Examples of Angle


Examples of net.sf.myway.base.db.Angle

        n = nf.parse(s, pos);
        sec = n.doubleValue() / 3600.0;
        pos.setIndex(source.length());
      }
    }
    return new Angle(degree + min + sec);
  }
View Full Code Here

Examples of net.sf.myway.base.db.Angle

        n = nf.parse(s, pos);
        sec = n.doubleValue() / 3600.0;
        pos.setIndex(source.length());
      }
    }
    return new Angle(degree + min + sec);
  }
View Full Code Here

Examples of net.sf.myway.base.db.Angle

    throws ParseException {
    final MapNode n = new MapNode();
    final String osmId = node.attributeValue("id");
    lookup.put(osmId, n);
    n.addExtRef(SYSTEM_ID, osmId);
    n.setLatitude(new Angle(Double.parseDouble(node.attributeValue("lat"))));
    n.setLongitude(new Angle(Double.parseDouble(node.attributeValue("lon"))));
    n.setUser(node.attributeValue("user"));
    final String t = node.attributeValue("timestamp");
    final Date ts = parseTimestamp(t);
    final Calendar cal = Calendar.getInstance();
    cal.setTime(ts);
View Full Code Here

Examples of org.apache.sis.measure.Angle

     * Tests conversions to {@link Angle}.
     */
    @Test
    public void testAngle() {
        final ObjectConverter<String,Angle> c = new StringConverter.Angle();
        runInvertibleConversion(c, "42°30′00″", new Angle(42.5));
        tryUnconvertibleValue(c);
        assertSerializedEquals(c);
    }
View Full Code Here

Examples of org.apache.sis.measure.Angle

            return bijective();
        }

        /** Converts the given angle. */
        @Override public Angle apply(final Double object) {
            return new Angle(object);
        }
View Full Code Here

Examples of org.apache.sis.measure.Angle

        super(true);
        this.westBoundLongitude = westBoundLongitude;
        this.eastBoundLongitude = eastBoundLongitude;
        this.southBoundLatitude = southBoundLatitude;
        this.northBoundLatitude = northBoundLatitude;
        final Angle min, max;
        if (westBoundLongitude > eastBoundLongitude) {
            min = new Longitude(westBoundLongitude);
            max = new Longitude(eastBoundLongitude);
        } else if (southBoundLatitude > northBoundLatitude) {
            min = new Latitude(southBoundLatitude);
View Full Code Here

Examples of org.apache.sis.measure.Angle

                          final double southBoundLatitude,
                          final double northBoundLatitude)
            throws IllegalArgumentException
    {
        checkWritePermission();
        final Angle min, max;
        if (westBoundLongitude > eastBoundLongitude) {
            min = new Longitude(westBoundLongitude);
            max = new Longitude(eastBoundLongitude);
            // Exception will be thrown below.
        } else if (southBoundLatitude > northBoundLatitude) {
View Full Code Here

Examples of org.apache.sis.measure.Angle

         * Check for NORTH, SOUTH, EAST, EAST-NORTH-EAST, etc.
         * Checked first because this is the most common case.
         */
        int c = AxisDirections.angleForCompass(source, target);
        if (c != Integer.MIN_VALUE) {
            return new Angle(c * (360.0 / AxisDirections.COMPASS_COUNT));
        }
        /*
         * Check for GEOCENTRIC_X, GEOCENTRIC_Y, GEOCENTRIC_Z.
         */
        c = AxisDirections.angleForGeocentric(source, target);
        if (c != Integer.MIN_VALUE) {
            return new Angle(c * 90);
        }
        /*
         * Check for DISPLAY_UP, DISPLAY_DOWN, etc. assuming a flat screen.
         * Note that we do not check for grid directions (COLUMN_POSITIVE,
         * ROW_POSITIVE, etc.) because the grid geometry may be anything.
         */
        c = AxisDirections.angleForDisplay(source, target);
        if (c != Integer.MIN_VALUE) {
            return new Angle(c * (360 / AxisDirections.DISPLAY_COUNT));
        }
        /*
         * Check for "South along 90° East", etc. directions. Note that this
         * check may perform a relatively costly parsing of axis direction name.
         * (NOTE: the check for 'isUserDefined' is performed outside DirectionAlongMeridian for
         * avoiding class initialization of the later in the common case where we do not need it).
         */
        final DirectionAlongMeridian srcMeridian, tgtMeridian;
        srcMeridian = AxisDirections.isUserDefined(source) ? DirectionAlongMeridian.parse(source) : null;
        tgtMeridian = AxisDirections.isUserDefined(target) ? DirectionAlongMeridian.parse(target) : null;
        if (srcMeridian != null && tgtMeridian != null) {
            return new Angle(srcMeridian.angle(tgtMeridian));
        }
        /*
         * Check for UP and DOWN, with special case if one of the direction is horizontal
         * (either a compass direction of a direction along a meridian).
         */
        final boolean srcVrt = AxisDirections.isVertical(source);
        final boolean tgtVrt = AxisDirections.isVertical(target);
        if (tgtVrt) {
            if (srcVrt) {
                return new Angle(source.equals(target) ? 0 : target.equals(AxisDirection.UP) ? 180 : -180);
            } else if (AxisDirections.isCompass(source) || srcMeridian != null) {
                return target.equals(AxisDirection.UP) ? ElevationAngle.ZENITH : ElevationAngle.NADIR;
            }
        } else if (srcVrt) {
            if (AxisDirections.isCompass(target) || tgtMeridian != null) {
View Full Code Here

Examples of org.apache.sis.measure.Angle

     */
    @Test
    public void testDouble() {
        final ObjectConverter<Angle,Double> c1 = AngleConverter.INSTANCE;
        final ObjectConverter<Double,Angle> c2 = AngleConverter.Inverse.INSTANCE;
        final Angle  v1 = new Angle (30.25);
        final Double v2 = new Double(30.25);
        assertEquals(v2, c1.apply(v1));
        assertEquals(v1, c2.apply(v2));
        assertSame(c2, c1.inverse());
        assertSame(c1, c2.inverse());
View Full Code Here

Examples of org.apache.sis.measure.Angle

     * Tests conversions to {@link Angle}.
     */
    @Test
    public void testAngle() {
        final ObjectConverter<String,Angle> c = new StringConverter.Angle();
        runInvertibleConversion(c, "42°30′",       new Angle(42.5));
        runInvertibleConversion(c, "42°30′56.25″", new Angle(42.515625));
        tryUnconvertibleValue(c);
        assertSerializedEquals(c);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.