Changeset 35976 in osm for applications/editors
- Timestamp:
- 2022-06-14T20:11:21+02:00 (2 years ago)
- Location:
- applications/editors/josm/plugins
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/CommandLine/src/org/openstreetmap/josm/plugins/commandline/LengthAction.java
r35942 r35976 137 137 mousePos = e.getPoint(); 138 138 if (nearestNode != null) { 139 drawStartPos = MainApplication.getMap().mapView.getPoint(nearestNode .getCoor());139 drawStartPos = MainApplication.getMap().mapView.getPoint(nearestNode); 140 140 } else { 141 141 drawStartPos = mousePos; … … 186 186 MapFrame map = MainApplication.getMap(); 187 187 if (nearestNode != null) 188 drawEndPos = map.mapView.getPoint(nearestNode .getCoor());188 drawEndPos = map.mapView.getPoint(nearestNode); 189 189 else 190 190 drawEndPos = mousePos; -
applications/editors/josm/plugins/CommandLine/src/org/openstreetmap/josm/plugins/commandline/PointAction.java
r35297 r35976 76 76 if (e.getButton() == MouseEvent.BUTTON1) { 77 77 if (isCtrlDown) { 78 if ( pointList.size() > 0) {78 if (!pointList.isEmpty()) { 79 79 pointList.remove(pointList.size() - 1); 80 80 updateTextEdit(); … … 88 88 return; 89 89 } 90 LatLon coor = node.getCoor(); 91 String point = String.valueOf(coor.getX()) + "," + String.valueOf(coor.getY()); 90 String point = node.lon() + "," + node.lat(); 92 91 int maxInstances = parentPlugin.currentCommand.parameters.get(parentPlugin.currentCommand.currentParameterNum).maxInstances; 93 92 if (maxInstances == 1) { -
applications/editors/josm/plugins/Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java
r35583 r35976 16 16 import org.openstreetmap.josm.command.SequenceCommand; 17 17 import org.openstreetmap.josm.data.UndoRedoHandler; 18 import org.openstreetmap.josm.data.coor.ILatLon; 18 19 import org.openstreetmap.josm.data.coor.LatLon; 19 20 import org.openstreetmap.josm.data.osm.DataSet; … … 85 86 int c1=0,c2; 86 87 double latDif,lonDif; 87 LatLon llc = nodeCommon.getCoor();88 ILatLon llc = nodeCommon; 88 89 for (Node n1 : nodesWay1) { 89 LatLon ll1 = n1.getCoor();90 if ( ll1 == null || llc == null) {90 ILatLon ll1 = n1; 91 if (!ll1.isLatLonKnown() || !llc.isLatLonKnown()) { 91 92 Logging.warn("Null coordinates: {0} / {1}", n1, nodeCommon); 92 93 continue; … … 106 107 continue; 107 108 } 108 LatLon ll2 = n2.getCoor();109 ILatLon ll2 = n2; 109 110 Node nodeOfGrid = new Node(new LatLon(ll2.lat()+latDif, ll2.lon()+lonDif)); 110 111 cmds.add(new AddCommand(ds, nodeOfGrid)); -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/org/openstreetmap/josm/plugins/customizepublictransportstop/StopAreaOperationBase.java
r34501 r35976 115 115 if (platform instanceof Way) { 116 116 // p = mapView.getPoint((Node) stopArea.selectedObject); 117 Double sumLat = 0.0;118 Double sumLon = 0.0;119 Integer countNode = 0;117 double sumLat = 0.0; 118 double sumLon = 0.0; 119 final int countNode = ((Way) platform).getNodesCount(); 120 120 for (Node node : ((Way) platform).getNodes()) { 121 LatLon coord = node.getCoor(); 122 sumLat += coord.getX(); 123 sumLon += coord.getY(); 124 countNode++; 121 sumLat += node.lat(); 122 sumLon += node.lon(); 125 123 } 126 124 return new LatLon(sumLon / countNode, sumLat / countNode); -
applications/editors/josm/plugins/FixAddresses/src/org/openstreetmap/josm/plugins/fixAddresses/gui/AddressEditDialog.java
r34880 r35976 275 275 276 276 for (Node node : way.getNodes()) { 277 mapViewer.addMapMarker(new MapMarkerDot(Color.GREEN, node. getCoor().lat(), node.getCoor().lon()));277 mapViewer.addMapMarker(new MapMarkerDot(Color.GREEN, node.lat(), node.lon())); 278 278 } 279 279 } -
applications/editors/josm/plugins/comfort0/build.xml
r35765 r35976 3 3 4 4 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 5 <property name="plugin.main.version" value=" 9229"/>5 <property name="plugin.main.version" value="12164"/> 6 6 <property name="plugin.canloadatruntime" value="true"/> 7 7 -
applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/OsmToLevel0L.java
r35585 r35976 3 3 import java.util.Collection; 4 4 5 import org.openstreetmap.josm.data.coor. LatLon;5 import org.openstreetmap.josm.data.coor.ILatLon; 6 6 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 7 7 import org.openstreetmap.josm.data.osm.KeyValueVisitor; … … 79 79 sb.append(p.getType().getAPIName()).append(" ").append(p.getUniqueId()); 80 80 if (p instanceof Node) { 81 final LatLon latLon = ((Node) p).getCoor();82 if (latLon != null) {81 final ILatLon latLon = (Node) p; 82 if (latLon.isLatLonKnown()) { 83 83 sb.append(": ").append(latLon.lat()).append(", ").append(latLon.lon()); 84 84 } -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/data/JOSMDataSource.java
r33842 r35976 29 29 @Override 30 30 public double getLat(Node node) { 31 return node. getCoor().lat();31 return node.lat(); 32 32 } 33 33 34 34 @Override 35 35 public double getLon(Node node) { 36 return node. getCoor().lon();36 return node.lon(); 37 37 } 38 38 -
applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/actions/ComputeBoundsAction.java
r35723 r35976 23 23 import javax.swing.AbstractAction; 24 24 25 import org.openstreetmap.josm.data.coor. LatLon;25 import org.openstreetmap.josm.data.coor.ILatLon; 26 26 import org.openstreetmap.josm.data.osm.BBox; 27 27 import org.openstreetmap.josm.data.osm.IPrimitive; … … 342 342 } 343 343 344 protected static finalboolean areNodeListAndBboxEqual(List<Node> nodes, BBox bBox) {344 protected static boolean areNodeListAndBboxEqual(List<Node> nodes, BBox bBox) { 345 345 if (nodes.size() == 5) { 346 346 Map<Double, List<Integer>> latMap = new HashMap<>(); 347 347 Map<Double, List<Integer>> lonMap = new HashMap<>(); 348 348 349 for (int i =0; i<4; i++) {350 LatLon c = nodes.get(i).getCoor();349 for (int i = 0; i < 4; i++) { 350 ILatLon c = nodes.get(i); 351 351 if (i > 1) { 352 LatLon b = nodes.get(i-1).getCoor();352 ILatLon b = nodes.get(i - 1); 353 353 if (b.lat() != c.lat() && b.lon() != c.lon()) { 354 354 return false; 355 355 } 356 356 } 357 List<Integer> latList = latMap.get(c.lat()); 358 if (latList == null) { 359 latList = new ArrayList<>(); 360 latMap.put(c.lat(), latList); 361 } 357 List<Integer> latList = latMap.computeIfAbsent(c.lat(), lat -> new ArrayList<>(1)); 362 358 latList.add(i); 363 List<Integer> lonList = lonMap.get(c.lon()); 364 if (lonList == null) { 365 lonList = new ArrayList<>(); 366 lonMap.put(c.lon(), lonList); 367 } 359 List<Integer> lonList = lonMap.computeIfAbsent(c.lon(), lon -> new ArrayList<>(1)); 368 360 lonList.add(i); 369 361 } … … 392 384 } 393 385 394 protected static finalString getNodeListShape(List<Node> nodes) {386 protected static String getNodeListShape(List<Node> nodes) { 395 387 StringBuilder result = new StringBuilder(" <shape>\n"); 396 388 int size = nodes.size(); … … 402 394 if (j == size) 403 395 j = 0; 404 LatLon ll = nodes.get(i).getCoor();396 ILatLon ll = nodes.get(i); 405 397 result.append("<point lat='") 406 398 .append(DF.format(ll.lat())).append("' lon='") -
applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/SvgImportTask.java
r35975 r35976 137 137 break; 138 138 case PathIterator.SEG_CLOSE: 139 if (currentway.firstNode(). getCoor().equalsEpsilon(nodes.getLast().getCoor(), ILatLon.MAX_SERVER_PRECISION)) {139 if (currentway.firstNode().equalsEpsilon(nodes.getLast(), ILatLon.MAX_SERVER_PRECISION)) { 140 140 currentway.removeNode(nodes.removeLast()); 141 141 } -
applications/editors/josm/plugins/jts/build.xml
r35884 r35976 4 4 <property name="commit.message" value="Commit message"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 0580"/>6 <property name="plugin.main.version" value="12164"/> 7 7 8 8 <property name="plugin.author" value="Josh Doe <josh@joshdoe.com>"/> -
applications/editors/josm/plugins/jts/src/org/openstreetmap/josm/plugins/jts/JTSConverter.java
r35122 r35976 71 71 return new Coordinate(node.getEastNorth().getX(), node.getEastNorth().getY()); 72 72 else 73 return new Coordinate(node. getCoor().getX(), node.getCoor().getY());73 return new Coordinate(node.lon(), node.lat()); 74 74 } 75 75 -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.java
r35579 r35976 209 209 } else { 210 210 length += lastNode.getCoor().greatCircleDistance(n.getCoor()); 211 segAngle = MeasurementLayer.angleBetween(lastNode .getCoor(), n.getCoor());211 segAngle = MeasurementLayer.angleBetween(lastNode, n); 212 212 lastNode = n; 213 213 } … … 235 235 wayArea += (MeasurementLayer.calcX(n.getCoor()) * MeasurementLayer.calcY(lastN.getCoor())) 236 236 - (MeasurementLayer.calcY(n.getCoor()) * MeasurementLayer.calcX(lastN.getCoor())); 237 segAngle = MeasurementLayer.angleBetween(lastN .getCoor(), n.getCoor());237 segAngle = MeasurementLayer.angleBetween(lastN, n); 238 238 } 239 239 lastN = n; -
applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java
r35369 r35976 2 2 package org.openstreetmap.josm.plugins.measurement; 3 3 /// @author Raphael Mack <ramack@raphael-mack.de> 4 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 28 29 29 30 import org.openstreetmap.josm.data.Bounds; 31 import org.openstreetmap.josm.data.coor.ILatLon; 30 32 import org.openstreetmap.josm.data.coor.LatLon; 31 33 import org.openstreetmap.josm.data.gpx.IGpxTrack; … … 171 173 } 172 174 173 public static double angleBetween( LatLon p1,LatLon p2){175 public static double angleBetween(ILatLon p1, ILatLon p2){ 174 176 double lat1, lon1, lat2, lon2; 175 177 double dlon; -
applications/editors/josm/plugins/namemanager/src/org/openstreetmap/josm/plugins/namemanager/utils/NameManagerUtils.java
r34532 r35976 60 60 } 61 61 pairs: for (Pair<Node, Node> pair : way.getNodePairs(false)) { 62 double x1Pair = pair.a. getCoor().getX();63 double y1Pair = pair.a. getCoor().getY();64 double x2Pair = pair.b. getCoor().getX();65 double y2Pair = pair.b. getCoor().getY();62 double x1Pair = pair.a.lon(); 63 double y1Pair = pair.a.lat(); 64 double x2Pair = pair.b.lon(); 65 double y2Pair = pair.b.lat(); 66 66 double aPair = 0.0; 67 67 double bPair = 0.0; … … 77 77 int crossCount = 0; 78 78 areaLine: for (Pair<Node, Node> areaLine : areaBorderLines) { 79 double x1Line = areaLine.a. getCoor().getX();80 double y1Line = areaLine.a. getCoor().getY();81 double x2Line = areaLine.b. getCoor().getX();82 double y2Line = areaLine.b. getCoor().getY();79 double x1Line = areaLine.a.lon(); 80 double y1Line = areaLine.a.lat(); 81 double x2Line = areaLine.b.lon(); 82 double y2Line = areaLine.b.lat(); 83 83 boolean areaLinePerpendicular = false; 84 84 double aLine = 0.0; … … 178 178 } 179 179 if (raySource != null) { 180 double rsX = raySource. getCoor().getX();181 double rsY = raySource. getCoor().getY();180 double rsX = raySource.lon(); 181 double rsY = raySource.lat(); 182 182 if (areaLinePerpendicular) { 183 183 if (x1Line == x2Line) { … … 218 218 List<Node> nodes = way.getNodes(); 219 219 for (Node node : nodes) { 220 if (node. getCoor().getX() < x) {221 x = node. getCoor().getX();222 } 223 if (node. getCoor().getY() > y) {224 y = node. getCoor().getY();220 if (node.lon() < x) { 221 x = node.lon(); 222 } 223 if (node.lat() > y) { 224 y = node.lat(); 225 225 } 226 226 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r35975 r35976 6 6 import java.awt.Component; 7 7 import java.awt.GraphicsEnvironment; 8 import java.awt.Point;9 8 import java.io.IOException; 10 9 import java.io.InputStream; … … 25 24 import javax.swing.Icon; 26 25 import javax.swing.JOptionPane; 27 import javax.xml.crypto.dsig.TransformException;28 26 29 27 import org.geotools.geometry.jts.JTS; … … 37 35 import org.geotools.util.factory.Hints; 38 36 import org.locationtech.jts.geom.LineString; 37 import org.locationtech.jts.geom.Point; 39 38 import org.opengis.geometry.MismatchedDimensionException; 40 39 import org.opengis.referencing.FactoryException; … … 44 43 import org.opengis.referencing.crs.ProjectedCRS; 45 44 import org.opengis.referencing.cs.CoordinateSystem; 45 import org.opengis.referencing.datum.Datum; 46 46 import org.opengis.referencing.operation.MathTransform; 47 47 import org.opengis.referencing.operation.OperationNotFoundException; 48 import org.opengis.referencing.operation.TransformException; 48 49 import org.openstreetmap.josm.data.coor.ILatLon; 49 50 import org.openstreetmap.josm.data.coor.LatLon; … … 54 55 import org.openstreetmap.josm.data.osm.RelationMember; 55 56 import org.openstreetmap.josm.data.osm.Way; 56 import org.openstreetmap.josm.data.projection.datum.Datum;57 57 import org.openstreetmap.josm.data.validation.tests.DuplicateWay; 58 58 import org.openstreetmap.josm.gui.ExtendedDialog; … … 113 113 LatLon ll = new LatLon(p.getY(), p.getX()); 114 114 for (Node node : nodes.values()) { 115 if (node. getCoor().equalsEpsilon(ll, ILatLon.MAX_SERVER_PRECISION)) {115 if (node.equalsEpsilon(ll, ILatLon.MAX_SERVER_PRECISION)) { 116 116 return node; 117 117 } … … 261 261 CoordinateSystem cs2 = crs2.getCoordinateSystem(); 262 262 if (!compareDebug("cs", cs1, cs2)) { 263 Integerdim1 = cs1.getDimension();264 Integerdim2 = cs2.getDimension();263 int dim1 = cs1.getDimension(); 264 int dim2 = cs2.getDimension(); 265 265 if (compareDebug("cs.dim", dim1, dim2)) { 266 266 for (int i = 0; i < dim1; i++) { … … 397 397 } 398 398 399 if ( candidates.size() > 0) {399 if (!candidates.isEmpty()) { 400 400 CoordinateReferenceSystem newCRS = candidates.get(0); 401 401 try { -
applications/editors/josm/plugins/pdfimport/src/org/openstreetmap/josm/plugins/pdfimport/FilePlacement18.java
r35817 r35976 27 27 28 28 import org.openstreetmap.josm.data.coor.EastNorth; 29 import org.openstreetmap.josm.data.coor. LatLon;29 import org.openstreetmap.josm.data.coor.ILatLon; 30 30 import org.openstreetmap.josm.data.osm.Node; 31 31 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 307 307 } 308 308 309 LatLon ll = ((Node) selected.iterator().next()).getCoor();309 ILatLon ll = ((Node) selected.iterator().next()); 310 310 return new EastNorth(ll.lon() * 1000, ll.lat() * 1000); 311 311 } -
applications/editors/josm/plugins/poly/src/poly/PolyExporter.java
r34991 r35976 102 102 103 103 for (Node n : w.getNodes()) { 104 writer.println(String.format(Locale.ENGLISH, " %f %f", n. getCoor().lon(), n.getCoor().lat()));104 writer.println(String.format(Locale.ENGLISH, " %f %f", n.lon(), n.lat())); 105 105 } 106 106 writer.println("END"); -
applications/editors/josm/plugins/public_transport/src/org/openstreetmap/josm/plugins/public_transport/actions/RoutePatternAction.java
r34718 r35976 1868 1868 if ("backward".equals(itineraryData.getValueAt(i, 1))) { 1869 1869 for (int j = way.getNodesCount() - 2; j >= 0; --j) { 1870 SegmentMetric sm = new SegmentMetric(way.getNode(j + 1). getCoor().lat(),1871 way.getNode(j + 1). getCoor().lon(),1872 way.getNode(j). getCoor().lat(), way.getNode(j).getCoor().lon(),1870 SegmentMetric sm = new SegmentMetric(way.getNode(j + 1).lat(), 1871 way.getNode(j + 1).lon(), 1872 way.getNode(j).lat(), way.getNode(j).lon(), 1873 1873 distance); 1874 1874 segmentMetrics.add(sm); … … 1877 1877 } else { 1878 1878 for (int j = 0; j < way.getNodesCount() - 1; ++j) { 1879 SegmentMetric sm = new SegmentMetric(way.getNode(j). getCoor().lat(),1880 way.getNode(j). getCoor().lon(),1881 way.getNode(j + 1). getCoor().lat(),1882 way.getNode(j + 1). getCoor().lon(), distance);1879 SegmentMetric sm = new SegmentMetric(way.getNode(j).lat(), 1880 way.getNode(j).lon(), 1881 way.getNode(j + 1).lat(), 1882 way.getNode(j + 1).lon(), distance); 1883 1883 segmentMetrics.add(sm); 1884 1884 distance += sm.length; … … 1894 1894 private StopReference detectMinDistance(Node node, Vector<SegmentMetric> segmentMetrics, 1895 1895 boolean rhsPossible, boolean lhsPossible) { 1896 if (node == null || node.getCoor() == null)1896 if (node == null || !node.isLatLonKnown()) 1897 1897 return null; 1898 1898 … … 1900 1900 double position = -1.0; 1901 1901 double distance = 180.0; 1902 double lat = node. getCoor().lat();1903 double lon = node. getCoor().lon();1902 double lat = node.lat(); 1903 double lon = node.lon(); 1904 1904 1905 1905 int curIndex = -2; -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java
r35829 r35976 52 52 return false; 53 53 for (Node n : way.getNodes()) { 54 LatLon ll = n.getCoor(); 55 if (n.isIncomplete() || (a != null && !a.contains(ll.getX(), ll.getY()))) 54 if (n.isIncomplete() || (a != null && !a.contains(n.lon(), n.lat()))) 56 55 return false; 57 56 } -
applications/editors/josm/plugins/reverter/src/reverter/ChangesetReverter.java
r35846 r35976 499 499 try { 500 500 for (Node n : nodes) { 501 if (!n.isDeleted() && n.getCoor() == null) {501 if (!n.isDeleted() && !n.isLatLonKnown()) { 502 502 PrimitiveId id = n.getPrimitiveId(); 503 503 OsmPrimitive p = ds.getPrimitiveById(id); -
applications/editors/josm/plugins/simplifyarea/src/org/openstreetmap/josm/plugins/simplifyarea/SimplifyAreaAction.java
r35579 r35976 56 56 private static boolean isInBounds(final Node node, final List<Bounds> bounds) { 57 57 for (final Bounds b : bounds) { 58 if (b.contains(node .getCoor())) {58 if (b.contains(node)) { 59 59 return true; 60 60 } -
applications/editors/josm/plugins/terracer/src/org/openstreetmap/josm/plugins/terracer/TerracerAction.java
r35975 r35976 758 758 */ 759 759 private double calculateSideness(Node a, Node b, Node c, Node d) { 760 final double ndx = b. getCoor().getX() - a.getCoor().getX();761 final double pdx = d. getCoor().getX() - c.getCoor().getX();762 final double ndy = b. getCoor().getY() - a.getCoor().getY();763 final double pdy = d. getCoor().getY() - c.getCoor().getY();760 final double ndx = b.lon() - a.lon(); 761 final double pdx = d.lon() - c.lon(); 762 final double ndy = b.lat() - a.lat(); 763 final double pdy = d.lat() - c.lat(); 764 764 765 765 return (ndx * pdx + ndy * pdy) … … 780 780 private Node interpolateNode(Node a, Node b, double f) { 781 781 Node n = new Node(a.getEastNorth().interpolate(b.getEastNorth(), f)); 782 LatLon latLon = n.getCoor(); 783 if (latLon.equalsEpsilon(a.getCoor(), ILatLon.MAX_SERVER_PRECISION)) 782 if (n.equalsEpsilon(a, ILatLon.MAX_SERVER_PRECISION)) 784 783 return a; 785 if ( latLon.equalsEpsilon(b.getCoor(), ILatLon.MAX_SERVER_PRECISION))784 if (n.equalsEpsilon(b, ILatLon.MAX_SERVER_PRECISION)) 786 785 return b; 787 786 return n; -
applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/ConnectWays.java
r35975 r35976 49 49 LatLon ll = n.getCoor(); 50 50 BBox bbox = new BBox( 51 ll.getX() - MIN_DISTANCE,52 ll.getY() - MIN_DISTANCE,53 ll.getX() + MIN_DISTANCE,54 ll.getY() + MIN_DISTANCE);51 n.lon() - MIN_DISTANCE, 52 n.lat() - MIN_DISTANCE, 53 n.lon() + MIN_DISTANCE, 54 n.lat() + MIN_DISTANCE); 55 55 56 56 // bude se node slucovat s jinym? … … 129 129 LatLon ll = node.getCoor(); 130 130 BBox bbox = new BBox( 131 ll.getX() - MIN_DISTANCE_TW,132 ll.getY() - MIN_DISTANCE_TW,133 ll.getX() + MIN_DISTANCE_TW,134 ll.getY() + MIN_DISTANCE_TW);131 node.lon() - MIN_DISTANCE_TW, 132 node.lat() - MIN_DISTANCE_TW, 133 node.lon() + MIN_DISTANCE_TW, 134 node.lat() + MIN_DISTANCE_TW); 135 135 136 136 // node nebyl slouceny s jinym … … 188 188 while (i < way.getNodesCount()) { 189 189 // usecka n1, n2 190 LatLon n1 = way.getNodes().get(i).getCoor();191 LatLon n2 = way.getNodes().get((i + 1) % way.getNodesCount()).getCoor();190 Node n1 = way.getNodes().get(i); 191 Node n2 = way.getNodes().get((i + 1) % way.getNodesCount()); 192 192 System.out.println(way.getNodes().get(i) + "-----" + way.getNodes().get((i + 1) % way.getNodesCount())); 193 193 double minDistanceSq = MIN_DISTANCE_SQ; 194 194 //double maxAngle = MAX_ANGLE; 195 195 List<Node> nodes = MainApplication.getLayerManager().getEditDataSet().searchNodes(new BBox( 196 Math.min(n1. getX(), n2.getX()) - minDistanceSq,197 Math.min(n1. getY(), n2.getY()) - minDistanceSq,198 Math.max(n1. getX(), n2.getX()) + minDistanceSq,199 Math.max(n1. getY(), n2.getY()) + minDistanceSq196 Math.min(n1.lon(), n2.lon()) - minDistanceSq, 197 Math.min(n1.lat(), n2.lat()) - minDistanceSq, 198 Math.max(n1.lon(), n2.lon()) + minDistanceSq, 199 Math.max(n1.lat(), n2.lat()) + minDistanceSq 200 200 )); 201 201 Node nearestNode = null; … … 204 204 continue; 205 205 } 206 LatLon nn = nod.getCoor(); 207 double dist = TracerGeometry.distanceFromSegment(nn, n1, n2); 208 double angle = TracerGeometry.angleOfLines(n1, nn, nn, n2); 206 double dist = TracerGeometry.distanceFromSegment(nod, n1, n2); 207 double angle = TracerGeometry.angleOfLines(n1, nod, nod, n2); 209 208 System.out.println("Angle: " + angle + " distance: " + dist + " Node: " + nod); 210 if (!n1.equalsEpsilon(n n, ILatLon.MAX_SERVER_PRECISION)211 && !n2.equalsEpsilon(n n, ILatLon.MAX_SERVER_PRECISION) && dist < minDistanceSq) { // && Math.abs(angle) < maxAngle) {209 if (!n1.equalsEpsilon(nod, ILatLon.MAX_SERVER_PRECISION) 210 && !n2.equalsEpsilon(nod, ILatLon.MAX_SERVER_PRECISION) && dist < minDistanceSq) { // && Math.abs(angle) < maxAngle) { 212 211 //maxAngle = angle; 213 212 nearestNode = nod; -
applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerGeometry.java
r19881 r35976 7 7 package org.openstreetmap.josm.plugins.tracer; 8 8 9 import org.openstreetmap.josm.data.coor. LatLon;9 import org.openstreetmap.josm.data.coor.ILatLon; 10 10 11 public class TracerGeometry { 11 public final class TracerGeometry { 12 private TracerGeometry() { 13 // Hide constructor 14 } 12 15 13 16 /** … … 19 22 * @return Angle in degrees. 20 23 */ 21 static public double angleOfLines(LatLon a, LatLon b, LatLon c,LatLon d) {24 public static double angleOfLines(ILatLon a, ILatLon b, ILatLon c, ILatLon d) { 22 25 return (Math.abs( 23 26 Math.atan2(a.lat() - b.lat(), a.lon() - b.lon()) - … … 33 36 * @return Distance. 34 37 */ 35 static public double distanceFromSegment(LatLon c, LatLon a,LatLon b) {38 public static double distanceFromSegment(ILatLon c, ILatLon a, ILatLon b) { 36 39 return distanceFromSegment( 37 c. getX(), c.getY(),38 a. getX(), a.getY(),39 b. getX(), b.getY()40 c.lon(), c.lat(), 41 a.lon(), a.lat(), 42 b.lon(), b.lat() 40 43 ); 41 44 } 42 45 43 static privatedouble distanceFromSegment(double cx, double cy, double ax, double ay, double bx, double by) {46 private static double distanceFromSegment(double cx, double cy, double ax, double ay, double bx, double by) { 44 47 double r_numerator = (cx - ax) * (bx - ax) + (cy - ay) * (by - ay); 45 48 double r_denomenator = (bx - ax) * (bx - ax) + (by - ay) * (by - ay); -
applications/editors/josm/plugins/tracer2/src/org/openstreetmap/josm/plugins/tracer2/ConnectWays.java
r35975 r35976 82 82 } 83 83 84 private static double calcAlpha(LatLon oP1, Node n) { 85 LatLon oP2 = n.getCoor(); 86 87 double dAlpha = Math.atan((oP2.getY() - oP1.getY()) / (oP2.getX() - oP1.getX())) * 180 / Math.PI + (oP1.getX() > oP2.getX() ? 180 : 0); 84 private static double calcAlpha(LatLon oP1, Node oP2) { 85 86 double dAlpha = Math.atan((oP2.lat() - oP1.lat()) / (oP2.lon() - oP1.lon())) * 180 / Math.PI + (oP1.lon() > oP2.lon() ? 180 : 0); 88 87 return checkAlpha(dAlpha); 89 88 } … … 333 332 //List<Command> cmds = new LinkedList<Command>(); 334 333 335 LatLon ll = node.getCoor();334 //LatLon ll = node.getCoor(); 336 335 //BBox bbox = new BBox( 337 336 // ll.getX() - MIN_DISTANCE_TW, … … 358 357 for (Pair<Node, Node> np : ww.getNodePairs(false)) { 359 358 //double dist1 = TracerGeometry.distanceFromSegment(ll, np.a.getCoor(), np.b.getCoor()); 360 double dist = distanceFromSegment2( ll, np.a.getCoor(), np.b.getCoor());359 double dist = distanceFromSegment2(node, np.a, np.b); 361 360 //System.out.println(" distance: " + dist1 + " " + dist); 362 361 … … 381 380 } 382 381 383 private static double distanceFromSegment2( LatLon c, LatLon a,LatLon b) {382 private static double distanceFromSegment2(ILatLon c, ILatLon a, ILatLon b) { 384 383 double x; 385 384 double y; 386 385 387 386 StraightLine oStraightLine1 = new StraightLine( 388 new Point2D.Double(a. getX(), a.getY()),389 new Point2D.Double(b. getX(), b.getY()));387 new Point2D.Double(a.lon(), a.lat()), 388 new Point2D.Double(b.lon(), b.lat())); 390 389 StraightLine oStraightLine2 = new StraightLine( 391 new Point2D.Double(c. getX(), c.getY()),392 new Point2D.Double(c. getX() + (a.getY()-b.getY()), c.getY() - (a.getX()-b.getX())));390 new Point2D.Double(c.lon(), c.lat()), 391 new Point2D.Double(c.lon() + (a.lat()-b.lat()), c.lat() - (a.lon()-b.lon()))); 393 392 Point2D.Double oPoint = oStraightLine1.GetIntersectionPoint(oStraightLine2); 394 393 395 if ((oPoint.x > a. getX() && oPoint.x > b.getX()) || (oPoint.x < a.getX() && oPoint.x < b.getX()) ||396 (oPoint.y > a. getY() && oPoint.y > b.getY()) || (oPoint.y < a.getY() && oPoint.y < b.getY())) {394 if ((oPoint.x > a.lon() && oPoint.x > b.lon()) || (oPoint.x < a.lon() && oPoint.x < b.lon()) || 395 (oPoint.y > a.lat() && oPoint.y > b.lat()) || (oPoint.y < a.lat() && oPoint.y < b.lat())) { 397 396 return 100000; 398 397 } 399 398 400 x = c. getX()-oPoint.getX();401 y = c. getY()-oPoint.getY();399 x = c.lon()-oPoint.getX(); 400 y = c.lat()-oPoint.getY(); 402 401 403 402 return Math.sqrt((x*x)+(y*y)); … … 421 420 while (i < way.getNodesCount()) { 422 421 // usecka n1, n2 423 LatLon n1 = way.getNodes().get(i).getCoor();424 LatLon n2 = way.getNodes().get((i + 1) % way.getNodesCount()).getCoor();422 ILatLon n1 = way.getNodes().get(i); 423 ILatLon n2 = way.getNodes().get((i + 1) % way.getNodesCount()); 425 424 System.out.println(way.getNodes().get(i) + "-----" + way.getNodes().get((i + 1) % way.getNodesCount())); 426 425 double minDistanceSq = Double.MAX_VALUE; … … 438 437 continue; 439 438 } 440 LatLon nn = nod.getCoor(); 441 //double dist = TracerGeometry.distanceFromSegment(nn, n1, n2); 442 double dist = distanceFromSegment2(nn, n1, n2); 443 // double angle = TracerGeometry.angleOfLines(n1, nn, nn, n2); 439 //double dist = TracerGeometry.distanceFromSegment(nod, n1, n2); 440 double dist = distanceFromSegment2(nod, n1, n2); 441 // double angle = TracerGeometry.angleOfLines(n1, nod, nod, n2); 444 442 //System.out.println("Angle: " + angle + " distance: " + dist + " Node: " + nod); 445 if (!n1.equalsEpsilon(n n, ILatLon.MAX_SERVER_PRECISION)446 && !n2.equalsEpsilon(n n, ILatLon.MAX_SERVER_PRECISION) && dist < minDistanceSq) { // && Math.abs(angle) < maxAngle) {443 if (!n1.equalsEpsilon(nod, ILatLon.MAX_SERVER_PRECISION) 444 && !n2.equalsEpsilon(nod, ILatLon.MAX_SERVER_PRECISION) && dist < minDistanceSq) { // && Math.abs(angle) < maxAngle) { 447 445 minDistanceSq = dist; 448 446 // maxAngle = angle; -
applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/data/TrustNode.java
r33869 r35976 25 25 26 26 public static String generateNodeSigtext(Node node) { 27 LatLon point = node.getCoor();28 27 String sigtext = node.getUniqueId() + "("; 29 sigtext += DecimalDegreesCoordinateFormat.INSTANCE.latToString( point) + ",";30 sigtext += DecimalDegreesCoordinateFormat.INSTANCE.lonToString( point) + ")";28 sigtext += DecimalDegreesCoordinateFormat.INSTANCE.latToString(node) + ","; 29 sigtext += DecimalDegreesCoordinateFormat.INSTANCE.lonToString(node) + ")"; 31 30 return sigtext; 32 31 } -
applications/editors/josm/plugins/turnlanes/src/org/openstreetmap/josm/plugins/turnlanes/gui/GuiUtil.java
r34566 r35976 134 134 135 135 public static Point2D loc(Node node) { 136 final EastNorth loc = ProjectionRegistry.getProjection().latlon2eastNorth(node.getCoor());136 final EastNorth loc = node.getEastNorth(); 137 137 return new Point2D.Double(loc.getX(), -loc.getY()); 138 138 } -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java
r34976 r35976 64 64 Node n1 = nodes.get(1); 65 65 66 double x = n1. getCoor().getX() - n0.getCoor().getX();67 double y = n1. getCoor().getY() - n0.getCoor().getY();66 double x = n1.lon() - n0.lon(); 67 double y = n1.lat() - n0.lat(); 68 68 return Math.atan2(y, x); 69 69 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java
r35681 r35976 450 450 451 451 static boolean isInArea(Node node, Area area) { 452 LatLon ll = node.getCoor(); 453 return node.isNewOrUndeleted() || area == null || ll == null || area.contains(ll.getX(), ll.getY()); 452 return node.isNewOrUndeleted() || area == null || !node.isLatLonKnown() || area.contains(node.lon(), node.lat()); 454 453 } 455 454 -
applications/editors/josm/plugins/waydownloader/src/org/openstreetmap/josm/plugins/waydownloader/WayDownloaderPlugin.java
r34976 r35976 22 22 import org.openstreetmap.josm.data.DataSource; 23 23 import org.openstreetmap.josm.data.UndoRedoHandler; 24 import org.openstreetmap.josm.data.coor. LatLon;24 import org.openstreetmap.josm.data.coor.ILatLon; 25 25 import org.openstreetmap.josm.data.osm.DataSet; 26 26 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 111 111 DownloadOsmTask downloadTask = new DownloadOsmTask(); 112 112 final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor(); 113 LatLon ll = selectedNode.getCoor();113 ILatLon ll = selectedNode; 114 114 final Future<?> future = downloadTask.download( 115 115 new DownloadParams(), … … 308 308 for (DataSource datasource : MainApplication.getLayerManager().getEditDataSet().getDataSources()) { 309 309 Bounds bounds = datasource.bounds; 310 if (bounds != null && bounds.contains(node .getCoor())) return true;310 if (bounds != null && bounds.contains(node)) return true; 311 311 } 312 312 return false;
Note:
See TracChangeset
for help on using the changeset viewer.