Package org.openstreetmap.josm.data.coor

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


        dialog.setCoordinates(n.getCoor());
        dialog.showDialog();
        if (dialog.getValue() != 1)
            return;

        LatLon coordinates = dialog.getCoordinates();
        if (coordinates == null)
            return;

        // move the node
        Main.main.undoRedo.add(new MoveCommand(n, coordinates));
View Full Code Here


            } else {
                Main.main.undoRedo.add(
                        c = new MoveCommand(selection, startEN, currentEN));
            }
            for (Node n : affectedNodes) {
                LatLon ll = n.getCoor();
                if (ll != null && ll.isOutSideWorld()) {
                    // Revert move
                    ((MoveCommand) c).resetToCheckpoint();
                    getCurrentDataSet().endUpdate();
                    JOptionPane.showMessageDialog(
                            Main.parent,
View Full Code Here

            if (!(p instanceof HistoryNode)) return;
            if (!(opposite instanceof HistoryNode)) return;
            HistoryNode node = (HistoryNode)p;
            HistoryNode oppositeNode = (HistoryNode) opposite;

            LatLon coord = node.getCoords();
            LatLon oppositeCoord = oppositeNode.getCoords();

            // display the coordinates
            //
            lblLat.setText(coord != null ? coord.latToString(CoordinateFormat.DECIMAL_DEGREES) : tr("(none)"));
            lblLon.setText(coord != null ? coord.lonToString(CoordinateFormat.DECIMAL_DEGREES) : tr("(none)"));

            // update background color to reflect differences in the coordinates
            //
            if (coord == oppositeCoord ||
                    (coord != null && oppositeCoord != null && coord.lat() == oppositeCoord.lat())) {
                lblLat.setBackground(Color.WHITE);
            } else {
                lblLat.setBackground(BGCOLOR_DIFFERENCE);
            }
            if (coord == oppositeCoord ||
                    (coord != null && oppositeCoord != null && coord.lon() == oppositeCoord.lon())) {
                lblLon.setBackground(Color.WHITE);
            } else {
                lblLon.setBackground(BGCOLOR_DIFFERENCE);
            }
        }
View Full Code Here

                return; // user canceled download or error occurred
            if (dataSet.allPrimitives().isEmpty()) {
                rememberErrorMessage(tr("No data found in this area."));
                // need to synthesize a download bounds lest the visual indication of downloaded
                // area doesn't work
                dataSet.dataSources.add(new DataSource(currentBounds != null ? currentBounds : new Bounds(new LatLon(0, 0)), "OpenStreetMap server"));
            }

            rememberDownloadedData(dataSet);
            int numDataLayers = getNumDataLayers();
            if (newLayer || numDataLayers == 0 || (numDataLayers > 1 && getEditLayer() == null)) {
View Full Code Here

            if (!(p instanceof HistoryNode)) return;
            if (!(opposite instanceof HistoryNode)) return;
            HistoryNode node = (HistoryNode) p;
            HistoryNode oppositeNode = (HistoryNode) opposite;

            LatLon coord = node.getCoords();
            LatLon oppositeCoord = oppositeNode.getCoords();

            // update distance
            //
            if (coord != null && oppositeCoord != null) {
                double distance = coord.greatCircleDistance(oppositeCoord);
View Full Code Here

     *
     * @param tb the description of the tile grid
     * @return the bounding box
     */
    protected Bounds convertTileBoundsToBoundingBox(TileBounds tb) {
        LatLon min = getNorthWestLatLonOfTile(tb.min, tb.zoomLevel);
        Point p = new Point(tb.max);
        p.x++;
        p.y++;
        LatLon max = getNorthWestLatLonOfTile(p, tb.zoomLevel);
        return new Bounds(max.lat(), min.lon(), min.lat(), max.lon());
    }
View Full Code Here

     * @return lat/lon of the north/west-corner of a tile at a specific zoom level
     */
    protected LatLon getNorthWestLatLonOfTile(Point tile, int zoom) {
        double lon =  tile.x / Math.pow(2.0, zoom) * 360.0 - 180;
        double lat =  Math.toDegrees(Math.atan(Math.sinh(Math.PI - (2.0 * Math.PI * tile.y) / Math.pow(2.0, zoom))));
        return new LatLon(lat, lon);
    }
View Full Code Here

        iSelectionRectEnd = pEnd;

        Coordinate l1 = getPosition(p_max); // lon may be outside [-180,180]
        Coordinate l2 = getPosition(p_min); // lon may be outside [-180,180]
        Bounds b = new Bounds(
                new LatLon(
                        Math.min(l2.getLat(), l1.getLat()),
                        LatLon.toIntervalLon(Math.min(l1.getLon(), l2.getLon()))
                        ),
                        new LatLon(
                                Math.max(l2.getLat(), l1.getLat()),
                                LatLon.toIntervalLon(Math.max(l1.getLon(), l2.getLon())))
                );
        Bounds oldValue = this.bbox;
        this.bbox = b;
View Full Code Here

    @Override
    public Bounds getWorldBoundsLatLon() {
        if (bounds != null) return bounds;
        return new Bounds(
            new LatLon(-90.0, -180.0),
            new LatLon(90.0, 180.0));
    }
View Full Code Here

            double l = Math.atan((xyz[2] / norm)
                    / (1.0 - (a * e2 * Math.cos(lt) / (norm * Math.sqrt(1.0 - e2 * s2)))));
            delta = Math.abs(l - lt);
            lt = l;
        }
        return new LatLon(Math.toDegrees(lt), Math.toDegrees(lg));
    }
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.