Package org.openstreetmap.josm.data.coor

Examples of org.openstreetmap.josm.data.coor.EastNorth.east()


        AudioMarker recent = AudioMarker.recentlyPlayedMarker();
        if (recent != null && recent.parentLayer != null && recent.parentLayer.fromLayer != null) {
            /* work out EastNorth equivalent of 50 (default) pixels tolerance */
            Point p = Main.map.mapView.getPoint(en);
            EastNorth enPlus25px = Main.map.mapView.getEastNorth(p.x+dropTolerance, p.y);
            cw = recent.parentLayer.fromLayer.data.nearestPointOnTrack(en, enPlus25px.east() - en.east());
        }

        AudioMarker ca = null;
        /* Find the prior audio marker (there should always be one in the
         * layer, even if it is only one at the start of the track) to
View Full Code Here


        /* If we didn't hit an audio marker, we need to create one at the nearest point on the track */
        if (ca == null) {
            /* work out EastNorth equivalent of 50 (default) pixels tolerance */
            Point p = Main.map.mapView.getPoint(en);
            EastNorth enPlus25px = Main.map.mapView.getEastNorth(p.x+dropTolerance, p.y);
            WayPoint cw = recent.parentLayer.fromLayer.data.nearestPointOnTrack(en, enPlus25px.east() - en.east());
            if (cw == null) {
                JOptionPane.showMessageDialog(
                        Main.parent,
                        tr("You need to SHIFT-drag the play head onto an audio marker or onto the track point where you want to synchronize."),
                        tr("Warning"),
View Full Code Here

                Projection p = Projections.getProjectionByCode(code);
                EastNorth en = p.latlon2eastNorth(new LatLon(lat, lon));
                String errorEN = String.format("%s (%s): Projecting latlon(%s,%s):%n" +
                        "        expected: eastnorth(%s,%s),%n" +
                        "        but got:  eastnorth(%s,%s)!%n",
                        p.toString(), code, lat, lon, east, north, en.east(), en.north());
                final double EPSILON_EN = SwissGridTest.SWISS_EPSG_CODE.equals(code)
                        ? SwissGridTest.EPSILON_APPROX
                        : 1e-3; // 1 mm accuracy
                if (Math.abs(east - en.east()) > EPSILON_EN || Math.abs(north - en.north()) > EPSILON_EN) {
                    fail.append(errorEN);
View Full Code Here

                        "        but got:  eastnorth(%s,%s)!%n",
                        p.toString(), code, lat, lon, east, north, en.east(), en.north());
                final double EPSILON_EN = SwissGridTest.SWISS_EPSG_CODE.equals(code)
                        ? SwissGridTest.EPSILON_APPROX
                        : 1e-3; // 1 mm accuracy
                if (Math.abs(east - en.east()) > EPSILON_EN || Math.abs(north - en.north()) > EPSILON_EN) {
                    fail.append(errorEN);
                }
                LatLon ll = p.eastNorth2latlon(new EastNorth(east, north));
                String errorLL = String.format("%s (%s): Inverse projecting eastnorth(%s,%s):%n" +
                        "        expected: latlon(%s,%s),%n" +
View Full Code Here

    public void projReferenceTest(final double epsilon) {
        Projection swiss = Projections.getProjectionByCode("EPSG:21781"); // Swiss grid
        StringBuilder errs = new StringBuilder();
        for (ProjData pd : data) {
            EastNorth en2 = swiss.latlon2eastNorth(pd.ll);
            if (Math.abs(pd.en.east() - en2.east()) > epsilon || Math.abs(pd.en.north() - en2.north()) > epsilon) {
                errs.append(String.format("%s should be: %s but is: %s%n", pd.name, pd.en, en2));
            }
        }
        assertTrue(errs.toString(), errs.length() == 0);
    }
View Full Code Here

            LatLon ll = new LatLon(46.518, 6.567);
            EastNorth en = Main.getProjection().latlon2eastNorth(ll);
            if (debug) {
                System.out.println(en);
            }
            assertTrue("Lausanne", Math.abs(en.east() - 533111.69) < 0.1);
            assertTrue("Lausanne", Math.abs(en.north() - 152227.85) < 0.1);
        }

        {
            LatLon ll = new LatLon(47.78, 8.58);
View Full Code Here

            LatLon ll = new LatLon(47.78, 8.58);
            EastNorth en = Main.getProjection().latlon2eastNorth(ll);
            if (debug) {
                System.out.println(en);
            }
            assertTrue("Schafouse", Math.abs(en.east() - 685544.16) < 0.1);
            assertTrue("Schafouse", Math.abs(en.north() - 292782.91) < 0.1);
        }

        {
            LatLon ll = new LatLon(46.58, 10.48);
View Full Code Here

            LatLon ll = new LatLon(46.58, 10.48);
            EastNorth en = Main.getProjection().latlon2eastNorth(ll);
            if (debug) {
                System.out.println(en);
            }
            assertTrue("Grinson", Math.abs(en.east() - 833068.04) < 0.1);
            assertTrue("Grinson", Math.abs(en.north() - 163265.39) < 0.1);
        }

        {
            LatLon ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600);
View Full Code Here

            LatLon ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600);
            EastNorth en = Main.getProjection().latlon2eastNorth(ll);
            if (debug) {
                System.out.println(en);
            }
            assertTrue("Berne", Math.abs(en.east() - 600000.0) < 0.1);
            assertTrue("Berne", Math.abs(en.north() - 200000.0) < 0.1);
        }
        {
            LatLon ll = new LatLon(46.0 + 2.0 / 60 + 38.87 / 3600, 8.0 + 43.0 / 60 + 49.79 / 3600);
            EastNorth en = Main.getProjection().latlon2eastNorth(ll);
View Full Code Here

            LatLon ll = new LatLon(46.0 + 2.0 / 60 + 38.87 / 3600, 8.0 + 43.0 / 60 + 49.79 / 3600);
            EastNorth en = Main.getProjection().latlon2eastNorth(ll);
            if (debug) {
                System.out.println(en);
            }
            assertTrue("Ref", Math.abs(en.east() - 700000.0) < 0.1);
            assertTrue("Ref", Math.abs(en.north() - 100000.0) < 0.1);
        }
    }

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.