@Test public void testAngle() { assertEquals( 90.0, getAngle(AxisDirection.WEST, AxisDirection.SOUTH), EPS); assertEquals(-90.0, getAngle(AxisDirection.SOUTH, AxisDirection.WEST), EPS); assertEquals( 45.0, getAngle(AxisDirection.SOUTH, AxisDirection.SOUTH_EAST), EPS); assertEquals(-22.5, getAngle(AxisDirection.NORTH_NORTH_WEST, AxisDirection.NORTH), EPS); }
public static double getAngle(final AxisDirection source, final AxisDirection target) { ensureNonNull("source", source); ensureNonNull("target", target); final int compass = getCompassAngle(source, target); if (compass != Integer.MIN_VALUE) { return compass * (360.0 / COMPASS_DIRECTION_COUNT); } final DirectionAlongMeridian src = DirectionAlongMeridian.parse(source); if (src != null) { final DirectionAlongMeridian tgt = DirectionAlongMeridian.parse(target); if (tgt != null) { return src.getAngle(tgt); } } return Double.NaN; }
DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implements CoordinateSystemAxis { public static double getAngle(final AxisDirection source, final AxisDirection target) { ensureNonNull("source", source); ensureNonNull("target", target); final int compass = getCompassAngle(source, target); if (compass != Integer.MIN_VALUE) { return compass * (360.0 / COMPASS_DIRECTION_COUNT); } final DirectionAlongMeridian src = DirectionAlongMeridian.parse(source); if (src != null) { final DirectionAlongMeridian tgt = DirectionAlongMeridian.parse(target); if (tgt != null) { return src.getAngle(tgt); } } return Double.NaN; } }
DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implements CoordinateSystemAxis { public static double getAngle(final AxisDirection source, final AxisDirection target) { ensureNonNull("source", source); ensureNonNull("target", target); final int compass = getCompassAngle(source, target); if (compass != Integer.MIN_VALUE) { return compass * (360.0 / COMPASS_DIRECTION_COUNT); } final DirectionAlongMeridian src = DirectionAlongMeridian.parse(source); if (src != null) { final DirectionAlongMeridian tgt = DirectionAlongMeridian.parse(target); if (tgt != null) { return src.getAngle(tgt); } } return Double.NaN; } DefaultCoordinateSystemAxis(final CoordinateSystemAxis axis);  DefaultCoordinateSystemAxis(final Map<String,?> properties,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit,
                                       final double        minimum,
                                       final double        maximum,
                                       final RangeMeaning  rangeMeaning);  DefaultCoordinateSystemAxis(final Map<String,?> properties,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit);  DefaultCoordinateSystemAxis(final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit);  DefaultCoordinateSystemAxis(final InternationalString name,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit); private  DefaultCoordinateSystemAxis(final int           name,
                                        final String        abbreviation,
                                        final AxisDirection direction,
                                        final Unit<?>       unit); }
DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implements CoordinateSystemAxis { public static double getAngle(final AxisDirection source, final AxisDirection target) { ensureNonNull("source", source); ensureNonNull("target", target); final int compass = getCompassAngle(source, target); if (compass != Integer.MIN_VALUE) { return compass * (360.0 / COMPASS_DIRECTION_COUNT); } final DirectionAlongMeridian src = DirectionAlongMeridian.parse(source); if (src != null) { final DirectionAlongMeridian tgt = DirectionAlongMeridian.parse(target); if (tgt != null) { return src.getAngle(tgt); } } return Double.NaN; } DefaultCoordinateSystemAxis(final CoordinateSystemAxis axis);  DefaultCoordinateSystemAxis(final Map<String,?> properties,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit,
                                       final double        minimum,
                                       final double        maximum,
                                       final RangeMeaning  rangeMeaning);  DefaultCoordinateSystemAxis(final Map<String,?> properties,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit);  DefaultCoordinateSystemAxis(final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit);  DefaultCoordinateSystemAxis(final InternationalString name,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit); private  DefaultCoordinateSystemAxis(final int           name,
                                        final String        abbreviation,
                                        final AxisDirection direction,
                                        final Unit<?>       unit); static DefaultCoordinateSystemAxis getPredefined(String name, AxisDirection direction); static AxisDirection getDirection(String direction); AxisDirection getDirection(); String getAbbreviation(); Unit<?> getUnit(); double getMinimumValue(); double getMaximumValue(); RangeMeaning getRangeMeaning(); static boolean isCompassDirection(final AxisDirection direction); static double getAngle(final AxisDirection source, final AxisDirection target); static boolean perpendicular(final AxisDirection first, final AxisDirection second); @Override boolean nameMatches(final String name); @Override boolean equals(final AbstractIdentifiedObject object, final boolean compareMetadata); @Override int hashCode(); }
DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implements CoordinateSystemAxis { public static double getAngle(final AxisDirection source, final AxisDirection target) { ensureNonNull("source", source); ensureNonNull("target", target); final int compass = getCompassAngle(source, target); if (compass != Integer.MIN_VALUE) { return compass * (360.0 / COMPASS_DIRECTION_COUNT); } final DirectionAlongMeridian src = DirectionAlongMeridian.parse(source); if (src != null) { final DirectionAlongMeridian tgt = DirectionAlongMeridian.parse(target); if (tgt != null) { return src.getAngle(tgt); } } return Double.NaN; } DefaultCoordinateSystemAxis(final CoordinateSystemAxis axis);  DefaultCoordinateSystemAxis(final Map<String,?> properties,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit,
                                       final double        minimum,
                                       final double        maximum,
                                       final RangeMeaning  rangeMeaning);  DefaultCoordinateSystemAxis(final Map<String,?> properties,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit);  DefaultCoordinateSystemAxis(final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit);  DefaultCoordinateSystemAxis(final InternationalString name,
                                       final String        abbreviation,
                                       final AxisDirection direction,
                                       final Unit<?>       unit); private  DefaultCoordinateSystemAxis(final int           name,
                                        final String        abbreviation,
                                        final AxisDirection direction,
                                        final Unit<?>       unit); static DefaultCoordinateSystemAxis getPredefined(String name, AxisDirection direction); static AxisDirection getDirection(String direction); AxisDirection getDirection(); String getAbbreviation(); Unit<?> getUnit(); double getMinimumValue(); double getMaximumValue(); RangeMeaning getRangeMeaning(); static boolean isCompassDirection(final AxisDirection direction); static double getAngle(final AxisDirection source, final AxisDirection target); static boolean perpendicular(final AxisDirection first, final AxisDirection second); @Override boolean nameMatches(final String name); @Override boolean equals(final AbstractIdentifiedObject object, final boolean compareMetadata); @Override int hashCode(); static final DefaultCoordinateSystemAxis GEODETIC_LONGITUDE; static final DefaultCoordinateSystemAxis GEODETIC_LATITUDE; static final DefaultCoordinateSystemAxis LONGITUDE; static final DefaultCoordinateSystemAxis LATITUDE; static final DefaultCoordinateSystemAxis ELLIPSOIDAL_HEIGHT; static final DefaultCoordinateSystemAxis GRAVITY_RELATED_HEIGHT; static final DefaultCoordinateSystemAxis ALTITUDE; static final DefaultCoordinateSystemAxis DEPTH; static final DefaultCoordinateSystemAxis GEOCENTRIC_RADIUS; static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE; static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE; static final DefaultCoordinateSystemAxis X; static final DefaultCoordinateSystemAxis Y; static final DefaultCoordinateSystemAxis Z; static final DefaultCoordinateSystemAxis GEOCENTRIC_X; static final DefaultCoordinateSystemAxis GEOCENTRIC_Y; static final DefaultCoordinateSystemAxis GEOCENTRIC_Z; static final DefaultCoordinateSystemAxis EASTING; static final DefaultCoordinateSystemAxis WESTING; static final DefaultCoordinateSystemAxis NORTHING; static final DefaultCoordinateSystemAxis SOUTHING; static final DefaultCoordinateSystemAxis TIME; static final DefaultCoordinateSystemAxis COLUMN; static final DefaultCoordinateSystemAxis ROW; static final DefaultCoordinateSystemAxis DISPLAY_X; static final DefaultCoordinateSystemAxis DISPLAY_Y; }