Package org.openstreetmap.josm.data.coor

Examples of org.openstreetmap.josm.data.coor.LatLon


    public double getBottomRightLon() {
        return xmax;
    }

    public LatLon getCenter() {
        return new LatLon(ymin + (ymax-ymin)/2.0, xmin + (xmax-xmin)/2.0);
    }
View Full Code Here


        // list all imagery entries where the current map location
        // is within the imagery bounds
        if (Main.isDisplayingMapView()) {
            MapView mv = Main.map.mapView;
            LatLon pos = mv.getProjection().eastNorth2latlon(mv.getCenter());
            final Set<ImageryInfo> inViewLayers = new TreeSet<>();

            for (ImageryInfo i : ImageryLayerInfo.instance.getDefaultLayers()) {
                if (i.getBounds() != null && i.getBounds().contains(pos)) {
                    inViewLayers.add(i);
View Full Code Here

    }

    public void searchNodes() {
        for (Node n:dataSet.getNodes()) {
            if (!n.isIncomplete() && !n.isDeleted()) {
                LatLon c = n.getCoor();
                if (c != null) {
                    BBox box = c.toBBox(0.0001);
                    if (!dataSet.searchNodes(box).contains(n)) {
                        printError("SEARCH NODES", "%s not found using Dataset.searchNodes()", n);
                    }
                }
            }
View Full Code Here

        if (name == null) {
            sb.append(node.getId());
        } else {
            sb.append(name);
        }
        LatLon coord = node.getCoords();
        if (coord != null) {
            sb.append(" (")
            .append(coord.latToString(CoordinateFormat.getDefaultFormat()))
            .append(", ")
            .append(coord.lonToString(CoordinateFormat.getDefaultFormat()))
            .append(")");
        }
        decorateNameWithId(sb, node);
        return sb.toString();
    }
View Full Code Here

                delta += 2*Math.PI;
            for(int j = 0; j < count[i]; j++) {
                double alpha = angles[i].a + (j+1)*delta/(count[i]+1);
                double x = center.east() + r*Math.cos(alpha);
                double y = center.north() + r*Math.sin(alpha);
                LatLon ll = Main.getProjection().eastNorth2latlon(new EastNorth(x,y));
                if (ll.isOutSideWorld()) {
                    notifyNodesNotOnCircle();
                    return;
                }
                Node n = new Node(ll);
                wayToAdd.add(n);
View Full Code Here

    private static class NodeHash implements Hash<Object, Object> {

        private double precision = Main.pref.getDouble("validator.duplicatenodes.precision", 0.);

        private LatLon roundCoord(LatLon coor) {
            return new LatLon(
                    Math.round(coor.lat() / precision) * precision,
                    Math.round(coor.lon() / precision) * precision
                    );
        }
View Full Code Here

        }

        @SuppressWarnings("unchecked")
        private LatLon getLatLon(Object o) {
            if (o instanceof Node) {
                LatLon coor = ((Node) o).getCoor();
                if (coor == null)
                    return null;
                if (precision==0)
                    return coor.getRoundedToOsmPrecision();
                return roundCoord(coor);
            } else if (o instanceof List<?>) {
                LatLon coor = ((List<Node>) o).get(0).getCoor();
                if (coor == null)
                    return null;
                if (precision==0)
                    return coor.getRoundedToOsmPrecision();
                return roundCoord(coor);
            } else
                throw new AssertionError();
        }
View Full Code Here

                throw new AssertionError();
        }

        @Override
        public boolean equals(Object k, Object t) {
            LatLon coorK = getLatLon(k);
            LatLon coorT = getLatLon(t);
            return coorK == coorT || (coorK != null && coorT != null && coorK.equals(coorT));
        }
View Full Code Here

            return coorK == coorT || (coorK != null && coorT != null && coorK.equals(coorT));
        }

        @Override
        public int getHashCode(Object k) {
            LatLon coorK = getLatLon(k);
            return coorK == null ? 0 : coorK.hashCode();
        }
View Full Code Here

        }

        @Override
        public void visit(INode n) {
            geomObj.add("type", "Point");
            LatLon ll = n.getCoor();
            if (ll != null) {
                geomObj.add("coordinates", getCoorArray(n.getCoor()));
            }
        }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.coor.LatLon

Copyright © 2018 www.massapicom. 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.