org.openstreetmap.josm.data.projection
Class CustomProjection

java.lang.Object
  extended by org.openstreetmap.josm.data.projection.AbstractProjection
      extended by org.openstreetmap.josm.data.projection.CustomProjection
All Implemented Interfaces:
Projection

public class CustomProjection
extends AbstractProjection

Custom projection Inspired by PROJ.4 and Proj4J.


Nested Class Summary
protected static class CustomProjection.Param
           
 
Field Summary
protected  Bounds bounds
           
protected  java.lang.String cacheDir
           
protected  java.lang.String code
           
protected  java.lang.String name
           
protected  java.lang.String pref
          pref String that defines the projection null means fall back mode (Mercator)
 
Fields inherited from class org.openstreetmap.josm.data.projection.AbstractProjection
datum, ellps, k_0, lon_0, proj, x_0, y_0
 
Constructor Summary
CustomProjection()
           
CustomProjection(java.lang.String pref)
           
CustomProjection(java.lang.String name, java.lang.String code, java.lang.String pref, java.lang.String cacheDir)
          Constructor.
 
Method Summary
 java.lang.String getCacheDirectoryName()
          Get a filename compatible string (for the cache directory).
 java.lang.Integer getEpsgCode()
           
 Bounds getWorldBoundsLatLon()
          Get the bounds of the world.
static double parseAngle(java.lang.String angleStr, java.lang.String parameterName)
           
static Bounds parseBounds(java.lang.String boundsStr)
           
 Datum parseDatum(java.util.Map<java.lang.String,java.lang.String> parameters, Ellipsoid ellps)
           
static double parseDouble(java.util.Map<java.lang.String,java.lang.String> parameters, java.lang.String parameterName)
           
static double parseDouble(java.lang.String doubleStr, java.lang.String parameterName)
           
 Ellipsoid parseEllipsoid(java.util.Map<java.lang.String,java.lang.String> parameters)
           
private  java.util.Map<java.lang.String,java.lang.String> parseParameterList(java.lang.String pref)
           
 Proj parseProjection(java.util.Map<java.lang.String,java.lang.String> parameters, Ellipsoid ellps)
           
 Datum parseToWGS84(java.lang.String paramList, Ellipsoid ellps)
           
 java.lang.String toCode()
          Default implementation of toCode().
 java.lang.String toString()
          Describe the projection in one or two words.
 void update(java.lang.String pref)
           
 
Methods inherited from class org.openstreetmap.josm.data.projection.AbstractProjection
convertDegreeMinuteSecond, convertMinuteSecond, dump, eastNorth2latlon, getCentralMeridian, getDatum, getDefaultZoomInPPD, getEllipsoid, getFalseEasting, getFalseNorthing, getProj, getScaleFactor, latlon2eastNorth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pref

protected java.lang.String pref
pref String that defines the projection null means fall back mode (Mercator)


name

protected java.lang.String name

code

protected java.lang.String code

cacheDir

protected java.lang.String cacheDir

bounds

protected Bounds bounds
Constructor Detail

CustomProjection

public CustomProjection()

CustomProjection

public CustomProjection(java.lang.String pref)

CustomProjection

public CustomProjection(java.lang.String name,
                        java.lang.String code,
                        java.lang.String pref,
                        java.lang.String cacheDir)
Constructor.

Parameters:
name - describe projection in one or two words
code - unique code for this projection - may be null
pref - the string that defines the custom projection
cacheDir - cache directory name
Method Detail

update

public void update(java.lang.String pref)
            throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseParameterList

private java.util.Map<java.lang.String,java.lang.String> parseParameterList(java.lang.String pref)
                                                                     throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseEllipsoid

public Ellipsoid parseEllipsoid(java.util.Map<java.lang.String,java.lang.String> parameters)
                         throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseDatum

public Datum parseDatum(java.util.Map<java.lang.String,java.lang.String> parameters,
                        Ellipsoid ellps)
                 throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseToWGS84

public Datum parseToWGS84(java.lang.String paramList,
                          Ellipsoid ellps)
                   throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseProjection

public Proj parseProjection(java.util.Map<java.lang.String,java.lang.String> parameters,
                            Ellipsoid ellps)
                     throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseBounds

public static Bounds parseBounds(java.lang.String boundsStr)
                          throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseDouble

public static double parseDouble(java.util.Map<java.lang.String,java.lang.String> parameters,
                                 java.lang.String parameterName)
                          throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseDouble

public static double parseDouble(java.lang.String doubleStr,
                                 java.lang.String parameterName)
                          throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

parseAngle

public static double parseAngle(java.lang.String angleStr,
                                java.lang.String parameterName)
                         throws ProjectionConfigurationException
Throws:
ProjectionConfigurationException

getEpsgCode

public java.lang.Integer getEpsgCode()
Specified by:
getEpsgCode in class AbstractProjection
Returns:
The EPSG Code of this CRS, null if it doesn't have one.

toCode

public java.lang.String toCode()
Description copied from class: AbstractProjection
Default implementation of toCode(). Should be overridden, if there is no EPSG code for this CRS.

Specified by:
toCode in interface Projection
Overrides:
toCode in class AbstractProjection
Returns:
the projection identifier

getCacheDirectoryName

public java.lang.String getCacheDirectoryName()
Description copied from interface: Projection
Get a filename compatible string (for the cache directory).

Returns:
the cache directory name (base name)

getWorldBoundsLatLon

public Bounds getWorldBoundsLatLon()
Description copied from interface: Projection
Get the bounds of the world.

Returns:
the supported lat/lon rectangle for this projection

toString

public java.lang.String toString()
Description copied from interface: Projection
Describe the projection in one or two words.

Specified by:
toString in interface Projection
Overrides:
toString in class java.lang.Object
Returns:
the name / description


JOSM