Class AbstractProjection
java.lang.Object
org.openstreetmap.josm.data.projection.AbstractProjection
- All Implemented Interfaces:
Projecting,Projection
- Direct Known Subclasses:
CustomProjection
Implementation of the Projection interface that represents a coordinate reference system and delegates
the real projection and datum conversion to other classes.
It handles false easting and northing, central meridian and general scale factor before calling the
delegate projection.
Forwards lat/lon values to the real projection in units of radians.
The fields are named after Proj.4 parameters.
Subclasses of AbstractProjection must set ellps and proj to a non-null value.
In addition, either datum or nadgrid has to be initialized to some value.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static final doubleconvertDegreeMinuteSecond(double degree, double minute, double second) protected static final doubleconvertMinuteSecond(double minute, double second) Convert from easting/norting to lat/lon.private LatLoneastNorth2latlon(EastNorth en, DoubleUnaryOperator normalizeLon) Convert a east/north coordinate to theLatLoncoordinate.Gets the base projection instance used.final doubleGets the meridian that this projection is centered on.final DatumgetDatum()Gets the datum this projection is based on.doubleThe default scale factor in east/north units per pixel (NavigatableComponent.getState())).final EllipsoidGet the base ellipsoid that this projection uses.abstract IntegerReturns The EPSG Code of this CRS.final doubleGets an east offset that gets applied when converting the coordinatefinal doubleGets an north offset that gets applied when converting the coordinatefinal ProjgetProj()Replies the projection (in the narrow sense)Returns an map or (subarea, projecting) paris that contains projecting instances to convert the coordinates inside the given area.final doublefinal doubleGet the factor that converts meters to intended units of east/north coordinates.final ProjectionBoundsGet an approximate EastNorth box around the lat/lon world bounds.latlon2eastNorth(ILatLon toConvert) Convert from lat/lon to easting/northing.toCode()Default implementation of toCode().private voidvisitOutline(Bounds b, int nPoints, Consumer<EastNorth> visitor) voidvisitOutline(Bounds b, Consumer<EastNorth> visitor) Visit points along the edge of this bounds instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.projection.Projecting
getCacheKey, latlon2eastNorthMethods inherited from interface org.openstreetmap.josm.data.projection.Projection
getEastNorthBoundsBox, getLatLonBoundsBox, getMetersPerUnit, getWorldBoundsLatLon, switchXY, toString
-
Field Details
-
ellps
-
datum
-
proj
-
x0
-
y0
-
lon0
-
pm
-
k0
-
toMeter
-
projectionBoundsBox
-
-
Constructor Details
-
AbstractProjection
public AbstractProjection()
-
-
Method Details
-
getEllipsoid
Get the base ellipsoid that this projection uses.- Returns:
- The
Ellipsoid
-
getDatum
Gets the datum this projection is based on.- Returns:
- The datum
-
getProj
Replies the projection (in the narrow sense)- Returns:
- The projection object
-
getFalseEasting
Gets an east offset that gets applied when converting the coordinate- Returns:
- The offset to apply in meter
-
getFalseNorthing
Gets an north offset that gets applied when converting the coordinate- Returns:
- The offset to apply in meter
-
getCentralMeridian
Gets the meridian that this projection is centered on.- Returns:
- The longitude of the meridian.
-
getScaleFactor
-
getToMeter
Get the factor that converts meters to intended units of east/north coordinates. For projected coordinate systems, the semi-major axis of the ellipsoid is always given in meters, which means the preliminary projection result will be in meters as well. This factor is used to convert to the intended units of east/north coordinates (e.g. feet in the US). For geographic coordinate systems, the preliminary "projection" result will be in degrees, so there is no reason to convert anything and this factor will by 1 by default.- Returns:
- factor that converts meters to intended units of east/north coordinates
-
latlon2eastNorth
Description copied from interface:ProjectingConvert from lat/lon to easting/northing. This method uses the newerILatLoninterface.- Specified by:
latlon2eastNorthin interfaceProjecting- Parameters:
toConvert- the geographical point to convert (in WGS84 lat/lon)- Returns:
- the corresponding east/north coordinates
- See Also:
-
eastNorth2latlon
Description copied from interface:ProjectionConvert from easting/norting to lat/lon.- Specified by:
eastNorth2latlonin interfaceProjection- Parameters:
en- the geographical point to convert (in projected coordinates)- Returns:
- the corresponding lat/lon (WGS84)
-
eastNorth2latlonClamped
Description copied from interface:ProjectingConvert a east/north coordinate to theLatLoncoordinate. This method clamps the lat/lon coordinate to the nearest point in the world bounds.- Specified by:
eastNorth2latlonClampedin interfaceProjecting- Parameters:
en- east/north- Returns:
- The lat/lon coordinate.
-
eastNorth2latlon
-
getProjectingsForArea
Description copied from interface:ProjectingReturns an map or (subarea, projecting) paris that contains projecting instances to convert the coordinates inside the given area. This can be used by projections to support continuous projections. It is possible that the area covered by the map is bigger than the one given as area. There may be holes.- Specified by:
getProjectingsForAreain interfaceProjecting- Parameters:
area- The base area- Returns:
- a map of non-overlapping
ProjectionBoundsinstances mapped to theProjectingobject to use for that area.
-
getDefaultZoomInPPD
Description copied from interface:ProjectionThe default scale factor in east/north units per pixel (NavigatableComponent.getState())). FIXME: misnomer- Specified by:
getDefaultZoomInPPDin interfaceProjection- Returns:
- the scale factor
-
getEpsgCode
Returns The EPSG Code of this CRS.- Returns:
- The EPSG Code of this CRS, null if it doesn't have one.
-
toCode
Default implementation of toCode(). Should be overridden, if there is no EPSG code for this CRS.- Specified by:
toCodein interfaceProjection- Returns:
- the projection identifier
-
convertMinuteSecond
-
convertDegreeMinuteSecond
protected static final double convertDegreeMinuteSecond(double degree, double minute, double second) -
getWorldBoundsBoxEastNorth
Description copied from interface:ProjectionGet an approximate EastNorth box around the lat/lon world bounds. Note: The projection is only valid within the bounds returned byProjection.getWorldBoundsLatLon(). The lat/lon bounds need not be a rectangular shape in east/north space. This method returns a box that contains this shape.- Specified by:
getWorldBoundsBoxEastNorthin interfaceProjection- Returns:
- EastNorth box around the lat/lon world bounds
-
getBaseProjection
Description copied from interface:ProjectingGets the base projection instance used. This may be the same as this one or a different one if this one is translated in east/north space.- Specified by:
getBaseProjectionin interfaceProjecting- Returns:
- The projection.
-
visitOutline
Description copied from interface:ProjectionVisit 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.
- Specified by:
visitOutlinein interfaceProjection- Parameters:
b- the lat/lon rectangle to tracevisitor- a function to call for the points on the edge.
-
visitOutline
-