NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Geometries.GeometryFactory Class Reference

Supplies a set of utility methods for building Geometry objects from lists of Coordinates. More...

Inheritance diagram for NetTopologySuite.Geometries.GeometryFactory:
NetTopologySuite.Geometries.OgcCompliantGeometryFactory

Public Member Functions

 GeometryFactory (IPrecisionModel precisionModel, int srid, ICoordinateSequenceFactory coordinateSequenceFactory)
 Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation. More...
 
 GeometryFactory (ICoordinateSequenceFactory coordinateSequenceFactory)
 Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0. More...
 
 GeometryFactory (IPrecisionModel precisionModel)
 Constructs a GeometryFactory that generates Geometries having the given {PrecisionModel} and the default CoordinateSequence implementation. More...
 
 GeometryFactory (IPrecisionModel precisionModel, int srid)
 Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation. More...
 
 GeometryFactory ()
 Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0. More...
 
virtual IGeometry ToGeometry (Envelope envelope)
 Creates a IGeometry with the same extent as the given envelope. More...
 
IPoint CreatePoint (Coordinate coordinate)
 Creates a Point using the given Coordinate. A null coordinate creates an empty Geometry. More...
 
IPoint CreatePoint (ICoordinateSequence coordinates)
 Creates a Point using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty Point. More...
 
ILineString CreateLineString (Coordinate[] coordinates)
 Creates a LineString using the given Coordinates. A null or empty array creates an empty LineString. More...
 
ILineString CreateLineString (ICoordinateSequence coordinates)
 Creates a LineString using the given CoordinateSequence. A null or empty CoordinateSequence creates an empty LineString. More...
 
ILinearRing CreateLinearRing (Coordinate[] coordinates)
 Creates a LinearRing using the given Coordinates; a null or empty array creates an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal. More...
 
ILinearRing CreateLinearRing (ICoordinateSequence coordinates)
 Creates a LinearRing using the given CoordinateSequence; a null or empty CoordinateSequence creates an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal. More...
 
virtual IPolygon CreatePolygon (ILinearRing shell, ILinearRing[] holes)
 Constructs a Polygon with the given exterior boundary and interior boundaries. More...
 
virtual IPolygon CreatePolygon (ICoordinateSequence coordinates)
 Constructs a Polygon with the given exterior boundary. More...
 
virtual IPolygon CreatePolygon (Coordinate[] coordinates)
 Constructs a Polygon with the given exterior boundary. More...
 
virtual IPolygon CreatePolygon (ILinearRing shell)
 Constructs a Polygon with the given exterior boundary. More...
 
IMultiPoint CreateMultiPoint (IPoint[] point)
 Creates a IMultiPoint using the given Points. A null or empty array will create an empty MultiPoint. More...
 
IMultiPoint CreateMultiPoint (Coordinate[] coordinates)
 Creates a IMultiPoint using the given Coordinates. A null or empty array will create an empty MultiPoint. More...
 
IMultiPoint CreateMultiPoint (ICoordinateSequence coordinates)
 Creates a IMultiPoint using the given CoordinateSequence. A null or empty CoordinateSequence will create an empty MultiPoint. More...
 
IMultiLineString CreateMultiLineString (ILineString[] lineStrings)
 Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString. More...
 
IMultiPolygon CreateMultiPolygon (IPolygon[] polygons)
 Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL. More...
 
IGeometryCollection CreateGeometryCollection (IGeometry[] geometries)
 Creates a GeometryCollection using the given Geometries; a null or empty array will create an empty GeometryCollection. More...
 
IGeometry BuildGeometry (ICollection< IGeometry > geomList)
 Build an appropriate Geometry, MultiGeometry, or GeometryCollection to contain the Geometrys in it. More...
 
IGeometry CreateGeometry (IGeometry g)
 Creates a deep copy of the input IGeometry. The ICoordinateSequenceFactory defined for this factory is used to copy the ICoordinateSequences of the input geometry. This is a convenient way to change the CoordinateSequence used to represent a geometry, or to change the factory used for a geometry. IGeometry.Clone() can also be used to make a deep copy, but it does not allow changing the CoordinateSequence type. More...
 

Static Public Member Functions

static IPoint CreatePointFromInternalCoord (Coordinate coord, IGeometry exemplar)
 
static IPoint[] ToPointArray (ICollection< IGeometry > points)
 Converts the ICollection to an array. More...
 
static IGeometry[] ToGeometryArray (ICollection< IGeometry > geometries)
 Converts the ICollection to an array. More...
 
static ILineString[] ToLineStringArray (ICollection< IGeometry > lineStrings)
 Converts the ICollection to an array. More...
 
static ILinearRing[] ToLinearRingArray (ICollection< IGeometry > linearRings)
 Converts the ICollection to an array. More...
 
static IPolygon[] ToPolygonArray (ICollection< IGeometry > polygons)
 Converts the ICollection to an array. More...
 
static IMultiPoint[] ToMultiPointArray (ICollection< IGeometry > multiPoints)
 Converts the ICollection to an array. More...
 
static IMultiLineString[] ToMultiLineStringArray (ICollection< IGeometry > multiLineStrings)
 Converts the ICollection to an array. More...
 
static IMultiPolygon[] ToMultiPolygonArray (ICollection< IGeometry > multiPolygons)
 Converts the ICollection to an array. More...
 

Static Public Attributes

static readonly IGeometryFactory Default = new GeometryFactory()
 A predefined GeometryFactory with PrecisionModel == PrecisionModels.Floating. More...
 
static readonly IGeometryFactory Floating = Default
 A predefined GeometryFactory with PrecisionModel == PrecisionModels.Floating. More...
 
static readonly IGeometryFactory FloatingSingle = new GeometryFactory(new PrecisionModel(PrecisionModels.FloatingSingle))
 A predefined GeometryFactory with PrecisionModel == PrecisionModels.FloatingSingle. More...
 
static readonly IGeometryFactory Fixed = new GeometryFactory(new PrecisionModel(PrecisionModels.Fixed))
 A predefined GeometryFactory with PrecisionModel == PrecisionModels.Fixed. More...
 

Properties

IPrecisionModel PrecisionModel [get]
 Returns the PrecisionModel that Geometries created by this factory will be associated with. More...
 
ICoordinateSequenceFactory CoordinateSequenceFactory [get]
 
int SRID [get]
 The SRID value defined for this factory. More...
 

Detailed Description

Supplies a set of utility methods for building Geometry objects from lists of Coordinates.

Note that the factory constructor methods do not change the input coordinates in any way. In particular, they are not rounded to the supplied PrecisionModel. It is assumed that input Coordinates meet the given precision.

Constructor & Destructor Documentation

NetTopologySuite.Geometries.GeometryFactory.GeometryFactory ( IPrecisionModel  precisionModel,
int  srid,
ICoordinateSequenceFactory  coordinateSequenceFactory 
)

Constructs a GeometryFactory that generates Geometries having the given PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.

NetTopologySuite.Geometries.GeometryFactory.GeometryFactory ( ICoordinateSequenceFactory  coordinateSequenceFactory)

Constructs a GeometryFactory that generates Geometries having the given CoordinateSequence implementation, a double-precision floating PrecisionModel and a spatial-reference ID of 0.

NetTopologySuite.Geometries.GeometryFactory.GeometryFactory ( IPrecisionModel  precisionModel)

Constructs a GeometryFactory that generates Geometries having the given {PrecisionModel} and the default CoordinateSequence implementation.

Parameters
precisionModelThe PrecisionModel to use.
NetTopologySuite.Geometries.GeometryFactory.GeometryFactory ( IPrecisionModel  precisionModel,
int  srid 
)

Constructs a GeometryFactory that generates Geometries having the given PrecisionModel and spatial-reference ID, and the default CoordinateSequence implementation.

Parameters
precisionModelThe PrecisionModel to use.
sridThe SRID to use.
NetTopologySuite.Geometries.GeometryFactory.GeometryFactory ( )

Constructs a GeometryFactory that generates Geometries having a floating PrecisionModel and a spatial-reference ID of 0.

Member Function Documentation

IGeometry NetTopologySuite.Geometries.GeometryFactory.BuildGeometry ( ICollection< IGeometry >  geomList)

Build an appropriate Geometry, MultiGeometry, or GeometryCollection to contain the Geometrys in it.

If geomList contains a single Polygon, the Polygon is returned.
If geomList contains several Polygons, a MultiPolygon is returned.
If geomList contains some Polygons and some LineStrings, a GeometryCollection is returned.
If geomList is empty, an empty GeometryCollection is returned. Note that this method does not "flatten" Geometries in the input, and hence if any MultiGeometries are contained in the input a GeometryCollection containing them will be returned.

Parameters
geomListThe Geometry to combine.
Returns
A IGeometry of the "smallest", "most type-specific" class that can contain the elements of geomList.

Determine some facts about the geometries in the list

Now construct an appropriate geometry to return

IGeometry NetTopologySuite.Geometries.GeometryFactory.CreateGeometry ( IGeometry  g)

Creates a deep copy of the input IGeometry. The ICoordinateSequenceFactory defined for this factory is used to copy the ICoordinateSequences of the input geometry. This is a convenient way to change the CoordinateSequence used to represent a geometry, or to change the factory used for a geometry. IGeometry.Clone() can also be used to make a deep copy, but it does not allow changing the CoordinateSequence type.

Parameters
gThe geometry
Returns
A deep copy of the input geometry, using the CoordinateSequence type of this factory
See also
IGeometry.Clone
IGeometryCollection NetTopologySuite.Geometries.GeometryFactory.CreateGeometryCollection ( IGeometry[]  geometries)

Creates a GeometryCollection using the given Geometries; a null or empty array will create an empty GeometryCollection.

Parameters
geometriesan array of Geometries, each of which may be empty but not null, or null
Returns
A IGeometryCollection object
ILinearRing NetTopologySuite.Geometries.GeometryFactory.CreateLinearRing ( Coordinate[]  coordinates)

Creates a LinearRing using the given Coordinates; a null or empty array creates an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal.

Parameters
coordinatesAn array without null elements, or an empty array, or null.
Returns
A ILinearRing object
Exceptions
ArgumentExceptionIf the ring is not closed, or has too few points
ILinearRing NetTopologySuite.Geometries.GeometryFactory.CreateLinearRing ( ICoordinateSequence  coordinates)

Creates a LinearRing using the given CoordinateSequence; a null or empty CoordinateSequence creates an empty LinearRing. The points must form a closed and simple linestring. Consecutive points must not be equal.

Parameters
coordinatesA CoordinateSequence (possibly empty), or null.
Returns
A ILinearRing object
Exceptions
ArgumentExceptionIf the ring is not closed, or has too few points
ILineString NetTopologySuite.Geometries.GeometryFactory.CreateLineString ( Coordinate[]  coordinates)

Creates a LineString using the given Coordinates. A null or empty array creates an empty LineString.

Parameters
coordinatesAn array without null elements, or an empty array, or null.
Returns
A ILineString object
ILineString NetTopologySuite.Geometries.GeometryFactory.CreateLineString ( ICoordinateSequence  coordinates)

Creates a LineString using the given CoordinateSequence. A null or empty CoordinateSequence creates an empty LineString.

Parameters
coordinatesA CoordinateSequence (possibly empty), or null.
Returns
A ILineString object
IMultiLineString NetTopologySuite.Geometries.GeometryFactory.CreateMultiLineString ( ILineString[]  lineStrings)

Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString.

Parameters
lineStringsLineStrings, each of which may be empty but not null-
Returns
A IMultiLineString object
IMultiPoint NetTopologySuite.Geometries.GeometryFactory.CreateMultiPoint ( IPoint[]  point)

Creates a IMultiPoint using the given Points. A null or empty array will create an empty MultiPoint.

Parameters
pointAn array (without null elements), or an empty array, or null.
Returns
A IMultiPoint object
IMultiPoint NetTopologySuite.Geometries.GeometryFactory.CreateMultiPoint ( Coordinate[]  coordinates)

Creates a IMultiPoint using the given Coordinates. A null or empty array will create an empty MultiPoint.

Parameters
coordinatesAn array (without null elements), or an empty array, or null
Returns
A IMultiPoint object
IMultiPoint NetTopologySuite.Geometries.GeometryFactory.CreateMultiPoint ( ICoordinateSequence  coordinates)

Creates a IMultiPoint using the given CoordinateSequence. A null or empty CoordinateSequence will create an empty MultiPoint.

Parameters
coordinatesA CoordinateSequence (possibly empty), or null.
Returns
A IMultiPoint object
IMultiPolygon NetTopologySuite.Geometries.GeometryFactory.CreateMultiPolygon ( IPolygon[]  polygons)

Creates a MultiPolygon using the given Polygons; a null or empty array will create an empty Polygon. The polygons must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL.

Parameters
polygonsPolygons, each of which may be empty but not null.
Returns
A IMultiPolygon object
IPoint NetTopologySuite.Geometries.GeometryFactory.CreatePoint ( Coordinate  coordinate)

Creates a Point using the given Coordinate. A null coordinate creates an empty Geometry.

Parameters
coordinatea Coordinate, or null
Returns
A IPoint object
IPoint NetTopologySuite.Geometries.GeometryFactory.CreatePoint ( ICoordinateSequence  coordinates)

Creates a Point using the given CoordinateSequence; a null or empty CoordinateSequence will create an empty Point.

Parameters
coordinatesa CoordinateSequence (possibly empty), or null
Returns
A IPoint object
static IPoint NetTopologySuite.Geometries.GeometryFactory.CreatePointFromInternalCoord ( Coordinate  coord,
IGeometry  exemplar 
)
static

Parameters
coord
exemplar
Returns
virtual IPolygon NetTopologySuite.Geometries.GeometryFactory.CreatePolygon ( ILinearRing  shell,
ILinearRing[]  holes 
)
virtual

Constructs a Polygon with the given exterior boundary and interior boundaries.

Parameters
shellThe outer boundary of the new Polygon, or null or an empty LinearRing if the empty point is to be created.
holesThe inner boundaries of the new Polygon, or null or empty LinearRing s if the empty point is to be created.
Returns
A IPolygon object

Reimplemented in NetTopologySuite.Geometries.OgcCompliantGeometryFactory.

virtual IPolygon NetTopologySuite.Geometries.GeometryFactory.CreatePolygon ( ICoordinateSequence  coordinates)
virtual

Constructs a Polygon with the given exterior boundary.

Parameters
coordinatesthe outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created.
Returns
A IPolygon object
Exceptions
ArgumentExceptionIf the boundary ring is invalid

Reimplemented in NetTopologySuite.Geometries.OgcCompliantGeometryFactory.

virtual IPolygon NetTopologySuite.Geometries.GeometryFactory.CreatePolygon ( Coordinate[]  coordinates)
virtual

Constructs a Polygon with the given exterior boundary.

Parameters
coordinatesthe outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created.
Returns
A IPolygon object
Exceptions
ArgumentExceptionIf the boundary ring is invalid

Reimplemented in NetTopologySuite.Geometries.OgcCompliantGeometryFactory.

virtual IPolygon NetTopologySuite.Geometries.GeometryFactory.CreatePolygon ( ILinearRing  shell)
virtual

Constructs a Polygon with the given exterior boundary.

Parameters
shellthe outer boundary of the new Polygon, or null or an empty LinearRing if the empty geometry is to be created.
Returns
the created Polygon
Exceptions
ArgumentExceptionIf the boundary ring is invalid

Reimplemented in NetTopologySuite.Geometries.OgcCompliantGeometryFactory.

virtual IGeometry NetTopologySuite.Geometries.GeometryFactory.ToGeometry ( Envelope  envelope)
virtual

Creates a IGeometry with the same extent as the given envelope.

The Geometry returned is guaranteed to be valid. To provide this behaviour, the following cases occur:

If the Envelope is:

  • null returns an empty IPoint
  • a point returns a non-empty IPoint
  • a line returns a two-point ILineString
  • a rectangle returns a IPolygon whose points are (minx, maxy), (minx, maxy), (maxx, maxy), (maxx, miny).
Parameters
envelopeThe Envelope
Returns
An empty Point (for null Envelopes), a Point (when min x = max x and min y = max y) or a Polygon (in all other cases)

Reimplemented in NetTopologySuite.Geometries.OgcCompliantGeometryFactory.

static IGeometry [] NetTopologySuite.Geometries.GeometryFactory.ToGeometryArray ( ICollection< IGeometry >  geometries)
static

Converts the ICollection to an array.

Parameters
geometriesThe ICollection of Geometry's to convert.
Returns
The ICollection in array format.
static ILinearRing [] NetTopologySuite.Geometries.GeometryFactory.ToLinearRingArray ( ICollection< IGeometry >  linearRings)
static

Converts the ICollection to an array.

Parameters
linearRingsThe ICollection of LinearRings to convert.
Returns
The ICollection in array format.
static ILineString [] NetTopologySuite.Geometries.GeometryFactory.ToLineStringArray ( ICollection< IGeometry >  lineStrings)
static

Converts the ICollection to an array.

Parameters
lineStringsThe ICollection of LineStrings to convert.
Returns
The ICollection in array format.
static IMultiLineString [] NetTopologySuite.Geometries.GeometryFactory.ToMultiLineStringArray ( ICollection< IGeometry >  multiLineStrings)
static

Converts the ICollection to an array.

Parameters
multiLineStringsThe ICollection of MultiLineStrings to convert.
Returns
The ICollection in array format.
static IMultiPoint [] NetTopologySuite.Geometries.GeometryFactory.ToMultiPointArray ( ICollection< IGeometry >  multiPoints)
static

Converts the ICollection to an array.

Parameters
multiPointsThe ICollection of MultiPoints to convert.
Returns
The ICollection in array format.
static IMultiPolygon [] NetTopologySuite.Geometries.GeometryFactory.ToMultiPolygonArray ( ICollection< IGeometry >  multiPolygons)
static

Converts the ICollection to an array.

Parameters
multiPolygonsThe ICollection of MultiPolygons to convert.
Returns
The ICollection in array format.
static IPoint [] NetTopologySuite.Geometries.GeometryFactory.ToPointArray ( ICollection< IGeometry >  points)
static

Converts the ICollection to an array.

Parameters
pointsThe ICollection of Points to convert.
Returns
The ICollection in array format.
static IPolygon [] NetTopologySuite.Geometries.GeometryFactory.ToPolygonArray ( ICollection< IGeometry >  polygons)
static

Converts the ICollection to an array.

Parameters
polygonsThe ICollection of Polygons to convert.
Returns
The ICollection in array format.

Member Data Documentation

readonly IGeometryFactory NetTopologySuite.Geometries.GeometryFactory.Default = new GeometryFactory()
static

A predefined GeometryFactory with PrecisionModel == PrecisionModels.Floating.

readonly IGeometryFactory NetTopologySuite.Geometries.GeometryFactory.Fixed = new GeometryFactory(new PrecisionModel(PrecisionModels.Fixed))
static

A predefined GeometryFactory with PrecisionModel == PrecisionModels.Fixed.

readonly IGeometryFactory NetTopologySuite.Geometries.GeometryFactory.Floating = Default
static

A predefined GeometryFactory with PrecisionModel == PrecisionModels.Floating.

A shortcut for GeometryFactory.Default.

readonly IGeometryFactory NetTopologySuite.Geometries.GeometryFactory.FloatingSingle = new GeometryFactory(new PrecisionModel(PrecisionModels.FloatingSingle))
static

A predefined GeometryFactory with PrecisionModel == PrecisionModels.FloatingSingle.

Property Documentation

ICoordinateSequenceFactory NetTopologySuite.Geometries.GeometryFactory.CoordinateSequenceFactory
get

IPrecisionModel NetTopologySuite.Geometries.GeometryFactory.PrecisionModel
get

Returns the PrecisionModel that Geometries created by this factory will be associated with.

int NetTopologySuite.Geometries.GeometryFactory.SRID
get

The SRID value defined for this factory.


The documentation for this class was generated from the following file: