Class HotPixel
- Namespace
- NetTopologySuite.Noding.Snapround
- Assembly
- NetTopologySuite.dll
Implements a "hot pixel" as used in the Snap Rounding algorithm. A hot pixel is a square region centred on the rounded valud of the coordinate given, and of width equal to the size of the scale factor. It is a partially open region, which contains the interior of the tolerance square and the boundary minus the top and right segments. This ensures that every point of the space lies in a unique hot pixel. It also matches the rounding semantics for numbers.
The hot pixel operations are all computed in the integer domain to avoid rounding problems. Hot Pixels support being marked as nodes. This is used to prevent introducing nodes at line vertices which do not have other lines snapped to them.public class HotPixel
- Inheritance
-
HotPixel
- Inherited Members
Constructors
HotPixel(Coordinate, double)
Creates a new hot pixel centered on a rounded point, using a given scale factor. The scale factor must be strictly positive(non-zero).
public HotPixel(Coordinate pt, double scaleFactor)
Parameters
ptCoordinateThe coordinate at the center of the hot pixel (already rounded)
scaleFactordoubleThe scale factor determining the pixel size
HotPixel(Coordinate, double, LineIntersector)
Initializes a new instance of the HotPixel class.
[Obsolete("LineIntersector is no longer used.")]
public HotPixel(Coordinate pt, double scaleFactor, LineIntersector li)
Parameters
ptCoordinateThe coordinate at the center of the hot pixel
scaleFactordoubleThe scale factor determining the pixel size
liLineIntersectorThe intersector to use for testing intersection with line segments
Properties
Coordinate
Gets the coordinate this hot pixel is based at.
public Coordinate Coordinate { get; }
Property Value
IsNode
Gets or sets a value indicating whether this pixel has been marked as a node.
public bool IsNode { get; set; }
Property Value
- bool
trueif the pixel is marked as a node
ScaleFactor
Gets the scale factor for the precision grid for this pixel.
public double ScaleFactor { get; }
Property Value
Width
Gets the width of the hot pixel in the original coordinate system.
public double Width { get; }
Property Value
Methods
AddSnappedNode(INodableSegmentString, int)
Adds a new node (equal to the snap pt) to the specified segment if the segment passes through the hot pixel
[Obsolete("Moved to MCIndexPointSnapper")]
public bool AddSnappedNode(INodableSegmentString segStr, int segIndex)
Parameters
segStrINodableSegmentStringsegIndexint
Returns
- bool
trueif a node was added to the segment
GetSafeEnvelope()
Returns a "safe" envelope that is guaranteed to contain the hot pixel. The envelope returned will be larger than the exact envelope of the pixel.
[Obsolete("Moved to MCIndexPointSnapper")]
public Envelope GetSafeEnvelope()
Returns
- Envelope
An envelope which contains the pixel
Intersects(Coordinate)
Tests whether a coordinate lies in (intersects) this hot pixel.
public bool Intersects(Coordinate p)
Parameters
pCoordinateThe coordinate to test
Returns
- bool
trueif the coordinate intersects this hot pixel
Intersects(Coordinate, Coordinate)
Tests whether the line segment (p0-p1) intersects this hot pixel.
public bool Intersects(Coordinate p0, Coordinate p1)
Parameters
p0CoordinateThe first coordinate of the line segment to test
p1CoordinateThe second coordinate of the line segment to test
Returns
- bool
true if the line segment intersects this hot pixel.
IntersectsScaled(Coordinate, Coordinate)
[Obsolete("This method was never intended to be public and will be removed in a future release.")]
public bool IntersectsScaled(Coordinate p0, Coordinate p1)
Parameters
p0Coordinatep1Coordinate
Returns
ToString()
public override string ToString()