Interface Projection
-
- All Superinterfaces:
Projecting
- All Known Implementing Classes:
AbstractProjection
,CustomProjection
public interface Projection extends Projecting
A projection, i.e. a class that supports conversion from lat/lon to east/north and back. The conversion from east/north to the screen coordinates is simply a scale factor and x/y offset.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LatLon
eastNorth2latlon(EastNorth en)
Convert from easting/norting to lat/lon.double
getDefaultZoomInPPD()
The default scale factor in east/north units per pixel (NavigatableComponent.getState()
)).ProjectionBounds
getEastNorthBoundsBox(ProjectionBounds box, Projection boxProjection)
Get a box in east/north space of this projection, that fully contains an east/north box of another projection.Bounds
getLatLonBoundsBox(ProjectionBounds pb)
Find lat/lon-box containing all the area of a given rectangle in east/north space.double
getMetersPerUnit()
Get the number of meters per unit of this projection.ProjectionBounds
getWorldBoundsBoxEastNorth()
Get an approximate EastNorth box around the lat/lon world bounds.Bounds
getWorldBoundsLatLon()
Get the bounds of the world.boolean
switchXY()
Does this projection natural order of coordinates is North East, instead of East Northjava.lang.String
toCode()
Return projection code.java.lang.String
toString()
Describe the projection in one or two words.void
visitOutline(Bounds bounds, java.util.function.Consumer<EastNorth> visitor)
Visit points along the edge of this bounds instance.-
Methods inherited from interface org.openstreetmap.josm.data.projection.Projecting
eastNorth2latlonClamped, getBaseProjection, getCacheKey, getProjectingsForArea, latlon2eastNorth, latlon2eastNorth
-
-
-
-
Method Detail
-
getDefaultZoomInPPD
double getDefaultZoomInPPD()
The default scale factor in east/north units per pixel (NavigatableComponent.getState()
)). FIXME: misnomer- Returns:
- the scale factor
-
eastNorth2latlon
LatLon eastNorth2latlon(EastNorth en)
Convert from easting/norting to lat/lon.- Parameters:
en
- the geographical point to convert (in projected coordinates)- Returns:
- the corresponding lat/lon (WGS84)
-
toString
java.lang.String toString()
Describe the projection in one or two words.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the name / description
-
toCode
java.lang.String toCode()
Return projection code. This should be a unique identifier. If projection supports parameters, return a different code for each set of parameters. The EPSG code can be used (if defined for the projection).- Returns:
- the projection identifier
-
getWorldBoundsLatLon
Bounds getWorldBoundsLatLon()
Get the bounds of the world.- Returns:
- the supported lat/lon rectangle for this projection
-
getWorldBoundsBoxEastNorth
ProjectionBounds getWorldBoundsBoxEastNorth()
Get an approximate EastNorth box around the lat/lon world bounds. Note: The projection is only valid within the bounds returned bygetWorldBoundsLatLon()
. The lat/lon bounds need not be a rectangular shape in east/north space. This method returns a box that contains this shape.- Returns:
- EastNorth box around the lat/lon world bounds
-
getLatLonBoundsBox
Bounds getLatLonBoundsBox(ProjectionBounds pb)
Find lat/lon-box containing all the area of a given rectangle in east/north space. This is an approximate method. Points outside of the world should be ignored.- Parameters:
pb
- the rectangle in projected space- Returns:
- minimum lat/lon box, that when projected, covers
pb
-
getEastNorthBoundsBox
ProjectionBounds getEastNorthBoundsBox(ProjectionBounds box, Projection boxProjection)
Get a box in east/north space of this projection, that fully contains an east/north box of another projection. Reprojecting a rectangular box from one projection to another may distort/rotate the shape of the box, so in general one needs to walk along the boundary in small steps to get a reliable result. This is an approximate method.- Parameters:
box
- the east/north box given in projectionboxProjection
boxProjection
- the projection ofbox
- Returns:
- an east/north box in this projection, containing the given box
-
getMetersPerUnit
double getMetersPerUnit()
Get the number of meters per unit of this projection. This more defines the scale of the map, than real conversion of unit to meters as this value is more less correct only along certain lines of true scale. Used by WMTS to properly scale tiles- Returns:
- meters per unit of projection
-
switchXY
boolean switchXY()
Does this projection natural order of coordinates is North East, instead of East North- Returns:
- true if natural order of coordinates is North East, false if East North
-
visitOutline
void visitOutline(Bounds bounds, java.util.function.Consumer<EastNorth> visitor)
Visit points along the edge of this bounds instance.Depending on the shape in east/north space, it may simply visit the 4 corners or (more generally) several points along the curved edges.
- Parameters:
bounds
- the lat/lon rectangle to tracevisitor
- a function to call for the points on the edge.- Since:
- 12818
-
-