Table of Contents

Class CoordinateSequenceComparator

Namespace
NetTopologySuite.Geometries
Assembly
NetTopologySuite.dll

Compares two CoordinateSequences.

public class CoordinateSequenceComparator : IComparer<CoordinateSequence>
Inheritance
CoordinateSequenceComparator
Implements
Inherited Members

Remarks

For sequences of the same dimension, the ordering is lexicographic. Otherwise, lower dimensions are sorted before higher. The dimensions compared can be limited; if this is done ordinate dimensions above the limit will not be compared.

If different behaviour is required for comparing size, dimension, or coordinate values, any or all methods can be overridden.

Constructors

CoordinateSequenceComparator()

Creates a comparator which will test all dimensions.

public CoordinateSequenceComparator()

CoordinateSequenceComparator(int)

Creates a comparator which will test only the specified number of dimensions.

public CoordinateSequenceComparator(int dimensionLimit)

Parameters

dimensionLimit int

The number of dimensions to test

Fields

DimensionLimit

The number of dimensions to test

protected int DimensionLimit

Field Value

int

Methods

Compare(CoordinateSequence, CoordinateSequence)

Compares two CoordinateSequences for relative order.

public int Compare(CoordinateSequence s1, CoordinateSequence s2)

Parameters

s1 CoordinateSequence

A coordinate sequence

s2 CoordinateSequence

A coordinate sequence

Returns

int

-1, 0, or 1 depending on whether s1 is less than, equal to, or greater than s2

Compare(double, double)

Compare two doubles, allowing for NaN values. NaN is treated as being less than any valid number.

public static int Compare(double a, double b)

Parameters

a double

A double

b double

A double

Returns

int

-1, 0, or 1 depending on whether a is less than, equal to or greater than b

Compare(object, object)

Compares two CoordinateSequences for relative order.

public int Compare(object o1, object o2)

Parameters

o1 object

A coordinate sequence

o2 object

A coordinate sequence

Returns

int

-1, 0, or 1 depending on whether o1 is less than, equal to, or greater than o2

CompareCoordinate(CoordinateSequence, CoordinateSequence, int, int)

Compares the same coordinate of two CoordinateSequences

protected int CompareCoordinate(CoordinateSequence s1, CoordinateSequence s2, int i, int dimension)

Parameters

s1 CoordinateSequence

A coordinate sequence

s2 CoordinateSequence

A coordinate sequence

i int

The index of the coordinate to test

dimension int

the number of dimensions to test

Returns

int