Class TLcdRectifiedPolynomialProjection
- All Implemented Interfaces:
ILcdProjection,ILcdRectifiedProjection,ILcdPropertyChangeSource,Serializable,Cloneable
Introduction
This ILcdRectifiedProjection uses a 2D polynomial function for mapping tie points between reference systems.
The 2D polynomial function is of the form:
x'=Px(x,y),
y'=Py(x,y),
where Px and Py are functions
of the form
∑ ai=1..m; j=1..m xi yj.
Given the degree of the polynomial and the sets of source/target tie points, the coefficients of the polynomials are computed using the least-squares method.
The minimum number of pairs of tie point required for computing the
coefficients is given by the formula:
(deg + 1) * (deg + 2) / 2,
where deg is the degree of the polynomial.
If fewer point pairs are available, the projection will gracefully fall-back to lower degrees. There should be at least 3 pairs of tie points.
Example
Sample Code
ILcdProjection projection =
new TLcdRectifiedPolynomialProjection(3);
Known limitations
- The polynomial function becomes very unstable when the degree increases to more than 2 or 3.
- Since:
- 8.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ILcdProjectionAn optional projection to be chained before a lonlat2world or after a world2lonlat transformation.protected ILcdPointThe point to be used as projection origin.protected ILcdPoint[]The array of tie points in the source (unrectified) reference.protected ILcdPoint[]The array of tie points in the target (rectified) reference.protected ILcdBoundsThe valid bounds of this projection in world coordinates.Fields inherited from class com.luciad.projection.ALcdProjection
fPropertyChangeDispatcherFields inherited from interface com.luciad.projection.ILcdProjection
EPSILON -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TLcdRectifiedPolynomialProjection that represents an identity mapping.TLcdRectifiedPolynomialProjection(int aPolynomialDegree) Creates a new TLcdRectifiedPolynomialProjection with the given maximum degree for the polynomial.TLcdRectifiedPolynomialProjection(int aPolynomialDegree, ILcdPoint[] aSourcePoints, ILcdPoint[] aTargetPoints) Creates a new TLcdRectifiedPolynomialProjection based on the given source and target tie points, and the maximum degree of the polynomial.TLcdRectifiedPolynomialProjection(int aPolynomialDegree, ILcdPoint[] aSourcePoints, ILcdPoint[] aTargetPoints, ILcdProjection aBaseProjection, ILcdBounds aWorldBounds) Creates a new TLcdRectifiedPolynomialProjection based on the given source and target tie points, and the maximum degree of the polynomial. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]boundaryLats(double aLongitude) Default implementation.double[][]boundaryLons(double aLatitude) Default implementation.protected voidClears the information that might be cache for mapping between source points and target points.clone()Makes a deep clone of thisILcdProjection.booleanChecks if thisILcdProjectionequals some other Object.Returns the optional internal projection.Origin of the projection is theILcd2DEditablePointthat corresponds with origin (0, 0) of the cartesian coordinate system of the projection.intReturns the maximum degree of the polynomial.getSourcePoint(int aIndex) Returns the specified tie point in the unrectified source coordinate system.getTargetPoint(int aIndex) Returns the specified tie point in the rectified target coordinate system.intReturns the number of tie point pairs.Returns the bounds in world (reference) coordinates.inthashCode()booleaninLonLatBounds(ILcdPoint aLLHP) Checks if anILcdPointis inside the valid area of geodetic coordinates of the projection.booleaninWorldBoundsOnEllipsoid(ILcdPoint aXYPoint, ILcdEllipsoid aEllipsoid) Default implementation callsinWorldBoundsOnSpherewithaEllipsoid.getAuxRadius()as sphere radius.booleaninWorldBoundsOnSphere(ILcdPoint aXYPoint, double aRadius) Checks if aILcdPointis inside the valid cartesian area of the projection.booleanIf all geodetic coordinates (l ,j ) are projected (visible) by anILcdProjectionand all (x,y ) coordinates are bounded this istrue.booleanAnILcdProjectionis continuous if there are no interruptions in the world coordinates.booleanisValid()Returns whether the current projection settings are valid.voidloadProperties(String aPrefix, Properties aProperties) The properties of anILcdProjectiondetermine the projection parameters that determine the plane, cylinder or cone on which the projection is done.voidlonlatheight2worldOnEllipsoidSFCT(ILcdPoint aLLHP, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aXYPointSFCT) Default implementation callslonlatheight2worldOnEllipsoidSFCTwithaEllipsoid.getAuxRadius()as sphere radius.voidlonlatheight2worldOnSphereSFCT(ILcdPoint aLLHP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) Transforms anILcd2DEditablePointon a sphere into the cartesian coordinate system of the projection.protected voidmapPointBackward(ILcdPoint aTargetPoint, ILcd2DEditablePoint aSourcePointSFCT) Applies the inverse of the polynomial transformation to the target point, to obtain the source point.protected voidmapPointForward(ILcdPoint aSourcePoint, ILcd2DEditablePoint aTargetPointSFCT) Applies the polynomial transformation to the source point to obtain the target point.voidsetBaseProjection(ILcdProjection aBaseProjection) Sets the projection to be chained before a lonlat2world or after a world2lonlat transformation.voidsetPolynomialDegree(int aPolynomialDegree) Sets the maximum degree of the polynomial (between 1 and 4).voidsetSourcePoints(ILcdPoint[] aSourcePoints) Sets the tie points in the unrectified source coordinate system.voidsetTargetPoints(ILcdPoint[] aTargetPoints) Sets the tie points in the rectified target coordinate system.voidsetWorldBounds(ILcdBounds aWorldBounds) Sets the bounds in world (reference) coordinates.voidworld2DEditableBoundsOnEllipsoidSFCT(ILcdEllipsoid aEllipsoid, ILcd2DEditableBounds aWorldBounds) Default implementation callsworld2lonlatOnSphereSFCTwithaEllipsoid.getAuxRadius()as sphere radius.voidworld2DEditableBoundsOnSphereSFCT(double aRadius, ILcd2DEditableBounds aWorldBounds) Sets theILcd2DEditableBoundsobject to the bounds of the projection in world coordinates.voidworld2lonlatOnEllipsoidSFCT(ILcdPoint aXYPoint, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLPointSFCT) Default implementation callsworld2lonlatOnSphereSFCTwithaEllipsoid.getAuxRadius()as sphere radius.voidworld2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPointSFCT) Transforms anILcdPointfrom the cartesian coordinate system of the projection into anILcd2DEditablePointonto a sphere.voidwritePropertiesSFCT(String aPrefix, Properties aPropertiesSFCT) The properties of anILcdProjectiondetermine the projection parameters that determine the plane, cylinder or cone on which the projection is done.Methods inherited from class com.luciad.projection.ALcdProjection
addPropertyChangeListener, firePropertyChangeEvent, removePropertyChangeListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.projection.ILcdProjection
toStringMethods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
fSourcePoints
The array of tie points in the source (unrectified) reference. -
fTargetPoints
The array of tie points in the target (rectified) reference. -
fBaseProjection
An optional projection to be chained before a lonlat2world or after a world2lonlat transformation. -
fWorldBounds
The valid bounds of this projection in world coordinates. -
fOrigin
The point to be used as projection origin. If a base projection is defined, the origin of the base projection is used instead.
-
-
Constructor Details
-
TLcdRectifiedPolynomialProjection
public TLcdRectifiedPolynomialProjection()Creates a new TLcdRectifiedPolynomialProjection that represents an identity mapping. -
TLcdRectifiedPolynomialProjection
public TLcdRectifiedPolynomialProjection(int aPolynomialDegree) Creates a new TLcdRectifiedPolynomialProjection with the given maximum degree for the polynomial.- Parameters:
aPolynomialDegree- the maximum degree for the polynomial.
-
TLcdRectifiedPolynomialProjection
public TLcdRectifiedPolynomialProjection(int aPolynomialDegree, ILcdPoint[] aSourcePoints, ILcdPoint[] aTargetPoints) Creates a new TLcdRectifiedPolynomialProjection based on the given source and target tie points, and the maximum degree of the polynomial.- Parameters:
aPolynomialDegree- the maximum degree for the polynomial.aSourcePoints- the unrectified tie points.aTargetPoints- the rectified tie points.
-
TLcdRectifiedPolynomialProjection
public TLcdRectifiedPolynomialProjection(int aPolynomialDegree, ILcdPoint[] aSourcePoints, ILcdPoint[] aTargetPoints, ILcdProjection aBaseProjection, ILcdBounds aWorldBounds) Creates a new TLcdRectifiedPolynomialProjection based on the given source and target tie points, and the maximum degree of the polynomial. Additionally, specifies a projection to be chained before a lonlat2world or after a world2lonlat transformation. Optionally, the bounds of the world model can also be specified. If null, the inBounds methods will return true or fall-back to the basic projection.- Parameters:
aPolynomialDegree- the maximum degree for the polynomial.aSourcePoints- the unrectified tie points.aTargetPoints- the rectified tie points.aBaseProjection- the optional projection to be chained.aWorldBounds- the optional bounds of the projection.
-
-
Method Details
-
getPolynomialDegree
public int getPolynomialDegree()Returns the maximum degree of the polynomial. -
setPolynomialDegree
public void setPolynomialDegree(int aPolynomialDegree) Sets the maximum degree of the polynomial (between 1 and 4). -
isValid
public boolean isValid()Returns whether the current projection settings are valid. -
loadProperties
Description copied from interface:ILcdProjectionThe properties of anILcdProjectiondetermine the projection parameters that determine the plane, cylinder or cone on which the projection is done. The properties of anILcdProjectionare of course dependent on the projection. A common property for allILcdprojectionobjects is the origin of the projection. Other, more specific, properties are standard parallels, azimuthal direction, perspective distance, ... .- Specified by:
loadPropertiesin interfaceILcdProjection- Parameters:
aPrefix- prefix for property names.aProperties- Properties object containing the serialized projection.
-
writePropertiesSFCT
Description copied from interface:ILcdProjectionThe properties of anILcdProjectiondetermine the projection parameters that determine the plane, cylinder or cone on which the projection is done. The properties of anILcdProjectionare of course dependent on the projection. A common property for allILcdprojectionobjects is the origin of the projection. Other, more specific, properties are standard parallels, azimuthal direction, perspective distance, ... .- Specified by:
writePropertiesSFCTin interfaceILcdProjection- Parameters:
aPrefix- prefix for property names.aPropertiesSFCT- Properties object in which to store the serialized projection properties as side effect.
-
clearMapCache
protected void clearMapCache()Clears the information that might be cache for mapping between source points and target points. -
mapPointForward
protected void mapPointForward(ILcdPoint aSourcePoint, ILcd2DEditablePoint aTargetPointSFCT) throws TLcdOutOfBoundsException Applies the polynomial transformation to the source point to obtain the target point.- Throws:
TLcdOutOfBoundsException
-
mapPointBackward
protected void mapPointBackward(ILcdPoint aTargetPoint, ILcd2DEditablePoint aSourcePointSFCT) throws TLcdOutOfBoundsException Applies the inverse of the polynomial transformation to the target point, to obtain the source point.- Throws:
TLcdOutOfBoundsException
-
equals
Description copied from interface:ILcdProjectionChecks if thisILcdProjectionequals some other Object.- Specified by:
equalsin interfaceILcdProjection- Parameters:
aObject- Object to compare with.- Returns:
- true if the Object is an instance of the same
ILcdProjectionclass and having the same projection properties, false otherwise.
-
hashCode
public int hashCode() -
clone
Description copied from interface:ILcdProjectionMakes a deep clone of thisILcdProjection.- Specified by:
clonein interfaceILcdProjection- Returns:
- deep clone of this
ILcdProjection.
-
setSourcePoints
Sets the tie points in the unrectified source coordinate system.- Parameters:
aSourcePoints- the unrectified tie points.
-
setTargetPoints
Sets the tie points in the rectified target coordinate system.- Parameters:
aTargetPoints- the rectified tie points.
-
setBaseProjection
Sets the projection to be chained before a lonlat2world or after a world2lonlat transformation.- Parameters:
aBaseProjection- the projection to be chained.
-
getWorldBounds
Returns the bounds in world (reference) coordinates.- Returns:
- the world bounds.
-
setWorldBounds
Sets the bounds in world (reference) coordinates.- Parameters:
aWorldBounds- the world bounds.
-
getTiePointCount
public int getTiePointCount()Description copied from interface:ILcdRectifiedProjectionReturns the number of tie point pairs.- Specified by:
getTiePointCountin interfaceILcdRectifiedProjection- Returns:
- the number of tie point pairs.
-
getSourcePoint
Description copied from interface:ILcdRectifiedProjectionReturns the specified tie point in the unrectified source coordinate system.- Specified by:
getSourcePointin interfaceILcdRectifiedProjection- Parameters:
aIndex- the index of the tie point.- Returns:
- the unrectified tie points.
-
getTargetPoint
Description copied from interface:ILcdRectifiedProjectionReturns the specified tie point in the rectified target coordinate system.- Specified by:
getTargetPointin interfaceILcdRectifiedProjection- Parameters:
aIndex- the index of the tie point.- Returns:
- the rectified tie points.
-
getBaseProjection
Description copied from interface:ILcdRectifiedProjectionReturns the optional internal projection. This projection is chained before a lonlat2world or after a world2lonlat transformation.- Specified by:
getBaseProjectionin interfaceILcdRectifiedProjection- Returns:
- the projection to be chained.
-
isAllInBounds
public boolean isAllInBounds()Description copied from interface:ILcdProjectionIf all geodetic coordinates (l ,j ) are projected (visible) by anILcdProjectionand all (x,y ) coordinates are bounded this istrue. AllILcdProjectionobjects have bounded (x,y ) coordinates because the projection is cut off if necessary.- Specified by:
isAllInBoundsin interfaceILcdProjection- Returns:
trueif all LonLatPoints are within the bounds of the projection,falseotherwise.
-
isContinuous
public boolean isContinuous()Description copied from interface:ILcdProjectionAnILcdProjectionis continuous if there are no interruptions in the world coordinates. Most projections are continuous.- Specified by:
isContinuousin interfaceILcdProjection- Returns:
trueif the projection is continuous,falseotherwise.
-
getOrigin
Description copied from interface:ILcdProjectionOrigin of the projection is theILcd2DEditablePointthat corresponds with origin (0, 0) of the cartesian coordinate system of the projection.- Specified by:
getOriginin interfaceILcdProjection- Returns:
- the origin of the projection.
-
lonlatheight2worldOnSphereSFCT
public void lonlatheight2worldOnSphereSFCT(ILcdPoint aLLHP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException Description copied from interface:ILcdProjectionTransforms anILcd2DEditablePointon a sphere into the cartesian coordinate system of the projection.- Specified by:
lonlatheight2worldOnSphereSFCTin interfaceILcdProjection- Parameters:
aLLHP- point to be projected.aRadius- radius of the sphere (meters).aXYPointSFCT- projected point as side effect.- Throws:
TLcdOutOfBoundsException- If theILcdPointaLLHPis not within the valid area of the projection (visible area), then this exception is thrown.
-
lonlatheight2worldOnEllipsoidSFCT
public void lonlatheight2worldOnEllipsoidSFCT(ILcdPoint aLLHP, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException Description copied from class:ALcdProjectionDefault implementation callslonlatheight2worldOnEllipsoidSFCTwithaEllipsoid.getAuxRadius()as sphere radius.- Specified by:
lonlatheight2worldOnEllipsoidSFCTin interfaceILcdProjection- Overrides:
lonlatheight2worldOnEllipsoidSFCTin classALcdProjection- Parameters:
aLLHP- point to be projected.aEllipsoid- ellipsoid on which the point is defined.aXYPointSFCT- projected point as side effect.- Throws:
TLcdOutOfBoundsException- If theILcdPointaLLHPis not within the valid area of the projection (visible area), then this exception is thrown.
-
world2lonlatOnSphereSFCT
public void world2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPointSFCT) throws TLcdOutOfBoundsException Description copied from interface:ILcdProjectionTransforms anILcdPointfrom the cartesian coordinate system of the projection into anILcd2DEditablePointonto a sphere.- Specified by:
world2lonlatOnSphereSFCTin interfaceILcdProjection- Parameters:
aXYPoint- projected point for which the corresponding geodetic point is sought.aRadius- radius of the sphere (meters).aLLPointSFCT- resulting geodetic coordinate as side effect.- Throws:
TLcdOutOfBoundsException- If theILcdPointaXYPointis not within the valid area of the projection (visible area), then this exception is thrown.
-
world2lonlatOnEllipsoidSFCT
public void world2lonlatOnEllipsoidSFCT(ILcdPoint aXYPoint, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLPointSFCT) throws TLcdOutOfBoundsException Description copied from class:ALcdProjectionDefault implementation callsworld2lonlatOnSphereSFCTwithaEllipsoid.getAuxRadius()as sphere radius.- Specified by:
world2lonlatOnEllipsoidSFCTin interfaceILcdProjection- Overrides:
world2lonlatOnEllipsoidSFCTin classALcdProjection- Parameters:
aXYPoint- projected point for which the corresponding geodetic point is sought.aEllipsoid- ellipsoid on which the geodetic coordinate is defined.aLLPointSFCT- resulting geodetic coordinate as side effect.- Throws:
TLcdOutOfBoundsException- If theILcdPointaXYPointis not within the valid area of the projection (visible area), then this exception is thrown.
-
inLonLatBounds
Description copied from interface:ILcdProjectionChecks if anILcdPointis inside the valid area of geodetic coordinates of the projection. The valid area is determined by the LonLatPoints that are visible and for which the corresponding cartesian coordinate is within the boundaries.- Specified by:
inLonLatBoundsin interfaceILcdProjection- Parameters:
aLLHP-ILcdPointto be checked upon.- Returns:
trueif valid,falseif invalid.
-
inWorldBoundsOnSphere
Description copied from interface:ILcdProjectionChecks if aILcdPointis inside the valid cartesian area of the projection. The valid cartesian area is determined naturally by the projection bounds or by an artificial introduced boundary limit because some cartesian points are at infinity. The shape of the valid cartesian area is in many cases rectangular or circular although it might be more complex.- Specified by:
inWorldBoundsOnSpherein interfaceILcdProjection- Parameters:
aXYPoint- point to be checked upon.aRadius- radius of the sphere.- Returns:
trueif valid,falseif invalid.
-
inWorldBoundsOnEllipsoid
Description copied from class:ALcdProjectionDefault implementation callsinWorldBoundsOnSpherewithaEllipsoid.getAuxRadius()as sphere radius.- Specified by:
inWorldBoundsOnEllipsoidin interfaceILcdProjection- Overrides:
inWorldBoundsOnEllipsoidin classALcdProjection- Parameters:
aXYPoint- point to be checked upon.aEllipsoid- ellipsoid on which the geodetic coordinate is defined.- Returns:
trueif valid,falseif invalid.- See Also:
-
world2DEditableBoundsOnSphereSFCT
Description copied from interface:ILcdProjectionSets theILcd2DEditableBoundsobject to the bounds of the projection in world coordinates.- Specified by:
world2DEditableBoundsOnSphereSFCTin interfaceILcdProjection- Parameters:
aRadius- radius of the sphere.aWorldBounds- the bounds of the projection in world coordinates as side effect.
-
world2DEditableBoundsOnEllipsoidSFCT
public void world2DEditableBoundsOnEllipsoidSFCT(ILcdEllipsoid aEllipsoid, ILcd2DEditableBounds aWorldBounds) Description copied from class:ALcdProjectionDefault implementation callsworld2lonlatOnSphereSFCTwithaEllipsoid.getAuxRadius()as sphere radius.- Specified by:
world2DEditableBoundsOnEllipsoidSFCTin interfaceILcdProjection- Overrides:
world2DEditableBoundsOnEllipsoidSFCTin classALcdProjection- Parameters:
aEllipsoid- ellipsoid considered.aWorldBounds- the bounds of the projection in world coordinates as side effect.
-
boundaryLons
public double[][] boundaryLons(double aLatitude) Description copied from class:ALcdProjectionDefault implementation. To be redefined for specific projections.- Specified by:
boundaryLonsin interfaceILcdProjection- Overrides:
boundaryLonsin classALcdProjection- Parameters:
aLatitude- latitude in decimal degrees and -90.0 <=aLat<= 90.0.- Returns:
- the array of pairs of longitudes[0] and longitudes[1], where the closed interval longitudes[0] -> longitudes[1] is in visible area and -180.0 <= lon[i] <= 180.0.
-
boundaryLats
public double[][] boundaryLats(double aLongitude) Description copied from class:ALcdProjectionDefault implementation. To be redefined for specific projections.- Specified by:
boundaryLatsin interfaceILcdProjection- Overrides:
boundaryLatsin classALcdProjection- Parameters:
aLongitude- longitude in decimal degrees -180.0 <= lon <= 180.0 .- Returns:
- the array of pairs of latitudes lats[0] and lats[1], where the closed interval lats[0] -> lats[1] is in visible area and -90.0 <= lats[i] <= 90.0 .
-