Changeset 10651 in josm for trunk/src/org/openstreetmap/josm/gui/MapViewState.java
- Timestamp:
- 2016-07-26T21:44:16+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapViewState.java
r10596 r10651 8 8 import java.awt.geom.Point2D; 9 9 import java.awt.geom.Point2D.Double; 10 import java.awt.geom.Rectangle2D; 10 11 11 12 import javax.swing.JComponent; … … 144 145 145 146 /** 147 * Gets the {@link MapViewPoint} for the given {@link LatLon} coordinate. 148 * @param latlon the position 149 * @return The point for that position. 150 * @since 10651 151 */ 152 public MapViewPoint getPointFor(LatLon latlon) { 153 return getPointFor(getProjection().latlon2eastNorth(latlon)); 154 } 155 156 /** 146 157 * Gets a rectangle representing the whole view area. 147 158 * @return The rectangle. … … 351 362 return projection.eastNorth2latlon(getEastNorth()); 352 363 } 364 365 /** 366 * Add the given offset to this point 367 * @param en The offset in east/north space. 368 * @return The new point 369 * @since 10651 370 */ 371 public MapViewPoint add(EastNorth en) { 372 return new MapViewEastNorthPoint(getEastNorth().add(en)); 373 } 353 374 } 354 375 … … 455 476 return projection.getLatLonBoundsBox(getProjectionBounds()); 456 477 } 478 479 /** 480 * Gets this rectangle on the screen. 481 * @return The rectangle. 482 * @since 10651 483 */ 484 public Rectangle2D getInView() { 485 double x1 = p1.getInViewX(); 486 double y1 = p1.getInViewY(); 487 double x2 = p2.getInViewX(); 488 double y2 = p2.getInViewY(); 489 return new Rectangle2D.Double(Math.min(x1, x2), Math.min(y1, y2), Math.abs(x1 - x2), Math.abs(y1 - y2)); 490 } 457 491 } 458 492
Note:
See TracChangeset
for help on using the changeset viewer.
