org.deegree.geometry.standard.primitive
Class DefaultRing

java.lang.Object
  extended by org.deegree.geometry.standard.AbstractDefaultGeometry
      extended by org.deegree.geometry.standard.primitive.DefaultRing
All Implemented Interfaces:
GMLObject, Object, TypedObjectNode, Geometry, Curve, GeometricPrimitive, Ring
Direct Known Subclasses:
DefaultLinearRing

public class DefaultRing
extends AbstractDefaultGeometry
implements Ring

Default implementation of Ring.

Version:
$Revision: 31641 $, $Date: 2011-08-24 21:24:55 +0200 (Wed, 24 Aug 2011) $
Author:
Markus Schneider , last edited by: $Author: mschneider $

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.deegree.geometry.primitive.Ring
Ring.RingType
 
Nested classes/interfaces inherited from interface org.deegree.geometry.primitive.Curve
Curve.CurveType
 
Nested classes/interfaces inherited from interface org.deegree.geometry.primitive.GeometricPrimitive
GeometricPrimitive.PrimitiveType
 
Nested classes/interfaces inherited from interface org.deegree.geometry.Geometry
Geometry.GeometryType
 
Field Summary
protected  List<Curve> members
          The constituting Curve instances.
protected  List<CurveSegment> segments
          The segments of all member curves.
 
Fields inherited from class org.deegree.geometry.standard.AbstractDefaultGeometry
crs, env, id, jtsFactory, jtsGeometry, pm
 
Constructor Summary
protected DefaultRing(String id, CRS crs, PrecisionModel pm, DefaultLineString singleCurve)
          Creates a new DefaultRing instance from a closed DefaultLineString.
  DefaultRing(String id, ICRS crs, PrecisionModel pm, LineStringSegment segment)
          Creates a new DefaultRing instance from the given parameters.
  DefaultRing(String id, ICRS crs, PrecisionModel pm, List<Curve> members)
          Creates a new DefaultRing instance from the given parameters.
 
Method Summary
protected  com.vividsolutions.jts.geom.LinearRing buildJTSGeometry()
           
 LineString getAsLineString()
          Returns a linear interpolated representation of the curve.
 Pair<Point,Point> getBoundary()
          The boundary of a curve is the set of points at either end of the curve.
 Points getControlPoints()
          Convenience method for accessing the control points of linear interpolated curves.
 int getCoordinateDimension()
          Returns the coordinate dimension, i.e. the dimension of the space that the geometry is embedded in.
 List<CurveSegment> getCurveSegments()
          Returns the segments that constitute this curve.
 Curve.CurveType getCurveType()
          Must always return Curve.CurveType.Ring.
 Point getEndPoint()
          Returns the end point of the curve.
 Geometry.GeometryType getGeometryType()
          Must always return Geometry.GeometryType#PRIMITIVE_GEOMETRY.
 Measure getLength(Unit requestedUnit)
           
 List<Curve> getMembers()
          Returns the Curves that constitute this Ring.
 GeometricPrimitive.PrimitiveType getPrimitiveType()
          Must always return GeometricPrimitive.PrimitiveType.Curve.
 Ring.RingType getRingType()
          Returns the type of ring.
 Point getStartPoint()
          Returns the start point of the curve.
 boolean isClosed()
          Returns whether the curve forms a closed loop.
 
Methods inherited from class org.deegree.geometry.standard.AbstractDefaultGeometry
contains, createFromJTS, crosses, equals, getAsDefaultGeometry, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getDifference, getDistance, getEnvelope, getGMLProperties, getId, getIntersection, getJTSGeometry, getPrecision, getUnion, intersects, isBeyond, isDisjoint, isSFSCompliant, isWithin, isWithinDistance, overlaps, setCoordinateSystem, setGMLProperties, setId, setPrecision, toString, touches
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.deegree.geometry.Geometry
contains, crosses, equals, getBuffer, getCentroid, getConvexHull, getCoordinateSystem, getDifference, getDistance, getEnvelope, getId, getIntersection, getPrecision, getUnion, intersects, isBeyond, isDisjoint, isSFSCompliant, isWithin, isWithinDistance, overlaps, setCoordinateSystem, setGMLProperties, setId, setPrecision, touches
 
Methods inherited from interface org.deegree.commons.tom.gml.GMLObject
getGMLProperties
 

Field Detail

members

protected List<Curve> members
The constituting Curve instances.


segments

protected List<CurveSegment> segments
The segments of all member curves.

Constructor Detail

DefaultRing

public DefaultRing(String id,
                   ICRS crs,
                   PrecisionModel pm,
                   List<Curve> members)
Creates a new DefaultRing instance from the given parameters.

Parameters:
id - identifier, may be null
crs - coordinate reference system, may be null
pm - precision model, may be null
members - the Curves that compose the Ring

DefaultRing

public DefaultRing(String id,
                   ICRS crs,
                   PrecisionModel pm,
                   LineStringSegment segment)
Creates a new DefaultRing instance from the given parameters.

Parameters:
id - identifier, may be null
crs - coordinate reference system, may be null
pm - precision model, may be null
segment - the segment that composes the Ring

DefaultRing

protected DefaultRing(String id,
                      CRS crs,
                      PrecisionModel pm,
                      DefaultLineString singleCurve)
Creates a new DefaultRing instance from a closed DefaultLineString.

Parameters:
id - identifier, may be null
crs - coordinate reference system, may be null
pm - precision model, may be null
singleCurve - closed line string
Method Detail

getCoordinateDimension

public int getCoordinateDimension()
Description copied from interface: Geometry
Returns the coordinate dimension, i.e. the dimension of the space that the geometry is embedded in.

Specified by:
getCoordinateDimension in interface Geometry
Returns:
the coordinate dimension

getGeometryType

public Geometry.GeometryType getGeometryType()
Description copied from interface: GeometricPrimitive
Must always return Geometry.GeometryType#PRIMITIVE_GEOMETRY.

Specified by:
getGeometryType in interface Geometry
Specified by:
getGeometryType in interface GeometricPrimitive
Returns:
must always return Geometry.GeometryType#PRIMITIVE_GEOMETRY

getPrimitiveType

public GeometricPrimitive.PrimitiveType getPrimitiveType()
Description copied from interface: Curve
Must always return GeometricPrimitive.PrimitiveType.Curve.

Specified by:
getPrimitiveType in interface Curve
Specified by:
getPrimitiveType in interface GeometricPrimitive
Returns:
GeometricPrimitive.PrimitiveType.Curve

getRingType

public Ring.RingType getRingType()
Description copied from interface: Ring
Returns the type of ring.

Specified by:
getRingType in interface Ring
Returns:
the type of ring

getAsLineString

public LineString getAsLineString()
Description copied from interface: Curve
Returns a linear interpolated representation of the curve.

NOTE: This method is only safe to use when the curve is a LineString or LinearRing or it only consists of LineStringSegments. In any other case it will fail.

Specified by:
getAsLineString in interface Curve
Returns:
curve as a linestring

getBoundary

public Pair<Point,Point> getBoundary()
Description copied from interface: Curve
The boundary of a curve is the set of points at either end of the curve. If the curve is a cycle, the two ends are identical, and the curve (if topologically closed) is considered to not have a boundary.

Specified by:
getBoundary in interface Curve
Returns:
boundary of a curve. If a curve does not have a boundary because it is closed an empty List shall be retruned

getCurveSegments

public List<CurveSegment> getCurveSegments()
Description copied from interface: Curve
Returns the segments that constitute this curve.

Specified by:
getCurveSegments in interface Curve
Returns:
the segments that constitute this curve

getCurveType

public Curve.CurveType getCurveType()
Description copied from interface: Ring
Must always return Curve.CurveType.Ring.

Specified by:
getCurveType in interface Curve
Specified by:
getCurveType in interface Ring
Returns:
Curve.CurveType.Ring

getLength

public Measure getLength(Unit requestedUnit)
Specified by:
getLength in interface Curve
Returns:
length of the curve

isClosed

public boolean isClosed()
Description copied from interface: Curve
Returns whether the curve forms a closed loop.

Specified by:
isClosed in interface Curve
Returns:
true, if the curve forms a closed loop, false otherwise

getMembers

public List<Curve> getMembers()
Description copied from interface: Ring
Returns the Curves that constitute this Ring.

Specified by:
getMembers in interface Ring
Returns:
the constituting curves

getStartPoint

public Point getStartPoint()
Description copied from interface: Curve
Returns the start point of the curve.

Specified by:
getStartPoint in interface Curve
Returns:
the start point of the curve

getEndPoint

public Point getEndPoint()
Description copied from interface: Curve
Returns the end point of the curve.

Specified by:
getEndPoint in interface Curve
Returns:
the end point of the curve

getControlPoints

public Points getControlPoints()
Description copied from interface: Curve
Convenience method for accessing the control points of linear interpolated curves.

NOTE: This method is only safe to use when the curve is a LineString or LinearRing or it only consists of LineStringSegments. In any other case it will fail.

Specified by:
getControlPoints in interface Curve
Returns:
the control points

buildJTSGeometry

protected com.vividsolutions.jts.geom.LinearRing buildJTSGeometry()
Overrides:
buildJTSGeometry in class AbstractDefaultGeometry


Copyright © 2011. All Rights Reserved.