Table of Contents

Class NtsGeometryServices

Namespace
NetTopologySuite
Assembly
NetTopologySuite.dll

A geometry service provider class

public class NtsGeometryServices
Inheritance
NtsGeometryServices
Inherited Members

Remarks

When overriding this class, you need to provide a public constructor with the following arguments:

  1. A factory to create coordinate sequences
  2. PrecisionModelA precision model
  3. intspatial reference id (srid)
  4. GeometryOverlayA class that bundles an overlay operation function set
  5. CoordinateEqualityComparerA class that performs checks Coordinates for equality.
NtsGeometryServices(CoordinateSequenceFactory, PrecisionModel, int, GeometryOverlay, CoordinateEqualityComparer)

Constructors

NtsGeometryServices()

Creates an instance of this class, using the CoordinateArraySequenceFactory as default and a Floating precision model.
No DefaultSRID is specified.
The Legacy function set for overlay operations is being used.

public NtsGeometryServices()

NtsGeometryServices(CoordinateSequenceFactory)

Creates an instance of this class, using a Floating precision model as default.
No DefaultSRID is specified.
The default coordinate sequence factory is defined by coordinateSequenceFactory.
The Legacy function set for overlay operations is being used.

public NtsGeometryServices(CoordinateSequenceFactory coordinateSequenceFactory)

Parameters

coordinateSequenceFactory CoordinateSequenceFactory

NtsGeometryServices(CoordinateSequenceFactory, PrecisionModel, int)

Creates an instance of this class, using the provided CoordinateSequenceFactory, PrecisionModel and spatial reference Id (srid).

public NtsGeometryServices(CoordinateSequenceFactory coordinateSequenceFactory, PrecisionModel precisionModel, int srid)

Parameters

coordinateSequenceFactory CoordinateSequenceFactory

The coordinate sequence factory to use.

precisionModel PrecisionModel

The precision model.

srid int

The default spatial reference ID

NtsGeometryServices(CoordinateSequenceFactory, PrecisionModel, int, GeometryOverlay, CoordinateEqualityComparer)

Creates an instance of this class, using the provided CoordinateSequenceFactory, PrecisionModel, a spatial reference Id (srid) and a GeometryOverlay.

public NtsGeometryServices(CoordinateSequenceFactory coordinateSequenceFactory, PrecisionModel precisionModel, int srid, GeometryOverlay geometryOverlay, CoordinateEqualityComparer coordinateEqualityComparer)

Parameters

coordinateSequenceFactory CoordinateSequenceFactory

The coordinate sequence factory to use.

precisionModel PrecisionModel

The precision model.

srid int

The default spatial reference ID

geometryOverlay GeometryOverlay

The geometry overlay function set to use.

coordinateEqualityComparer CoordinateEqualityComparer

The equality comparer for coordinates

NtsGeometryServices(GeometryOverlay)

Creates an instance of this class, using the CoordinateArraySequenceFactory as default and a Floating precision model. No DefaultSRID is specified

public NtsGeometryServices(GeometryOverlay geometryOverlay)

Parameters

geometryOverlay GeometryOverlay

The function set to perform overlay operations

NtsGeometryServices(PrecisionModel)

Creates an instance of this class, using the CoordinateArraySequenceFactory as default.
No DefaultSRID is specified.
The default precision model is defined by precisionModel.
The Legacy function set for overlay operations is being used.

public NtsGeometryServices(PrecisionModel precisionModel)

Parameters

precisionModel PrecisionModel

NtsGeometryServices(PrecisionModel, int)

Creates an instance of this class, using the CoordinateArraySequenceFactory as default.
A value of srid is assigned to DefaultSRID.
The default precision model is defined by precisionModel.
The Legacy function set for overlay operations is being used.

public NtsGeometryServices(PrecisionModel precisionModel, int srid)

Parameters

precisionModel PrecisionModel
srid int

Properties

CoordinateEqualityComparer

Gets an object that is used to test 2 coordinates for equality.

public CoordinateEqualityComparer CoordinateEqualityComparer { get; }

Property Value

CoordinateEqualityComparer

A coordinate equality tester object

DefaultCoordinateSequenceFactory

Gets or sets the coordiate sequence factory to use

public CoordinateSequenceFactory DefaultCoordinateSequenceFactory { get; }

Property Value

CoordinateSequenceFactory

DefaultPrecisionModel

Gets or sets the default precision model

public PrecisionModel DefaultPrecisionModel { get; }

Property Value

PrecisionModel

DefaultSRID

Gets the default spatial reference id

public int DefaultSRID { get; }

Property Value

int

GeometryOverlay

Gets or sets a value indicating the operations to use for geometry overlay.

public GeometryOverlay GeometryOverlay { get; }

Property Value

GeometryOverlay

A set of geometry overlay functions.

Instance

Gets or sets the default instance of NtsGeometryServices.

public static NtsGeometryServices Instance { get; set; }

Property Value

NtsGeometryServices

Exceptions

ArgumentNullException

Thrown when trying to set the value to null.

Methods

CreateGeometryFactory()

Creates or retrieves a geometry factory using DefaultSRID, DefaultPrecisionModel and DefaultCoordinateSequenceFactory.

public GeometryFactory CreateGeometryFactory()

Returns

GeometryFactory

A geometry factory

CreateGeometryFactory(CoordinateSequenceFactory)

Creates or retrieves a geometry factory using DefaultSRID, DefaultPrecisionModel and coordinateSequenceFactory.

public GeometryFactory CreateGeometryFactory(CoordinateSequenceFactory coordinateSequenceFactory)

Parameters

coordinateSequenceFactory CoordinateSequenceFactory

Returns

GeometryFactory

A geometry factory

CreateGeometryFactory(PrecisionModel)

Creates or retrieves a geometry factory using DefaultSRID, precisionModel and DefaultCoordinateSequenceFactory.

public GeometryFactory CreateGeometryFactory(PrecisionModel precisionModel)

Parameters

precisionModel PrecisionModel

The precision model to use.

Returns

GeometryFactory

A geometry factory

CreateGeometryFactory(PrecisionModel, int)

Creates or retrieves a geometry factory using srid, precisionModel and DefaultCoordinateSequenceFactory.

public GeometryFactory CreateGeometryFactory(PrecisionModel precisionModel, int srid)

Parameters

precisionModel PrecisionModel

The precision model to use.

srid int

The spatial reference id.

Returns

GeometryFactory

A geometry factory

CreateGeometryFactory(PrecisionModel, int, CoordinateSequenceFactory)

Creates or retrieves a geometry factory using srid, precisionModel and coordinateSequenceFactory.

public GeometryFactory CreateGeometryFactory(PrecisionModel precisionModel, int srid, CoordinateSequenceFactory coordinateSequenceFactory)

Parameters

precisionModel PrecisionModel

The precision model to use.

srid int

The spatial reference id.

coordinateSequenceFactory CoordinateSequenceFactory

Returns

GeometryFactory

A geometry factory

CreateGeometryFactory(int)

Creates or retrieves a geometry factory using srid, DefaultPrecisionModel and DefaultCoordinateSequenceFactory.

public GeometryFactory CreateGeometryFactory(int srid)

Parameters

srid int

Returns

GeometryFactory

A geometry factory

CreateGeometryFactoryCore(PrecisionModel, int, CoordinateSequenceFactory)

Creates a GeometryFactory based on the given parameters.

protected virtual GeometryFactory CreateGeometryFactoryCore(PrecisionModel precisionModel, int srid, CoordinateSequenceFactory coordinateSequenceFactory)

Parameters

precisionModel PrecisionModel

The value for PrecisionModel.

srid int

The value for SRID.

coordinateSequenceFactory CoordinateSequenceFactory

The value for CoordinateSequenceFactory.

Returns

GeometryFactory

A GeometryFactory that has the given values.

Remarks

This method is expected to be safe to call from any number of threads at once.

Implementations must make sure to use a constructor which is properly assigning GeometryOverlay to the factory.

Although the result for a given set of parameters is cached, there is no guarantee that, once this method is called with some set of parameters, it will never be called again with an exactly equal set of parameters. When this does happen, an arbitrary result is chosen as the winner (not necessarily the first one to start or finish), and all other results are discarded.

CreatePrecisionModel(PrecisionModel)

Creates a precision model based on given precision model.

[Obsolete("Will be removed in a future version")]
public PrecisionModel CreatePrecisionModel(PrecisionModel precisionModel)

Parameters

precisionModel PrecisionModel

Returns

PrecisionModel

The precision model

CreatePrecisionModel(PrecisionModels)

Creates a precision model based on given precision model type

[Obsolete("Will be removed in a future version")]
public PrecisionModel CreatePrecisionModel(PrecisionModels modelType)

Parameters

modelType PrecisionModels

Returns

PrecisionModel

The precision model type

CreatePrecisionModel(double)

Creates a precision model based on the given scale factor.

[Obsolete("Will be removed in a future version")]
public PrecisionModel CreatePrecisionModel(double scale)

Parameters

scale double

The scale factor

Returns

PrecisionModel

The precision model.