Rebuild geometries from subpaths left by clipping with a rectangle.
More...
#include <RectangleIntersectionBuilder.h>
Rebuild geometries from subpaths left by clipping with a rectangle.
The RectangleIntersectionBuilder is used to maintain lists of polygons, linestrings and points left from clipping a geom::Geometry with a Rectangle. Once all clipping has been done, the class builds a valid geom::Geometry from the components.
- Note
- This is a utility class needed by RectangleIntersection, and is not intended for public use.
Definition at line 63 of file RectangleIntersectionBuilder.h.
geos::operation::intersection::RectangleIntersectionBuilder::~RectangleIntersectionBuilder |
( |
| ) |
|
geos::operation::intersection::RectangleIntersectionBuilder::RectangleIntersectionBuilder |
( |
const geom::GeometryFactory & |
f | ) |
|
|
inlineprivate |
void geos::operation::intersection::RectangleIntersectionBuilder::add |
( |
geom::Polygon * |
g | ) |
|
|
private |
void geos::operation::intersection::RectangleIntersectionBuilder::add |
( |
geom::LineString * |
g | ) |
|
|
private |
void geos::operation::intersection::RectangleIntersectionBuilder::add |
( |
geom::Point * |
g | ) |
|
|
private |
std::unique_ptr<geom::Geometry> geos::operation::intersection::RectangleIntersectionBuilder::build |
( |
| ) |
|
|
private |
Build the result geometry from partial results and clean up.
void geos::operation::intersection::RectangleIntersectionBuilder::clear |
( |
| ) |
|
|
private |
void geos::operation::intersection::RectangleIntersectionBuilder::close_boundary |
( |
const Rectangle & |
rect, |
|
|
std::vector< geom::Coordinate > * |
ring, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2 |
|
) |
| |
|
private |
Close a ring clockwise along rectangle edges.
Only the 4 corners and x1,y1 need to be considered. The possible cases are:
x1,y1 corner1 x1,y1 corner1 corner2 x1,y1 corner1 corner2 corner3 x1,y1 corner1 corner2 corner3 corner4 x1,y1
void geos::operation::intersection::RectangleIntersectionBuilder::close_ring |
( |
const Rectangle & |
rect, |
|
|
std::vector< geom::Coordinate > * |
ring |
|
) |
| |
|
private |
bool geos::operation::intersection::RectangleIntersectionBuilder::empty |
( |
| ) |
const |
|
private |
void geos::operation::intersection::RectangleIntersectionBuilder::reconnect |
( |
| ) |
|
|
private |
Reconnect disjointed parts
When we clip a LinearRing we may get multiple linestrings. Often the first and last ones can be reconnected to simplify output.
Sample clip with a rectangle 0,0 –> 10,10 without reconnecting:
Input: POLYGON ((5 10,0 0,10 0,5 10)) Output: MULTILINESTRING ((5 10,0 0),(10 0,5 10)) Desired: LINESTRING (10 0,5 10,0 0)
TODO: If there is a very sharp spike from inside the rectangle outside, and then back in, it is possible that the intersection points at the edge are equal. In this case we could reconnect the linestrings. The task is the same we're already doing for the 1st/last linestrings, we'd just do it for any adjacent pair as well.
void geos::operation::intersection::RectangleIntersectionBuilder::reconnectPolygons |
( |
const Rectangle & |
rect | ) |
|
|
private |
Build polygons from parts left by clipping one.
- Build exterior ring(s) from lines
- Attach polygons as holes to the exterior ring(s)
Export parts to another container
void geos::operation::intersection::RectangleIntersectionBuilder::reverseLines |
( |
| ) |
|
|
private |
std::list<geom::LineString*> geos::operation::intersection::RectangleIntersectionBuilder::lines |
|
private |
std::list<geom::Point*> geos::operation::intersection::RectangleIntersectionBuilder::points |
|
private |
std::list<geom::Polygon*> geos::operation::intersection::RectangleIntersectionBuilder::polygons |
|
private |
The documentation for this class was generated from the following file: