Changeset 12161 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2017-05-15T15:43:30+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapViewState.java
r12074 r12161 20 20 import org.openstreetmap.josm.data.ProjectionBounds; 21 21 import org.openstreetmap.josm.data.coor.EastNorth; 22 import org.openstreetmap.josm.data.coor.ILatLon; 22 23 import org.openstreetmap.josm.data.coor.LatLon; 23 24 import org.openstreetmap.josm.data.osm.Node; … … 180 181 /** 181 182 * Gets the {@link MapViewPoint} for the given {@link LatLon} coordinate. 183 * <p> 184 * This method exists to not break binary compatibility with old plugins 182 185 * @param latlon the position 183 186 * @return The point for that position. … … 185 188 */ 186 189 public MapViewPoint getPointFor(LatLon latlon) { 187 return getPointFor(getProjection().latlon2eastNorth(latlon)); 190 return getPointFor((ILatLon) latlon); 191 } 192 193 /** 194 * Gets the {@link MapViewPoint} for the given {@link LatLon} coordinate. 195 * @param latlon the position 196 * @return The point for that position. 197 * @since xxx 198 */ 199 public MapViewPoint getPointFor(ILatLon latlon) { 200 try { 201 return getPointFor(Optional.ofNullable(latlon.getEastNorth(getProjection())) 202 .orElseThrow(IllegalArgumentException::new)); 203 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 204 throw BugReport.intercept(e).put("latlon", latlon); 205 } 188 206 } 189 207 … … 196 214 */ 197 215 public MapViewPoint getPointFor(Node node) { 198 try { 199 return getPointFor(Optional.ofNullable(node.getEastNorth(getProjection())) 200 .orElseThrow(IllegalArgumentException::new)); 201 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 202 throw BugReport.intercept(e).put("node", node); 203 } 216 return getPointFor((ILatLon) node); 204 217 } 205 218 … … 249 262 * Gets the current projection used for the MapView. 250 263 * @return The projection. 264 * @see #getProjecting() 251 265 */ 252 266 public Projection getProjection() { 253 267 return projecting.getBaseProjection(); 268 } 269 270 /** 271 * Gets the current projecting instance that is used to convert between east/north and lat/lon space. 272 * @return The projection. 273 * @since xxx 274 */ 275 public Projecting getProjecting() { 276 return projecting; 254 277 } 255 278 -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
r10198 r12161 203 203 204 204 void addCoordinates(Node n) { 205 if (n. getCoor() != null) {205 if (n.isLatLonKnown()) { 206 206 add(tr("Coordinates: "), 207 Double.toString(n. getCoor().lat()), ", ",208 Double.toString(n. getCoor().lon()));207 Double.toString(n.lat()), ", ", 208 Double.toString(n.lon())); 209 209 add(tr("Coordinates (projected): "), 210 210 Double.toString(n.getEastNorth().east()), ", ", -
trunk/src/org/openstreetmap/josm/gui/draw/MapViewPath.java
r11817 r12161 9 9 10 10 import org.openstreetmap.josm.data.coor.EastNorth; 11 import org.openstreetmap.josm.data. osm.Node;11 import org.openstreetmap.josm.data.coor.ILatLon; 12 12 import org.openstreetmap.josm.gui.MapView; 13 13 import org.openstreetmap.josm.gui.MapViewState; … … 57 57 * @return this for easy chaining. 58 58 */ 59 public MapViewPath moveTo( Noden) {60 moveTo(n.getEastNorth( ));59 public MapViewPath moveTo(ILatLon n) { 60 moveTo(n.getEastNorth(state.getProjecting())); 61 61 return this; 62 62 } … … 85 85 * @return this for easy chaining. 86 86 */ 87 public MapViewPath lineTo( Noden) {88 lineTo(n.getEastNorth( ));87 public MapViewPath lineTo(ILatLon n) { 88 lineTo(n.getEastNorth(state.getProjecting())); 89 89 return this; 90 90 } … … 115 115 * @return this for easy chaining. 116 116 */ 117 public MapViewPath shapeAround( Nodep1, SymbolShape symbol, double size) {118 shapeAround(p1.getEastNorth( ), symbol, size);117 public MapViewPath shapeAround(ILatLon p1, SymbolShape symbol, double size) { 118 shapeAround(p1.getEastNorth(state.getProjecting()), symbol, size); 119 119 return this; 120 120 } … … 144 144 * @return this for easy chaining. 145 145 */ 146 public MapViewPath append(Iterable< Node> nodes, boolean connect) {146 public MapViewPath append(Iterable<? extends ILatLon> nodes, boolean connect) { 147 147 appendWay(nodes, connect, false); 148 148 return this; … … 155 155 * @return this for easy chaining. 156 156 */ 157 public MapViewPath appendClosed(Iterable< Node> nodes, boolean connect) {157 public MapViewPath appendClosed(Iterable<? extends ILatLon> nodes, boolean connect) { 158 158 appendWay(nodes, connect, true); 159 159 return this; 160 160 } 161 161 162 private void appendWay(Iterable< Node> nodes, boolean connect, boolean close) {162 private void appendWay(Iterable<? extends ILatLon> nodes, boolean connect, boolean close) { 163 163 boolean useMoveTo = !connect; 164 Nodefirst = null;165 for ( Noden : nodes) {164 ILatLon first = null; 165 for (ILatLon n : nodes) { 166 166 if (useMoveTo) { 167 167 moveTo(n);
Note:
See TracChangeset
for help on using the changeset viewer.