Skip to content

Commit fa6714e

Browse files
committed
Add geosop orientationIndex op
1 parent badff59 commit fa6714e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

util/geosop/GeometryOp.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <geos/geom/GeometryFactory.h>
2525
#include <geos/geom/prep/PreparedGeometry.h>
2626
#include <geos/geom/prep/PreparedGeometryFactory.h>
27+
#include <geos/algorithm/Orientation.h>
2728
#include <geos/algorithm/construct/LargestEmptyCircle.h>
2829
#include <geos/algorithm/construct/MaximumInscribedCircle.h>
2930
#include <geos/algorithm/BoundaryNodeRule.h>
@@ -802,6 +803,18 @@ std::vector<GeometryOpCreator> opRegistry {
802803
return new Result( prepGeomCache.get(geom.get())->intersects( geomB.get() ) );
803804
});
804805
}},
806+
{ "orientationIndex", [](std::string name) { return GeometryOp::create(name,
807+
catRel, "orientation index for a line segment and a point",
808+
Result::typeInt,
809+
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB) {
810+
std::unique_ptr<CoordinateSequence> seqA = geom->getCoordinates();
811+
Coordinate p0 = seqA->getAt(0);
812+
Coordinate p1 = seqA->getAt(1);
813+
std::unique_ptr<CoordinateSequence> seqB = geomB->getCoordinates();
814+
Coordinate q = seqB->getAt(0);
815+
return new Result( algorithm::Orientation::index(p0, p1, q) );
816+
});
817+
}},
805818

806819
//============= category: Overlay ==================
807820

0 commit comments

Comments
 (0)