Class HotPixel
- java.lang.Object
-
- org.locationtech.jts.noding.snapround.HotPixel
-
public class HotPixel extends java.lang.Object
Implements a "hot pixel" as used in the Snap Rounding algorithm. A hot pixel contains the interior of the tolerance square and the boundary minus the top and right segments.The hot pixel operations are all computed in the integer domain to avoid rounding problems.
- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description HotPixel(Coordinate pt, double scaleFactor, LineIntersector li)
Creates a new hot pixel, using a given scale factor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addSnappedNode(NodedSegmentString segStr, int segIndex)
Adds a new node (equal to the snap pt) to the specified segment if the segment passes through the hot pixelCoordinate
getCoordinate()
Gets the coordinate this hot pixel is based at.Envelope
getSafeEnvelope()
Returns a "safe" envelope that is guaranteed to contain the hot pixel.boolean
intersects(Coordinate p0, Coordinate p1)
Tests whether the line segment (p0-p1) intersects this hot pixel.
-
-
-
Constructor Detail
-
HotPixel
public HotPixel(Coordinate pt, double scaleFactor, LineIntersector li)
Creates a new hot pixel, using a given scale factor. The scale factor must be strictly positive (non-zero).- Parameters:
pt
- the coordinate at the centre of the pixelscaleFactor
- the scaleFactor determining the pixel size. Must be > 0li
- the intersector to use for testing intersection with line segments
-
-
Method Detail
-
getCoordinate
public Coordinate getCoordinate()
Gets the coordinate this hot pixel is based at.- Returns:
- the coordinate of the pixel
-
getSafeEnvelope
public Envelope 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.- Returns:
- an envelope which contains the hot pixel
-
intersects
public boolean intersects(Coordinate p0, Coordinate p1)
Tests whether the line segment (p0-p1) intersects this hot pixel.- Parameters:
p0
- the first coordinate of the line segment to testp1
- the second coordinate of the line segment to test- Returns:
- true if the line segment intersects this hot pixel
-
addSnappedNode
public boolean addSnappedNode(NodedSegmentString segStr, int segIndex)
Adds a new node (equal to the snap pt) to the specified segment if the segment passes through the hot pixel- Parameters:
segStr
-segIndex
-- Returns:
- true if a node was added to the segment
-
-