org.geotools.geometry.iso.primitive
Class CurveImpl

java.lang.Object
  extended by org.geotools.geometry.iso.root.GeometryImpl
      extended by org.geotools.geometry.iso.primitive.PrimitiveImpl
          extended by org.geotools.geometry.iso.primitive.OrientablePrimitiveImpl
              extended by org.geotools.geometry.iso.primitive.OrientableCurveImpl
                  extended by org.geotools.geometry.iso.primitive.CurveImpl
All Implemented Interfaces:
java.io.Serializable, org.opengis.geometry.coordinate.GenericCurve, org.opengis.geometry.Geometry, org.opengis.geometry.primitive.Curve, org.opengis.geometry.primitive.OrientableCurve, org.opengis.geometry.primitive.OrientablePrimitive, org.opengis.geometry.primitive.Primitive, org.opengis.geometry.TransfiniteSet

public class CurveImpl
extends OrientableCurveImpl
implements org.opengis.geometry.primitive.Curve

Curve (Figure 11 of the ISO 19107 v5) is a descendent subtype of Primitive through OrientablePrimitive. It is the basis for 1-dimensional geometry. A curve is a continuous image of an open interval and so could be written as a parameterized function such as c(t):(a, b) -> E^n where "t" is a real parameter and E^n is Euclidean space of dimension n (usually 2 or 3, as determined by the coordinate reference system). Any other parameterization that results in the same image curve, traced in the same direction, such as any linear shifts and positive scales such as e(t) = c(a + t(b-a)):(0,1) -> E^n, is an equivalent representation of the same curve. For the sake of simplicity, Curves should be parameterized by arc length, so that the parameterization operation inherited from GenericCurve will be valid for parameters between 0 and the length of the curve. Curves are continuous, connected, and have a measurable length in terms of the coordinate system. The orientation of the curve is determined by this parameterization, and is consistent with the tangent function, which approximates the derivative function of the parameterization and shall always point in the "forward" direction. The parameterization of the reversal of the curve defined by c(t):(a, b) -> E^n would be defined by a function of the form s(t) = c(a + b - t):(a, b)?E^n. A curve is composed of one or more curve segments. Each curve segment within a curve may be defined using a different interpolation method. The curve segments are connected to one another, with the end point of each segment except the last being the start point of the next segment in the segment list.

Version:
Abstract Specification V5
Author:
Jackson Roehrig & Sanjay Jena
See Also:
Serialized Form

Field Summary
protected  CurveBoundaryImpl boundary
          Boundary of the Curve
 
Fields inherited from class org.geotools.geometry.iso.primitive.OrientablePrimitiveImpl
proxy
 
Fields inherited from class org.geotools.geometry.iso.primitive.PrimitiveImpl
complex, containedPrimitive, containingPrimitive
 
Fields inherited from class org.geotools.geometry.iso.root.GeometryImpl
crs, percision
 
Constructor Summary
CurveImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs, java.util.List<? extends org.opengis.geometry.primitive.CurveSegment> segments)
          The Curve constructor takes an abstract sequential list of CurveSegments with the appropriate end-to-start relationships and creates a Curve.
CurveImpl(org.opengis.geometry.coordinate.LineSegment edge)
          The Curve constructor takes an abstract sequential list of CurveSegments with the appropriate end-to-start relationships and creates a Curve.
 
Method Summary
 java.util.List<org.opengis.geometry.DirectPosition> asDirectPositions()
          Returns the DirectPositions which define the control points of this Curve
 java.util.List<org.opengis.geometry.coordinate.LineSegment> asLineSegments()
          The function "asLineString" constructs a line string (sequence of line segments) where the control points (ends of the segments) lie on this curve.
 LineStringImpl asLineString()
           
 LineStringImpl asLineString(double spacing, double offset)
           
 CurveImpl clone()
           
protected  org.opengis.geometry.primitive.OrientablePrimitive createProxy()
           
 boolean equals(java.lang.Object obj)
           
 org.opengis.geometry.DirectPosition forConstructiveParam(double cp)
           
 org.opengis.geometry.DirectPosition forParam(double distance)
           
 org.opengis.geometry.primitive.CurveBoundary getBoundary()
           
 org.opengis.geometry.complex.CompositeCurve getComposite()
           
 int getDimension(org.opengis.geometry.DirectPosition point)
          The method dimension returns the inherent dimension of this Object, which is less than or equal to the coordinate dimension.
 double getEndConstructiveParam()
           
 double getEndParam()
           
 org.opengis.geometry.DirectPosition getEndPoint()
          The operations "endPoint" shall return the DirectPositions of the last point, respectively on the GenericCurve.
 org.opengis.geometry.Envelope getEnvelope()
           
 org.opengis.geometry.coordinate.ParamForPoint getParamForPoint(org.opengis.geometry.DirectPosition p)
          The operation "paramForPoint" shall return the parameter for this GenericCurve at the passed DirectPosition.
 org.opengis.geometry.primitive.OrientableCurve[] getProxy()
          Returns an array with two orientable primitives, whereas the first one is "this" object and the second one the field proxy
 org.opengis.geometry.DirectPosition getRepresentativePoint()
           
protected  CurveSegmentImpl getSegmentAt(double dist)
           
 java.util.List<org.opengis.geometry.primitive.CurveSegment> getSegments()
           
 double getStartConstructiveParam()
           
 double getStartParam()
           
 org.opengis.geometry.DirectPosition getStartPoint()
          The operations "startPoint" shall return the DirectPositions of the first point, respectively on the GenericCurve.
 double[] getTangent(double distance)
           
 int hashCode()
           
 boolean isSimple()
           
 double length()
          This third form of the operation length returns length(0.0,length)
 double length(double par1, double par2)
           
 double length(org.opengis.geometry.coordinate.Position point1, org.opengis.geometry.coordinate.Position point2)
           
 CurveImpl merge(CurveImpl other)
          Constructs a new Curve by merging this Curve with another Curve The two input curves will not be modified.
 void split(double distance)
           
 java.lang.String toString()
           
 org.opengis.geometry.Geometry transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCRS, org.opengis.referencing.operation.MathTransform transform)
           
 
Methods inherited from class org.geotools.geometry.iso.primitive.OrientableCurveImpl
getPrimitive
 
Methods inherited from class org.geotools.geometry.iso.primitive.OrientablePrimitiveImpl
getOrientation
 
Methods inherited from class org.geotools.geometry.iso.primitive.PrimitiveImpl
addComplex, addContainedPrimitive, addContainingPrimitive, getComplexes, getContainedPrimitives, getContainingPrimitives, getMaximalComplex
 
Methods inherited from class org.geotools.geometry.iso.root.GeometryImpl
castToGeometryImpl, castToGeometryImpl, contains, contains, cRelate, crosses, difference, disjoint, distance, equals, getBuffer, getCentroid, getClosure, getConvexHull, getCoordinateDimension, getCoordinateReferenceSystem, getDistance, getMbRegion, getPositionFactory, getPrecision, intersection, intersects, isCycle, isMutable, overlaps, relate, symmetricDifference, toImmutable, touches, transform, union, within
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.geometry.primitive.OrientableCurve
getPrimitive
 
Methods inherited from interface org.opengis.geometry.primitive.OrientablePrimitive
getOrientation
 
Methods inherited from interface org.opengis.geometry.primitive.Primitive
getComplexes, getContainedPrimitives, getContainingPrimitives
 
Methods inherited from interface org.opengis.geometry.Geometry
distance, getBuffer, getCentroid, getClosure, getConvexHull, getCoordinateDimension, getCoordinateReferenceSystem, getMaximalComplex, getMbRegion, getPrecision, isCycle, isMutable, toImmutable, transform
 
Methods inherited from interface org.opengis.geometry.TransfiniteSet
contains, contains, difference, equals, intersection, intersects, symmetricDifference, union
 

Field Detail

boundary

protected CurveBoundaryImpl boundary
Boundary of the Curve

Constructor Detail

CurveImpl

public CurveImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                 java.util.List<? extends org.opengis.geometry.primitive.CurveSegment> segments)
          throws java.lang.IllegalArgumentException
The Curve constructor takes an abstract sequential list of CurveSegments with the appropriate end-to-start relationships and creates a Curve. Curve::Curve(segment[1..n] : CurveSegment) : Curve The start position of the first segment and the end position of the last segment must be associated to a PointImpl. If they are associated instead of that to a direct position, then this direct position will be used to construct a new Point.

Parameters:
crs -
segments -
Throws:
IllegalArgumentException, - if the array of CurveSegments is empty or does not fulfill the requirements of the CurveSegments
java.lang.IllegalArgumentException

CurveImpl

public CurveImpl(org.opengis.geometry.coordinate.LineSegment edge)
The Curve constructor takes an abstract sequential list of CurveSegments with the appropriate end-to-start relationships and creates a Curve. Curve::Curve(segment[1..n] : CurveSegment) : Curve The start position of the first segment and the end position of the last segment must be associated to a PointImpl. If they are associated instead of that to a direct position, then this direct position will be used to construct a new Point. Contained primitives must be curve segments or points. If it is a curve

Parameters:
factory -
segments -
containedPrimitive -
containingPrimitive -
complex -
Throws:
java.lang.IllegalArgumentException
Method Detail

getProxy

public org.opengis.geometry.primitive.OrientableCurve[] getProxy()
Description copied from class: OrientableCurveImpl
Returns an array with two orientable primitives, whereas the first one is "this" object and the second one the field proxy

Specified by:
getProxy in interface org.opengis.geometry.primitive.Curve
Specified by:
getProxy in interface org.opengis.geometry.primitive.Primitive
Overrides:
getProxy in class OrientableCurveImpl
Returns:
an array OrientablePrimitive[2] with the positive and the negative orientable primitive

clone

public CurveImpl clone()
                throws java.lang.CloneNotSupportedException
Specified by:
clone in interface org.opengis.geometry.Geometry
Specified by:
clone in class GeometryImpl
Throws:
java.lang.CloneNotSupportedException

createProxy

protected org.opengis.geometry.primitive.OrientablePrimitive createProxy()
Specified by:
createProxy in class OrientablePrimitiveImpl
Returns:
a new orientable primitive with negative orientation

getBoundary

public org.opengis.geometry.primitive.CurveBoundary getBoundary()
Specified by:
getBoundary in interface org.opengis.geometry.Geometry
Specified by:
getBoundary in interface org.opengis.geometry.primitive.OrientableCurve
Specified by:
getBoundary in interface org.opengis.geometry.primitive.Primitive
Specified by:
getBoundary in class OrientableCurveImpl

getEnvelope

public org.opengis.geometry.Envelope getEnvelope()
Specified by:
getEnvelope in interface org.opengis.geometry.Geometry
Specified by:
getEnvelope in class GeometryImpl

split

public void split(double distance)
Parameters:
distance -

getSegmentAt

protected CurveSegmentImpl getSegmentAt(double dist)
Parameters:
dist -
Returns:
CurveSegmentImpl

getStartPoint

public org.opengis.geometry.DirectPosition getStartPoint()
The operations "startPoint" shall return the DirectPositions of the first point, respectively on the GenericCurve. This differs from the boundary operator in Primitive, since it returns only the values of these two points, not representative objects. GenericCurve::startPoint() : DirectPosition2D

Specified by:
getStartPoint in interface org.opengis.geometry.coordinate.GenericCurve
Returns:
an DirectPosition2D value

getEndPoint

public org.opengis.geometry.DirectPosition getEndPoint()
The operations "endPoint" shall return the DirectPositions of the last point, respectively on the GenericCurve. This differs from the boundary operator in Primitive, since it returns only the values of these two points, not representative objects. GenericCurve::startPoint() : DirectPosition2D

Specified by:
getEndPoint in interface org.opengis.geometry.coordinate.GenericCurve
Returns:
an DirectPosition2D value

getParamForPoint

public org.opengis.geometry.coordinate.ParamForPoint getParamForPoint(org.opengis.geometry.DirectPosition p)
The operation "paramForPoint" shall return the parameter for this GenericCurve at the passed DirectPosition. If the DirectPosition is not on the curve, the nearest point on the curve shall be used. GenericCurve::paramForPoint(p : DirectPosition2D) : Set, DirectPosition2D The DirectPosition closest is the actual value for the "p" used, that is, it shall be the point on the GenericCurve closest to the coordinate passed in as "p". The return set will contain only one distance, unless the curve is not simple. If there is more than one DirectPosition on the GenericCurve at the same minimal distance from the passed "p", the return value may be an arbitrary choice of one of the possible answers.

Specified by:
getParamForPoint in interface org.opengis.geometry.coordinate.GenericCurve
Parameters:
p - an DirectPosition2D value
Returns:
Array of parameters for the Position

forParam

public org.opengis.geometry.DirectPosition forParam(double distance)
Specified by:
forParam in interface org.opengis.geometry.coordinate.GenericCurve

length

public double length(double par1,
                     double par2)
Specified by:
length in interface org.opengis.geometry.coordinate.GenericCurve

length

public double length()
This third form of the operation length returns length(0.0,length)

Returns:
length

asLineSegments

public java.util.List<org.opengis.geometry.coordinate.LineSegment> asLineSegments()
The function "asLineString" constructs a line string (sequence of line segments) where the control points (ends of the segments) lie on this curve. If "maxSpacing" is given (not zero), then the distance between control points along the generated curve is not more than "maxSpacing". If "maxOffset" is given (not zero), the distance between generated curve at any point and the original curve is be more than the "maxOffset". If both parameters are set, then both criteria are met. If the original control points of the curve lie on the curve, then they are included in the returned LineString's controlPoints. If both parameters are set to zero, then the line string returned is constructed from the control points of the original curve. GenericCurve::asLineString(spacing : Distance = 0, offset : Distance = 0) : LineString NOTE This function is useful in creating linear approximations of the curve for simple actions such as display. It is often referred to as a "stroked curve". For this purpose, the "maxOffset" version is useful in maintaining a minimal representation of the curve appropriate for the display device being targeted. This function is also useful in preparing to transform a curve from one coordinate reference system to another by transforming its control points. In this case, the "maxSpacing" version is more appropriate. Allowing both parameters to default to zero does not seem to have any useful geographic nor geometric interpretation unless further information is known about how the curves were constructed.

Returns:
an LineString value

asLineString

public LineStringImpl asLineString(double spacing,
                                   double offset)
Specified by:
asLineString in interface org.opengis.geometry.coordinate.GenericCurve

asLineString

public LineStringImpl asLineString()
Returns:
LineStringImpl

getDimension

public int getDimension(org.opengis.geometry.DirectPosition point)
The method dimension returns the inherent dimension of this Object, which is less than or equal to the coordinate dimension. The dimension of a collection of geometric objects is the largest dimension of any of its pieces. Points are 0-dimensional, curves are 1-dimensional, surfaces are 2-dimensional, and solids are 3-dimensional. Locally, the dimension of a geometric object at a point is the dimension of a local neighborhood of the point - that is the dimension of any coordinate neighborhood of the point. Dimension is unambiguously defined only for DirectPositions interior to this Object. If the passed DirectPosition2D is NULL, then the method returns the largest possible dimension for any DirectPosition2D in this Object.

Specified by:
getDimension in interface org.opengis.geometry.Geometry
Specified by:
getDimension in class GeometryImpl
Parameters:
point - a DirectPosition2D value
Returns:
an int value

getRepresentativePoint

public org.opengis.geometry.DirectPosition getRepresentativePoint()
Specified by:
getRepresentativePoint in interface org.opengis.geometry.Geometry
Specified by:
getRepresentativePoint in class GeometryImpl

isSimple

public boolean isSimple()
Specified by:
isSimple in interface org.opengis.geometry.Geometry

getSegments

public java.util.List<org.opengis.geometry.primitive.CurveSegment> getSegments()
Specified by:
getSegments in interface org.opengis.geometry.primitive.Curve

getComposite

public org.opengis.geometry.complex.CompositeCurve getComposite()
Specified by:
getComposite in interface org.opengis.geometry.primitive.OrientableCurve
Specified by:
getComposite in interface org.opengis.geometry.primitive.Primitive
Overrides:
getComposite in class OrientableCurveImpl

getTangent

public double[] getTangent(double distance)
Specified by:
getTangent in interface org.opengis.geometry.coordinate.GenericCurve

getStartParam

public double getStartParam()
Specified by:
getStartParam in interface org.opengis.geometry.coordinate.GenericCurve

getEndParam

public double getEndParam()
Specified by:
getEndParam in interface org.opengis.geometry.coordinate.GenericCurve

getStartConstructiveParam

public double getStartConstructiveParam()
Specified by:
getStartConstructiveParam in interface org.opengis.geometry.coordinate.GenericCurve

getEndConstructiveParam

public double getEndConstructiveParam()
Specified by:
getEndConstructiveParam in interface org.opengis.geometry.coordinate.GenericCurve

forConstructiveParam

public org.opengis.geometry.DirectPosition forConstructiveParam(double cp)
Specified by:
forConstructiveParam in interface org.opengis.geometry.coordinate.GenericCurve

length

public double length(org.opengis.geometry.coordinate.Position point1,
                     org.opengis.geometry.coordinate.Position point2)
Specified by:
length in interface org.opengis.geometry.coordinate.GenericCurve

asDirectPositions

public java.util.List<org.opengis.geometry.DirectPosition> asDirectPositions()
Returns the DirectPositions which define the control points of this Curve

Returns:

merge

public CurveImpl merge(CurveImpl other)
Constructs a new Curve by merging this Curve with another Curve The two input curves will not be modified. There will be no more references to positions or lists of the input curves, all values are copied.

Parameters:
other -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

transform

public org.opengis.geometry.Geometry transform(org.opengis.referencing.crs.CoordinateReferenceSystem newCRS,
                                               org.opengis.referencing.operation.MathTransform transform)
                                        throws org.opengis.geometry.MismatchedDimensionException,
                                               org.opengis.referencing.operation.TransformException
Specified by:
transform in interface org.opengis.geometry.Geometry
Overrides:
transform in class GeometryImpl
Throws:
org.opengis.geometry.MismatchedDimensionException
org.opengis.referencing.operation.TransformException


Copyright © 1996-2010 Geotools. All Rights Reserved.