Class HotPixel
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.
Inherited Members
Namespace: NetTopologySuite.Noding.Snapround
Assembly: NetTopologySuite.dll
Syntax
public class HotPixel
Constructors
| Improve this Doc View SourceHotPixel(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).
Declaration
public HotPixel(Coordinate pt, double scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | pt | The coordinate at the center of the hot pixel (already rounded) |
Double | scaleFactor | The scale factor determining the pixel size |
HotPixel(Coordinate, Double, LineIntersector)
Initializes a new instance of the HotPixel class.
Declaration
[Obsolete("LineIntersector is no longer used.")]
public HotPixel(Coordinate pt, double scaleFactor, LineIntersector li)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | pt | The coordinate at the center of the hot pixel |
Double | scaleFactor | The scale factor determining the pixel size |
LineIntersector | li | The intersector to use for testing intersection with line segments |
Properties
| Improve this Doc View SourceCoordinate
Gets the coordinate this hot pixel is based at.
Declaration
public Coordinate Coordinate { get; }
Property Value
Type | Description |
---|---|
Coordinate |
IsNode
Gets or sets a value indicating whether this pixel has been marked as a node.
Declaration
public bool IsNode { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
|
ScaleFactor
Gets the scale factor for the precision grid for this pixel.
Declaration
public double ScaleFactor { get; }
Property Value
Type | Description |
---|---|
Double |
Width
Gets the width of the hot pixel in the original coordinate system.
Declaration
public double Width { get; }
Property Value
Type | Description |
---|---|
Double |
Methods
| Improve this Doc View SourceAddSnappedNode(INodableSegmentString, Int32)
Adds a new node (equal to the snap pt) to the specified segment if the segment passes through the hot pixel
Declaration
[Obsolete("Moved to MCIndexPointSnapper")]
public bool AddSnappedNode(INodableSegmentString segStr, int segIndex)
Parameters
Type | Name | Description |
---|---|---|
INodableSegmentString | segStr | |
Int32 | segIndex |
Returns
Type | Description |
---|---|
Boolean |
|
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.
Declaration
[Obsolete("Moved to MCIndexPointSnapper")]
public Envelope GetSafeEnvelope()
Returns
Type | Description |
---|---|
Envelope | An envelope which contains the pixel |
Intersects(Coordinate)
Tests whether a coordinate lies in (intersects) this hot pixel.
Declaration
public bool Intersects(Coordinate p)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p | The coordinate to test |
Returns
Type | Description |
---|---|
Boolean |
|
Intersects(Coordinate, Coordinate)
Tests whether the line segment (p0-p1) intersects this hot pixel.
Declaration
public bool Intersects(Coordinate p0, Coordinate p1)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p0 | The first coordinate of the line segment to test |
Coordinate | p1 | The second coordinate of the line segment to test |
Returns
Type | Description |
---|---|
Boolean | true if the line segment intersects this hot pixel. |
IntersectsScaled(Coordinate, Coordinate)
Declaration
[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
Type | Name | Description |
---|---|---|
Coordinate | p0 | |
Coordinate | p1 |
Returns
Type | Description |
---|---|
Boolean |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |