|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAbstractFactory
ReferencingFactory
AbstractAuthorityFactory
AuthorityFactoryAdapter
TransformedAuthorityFactory
OrderedAxisAuthorityFactory
public class OrderedAxisAuthorityFactory
An authority factory which delegates all the work to an other factory, and reorder the axis in some pre-determined order. This factory is mostly used by application expecting geographic coordinates in (longitude, latitude) order, while most geographic CRS specified in the EPSG database use the opposite axis order.
It is better to avoid this class if you can. This class exists primarily for compatibility with external data or applications that assume (longitude, latitude) axis order no matter what the EPSG database said, for example Shapefiles.
The axis order can be specified at construction time as an array of axis directions. If no such array is explicitly specified, then the default order is
East,
East-North-East,
North-East,
North-North-East,
North,
Up,
Geocentric X,
Geocentric Y,
Geocentric Z,
Column,
Row,
Display right,
Display up and
Future.
This means that, for example, axis with East or West direction will be placed before any
axis with North or South direction. Axis directions not specified in the table (for example
OTHER
) will be ordered last. This is somewhat equivalent to the
ordering of NaN
values in an array of double
.
Notes:
compare
method
implementation. Subclasses may override this method if the want to provide a more
sophesticated axis ordering.
For some authority factories, an instance of this class can be obtained by passing a
FORCE_LONGITUDE_FIRST_AXIS_ORDER
hint
to the FactoryFinder.getCRSAuthorityFactory(...)
method. Whatever this hint is supported
or not is authority dependent. Example:
This class is named ordered axis authority factory instead of something like longitude first axis order because the axis order can be user-supplied. The (longitude, latitude) order just appears to be the default one.Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); CRSAuthorityFactory factory = FactoryFinder.getCRSAuthorityFactory("EPSG", hints); CoordinateReferenceSystem crs = factory.createCoordinateReferenceSystem("EPSG:4326");
Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER
,
Hints.FORCE_STANDARD_AXIS_UNITS
Field Summary | |
---|---|
protected boolean |
forceStandardDirections
true if this authority factory should also force the axis to their standard
direction. |
protected boolean |
forceStandardUnits
true if this authority factory should also force all angular units to
decimal degrees and linear units to meters. |
Fields inherited from class ReferencingFactory |
---|
LOGGER |
Fields inherited from class AbstractFactory |
---|
hints, MAXIMUM_PRIORITY, MINIMUM_PRIORITY, NORMAL_PRIORITY, priority |
Constructor Summary | |
---|---|
OrderedAxisAuthorityFactory(AbstractAuthorityFactory factory,
Hints userHints,
AxisDirection[] axisOrder)
Creates a factory which will reorder the axis of all objects created by the supplied factory. |
|
OrderedAxisAuthorityFactory(String authority,
Hints userHints,
AxisDirection[] axisOrder)
Creates a factory which will reorder the axis of all objects created by the default authority factories. |
Method Summary | |
---|---|
int |
compare(Object axis1,
Object axis2)
Compares two axis for order. |
protected AxisDirection |
replace(AxisDirection direction)
Replaces the specified direction, if applicable. |
protected Unit<?> |
replace(Unit<?> units)
Replaces the specified unit, if applicable. |
Methods inherited from class TransformedAuthorityFactory |
---|
createFromCoordinateReferenceSystemCodes, dispose, getPriority, replace, replace, replace, replace, replace |
Methods inherited from class AbstractAuthorityFactory |
---|
noSuchAuthorityCode, trimAuthority |
Methods inherited from class ReferencingFactory |
---|
ensureNonNull |
Methods inherited from class AbstractFactory |
---|
addImplementationHints, equals, getImplementationHints, hashCode, onDeregistration, onRegistration, toString |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface CSAuthorityFactory |
---|
createCartesianCS, createCoordinateSystem, createCoordinateSystemAxis, createCylindricalCS, createEllipsoidalCS, createPolarCS, createSphericalCS, createTimeCS, createUnit, createVerticalCS |
Methods inherited from interface CRSAuthorityFactory |
---|
createCompoundCRS, createCoordinateReferenceSystem, createDerivedCRS, createEngineeringCRS, createGeocentricCRS, createGeographicCRS, createImageCRS, createProjectedCRS, createTemporalCRS, createVerticalCRS |
Methods inherited from interface AuthorityFactory |
---|
createObject, getAuthority, getAuthorityCodes, getDescriptionText |
Methods inherited from interface Factory |
---|
getVendor |
Methods inherited from interface Comparator |
---|
equals |
Methods inherited from interface Factory |
---|
getImplementationHints |
Field Detail |
---|
protected final boolean forceStandardDirections
true
if this authority factory should also force the axis to their standard
direction. For example if true
, then axis with increasing values toward South
will be converted to axis with increasing values toward North. The default value is
false
.
Hints.FORCE_STANDARD_AXIS_DIRECTIONS
protected final boolean forceStandardUnits
true
if this authority factory should also force all angular units to
decimal degrees and linear units to meters. The default value is false
.
Hints.FORCE_STANDARD_AXIS_UNITS
Constructor Detail |
---|
public OrderedAxisAuthorityFactory(String authority, Hints userHints, AxisDirection[] axisOrder) throws FactoryRegistryException, IllegalArgumentException
ReferencingFactoryFinder
. This
constructor accepts the following hints:
Hints.FORCE_STANDARD_AXIS_UNITS
Hints.FORCE_STANDARD_AXIS_DIRECTIONS
ReferencingFactoryFinder
authority
- The authority to wraps (example: "EPSG"
). If null
,
then all authority factories must be explicitly specified in the set of hints.userHints
- An optional set of hints, or null
if none.axisOrder
- An array of axis directions that determine the axis order wanted,
or null
for the default axis order.
FactoryRegistryException
- if at least one factory can not be obtained.
IllegalArgumentException
- If at least two axis directions are colinear.public OrderedAxisAuthorityFactory(AbstractAuthorityFactory factory, Hints userHints, AxisDirection[] axisOrder) throws IllegalArgumentException
factory
- The factory that produces objects using arbitrary axis order.userHints
- An optional set of hints, or null
if none.axisOrder
- An array of axis directions that determine the axis order wanted,
or null
for the default axis order.
IllegalArgumentException
- If at least two axis directions are colinear.Method Detail |
---|
public int compare(Object axis1, Object axis2)
replace
method for ordering the axis in a
coordinate system. The default implementation orders the axis according their
direction, using the direction
table given at construction time (see also the class description).
Subclasses may override this method if they want to define a more sophesticated
axis ordering.
compare
in interface Comparator
axis1
- The first axis to compare.axis2
- The second axis to compare.
axis1
should appears before axis2
, or a
positive number if axis2
should appears before axis1
, or 0 if
the two axis are unordered one relative to the other.protected Unit<?> replace(Unit<?> units)
TransformedAuthorityFactory.replace(CoordinateSystem)
method. The default implementation replaces the unit
only if the FORCE_STANDARD_AXIS_UNITS
hint was
specified as TRUE
at construction time. In such case, the default
substitution table is:
This default substitution table may be expanded in future Geotools versions.
replace
in class TransformedAuthorityFactory
units
- The units to replace.
units
if no change were needed.protected AxisDirection replace(AxisDirection direction)
TransformedAuthorityFactory.replace(CoordinateSystem)
method. The default implementation replaces the direction
only if the FORCE_STANDARD_AXIS_DIRECTIONS
hint
was specified as TRUE
at construction time. In such case, the default
substitution table is as specified in the AxisDirection.absolute()
method.
Subclasses may override this method if they want to use a different substitution table.
replace
in class TransformedAuthorityFactory
direction
- The axis direction to replace.
direction
if no change were needed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |