From bec8387f450d37b8350f2d3242b4daae158f55f7 Mon Sep 17 00:00:00 2001 From: cbdbc Date: Tue, 19 Nov 2024 10:50:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82?= =?UTF-8?q?=D0=B5=D0=BA=D0=B0=20GEOS=203.8.1=20=D0=B4=D0=BB=D1=8F=20=D0=97?= =?UTF-8?q?=D0=9E=D0=A1=D0=A0=D0=92=20=D0=9D=D0=B5=D0=B9=D1=82=D1=80=D0=B8?= =?UTF-8?q?=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AUTHORS | 57 + CMakeLists.txt | 394 + COPYING | 502 + HOWTO_RELEASE | 47 + INSTALL | 92 + Makefile.am | 77 + NEWS | 706 + README.md | 122 + Version.txt | 22 + acsite.m4 | 55 + appveyor.yml | 81 + autogen.sh | 96 + benchmarks/CMakeLists.txt | 16 + benchmarks/ClassSizes.cpp | 76 + benchmarks/Makefile.am | 17 + benchmarks/algorithm/CMakeLists.txt | 20 + .../algorithm/InteriorPointAreaPerfTest.cpp | 138 + benchmarks/algorithm/Makefile.am | 25 + .../algorithm/UnaryUnionSegmentsPerfTest.cpp | 71 + benchmarks/algorithm/VoronoiPerfTest.cpp | 92 + benchmarks/capi/CMakeLists.txt | 24 + .../capi/GEOSPreparedContainsPerfTest.cpp | 111 + benchmarks/capi/IntersectionPerfTest.cpp | 87 + benchmarks/capi/Makefile.am | 26 + benchmarks/capi/memleak_mp_prep.c | 42 + benchmarks/capi/memleak_mp_prep.sh | 6 + benchmarks/operation/CMakeLists.txt | 12 + benchmarks/operation/Makefile.am | 9 + benchmarks/operation/buffer/CMakeLists.txt | 12 + .../buffer/IteratedBufferStressTest.cpp | 90 + benchmarks/operation/buffer/Makefile.am | 17 + benchmarks/operation/predicate/CMakeLists.txt | 12 + benchmarks/operation/predicate/Makefile.am | 17 + .../predicate/RectangleIntersectsPerfTest.cpp | 164 + capi/CMakeLists.txt | 36 + capi/Makefile.am | 33 + capi/geos_c.cpp | 1476 ++ capi/geos_c.h.in | 2194 +++ capi/geos_ts_c.cpp | 6812 ++++++++++ cmake/FindMakeDistCheck.cmake | 61 + cmake/cmake_uninstall.cmake.in | 48 + cmake/geos-config.cmake | 11 + configure.ac | 520 + debian/README.Debian | 41 + debian/changelog | 12 + debian/compat | 1 + debian/control | 51 + debian/copyright | 28 + debian/geos-config.1 | 63 + debian/libgeos-dev.dirs | 4 + debian/libgeos-dev.docs | 4 + debian/libgeos-dev.install | 6 + debian/libgeos-dev.manpages | 1 + debian/libgeos-doc.doc-base | 10 + debian/libgeos-doc.docs | 3 + debian/libgeos.dirs | 1 + debian/libgeos.docs | 3 + debian/libgeos.install | 1 + debian/makedoc | 8 + debian/rules | 127 + debian/watch | 6 + doc/CMakeLists.txt | 55 + doc/Doxyfile.in | 2450 ++++ doc/Makefile.am | 26 + doc/README | 5 + doc/check_doxygen_errors.cmake | 50 + doc/example.cpp | 1156 ++ doc/example.tosql | 9 + examples/client/CMakeLists.txt | 20 + examples/client/geos_c_client.cpp | 6 + examples/client/geos_client.cpp | 8 + include/CMakeLists.txt | 37 + include/Makefile.am | 10 + include/acconfig.h | 20 + include/geos.h | 35 + include/geos/Makefile.am | 57 + include/geos/algorithm/Angle.h | 227 + include/geos/algorithm/Area.h | 78 + include/geos/algorithm/BoundaryNodeRule.h | 145 + include/geos/algorithm/CGAlgorithmsDD.h | 165 + .../algorithm/CentralEndpointIntersector.h | 163 + include/geos/algorithm/Centroid.h | 159 + include/geos/algorithm/ConvexHull.h | 193 + include/geos/algorithm/ConvexHull.inl | 53 + include/geos/algorithm/Distance.h | 110 + include/geos/algorithm/HCoordinate.h | 103 + include/geos/algorithm/InteriorPointArea.h | 113 + include/geos/algorithm/InteriorPointLine.h | 82 + include/geos/algorithm/InteriorPointPoint.h | 76 + include/geos/algorithm/Intersection.h | 61 + include/geos/algorithm/Length.h | 53 + include/geos/algorithm/LineIntersector.h | 360 + include/geos/algorithm/Makefile.am | 39 + .../geos/algorithm/MinimumBoundingCircle.h | 139 + include/geos/algorithm/MinimumDiameter.h | 180 + .../algorithm/NotRepresentableException.h | 46 + include/geos/algorithm/Orientation.h | 96 + include/geos/algorithm/PointInRing.h | 43 + include/geos/algorithm/PointLocation.h | 92 + include/geos/algorithm/PointLocator.h | 111 + include/geos/algorithm/RayCrossingCounter.h | 153 + include/geos/algorithm/RayCrossingCounterDD.h | 167 + include/geos/algorithm/RobustDeterminant.h | 70 + include/geos/algorithm/SimplePointInRing.h | 48 + .../distance/DiscreteFrechetDistance.h | 186 + .../distance/DiscreteHausdorffDistance.h | 271 + .../geos/algorithm/distance/DistanceToPoint.h | 75 + include/geos/algorithm/distance/Makefile.am | 14 + .../algorithm/distance/PointPairDistance.h | 154 + .../locate/IndexedPointInAreaLocator.h | 122 + include/geos/algorithm/locate/Makefile.am | 13 + .../algorithm/locate/PointOnGeometryLocator.h | 58 + .../locate/SimplePointInAreaLocator.h | 115 + include/geos/algorithm/ttmath/COPYRIGHT | 28 + include/geos/algorithm/ttmath/Makefile.am | 24 + include/geos/algorithm/ttmath/README | 23 + include/geos/algorithm/ttmath/ttmath.h | 2880 ++++ include/geos/algorithm/ttmath/ttmathbig.h | 6093 +++++++++ include/geos/algorithm/ttmath/ttmathdec.h | 419 + include/geos/algorithm/ttmath/ttmathint.h | 1923 +++ include/geos/algorithm/ttmath/ttmathmisc.h | 250 + include/geos/algorithm/ttmath/ttmathobjects.h | 812 ++ include/geos/algorithm/ttmath/ttmathparser.h | 2777 ++++ include/geos/algorithm/ttmath/ttmaththreads.h | 252 + include/geos/algorithm/ttmath/ttmathtypes.h | 718 + include/geos/algorithm/ttmath/ttmathuint.h | 4189 ++++++ .../geos/algorithm/ttmath/ttmathuint_noasm.h | 1038 ++ .../geos/algorithm/ttmath/ttmathuint_x86.h | 1620 +++ .../geos/algorithm/ttmath/ttmathuint_x86_64.h | 1177 ++ .../ttmath/ttmathuint_x86_64_msvc.asm | 551 + include/geos/constants.h | 55 + include/geos/export.h | 35 + include/geos/geom.h | 153 + include/geos/geom/BinaryOp.h | 629 + include/geos/geom/Coordinate.h | 162 + include/geos/geom/Coordinate.inl | 154 + include/geos/geom/CoordinateArraySequence.h | 143 + .../geom/CoordinateArraySequenceFactory.h | 73 + .../geom/CoordinateArraySequenceFactory.inl | 60 + include/geos/geom/CoordinateFilter.h | 74 + include/geos/geom/CoordinateList.h | 215 + include/geos/geom/CoordinateSequence.h | 308 + include/geos/geom/CoordinateSequenceFactory.h | 118 + include/geos/geom/CoordinateSequenceFilter.h | 120 + .../geom/DefaultCoordinateSequenceFactory.h | 66 + include/geos/geom/Dimension.h | 70 + include/geos/geom/Envelope.h | 494 + include/geos/geom/Envelope.inl | 269 + .../geos/geom/FixedSizeCoordinateSequence.h | 130 + include/geos/geom/Geometry.h | 976 ++ include/geos/geom/GeometryCollection.h | 232 + include/geos/geom/GeometryCollection.inl | 45 + include/geos/geom/GeometryComponentFilter.h | 64 + include/geos/geom/GeometryFactory.h | 511 + include/geos/geom/GeometryFactory.inl | 49 + include/geos/geom/GeometryFilter.h | 77 + include/geos/geom/IntersectionMatrix.h | 386 + include/geos/geom/LineSegment.h | 391 + include/geos/geom/LineSegment.inl | 204 + include/geos/geom/LineString.h | 237 + include/geos/geom/LinearRing.h | 129 + include/geos/geom/Location.h | 68 + include/geos/geom/Makefile.am | 51 + include/geos/geom/MultiLineString.h | 146 + include/geos/geom/MultiLineString.inl | 49 + include/geos/geom/MultiPoint.h | 145 + include/geos/geom/MultiPolygon.h | 146 + include/geos/geom/MultiPolygon.inl | 46 + include/geos/geom/Point.h | 198 + include/geos/geom/Polygon.h | 202 + include/geos/geom/PrecisionModel.h | 330 + include/geos/geom/PrecisionModel.inl | 64 + include/geos/geom/Triangle.h | 105 + .../prep/AbstractPreparedPolygonContains.h | 146 + .../geos/geom/prep/BasicPreparedGeometry.h | 182 + include/geos/geom/prep/Makefile.am | 23 + include/geos/geom/prep/PreparedGeometry.h | 203 + .../geos/geom/prep/PreparedGeometryFactory.h | 95 + include/geos/geom/prep/PreparedLineString.h | 65 + .../geom/prep/PreparedLineStringIntersects.h | 100 + include/geos/geom/prep/PreparedPoint.h | 58 + include/geos/geom/prep/PreparedPolygon.h | 76 + .../geos/geom/prep/PreparedPolygonContains.h | 107 + .../prep/PreparedPolygonContainsProperly.h | 103 + .../geos/geom/prep/PreparedPolygonCovers.h | 110 + .../geom/prep/PreparedPolygonIntersects.h | 92 + .../geos/geom/prep/PreparedPolygonPredicate.h | 144 + .../geom/util/ComponentCoordinateExtracter.h | 71 + include/geos/geom/util/CoordinateOperation.h | 72 + include/geos/geom/util/Densifier.h | 92 + include/geos/geom/util/GeometryCombiner.h | 120 + include/geos/geom/util/GeometryEditor.h | 129 + .../geos/geom/util/GeometryEditorOperation.h | 65 + include/geos/geom/util/GeometryExtracter.h | 97 + include/geos/geom/util/GeometryTransformer.h | 195 + .../geos/geom/util/LinearComponentExtracter.h | 69 + include/geos/geom/util/Makefile.am | 23 + include/geos/geom/util/PointExtracter.h | 65 + include/geos/geom/util/PolygonExtracter.h | 68 + .../geom/util/ShortCircuitedGeometryVisitor.h | 68 + include/geos/geom/util/SineStarFactory.h | 124 + include/geos/geomPrep.h | 38 + include/geos/geomUtil.h | 39 + include/geos/geomgraph.h | 78 + include/geos/geomgraph/Depth.h | 70 + include/geos/geomgraph/Depth.inl | 119 + include/geos/geomgraph/DirectedEdge.h | 192 + include/geos/geomgraph/DirectedEdge.inl | 132 + include/geos/geomgraph/DirectedEdgeStar.h | 171 + include/geos/geomgraph/Edge.h | 287 + include/geos/geomgraph/EdgeEnd.h | 194 + include/geos/geomgraph/EdgeEndStar.h | 225 + include/geos/geomgraph/EdgeIntersection.h | 155 + include/geos/geomgraph/EdgeIntersectionList.h | 133 + include/geos/geomgraph/EdgeList.h | 132 + include/geos/geomgraph/EdgeNodingValidator.h | 122 + include/geos/geomgraph/EdgeRing.h | 206 + include/geos/geomgraph/GeometryGraph.h | 271 + include/geos/geomgraph/GeometryGraph.inl | 49 + include/geos/geomgraph/GraphComponent.h | 120 + include/geos/geomgraph/Label.h | 177 + include/geos/geomgraph/Label.inl | 256 + include/geos/geomgraph/Makefile.am | 37 + include/geos/geomgraph/Node.h | 199 + include/geos/geomgraph/NodeFactory.h | 54 + include/geos/geomgraph/NodeMap.h | 140 + include/geos/geomgraph/PlanarGraph.h | 209 + include/geos/geomgraph/Position.h | 72 + include/geos/geomgraph/Quadrant.h | 107 + include/geos/geomgraph/Quadrant.inl | 112 + include/geos/geomgraph/TopologyLocation.h | 150 + include/geos/geomgraph/TopologyLocation.inl | 200 + .../geos/geomgraph/index/EdgeSetIntersector.h | 69 + include/geos/geomgraph/index/Makefile.am | 22 + include/geos/geomgraph/index/MonotoneChain.h | 75 + .../geos/geomgraph/index/MonotoneChainEdge.h | 87 + .../geomgraph/index/MonotoneChainIndexer.h | 53 + .../geos/geomgraph/index/SegmentIntersector.h | 153 + .../geomgraph/index/SegmentIntersector.inl | 101 + .../index/SimpleEdgeSetIntersector.h | 62 + .../index/SimpleMCSweepLineIntersector.h | 111 + .../index/SimpleSweepLineIntersector.h | 97 + include/geos/geomgraph/index/SweepLineEvent.h | 141 + .../geos/geomgraph/index/SweepLineEventObj.h | 41 + .../geos/geomgraph/index/SweepLineSegment.h | 60 + include/geos/geomgraphindex.h | 40 + include/geos/geosAlgorithm.h | 95 + include/geos/index/ItemVisitor.h | 41 + include/geos/index/Makefile.am | 18 + include/geos/index/SpatialIndex.h | 107 + include/geos/index/bintree/Bintree.h | 129 + include/geos/index/bintree/Interval.h | 64 + include/geos/index/bintree/Key.h | 74 + include/geos/index/bintree/Makefile.am | 17 + include/geos/index/bintree/Node.h | 77 + include/geos/index/bintree/NodeBase.h | 80 + include/geos/index/bintree/Root.h | 80 + include/geos/index/chain/Makefile.am | 14 + include/geos/index/chain/MonotoneChain.h | 199 + .../geos/index/chain/MonotoneChainBuilder.h | 114 + .../index/chain/MonotoneChainOverlapAction.h | 90 + .../index/chain/MonotoneChainSelectAction.h | 77 + .../intervalrtree/IntervalRTreeBranchNode.h | 56 + .../intervalrtree/IntervalRTreeLeafNode.h | 61 + .../index/intervalrtree/IntervalRTreeNode.h | 108 + include/geos/index/intervalrtree/Makefile.am | 14 + .../intervalrtree/SortedPackedIntervalRTree.h | 106 + include/geos/index/quadtree/DoubleBits.h | 102 + include/geos/index/quadtree/IntervalSize.h | 64 + include/geos/index/quadtree/Key.h | 89 + include/geos/index/quadtree/Makefile.am | 17 + include/geos/index/quadtree/Node.h | 143 + include/geos/index/quadtree/NodeBase.h | 163 + include/geos/index/quadtree/Quadtree.h | 202 + include/geos/index/quadtree/Root.h | 89 + include/geos/index/strtree/AbstractNode.h | 133 + include/geos/index/strtree/AbstractSTRtree.h | 333 + include/geos/index/strtree/Boundable.h | 52 + include/geos/index/strtree/BoundablePair.h | 125 + include/geos/index/strtree/EnvelopeUtil.h | 36 + .../geos/index/strtree/GeometryItemDistance.h | 45 + include/geos/index/strtree/Interval.h | 45 + include/geos/index/strtree/ItemBoundable.h | 60 + include/geos/index/strtree/ItemDistance.h | 51 + include/geos/index/strtree/Makefile.am | 21 + include/geos/index/strtree/SIRtree.h | 126 + include/geos/index/strtree/STRtree.h | 178 + include/geos/index/sweepline/Makefile.am | 14 + include/geos/index/sweepline/SweepLineEvent.h | 97 + include/geos/index/sweepline/SweepLineIndex.h | 89 + .../geos/index/sweepline/SweepLineInterval.h | 39 + .../index/sweepline/SweepLineOverlapAction.h | 46 + include/geos/indexBintree.h | 36 + include/geos/indexChain.h | 34 + include/geos/indexIntervalRTree.h | 33 + include/geos/indexQuadtree.h | 38 + include/geos/indexStrtree.h | 37 + include/geos/indexSweepline.h | 37 + include/geos/inline.h | 25 + include/geos/io.h | 66 + include/geos/io/ByteOrderDataInStream.h | 81 + include/geos/io/ByteOrderDataInStream.inl | 101 + include/geos/io/ByteOrderValues.h | 60 + include/geos/io/CLocalizer.h | 55 + include/geos/io/Makefile.am | 23 + include/geos/io/ParseException.h | 55 + include/geos/io/StringTokenizer.h | 68 + include/geos/io/WKBConstants.h | 47 + include/geos/io/WKBReader.h | 161 + include/geos/io/WKBWriter.h | 221 + include/geos/io/WKTReader.h | 120 + include/geos/io/WKTReader.inl | 76 + include/geos/io/WKTWriter.h | 282 + include/geos/io/Writer.h | 53 + .../geos/linearref/ExtractLineByLocation.h | 89 + include/geos/linearref/LengthIndexOfPoint.h | 88 + include/geos/linearref/LengthIndexedLine.h | 212 + include/geos/linearref/LengthLocationMap.h | 135 + .../geos/linearref/LinearGeometryBuilder.h | 108 + include/geos/linearref/LinearIterator.h | 158 + include/geos/linearref/LinearLocation.h | 250 + include/geos/linearref/LocationIndexOfLine.h | 74 + include/geos/linearref/LocationIndexOfPoint.h | 79 + include/geos/linearref/LocationIndexedLine.h | 278 + include/geos/linearref/Makefile.am | 18 + include/geos/noding.h | 49 + include/geos/noding/BasicSegmentString.h | 104 + include/geos/noding/BasicSegmentString.inl | 64 + include/geos/noding/FastNodingValidator.h | 131 + .../noding/FastSegmentSetIntersectionFinder.h | 83 + include/geos/noding/GeometryNoder.h | 71 + include/geos/noding/IntersectionAdder.h | 209 + include/geos/noding/IntersectionFinderAdder.h | 114 + include/geos/noding/IteratedNoder.h | 124 + include/geos/noding/MCIndexNoder.h | 134 + include/geos/noding/MCIndexNoder.inl | 48 + .../MCIndexSegmentSetMutualIntersector.h | 129 + include/geos/noding/Makefile.am | 39 + include/geos/noding/NodableSegmentString.h | 58 + include/geos/noding/NodedSegmentString.h | 214 + include/geos/noding/Noder.h | 85 + .../geos/noding/NodingIntersectionFinder.h | 229 + include/geos/noding/NodingValidator.h | 113 + include/geos/noding/Octant.h | 77 + include/geos/noding/OrientedCoordinateArray.h | 117 + include/geos/noding/ScaledNoder.h | 136 + .../geos/noding/SegmentIntersectionDetector.h | 179 + include/geos/noding/SegmentIntersector.h | 93 + include/geos/noding/SegmentNode.h | 125 + include/geos/noding/SegmentNodeList.h | 226 + include/geos/noding/SegmentPointComparator.h | 121 + .../geos/noding/SegmentSetMutualIntersector.h | 82 + include/geos/noding/SegmentString.h | 120 + include/geos/noding/SegmentStringUtil.h | 74 + include/geos/noding/SimpleNoder.h | 74 + include/geos/noding/SinglePassNoder.h | 101 + include/geos/noding/snapround/HotPixel.h | 217 + include/geos/noding/snapround/HotPixel.inl | 50 + .../noding/snapround/MCIndexPointSnapper.h | 95 + .../noding/snapround/MCIndexSnapRounder.h | 159 + include/geos/noding/snapround/Makefile.am | 15 + .../geos/noding/snapround/SimpleSnapRounder.h | 147 + include/geos/nodingSnapround.h | 38 + include/geos/opBuffer.h | 40 + include/geos/opDistance.h | 35 + include/geos/opLinemerge.h | 36 + include/geos/opOverlay.h | 75 + include/geos/opPolygonize.h | 34 + include/geos/opPredicate.h | 30 + include/geos/opRelate.h | 83 + include/geos/opValid.h | 38 + include/geos/operation.h | 34 + .../geos/operation/GeometryGraphOperation.h | 90 + include/geos/operation/IsSimpleOp.h | 226 + include/geos/operation/Makefile.am | 23 + include/geos/operation/buffer/BufferBuilder.h | 255 + .../buffer/BufferInputLineSimplifier.h | 184 + include/geos/operation/buffer/BufferOp.h | 273 + .../geos/operation/buffer/BufferParameters.h | 324 + .../geos/operation/buffer/BufferSubgraph.h | 205 + include/geos/operation/buffer/Makefile.am | 21 + .../operation/buffer/OffsetCurveBuilder.h | 200 + .../operation/buffer/OffsetCurveSetBuilder.h | 217 + .../operation/buffer/OffsetSegmentGenerator.h | 364 + .../operation/buffer/OffsetSegmentString.h | 218 + .../operation/buffer/RightmostEdgeFinder.h | 110 + .../operation/buffer/SubgraphDepthLocater.h | 123 + .../distance/ConnectedElementLocationFilter.h | 77 + .../distance/ConnectedElementPointFilter.h | 76 + include/geos/operation/distance/DistanceOp.h | 232 + .../geos/operation/distance/FacetSequence.h | 86 + .../distance/FacetSequenceTreeBuilder.h | 50 + .../operation/distance/GeometryLocation.h | 122 + .../operation/distance/IndexedFacetDistance.h | 52 + include/geos/operation/distance/Makefile.am | 17 + .../geos/operation/intersection/Makefile.am | 13 + .../geos/operation/intersection/Rectangle.h | 237 + .../intersection/RectangleIntersection.h | 178 + .../RectangleIntersectionBuilder.h | 160 + include/geos/operation/linemerge/EdgeString.h | 91 + .../linemerge/LineMergeDirectedEdge.h | 79 + .../geos/operation/linemerge/LineMergeEdge.h | 64 + .../geos/operation/linemerge/LineMergeGraph.h | 93 + include/geos/operation/linemerge/LineMerger.h | 145 + .../geos/operation/linemerge/LineSequencer.h | 301 + include/geos/operation/linemerge/Makefile.am | 16 + include/geos/operation/overlay/EdgeSetNoder.h | 72 + .../geos/operation/overlay/ElevationMatrix.h | 113 + .../operation/overlay/ElevationMatrixCell.h | 65 + include/geos/operation/overlay/LineBuilder.h | 140 + include/geos/operation/overlay/Makefile.am | 24 + .../geos/operation/overlay/MaximalEdgeRing.h | 107 + .../geos/operation/overlay/MinimalEdgeRing.h | 80 + .../operation/overlay/MinimalEdgeRing.inl | 57 + .../operation/overlay/OverlayNodeFactory.h | 58 + include/geos/operation/overlay/OverlayOp.h | 432 + include/geos/operation/overlay/PointBuilder.h | 106 + .../geos/operation/overlay/PolygonBuilder.h | 212 + .../operation/overlay/snap/GeometrySnapper.h | 158 + .../overlay/snap/LineStringSnapper.h | 168 + .../geos/operation/overlay/snap/Makefile.am | 14 + .../overlay/snap/SnapIfNeededOverlayOp.h | 111 + .../operation/overlay/snap/SnapOverlayOp.h | 140 + .../overlay/validate/FuzzyPointLocator.h | 99 + .../overlay/validate/OffsetPointGenerator.h | 89 + .../overlay/validate/OverlayResultValidator.h | 135 + include/geos/operation/polygonize/BuildArea.h | 78 + include/geos/operation/polygonize/EdgeRing.h | 351 + .../geos/operation/polygonize/HoleAssigner.h | 66 + include/geos/operation/polygonize/Makefile.am | 17 + .../polygonize/PolygonizeDirectedEdge.h | 130 + .../operation/polygonize/PolygonizeEdge.h | 61 + .../operation/polygonize/PolygonizeGraph.h | 216 + .../geos/operation/polygonize/Polygonizer.h | 247 + include/geos/operation/predicate/Makefile.am | 13 + .../operation/predicate/RectangleContains.h | 122 + .../operation/predicate/RectangleIntersects.h | 101 + .../predicate/SegmentIntersectionTester.h | 94 + .../geos/operation/relate/EdgeEndBuilder.h | 72 + include/geos/operation/relate/EdgeEndBundle.h | 107 + .../geos/operation/relate/EdgeEndBundleStar.h | 68 + include/geos/operation/relate/Makefile.am | 18 + .../geos/operation/relate/RelateComputer.h | 169 + include/geos/operation/relate/RelateNode.h | 69 + .../geos/operation/relate/RelateNodeFactory.h | 57 + .../geos/operation/relate/RelateNodeGraph.h | 97 + include/geos/operation/relate/RelateOp.h | 137 + .../geos/operation/sharedpaths/Makefile.am | 11 + .../operation/sharedpaths/SharedPathsOp.h | 163 + .../operation/union/CascadedPolygonUnion.h | 212 + include/geos/operation/union/CascadedUnion.h | 199 + include/geos/operation/union/CoverageUnion.h | 56 + .../geos/operation/union/GeometryListHolder.h | 74 + include/geos/operation/union/Makefile.am | 17 + include/geos/operation/union/OverlapUnion.h | 126 + .../geos/operation/union/PointGeometryUnion.h | 73 + include/geos/operation/union/UnaryUnionOp.h | 236 + .../operation/valid/ConnectedInteriorTester.h | 149 + .../operation/valid/ConsistentAreaTester.h | 139 + include/geos/operation/valid/IsValidOp.h | 278 + include/geos/operation/valid/MakeValid.h | 79 + include/geos/operation/valid/Makefile.am | 20 + .../valid/QuadtreeNestedRingTester.h | 103 + .../operation/valid/RepeatedPointRemover.h | 41 + .../operation/valid/RepeatedPointTester.h | 68 + .../operation/valid/SimpleNestedRingTester.h | 100 + .../valid/SweeplineNestedRingTester.h | 126 + .../operation/valid/TopologyValidationError.h | 77 + include/geos/planargraph.h | 42 + include/geos/planargraph/DirectedEdge.h | 239 + include/geos/planargraph/DirectedEdgeStar.h | 151 + include/geos/planargraph/Edge.h | 142 + include/geos/planargraph/GraphComponent.h | 187 + include/geos/planargraph/Makefile.am | 18 + include/geos/planargraph/Node.h | 158 + include/geos/planargraph/NodeMap.h | 137 + include/geos/planargraph/PlanarGraph.h | 283 + include/geos/planargraph/Subgraph.h | 183 + .../algorithm/ConnectedSubgraphFinder.h | 95 + .../geos/planargraph/algorithm/Makefile.am | 11 + include/geos/precision.h | 33 + include/geos/precision/CommonBits.h | 99 + include/geos/precision/CommonBitsOp.h | 174 + include/geos/precision/CommonBitsRemover.h | 92 + include/geos/precision/EnhancedPrecisionOp.h | 107 + .../geos/precision/GeometryPrecisionReducer.h | 168 + include/geos/precision/Makefile.am | 18 + include/geos/precision/MinimumClearance.h | 60 + .../PrecisionReducerCoordinateOperation.h | 68 + .../SimpleGeometryPrecisionReducer.h | 90 + include/geos/profiler.h | 187 + .../simplify/DouglasPeuckerLineSimplifier.h | 102 + .../geos/simplify/DouglasPeuckerSimplifier.h | 86 + include/geos/simplify/LineSegmentIndex.h | 89 + include/geos/simplify/Makefile.am | 18 + include/geos/simplify/TaggedLineSegment.h | 85 + include/geos/simplify/TaggedLineString.h | 131 + .../simplify/TaggedLineStringSimplifier.h | 170 + include/geos/simplify/TaggedLinesSimplifier.h | 119 + .../simplify/TopologyPreservingSimplifier.h | 96 + include/geos/spatialIndex.h | 30 + .../DelaunayTriangulationBuilder.h | 169 + .../IncrementalDelaunayTriangulator.h | 87 + include/geos/triangulate/Makefile.am | 14 + .../geos/triangulate/VoronoiDiagramBuilder.h | 137 + .../quadedge/LastFoundQuadEdgeLocator.h | 68 + .../quadedge/LocateFailureException.h | 40 + include/geos/triangulate/quadedge/Makefile.am | 18 + include/geos/triangulate/quadedge/QuadEdge.h | 412 + .../triangulate/quadedge/QuadEdgeLocator.h | 49 + .../quadedge/QuadEdgeSubdivision.h | 514 + .../triangulate/quadedge/TrianglePredicate.h | 113 + .../triangulate/quadedge/TriangleVisitor.h | 50 + include/geos/triangulate/quadedge/Vertex.h | 316 + include/geos/unload.h | 33 + include/geos/util.h | 87 + include/geos/util/Assert.h | 69 + include/geos/util/AssertionFailedException.h | 51 + include/geos/util/CoordinateArrayFilter.h | 64 + include/geos/util/GEOSException.h | 66 + include/geos/util/GeometricShapeFactory.h | 200 + include/geos/util/IllegalArgumentException.h | 53 + include/geos/util/IllegalStateException.h | 46 + include/geos/util/Interrupt.h | 74 + include/geos/util/Machine.h | 28 + include/geos/util/Makefile.am | 23 + include/geos/util/TopologyException.h | 67 + .../geos/util/UniqueCoordinateArrayFilter.h | 90 + .../geos/util/UnsupportedOperationException.h | 55 + include/geos/util/math.h | 44 + include/geos/version.h.in | 37 + include/geos_c.h | 2194 +++ macros/Makefile.am | 8 + macros/ac_pkg_swig.m4 | 158 + macros/ac_python_devel.m4 | 72 + macros/ax_check_compile_flag.m4 | 74 + macros/ax_cxx_compile_stdcxx.m4 | 562 + macros/ax_cxx_compile_stdcxx_11.m4 | 39 + macros/boost.m4 | 490 + macros/geos.m4 | 91 + macros/python.m4 | 239 + macros/ruby.m4 | 77 + src/CMakeLists.txt | 13 + src/Makefile.am | 48 + src/algorithm/Angle.cpp | 213 + src/algorithm/Area.cpp | 98 + src/algorithm/BoundaryNodeRule.cpp | 169 + src/algorithm/CGAlgorithmsDD.cpp | 229 + src/algorithm/Centroid.cpp | 199 + src/algorithm/ConvexHull.cpp | 394 + src/algorithm/Distance.cpp | 206 + src/algorithm/HCoordinate.cpp | 182 + src/algorithm/InteriorPointArea.cpp | 344 + src/algorithm/InteriorPointLine.cpp | 156 + src/algorithm/InteriorPointPoint.cpp | 89 + src/algorithm/Intersection.cpp | 88 + src/algorithm/Length.cpp | 61 + src/algorithm/LineIntersector.cpp | 922 ++ src/algorithm/Makefile.am | 39 + src/algorithm/MinimumBoundingCircle.cpp | 324 + src/algorithm/MinimumDiameter.cpp | 384 + src/algorithm/NotRepresentableException.cpp | 40 + src/algorithm/Orientation.cpp | 128 + src/algorithm/PointLocation.cpp | 88 + src/algorithm/PointLocator.cpp | 203 + src/algorithm/RayCrossingCounter.cpp | 169 + src/algorithm/RayCrossingCounterDD.cpp | 179 + src/algorithm/RobustDeterminant.cpp | 313 + src/algorithm/SimplePointInRing.cpp | 42 + .../distance/DiscreteFrechetDistance.cpp | 146 + .../distance/DiscreteHausdorffDistance.cpp | 101 + src/algorithm/distance/DistanceToPoint.cpp | 116 + src/algorithm/distance/Makefile.am | 15 + .../locate/IndexedPointInAreaLocator.cpp | 136 + src/algorithm/locate/Makefile.am | 15 + .../locate/PointOnGeometryLocator.cpp | 24 + .../locate/SimplePointInAreaLocator.cpp | 122 + src/geom/Coordinate.cpp | 62 + src/geom/CoordinateArraySequence.cpp | 256 + src/geom/CoordinateArraySequenceFactory.cpp | 44 + src/geom/CoordinateSequence.cpp | 251 + src/geom/DefaultCoordinateSequenceFactory.cpp | 30 + src/geom/Dimension.cpp | 90 + src/geom/Envelope.cpp | 400 + src/geom/Geometry.cpp | 913 ++ src/geom/GeometryCollection.cpp | 401 + src/geom/GeometryComponentFilter.cpp | 41 + src/geom/GeometryFactory.cpp | 800 ++ src/geom/IntersectionMatrix.cpp | 403 + src/geom/LineSegment.cpp | 309 + src/geom/LineString.cpp | 421 + src/geom/LinearRing.cpp | 126 + src/geom/Location.cpp | 46 + src/geom/Makefile.am | 41 + src/geom/MultiLineString.cpp | 142 + src/geom/MultiPoint.cpp | 97 + src/geom/MultiPolygon.cpp | 133 + src/geom/Point.cpp | 306 + src/geom/Polygon.cpp | 525 + src/geom/PrecisionModel.cpp | 245 + src/geom/Triangle.cpp | 94 + .../prep/AbstractPreparedPolygonContains.cpp | 220 + src/geom/prep/BasicPreparedGeometry.cpp | 158 + src/geom/prep/Makefile.am | 26 + src/geom/prep/PreparedGeometry.cpp | 28 + src/geom/prep/PreparedGeometryFactory.cpp | 75 + src/geom/prep/PreparedLineString.cpp | 66 + .../prep/PreparedLineStringIntersects.cpp | 95 + src/geom/prep/PreparedPoint.cpp | 39 + src/geom/prep/PreparedPolygon.cpp | 148 + src/geom/prep/PreparedPolygonContains.cpp | 51 + .../prep/PreparedPolygonContainsProperly.cpp | 89 + src/geom/prep/PreparedPolygonCovers.cpp | 48 + src/geom/prep/PreparedPolygonIntersects.cpp | 91 + src/geom/prep/PreparedPolygonPredicate.cpp | 179 + .../util/ComponentCoordinateExtracter.cpp | 67 + src/geom/util/CoordinateOperation.cpp | 56 + src/geom/util/Densifier.cpp | 165 + src/geom/util/GeometryCombiner.cpp | 120 + src/geom/util/GeometryEditor.cpp | 176 + src/geom/util/GeometryTransformer.cpp | 401 + src/geom/util/LinearComponentExtracter.cpp | 56 + src/geom/util/Makefile.am | 19 + src/geom/util/PointExtracter.cpp | 61 + src/geom/util/PolygonExtracter.cpp | 56 + .../util/ShortCircuitedGeometryVisitor.cpp | 56 + src/geom/util/SineStarFactory.cpp | 92 + src/geomgraph/Depth.cpp | 99 + src/geomgraph/DirectedEdge.cpp | 237 + src/geomgraph/DirectedEdgeStar.cpp | 497 + src/geomgraph/Edge.cpp | 322 + src/geomgraph/EdgeEnd.cpp | 218 + src/geomgraph/EdgeEndStar.cpp | 371 + src/geomgraph/EdgeIntersectionList.cpp | 190 + src/geomgraph/EdgeList.cpp | 150 + src/geomgraph/EdgeNodingValidator.cpp | 62 + src/geomgraph/EdgeRing.cpp | 389 + src/geomgraph/GeometryGraph.cpp | 583 + src/geomgraph/GraphComponent.cpp | 66 + src/geomgraph/Label.cpp | 55 + src/geomgraph/Makefile.am | 32 + src/geomgraph/Node.cpp | 298 + src/geomgraph/NodeFactory.cpp | 43 + src/geomgraph/NodeMap.cpp | 169 + src/geomgraph/PlanarGraph.cpp | 385 + src/geomgraph/Position.cpp | 54 + src/geomgraph/Quadrant.cpp | 69 + src/geomgraph/TopologyLocation.cpp | 81 + src/geomgraph/index/Makefile.am | 16 + src/geomgraph/index/MonotoneChainEdge.cpp | 166 + src/geomgraph/index/MonotoneChainIndexer.cpp | 72 + src/geomgraph/index/SegmentIntersector.cpp | 177 + .../index/SimpleEdgeSetIntersector.cpp | 95 + .../index/SimpleMCSweepLineIntersector.cpp | 166 + .../index/SimpleSweepLineIntersector.cpp | 154 + src/geomgraph/index/SweepLineEvent.cpp | 80 + src/geomgraph/index/SweepLineSegment.cpp | 63 + src/index/Makefile.am | 22 + src/index/bintree/Bintree.cpp | 165 + src/index/bintree/Interval.cpp | 113 + src/index/bintree/Key.cpp | 98 + src/index/bintree/Makefile.am | 16 + src/index/bintree/Node.cpp | 171 + src/index/bintree/NodeBase.cpp | 142 + src/index/bintree/Root.cpp | 89 + src/index/chain/Makefile.am | 12 + src/index/chain/MonotoneChain.cpp | 164 + src/index/chain/MonotoneChainBuilder.cpp | 126 + .../chain/MonotoneChainOverlapAction.cpp | 42 + src/index/chain/MonotoneChainSelectAction.cpp | 40 + .../intervalrtree/IntervalRTreeBranchNode.cpp | 54 + .../intervalrtree/IntervalRTreeLeafNode.cpp | 45 + src/index/intervalrtree/Makefile.am | 11 + .../SortedPackedIntervalRTree.cpp | 130 + src/index/quadtree/DoubleBits.cpp | 189 + src/index/quadtree/IntervalSize.cpp | 49 + src/index/quadtree/Key.cpp | 125 + src/index/quadtree/Makefile.am | 15 + src/index/quadtree/Node.cpp | 202 + src/index/quadtree/NodeBase.cpp | 277 + src/index/quadtree/Quadtree.cpp | 167 + src/index/quadtree/Root.cpp | 143 + src/index/strtree/AbstractSTRtree.cpp | 370 + src/index/strtree/BoundablePair.cpp | 157 + src/index/strtree/EnvelopeUtil.cpp | 50 + src/index/strtree/GeometryItemDistance.cpp | 32 + src/index/strtree/Interval.cpp | 65 + src/index/strtree/Makefile.am | 17 + src/index/strtree/SIRtree.cpp | 153 + src/index/strtree/STRtree.cpp | 429 + src/index/sweepline/Makefile.am | 13 + src/index/sweepline/SweepLineEvent.cpp | 125 + src/index/sweepline/SweepLineIndex.cpp | 104 + src/index/sweepline/SweepLineInterval.cpp | 50 + src/info.plist.in | 26 + src/inlines.cpp | 72 + src/io/ByteOrderDataInStream.cpp | 30 + src/io/ByteOrderValues.cpp | 155 + src/io/CLocalizer.cpp | 49 + src/io/Makefile.am | 22 + src/io/ParseException.cpp | 62 + src/io/StringTokenizer.cpp | 202 + src/io/Unload.cpp | 32 + src/io/WKBReader.cpp | 435 + src/io/WKBWriter.cpp | 311 + src/io/WKTReader.cpp | 421 + src/io/WKTWriter.cpp | 530 + src/io/Writer.cpp | 49 + src/linearref/ExtractLineByLocation.cpp | 161 + src/linearref/LengthIndexOfPoint.cpp | 129 + src/linearref/LengthIndexedLine.cpp | 166 + src/linearref/LengthLocationMap.cpp | 171 + src/linearref/LinearGeometryBuilder.cpp | 156 + src/linearref/LinearIterator.cpp | 161 + src/linearref/LinearLocation.cpp | 382 + src/linearref/LocationIndexOfLine.cpp | 67 + src/linearref/LocationIndexOfPoint.cpp | 126 + src/linearref/Makefile.am | 22 + src/noding/BasicSegmentString.cpp | 52 + src/noding/FastNodingValidator.cpp | 79 + .../FastSegmentSetIntersectionFinder.cpp | 70 + src/noding/GeometryNoder.cpp | 190 + src/noding/IntersectionAdder.cpp | 121 + src/noding/IntersectionFinderAdder.cpp | 66 + src/noding/IteratedNoder.cpp | 104 + src/noding/MCIndexNoder.cpp | 148 + .../MCIndexSegmentSetMutualIntersector.cpp | 153 + src/noding/Makefile.am | 33 + src/noding/NodedSegmentString.cpp | 183 + src/noding/NodingIntersectionFinder.cpp | 156 + src/noding/NodingValidator.cpp | 201 + src/noding/Octant.cpp | 101 + src/noding/OrientedCoordinateArray.cpp | 149 + src/noding/ScaledNoder.cpp | 236 + src/noding/SegmentIntersectionDetector.cpp | 87 + src/noding/SegmentNode.cpp | 114 + src/noding/SegmentNodeList.cpp | 314 + src/noding/SegmentString.cpp | 58 + src/noding/SegmentStringUtil.cpp | 22 + src/noding/SimpleNoder.cpp | 67 + src/noding/snapround/HotPixel.cpp | 221 + src/noding/snapround/MCIndexPointSnapper.cpp | 152 + src/noding/snapround/MCIndexSnapRounder.cpp | 142 + src/noding/snapround/Makefile.am | 16 + src/noding/snapround/SimpleSnapRounder.cpp | 216 + src/operation/GeometryGraphOperation.cpp | 123 + src/operation/IsSimpleOp.cpp | 352 + src/operation/Makefile.am | 36 + src/operation/buffer/BufferBuilder.cpp | 732 + .../buffer/BufferInputLineSimplifier.cpp | 227 + src/operation/buffer/BufferOp.cpp | 274 + src/operation/buffer/BufferParameters.cpp | 135 + src/operation/buffer/BufferSubgraph.cpp | 355 + src/operation/buffer/Makefile.am | 23 + src/operation/buffer/OffsetCurveBuilder.cpp | 330 + .../buffer/OffsetCurveSetBuilder.cpp | 376 + .../buffer/OffsetSegmentGenerator.cpp | 573 + src/operation/buffer/RightmostEdgeFinder.cpp | 272 + src/operation/buffer/SubgraphDepthLocater.cpp | 366 + .../ConnectedElementLocationFilter.cpp | 70 + .../distance/ConnectedElementPointFilter.cpp | 61 + src/operation/distance/DistanceOp.cpp | 532 + src/operation/distance/FacetSequence.cpp | 229 + .../distance/FacetSequenceTreeBuilder.cpp | 99 + src/operation/distance/GeometryLocation.cpp | 100 + .../distance/IndexedFacetDistance.cpp | 120 + src/operation/distance/Makefile.am | 19 + src/operation/intersection/Makefile.am | 15 + src/operation/intersection/Rectangle.cpp | 64 + .../intersection/RectangleIntersection.cpp | 708 + .../RectangleIntersectionBuilder.cpp | 533 + src/operation/linemerge/EdgeString.cpp | 101 + .../linemerge/LineMergeDirectedEdge.cpp | 67 + src/operation/linemerge/LineMergeEdge.cpp | 48 + src/operation/linemerge/LineMergeGraph.cpp | 135 + src/operation/linemerge/LineMerger.cpp | 243 + src/operation/linemerge/LineSequencer.cpp | 449 + src/operation/linemerge/Makefile.am | 18 + src/operation/overlay/EdgeSetNoder.cpp | 61 + src/operation/overlay/ElevationMatrix.cpp | 259 + src/operation/overlay/ElevationMatrixCell.cpp | 84 + src/operation/overlay/LineBuilder.cpp | 309 + src/operation/overlay/Makefile.am | 32 + src/operation/overlay/MaximalEdgeRing.cpp | 136 + src/operation/overlay/MinimalEdgeRing.cpp | 54 + src/operation/overlay/OverlayNodeFactory.cpp | 46 + src/operation/overlay/OverlayOp.cpp | 1123 ++ src/operation/overlay/PointBuilder.cpp | 108 + src/operation/overlay/PolygonBuilder.cpp | 386 + .../overlay/snap/GeometrySnapper.cpp | 229 + .../overlay/snap/LineStringSnapper.cpp | 467 + .../overlay/snap/SnapIfNeededOverlayOp.cpp | 82 + src/operation/overlay/snap/SnapOverlayOp.cpp | 112 + .../overlay/validate/FuzzyPointLocator.cpp | 120 + .../overlay/validate/OffsetPointGenerator.cpp | 114 + .../validate/OverlayResultValidator.cpp | 234 + src/operation/polygonize/BuildArea.cpp | 226 + src/operation/polygonize/EdgeRing.cpp | 336 + src/operation/polygonize/HoleAssigner.cpp | 84 + src/operation/polygonize/Makefile.am | 19 + .../polygonize/PolygonizeDirectedEdge.cpp | 114 + src/operation/polygonize/PolygonizeEdge.cpp | 42 + src/operation/polygonize/PolygonizeGraph.cpp | 468 + src/operation/polygonize/Polygonizer.cpp | 339 + src/operation/predicate/Makefile.am | 16 + src/operation/predicate/RectangleContains.cpp | 155 + .../predicate/RectangleIntersects.cpp | 319 + .../predicate/SegmentIntersectionTester.cpp | 121 + src/operation/relate/EdgeEndBuilder.cpp | 148 + src/operation/relate/EdgeEndBundle.cpp | 197 + src/operation/relate/EdgeEndBundleStar.cpp | 78 + src/operation/relate/Makefile.am | 20 + src/operation/relate/RelateComputer.cpp | 504 + src/operation/relate/RelateNode.cpp | 60 + src/operation/relate/RelateNodeFactory.cpp | 48 + src/operation/relate/RelateNodeGraph.cpp | 144 + src/operation/relate/RelateOp.cpp | 76 + src/operation/sharedpaths/Makefile.am | 11 + src/operation/sharedpaths/SharedPathsOp.cpp | 171 + src/operation/union/CascadedPolygonUnion.cpp | 277 + src/operation/union/CascadedUnion.cpp | 209 + src/operation/union/CoverageUnion.cpp | 126 + src/operation/union/Makefile.am | 18 + src/operation/union/OverlapUnion.cpp | 261 + src/operation/union/PointGeometryUnion.cpp | 102 + src/operation/union/UnaryUnionOp.cpp | 149 + .../valid/ConnectedInteriorTester.cpp | 348 + src/operation/valid/ConsistentAreaTester.cpp | 122 + .../valid/IndexedNestedRingTester.cpp | 118 + src/operation/valid/IndexedNestedRingTester.h | 108 + src/operation/valid/IsValidOp.cpp | 692 + src/operation/valid/MakeValid.cpp | 311 + src/operation/valid/Makefile.am | 28 + .../valid/QuadtreeNestedRingTester.cpp | 131 + src/operation/valid/RepeatedPointRemover.cpp | 53 + src/operation/valid/RepeatedPointTester.cpp | 151 + .../valid/SimpleNestedRingTester.cpp | 73 + .../valid/SweeplineNestedRingTester.cpp | 109 + .../valid/TopologyValidationError.cpp | 89 + src/planargraph/DirectedEdge.cpp | 187 + src/planargraph/DirectedEdgeStar.cpp | 188 + src/planargraph/Edge.cpp | 105 + src/planargraph/Makefile.am | 23 + src/planargraph/Node.cpp | 69 + src/planargraph/NodeMap.cpp | 90 + src/planargraph/PlanarGraph.cpp | 155 + src/planargraph/Subgraph.cpp | 47 + .../algorithm/ConnectedSubgraphFinder.cpp | 96 + src/precision/CommonBits.cpp | 102 + src/precision/CommonBitsOp.cpp | 176 + src/precision/CommonBitsRemover.cpp | 188 + src/precision/EnhancedPrecisionOp.cpp | 226 + src/precision/GeometryPrecisionReducer.cpp | 145 + src/precision/Makefile.am | 20 + src/precision/MinimumClearance.cpp | 220 + .../PrecisionReducerCoordinateOperation.cpp | 96 + .../SimpleGeometryPrecisionReducer.cpp | 173 + src/simplify/DouglasPeuckerLineSimplifier.cpp | 117 + src/simplify/DouglasPeuckerSimplifier.cpp | 195 + src/simplify/LineSegmentIndex.cpp | 161 + src/simplify/Makefile.am | 20 + src/simplify/TaggedLineSegment.cpp | 75 + src/simplify/TaggedLineString.cpp | 250 + src/simplify/TaggedLineStringSimplifier.cpp | 328 + src/simplify/TaggedLinesSimplifier.cpp | 67 + src/simplify/TopologyPreservingSimplifier.cpp | 356 + .../DelaunayTriangulationBuilder.cpp | 148 + .../IncrementalDelaunayTriangulator.cpp | 106 + src/triangulate/Makefile.am | 17 + src/triangulate/VoronoiDiagramBuilder.cpp | 162 + .../quadedge/LastFoundQuadEdgeLocator.cpp | 59 + .../quadedge/LocateFailureException.cpp | 33 + src/triangulate/quadedge/Makefile.am | 18 + src/triangulate/quadedge/QuadEdge.cpp | 180 + .../quadedge/QuadEdgeSubdivision.cpp | 661 + .../quadedge/TrianglePredicate.cpp | 89 + src/triangulate/quadedge/Vertex.cpp | 211 + src/util/Assert.cpp | 59 + src/util/GeometricShapeFactory.cpp | 277 + src/util/Interrupt.cpp | 83 + src/util/Makefile.am | 17 + src/util/Profiler.cpp | 135 + src/util/math.cpp | 121 + swig/Makefile.am | 17 + swig/geos.i.in | 1293 ++ swig/python/Makefile.am | 45 + swig/python/README.txt | 7 + swig/python/geos.pth | 2 + swig/python/geos.py | 399 + swig/python/geos_wrap.cxx | 11112 ++++++++++++++++ swig/python/python.i | 56 + swig/python/tests/Makefile.am | 12 + swig/python/tests/TESTING.txt | 12 + swig/python/tests/example.py | 529 + swig/python/tests/runtests.py | 30 + swig/python/tests/test_geometry.py | 264 + swig/ruby/Makefile.am | 46 + swig/ruby/geos_wrap.cxx | 9932 ++++++++++++++ swig/ruby/ruby.i | 176 + swig/ruby/test/Makefile.am | 24 + swig/ruby/test/example.rb | 419 + swig/ruby/test/geos_tests.rb | 12 + swig/ruby/test/test_buffer.rb | 42 + swig/ruby/test/test_combinations.rb | 57 + swig/ruby/test/test_coordinate_sequence.rb | 88 + swig/ruby/test/test_envelope.rb | 44 + swig/ruby/test/test_geometry.rb | 280 + swig/ruby/test/test_helper.rb | 248 + swig/ruby/test/test_io.rb | 150 + swig/ruby/test/test_operations.rb | 92 + swig/ruby/test/test_relations.rb | 336 + swig/ruby/test/test_srid.rb | 60 + swig/ruby/test/test_version.rb | 21 + tests/CMakeLists.txt | 14 + tests/Makefile.am | 11 + tests/README.md | 50 + tests/bigtest/CMakeLists.txt | 15 + tests/bigtest/GeometryTestFactory.cpp | 147 + tests/bigtest/Makefile.am | 19 + tests/bigtest/README | 5 + tests/bigtest/TestSweepLineSpeed.cpp | 80 + tests/bigtest/bigtest.h | 46 + tests/geostest/Makefile.am | 19 + tests/geostest/brokengrammar | 1 + tests/geostest/geostest.c | 394 + tests/geostest/test.expected | 29 + tests/geostest/test.wkt | 1 + tests/geostest/testrunner.sh | 28 + tests/thread/Makefile.am | 18 + tests/thread/badthreadtest.c | 449 + tests/thread/threadtest.c | 450 + tests/unit/CMakeLists.txt | 36 + tests/unit/Makefile.am | 198 + tests/unit/algorithm/AngleTest.cpp | 131 + tests/unit/algorithm/AreaTest.cpp | 121 + .../CGAlgorithms/computeOrientationTest.cpp | 114 + .../unit/algorithm/CGAlgorithms/isCCWTest.cpp | 133 + .../CGAlgorithms/isPointInRingTest.cpp | 87 + .../algorithm/CGAlgorithms/signedAreaTest.cpp | 101 + tests/unit/algorithm/ConvexHullTest.cpp | 222 + .../unit/algorithm/InteriorPointAreaTest.cpp | 80 + tests/unit/algorithm/IntersectionTest.cpp | 117 + tests/unit/algorithm/LengthTest.cpp | 93 + .../unit/algorithm/LocatePointInRingTest.cpp | 189 + .../algorithm/MinimumBoundingCircleTest.cpp | 207 + tests/unit/algorithm/MinimumDiameterTest.cpp | 246 + .../algorithm/OrientationIndexFailureTest.cpp | 139 + tests/unit/algorithm/PointLocatorTest.cpp | 115 + .../algorithm/RobustLineIntersectionTest.cpp | 486 + .../algorithm/RobustLineIntersectorTest.cpp | 333 + .../distance/DiscreteFrechetDistanceTest.cpp | 135 + .../DiscreteHausdorffDistanceTest.cpp | 137 + tests/unit/capi/GEOSBufferTest.cpp | 570 + tests/unit/capi/GEOSBuildAreaTest.cpp | 81 + tests/unit/capi/GEOSCAPIDefinesTest.cpp | 68 + tests/unit/capi/GEOSClipByRectTest.cpp | 204 + tests/unit/capi/GEOSContainsTest.cpp | 238 + tests/unit/capi/GEOSConvexHullTest.cpp | 81 + tests/unit/capi/GEOSCoordSeqTest.cpp | 391 + tests/unit/capi/GEOSCoverageUnionTest.cpp | 107 + .../capi/GEOSDelaunayTriangulationTest.cpp | 194 + tests/unit/capi/GEOSDistanceTest.cpp | 137 + tests/unit/capi/GEOSEqualsTest.cpp | 194 + tests/unit/capi/GEOSFrechetDistanceTest.cpp | 100 + tests/unit/capi/GEOSGeomFromWKBTest.cpp | 153 + tests/unit/capi/GEOSGeomToWKTTest.cpp | 219 + .../capi/GEOSGeom_createCollectionTest.cpp | 117 + tests/unit/capi/GEOSGeom_createTest.cpp | 154 + tests/unit/capi/GEOSGeom_extentTest.cpp | 84 + .../capi/GEOSGeom_extractUniquePointsTest.cpp | 106 + tests/unit/capi/GEOSGeom_setPrecisionTest.cpp | 199 + tests/unit/capi/GEOSGetCentroidTest.cpp | 178 + tests/unit/capi/GEOSHausdorffDistanceTest.cpp | 100 + tests/unit/capi/GEOSInterpolateTest.cpp | 68 + tests/unit/capi/GEOSInterruptTest.cpp | 225 + tests/unit/capi/GEOSIntersectionTest.cpp | 147 + tests/unit/capi/GEOSIntersectsTest.cpp | 183 + tests/unit/capi/GEOSLineString_PointTest.cpp | 148 + tests/unit/capi/GEOSMakeValidTest.cpp | 81 + .../capi/GEOSMinimumBoundingCircleTest.cpp | 160 + tests/unit/capi/GEOSMinimumClearanceTest.cpp | 143 + tests/unit/capi/GEOSMinimumRectangleTest.cpp | 84 + tests/unit/capi/GEOSMinimumWidthTest.cpp | 100 + tests/unit/capi/GEOSNearestPointsTest.cpp | 121 + tests/unit/capi/GEOSNodeTest.cpp | 128 + tests/unit/capi/GEOSOffsetCurveTest.cpp | 292 + tests/unit/capi/GEOSOrientationIndexTest.cpp | 171 + tests/unit/capi/GEOSPointOnSurfaceTest.cpp | 262 + tests/unit/capi/GEOSPolygonizeTest.cpp | 179 + tests/unit/capi/GEOSPreparedGeometryTest.cpp | 396 + .../capi/GEOSRelateBoundaryNodeRuleTest.cpp | 166 + .../unit/capi/GEOSRelatePatternMatchTest.cpp | 105 + tests/unit/capi/GEOSReverseTest.cpp | 146 + tests/unit/capi/GEOSSTRtreeTest.cpp | 265 + .../unit/capi/GEOSSegmentIntersectionTest.cpp | 84 + tests/unit/capi/GEOSSharedPathsTest.cpp | 125 + tests/unit/capi/GEOSSimplifyTest.cpp | 78 + tests/unit/capi/GEOSSnapTest.cpp | 246 + tests/unit/capi/GEOSUnaryUnionTest.cpp | 240 + tests/unit/capi/GEOSUserDataTest.cpp | 105 + tests/unit/capi/GEOSVoronoiDiagramTest.cpp | 199 + tests/unit/capi/GEOSWithinTest.cpp | 122 + tests/unit/capi/GEOSisClosedTest.cpp | 98 + tests/unit/capi/GEOSisValidDetailTest.cpp | 178 + .../CoordinateArraySequenceFactoryTest.cpp | 176 + .../unit/geom/CoordinateArraySequenceTest.cpp | 596 + tests/unit/geom/CoordinateListTest.cpp | 175 + tests/unit/geom/CoordinateTest.cpp | 222 + tests/unit/geom/DimensionTest.cpp | 141 + tests/unit/geom/EnvelopeTest.cpp | 246 + .../geom/FixedSizeCoordinateSequenceTest.cpp | 143 + tests/unit/geom/Geometry/cloneTest.cpp | 159 + tests/unit/geom/Geometry/coversTest.cpp | 126 + tests/unit/geom/Geometry/equalsTest.cpp | 68 + tests/unit/geom/Geometry/isRectangleTest.cpp | 134 + tests/unit/geom/Geometry/normalizeTest.cpp | 219 + tests/unit/geom/Geometry/touchesTest.cpp | 173 + tests/unit/geom/GeometryCollectionTest.cpp | 146 + .../unit/geom/GeometryComponentFilterTest.cpp | 185 + tests/unit/geom/GeometryFactoryTest.cpp | 1237 ++ tests/unit/geom/GeometryFilterTest.cpp | 98 + tests/unit/geom/IntersectionMatrixTest.cpp | 580 + tests/unit/geom/LineSegmentTest.cpp | 157 + tests/unit/geom/LineStringTest.cpp | 531 + tests/unit/geom/LinearRingTest.cpp | 476 + tests/unit/geom/LocationTest.cpp | 78 + tests/unit/geom/MultiLineStringTest.cpp | 67 + tests/unit/geom/MultiPointTest.cpp | 421 + tests/unit/geom/MultiPolygonTest.cpp | 65 + tests/unit/geom/PointTest.cpp | 584 + tests/unit/geom/PolygonTest.cpp | 614 + tests/unit/geom/PrecisionModelTest.cpp | 150 + tests/unit/geom/TriangleTest.cpp | 204 + .../prep/PreparedGeometry/touchesTest.cpp | 130 + .../geom/prep/PreparedGeometryFactoryTest.cpp | 507 + .../unit/geom/util/GeometryExtracterTest.cpp | 99 + tests/unit/geos_unit.cpp | 113 + .../index/chain/MonotoneChainBuilderTest.cpp | 72 + tests/unit/index/quadtree/DoubleBitsTest.cpp | 36 + tests/unit/index/strtree/SIRtreeTest.cpp | 34 + tests/unit/io/ByteOrderValuesTest.cpp | 151 + tests/unit/io/WKBReaderTest.cpp | 385 + tests/unit/io/WKBWriterTest.cpp | 177 + tests/unit/io/WKTReaderTest.cpp | 196 + tests/unit/io/WKTWriterTest.cpp | 153 + tests/unit/io/WriterTest.cpp | 88 + .../unit/linearref/LengthIndexedLineTest.cpp | 531 + tests/unit/noding/BasicSegmentStringTest.cpp | 214 + tests/unit/noding/NodedSegmentStringTest.cpp | 272 + .../noding/OrientedCoordinateArrayTest.cpp | 131 + tests/unit/noding/SegmentNodeTest.cpp | 224 + .../noding/SegmentPointComparatorTest.cpp | 189 + tests/unit/noding/snapround/HotPixelTest.cpp | 118 + .../snapround/MCIndexSnapRounderTest.cpp | 154 + tests/unit/operation/IsSimpleOpTest.cpp | 144 + .../operation/buffer/BufferBuilderTest.cpp | 129 + tests/unit/operation/buffer/BufferOpTest.cpp | 371 + .../operation/buffer/BufferParametersTest.cpp | 211 + .../operation/distance/DistanceOpTest.cpp | 576 + .../distance/IndexedFacetDistanceTest.cpp | 180 + .../geounion/CascadedPolygonUnionTest.cpp | 164 + .../operation/geounion/CoverageUnionTest.cpp | 222 + .../operation/geounion/UnaryUnionOpTest.cpp | 208 + .../RectangleIntersectionTest.cpp | 1681 +++ .../operation/linemerge/LineMergerTest.cpp | 298 + .../operation/linemerge/LineSequencerTest.cpp | 312 + .../operation/overlay/OverlayOpUnionTest.cpp | 95 + .../overlay/snap/GeometrySnapperTest.cpp | 98 + .../overlay/snap/LineStringSnapperTest.cpp | 384 + .../validate/FuzzyPointLocatorTest.cpp | 204 + .../validate/OffsetPointGeneratorTest.cpp | 204 + .../validate/OverlayResultValidatorTest.cpp | 186 + .../operation/polygonize/PolygonizeTest.cpp | 331 + .../sharedpaths/SharedPathsOpTest.cpp | 429 + tests/unit/operation/valid/IsValidOpTest.cpp | 121 + .../valid/RepeatedPointRemoverTest.cpp | 62 + .../operation/valid/ValidClosedRingTest.cpp | 171 + .../ValidSelfTouchingRingFormingHoleTest.cpp | 201 + tests/unit/precision/CommonBitsTest.cpp | 80 + .../GeometryPrecisionReducerTest.cpp | 201 + .../SimpleGeometryPrecisionReducerTest.cpp | 153 + .../simplify/DouglasPeuckerSimplifierTest.cpp | 376 + .../TopologyPreservingSimplifierTest.cpp | 346 + tests/unit/triangulate/DelaunayTest.cpp | 232 + tests/unit/triangulate/VoronoiTest.cpp | 237 + .../quadedge/QuadEdgeSubdivisionTest.cpp | 162 + .../triangulate/quadedge/QuadEdgeTest.cpp | 172 + .../unit/triangulate/quadedge/VertexTest.cpp | 59 + tests/unit/tut/README | 4 + tests/unit/tut/tut.hpp | 578 + tests/unit/tut/tut_assert.hpp | 312 + tests/unit/tut/tut_config.hpp | 6 + tests/unit/tut/tut_console_reporter.hpp | 280 + tests/unit/tut/tut_cppunit_reporter.hpp | 218 + tests/unit/tut/tut_exception.hpp | 237 + tests/unit/tut/tut_fpt.hpp | 181 + tests/unit/tut/tut_macros.hpp | 71 + tests/unit/tut/tut_main.hpp | 111 + tests/unit/tut/tut_posix.hpp | 513 + tests/unit/tut/tut_reporter.hpp | 11 + tests/unit/tut/tut_restartable.hpp | 410 + tests/unit/tut/tut_result.hpp | 179 + tests/unit/tut/tut_runner.hpp | 388 + tests/unit/tut/tut_xml_reporter.hpp | 310 + .../util/UniqueCoordinateArrayFilterTest.cpp | 91 + tests/unit/utility.h | 230 + tests/xmltester/BufferResultMatcher.cpp | 132 + tests/xmltester/BufferResultMatcher.h | 63 + tests/xmltester/CMakeLists.txt | 37 + tests/xmltester/CTS.cpp | 44 + tests/xmltester/JTSXMLTester.sh | 49 + tests/xmltester/Makefile.am | 171 + tests/xmltester/SimpleWKTTester.cpp | 71 + .../SingleSidedBufferResultMatcher.cpp | 102 + .../SingleSidedBufferResultMatcher.h | 58 + tests/xmltester/Stackwalker.cpp | 2333 ++++ tests/xmltester/Stackwalker.h | 70 + tests/xmltester/WKTIn | 7 + tests/xmltester/WKTOut | 35 + tests/xmltester/XMLTester.cpp | 2019 +++ tests/xmltester/XMLTester.h | 130 + tests/xmltester/safe_to_xml.sh | 143 + tests/xmltester/testrunner.sh | 10 + tests/xmltester/tests/failure/TestOverlay.xml | 112 + .../tests/failure/issue-geos-344.xml | 22 + .../tests/failure/misc-TestBigNastyBuffer.xml | 27 + .../tests/failure/misc-TestSameDirection.xml | 123 + .../failure/robust-TestRobustRelateFloat.xml | 38 + tests/xmltester/tests/general/MISSING | 6 + .../xmltester/tests/general/TestBoundary.xml | 165 + tests/xmltester/tests/general/TestBuffer.xml | 135 + .../tests/general/TestBufferMitredJoin.xml | 60 + .../xmltester/tests/general/TestCentroid.xml | 271 + .../tests/general/TestConvexHull-big.xml | 17 + .../tests/general/TestConvexHull.xml | 186 + tests/xmltester/tests/general/TestDensify.xml | 57 + .../xmltester/tests/general/TestDistance.xml | 60 + .../tests/general/TestEqualsExact.xml | 157 + .../tests/general/TestFunctionAA.xml | 663 + .../tests/general/TestFunctionAAPrec.xml | 828 ++ .../tests/general/TestFunctionLA.xml | 522 + .../tests/general/TestFunctionLAPrec.xml | 59 + .../tests/general/TestFunctionLL.xml | 375 + .../tests/general/TestFunctionLLPrec.xml | 28 + .../tests/general/TestFunctionPA.xml | 155 + .../tests/general/TestFunctionPL.xml | 286 + .../tests/general/TestFunctionPLPrec.xml | 19 + .../tests/general/TestFunctionPP.xml | 269 + .../tests/general/TestInteriorPoint.xml | 128 + .../tests/general/TestIntersectsPL.xml | 37 + .../tests/general/TestMinimumClearance.xml | 89 + .../general/TestPreparedIntersectsPL.xml | 37 + .../general/TestPreparedPointPredicate.xml | 34 + .../general/TestPreparedPolygonPredicate.xml | 289 + ...eparedPredicatesWithGeometryCollection.xml | 81 + .../tests/general/TestRectanglePredicate.xml | 304 + .../xmltester/tests/general/TestRelateAA.xml | 235 + .../xmltester/tests/general/TestRelateAC.xml | 27 + .../xmltester/tests/general/TestRelateLA.xml | 190 + .../xmltester/tests/general/TestRelateLC.xml | 41 + .../xmltester/tests/general/TestRelateLL.xml | 311 + .../xmltester/tests/general/TestRelatePA.xml | 103 + .../xmltester/tests/general/TestRelatePL.xml | 124 + .../xmltester/tests/general/TestRelatePP.xml | 64 + tests/xmltester/tests/general/TestSimple.xml | 357 + .../tests/general/TestUnaryUnion.xml | 161 + .../tests/general/TestUnaryUnionFloating.xml | 20 + tests/xmltester/tests/general/TestValid.xml | 779 ++ .../tests/general/TestValid2-big.xml | 18 + tests/xmltester/tests/general/TestValid2.xml | 5267 ++++++++ .../tests/general/TestWithinDistance.xml | 92 + .../xmltester/tests/issue/issue-geos-1018.xml | 19 + .../xmltester/tests/issue/issue-geos-176.xml | 40 + .../xmltester/tests/issue/issue-geos-188.xml | 22 + .../xmltester/tests/issue/issue-geos-234.xml | 26 + .../xmltester/tests/issue/issue-geos-244.xml | 23 + .../xmltester/tests/issue/issue-geos-275.xml | 31 + .../xmltester/tests/issue/issue-geos-350.xml | 50 + .../xmltester/tests/issue/issue-geos-356.xml | 25 + .../xmltester/tests/issue/issue-geos-358.xml | 26 + .../xmltester/tests/issue/issue-geos-360.xml | 22 + .../xmltester/tests/issue/issue-geos-366.xml | 23 + .../xmltester/tests/issue/issue-geos-392.xml | 26 + .../xmltester/tests/issue/issue-geos-398.xml | 42 + .../xmltester/tests/issue/issue-geos-434.xml | 77 + .../xmltester/tests/issue/issue-geos-459.xml | 21 + .../xmltester/tests/issue/issue-geos-488.xml | 45 + .../xmltester/tests/issue/issue-geos-527.xml | 27 + .../xmltester/tests/issue/issue-geos-569.xml | 22 + .../xmltester/tests/issue/issue-geos-582.xml | 13 + .../xmltester/tests/issue/issue-geos-586.xml | 21 + .../xmltester/tests/issue/issue-geos-599.xml | 31 + .../xmltester/tests/issue/issue-geos-605.xml | 109 + .../xmltester/tests/issue/issue-geos-615.xml | 22 + .../xmltester/tests/issue/issue-geos-716.xml | 75 + .../xmltester/tests/issue/issue-geos-837.xml | 16 + .../xmltester/tests/issue/issue-geos-838.xml | 23 + .../xmltester/tests/issue/issue-geos-990.xml | 19 + .../xmltester/tests/issue/issue-geos-994.xml | 171 + tests/xmltester/tests/misc/Buffer-1.xml | 363 + tests/xmltester/tests/misc/Buffer-2.xml | 56 + tests/xmltester/tests/misc/InvalidRelates.xml | 89 + tests/xmltester/tests/misc/Segfaults.xml | 36 + .../tests/misc/TestBufferExternal-1.xml | 58 + .../tests/misc/TestBufferExternal-2.xml | 508 + tests/xmltester/tests/misc/TestIsValid.xml | 102 + tests/xmltester/tests/misc/buildarea.xml | 98 + tests/xmltester/tests/misc/fme.xml | 20 + tests/xmltester/tests/misc/heisenbugs.xml | 22 + tests/xmltester/tests/misc/hexwkb.xml | 61 + .../xmltester/tests/misc/hole_from_shell.xml | 22 + tests/xmltester/tests/misc/hole_red.xml | 22 + tests/xmltester/tests/misc/linemerge.xml | 14 + tests/xmltester/tests/misc/makevalid.xml | 157 + tests/xmltester/tests/misc/robustness.xml | 126 + tests/xmltester/tests/misc/safe-16595.xml | 273 + tests/xmltester/tests/misc/safe-16596.xml | 1548 +++ .../tests/misc/safe-TestBufferJagged.xml | 75 + .../tests/misc/singlesidedbuffer.xml | 86 + tests/xmltester/tests/misc/split.xml | 52 + .../misc/stmlf-20061020-invalid-output.xml | 61 + tests/xmltester/tests/misc/stmlf-20061020.xml | 282 + tests/xmltester/tests/misc/stmlf-20070119.xml | 22 + .../tests/robust/TestRobustOverlayFixed.xml | 18 + .../tests/robust/TestRobustRelate.xml | 19 + .../tests/validate/TestRelateAA-big.xml | 34 + .../xmltester/tests/validate/TestRelateAA.xml | 2833 ++++ .../xmltester/tests/validate/TestRelateAC.xml | 36 + .../xmltester/tests/validate/TestRelateLA.xml | 1932 +++ .../xmltester/tests/validate/TestRelateLC.xml | 57 + .../xmltester/tests/validate/TestRelateLL.xml | 3388 +++++ .../xmltester/tests/validate/TestRelatePA.xml | 1018 ++ .../xmltester/tests/validate/TestRelatePL.xml | 2286 ++++ .../xmltester/tests/validate/TestRelatePP.xml | 303 + tests/xmltester/tinyxml2/README | 1 + tests/xmltester/tinyxml2/tinyxml2.cpp | 2837 ++++ tests/xmltester/tinyxml2/tinyxml2.h | 2307 ++++ tools/CMakeLists.txt | 53 + tools/Makefile.am | 9 + tools/astyle.sh | 13 + tools/astyle/ASBeautifier.cpp | 3744 ++++++ tools/astyle/ASEnhancer.cpp | 796 ++ tools/astyle/ASFormatter.cpp | 8245 ++++++++++++ tools/astyle/ASLocalizer.cpp | 1166 ++ tools/astyle/ASLocalizer.h | 167 + tools/astyle/ASResource.cpp | 837 ++ tools/astyle/CMakeLists.txt | 16 + tools/astyle/LICENSE.md | 21 + tools/astyle/Makefile.am | 26 + tools/astyle/astyle.h | 1083 ++ tools/astyle/astyle_main.cpp | 4315 ++++++ tools/astyle/astyle_main.h | 452 + tools/build-cmake.bat | 46 + tools/ci/bessie.sh | 31 + tools/ci/bessie32.sh | 31 + tools/ci/common.sh | 35 + tools/ci/script.sh | 20 + tools/ci/script_autotools.sh | 20 + tools/ci/script_cmake.sh | 23 + tools/findclassfiles | 18 + tools/geos-config.cmake | 76 + tools/geos-config.in | 75 + 1262 files changed, 283354 insertions(+) create mode 100644 AUTHORS create mode 100644 CMakeLists.txt create mode 100644 COPYING create mode 100644 HOWTO_RELEASE create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README.md create mode 100644 Version.txt create mode 100644 acsite.m4 create mode 100644 appveyor.yml create mode 100755 autogen.sh create mode 100644 benchmarks/CMakeLists.txt create mode 100644 benchmarks/ClassSizes.cpp create mode 100644 benchmarks/Makefile.am create mode 100644 benchmarks/algorithm/CMakeLists.txt create mode 100644 benchmarks/algorithm/InteriorPointAreaPerfTest.cpp create mode 100644 benchmarks/algorithm/Makefile.am create mode 100644 benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp create mode 100644 benchmarks/algorithm/VoronoiPerfTest.cpp create mode 100644 benchmarks/capi/CMakeLists.txt create mode 100644 benchmarks/capi/GEOSPreparedContainsPerfTest.cpp create mode 100644 benchmarks/capi/IntersectionPerfTest.cpp create mode 100644 benchmarks/capi/Makefile.am create mode 100644 benchmarks/capi/memleak_mp_prep.c create mode 100644 benchmarks/capi/memleak_mp_prep.sh create mode 100644 benchmarks/operation/CMakeLists.txt create mode 100644 benchmarks/operation/Makefile.am create mode 100644 benchmarks/operation/buffer/CMakeLists.txt create mode 100644 benchmarks/operation/buffer/IteratedBufferStressTest.cpp create mode 100644 benchmarks/operation/buffer/Makefile.am create mode 100644 benchmarks/operation/predicate/CMakeLists.txt create mode 100644 benchmarks/operation/predicate/Makefile.am create mode 100644 benchmarks/operation/predicate/RectangleIntersectsPerfTest.cpp create mode 100644 capi/CMakeLists.txt create mode 100644 capi/Makefile.am create mode 100644 capi/geos_c.cpp create mode 100644 capi/geos_c.h.in create mode 100644 capi/geos_ts_c.cpp create mode 100644 cmake/FindMakeDistCheck.cmake create mode 100644 cmake/cmake_uninstall.cmake.in create mode 100644 cmake/geos-config.cmake create mode 100644 configure.ac create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/geos-config.1 create mode 100644 debian/libgeos-dev.dirs create mode 100644 debian/libgeos-dev.docs create mode 100644 debian/libgeos-dev.install create mode 100644 debian/libgeos-dev.manpages create mode 100644 debian/libgeos-doc.doc-base create mode 100644 debian/libgeos-doc.docs create mode 100644 debian/libgeos.dirs create mode 100644 debian/libgeos.docs create mode 100644 debian/libgeos.install create mode 100755 debian/makedoc create mode 100755 debian/rules create mode 100644 debian/watch create mode 100644 doc/CMakeLists.txt create mode 100644 doc/Doxyfile.in create mode 100644 doc/Makefile.am create mode 100644 doc/README create mode 100644 doc/check_doxygen_errors.cmake create mode 100644 doc/example.cpp create mode 100755 doc/example.tosql create mode 100644 examples/client/CMakeLists.txt create mode 100644 examples/client/geos_c_client.cpp create mode 100644 examples/client/geos_client.cpp create mode 100644 include/CMakeLists.txt create mode 100644 include/Makefile.am create mode 100644 include/acconfig.h create mode 100644 include/geos.h create mode 100644 include/geos/Makefile.am create mode 100644 include/geos/algorithm/Angle.h create mode 100644 include/geos/algorithm/Area.h create mode 100644 include/geos/algorithm/BoundaryNodeRule.h create mode 100644 include/geos/algorithm/CGAlgorithmsDD.h create mode 100644 include/geos/algorithm/CentralEndpointIntersector.h create mode 100644 include/geos/algorithm/Centroid.h create mode 100644 include/geos/algorithm/ConvexHull.h create mode 100644 include/geos/algorithm/ConvexHull.inl create mode 100644 include/geos/algorithm/Distance.h create mode 100644 include/geos/algorithm/HCoordinate.h create mode 100644 include/geos/algorithm/InteriorPointArea.h create mode 100644 include/geos/algorithm/InteriorPointLine.h create mode 100644 include/geos/algorithm/InteriorPointPoint.h create mode 100644 include/geos/algorithm/Intersection.h create mode 100644 include/geos/algorithm/Length.h create mode 100644 include/geos/algorithm/LineIntersector.h create mode 100644 include/geos/algorithm/Makefile.am create mode 100644 include/geos/algorithm/MinimumBoundingCircle.h create mode 100644 include/geos/algorithm/MinimumDiameter.h create mode 100644 include/geos/algorithm/NotRepresentableException.h create mode 100644 include/geos/algorithm/Orientation.h create mode 100644 include/geos/algorithm/PointInRing.h create mode 100644 include/geos/algorithm/PointLocation.h create mode 100644 include/geos/algorithm/PointLocator.h create mode 100644 include/geos/algorithm/RayCrossingCounter.h create mode 100644 include/geos/algorithm/RayCrossingCounterDD.h create mode 100644 include/geos/algorithm/RobustDeterminant.h create mode 100644 include/geos/algorithm/SimplePointInRing.h create mode 100644 include/geos/algorithm/distance/DiscreteFrechetDistance.h create mode 100644 include/geos/algorithm/distance/DiscreteHausdorffDistance.h create mode 100644 include/geos/algorithm/distance/DistanceToPoint.h create mode 100644 include/geos/algorithm/distance/Makefile.am create mode 100644 include/geos/algorithm/distance/PointPairDistance.h create mode 100644 include/geos/algorithm/locate/IndexedPointInAreaLocator.h create mode 100644 include/geos/algorithm/locate/Makefile.am create mode 100644 include/geos/algorithm/locate/PointOnGeometryLocator.h create mode 100644 include/geos/algorithm/locate/SimplePointInAreaLocator.h create mode 100644 include/geos/algorithm/ttmath/COPYRIGHT create mode 100644 include/geos/algorithm/ttmath/Makefile.am create mode 100644 include/geos/algorithm/ttmath/README create mode 100644 include/geos/algorithm/ttmath/ttmath.h create mode 100644 include/geos/algorithm/ttmath/ttmathbig.h create mode 100644 include/geos/algorithm/ttmath/ttmathdec.h create mode 100644 include/geos/algorithm/ttmath/ttmathint.h create mode 100644 include/geos/algorithm/ttmath/ttmathmisc.h create mode 100644 include/geos/algorithm/ttmath/ttmathobjects.h create mode 100644 include/geos/algorithm/ttmath/ttmathparser.h create mode 100644 include/geos/algorithm/ttmath/ttmaththreads.h create mode 100644 include/geos/algorithm/ttmath/ttmathtypes.h create mode 100644 include/geos/algorithm/ttmath/ttmathuint.h create mode 100644 include/geos/algorithm/ttmath/ttmathuint_noasm.h create mode 100644 include/geos/algorithm/ttmath/ttmathuint_x86.h create mode 100644 include/geos/algorithm/ttmath/ttmathuint_x86_64.h create mode 100644 include/geos/algorithm/ttmath/ttmathuint_x86_64_msvc.asm create mode 100644 include/geos/constants.h create mode 100644 include/geos/export.h create mode 100644 include/geos/geom.h create mode 100644 include/geos/geom/BinaryOp.h create mode 100644 include/geos/geom/Coordinate.h create mode 100644 include/geos/geom/Coordinate.inl create mode 100644 include/geos/geom/CoordinateArraySequence.h create mode 100644 include/geos/geom/CoordinateArraySequenceFactory.h create mode 100644 include/geos/geom/CoordinateArraySequenceFactory.inl create mode 100644 include/geos/geom/CoordinateFilter.h create mode 100644 include/geos/geom/CoordinateList.h create mode 100644 include/geos/geom/CoordinateSequence.h create mode 100644 include/geos/geom/CoordinateSequenceFactory.h create mode 100644 include/geos/geom/CoordinateSequenceFilter.h create mode 100644 include/geos/geom/DefaultCoordinateSequenceFactory.h create mode 100644 include/geos/geom/Dimension.h create mode 100644 include/geos/geom/Envelope.h create mode 100644 include/geos/geom/Envelope.inl create mode 100644 include/geos/geom/FixedSizeCoordinateSequence.h create mode 100644 include/geos/geom/Geometry.h create mode 100644 include/geos/geom/GeometryCollection.h create mode 100644 include/geos/geom/GeometryCollection.inl create mode 100644 include/geos/geom/GeometryComponentFilter.h create mode 100644 include/geos/geom/GeometryFactory.h create mode 100644 include/geos/geom/GeometryFactory.inl create mode 100644 include/geos/geom/GeometryFilter.h create mode 100644 include/geos/geom/IntersectionMatrix.h create mode 100644 include/geos/geom/LineSegment.h create mode 100644 include/geos/geom/LineSegment.inl create mode 100644 include/geos/geom/LineString.h create mode 100644 include/geos/geom/LinearRing.h create mode 100644 include/geos/geom/Location.h create mode 100644 include/geos/geom/Makefile.am create mode 100644 include/geos/geom/MultiLineString.h create mode 100644 include/geos/geom/MultiLineString.inl create mode 100644 include/geos/geom/MultiPoint.h create mode 100644 include/geos/geom/MultiPolygon.h create mode 100644 include/geos/geom/MultiPolygon.inl create mode 100644 include/geos/geom/Point.h create mode 100644 include/geos/geom/Polygon.h create mode 100644 include/geos/geom/PrecisionModel.h create mode 100644 include/geos/geom/PrecisionModel.inl create mode 100644 include/geos/geom/Triangle.h create mode 100644 include/geos/geom/prep/AbstractPreparedPolygonContains.h create mode 100644 include/geos/geom/prep/BasicPreparedGeometry.h create mode 100644 include/geos/geom/prep/Makefile.am create mode 100644 include/geos/geom/prep/PreparedGeometry.h create mode 100644 include/geos/geom/prep/PreparedGeometryFactory.h create mode 100644 include/geos/geom/prep/PreparedLineString.h create mode 100644 include/geos/geom/prep/PreparedLineStringIntersects.h create mode 100644 include/geos/geom/prep/PreparedPoint.h create mode 100644 include/geos/geom/prep/PreparedPolygon.h create mode 100644 include/geos/geom/prep/PreparedPolygonContains.h create mode 100644 include/geos/geom/prep/PreparedPolygonContainsProperly.h create mode 100644 include/geos/geom/prep/PreparedPolygonCovers.h create mode 100644 include/geos/geom/prep/PreparedPolygonIntersects.h create mode 100644 include/geos/geom/prep/PreparedPolygonPredicate.h create mode 100644 include/geos/geom/util/ComponentCoordinateExtracter.h create mode 100644 include/geos/geom/util/CoordinateOperation.h create mode 100644 include/geos/geom/util/Densifier.h create mode 100644 include/geos/geom/util/GeometryCombiner.h create mode 100644 include/geos/geom/util/GeometryEditor.h create mode 100644 include/geos/geom/util/GeometryEditorOperation.h create mode 100644 include/geos/geom/util/GeometryExtracter.h create mode 100644 include/geos/geom/util/GeometryTransformer.h create mode 100644 include/geos/geom/util/LinearComponentExtracter.h create mode 100644 include/geos/geom/util/Makefile.am create mode 100644 include/geos/geom/util/PointExtracter.h create mode 100644 include/geos/geom/util/PolygonExtracter.h create mode 100644 include/geos/geom/util/ShortCircuitedGeometryVisitor.h create mode 100644 include/geos/geom/util/SineStarFactory.h create mode 100644 include/geos/geomPrep.h create mode 100644 include/geos/geomUtil.h create mode 100644 include/geos/geomgraph.h create mode 100644 include/geos/geomgraph/Depth.h create mode 100644 include/geos/geomgraph/Depth.inl create mode 100644 include/geos/geomgraph/DirectedEdge.h create mode 100644 include/geos/geomgraph/DirectedEdge.inl create mode 100644 include/geos/geomgraph/DirectedEdgeStar.h create mode 100644 include/geos/geomgraph/Edge.h create mode 100644 include/geos/geomgraph/EdgeEnd.h create mode 100644 include/geos/geomgraph/EdgeEndStar.h create mode 100644 include/geos/geomgraph/EdgeIntersection.h create mode 100644 include/geos/geomgraph/EdgeIntersectionList.h create mode 100644 include/geos/geomgraph/EdgeList.h create mode 100644 include/geos/geomgraph/EdgeNodingValidator.h create mode 100644 include/geos/geomgraph/EdgeRing.h create mode 100644 include/geos/geomgraph/GeometryGraph.h create mode 100644 include/geos/geomgraph/GeometryGraph.inl create mode 100644 include/geos/geomgraph/GraphComponent.h create mode 100644 include/geos/geomgraph/Label.h create mode 100644 include/geos/geomgraph/Label.inl create mode 100644 include/geos/geomgraph/Makefile.am create mode 100644 include/geos/geomgraph/Node.h create mode 100644 include/geos/geomgraph/NodeFactory.h create mode 100644 include/geos/geomgraph/NodeMap.h create mode 100644 include/geos/geomgraph/PlanarGraph.h create mode 100644 include/geos/geomgraph/Position.h create mode 100644 include/geos/geomgraph/Quadrant.h create mode 100644 include/geos/geomgraph/Quadrant.inl create mode 100644 include/geos/geomgraph/TopologyLocation.h create mode 100644 include/geos/geomgraph/TopologyLocation.inl create mode 100644 include/geos/geomgraph/index/EdgeSetIntersector.h create mode 100644 include/geos/geomgraph/index/Makefile.am create mode 100644 include/geos/geomgraph/index/MonotoneChain.h create mode 100644 include/geos/geomgraph/index/MonotoneChainEdge.h create mode 100644 include/geos/geomgraph/index/MonotoneChainIndexer.h create mode 100644 include/geos/geomgraph/index/SegmentIntersector.h create mode 100644 include/geos/geomgraph/index/SegmentIntersector.inl create mode 100644 include/geos/geomgraph/index/SimpleEdgeSetIntersector.h create mode 100644 include/geos/geomgraph/index/SimpleMCSweepLineIntersector.h create mode 100644 include/geos/geomgraph/index/SimpleSweepLineIntersector.h create mode 100644 include/geos/geomgraph/index/SweepLineEvent.h create mode 100644 include/geos/geomgraph/index/SweepLineEventObj.h create mode 100644 include/geos/geomgraph/index/SweepLineSegment.h create mode 100644 include/geos/geomgraphindex.h create mode 100644 include/geos/geosAlgorithm.h create mode 100644 include/geos/index/ItemVisitor.h create mode 100644 include/geos/index/Makefile.am create mode 100644 include/geos/index/SpatialIndex.h create mode 100644 include/geos/index/bintree/Bintree.h create mode 100644 include/geos/index/bintree/Interval.h create mode 100644 include/geos/index/bintree/Key.h create mode 100644 include/geos/index/bintree/Makefile.am create mode 100644 include/geos/index/bintree/Node.h create mode 100644 include/geos/index/bintree/NodeBase.h create mode 100644 include/geos/index/bintree/Root.h create mode 100644 include/geos/index/chain/Makefile.am create mode 100644 include/geos/index/chain/MonotoneChain.h create mode 100644 include/geos/index/chain/MonotoneChainBuilder.h create mode 100644 include/geos/index/chain/MonotoneChainOverlapAction.h create mode 100644 include/geos/index/chain/MonotoneChainSelectAction.h create mode 100644 include/geos/index/intervalrtree/IntervalRTreeBranchNode.h create mode 100644 include/geos/index/intervalrtree/IntervalRTreeLeafNode.h create mode 100644 include/geos/index/intervalrtree/IntervalRTreeNode.h create mode 100644 include/geos/index/intervalrtree/Makefile.am create mode 100644 include/geos/index/intervalrtree/SortedPackedIntervalRTree.h create mode 100644 include/geos/index/quadtree/DoubleBits.h create mode 100644 include/geos/index/quadtree/IntervalSize.h create mode 100644 include/geos/index/quadtree/Key.h create mode 100644 include/geos/index/quadtree/Makefile.am create mode 100644 include/geos/index/quadtree/Node.h create mode 100644 include/geos/index/quadtree/NodeBase.h create mode 100644 include/geos/index/quadtree/Quadtree.h create mode 100644 include/geos/index/quadtree/Root.h create mode 100644 include/geos/index/strtree/AbstractNode.h create mode 100644 include/geos/index/strtree/AbstractSTRtree.h create mode 100644 include/geos/index/strtree/Boundable.h create mode 100644 include/geos/index/strtree/BoundablePair.h create mode 100644 include/geos/index/strtree/EnvelopeUtil.h create mode 100644 include/geos/index/strtree/GeometryItemDistance.h create mode 100644 include/geos/index/strtree/Interval.h create mode 100644 include/geos/index/strtree/ItemBoundable.h create mode 100644 include/geos/index/strtree/ItemDistance.h create mode 100644 include/geos/index/strtree/Makefile.am create mode 100644 include/geos/index/strtree/SIRtree.h create mode 100644 include/geos/index/strtree/STRtree.h create mode 100644 include/geos/index/sweepline/Makefile.am create mode 100644 include/geos/index/sweepline/SweepLineEvent.h create mode 100644 include/geos/index/sweepline/SweepLineIndex.h create mode 100644 include/geos/index/sweepline/SweepLineInterval.h create mode 100644 include/geos/index/sweepline/SweepLineOverlapAction.h create mode 100644 include/geos/indexBintree.h create mode 100644 include/geos/indexChain.h create mode 100644 include/geos/indexIntervalRTree.h create mode 100644 include/geos/indexQuadtree.h create mode 100644 include/geos/indexStrtree.h create mode 100644 include/geos/indexSweepline.h create mode 100644 include/geos/inline.h create mode 100644 include/geos/io.h create mode 100644 include/geos/io/ByteOrderDataInStream.h create mode 100644 include/geos/io/ByteOrderDataInStream.inl create mode 100644 include/geos/io/ByteOrderValues.h create mode 100644 include/geos/io/CLocalizer.h create mode 100644 include/geos/io/Makefile.am create mode 100644 include/geos/io/ParseException.h create mode 100644 include/geos/io/StringTokenizer.h create mode 100644 include/geos/io/WKBConstants.h create mode 100644 include/geos/io/WKBReader.h create mode 100644 include/geos/io/WKBWriter.h create mode 100644 include/geos/io/WKTReader.h create mode 100644 include/geos/io/WKTReader.inl create mode 100644 include/geos/io/WKTWriter.h create mode 100644 include/geos/io/Writer.h create mode 100644 include/geos/linearref/ExtractLineByLocation.h create mode 100644 include/geos/linearref/LengthIndexOfPoint.h create mode 100644 include/geos/linearref/LengthIndexedLine.h create mode 100644 include/geos/linearref/LengthLocationMap.h create mode 100644 include/geos/linearref/LinearGeometryBuilder.h create mode 100644 include/geos/linearref/LinearIterator.h create mode 100644 include/geos/linearref/LinearLocation.h create mode 100644 include/geos/linearref/LocationIndexOfLine.h create mode 100644 include/geos/linearref/LocationIndexOfPoint.h create mode 100644 include/geos/linearref/LocationIndexedLine.h create mode 100644 include/geos/linearref/Makefile.am create mode 100644 include/geos/noding.h create mode 100644 include/geos/noding/BasicSegmentString.h create mode 100644 include/geos/noding/BasicSegmentString.inl create mode 100644 include/geos/noding/FastNodingValidator.h create mode 100644 include/geos/noding/FastSegmentSetIntersectionFinder.h create mode 100644 include/geos/noding/GeometryNoder.h create mode 100644 include/geos/noding/IntersectionAdder.h create mode 100644 include/geos/noding/IntersectionFinderAdder.h create mode 100644 include/geos/noding/IteratedNoder.h create mode 100644 include/geos/noding/MCIndexNoder.h create mode 100644 include/geos/noding/MCIndexNoder.inl create mode 100644 include/geos/noding/MCIndexSegmentSetMutualIntersector.h create mode 100644 include/geos/noding/Makefile.am create mode 100644 include/geos/noding/NodableSegmentString.h create mode 100644 include/geos/noding/NodedSegmentString.h create mode 100644 include/geos/noding/Noder.h create mode 100644 include/geos/noding/NodingIntersectionFinder.h create mode 100644 include/geos/noding/NodingValidator.h create mode 100644 include/geos/noding/Octant.h create mode 100644 include/geos/noding/OrientedCoordinateArray.h create mode 100644 include/geos/noding/ScaledNoder.h create mode 100644 include/geos/noding/SegmentIntersectionDetector.h create mode 100644 include/geos/noding/SegmentIntersector.h create mode 100644 include/geos/noding/SegmentNode.h create mode 100644 include/geos/noding/SegmentNodeList.h create mode 100644 include/geos/noding/SegmentPointComparator.h create mode 100644 include/geos/noding/SegmentSetMutualIntersector.h create mode 100644 include/geos/noding/SegmentString.h create mode 100644 include/geos/noding/SegmentStringUtil.h create mode 100644 include/geos/noding/SimpleNoder.h create mode 100644 include/geos/noding/SinglePassNoder.h create mode 100644 include/geos/noding/snapround/HotPixel.h create mode 100644 include/geos/noding/snapround/HotPixel.inl create mode 100644 include/geos/noding/snapround/MCIndexPointSnapper.h create mode 100644 include/geos/noding/snapround/MCIndexSnapRounder.h create mode 100644 include/geos/noding/snapround/Makefile.am create mode 100644 include/geos/noding/snapround/SimpleSnapRounder.h create mode 100644 include/geos/nodingSnapround.h create mode 100644 include/geos/opBuffer.h create mode 100644 include/geos/opDistance.h create mode 100644 include/geos/opLinemerge.h create mode 100644 include/geos/opOverlay.h create mode 100644 include/geos/opPolygonize.h create mode 100644 include/geos/opPredicate.h create mode 100644 include/geos/opRelate.h create mode 100644 include/geos/opValid.h create mode 100644 include/geos/operation.h create mode 100644 include/geos/operation/GeometryGraphOperation.h create mode 100644 include/geos/operation/IsSimpleOp.h create mode 100644 include/geos/operation/Makefile.am create mode 100644 include/geos/operation/buffer/BufferBuilder.h create mode 100644 include/geos/operation/buffer/BufferInputLineSimplifier.h create mode 100644 include/geos/operation/buffer/BufferOp.h create mode 100644 include/geos/operation/buffer/BufferParameters.h create mode 100644 include/geos/operation/buffer/BufferSubgraph.h create mode 100644 include/geos/operation/buffer/Makefile.am create mode 100644 include/geos/operation/buffer/OffsetCurveBuilder.h create mode 100644 include/geos/operation/buffer/OffsetCurveSetBuilder.h create mode 100644 include/geos/operation/buffer/OffsetSegmentGenerator.h create mode 100644 include/geos/operation/buffer/OffsetSegmentString.h create mode 100644 include/geos/operation/buffer/RightmostEdgeFinder.h create mode 100644 include/geos/operation/buffer/SubgraphDepthLocater.h create mode 100644 include/geos/operation/distance/ConnectedElementLocationFilter.h create mode 100644 include/geos/operation/distance/ConnectedElementPointFilter.h create mode 100644 include/geos/operation/distance/DistanceOp.h create mode 100644 include/geos/operation/distance/FacetSequence.h create mode 100644 include/geos/operation/distance/FacetSequenceTreeBuilder.h create mode 100644 include/geos/operation/distance/GeometryLocation.h create mode 100644 include/geos/operation/distance/IndexedFacetDistance.h create mode 100644 include/geos/operation/distance/Makefile.am create mode 100644 include/geos/operation/intersection/Makefile.am create mode 100644 include/geos/operation/intersection/Rectangle.h create mode 100644 include/geos/operation/intersection/RectangleIntersection.h create mode 100644 include/geos/operation/intersection/RectangleIntersectionBuilder.h create mode 100644 include/geos/operation/linemerge/EdgeString.h create mode 100644 include/geos/operation/linemerge/LineMergeDirectedEdge.h create mode 100644 include/geos/operation/linemerge/LineMergeEdge.h create mode 100644 include/geos/operation/linemerge/LineMergeGraph.h create mode 100644 include/geos/operation/linemerge/LineMerger.h create mode 100644 include/geos/operation/linemerge/LineSequencer.h create mode 100644 include/geos/operation/linemerge/Makefile.am create mode 100644 include/geos/operation/overlay/EdgeSetNoder.h create mode 100644 include/geos/operation/overlay/ElevationMatrix.h create mode 100644 include/geos/operation/overlay/ElevationMatrixCell.h create mode 100644 include/geos/operation/overlay/LineBuilder.h create mode 100644 include/geos/operation/overlay/Makefile.am create mode 100644 include/geos/operation/overlay/MaximalEdgeRing.h create mode 100644 include/geos/operation/overlay/MinimalEdgeRing.h create mode 100644 include/geos/operation/overlay/MinimalEdgeRing.inl create mode 100644 include/geos/operation/overlay/OverlayNodeFactory.h create mode 100644 include/geos/operation/overlay/OverlayOp.h create mode 100644 include/geos/operation/overlay/PointBuilder.h create mode 100644 include/geos/operation/overlay/PolygonBuilder.h create mode 100644 include/geos/operation/overlay/snap/GeometrySnapper.h create mode 100644 include/geos/operation/overlay/snap/LineStringSnapper.h create mode 100644 include/geos/operation/overlay/snap/Makefile.am create mode 100644 include/geos/operation/overlay/snap/SnapIfNeededOverlayOp.h create mode 100644 include/geos/operation/overlay/snap/SnapOverlayOp.h create mode 100644 include/geos/operation/overlay/validate/FuzzyPointLocator.h create mode 100644 include/geos/operation/overlay/validate/OffsetPointGenerator.h create mode 100644 include/geos/operation/overlay/validate/OverlayResultValidator.h create mode 100644 include/geos/operation/polygonize/BuildArea.h create mode 100644 include/geos/operation/polygonize/EdgeRing.h create mode 100644 include/geos/operation/polygonize/HoleAssigner.h create mode 100644 include/geos/operation/polygonize/Makefile.am create mode 100644 include/geos/operation/polygonize/PolygonizeDirectedEdge.h create mode 100644 include/geos/operation/polygonize/PolygonizeEdge.h create mode 100644 include/geos/operation/polygonize/PolygonizeGraph.h create mode 100644 include/geos/operation/polygonize/Polygonizer.h create mode 100644 include/geos/operation/predicate/Makefile.am create mode 100644 include/geos/operation/predicate/RectangleContains.h create mode 100644 include/geos/operation/predicate/RectangleIntersects.h create mode 100644 include/geos/operation/predicate/SegmentIntersectionTester.h create mode 100644 include/geos/operation/relate/EdgeEndBuilder.h create mode 100644 include/geos/operation/relate/EdgeEndBundle.h create mode 100644 include/geos/operation/relate/EdgeEndBundleStar.h create mode 100644 include/geos/operation/relate/Makefile.am create mode 100644 include/geos/operation/relate/RelateComputer.h create mode 100644 include/geos/operation/relate/RelateNode.h create mode 100644 include/geos/operation/relate/RelateNodeFactory.h create mode 100644 include/geos/operation/relate/RelateNodeGraph.h create mode 100644 include/geos/operation/relate/RelateOp.h create mode 100644 include/geos/operation/sharedpaths/Makefile.am create mode 100644 include/geos/operation/sharedpaths/SharedPathsOp.h create mode 100644 include/geos/operation/union/CascadedPolygonUnion.h create mode 100644 include/geos/operation/union/CascadedUnion.h create mode 100644 include/geos/operation/union/CoverageUnion.h create mode 100644 include/geos/operation/union/GeometryListHolder.h create mode 100644 include/geos/operation/union/Makefile.am create mode 100644 include/geos/operation/union/OverlapUnion.h create mode 100644 include/geos/operation/union/PointGeometryUnion.h create mode 100644 include/geos/operation/union/UnaryUnionOp.h create mode 100644 include/geos/operation/valid/ConnectedInteriorTester.h create mode 100644 include/geos/operation/valid/ConsistentAreaTester.h create mode 100644 include/geos/operation/valid/IsValidOp.h create mode 100644 include/geos/operation/valid/MakeValid.h create mode 100644 include/geos/operation/valid/Makefile.am create mode 100644 include/geos/operation/valid/QuadtreeNestedRingTester.h create mode 100644 include/geos/operation/valid/RepeatedPointRemover.h create mode 100644 include/geos/operation/valid/RepeatedPointTester.h create mode 100644 include/geos/operation/valid/SimpleNestedRingTester.h create mode 100644 include/geos/operation/valid/SweeplineNestedRingTester.h create mode 100644 include/geos/operation/valid/TopologyValidationError.h create mode 100644 include/geos/planargraph.h create mode 100644 include/geos/planargraph/DirectedEdge.h create mode 100644 include/geos/planargraph/DirectedEdgeStar.h create mode 100644 include/geos/planargraph/Edge.h create mode 100644 include/geos/planargraph/GraphComponent.h create mode 100644 include/geos/planargraph/Makefile.am create mode 100644 include/geos/planargraph/Node.h create mode 100644 include/geos/planargraph/NodeMap.h create mode 100644 include/geos/planargraph/PlanarGraph.h create mode 100644 include/geos/planargraph/Subgraph.h create mode 100644 include/geos/planargraph/algorithm/ConnectedSubgraphFinder.h create mode 100644 include/geos/planargraph/algorithm/Makefile.am create mode 100644 include/geos/precision.h create mode 100644 include/geos/precision/CommonBits.h create mode 100644 include/geos/precision/CommonBitsOp.h create mode 100644 include/geos/precision/CommonBitsRemover.h create mode 100644 include/geos/precision/EnhancedPrecisionOp.h create mode 100644 include/geos/precision/GeometryPrecisionReducer.h create mode 100644 include/geos/precision/Makefile.am create mode 100644 include/geos/precision/MinimumClearance.h create mode 100644 include/geos/precision/PrecisionReducerCoordinateOperation.h create mode 100644 include/geos/precision/SimpleGeometryPrecisionReducer.h create mode 100644 include/geos/profiler.h create mode 100644 include/geos/simplify/DouglasPeuckerLineSimplifier.h create mode 100644 include/geos/simplify/DouglasPeuckerSimplifier.h create mode 100644 include/geos/simplify/LineSegmentIndex.h create mode 100644 include/geos/simplify/Makefile.am create mode 100644 include/geos/simplify/TaggedLineSegment.h create mode 100644 include/geos/simplify/TaggedLineString.h create mode 100644 include/geos/simplify/TaggedLineStringSimplifier.h create mode 100644 include/geos/simplify/TaggedLinesSimplifier.h create mode 100644 include/geos/simplify/TopologyPreservingSimplifier.h create mode 100644 include/geos/spatialIndex.h create mode 100644 include/geos/triangulate/DelaunayTriangulationBuilder.h create mode 100644 include/geos/triangulate/IncrementalDelaunayTriangulator.h create mode 100644 include/geos/triangulate/Makefile.am create mode 100644 include/geos/triangulate/VoronoiDiagramBuilder.h create mode 100644 include/geos/triangulate/quadedge/LastFoundQuadEdgeLocator.h create mode 100644 include/geos/triangulate/quadedge/LocateFailureException.h create mode 100644 include/geos/triangulate/quadedge/Makefile.am create mode 100644 include/geos/triangulate/quadedge/QuadEdge.h create mode 100644 include/geos/triangulate/quadedge/QuadEdgeLocator.h create mode 100644 include/geos/triangulate/quadedge/QuadEdgeSubdivision.h create mode 100644 include/geos/triangulate/quadedge/TrianglePredicate.h create mode 100644 include/geos/triangulate/quadedge/TriangleVisitor.h create mode 100644 include/geos/triangulate/quadedge/Vertex.h create mode 100644 include/geos/unload.h create mode 100644 include/geos/util.h create mode 100644 include/geos/util/Assert.h create mode 100644 include/geos/util/AssertionFailedException.h create mode 100644 include/geos/util/CoordinateArrayFilter.h create mode 100644 include/geos/util/GEOSException.h create mode 100644 include/geos/util/GeometricShapeFactory.h create mode 100644 include/geos/util/IllegalArgumentException.h create mode 100644 include/geos/util/IllegalStateException.h create mode 100644 include/geos/util/Interrupt.h create mode 100644 include/geos/util/Machine.h create mode 100644 include/geos/util/Makefile.am create mode 100644 include/geos/util/TopologyException.h create mode 100644 include/geos/util/UniqueCoordinateArrayFilter.h create mode 100644 include/geos/util/UnsupportedOperationException.h create mode 100644 include/geos/util/math.h create mode 100644 include/geos/version.h.in create mode 100644 include/geos_c.h create mode 100644 macros/Makefile.am create mode 100644 macros/ac_pkg_swig.m4 create mode 100644 macros/ac_python_devel.m4 create mode 100755 macros/ax_check_compile_flag.m4 create mode 100755 macros/ax_cxx_compile_stdcxx.m4 create mode 100755 macros/ax_cxx_compile_stdcxx_11.m4 create mode 100644 macros/boost.m4 create mode 100644 macros/geos.m4 create mode 100644 macros/python.m4 create mode 100644 macros/ruby.m4 create mode 100644 src/CMakeLists.txt create mode 100644 src/Makefile.am create mode 100644 src/algorithm/Angle.cpp create mode 100644 src/algorithm/Area.cpp create mode 100644 src/algorithm/BoundaryNodeRule.cpp create mode 100644 src/algorithm/CGAlgorithmsDD.cpp create mode 100644 src/algorithm/Centroid.cpp create mode 100644 src/algorithm/ConvexHull.cpp create mode 100644 src/algorithm/Distance.cpp create mode 100644 src/algorithm/HCoordinate.cpp create mode 100644 src/algorithm/InteriorPointArea.cpp create mode 100644 src/algorithm/InteriorPointLine.cpp create mode 100644 src/algorithm/InteriorPointPoint.cpp create mode 100644 src/algorithm/Intersection.cpp create mode 100644 src/algorithm/Length.cpp create mode 100644 src/algorithm/LineIntersector.cpp create mode 100644 src/algorithm/Makefile.am create mode 100644 src/algorithm/MinimumBoundingCircle.cpp create mode 100644 src/algorithm/MinimumDiameter.cpp create mode 100644 src/algorithm/NotRepresentableException.cpp create mode 100644 src/algorithm/Orientation.cpp create mode 100644 src/algorithm/PointLocation.cpp create mode 100644 src/algorithm/PointLocator.cpp create mode 100644 src/algorithm/RayCrossingCounter.cpp create mode 100644 src/algorithm/RayCrossingCounterDD.cpp create mode 100644 src/algorithm/RobustDeterminant.cpp create mode 100644 src/algorithm/SimplePointInRing.cpp create mode 100644 src/algorithm/distance/DiscreteFrechetDistance.cpp create mode 100644 src/algorithm/distance/DiscreteHausdorffDistance.cpp create mode 100644 src/algorithm/distance/DistanceToPoint.cpp create mode 100644 src/algorithm/distance/Makefile.am create mode 100644 src/algorithm/locate/IndexedPointInAreaLocator.cpp create mode 100644 src/algorithm/locate/Makefile.am create mode 100644 src/algorithm/locate/PointOnGeometryLocator.cpp create mode 100644 src/algorithm/locate/SimplePointInAreaLocator.cpp create mode 100644 src/geom/Coordinate.cpp create mode 100644 src/geom/CoordinateArraySequence.cpp create mode 100644 src/geom/CoordinateArraySequenceFactory.cpp create mode 100644 src/geom/CoordinateSequence.cpp create mode 100644 src/geom/DefaultCoordinateSequenceFactory.cpp create mode 100644 src/geom/Dimension.cpp create mode 100644 src/geom/Envelope.cpp create mode 100644 src/geom/Geometry.cpp create mode 100644 src/geom/GeometryCollection.cpp create mode 100644 src/geom/GeometryComponentFilter.cpp create mode 100644 src/geom/GeometryFactory.cpp create mode 100644 src/geom/IntersectionMatrix.cpp create mode 100644 src/geom/LineSegment.cpp create mode 100644 src/geom/LineString.cpp create mode 100644 src/geom/LinearRing.cpp create mode 100644 src/geom/Location.cpp create mode 100644 src/geom/Makefile.am create mode 100644 src/geom/MultiLineString.cpp create mode 100644 src/geom/MultiPoint.cpp create mode 100644 src/geom/MultiPolygon.cpp create mode 100644 src/geom/Point.cpp create mode 100644 src/geom/Polygon.cpp create mode 100644 src/geom/PrecisionModel.cpp create mode 100644 src/geom/Triangle.cpp create mode 100644 src/geom/prep/AbstractPreparedPolygonContains.cpp create mode 100644 src/geom/prep/BasicPreparedGeometry.cpp create mode 100644 src/geom/prep/Makefile.am create mode 100644 src/geom/prep/PreparedGeometry.cpp create mode 100644 src/geom/prep/PreparedGeometryFactory.cpp create mode 100644 src/geom/prep/PreparedLineString.cpp create mode 100644 src/geom/prep/PreparedLineStringIntersects.cpp create mode 100644 src/geom/prep/PreparedPoint.cpp create mode 100644 src/geom/prep/PreparedPolygon.cpp create mode 100644 src/geom/prep/PreparedPolygonContains.cpp create mode 100644 src/geom/prep/PreparedPolygonContainsProperly.cpp create mode 100644 src/geom/prep/PreparedPolygonCovers.cpp create mode 100644 src/geom/prep/PreparedPolygonIntersects.cpp create mode 100644 src/geom/prep/PreparedPolygonPredicate.cpp create mode 100644 src/geom/util/ComponentCoordinateExtracter.cpp create mode 100644 src/geom/util/CoordinateOperation.cpp create mode 100644 src/geom/util/Densifier.cpp create mode 100644 src/geom/util/GeometryCombiner.cpp create mode 100644 src/geom/util/GeometryEditor.cpp create mode 100644 src/geom/util/GeometryTransformer.cpp create mode 100644 src/geom/util/LinearComponentExtracter.cpp create mode 100644 src/geom/util/Makefile.am create mode 100644 src/geom/util/PointExtracter.cpp create mode 100644 src/geom/util/PolygonExtracter.cpp create mode 100644 src/geom/util/ShortCircuitedGeometryVisitor.cpp create mode 100644 src/geom/util/SineStarFactory.cpp create mode 100644 src/geomgraph/Depth.cpp create mode 100644 src/geomgraph/DirectedEdge.cpp create mode 100644 src/geomgraph/DirectedEdgeStar.cpp create mode 100644 src/geomgraph/Edge.cpp create mode 100644 src/geomgraph/EdgeEnd.cpp create mode 100644 src/geomgraph/EdgeEndStar.cpp create mode 100644 src/geomgraph/EdgeIntersectionList.cpp create mode 100644 src/geomgraph/EdgeList.cpp create mode 100644 src/geomgraph/EdgeNodingValidator.cpp create mode 100644 src/geomgraph/EdgeRing.cpp create mode 100644 src/geomgraph/GeometryGraph.cpp create mode 100644 src/geomgraph/GraphComponent.cpp create mode 100644 src/geomgraph/Label.cpp create mode 100644 src/geomgraph/Makefile.am create mode 100644 src/geomgraph/Node.cpp create mode 100644 src/geomgraph/NodeFactory.cpp create mode 100644 src/geomgraph/NodeMap.cpp create mode 100644 src/geomgraph/PlanarGraph.cpp create mode 100644 src/geomgraph/Position.cpp create mode 100644 src/geomgraph/Quadrant.cpp create mode 100644 src/geomgraph/TopologyLocation.cpp create mode 100644 src/geomgraph/index/Makefile.am create mode 100644 src/geomgraph/index/MonotoneChainEdge.cpp create mode 100644 src/geomgraph/index/MonotoneChainIndexer.cpp create mode 100644 src/geomgraph/index/SegmentIntersector.cpp create mode 100644 src/geomgraph/index/SimpleEdgeSetIntersector.cpp create mode 100644 src/geomgraph/index/SimpleMCSweepLineIntersector.cpp create mode 100644 src/geomgraph/index/SimpleSweepLineIntersector.cpp create mode 100644 src/geomgraph/index/SweepLineEvent.cpp create mode 100644 src/geomgraph/index/SweepLineSegment.cpp create mode 100644 src/index/Makefile.am create mode 100644 src/index/bintree/Bintree.cpp create mode 100644 src/index/bintree/Interval.cpp create mode 100644 src/index/bintree/Key.cpp create mode 100644 src/index/bintree/Makefile.am create mode 100644 src/index/bintree/Node.cpp create mode 100644 src/index/bintree/NodeBase.cpp create mode 100644 src/index/bintree/Root.cpp create mode 100644 src/index/chain/Makefile.am create mode 100644 src/index/chain/MonotoneChain.cpp create mode 100644 src/index/chain/MonotoneChainBuilder.cpp create mode 100644 src/index/chain/MonotoneChainOverlapAction.cpp create mode 100644 src/index/chain/MonotoneChainSelectAction.cpp create mode 100644 src/index/intervalrtree/IntervalRTreeBranchNode.cpp create mode 100644 src/index/intervalrtree/IntervalRTreeLeafNode.cpp create mode 100644 src/index/intervalrtree/Makefile.am create mode 100644 src/index/intervalrtree/SortedPackedIntervalRTree.cpp create mode 100644 src/index/quadtree/DoubleBits.cpp create mode 100644 src/index/quadtree/IntervalSize.cpp create mode 100644 src/index/quadtree/Key.cpp create mode 100644 src/index/quadtree/Makefile.am create mode 100644 src/index/quadtree/Node.cpp create mode 100644 src/index/quadtree/NodeBase.cpp create mode 100644 src/index/quadtree/Quadtree.cpp create mode 100644 src/index/quadtree/Root.cpp create mode 100644 src/index/strtree/AbstractSTRtree.cpp create mode 100644 src/index/strtree/BoundablePair.cpp create mode 100644 src/index/strtree/EnvelopeUtil.cpp create mode 100644 src/index/strtree/GeometryItemDistance.cpp create mode 100644 src/index/strtree/Interval.cpp create mode 100644 src/index/strtree/Makefile.am create mode 100644 src/index/strtree/SIRtree.cpp create mode 100644 src/index/strtree/STRtree.cpp create mode 100644 src/index/sweepline/Makefile.am create mode 100644 src/index/sweepline/SweepLineEvent.cpp create mode 100644 src/index/sweepline/SweepLineIndex.cpp create mode 100644 src/index/sweepline/SweepLineInterval.cpp create mode 100644 src/info.plist.in create mode 100644 src/inlines.cpp create mode 100644 src/io/ByteOrderDataInStream.cpp create mode 100644 src/io/ByteOrderValues.cpp create mode 100644 src/io/CLocalizer.cpp create mode 100644 src/io/Makefile.am create mode 100644 src/io/ParseException.cpp create mode 100644 src/io/StringTokenizer.cpp create mode 100644 src/io/Unload.cpp create mode 100644 src/io/WKBReader.cpp create mode 100644 src/io/WKBWriter.cpp create mode 100644 src/io/WKTReader.cpp create mode 100644 src/io/WKTWriter.cpp create mode 100644 src/io/Writer.cpp create mode 100644 src/linearref/ExtractLineByLocation.cpp create mode 100644 src/linearref/LengthIndexOfPoint.cpp create mode 100644 src/linearref/LengthIndexedLine.cpp create mode 100644 src/linearref/LengthLocationMap.cpp create mode 100644 src/linearref/LinearGeometryBuilder.cpp create mode 100644 src/linearref/LinearIterator.cpp create mode 100644 src/linearref/LinearLocation.cpp create mode 100644 src/linearref/LocationIndexOfLine.cpp create mode 100644 src/linearref/LocationIndexOfPoint.cpp create mode 100644 src/linearref/Makefile.am create mode 100644 src/noding/BasicSegmentString.cpp create mode 100644 src/noding/FastNodingValidator.cpp create mode 100644 src/noding/FastSegmentSetIntersectionFinder.cpp create mode 100644 src/noding/GeometryNoder.cpp create mode 100644 src/noding/IntersectionAdder.cpp create mode 100644 src/noding/IntersectionFinderAdder.cpp create mode 100644 src/noding/IteratedNoder.cpp create mode 100644 src/noding/MCIndexNoder.cpp create mode 100644 src/noding/MCIndexSegmentSetMutualIntersector.cpp create mode 100644 src/noding/Makefile.am create mode 100644 src/noding/NodedSegmentString.cpp create mode 100644 src/noding/NodingIntersectionFinder.cpp create mode 100644 src/noding/NodingValidator.cpp create mode 100644 src/noding/Octant.cpp create mode 100644 src/noding/OrientedCoordinateArray.cpp create mode 100644 src/noding/ScaledNoder.cpp create mode 100644 src/noding/SegmentIntersectionDetector.cpp create mode 100644 src/noding/SegmentNode.cpp create mode 100644 src/noding/SegmentNodeList.cpp create mode 100644 src/noding/SegmentString.cpp create mode 100644 src/noding/SegmentStringUtil.cpp create mode 100644 src/noding/SimpleNoder.cpp create mode 100644 src/noding/snapround/HotPixel.cpp create mode 100644 src/noding/snapround/MCIndexPointSnapper.cpp create mode 100644 src/noding/snapround/MCIndexSnapRounder.cpp create mode 100644 src/noding/snapround/Makefile.am create mode 100644 src/noding/snapround/SimpleSnapRounder.cpp create mode 100644 src/operation/GeometryGraphOperation.cpp create mode 100644 src/operation/IsSimpleOp.cpp create mode 100644 src/operation/Makefile.am create mode 100644 src/operation/buffer/BufferBuilder.cpp create mode 100644 src/operation/buffer/BufferInputLineSimplifier.cpp create mode 100644 src/operation/buffer/BufferOp.cpp create mode 100644 src/operation/buffer/BufferParameters.cpp create mode 100644 src/operation/buffer/BufferSubgraph.cpp create mode 100644 src/operation/buffer/Makefile.am create mode 100644 src/operation/buffer/OffsetCurveBuilder.cpp create mode 100644 src/operation/buffer/OffsetCurveSetBuilder.cpp create mode 100644 src/operation/buffer/OffsetSegmentGenerator.cpp create mode 100644 src/operation/buffer/RightmostEdgeFinder.cpp create mode 100644 src/operation/buffer/SubgraphDepthLocater.cpp create mode 100644 src/operation/distance/ConnectedElementLocationFilter.cpp create mode 100644 src/operation/distance/ConnectedElementPointFilter.cpp create mode 100644 src/operation/distance/DistanceOp.cpp create mode 100644 src/operation/distance/FacetSequence.cpp create mode 100644 src/operation/distance/FacetSequenceTreeBuilder.cpp create mode 100644 src/operation/distance/GeometryLocation.cpp create mode 100644 src/operation/distance/IndexedFacetDistance.cpp create mode 100644 src/operation/distance/Makefile.am create mode 100644 src/operation/intersection/Makefile.am create mode 100644 src/operation/intersection/Rectangle.cpp create mode 100644 src/operation/intersection/RectangleIntersection.cpp create mode 100644 src/operation/intersection/RectangleIntersectionBuilder.cpp create mode 100644 src/operation/linemerge/EdgeString.cpp create mode 100644 src/operation/linemerge/LineMergeDirectedEdge.cpp create mode 100644 src/operation/linemerge/LineMergeEdge.cpp create mode 100644 src/operation/linemerge/LineMergeGraph.cpp create mode 100644 src/operation/linemerge/LineMerger.cpp create mode 100644 src/operation/linemerge/LineSequencer.cpp create mode 100644 src/operation/linemerge/Makefile.am create mode 100644 src/operation/overlay/EdgeSetNoder.cpp create mode 100644 src/operation/overlay/ElevationMatrix.cpp create mode 100644 src/operation/overlay/ElevationMatrixCell.cpp create mode 100644 src/operation/overlay/LineBuilder.cpp create mode 100644 src/operation/overlay/Makefile.am create mode 100644 src/operation/overlay/MaximalEdgeRing.cpp create mode 100644 src/operation/overlay/MinimalEdgeRing.cpp create mode 100644 src/operation/overlay/OverlayNodeFactory.cpp create mode 100644 src/operation/overlay/OverlayOp.cpp create mode 100644 src/operation/overlay/PointBuilder.cpp create mode 100644 src/operation/overlay/PolygonBuilder.cpp create mode 100644 src/operation/overlay/snap/GeometrySnapper.cpp create mode 100644 src/operation/overlay/snap/LineStringSnapper.cpp create mode 100644 src/operation/overlay/snap/SnapIfNeededOverlayOp.cpp create mode 100644 src/operation/overlay/snap/SnapOverlayOp.cpp create mode 100644 src/operation/overlay/validate/FuzzyPointLocator.cpp create mode 100644 src/operation/overlay/validate/OffsetPointGenerator.cpp create mode 100644 src/operation/overlay/validate/OverlayResultValidator.cpp create mode 100644 src/operation/polygonize/BuildArea.cpp create mode 100644 src/operation/polygonize/EdgeRing.cpp create mode 100644 src/operation/polygonize/HoleAssigner.cpp create mode 100644 src/operation/polygonize/Makefile.am create mode 100644 src/operation/polygonize/PolygonizeDirectedEdge.cpp create mode 100644 src/operation/polygonize/PolygonizeEdge.cpp create mode 100644 src/operation/polygonize/PolygonizeGraph.cpp create mode 100644 src/operation/polygonize/Polygonizer.cpp create mode 100644 src/operation/predicate/Makefile.am create mode 100644 src/operation/predicate/RectangleContains.cpp create mode 100644 src/operation/predicate/RectangleIntersects.cpp create mode 100644 src/operation/predicate/SegmentIntersectionTester.cpp create mode 100644 src/operation/relate/EdgeEndBuilder.cpp create mode 100644 src/operation/relate/EdgeEndBundle.cpp create mode 100644 src/operation/relate/EdgeEndBundleStar.cpp create mode 100644 src/operation/relate/Makefile.am create mode 100644 src/operation/relate/RelateComputer.cpp create mode 100644 src/operation/relate/RelateNode.cpp create mode 100644 src/operation/relate/RelateNodeFactory.cpp create mode 100644 src/operation/relate/RelateNodeGraph.cpp create mode 100644 src/operation/relate/RelateOp.cpp create mode 100644 src/operation/sharedpaths/Makefile.am create mode 100644 src/operation/sharedpaths/SharedPathsOp.cpp create mode 100644 src/operation/union/CascadedPolygonUnion.cpp create mode 100644 src/operation/union/CascadedUnion.cpp create mode 100644 src/operation/union/CoverageUnion.cpp create mode 100644 src/operation/union/Makefile.am create mode 100644 src/operation/union/OverlapUnion.cpp create mode 100644 src/operation/union/PointGeometryUnion.cpp create mode 100644 src/operation/union/UnaryUnionOp.cpp create mode 100644 src/operation/valid/ConnectedInteriorTester.cpp create mode 100644 src/operation/valid/ConsistentAreaTester.cpp create mode 100644 src/operation/valid/IndexedNestedRingTester.cpp create mode 100644 src/operation/valid/IndexedNestedRingTester.h create mode 100644 src/operation/valid/IsValidOp.cpp create mode 100644 src/operation/valid/MakeValid.cpp create mode 100644 src/operation/valid/Makefile.am create mode 100644 src/operation/valid/QuadtreeNestedRingTester.cpp create mode 100644 src/operation/valid/RepeatedPointRemover.cpp create mode 100644 src/operation/valid/RepeatedPointTester.cpp create mode 100644 src/operation/valid/SimpleNestedRingTester.cpp create mode 100644 src/operation/valid/SweeplineNestedRingTester.cpp create mode 100644 src/operation/valid/TopologyValidationError.cpp create mode 100644 src/planargraph/DirectedEdge.cpp create mode 100644 src/planargraph/DirectedEdgeStar.cpp create mode 100644 src/planargraph/Edge.cpp create mode 100644 src/planargraph/Makefile.am create mode 100644 src/planargraph/Node.cpp create mode 100644 src/planargraph/NodeMap.cpp create mode 100644 src/planargraph/PlanarGraph.cpp create mode 100644 src/planargraph/Subgraph.cpp create mode 100644 src/planargraph/algorithm/ConnectedSubgraphFinder.cpp create mode 100644 src/precision/CommonBits.cpp create mode 100644 src/precision/CommonBitsOp.cpp create mode 100644 src/precision/CommonBitsRemover.cpp create mode 100644 src/precision/EnhancedPrecisionOp.cpp create mode 100644 src/precision/GeometryPrecisionReducer.cpp create mode 100644 src/precision/Makefile.am create mode 100644 src/precision/MinimumClearance.cpp create mode 100644 src/precision/PrecisionReducerCoordinateOperation.cpp create mode 100644 src/precision/SimpleGeometryPrecisionReducer.cpp create mode 100644 src/simplify/DouglasPeuckerLineSimplifier.cpp create mode 100644 src/simplify/DouglasPeuckerSimplifier.cpp create mode 100644 src/simplify/LineSegmentIndex.cpp create mode 100644 src/simplify/Makefile.am create mode 100644 src/simplify/TaggedLineSegment.cpp create mode 100644 src/simplify/TaggedLineString.cpp create mode 100644 src/simplify/TaggedLineStringSimplifier.cpp create mode 100644 src/simplify/TaggedLinesSimplifier.cpp create mode 100644 src/simplify/TopologyPreservingSimplifier.cpp create mode 100644 src/triangulate/DelaunayTriangulationBuilder.cpp create mode 100644 src/triangulate/IncrementalDelaunayTriangulator.cpp create mode 100644 src/triangulate/Makefile.am create mode 100644 src/triangulate/VoronoiDiagramBuilder.cpp create mode 100644 src/triangulate/quadedge/LastFoundQuadEdgeLocator.cpp create mode 100644 src/triangulate/quadedge/LocateFailureException.cpp create mode 100644 src/triangulate/quadedge/Makefile.am create mode 100644 src/triangulate/quadedge/QuadEdge.cpp create mode 100644 src/triangulate/quadedge/QuadEdgeSubdivision.cpp create mode 100644 src/triangulate/quadedge/TrianglePredicate.cpp create mode 100644 src/triangulate/quadedge/Vertex.cpp create mode 100644 src/util/Assert.cpp create mode 100644 src/util/GeometricShapeFactory.cpp create mode 100644 src/util/Interrupt.cpp create mode 100644 src/util/Makefile.am create mode 100644 src/util/Profiler.cpp create mode 100644 src/util/math.cpp create mode 100644 swig/Makefile.am create mode 100644 swig/geos.i.in create mode 100644 swig/python/Makefile.am create mode 100644 swig/python/README.txt create mode 100644 swig/python/geos.pth create mode 100644 swig/python/geos.py create mode 100644 swig/python/geos_wrap.cxx create mode 100644 swig/python/python.i create mode 100644 swig/python/tests/Makefile.am create mode 100644 swig/python/tests/TESTING.txt create mode 100644 swig/python/tests/example.py create mode 100644 swig/python/tests/runtests.py create mode 100644 swig/python/tests/test_geometry.py create mode 100644 swig/ruby/Makefile.am create mode 100644 swig/ruby/geos_wrap.cxx create mode 100644 swig/ruby/ruby.i create mode 100644 swig/ruby/test/Makefile.am create mode 100644 swig/ruby/test/example.rb create mode 100644 swig/ruby/test/geos_tests.rb create mode 100644 swig/ruby/test/test_buffer.rb create mode 100644 swig/ruby/test/test_combinations.rb create mode 100644 swig/ruby/test/test_coordinate_sequence.rb create mode 100644 swig/ruby/test/test_envelope.rb create mode 100644 swig/ruby/test/test_geometry.rb create mode 100644 swig/ruby/test/test_helper.rb create mode 100644 swig/ruby/test/test_io.rb create mode 100644 swig/ruby/test/test_operations.rb create mode 100644 swig/ruby/test/test_relations.rb create mode 100644 swig/ruby/test/test_srid.rb create mode 100644 swig/ruby/test/test_version.rb create mode 100644 tests/CMakeLists.txt create mode 100644 tests/Makefile.am create mode 100644 tests/README.md create mode 100644 tests/bigtest/CMakeLists.txt create mode 100644 tests/bigtest/GeometryTestFactory.cpp create mode 100644 tests/bigtest/Makefile.am create mode 100644 tests/bigtest/README create mode 100644 tests/bigtest/TestSweepLineSpeed.cpp create mode 100644 tests/bigtest/bigtest.h create mode 100644 tests/geostest/Makefile.am create mode 100644 tests/geostest/brokengrammar create mode 100644 tests/geostest/geostest.c create mode 100644 tests/geostest/test.expected create mode 100644 tests/geostest/test.wkt create mode 100644 tests/geostest/testrunner.sh create mode 100644 tests/thread/Makefile.am create mode 100644 tests/thread/badthreadtest.c create mode 100644 tests/thread/threadtest.c create mode 100644 tests/unit/CMakeLists.txt create mode 100644 tests/unit/Makefile.am create mode 100644 tests/unit/algorithm/AngleTest.cpp create mode 100644 tests/unit/algorithm/AreaTest.cpp create mode 100644 tests/unit/algorithm/CGAlgorithms/computeOrientationTest.cpp create mode 100644 tests/unit/algorithm/CGAlgorithms/isCCWTest.cpp create mode 100644 tests/unit/algorithm/CGAlgorithms/isPointInRingTest.cpp create mode 100644 tests/unit/algorithm/CGAlgorithms/signedAreaTest.cpp create mode 100644 tests/unit/algorithm/ConvexHullTest.cpp create mode 100644 tests/unit/algorithm/InteriorPointAreaTest.cpp create mode 100644 tests/unit/algorithm/IntersectionTest.cpp create mode 100644 tests/unit/algorithm/LengthTest.cpp create mode 100644 tests/unit/algorithm/LocatePointInRingTest.cpp create mode 100644 tests/unit/algorithm/MinimumBoundingCircleTest.cpp create mode 100644 tests/unit/algorithm/MinimumDiameterTest.cpp create mode 100644 tests/unit/algorithm/OrientationIndexFailureTest.cpp create mode 100644 tests/unit/algorithm/PointLocatorTest.cpp create mode 100644 tests/unit/algorithm/RobustLineIntersectionTest.cpp create mode 100644 tests/unit/algorithm/RobustLineIntersectorTest.cpp create mode 100644 tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp create mode 100644 tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp create mode 100644 tests/unit/capi/GEOSBufferTest.cpp create mode 100644 tests/unit/capi/GEOSBuildAreaTest.cpp create mode 100644 tests/unit/capi/GEOSCAPIDefinesTest.cpp create mode 100644 tests/unit/capi/GEOSClipByRectTest.cpp create mode 100644 tests/unit/capi/GEOSContainsTest.cpp create mode 100644 tests/unit/capi/GEOSConvexHullTest.cpp create mode 100644 tests/unit/capi/GEOSCoordSeqTest.cpp create mode 100644 tests/unit/capi/GEOSCoverageUnionTest.cpp create mode 100644 tests/unit/capi/GEOSDelaunayTriangulationTest.cpp create mode 100644 tests/unit/capi/GEOSDistanceTest.cpp create mode 100644 tests/unit/capi/GEOSEqualsTest.cpp create mode 100644 tests/unit/capi/GEOSFrechetDistanceTest.cpp create mode 100644 tests/unit/capi/GEOSGeomFromWKBTest.cpp create mode 100644 tests/unit/capi/GEOSGeomToWKTTest.cpp create mode 100644 tests/unit/capi/GEOSGeom_createCollectionTest.cpp create mode 100644 tests/unit/capi/GEOSGeom_createTest.cpp create mode 100644 tests/unit/capi/GEOSGeom_extentTest.cpp create mode 100644 tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp create mode 100644 tests/unit/capi/GEOSGeom_setPrecisionTest.cpp create mode 100644 tests/unit/capi/GEOSGetCentroidTest.cpp create mode 100644 tests/unit/capi/GEOSHausdorffDistanceTest.cpp create mode 100644 tests/unit/capi/GEOSInterpolateTest.cpp create mode 100644 tests/unit/capi/GEOSInterruptTest.cpp create mode 100644 tests/unit/capi/GEOSIntersectionTest.cpp create mode 100644 tests/unit/capi/GEOSIntersectsTest.cpp create mode 100644 tests/unit/capi/GEOSLineString_PointTest.cpp create mode 100644 tests/unit/capi/GEOSMakeValidTest.cpp create mode 100644 tests/unit/capi/GEOSMinimumBoundingCircleTest.cpp create mode 100644 tests/unit/capi/GEOSMinimumClearanceTest.cpp create mode 100644 tests/unit/capi/GEOSMinimumRectangleTest.cpp create mode 100644 tests/unit/capi/GEOSMinimumWidthTest.cpp create mode 100644 tests/unit/capi/GEOSNearestPointsTest.cpp create mode 100644 tests/unit/capi/GEOSNodeTest.cpp create mode 100644 tests/unit/capi/GEOSOffsetCurveTest.cpp create mode 100644 tests/unit/capi/GEOSOrientationIndexTest.cpp create mode 100644 tests/unit/capi/GEOSPointOnSurfaceTest.cpp create mode 100644 tests/unit/capi/GEOSPolygonizeTest.cpp create mode 100644 tests/unit/capi/GEOSPreparedGeometryTest.cpp create mode 100644 tests/unit/capi/GEOSRelateBoundaryNodeRuleTest.cpp create mode 100644 tests/unit/capi/GEOSRelatePatternMatchTest.cpp create mode 100644 tests/unit/capi/GEOSReverseTest.cpp create mode 100644 tests/unit/capi/GEOSSTRtreeTest.cpp create mode 100644 tests/unit/capi/GEOSSegmentIntersectionTest.cpp create mode 100644 tests/unit/capi/GEOSSharedPathsTest.cpp create mode 100644 tests/unit/capi/GEOSSimplifyTest.cpp create mode 100644 tests/unit/capi/GEOSSnapTest.cpp create mode 100644 tests/unit/capi/GEOSUnaryUnionTest.cpp create mode 100644 tests/unit/capi/GEOSUserDataTest.cpp create mode 100644 tests/unit/capi/GEOSVoronoiDiagramTest.cpp create mode 100644 tests/unit/capi/GEOSWithinTest.cpp create mode 100644 tests/unit/capi/GEOSisClosedTest.cpp create mode 100644 tests/unit/capi/GEOSisValidDetailTest.cpp create mode 100644 tests/unit/geom/CoordinateArraySequenceFactoryTest.cpp create mode 100644 tests/unit/geom/CoordinateArraySequenceTest.cpp create mode 100644 tests/unit/geom/CoordinateListTest.cpp create mode 100644 tests/unit/geom/CoordinateTest.cpp create mode 100644 tests/unit/geom/DimensionTest.cpp create mode 100644 tests/unit/geom/EnvelopeTest.cpp create mode 100644 tests/unit/geom/FixedSizeCoordinateSequenceTest.cpp create mode 100644 tests/unit/geom/Geometry/cloneTest.cpp create mode 100644 tests/unit/geom/Geometry/coversTest.cpp create mode 100644 tests/unit/geom/Geometry/equalsTest.cpp create mode 100644 tests/unit/geom/Geometry/isRectangleTest.cpp create mode 100644 tests/unit/geom/Geometry/normalizeTest.cpp create mode 100644 tests/unit/geom/Geometry/touchesTest.cpp create mode 100644 tests/unit/geom/GeometryCollectionTest.cpp create mode 100644 tests/unit/geom/GeometryComponentFilterTest.cpp create mode 100644 tests/unit/geom/GeometryFactoryTest.cpp create mode 100644 tests/unit/geom/GeometryFilterTest.cpp create mode 100644 tests/unit/geom/IntersectionMatrixTest.cpp create mode 100644 tests/unit/geom/LineSegmentTest.cpp create mode 100644 tests/unit/geom/LineStringTest.cpp create mode 100644 tests/unit/geom/LinearRingTest.cpp create mode 100644 tests/unit/geom/LocationTest.cpp create mode 100644 tests/unit/geom/MultiLineStringTest.cpp create mode 100644 tests/unit/geom/MultiPointTest.cpp create mode 100644 tests/unit/geom/MultiPolygonTest.cpp create mode 100644 tests/unit/geom/PointTest.cpp create mode 100644 tests/unit/geom/PolygonTest.cpp create mode 100644 tests/unit/geom/PrecisionModelTest.cpp create mode 100644 tests/unit/geom/TriangleTest.cpp create mode 100644 tests/unit/geom/prep/PreparedGeometry/touchesTest.cpp create mode 100644 tests/unit/geom/prep/PreparedGeometryFactoryTest.cpp create mode 100644 tests/unit/geom/util/GeometryExtracterTest.cpp create mode 100644 tests/unit/geos_unit.cpp create mode 100644 tests/unit/index/chain/MonotoneChainBuilderTest.cpp create mode 100644 tests/unit/index/quadtree/DoubleBitsTest.cpp create mode 100644 tests/unit/index/strtree/SIRtreeTest.cpp create mode 100644 tests/unit/io/ByteOrderValuesTest.cpp create mode 100644 tests/unit/io/WKBReaderTest.cpp create mode 100644 tests/unit/io/WKBWriterTest.cpp create mode 100644 tests/unit/io/WKTReaderTest.cpp create mode 100644 tests/unit/io/WKTWriterTest.cpp create mode 100644 tests/unit/io/WriterTest.cpp create mode 100644 tests/unit/linearref/LengthIndexedLineTest.cpp create mode 100644 tests/unit/noding/BasicSegmentStringTest.cpp create mode 100644 tests/unit/noding/NodedSegmentStringTest.cpp create mode 100644 tests/unit/noding/OrientedCoordinateArrayTest.cpp create mode 100644 tests/unit/noding/SegmentNodeTest.cpp create mode 100644 tests/unit/noding/SegmentPointComparatorTest.cpp create mode 100644 tests/unit/noding/snapround/HotPixelTest.cpp create mode 100644 tests/unit/noding/snapround/MCIndexSnapRounderTest.cpp create mode 100644 tests/unit/operation/IsSimpleOpTest.cpp create mode 100644 tests/unit/operation/buffer/BufferBuilderTest.cpp create mode 100644 tests/unit/operation/buffer/BufferOpTest.cpp create mode 100644 tests/unit/operation/buffer/BufferParametersTest.cpp create mode 100644 tests/unit/operation/distance/DistanceOpTest.cpp create mode 100644 tests/unit/operation/distance/IndexedFacetDistanceTest.cpp create mode 100644 tests/unit/operation/geounion/CascadedPolygonUnionTest.cpp create mode 100644 tests/unit/operation/geounion/CoverageUnionTest.cpp create mode 100644 tests/unit/operation/geounion/UnaryUnionOpTest.cpp create mode 100644 tests/unit/operation/intersection/RectangleIntersectionTest.cpp create mode 100644 tests/unit/operation/linemerge/LineMergerTest.cpp create mode 100644 tests/unit/operation/linemerge/LineSequencerTest.cpp create mode 100644 tests/unit/operation/overlay/OverlayOpUnionTest.cpp create mode 100644 tests/unit/operation/overlay/snap/GeometrySnapperTest.cpp create mode 100644 tests/unit/operation/overlay/snap/LineStringSnapperTest.cpp create mode 100644 tests/unit/operation/overlay/validate/FuzzyPointLocatorTest.cpp create mode 100644 tests/unit/operation/overlay/validate/OffsetPointGeneratorTest.cpp create mode 100644 tests/unit/operation/overlay/validate/OverlayResultValidatorTest.cpp create mode 100644 tests/unit/operation/polygonize/PolygonizeTest.cpp create mode 100644 tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp create mode 100644 tests/unit/operation/valid/IsValidOpTest.cpp create mode 100644 tests/unit/operation/valid/RepeatedPointRemoverTest.cpp create mode 100644 tests/unit/operation/valid/ValidClosedRingTest.cpp create mode 100644 tests/unit/operation/valid/ValidSelfTouchingRingFormingHoleTest.cpp create mode 100644 tests/unit/precision/CommonBitsTest.cpp create mode 100644 tests/unit/precision/GeometryPrecisionReducerTest.cpp create mode 100644 tests/unit/precision/SimpleGeometryPrecisionReducerTest.cpp create mode 100644 tests/unit/simplify/DouglasPeuckerSimplifierTest.cpp create mode 100644 tests/unit/simplify/TopologyPreservingSimplifierTest.cpp create mode 100644 tests/unit/triangulate/DelaunayTest.cpp create mode 100644 tests/unit/triangulate/VoronoiTest.cpp create mode 100644 tests/unit/triangulate/quadedge/QuadEdgeSubdivisionTest.cpp create mode 100644 tests/unit/triangulate/quadedge/QuadEdgeTest.cpp create mode 100644 tests/unit/triangulate/quadedge/VertexTest.cpp create mode 100644 tests/unit/tut/README create mode 100644 tests/unit/tut/tut.hpp create mode 100644 tests/unit/tut/tut_assert.hpp create mode 100644 tests/unit/tut/tut_config.hpp create mode 100644 tests/unit/tut/tut_console_reporter.hpp create mode 100644 tests/unit/tut/tut_cppunit_reporter.hpp create mode 100644 tests/unit/tut/tut_exception.hpp create mode 100644 tests/unit/tut/tut_fpt.hpp create mode 100644 tests/unit/tut/tut_macros.hpp create mode 100644 tests/unit/tut/tut_main.hpp create mode 100644 tests/unit/tut/tut_posix.hpp create mode 100644 tests/unit/tut/tut_reporter.hpp create mode 100644 tests/unit/tut/tut_restartable.hpp create mode 100644 tests/unit/tut/tut_result.hpp create mode 100644 tests/unit/tut/tut_runner.hpp create mode 100644 tests/unit/tut/tut_xml_reporter.hpp create mode 100644 tests/unit/util/UniqueCoordinateArrayFilterTest.cpp create mode 100644 tests/unit/utility.h create mode 100644 tests/xmltester/BufferResultMatcher.cpp create mode 100644 tests/xmltester/BufferResultMatcher.h create mode 100644 tests/xmltester/CMakeLists.txt create mode 100644 tests/xmltester/CTS.cpp create mode 100755 tests/xmltester/JTSXMLTester.sh create mode 100644 tests/xmltester/Makefile.am create mode 100644 tests/xmltester/SimpleWKTTester.cpp create mode 100644 tests/xmltester/SingleSidedBufferResultMatcher.cpp create mode 100644 tests/xmltester/SingleSidedBufferResultMatcher.h create mode 100644 tests/xmltester/Stackwalker.cpp create mode 100644 tests/xmltester/Stackwalker.h create mode 100644 tests/xmltester/WKTIn create mode 100644 tests/xmltester/WKTOut create mode 100644 tests/xmltester/XMLTester.cpp create mode 100644 tests/xmltester/XMLTester.h create mode 100755 tests/xmltester/safe_to_xml.sh create mode 100644 tests/xmltester/testrunner.sh create mode 100644 tests/xmltester/tests/failure/TestOverlay.xml create mode 100644 tests/xmltester/tests/failure/issue-geos-344.xml create mode 100644 tests/xmltester/tests/failure/misc-TestBigNastyBuffer.xml create mode 100644 tests/xmltester/tests/failure/misc-TestSameDirection.xml create mode 100644 tests/xmltester/tests/failure/robust-TestRobustRelateFloat.xml create mode 100644 tests/xmltester/tests/general/MISSING create mode 100644 tests/xmltester/tests/general/TestBoundary.xml create mode 100644 tests/xmltester/tests/general/TestBuffer.xml create mode 100644 tests/xmltester/tests/general/TestBufferMitredJoin.xml create mode 100644 tests/xmltester/tests/general/TestCentroid.xml create mode 100644 tests/xmltester/tests/general/TestConvexHull-big.xml create mode 100644 tests/xmltester/tests/general/TestConvexHull.xml create mode 100644 tests/xmltester/tests/general/TestDensify.xml create mode 100644 tests/xmltester/tests/general/TestDistance.xml create mode 100644 tests/xmltester/tests/general/TestEqualsExact.xml create mode 100644 tests/xmltester/tests/general/TestFunctionAA.xml create mode 100644 tests/xmltester/tests/general/TestFunctionAAPrec.xml create mode 100644 tests/xmltester/tests/general/TestFunctionLA.xml create mode 100644 tests/xmltester/tests/general/TestFunctionLAPrec.xml create mode 100644 tests/xmltester/tests/general/TestFunctionLL.xml create mode 100644 tests/xmltester/tests/general/TestFunctionLLPrec.xml create mode 100644 tests/xmltester/tests/general/TestFunctionPA.xml create mode 100644 tests/xmltester/tests/general/TestFunctionPL.xml create mode 100644 tests/xmltester/tests/general/TestFunctionPLPrec.xml create mode 100644 tests/xmltester/tests/general/TestFunctionPP.xml create mode 100644 tests/xmltester/tests/general/TestInteriorPoint.xml create mode 100644 tests/xmltester/tests/general/TestIntersectsPL.xml create mode 100644 tests/xmltester/tests/general/TestMinimumClearance.xml create mode 100644 tests/xmltester/tests/general/TestPreparedIntersectsPL.xml create mode 100644 tests/xmltester/tests/general/TestPreparedPointPredicate.xml create mode 100644 tests/xmltester/tests/general/TestPreparedPolygonPredicate.xml create mode 100644 tests/xmltester/tests/general/TestPreparedPredicatesWithGeometryCollection.xml create mode 100644 tests/xmltester/tests/general/TestRectanglePredicate.xml create mode 100644 tests/xmltester/tests/general/TestRelateAA.xml create mode 100644 tests/xmltester/tests/general/TestRelateAC.xml create mode 100644 tests/xmltester/tests/general/TestRelateLA.xml create mode 100644 tests/xmltester/tests/general/TestRelateLC.xml create mode 100644 tests/xmltester/tests/general/TestRelateLL.xml create mode 100644 tests/xmltester/tests/general/TestRelatePA.xml create mode 100644 tests/xmltester/tests/general/TestRelatePL.xml create mode 100644 tests/xmltester/tests/general/TestRelatePP.xml create mode 100644 tests/xmltester/tests/general/TestSimple.xml create mode 100644 tests/xmltester/tests/general/TestUnaryUnion.xml create mode 100644 tests/xmltester/tests/general/TestUnaryUnionFloating.xml create mode 100644 tests/xmltester/tests/general/TestValid.xml create mode 100644 tests/xmltester/tests/general/TestValid2-big.xml create mode 100644 tests/xmltester/tests/general/TestValid2.xml create mode 100644 tests/xmltester/tests/general/TestWithinDistance.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-1018.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-176.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-188.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-234.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-244.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-275.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-350.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-356.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-358.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-360.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-366.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-392.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-398.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-434.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-459.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-488.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-527.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-569.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-582.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-586.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-599.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-605.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-615.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-716.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-837.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-838.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-990.xml create mode 100644 tests/xmltester/tests/issue/issue-geos-994.xml create mode 100644 tests/xmltester/tests/misc/Buffer-1.xml create mode 100644 tests/xmltester/tests/misc/Buffer-2.xml create mode 100644 tests/xmltester/tests/misc/InvalidRelates.xml create mode 100644 tests/xmltester/tests/misc/Segfaults.xml create mode 100644 tests/xmltester/tests/misc/TestBufferExternal-1.xml create mode 100644 tests/xmltester/tests/misc/TestBufferExternal-2.xml create mode 100644 tests/xmltester/tests/misc/TestIsValid.xml create mode 100644 tests/xmltester/tests/misc/buildarea.xml create mode 100644 tests/xmltester/tests/misc/fme.xml create mode 100644 tests/xmltester/tests/misc/heisenbugs.xml create mode 100644 tests/xmltester/tests/misc/hexwkb.xml create mode 100644 tests/xmltester/tests/misc/hole_from_shell.xml create mode 100644 tests/xmltester/tests/misc/hole_red.xml create mode 100644 tests/xmltester/tests/misc/linemerge.xml create mode 100644 tests/xmltester/tests/misc/makevalid.xml create mode 100644 tests/xmltester/tests/misc/robustness.xml create mode 100644 tests/xmltester/tests/misc/safe-16595.xml create mode 100644 tests/xmltester/tests/misc/safe-16596.xml create mode 100644 tests/xmltester/tests/misc/safe-TestBufferJagged.xml create mode 100644 tests/xmltester/tests/misc/singlesidedbuffer.xml create mode 100644 tests/xmltester/tests/misc/split.xml create mode 100644 tests/xmltester/tests/misc/stmlf-20061020-invalid-output.xml create mode 100644 tests/xmltester/tests/misc/stmlf-20061020.xml create mode 100644 tests/xmltester/tests/misc/stmlf-20070119.xml create mode 100644 tests/xmltester/tests/robust/TestRobustOverlayFixed.xml create mode 100644 tests/xmltester/tests/robust/TestRobustRelate.xml create mode 100644 tests/xmltester/tests/validate/TestRelateAA-big.xml create mode 100644 tests/xmltester/tests/validate/TestRelateAA.xml create mode 100644 tests/xmltester/tests/validate/TestRelateAC.xml create mode 100644 tests/xmltester/tests/validate/TestRelateLA.xml create mode 100644 tests/xmltester/tests/validate/TestRelateLC.xml create mode 100644 tests/xmltester/tests/validate/TestRelateLL.xml create mode 100644 tests/xmltester/tests/validate/TestRelatePA.xml create mode 100644 tests/xmltester/tests/validate/TestRelatePL.xml create mode 100644 tests/xmltester/tests/validate/TestRelatePP.xml create mode 100644 tests/xmltester/tinyxml2/README create mode 100755 tests/xmltester/tinyxml2/tinyxml2.cpp create mode 100755 tests/xmltester/tinyxml2/tinyxml2.h create mode 100644 tools/CMakeLists.txt create mode 100644 tools/Makefile.am create mode 100755 tools/astyle.sh create mode 100755 tools/astyle/ASBeautifier.cpp create mode 100755 tools/astyle/ASEnhancer.cpp create mode 100755 tools/astyle/ASFormatter.cpp create mode 100755 tools/astyle/ASLocalizer.cpp create mode 100755 tools/astyle/ASLocalizer.h create mode 100755 tools/astyle/ASResource.cpp create mode 100644 tools/astyle/CMakeLists.txt create mode 100755 tools/astyle/LICENSE.md create mode 100644 tools/astyle/Makefile.am create mode 100755 tools/astyle/astyle.h create mode 100755 tools/astyle/astyle_main.cpp create mode 100755 tools/astyle/astyle_main.h create mode 100644 tools/build-cmake.bat create mode 100644 tools/ci/bessie.sh create mode 100644 tools/ci/bessie32.sh create mode 100644 tools/ci/common.sh create mode 100755 tools/ci/script.sh create mode 100755 tools/ci/script_autotools.sh create mode 100755 tools/ci/script_cmake.sh create mode 100755 tools/findclassfiles create mode 100644 tools/geos-config.cmake create mode 100644 tools/geos-config.in diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..3632673 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,57 @@ +2006-Present +GEOS is a project of the OSGEO foundation and is continually improved +and funded by mandy FOSS4G developers as well as corporations all +over the world. + +Developers and Project Steering Committee (PSC): +Active: + Martin Davis (mtnclimb at gmail.com )(PSC) - Architecture + Sandro Santilli (strk@kbt.io) (PSC Chair) - Bug Fixing / Maintenance + Paul Ramsey (pramsey@cleverelephant.ca) (PSC) - Coordination / Build + Regina Obe (lr@pcorp.us) (PSC) - QA / Windows / Coordination + Howard Butler (howard@hobu.co) (PSC) - OS Platform support and testing + Dale Lutz (dale.lutz@safe.com) (PSC) + Daniel Baston (dbaston@gmail.com) - Bug Fixing / New functionality + Kurt Schwehr ( schwehr@gmail.com ) - Bug Fixing / Test hardening + Vicky Vergara (vicky@georepublic.de) - Refactor / Test development + +Not Active: + Mateusz Loskot (mateusz@loskot.net) - Unit testing + Frank Warmerdam (warmerdam@pobox.com) - VStudio porting + Dave Blasby (dblasby@gmail.com) - PostGIS Connectivity + Yury Bychkov (me@yury.ca) - Initial Porting + Sean Gillies (sgillies@frii.com) - Scripting Interface + Fernando Villa (fvilla@zoo.uvm.edu) - GNU Build System + Norman Vine (nvine@cape.com) - Porting / C++ Expertise + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +2003-11-06 + +Initial development of GEOS was funded by: + + Vivid Solutions Inc (www.vividsolutions.com) + Refractions Research Inc (www.refractions.net) + British Columbia Advanced Systems Institute (www.asi.bc.ca) + +GEOS is based on algorithms originally developed in Java +by Martin Davis (mbdavis@refractions.net) in the +JTS Topology Suite (www.vividsolutions.com/jts/jtshome.htm) + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +2004 to 2006 + +Continued development of GEOS funded by Refractions Research Inc. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +2006 + +Continued development of GEOS funded by Refractions Research Inc. + +Inclusion of new JTS functionality in JTS 1.5 to 1.7 funded +by Safe Software and Autodesk. + +Improved robustness of geometric operations for GEOS 3.0.0 funded +by the Bavarian State Ministry of Agriculture and Forestry and the +State Survey of Bavaria. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0ec3f8d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,394 @@ +############################################################################## +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018-2019 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +############################################################################## + +# Require CMake 3.8+ with support for meta-features that request compiler +# modes for specific C/C++ language standard levels. +cmake_minimum_required(VERSION 3.8) + +# Default to release build so packagers don't release debug builds +set(DEFAULT_BUILD_TYPE Release) + +# Require CMake 3.13+ with VS generator for complete support of VS versions +# and support by AppVeyor. +if(${CMAKE_GENERATOR} MATCHES "Visual Studio") + cmake_minimum_required(VERSION 3.13 FATAL_ERROR) +endif() + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +# TODO: Follow CMake detection of git and version tagging +# https://gitlab.kitware.com/cmake/cmake/blob/master/Source/CMakeVersionSource.cmake +if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD) + set(GEOS_BUILD_FROM_GIT ON) +endif() + +# Make sure we know our build type +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE}) + message(STATUS "GEOS: Using default build type: ${CMAKE_BUILD_TYPE}") +else() + message(STATUS "GEOS: Build type: ${CMAKE_BUILD_TYPE}") +endif() + + +#----------------------------------------------------------------------------- +# Options +#----------------------------------------------------------------------------- +include(CMakeDependentOption) + +## CMake global variables +option(BUILD_SHARED_LIBS "Build GEOS with shared libraries" ON) +set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard version to use (default is 11)") + +## GEOS custom variables +cmake_dependent_option(GEOS_BUILD_DEVELOPER + "Build with compilation flags useful for development" ON + "GEOS_BUILD_FROM_GIT" OFF) +mark_as_advanced(GEOS_BUILD_DEVELOPER) + +if (POLICY CMP0092) + # dont set /W3 warning flags by default, we already + # set /W4 anyway + cmake_policy(SET CMP0092 NEW) +endif() + +#----------------------------------------------------------------------------- +# Setup build directories +#----------------------------------------------------------------------------- +# Place executables and shared libraries in the same location for +# convenience of direct execution from common spot and for +# convenience in environments without RPATH support. +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +message(STATUS "GEOS: Run-time output: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") +message(STATUS "GEOS: Archives output: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + +#----------------------------------------------------------------------------- +# Version +#----------------------------------------------------------------------------- +file(READ Version.txt _version_txt) + +string(REGEX MATCH "GEOS_VERSION_MAJOR=([0-9]+)" _ ${_version_txt}) +set(_version_major ${CMAKE_MATCH_1}) +string(REGEX MATCH "GEOS_VERSION_MINOR=([0-9]+)" _ ${_version_txt}) +set(_version_minor ${CMAKE_MATCH_1}) +string(REGEX MATCH "GEOS_VERSION_PATCH=([0-9]+)" _ ${_version_txt}) +set(_version_patch ${CMAKE_MATCH_1}) +# OPTIONS: "", "dev", "rc1" etc. +string(REGEX MATCH "GEOS_PATCH_WORD=([a-zA-Z0-9]+)" _ ${_version_txt}) +set(_version_patch_word ${CMAKE_MATCH_1}) + +# Version of JTS this release is bound to +string(REGEX MATCH "JTS_PORT=([0-9a-zA-Z\.]+)" _ ${_version_txt}) +set(JTS_PORT ${CMAKE_MATCH_1}) + +# Version of public C API +string(REGEX MATCH "CAPI_INTERFACE_CURRENT=([0-9]+)" _ ${_version_txt}) +set(_version_capi_current ${CMAKE_MATCH_1}) +string(REGEX MATCH "CAPI_INTERFACE_REVISION=([0-9]+)" _ ${_version_txt}) +set(_version_capi_revision ${CMAKE_MATCH_1}) +string(REGEX MATCH "CAPI_INTERFACE_AGE=([0-9]+)" _ ${_version_txt}) +set(_version_capi_age ${CMAKE_MATCH_1}) + +unset(_version_txt) + +math(EXPR _version_capi_major "${_version_capi_current} - ${_version_capi_age}") +set(CAPI_VERSION_MAJOR ${_version_capi_major}) +set(CAPI_VERSION_MINOR ${_version_capi_age}) +set(CAPI_VERSION_PATCH ${_version_capi_revision}) +set(CAPI_VERSION "${_version_capi_major}.${_version_capi_age}.${_version_capi_revision}") + +unset(_version_capi_current) +unset(_version_capi_major) +unset(_version_capi_age) +unset(_version_capi_revision) + +#----------------------------------------------------------------------------- +# Project +#----------------------------------------------------------------------------- +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9) + list(APPEND _project_info DESCRIPTION "GEOS - C++ port of the Java Topology Suite (JTS)") +endif() +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) + list(APPEND _project_info HOMEPAGE_URL "http://geos.osgeo.org") +endif() + +project(GEOS VERSION "${_version_major}.${_version_minor}.${_version_patch}" + LANGUAGES C CXX + ${_project_info}) + +if("${_version_patch_word}" STREQUAL "") + set(GEOS_VERSION_FULL "${GEOS_VERSION}") +else() + set(GEOS_VERSION_FULL "${GEOS_VERSION}${_version_patch_word}") +endif() + +unset(_version_major) +unset(_version_minor) +unset(_version_patch) +unset(_version_patch_word) + +message(STATUS "GEOS: Version ${GEOS_VERSION_FULL}") +message(STATUS "GEOS: C API Version ${CAPI_VERSION}") +message(STATUS "GEOS: JTS port ${JTS_PORT}") + +#----------------------------------------------------------------------------- +# C++ language version and compilation flags +#----------------------------------------------------------------------------- +message(STATUS "GEOS: Require C++${CMAKE_CXX_STANDARD}") +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +#----------------------------------------------------------------------------- +# Target geos_cxx_flags: common compilation flags +#----------------------------------------------------------------------------- +add_library(geos_cxx_flags INTERFACE) +target_compile_features(geos_cxx_flags INTERFACE cxx_std_11) + +#----------------------------------------------------------------------------- +# Target geos_cxx_flags: common compilation flags +#----------------------------------------------------------------------------- +option(DISABLE_GEOS_INLINE "Disable inlining" ON) +if(NOT DISABLE_GEOS_INLINE) + target_compile_definitions(geos_cxx_flags INTERFACE GEOS_INLINE) +else() + message(STATUS + "GEOS: DISABLING inlining of small functions") +endif() + +#----------------------------------------------------------------------------- +# Target geos_developer_cxx_flags: developer mode compilation flags +#----------------------------------------------------------------------------- +# Do NOT install this target for end-users! +add_library(geos_developer_cxx_flags INTERFACE) + +if(GEOS_BUILD_DEVELOPER) + message(STATUS "GEOS: Developer mode enabled") +endif() + +# geos_cxx_flags inherits properties from geos_developer_cxx_flags when +# building as part of the GEOS repository or on explicit request for +# developer compilation mode, as GEOS contributor. +# The flags are intended only for GEOS itself and are not part of +# usage requirements needed by GEOS consumers. +if(GEOS_BUILD_DEVELOPER) + target_link_libraries(geos_cxx_flags + INTERFACE + $) +endif() + +target_compile_definitions(geos_cxx_flags + INTERFACE + USE_UNSTABLE_GEOS_CPP_API) + +target_compile_definitions(geos_developer_cxx_flags + INTERFACE + $<$:_CRT_NONSTDC_NO_DEPRECATE> + $<$:_SCL_SECURE_NO_DEPRECATE> + $<$:_CRT_SECURE_NO_WARNINGS> + $<$:NOMINMAX>) + +if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" ) + add_compile_options( -Wno-psabi ) + add_compile_definitions( DISABLE_GEOS_INLINE=ON ) +endif() + +target_compile_options(geos_developer_cxx_flags + INTERFACE + $<$:-W4> + $<$,$>:-pedantic -Wall -Wextra -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wdouble-promotion -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wuninitialized -Wunused-parameter -fno-common> + $<$:-fno-implicit-inline-templates>) + +# Disable TTMath ASM support on Windows due to build issues +if(WIN32) + target_compile_definitions(geos_cxx_flags + INTERFACE TTMATH_NOASM) +endif() + +#----------------------------------------------------------------------------- +# Define a coverage build +#----------------------------------------------------------------------------- +set(CMAKE_CXX_FLAGS_COVERAGE "-fprofile-arcs -ftest-coverage") + +#----------------------------------------------------------------------------- +# Target geos: C++ API library +#----------------------------------------------------------------------------- +add_library(geos "") +target_link_libraries(geos PUBLIC geos_cxx_flags) +add_subdirectory(include) +add_subdirectory(src) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(geos + PRIVATE $<$:GEOS_DLL_EXPORT>) + + set_target_properties(geos PROPERTIES VERSION ${GEOS_VERSION}) + set_target_properties(geos PROPERTIES SOVERSION ${GEOS_VERSION}) +endif() + +#----------------------------------------------------------------------------- +# Target geos_c: C API library +#----------------------------------------------------------------------------- +add_library(geos_c "") +target_link_libraries(geos_c PRIVATE geos) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(geos_c + PRIVATE $<$:GEOS_DLL_EXPORT>) + + set_target_properties(geos_c PROPERTIES VERSION ${CAPI_VERSION}) + if(NOT WIN32) + set_target_properties(geos_c PROPERTIES SOVERSION ${CAPI_VERSION_MAJOR}) + endif() +endif() + +add_subdirectory(capi) + +#----------------------------------------------------------------------------- +# Tests +#----------------------------------------------------------------------------- +#include(CTest) +#if(BUILD_TESTING) + #add_subdirectory(tests) +#endif() + +#----------------------------------------------------------------------------- +# Benchmarks +#----------------------------------------------------------------------------- +#add_subdirectory(benchmarks) + +#----------------------------------------------------------------------------- +# Documentation/Examples +#----------------------------------------------------------------------------- +#add_subdirectory(doc) + +#----------------------------------------------------------------------------- +# Install and export targets - support 'make install' or equivalent +#----------------------------------------------------------------------------- +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake" + VERSION ${GEOS_VERSION} + COMPATIBILITY AnyNewerVersion) + +configure_file(cmake/geos-config.cmake + "${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake" + COPYONLY) + +install(TARGETS geos geos_cxx_flags + EXPORT geos-targets + LIBRARY DESTINATION lib NAMELINK_SKIP + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include + ) + +install(TARGETS geos_c + EXPORT geos-targets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include + ) + +#install(EXPORT geos-targets + #FILE geos-targets.cmake + #NAMESPACE GEOS:: + #DESTINATION lib/cmake/GEOS) + +#install(FILES + #"${CMAKE_CURRENT_BINARY_DIR}/geos-config.cmake" + #"${CMAKE_CURRENT_BINARY_DIR}/geos-config-version.cmake" + #DESTINATION lib/cmake/GEOS) +#install(DIRECTORY + #"${CMAKE_CURRENT_LIST_DIR}/include/geos" + #"${CMAKE_CURRENT_BINARY_DIR}/include/geos" + #DESTINATION include + #FILES_MATCHING PATTERN "*.h") +#if(NOT DISABLE_GEOS_INLINE) + #install(DIRECTORY + #"${CMAKE_CURRENT_LIST_DIR}/include/geos" + #"${CMAKE_CURRENT_BINARY_DIR}/include/geos" + #DESTINATION include + #FILES_MATCHING PATTERN "*.inl") +#endif() +#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capi/geos_c.h" + #DESTINATION include) + +# 03.07.2023, A.Vasyunin: CMake fails with error: no matching function for call to 'stat::stat(const char*, stat*)' +# In KPDA_TARGET/usr/include/sys/stat.h we have stat::stat() wrapped under #if defined(__EXT_POSIX1_198808) +# add_subdirectory(tools) + +#----------------------------------------------------------------------------- +# Uninstall +#----------------------------------------------------------------------------- + +configure_file("${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${PROJECT_BINARY_DIR}/cmake/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + +add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake/cmake_uninstall.cmake") + +#----------------------------------------------------------------------------- +# "make dist" workalike +#----------------------------------------------------------------------------- +get_property(_is_multi_config_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _is_multi_config_generator) + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GEOS Computational Geometry Library") + set(CPACK_PACKAGE_VENDOR "OSGeo") + set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md) + set(CPACK_SOURCE_GENERATOR "TBZ2") + set(CPACK_PACKAGE_VERSION_MAJOR ${GEOS_VERSION_MAJOR}) + set(CPACK_PACKAGE_VERSION_MINOR ${GEOS_VERSION_MINOR}) + set(CPACK_PACKAGE_VERSION_PATCH ${GEOS_VERSION_PATCH}) + set(CPACK_SOURCE_PACKAGE_FILE_NAME "geos-${GEOS_VERSION_FULL}") + + set(CPACK_SOURCE_IGNORE_FILES + "/\\\\.git" + "/autogen\\\\.sh" + "/tools/ci" + "/HOWTO_RELEASE" + "/autom4te\\\\.cache" + "\\\\.yml\$" + "\\\\.deps" + "/debian/" + "/php/" + "/.*build-.*/" + ${PROJECT_BINARY_DIR} + ) + + # message(STATUS "GEOS: CPACK_SOURCE_PACKAGE_FILE_NAME: ${CPACK_SOURCE_PACKAGE_FILE_NAME}") + # message(STATUS "GEOS: CPACK_SOURCE_IGNORE_FILES: ${CPACK_SOURCE_IGNORE_FILES}") + # message(STATUS "GEOS: CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") + include(CPack) + add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) + + message(STATUS "GEOS: Configured 'dist' target") +endif() + +#----------------------------------------------------------------------------- +# "make check" workalike +#----------------------------------------------------------------------------- + +add_custom_target(check COMMAND ${CMAKE_BUILD_TOOL} test) + +#----------------------------------------------------------------------------- +# "make distcheck" workalike +#----------------------------------------------------------------------------- +#if(NOT _is_multi_config_generator) + #find_package(MakeDistCheck) + #AddMakeDistCheck() + #message(STATUS "GEOS: Configured 'distcheck' target") +#endif() + +unset(_is_multi_config_generator) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/HOWTO_RELEASE b/HOWTO_RELEASE new file mode 100644 index 0000000..893e1a8 --- /dev/null +++ b/HOWTO_RELEASE @@ -0,0 +1,47 @@ +1. Verify that the versions currently set in Version.txt + sense for this release. + + - GEOS_VERSION_PATCH + - GEOS_VERSION_MINOR + - GEOS_VERSION_MAJOR + + - CAPI_INTERFACE_CURRENT + - CAPI_INTERFACE_REVISION + - CAPI_INTERFACE_AGE + + Always increase the revision value. + Increase the current value whenever an interface has been added, removed or changed. + Increase the age value only if the changes made to the ABI are backward compatible. + +2. Run 'make distcheck', fix any problem with it. + +3. Update the NEWS file (extract most important things from the + repository log). Make sure to update the release date. + +4. Commit the changes in the NEWS file. + +5. Run 'make dist-bzip2'. + + $ ./autogen.sh && ./configure && make dist-bzip2 + +6. Verify that you can un-pack and build the tarball. + + - autotools: ./configure && make check + - cmake: mkdir build && cd build && cmake .. && make && make check + +7. Copy the tarball to upload.osgeo.org:/osgeo/download/geos + +8. Tag the release: + + $ git tag MAJOR.MINOR.PATCH + $ git push origin MAJOR.MINOR.PATCH + +9. Increment all the version numbers for the next release (described in 1 above). + +10. Update wiki page https://trac.osgeo.org/geos/ at Download section + + - Add latest release + - Remove previous patch level release (if any) + +11. Announce on geos-devel + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..e9ea10a --- /dev/null +++ b/INSTALL @@ -0,0 +1,92 @@ +## Building GEOS From Source + +### Prerequisites + +GEOS has no external library dependencies and can be built with any C++11 +compiler. + +### Unix + +GEOS can be built on Unix systems using either the autotools or CMake build +systems. + +#### Using Autotools: + +When building GEOS using autotools, a `configure` script must first be generated +using the `autogen.sh` file included in the root of the repository: + + ./autogen.sh + +An out-of-tree build can then be initiated by creating a subdirectory and +running the generated `configure` script from that subdirectory: + + mkdir obj && cd obj && ../configure + +Once the `configure` script has run, GEOS can be built by running `make` and +installed by running `make install`. The test suite can be run using `make +check`. + +#### Using CMake: + +To build `GEOS` using CMake, create a build directory and run the `cmake` command +from that location: + + mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. + +Setting `CMAKE_BUILD_TYPE` to `Release` is necessary to enable compiler +optimizations. + +Once the `cmake` tool has run, GEOS can be built by running `make` and +installed by running `make install`. + +The entire test suite can be run using `make check`. +Alternatively, the `ctest` command can be used, which provides more control over test execution. +For example, `ctest -R unit-capi -j2` uses a regular expression to run all tests +associated with the C API, using two processes in parallel. +A list of available tests can be obtained using `ctest -N`. + +### Microsoft Windows + +GEOS can be built with Microsoft Visual C++ by opening the `CMakeLists.txt` in +the project root using `File > Open > CMake`. + +If you prefer the command-line + +#### Build with CMake generator for Ninja (fast) + +In the Visual Studio 2019 command prompt, `x64 Native Tools Command Prompt for VS 2019` or `x64_x86 Cross Tools Command Prompt for VS 2019`: + +``` +cmake -S . -B _build_vs2019_ninja -G Ninja -DCMAKE_BUILD_TYPE=Release +cmake --build _build_vs2019_ninja -j 16 --verbose +``` + +#### Build with CMake generator for MSBuild (default) + +In the non-specific Command Prompt: + +##### 64-bit + +``` +cmake -S . -B _build_vs2019x64 -G "Visual Studio 16 2019" -A x64 -DCMAKE_GENERATOR_TOOLSET=host=x64 +cmake --build _build_vs2019x64 --config Release -j 16 --verbose +``` + +##### 32-bit + +``` +cmake -S . -B _build_vs2019x32 -G "Visual Studio 16 2019" -A x32 -DCMAKE_GENERATOR_TOOLSET=host=x64 +cmake --build _build_vs2019x32 --config Release -j 16 --verbose +``` + +#### Test using CMake + +``` +cd +ctest --show-only +ctest +ctest --output-on-failure +ctest -V +ctest -VV +``` + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..dbc7451 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,77 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +# NOTE: Make sure that 'src' appears first. +# 'capi' and 'doc' surely rely on availability of libgeos +# which is built under 'src' and it seems that automake +# is not able to detect required build order but blindly +# relies on the order items in SUBDIRS appear. +# + +# foreign is needed to avoid enforced ChangeLog in EXTRA_DIST +# (we'll still take care of adding it ourselves) +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = \ + include \ + src \ + capi \ + doc \ + macros \ + swig \ + tests \ + benchmarks \ + tools + +BUILT_SOURCES = + +EXTRA_DIST = \ + README.md \ + acsite.m4 \ + .editorconfig \ + Version.txt \ + CMakeLists.txt \ + cmake/cmake_uninstall.cmake.in \ + cmake/geos-config.cmake \ + cmake/FindMakeDistCheck.cmake + +ACLOCAL_AMFLAGS = -I macros + +dist-hook: gen-ChangeLog + +gen-ChangeLog: + cd $(distdir) && owd=`pwd` && \ + cd ../ && cd $(srcdir) && \ + if test -d .git; then \ + git log --pretty --numstat --summary | git2cl > $${owd}/ChangeLog; \ + elif test -d .svn; then \ + svn2cl --authors=authors.svn -i -o $${owd}/ChangeLog; \ + elif test -f ChangeLog; then \ + cp ChangeLog $${owd}/ChangeLog; \ + fi + +apidoc doxygen: + cd doc && make $@ + +doxygen-checked: + ( set -o pipefail; \ + ! make doxygen 2>&1 > /dev/null | \ + grep -v '\(not documented\|ignoring unsupported tag\)'; \ + ) + +authors.git: authors.svn + cd $(srcdir) && sed -e 's/:/ = /' authors.svn > authors.git + +svnrebase: authors.git + cd $(srcdir) && git svn rebase --authors-file authors.git + +VALGRIND = $(LIBTOOL) --mode=execute valgrind --leak-check=full --error-exitcode=1 + +valgrindcheck: + $(VALGRIND) tests/unit/geos_unit + +check-local: + ! find $(srcdir) -name '*.cpp' -o -name '*.h' | \ + grep -v tests/xmltester/tinyxml | \ + grep -v include/geos/algorithm/ttmath | \ + xargs grep -n '[[:space:]]$$' diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..155b859 --- /dev/null +++ b/NEWS @@ -0,0 +1,706 @@ +Changes in 3.8.1 +2020-03-10 + +- Bug fixes / improvements + - Stack allocate line segments in OverlapUnion (Paul Ramsey) + - Avoid returning non-empty CoordinateSequence from empty Point + (#1001, Dan Baston) + - Avoid assertion failure with MSVC 2017 / 2019 (#1002, Dan Baston) + - Remove whitespace from end of GEOSversion() output (azhi) + - Improve performance of GEOSisValid (#1008, Dan Baston) + - Avoid changing MultiLineString component order in GEOSReverse + (#1013, Dan Baston) + - Fix missing vtable for LineString and CoordinateArraySequenceFactory + (#299 and #1016, Evgen Bodunov) + - Reduce performance regression in GEOSBuffer (#1020) + +Changes in 3.8.0 +2019-10-10 + +- New things: + - CAPI: GEOSBuildArea (#952, Even Rouault) + - CAPI: GEOSMakeValid (#952, Even Rouault) + - CAPI: GEOSPolygonize_valid (#727, Dan Baston) + - CAPI: GEOSCoverageUnion (Dan Baston) + - CAPI: GEOSCoordSeq_setXY, GEOSCoordSeq_setXYZ, + GEOSCoordSeq_getXY, GEOSCoordSeq_getXYZ (Dan Baston) + - CAPI: GEOSMinimumBoundingCircle (#735) + - CAPI: GEOSGeom_createPointFromXY (Dan Baston) + +- Improvements: + - Improve overall performance by reducing of heap allocations (Dan Baston) + - Improve performance and robustness of GEOSPointOnSurface (Martin Davis) + - Improve performance of GEOSPolygonize for cases with many potential + holes (#748, Dan Baston) + - Support extended precision calculations (ttmath) and port JTS + improvements related to extended precision (Paul Ramsey, Mateusz Loskot) + - Improve performance of GEOSPolygonize for cases with many or complex + shells (Dan Baston, Martin Davis) + - Improve performance of Delaunay triangulations / Voronoi Diagrams + (Dan Baston) + - Improve performance of prepared geometry operations (Dan Baston) + - Improve robustness of Delaunay triangulations (Paul Ramsey, Martin Davis) + - Improve performance of unary union for lines (Dan Baston) + - Improve general predicate, overlay, and buffer performance (Dan Baston, Paul Ramsey) + - Improve cascaded union performance (Paul Ramsey, Martin Davis) + - Allocate default GeometryFactory singleton on the stack (Sandro Mani) + - Harmonize XML tests with JTS and harmonize cmake/autoconf + test running (Paul Ramsey) + - CMake modernization (Mateusz Loskot, Paul Ramsey, Dan Baston) + - Return unique_ptr from most methods that produce a new geometry (Dan Baston) + +- Changes: + - Constructive geometry functions in CAPI now preserve SRID + of input arguments in output (#896) + + +Changes in 3.7.2 +2019-05-02 + +- Bug fixes / improvements + - Envelope constructor using strtod (#875 Paul Ramsey) + - Failure in CMake for OSX Framework (#936 Paul Ramsey) + - Polygon build failure in Overlay difference (#789 Paul Ramsey) + - Invalid union result from valid polygon inputs (#838) + + +Changes in 3.7.1 +2018-11-29 + +- Bug fixes / improvements + - Fix crash in GEOSCoordSeq_isCCW with empty coordseq + (#927, Sergey Fedoseev) + - Fix crash in GEOSInterpolate with empty LineString + (#926, Sergey Fedoseev) + - Fix crash in GEOSUnaryUnion with empty LineString + (#928, Sergey Fedoseev) + - Fix memory leak in SIRtree::insert (#919, Dan Baston) + - Reduce required autoconf to 2.63 + (#56, John Harvey) + - Fix incorrect return values on error from GEOSLength + GEOSisValidDetail (#941, Dan Baston) + + +Changes in 3.7.0 +2018-09-10 + +- New things: + - CAPI: GEOSDistanceIndexed (#795, Dan Baston) + - CAPI: GEOSCoordSeq_isCCW (#870, Dan Baston) + - CAPI: GEOSGeom_getXMin, GEOSGeom_getXMax, + GEOSGeom_getYMin, GEOSGeom_getYMax (#871, Dan Baston) + - CAPI: GEOSFrechetDistance (#797, Shinichi SUGIYAMA) + - CAPI: GEOSReverse (#872, Dan Baston) + - CAPI: GEOSSegmentIntersection (#873, Dan Baston) + - CAPI: GEOSGeomGetZ (#581, J Smith) + +- Improvements + - Interruptible snap operation (Paul Ramsey) + - Numerous packaging, doc, and build changes + (Debian group: Bas Couwenberg, Francesco Paolo Lovergine) + +- C++ API changes: + - Require defining USE_UNSTABLE_GEOS_CPP_API for use without + warnings. + - Make C++11 required (Mateusz Loskot) + - Use C++11 unique_ptr, nullptr, and override constructs + (Mateusz Loskot) + - C++11 standard delete on noncopyable + (#851, Vicky Vergara) + - Fix CommonBits::getBit to correctly handle i >= 32 + (#834, Kurt Schwehr) + +Changes in 3.7.0rc1 +2018-08-19 +Fixes / enhancements since 3.7.0beta2 + - Avoid segfault when querying empty tree (#730, framm) + - Collection with Empty components crashes overlay (#782, Dan Baston) + - Allow static library with C API for CMake builds (#878, Dakota Hawkins) + +Changes in 3.7.0beta2 +2018-08-06 +Fixes since 3.7.0beta1 + - Fix infinite loop in GEOSClipByRect (#865, Dan Baston) + - Make GEOSException inherit from std::runtime_error + to address clang warnings (Dan Baston) + - Add missing CMake files to tarball (#895, Regina Obe) + + +Changes in 3.7.0beta1 +2018-06-25 +See 3.7.0 latest notes + +Changes in 3.7.0alpha +2018-06-14 +See 3.7.0 notes + +Changes in 3.6.1 +2016-12-24 + +- Bug fixes / improvements + - Fix GEOSSTRtree_nearest_r signature and add implementation (#796) + - Fix --static-clibs and --static-cclibs returns from geos-config + - Fix WKB representation of empty polygon (#680). + - Fix empty GEOSSimplify return on inner ring collapse (#741) + +Changes in 3.6.0 +2016-10-25 + +- Important / Breaking Changes: + - The PHP binding moved to its own repository: + http://git.osgeo.org/gogs/geos/php-geos (#765) +- New things: + - CAPI: GEOSGeom_{get,set}UserData (Rashad Kanavath) + - CAPI: GEOSGeom_{set,get}Precision (#713) + - CAPI: GEOSMinimumRotatedRectangle and GEOSMinimumWidth + (#729, Nyall Dawson) + - CAPI: GEOSSTRtree_nearest (#768, Dan Baston) + - CAPI: GEOSMinimumClearance and GEOSMinimumClearanceLine + (#776, Dan Baston) +- C++ API changes: + - Automatic memory management for GeometryFactory objects + + +Changes in 3.5.0 +2015-08-16 + +- New things: + - Voronoi API (#627) + - PHP: Geometry->normalize method + - GEOS_USE_ONLY_R_API macro support (#695) + - PHP: WKBReader->read() & WKBWriter::write() methods (Benjamin Morel) + - GEOSClipByRect (#699, Mika Heiskanen, Sandro Santilli) + - CAPI: thread-safe message handling API (#663, Pepijn Van Eeckhoudt) +- Improvements: + - Speed-up intersection and difference between geometries + with small bounding box overlap. + - CAPI: add MULTILINESTRING support for GEOSisClosed (Benjamin Morel) +- C++ API changes: + - Added no-parameter CoordinateSequenceFactory::create method (Sandro Mani) + +Changes in 3.4.2 +2013-08-25 + +- Bug fixes / improvements + - Use a double for PrecisionModel scale, avoiding overflows + should fix 32-bit regression failures (#652) + - isnan workaround OS detection missing NetBSD, DragonFly, Sun nuance (#650) + - Do not distribute platform.h and version.h, but install both (#601) + - Non-standard ChangeLog file in 3.4.0 and 3.4.1 releases (#654) + - new travis bot (#657) + - accept multiple Nan representations (#656) + + +Changes in 3.4.1 +2013-08-17 + +- Bug fixes / improvements + - Assertion failure snapping line to points of rectangle + smaller than tolerance (#649) + - Can't build using cmake with tar ball (#644) + +Changes in 3.4.0 +2013-08-11 + +- New things: + - Delaunay Triangulation API (#487, #565, #570, #567) + - Interruptibility API (C and C++) + - CAPI: GEOSNode (#496) - PHP: Geometry->node + - GeometryPrecisionReducer class (#496, #526) + - BufferInputLineSimplifier header exposed (#548) + - New Centroid class supporting mixed geometry components (#612) + - io::Writer::reserve() method + - CAPI: GEOSNearestPoints + - Add --cclibs, --static-clibs and --static-cclibs to geos-config (#497) + - Early bail out of overlay exception if input is invalid + +- C++ API changes: + - New noding::GeometryNoder class + - Added BufferOp::setSingleSided + - Signature of most functions taking a Label changed to take it + by reference rather than pointer. + - Signature of most functions taking an IntersectionMatrix changed + to take it by reference rather than pointer. + - GraphComponent::label is now a Label value (from a pointer) + - NodedSegmentString takes ownership of CoordinateSenuence now + - io::Writer's toString() returns by const ref, write() takes a const ref + - Unify prototypes of WKTReader and WKBReader constructor (#310) + - GeometryCollection::computeEnvelopInternal and + GeometryCollection::compareToSameClass are marked virtual (#478) + +- Bug fixes / improvements + - A point interpolated from a line does not always intersect + the same line (#323) + - Port ConvexHull robustness fix from JTS-1.13 (#457) + - Improve Overlay robustness by reducing input precision on topology + exception and by refusing to accept unnoded output (#459) + - Improve Buffer robustness by reducing input precision on topology + exception (#605) + - Mismatch segment sides in OffsetCurveBuilder (#633 ) + - Fixed Linear Referencing API to handle MultiLineStrings consistently + by always using the lowest possible index value, and by trimming + zero-length components from results (#323) + - Fixed CMake configuration to set correct SOVERSION (current - age) + - Fix EMPTY return from single-point lines and zero-length polygons (#612) + - CMakeLists.txt, tools/geos_svn_revision_cmake.h.in: Add + geos_svn_revision.h generator to CMake config (#643) + - Makefile.vc 'clean' step leaks obj files (#607) + +Changes in 3.3.9 +2013-09-04 + +- Bug fixes / improvements + - Fix OffsetCurve op in presence of duplicated vertices (#602) + - Fix LineSegmentVisitor copy ctor (#636) + - Fix area boundary return from GEOSPointOnSurface (#623) + - Speedup GEOSWKBReader_read (#621) + - Fix RobustLineIntersector handling of invalid intersection points (#622) + - Reduce likelyhood of invalid output from snap operation (#629, #501) + - Reduce memory fragmentation of prepared Polygon/Point intersection op + - Fix mingw64 compile (#630) + - Fix bug in HotPixel constructor (#635) + - Fix install location of linearref headers (#624) + - Fix multi-geometry constructor to drop SRID from components (#583) + +Changes in 3.3.8 +2013-02-28 + +- Bug fixes / improvements + - IsValidOp: throw proper error on nested shells (#608) + - Fix header guards (#617, #618, #619) + - WKTWriter::appendCoordinate optimisation + - Fix centroid computation for collections with empty components (#582) + +Changes in 3.3.7 +2013-01-22 + +- Bug fixes / improvements + - Fix abort in RightmostEdgeFinder (#605) + - Do not force precision reduction below 6 significant digits + while trying to obtain a valid Buffer output (#605) + - Fix GEOSPointOnSurface with zero-length linestring (#609) + - Fix EMPTY return from zero-area polygon (#613) + - Segfault from symdifference (#615) + +Changes in 3.3.6 +2012-11-15 -- that's Post-GIS day ! + +- Bug fixes / improvements + - Add support for testing with phpunit 3.6 (not loosing support for 3.4) + - Segfault from intersection (#586, #598, #599) + +Changes in 3.3.5 +2012-06-25 + +- Bug fixes / improvements + - Correctly increment CAPI lib version from 3.3.3 (#558) + - Port robustness fix to CentroidArea (#559) + - Always return POINT from GEOSGetCentroid, even for EMPTY (#560) + - Always return POINT from GEOSPointOnSurface, even for EMPTY (#561) + +Changes in 3.3.4 +2012-05-31 + +- Bug fixes / improvements + - Do not abort on NaN overlay input (#530) + - Reduce CommonBitsRemover harmful effects during overlay op (#527) + - Better cross-compiler support (#534) + - Enable overlay ops short-circuits (#542) + - Envelope-based short-circuit for symDifference (#543) + - Fix support for PHP 5.4 (#513) + - Fix TopologyPreservingSimplifier invalid output on closed line (#508) + - Reduce calls to ptNotInList, greatly speeding up Polygonizer (#545) + +Changes in 3.3.3 +2012-04-01 + +- Bug fixes / improvements + - Fix simplification of collections with empty items (#519) + - Fix MSVC compilation of ambiguous log() call (#506) + - Fix CMake issues with std:: namespace detection (#493) + +Changes in 3.3.2 +2012-01-05 + +- Bug fixes / improvements + - Fix CMAKE_CXX_FLAGS overriding -std=gnu++0x (#489) + - Missing versions update in CMake configuration (#490) + - Fix noding of self-intersecting lines through UnaryUnion (#482) + - Fix handling of collapsed edges skipping in BufferOp (#494) + - Print up to 18 digits of precision for TopologyException points + - Fix noding with reduced precision in Buffer operation (#473) + - Fix HotPixel original point invalidation (#498) + - Fix CascadedPolygonUnion to discard non-polygonal components (#499) + - Improve buffer robustness by reverting to non-snaprounding noder (#495) + - Fix C++11 build by avoiding std::pair (#491) + - Add --clibs to geos-config and GEOS_C_LIBS to geos.m4 (#497) + - Apply shoelace formula for area calculation (#485) + - Fix default initialization issue for clang (#500) + - Improve overlay robustness by fixing areal validity on snapping (#488) + +Changes in 3.3.1 +2011-09-27 + +- Bug fixes / improvements + - Fix memory leak on invalid geometry in InteriorPointArea (#475) + - ValidOp abort in presence of 2 touching holes forming an island (#449) + - Enable prepared intersects operation for points + - Fortify suspicious code found by static analysis tools + - Fix for SOLARIS build (#461) + - Fix EMPTY result from GEOSOffsetCurve with distance 0 (#454) + - Fix Geometry::clone to copy SRID (#464) + - Fix for clang builds (#463) + - Fix out-of-place builds for python binding (#332) and regress testing + - Fix OS X framework cmake build (#385) + +Changes in 3.3.0 +2011-05-30 + +- New things: + - CAPI: GEOSBufferWithParams (allows single sided buffers) + - CAPI: GEOSOffsetCurve deprecates GEOSSingleSidedBuffer + - CAPI: GEOSUnaryUnion deprecates GEOSCascadedUnion + - CAPI: GEOSisValidDetail: tell state, reason & location apart. allows + passing flags. + - CAPI: GEOSContext_setNoticeHandler_r, GEOSContext_setErrorHandler_r + - CAPI: GEOSGeom_createEmptyPoint, GEOSGeom_createEmptyLineString + GEOSGeom_createEmptyPolygon, GEOSGeom_createEmptyCollection + - CAPI: GEOSGeom_extractUniquePoints + - CAPI: GEOSGetGeometryN support for single geometries + - CAPI: GEOSPolygonize_full to return all informations computed by + the polygonizer + - CAPI: GEOSOrientationIndex + - CAPI: GEOSSharedPaths to find shared paths and their orientation + - CAPI: GEOSSnap + - CAPI: GEOSRelatePatternMatch + - CAPI: GEOSCovers, GEOSCoveredBy (#396) + - CAPI: GEOSRelateBoundaryNodeRule (#399) + - CAPI: GEOSGeom_getCoordinateDimension() (#311) + - CAPI: GEOSWKTWriter_setOutputDimension, GEOSWKTWriter_setOld3D (#292) + - PHP: new PHP5 bindings based on CAPI +- Semantic C++ API changes: + - Geometry inheritance chain changed to introduce Puntal, Lineal + and Polygonal classes (virtual inheritance introduced) + - Polygonizer::getInvalidRingLines retains ownership of vector elements + - Geometry::isWithinDistance method is now const + - Polygonizer::getCutEdges returns by const ref + - Polygonizer::getDangles returns by const ref + - Empty LinearRings are closed by definition +- Bug fixes / improvements + - Fixed Geometry.distance() and DistanceOp to return 0.0 for empty inputs + - Invalid compound geometries reported as valid (#333) + - Return up to 15 digits of precision from GEOSisValidReason_t (#329) + - CAPI: do not leak contexts when using the non-reentrant interface + - Fix duplicated dangles returned by Polygonizer + - Fix SnapIfNeededOverlayOp to throw the originating exception + - Fixed LineMerger to skip lines with only a single unique coordinate + - Fix NodedSegmentString to handle zero-length line segments correctly + (via safeOctant) + - Fixed buffer OffsetCurveSetBuilder to handle "flat" rings correctly + - Added illegal state check in LineSegment::pointAlongOffset() + - Improved performance of RectangleIntersects by always using + segment-scanning and refining SegmentIntersectionTester + - Reduce memory use in PreparedGeometry predicates (#342) + - Fix infinite loop in RobustDeterminant with nan/inf input (#357) + +Changes in 3.2.0 +2009-12-14 + +- Add Single-sided buffer operation +- JTS-1.10 sync ... + - Drastically improved Buffer speed (20x for a case in testsuite) + - Improved EdgeList duplicate edge finding + - Added algorithm::distance package + - Added algorithm::Angle class + - Added algorithm::BoundaryNodeRule class + - IsSimpleOp can now return non-simple location coordinate + - DistanceOp can now check for 'within distance' predicate + (earlier exit) + - MultiPolygon::getBoundary always return MultiLineString, also + when the result is the EMPTY geometry. +- Various bug and leak fixes, optimizations +- Replace MarkupSTL with tinyXML + +Changes in 3.1.0 + +- PreparedGeometry operations for very fast predicate testing. + - Intersects() + - Covers() + - CoveredBy() + - ContainsProperly() +- Easier builds under MSVC and OpenSolaris +- Thread-safe CAPI option +- IsValidReason added to CAPI +- GEOSPolygonizer_getCutEdges added to CAPI +- CascadedUnion operation for fast unions of geometry sets +- Numerous bug fixes. + http://trac.osgeo.org/geos/query?status=closed&milestone=3.1.0&order=priority + +Changes in 3.0.0 + + These are mostly ABI breaking changes. + In few cases the API also changed, but the most external one + (the documented one) should be unchanged. + +- New things: + - Added geom::BinaryOp class performing a binary operation + using different heuristics to reduce probability of robustness + issues. Both C-API and XMLTester now use this class for + binary operations. + - Added covers() and coveredBy() predicates to Geometry class + - Added overlay::overlayOp() adapter class + - Added GEOSSimplify() and GEOSTopologyPreserveSimplify() + to the C API + - Added closed ring checks in IsValidOp + - Multi-input support in XMLTester + - HEXWKB I/O + - Envelope(string) ctor + - Ruby interface + - New ShortCircuitedGeometryVisitor class + - New operation/predicate package + - Added CGAlgorithms::isPointInRing() version working with + Coordinate::ConstVect type (faster!) + - Added getAt(int pos, Coordinate &to) funtion to CoordinateSequence + class. + - Moved GetNumGeometries() and GetGeometryN() interfaces + from GeometryCollection to Geometry class. + - New planarSubgraph class + - New ConnectedSubgraphFinder class. + - New LineSequencer class + - New WKTWriter::toLineString and ::toPoint convenience methods + - New IsValidOp::setSelfTouchingRingFormingHoleValid method + - New WKTWriter::toLineString and ::toPoint convenience methods + - New IsValidOp::setSelfTouchingRingFormingHoleValid method + - New Envelope::centre() + - New Envelope::intersection(Envelope) + - New Envelope::expandBy(distance, [ydistance]) + - New LineString::reverse() + - New MultiLineString::reverse() + - New Geometry::buffer(distance, quadSeg, endCapStyle) + - New SnapRounding code + - New size() and operator[] interfaces to CoordinateSequence + - New ScaledNoder class + - New unit tests (make check rule) + +- Optimizations: + - WKT parser speedup + - Function inlining + - Coordinate copies reduction + - Heap allocations reduction + - More classes made final + - Better use of standard containers + - Use of singletons when appropriate + - Removed many function calls in loops' end conditions + - Improved XMLTester output and user interface + - Improved memory use in geos::geom::util::PolygonExtractor + - Ported JTS-1.7 version of ConvexHull with big attention to + memory usage optimizations. + - Changed CoordinateArrayFilter to reduce memory copies + - Changed UniqueCoordinateArrayFilter to reduce memory copies + - Added rectangle-based optimizations of intersects() and + contains() ops + - Inlined all planarGraphComponent class + - More iterators returning methods and inlining in planargraph. + - Obsoleted toInternalGeometry/fromInternalGeometry + - Improved buffering speed and robustness by using Snap Rounding + +- Semantic changes + + - SegmentString: getCoordinates() doesn't return a clone + anymore, getCoordinatesRO() obsoleted. + - JTS packages mapped to geos:: sub-namespaces + - Geometry::getInteriorPoint() returns NULL if called + against an EMPTY geom + - LineString::get{Start,End}Point return NULL for + EMPTY geoms + - GEOSException is now derived by std::runtim_exception + and thrown by const reference. + - Geometry constructors made protected, to force use + of a GeometryFactory. + +- Correctness: + - More const-correct signatures + - Stronger methods typing (removed some void * args). + - Changed index-related funx signatures to use size_t + rather then int + - More const-correctness in Buffer "package" + - Bugfix in LineString::getCoordinate() failing to return + NULL from getCoordinat() when empty. + - Use unsigned int for indexes and sizes. + +- Layout changes: + - Namespaces mapping JTS packages + - Renamed classes after JTS names (namespaces use made this possible + w/out name clashes) + - Splitted headers, for build speedup and possible API reduction. + - Moved source/bigtest and source/test to tests/bigtest + and test/xmltester + - Moved C-API in it's own top-level dir capi/ + - Reworked automake scripts to produce a static lib for each subdir + and then link all subsystem's libs togheter + - Renamed DefaultCoordinateSequence to CoordinateArraySequence. + - Renamed OverlayOp opcodes by prepending the 'op' prefix, and + given the enum a name (OpCode) for type-safety. + +- Bug fixes: + - Fixed bug causing redundant linestrings to be returned in the + result of overlaying polygons containing touching holes (#13) + - Fixed integer conversion bug + - Fixed PointLocator handling of LinearRings + - Added missing ::clone() methods for Multi* geoms + +- (Partial) Detailed list of changes: + - Changed SegmentNode to contain a *real* Coordinate (not a pointer) + to reduce construction costs. + - Changed geomgraph nodeMap to use Coordinate pointers as keys + - Envelope destructor made non-virtual to give compiler more static + binding options. + - Changed BufferSubgraph::computeDepths to use a set instead of a + vector for checking visited Edges. + - Made LineIntersector a concrete type + - Node::isIncidentEdgeInResult() method made virtual + - Const-correct signatures in LineMerger package + - Changed operation/valid/*NestedRingTester classes interface + to use Coordinate pointers instead of copies. + - Changed EdgeIntersectionList to use a set instead of a vector + - Changed DepthSegment to store a real Coordinate rather then a pointer. + - Changed SubgraphDepthLocater to store real containers rather then + pointers. + - Changed BufferSubgraph to store a real RightmostEdgeFinder and real + containers rather then pointers. + - CoordinateSequence API changes: + - point index and size related functions + use unsigned int rather then int + - Changed EdgeEndStar to maintain a single container for EdgeEnds + - Changed PlanarGraph::addEdges to take a const vector by ref + rathern then a non-const vector by pointer + - Changed EdgeList::addAll to take a const vector by ref + rather then a non-const vector by pointer + - Added apply_rw(CoordinateFilter *) and apply_ro(CoordinateFilter *) + const to CoordinateSequence + - LineBuilder::lineEdgesList made a real vector, rather then pointer + (private member) + - SegmentString::eiList made a real SegmentNodeList, rather then + a pointer (private member) + - Removed coordinate copies in ElevationMatrix::elevate + - Changed CoordinateFilter interface to have a const method + for filter_rw, updated interfaces using this to take + const CoordinateFilter (apply_rw). + + +Changes in 2.2.4 + + - Added version.in.vc to distribution + +Changes in 2.2.1 + +- Support for MingW builds +- Bugfix in Polygonizer chocking on invalid LineString inputs +- CAPI: small leak removed in GEOSHasZ() + +Changes in 2.2.0 + +- Performance improvement in OverlayOp::insertUniqueEdge() +- CoordinateSequence copy removal in EdgeRing +- Minor memory allocation improvements +- Higher dimensions interface for CoordinateSequence +- Added getCoordinatesRO for Point class +- NEW WKB IO +- NEW Simplified and stabler C API + +Changes in 2.1.4 + +- Severe BUGFIX in BufferSubgraphGT and other functions used + as StrictWeakOrdering predicates for sort() + +Changes in 2.1.3 + +- win32/mingw build support +- Segfault fix in LinearRing and LineString constructors +- Segfault fix in Polygonizer +- XMLTester installed by default +- XMLTester code cleanup +- Fixed handling of collection input in GeometryFactory::buildGeometry +- Added shortcircuit test for Union operation +- Reduced useless Coordinate copies in CGAlgorithms::isPointInRing() +- Performance improvements in CGAlgorithms::isOnLine() +- Other minor performance improvements +- New Node::isIncidentEdgeInResult() method +- OverlayOp's PointBuilder performance improvement by reduction + of LineIntersector calls. +- Optimizations in Buffer operation +- Sever BUGFIX in DepthSegmentLT as suggested by Graeme Hiebert + +Changes in 2.1.2 + +- Segfault fix in Point::isEmpty +- Mem Leak fix in OffsetCurveBuilder::getRingCurve +- Bugfix in LineSegment::reverse +- Added multipolygon buffering test in source/test/testLeaksBig +- Ported JTS robustness patch for RobustLineIntersector +- Removed useless Coordinate copies in OverlayOp::mergeZ() +- Avoided throws by IsValid on invalid input +- Stricter C++ syntax (math.h=>cmath, ieeefp.h in "C" block, ostringstream + instead of sprintf) +- Better support for older compilers (Polygonizer::LineStringAdder friendship) +- Removed useless Coordinate copies in CGAlgorithms::isOnLine() +- Added support for polygonize and parametrized buffer tests in XMLTester +- Fixed support for --includedir and --libdir +- Fixed Z interpolation in LineIntersector +- Handled NULL results from getCentroid() in XMLTester +- Segfault fix in (EMPTY)Geometry::getCentroid() +- Made polygon::getBoundary() always OGC-valid (no LinearRings) +- Input checking and promoting in GeometryFactory::createMultiLineString() +- Segfault fix in GeometryEditor::editPolygon() + + +Changes in 2.1.1 + +- Fixed uninitialized Coordinate in TopologyException +- Added install of version.h, platform.h and timeval.h +- Memleak fix in PolygonizeGraph +- Memleak fix in OverlayOp +- Compiler warnings removal +- Cleaner w32 build +- Z interpolation in overlay operations +- Debian package build scripts + + +Changes in 2.1.0 + +- Added Polygonizer and LineMerger classes. +- python wrapper examples +- General cleanup / warnings removal +- cleaner win32 / older copilers builds +- Reduced heap allocations +- debian package builder scripts +- reduction of standard C lib headers dependency +- Z support in overlay operations. + + +Changes in 2.0.0 + +- CoordinateList renamed to CoordinateSequence, BasicCoordinateList + renamed to DefaultCoordinateSequence to reflect JTS changes. + DefaultCoordinateSequenceFactory and CoordinateSequenceFactory + got same interface as JTS. +- Added geos/version.h defining versioning infos +- Added geos.h for quick inclusion. It will include geos/geom.h, + new geos/version.h, geos/util.h geos/io.h and geos/unload.h + (geometry input/output, exceptions, operations). +- Added a geos::version() function showing GEOS and equivalent + JTS versions as strings. +- All geometry constructors take ownership of given arguments. + GeometryFactory provides pass-by-reference geometry creators + to take care of a deep-copy. +- GeometryFactory::createMultiPoint(const CoordinateList *) + has been renamed to + GeometryFactory::createMultiPoint(const CoordinateList &) + to reflect copy semantic +- GeometryFactory: EMPTY geometry creation do now have their + own constructors taking no arguments. +- Geometry constructors taking PrecisionModel and SRID have + been dropped. You have to use GeometryFactory instead. +- WKTWriter default constructor has been dropped. You need + to initialize it with an explicit GeometryFactory + diff --git a/README.md b/README.md new file mode 100644 index 0000000..71157ad --- /dev/null +++ b/README.md @@ -0,0 +1,122 @@ +GEOS -- Geometry Engine, Open Source +==================================== + +GEOS is a C++11 library for performing operations on two-dimensional vector +geometries. It is primarily a port of the [JTS Topology +Suite](https://github.com/locationtech/jts) Java library. It provides many of +the algorithms used by [PostGIS](http://www.postgis.net/), the +[Shapely](https://pypi.org/project/Shapely/) package for Python, the +[sf](https://github.com/r-spatial/sf) package for R, and others. + +More information is available the [project homepage](https://trac.osgeo.org/geos). + +## Build status + +| Branch | Debbie | Winnie | Dronie | Travis CI | GitLab CI | AppVeyor | +|:--- |:--- |:--- |:--- |:--- |:--- |:--- | +| 3.8 | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Branch_3.8)](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.8/) | [![winnie](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.8/badge/icon)](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.8/) | [![dronie](https://dronie.osgeo.org/api/badges/geos/geos/status.svg?branch=3.8)](https://dronie.osgeo.org/geos/geos?branch=3.8) | [![travis](https://travis-ci.com/libgeos/geos.svg?branch=3.8)](https://travis-ci.com/libgeos/geos?branch=3.8) | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/svn-3.8/build.svg)](https://gitlab.com/geos/libgeos/commits/3.8) | [![appveyor](https://ci.appveyor.com/api/projects/status/62aplwst722b89au/branch/3.8?svg=true)](https://ci.appveyor.com/project/dbaston/geos/branch/3.8) | + + +## Build/install + +See [INSTALL](./INSTALL) file + +## Client applications + +### Using the C interface + +GEOS promises long-term stability of the C API. In general, successive releases +of the C API may add new functions but will not remove or change existing types +or function signatures. The C library uses the C++ interface, but the C library +follows normal ABI-change-sensitive versioning, so programs that link only +against the C library should work without relinking when GEOS is upgraded. For +this reason, it is recommended to use the C API for software that is intended +to be dynamically linked to a system install of GEOS. + +The `geos-config` program can be used to determine appropriate compiler and +linker flags for building against the C library: + + CFLAGS += `geos-config --cflags` + LDFLAGS += `geos-config --ldflags` -lgeos_c + +All functionality of the C API is available through the `geos_c.h` header file. + +Documentation for the C API is provided via comments in the `geos_c.h` header +file. C API usage examples can be found in the GEOS unit tests and in the +source code of software that uses GEOS, such as PostGIS and the sf package +for R. + +### Using the C++ interface + +The C++ interface to GEOS provides a more natural API for C++ programs, as well +as additional functionality that has not been exposed in the C API. However, +developers who decide to use the C++ interface should be aware that GEOS does +not promise API or ABI stability of the C++ API between releases. Breaking +changes in the C++ API/ABI are not typically announced or included in the NEWS +file. + +The C++ library name will change on every minor release. + +The `geos-config` program can be used to determine appropriate compiler and +linker flags for building against the C++ library: + + CFLAGS += `geos-config --cflags` + LDFLAGS += `geos-config --ldflags` -lgeos + +A compiler warning may be issued when building against the C++ library. To +remove the compiler warning, define `USE_UNSTABLE_GEOS_CPP_API` somewhere +in the program. + +Commonly-used functionality of GEOS is available in the `geos.h` header file. +Less-common functionality can be accessed by including headers for individual +classes, e.g. `#include `. + + #include + +Documentation for the C++ API is available at https://geos.osgeo.org/doxygen/, +and basic C++ usage examples can be found in `doc/example.cpp`. + + +### Scripting language bindings + +#### Ruby + +Ruby bindings are part of GEOS. To build, use the `--enable-ruby` option +when configuring: + + ./configure .. --enable-ruby + +#### PHP + +PHP bindings for GEOS are available separately from +[php-geos](https://git.osgeo.org/gitea/geos/php-geos). + +#### Python + +Python bindings are available via: + + 1. [Shapely](http://pypi.python.org/pypi/Shapely) package. + 2. Calling functions from `libgeos_c` via Python ctypes. + + +## Documentation + +Doxygen documentation can be generated using either the autotools or CMake build +systems. + +### Using Autotools: + + cd doc + make doxygen-html + +### Using CMake: + + cmake -DBUILD_DOCUMENTATION=YES + make docs + +## Style + +To format your code into the desired style, use the astyle +version included in source tree: + + tools/astyle.sh diff --git a/Version.txt b/Version.txt new file mode 100644 index 0000000..8a4aff4 --- /dev/null +++ b/Version.txt @@ -0,0 +1,22 @@ + +# GEOS Versions +GEOS_VERSION_MAJOR=3 +GEOS_VERSION_MINOR=8 +GEOS_VERSION_PATCH=1 + +# OPTIONS: "", "dev", "rc1" etc. +GEOS_PATCH_WORD= + +# GEOS CAPI Versions +# +# Always increase the revision value. +# Increase the current value whenever an interface has been +# added, removed or changed. +# Increase the age value only if the changes made to the ABI +# are backward compatible. +CAPI_INTERFACE_CURRENT=14 +CAPI_INTERFACE_REVISION=3 +CAPI_INTERFACE_AGE=13 + +# JTS Port +JTS_PORT=1.13.0 diff --git a/acsite.m4 b/acsite.m4 new file mode 100644 index 0000000..2b8d2df --- /dev/null +++ b/acsite.m4 @@ -0,0 +1,55 @@ +# This has been taken from postgres-9.1+ local macros +# ( REL9_1_BETA2-1484-g293ec33 ) + +# PGAC_TYPE_64BIT_INT(TYPE) +# ------------------------- +# Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to +# yes or no respectively, and define HAVE_TYPE_64 if yes. +AC_DEFUN([PGAC_TYPE_64BIT_INT], +[define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl +define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl +AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar], +[AC_TRY_RUN( +[typedef $1 ac_int64; + +/* + * These are globals to discourage the compiler from folding all the + * arithmetic tests down to compile-time constants. + */ +ac_int64 a = 20000001; +ac_int64 b = 40000005; + +int does_int64_work() +{ + ac_int64 c,d; + + if (sizeof(ac_int64) != 8) + return 0; /* definitely not the right size */ + + /* Do perfunctory checks to see if 64-bit arithmetic seems to work */ + c = a * b; + d = (c + b) / b; + if (d != a+1) + return 0; + return 1; +} +main() { + if (does_int64_work()) + exit(0); + exit(-1); +}], +[Ac_cachevar=yes], +[Ac_cachevar=no], +[# If cross-compiling, check the size reported by the compiler and +# trust that the arithmetic works. +AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [sizeof($1) == 8])], + Ac_cachevar=yes, + Ac_cachevar=no)])]) + +Ac_define=$Ac_cachevar +if test x"$Ac_cachevar" = xyes ; then + AC_DEFINE(Ac_define, 1, [Define to 1 if `]$1[' works and is 64 bits.]) +fi +undefine([Ac_define])dnl +undefine([Ac_cachevar])dnl +])# PGAC_TYPE_64BIT_INT diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..8d61646 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,81 @@ +version: 1.0.{build} + +image: Visual Studio 2017 + +platform: x64 + +configuration: Release + +shallow_clone: true +clone_depth: 5 + +matrix: + fast_finish: false # set this flag to immediately finish build once one of the jobs fails. + +environment: + matrix: + - PLATFORM: x64 + BUILDER: CMake + GENERATOR: "Visual Studio 15 2017 Win64" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 +# - PLATFORM: x86 +# BUILDER: CMake +# GENERATOR: "Visual Studio 15 2017" +# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 +# - PLATFORM: x64 +# BUILDER: CMake +# GENERATOR: "NMake Makefiles" +# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 +# - PLATFORM: x86 +# BUILDER: CMake +# GENERATOR: "NMake Makefiles" +# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 +# - PLATFORM: x64 +# BUILDER: CMake +# GENERATOR: "Visual Studio 14 2015 Win64" +# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 +# - PLATFORM: x86 +# BUILDER: CMake +# GENERATOR: "Visual Studio 14 2015" +# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 +# - PLATFORM: x64 +# BUILDER: CMake +# GENERATOR: "NMake Makefiles" +# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - PLATFORM: x86 + BUILDER: CMake + GENERATOR: "NMake Makefiles" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + +init: + - ps: 'Write-Host "Building GEOS branch: $env:APPVEYOR_REPO_BRANCH" -ForegroundColor Magenta' + #- ps: | + # Write-Host "Build worker environment variables:" -ForegroundColor Magenta + # Get-ChildItem Env: | %{"{0}={1}" -f $_.Name,$_.Value} + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x86" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 + - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" if "%GENERATOR%"=="NMake Makefiles" if "%PLATFORM%"=="x64" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 + +before_build: + - ps: 'Write-Host "Running $env:BUILDER with $env:GENERATOR" -ForegroundColor Magenta' + - if "%BUILDER%"=="CMake" cmake.exe -G "%GENERATOR%" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER% + - if "%BUILDER%"=="NMake" .\autogen.bat + +build_script: + - ps: 'Write-Host "Running $env:BUILDER:" -ForegroundColor Magenta' + - if "%BUILDER%"=="CMake" cmake --build . --config %CONFIGURATION% + - if "%BUILDER%"=="NMake" nmake /f makefile.vc + +test_script: + - ps: 'Write-Host "Running tests:" -ForegroundColor Magenta' + - if "%BUILDER%"=="CMake" ctest --output-on-failure -C %CONFIGURATION% + - if "%BUILDER%"=="NMake" echo *** NMake does NOT build tests *** + +# If you need to debug AppVeyor session (https://www.appveyor.com/docs/how-to/rdp-to-build-worker), then: +# 1. Uncomment the on_finish section below: +#on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +# 2. Add this line to the init section below +#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..b2950c1 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# +# +# GEOS Bootstrapping Script +# +giveup() +{ + echo + echo " Something went wrong, giving up!" + echo + exit 1 +} + +OSTYPE=`uname -s` + +AUTOCONF=`which autoconf 2>/dev/null` +if [ ! ${AUTOCONF} ]; then + echo "Missing autoconf!" + exit +fi +AUTOCONF_VER=`${AUTOCONF} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'` + +AUTOHEADER=`which autoheader 2>/dev/null` +if [ ! ${AUTOHEADER} ]; then + echo "Missing autoheader!" + exit +fi + +for aclocal in aclocal aclocal-1.10 aclocal-1.9; do + ACLOCAL=`which $aclocal 2>/dev/null` + if test -x "${ACLOCAL}"; then + break; + fi +done +if [ ! ${ACLOCAL} ]; then + echo "Missing aclocal!" + exit +fi +ACLOCAL_VER=`${ACLOCAL} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'` + +for automake in automake automake-1.10 automake-1.9; do + AUTOMAKE=`which $automake 2>/dev/null` + if test -x "${AUTOMAKE}"; then + break; + fi +done +if [ ! ${AUTOMAKE} ]; then + echo "Missing automake!" + exit +fi +AUTOMAKE_VER=`${AUTOMAKE} --version | grep -E "^.*[0-9]$" | sed 's/^.* //'` + +for libtoolize in libtoolize glibtoolize; do + LIBTOOLIZE=`which $libtoolize 2>/dev/null` + if test -x "${LIBTOOLIZE}"; then + break; + fi +done +if [ ! ${LIBTOOLIZE} ]; then + echo "Missing libtoolize!" + exit +fi +LIBTOOLIZE_VER=`${LIBTOOLIZE} --version | grep -E "^.*[0-9]\.[0-9]" | sed 's/^.* //'` + +AMOPTS="--add-missing --copy -Woverride" +if test "$OSTYPE" = "IRIX" -o "$OSTYPE" = "IRIX64"; then + AMOPTS=$AMOPTS" --include-deps"; +fi + +LTOPTS="--force --copy" +echo "* Running ${LIBTOOLIZE} (${LIBTOOLIZE_VER})" +echo " OPTIONS = ${LTOPTS}" +${LIBTOOLIZE} ${LTOPTS} || giveup + +echo "* Running $ACLOCAL (${ACLOCAL_VER})" +${ACLOCAL} -I macros || giveup + +echo "* Running ${AUTOHEADER} (${AUTOCONF_VER})" +${AUTOHEADER} || giveup + +echo "* Running ${AUTOMAKE} (${AUTOMAKE_VER})" +echo " OPTIONS = ${AMOPTS}" +${AUTOMAKE} ${AMOPTS} || giveup + +echo "* Running ${AUTOCONF} (${AUTOCONF_VER})" +${AUTOCONF} || giveup + +if test -f "${PWD}/configure"; then + echo "======================================" + echo "Now you are ready to run './configure'" + echo "======================================" +else + echo " Failed to generate ./configure script!" + giveup +fi + diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt new file mode 100644 index 0000000..a7a74a8 --- /dev/null +++ b/benchmarks/CMakeLists.txt @@ -0,0 +1,16 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ +add_executable(perf_class_sizes ClassSizes.cpp) +target_link_libraries(perf_class_sizes PRIVATE geos) + +add_subdirectory(algorithm) +add_subdirectory(operation) +add_subdirectory(capi) diff --git a/benchmarks/ClassSizes.cpp b/benchmarks/ClassSizes.cpp new file mode 100644 index 0000000..015be21 --- /dev/null +++ b/benchmarks/ClassSizes.cpp @@ -0,0 +1,76 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2011 Sandro Santilli + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + ********************************************************************** + * + * - Monitor class sizes + * + **********************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace geos; + +#define check(x) \ + { cout << "Size of " << #x << " is " << sizeof(x) << endl; } + +int +main() +{ + check(geomgraph::Depth); + check(geomgraph::DirectedEdge); + check(geomgraph::DirectedEdgeStar); + check(geomgraph::Edge); + check(geomgraph::EdgeEnd); + check(geomgraph::PlanarGraph); + check(geomgraph::TopologyLocation); + check(geomgraph::index::SweepLineEvent); + check(noding::NodedSegmentString); + check(geom::Geometry); + check(geom::Point); + check(geom::LineString); + check(geom::LinearRing); + check(geom::Polygon); + check(geom::GeometryCollection); + check(geom::MultiPoint); + check(geom::MultiLineString); + check(geom::MultiPolygon); + check(geom::CoordinateArraySequence); + check(geom::FixedSizeCoordinateSequence<1>); + check(geom::FixedSizeCoordinateSequence<2>); + check(int64); +} + diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am new file mode 100644 index 0000000..82f124d --- /dev/null +++ b/benchmarks/Makefile.am @@ -0,0 +1,17 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +SUBDIRS = \ + algorithm \ + operation \ + capi + +LIBS = $(top_builddir)/src/libgeos.la + +AM_CPPFLAGS = -I$(top_srcdir)/include + +noinst_PROGRAMS = ClassSizes + +ClassSizes_SOURCES = ClassSizes.cpp + +EXTRA_DIST = CMakeLists.txt diff --git a/benchmarks/algorithm/CMakeLists.txt b/benchmarks/algorithm/CMakeLists.txt new file mode 100644 index 0000000..c1ccdaa --- /dev/null +++ b/benchmarks/algorithm/CMakeLists.txt @@ -0,0 +1,20 @@ +################################################################################# +# +# CMake configuration for GEOS benchmarks/operation/predicate tests +# +# Copyright (C) 2017 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +# +################################################################################# +add_executable(perf_interiorpoint_area InteriorPointAreaPerfTest.cpp) +target_link_libraries(perf_interiorpoint_area geos) + +add_executable(perf_voronoi VoronoiPerfTest.cpp) +target_link_libraries(perf_voronoi geos) + +add_executable(perf_unaryunion_segments UnaryUnionSegmentsPerfTest.cpp) +target_link_libraries(perf_unaryunion_segments geos) diff --git a/benchmarks/algorithm/InteriorPointAreaPerfTest.cpp b/benchmarks/algorithm/InteriorPointAreaPerfTest.cpp new file mode 100644 index 0000000..9d47ba1 --- /dev/null +++ b/benchmarks/algorithm/InteriorPointAreaPerfTest.cpp @@ -0,0 +1,138 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2011 Sandro Santilli + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + ********************************************************************** + * + * Last port: perf/operation/predicate/RectangleIntersectsPerfTest.java r378 (JTS-1.12) + * + **********************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace geos::geom; +using namespace geos::io; +using namespace std; + +class InteriorPointAreaPerfTest { +public: + InteriorPointAreaPerfTest() + : + pm(), + fact(GeometryFactory::create(&pm, 0)) + { + showHeader(); + } + + void + test(int nPts) + { + Coordinate origin(ORG_X, ORG_Y); + std::unique_ptr sinePoly = + createSineStar(origin, SIZE, nPts); + + /** + * Make the geometry "crinkly" by rounding off the points. + * This defeats the MonotoneChain optimization in the full relate + * algorithm, and provides a more realistic test. + */ + using geos::precision::SimpleGeometryPrecisionReducer; + double scale = nPts / SIZE; + PrecisionModel p_pm(scale); + SimpleGeometryPrecisionReducer reducer(&p_pm); + std::unique_ptr sinePolyCrinkly(reducer.reduce(sinePoly.get())); + sinePoly.reset(); + + //cout << sinePolyCrinkly->toText() << endl; + + test(*sinePolyCrinkly); + } + + const double ORG_X = 100.0; + const double ORG_Y = 100.0; + const double SIZE = 100.0; + const int N_ARMS = 20; + const double ARM_RATIO = 0.3; + const int N_ITER = 100; + +private: + PrecisionModel pm; + GeometryFactory::Ptr fact; + + void + showHeader() { + cout << "Interior Point Area perf test" << endl; + cout << "# Iterations: " << N_ITER << endl; + cout << "SineStar: origin: (" + << ORG_X << ", " << ORG_Y + << ") size: " << SIZE + << " # arms: " << N_ARMS + << " arm ratio: " << ARM_RATIO + << endl; + } + + void + test(geos::geom::Geometry& poly) + { + geos::util::Profile sw(""); + sw.start(); + + for(int i = 0; i < N_ITER; i++) { + std::unique_ptr pt( poly.getInteriorPoint() ); + } + + sw.stop(); + cout << poly.getNumPoints() << " points: " << sw.getTotFormatted() << endl; + } + + std::unique_ptr + createSineStar(const Coordinate& origin, + double size, int nPts) + { + using geos::geom::util::SineStarFactory; + + SineStarFactory gsf(fact.get()); + gsf.setCentre(origin); + gsf.setSize(size); + gsf.setNumPoints(nPts); + gsf.setArmLengthRatio( ARM_RATIO ); + gsf.setNumArms( N_ARMS ); + std::unique_ptr poly = gsf.createSineStar(); + return poly; + } +}; + +int +main() +{ + InteriorPointAreaPerfTest tester; + + tester.test(100); + tester.test(1000); + tester.test(10000); + tester.test(100000); + tester.test(1000000); +} + diff --git a/benchmarks/algorithm/Makefile.am b/benchmarks/algorithm/Makefile.am new file mode 100644 index 0000000..226f3d8 --- /dev/null +++ b/benchmarks/algorithm/Makefile.am @@ -0,0 +1,25 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +prefix=@prefix@ +top_srcdir=@top_srcdir@ +top_builddir=@top_builddir@ + +noinst_PROGRAMS = \ + InteriorPointAreaPerfTest \ + VoronoiPerfTest \ + UnaryUnionSegmentsPerfTest + +InteriorPointAreaPerfTest_SOURCES = InteriorPointAreaPerfTest.cpp +InteriorPointAreaPerfTest_LDADD = $(top_builddir)/src/libgeos.la + +VoronoiPerfTest_SOURCES = VoronoiPerfTest.cpp +VoronoiPerfTest_LDADD = $(top_builddir)/src/libgeos.la + +UnaryUnionSegmentsPerfTest_SOURCES = UnaryUnionSegmentsPerfTest.cpp +UnaryUnionSegmentsPerfTest_LDADD = $(top_builddir)/src/libgeos.la + +AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/src/io/markup + +EXTRA_DIST = CMakeLists.txt diff --git a/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp b/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp new file mode 100644 index 0000000..f86f0c6 --- /dev/null +++ b/benchmarks/algorithm/UnaryUnionSegmentsPerfTest.cpp @@ -0,0 +1,71 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2019 Daniel Baston + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class SegmentUnaryUnionPerfTest { + +public: + void test(size_t num_lines) { + using namespace geos::geom; + + std::default_random_engine e(12345); + std::uniform_real_distribution<> dis(0, 100); + + + std::vector> lines; + + for (size_t i = 0; i < num_lines; i++) { + CoordinateArraySequence cas(2, 2); + cas.setAt(Coordinate(dis(e), dis(e)), 0); + cas.setAt(Coordinate(dis(e), dis(e)), 1); + + lines.emplace_back(gfact->createLineString(std::move(cas))); + } + + auto g = gfact->createMultiLineString(std::move(lines)); + + auto sw = profiler->get("union"); + sw->start(); + + g->Union(); + + sw->stop(); + + std::cout << *sw << std::endl; + } +private: + decltype(geos::geom::GeometryFactory::create()) gfact = geos::geom::GeometryFactory::create(); + geos::util::Profiler* profiler = geos::util::Profiler::instance(); +}; + +int main(int argc, char** argv) { + SegmentUnaryUnionPerfTest tester; + + auto num_lines = std::atol(argv[1]); + auto num_reps = argc > 2 ? std::atol(argv[2]) : 1; + + for (int i = 0; i < num_reps; i++) { + tester.test(num_lines); + } +} \ No newline at end of file diff --git a/benchmarks/algorithm/VoronoiPerfTest.cpp b/benchmarks/algorithm/VoronoiPerfTest.cpp new file mode 100644 index 0000000..df90128 --- /dev/null +++ b/benchmarks/algorithm/VoronoiPerfTest.cpp @@ -0,0 +1,92 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2019 Daniel Baston + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class VoronoiPerfTest { + +public: + void test(size_t num_points) { + using namespace geos::geom; + + std::default_random_engine e(12345); + std::uniform_real_distribution<> dis(0, 100); + + std::unique_ptr> coords(new std::vector(num_points)); + std::generate(coords->begin(), coords->end(), [&dis, &e]() { + return Coordinate(dis(e), dis(e)); + }); + CoordinateArraySequence seq(coords.release()); + auto geom = gfact->createLineString(seq.clone()); + + voronoi(seq); + voronoi(*geom); + + delaunay(seq); + delaunay(*geom); + + std::cout << std::endl; + } +private: + decltype(geos::geom::GeometryFactory::create()) gfact = geos::geom::GeometryFactory::create(); + geos::util::Profiler* profiler = geos::util::Profiler::instance(); + + template + void voronoi(const T & sites) { + auto sw = profiler->get(std::string("Voronoi from ") + typeid(T).name()); + sw->start(); + + geos::triangulate::VoronoiDiagramBuilder vdb; + vdb.setSites(sites); + + auto result = vdb.getDiagram(*gfact); + + sw->stop(); + std::cout << sw->name << ": " << result->getNumGeometries() << ": " << *sw << std::endl; + } + + template + void delaunay(const T & seq) { + auto sw = profiler->get(std::string("Delaunay from ") + typeid(T).name()); + sw->start(); + + geos::triangulate::DelaunayTriangulationBuilder dtb; + dtb.setSites(seq); + + auto result = dtb.getTriangles(*gfact); + + sw->stop(); + std::cout << sw->name << ": " << result->getNumGeometries() << ": " << *sw << std::endl; + } +}; + +int main() { + VoronoiPerfTest tester; + + //tester.test(100); + //tester.test(1000); + //tester.test(10000); + for (auto i = 0; i < 5; i++) { + tester.test(100000); + } +} \ No newline at end of file diff --git a/benchmarks/capi/CMakeLists.txt b/benchmarks/capi/CMakeLists.txt new file mode 100644 index 0000000..5f37deb --- /dev/null +++ b/benchmarks/capi/CMakeLists.txt @@ -0,0 +1,24 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ +add_executable(perf_memleak_mp_prep memleak_mp_prep.c) +# test_perf_memleak_mp_prep is not dependant against geos target, +# but geos_c only, so need explicit include directories. +target_include_directories(perf_memleak_mp_prep + PUBLIC + $ + $) +target_link_libraries(perf_memleak_mp_prep PRIVATE geos_c) + +add_executable(perf_geospreparedcontains GEOSPreparedContainsPerfTest.cpp) +target_link_libraries(perf_geospreparedcontains PRIVATE geos geos_c) + +add_executable(perf_intersection IntersectionPerfTest.cpp) +target_link_libraries(perf_intersection PRIVATE geos geos_c) diff --git a/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp b/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp new file mode 100644 index 0000000..f010948 --- /dev/null +++ b/benchmarks/capi/GEOSPreparedContainsPerfTest.cpp @@ -0,0 +1,111 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2019 Daniel Baston + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +class GEOSPreparedContainsPerfTest { + +public: + void test(const GEOSGeometry* g, size_t num_points) { + using namespace geos::geom; + + double xmin, xmax, ymin, ymax; + + GEOSGeom_getXMin(g, &xmin); + GEOSGeom_getXMax(g, &xmax); + GEOSGeom_getYMin(g, &ymin); + GEOSGeom_getYMax(g, &ymax); + + std::default_random_engine e(12345); + std::uniform_real_distribution<> xdist(xmin, xmax); + std::uniform_real_distribution<> ydist(ymin, ymax); + + std::vector coords(num_points); + std::generate(coords.begin(), coords.end(), [&xdist, &ydist, &e]() { + return Coordinate(xdist(e), ydist(e)); + }); + + geos::util::Profile sw("GEOSPreparedContains"); + sw.start(); + + size_t hits = 0; + auto prep = GEOSPrepare(g); + for (const auto& c : coords) { + auto pt = GEOSGeom_createPointFromXY(c.x, c.y); + + if (GEOSPreparedContains(prep, pt)) { + hits++; + } + + GEOSGeom_destroy(pt); + } + + GEOSPreparedGeom_destroy(prep); + + sw.stop(); + + std::cout << sw.name << ": " << hits << " hits from " << num_points << " points in " << sw.getTotFormatted() << std::endl; + + } +}; + +int main(int argc, char** argv) { + if (argc != 3) { + std::cout << "perf_geospreparedcontins performs a specified number of point-in-polygon tests" << std::endl; + std::cout << "on randomly generated points from the bounding box of a single geometry provided" << std::endl; + std::cout << "in a file as WKT." << std::endl; + std::cout << std::endl; + std::cout << "Usage: perf_geospreparedcontins [wktfile] [n]" << std::endl; + return 0; + } + + GEOSPreparedContainsPerfTest tester; + + int n = std::atoi(argv[2]); + std::cout << "Performing " << n << " point-in-polygon tests." << std::endl; + + std::string fname{argv[1]}; + std::cout << "Reading shape from " << fname << std::endl; + + std::ifstream f(fname); + std::stringstream buff; + buff << f.rdbuf(); + f.close(); + + std::string wkt = buff.str(); + buff.clear(); + + initGEOS(nullptr, nullptr); + GEOSGeometry* g = GEOSGeomFromWKT(wkt.c_str()); + wkt.clear(); + + tester.test(g, n); + + GEOSGeom_destroy(g); +} diff --git a/benchmarks/capi/IntersectionPerfTest.cpp b/benchmarks/capi/IntersectionPerfTest.cpp new file mode 100644 index 0000000..3617fbe --- /dev/null +++ b/benchmarks/capi/IntersectionPerfTest.cpp @@ -0,0 +1,87 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2019 Daniel Baston + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + **********************************************************************/ + +#include +#include + +#include +#include +#include + +int main(int argc, char** argv) { + if (argc != 2 && argc != 3) { + std::cout << "perf_intersection reads geometries from a WKT file and" << std::endl; + std::cout << "inserts them into an STR-tree. For each input geometry, it" << std::endl; + std::cout << "queries the tree to find all intersecting geometries and" << std::endl; + std::cout << "then computes their intersection." << std::endl; + std::cout << std::endl; + std::cout << "Usage: perf_intersection [wktfile] [n]" << std::endl; + return 0; + } + + initGEOS(nullptr, nullptr); + + std::string fname{argv[1]}; + + long max_geoms; + if (argc == 3) { + max_geoms = std::atol(argv[2]); + std::cout << "Reading up to " << max_geoms << " geometries from " << fname << std::endl; + } else { + std::cout << "Reading geometries from " << fname << std::endl; + max_geoms = -1; + } + + std::vector geoms; + + std::ifstream f(fname); + std::string line; + long i = 0; + while(std::getline(f, line) && i < max_geoms) { + geoms.push_back(GEOSGeomFromWKT(line.c_str())); + i++; + } + f.close(); + + std::cout << "Read " << geoms.size() << " geometries." << std::endl; + + GEOSSTRtree* tree = GEOSSTRtree_create(10); + + for (const auto& g : geoms) { + GEOSSTRtree_insert(tree, g, g); + } + + geos::util::Profile sw("Intersection"); + sw.start(); + + for (const auto& g : geoms) { + GEOSSTRtree_query(tree, g, [](void* g2v, void* g1v) { + GEOSGeometry* g1 = (GEOSGeometry*) g1v; + GEOSGeometry* g2 = (GEOSGeometry*) g2v; + if (GEOSIntersects(g1, g2) == 1) { + GEOSGeometry* g3 = GEOSIntersection(g1, g2); + GEOSGeom_destroy(g3); + } + }, g); + } + + sw.stop(); + std::cout << sw.getTotFormatted() << std::endl; + + GEOSSTRtree_destroy(tree); + + for (auto& g : geoms) { + GEOSGeom_destroy(g); + } +} diff --git a/benchmarks/capi/Makefile.am b/benchmarks/capi/Makefile.am new file mode 100644 index 0000000..4c3618e --- /dev/null +++ b/benchmarks/capi/Makefile.am @@ -0,0 +1,26 @@ +# +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +prefix=@prefix@ +top_srcdir=@top_srcdir@ +top_builddir=@top_builddir@ + +check_PROGRAMS = \ + memleak_mp_prep \ + GEOSPreparedContainsPerfTest \ + IntersectionPerfTest + +LIBS = $(top_builddir)/capi/libgeos_c.la +AM_CPPFLAGS = -I$(top_builddir)/capi -I$(top_srcdir)/include + +memleak_mp_prep_SOURCES = memleak_mp_prep.c +memleak_mp_prep_LDADD = $(LIBS) + +GEOSPreparedContainsPerfTest_SOURCES = GEOSPreparedContainsPerfTest.cpp +GEOSPreparedContainsPerfTest_LDADD = $(top_builddir)/src/libgeos.la + +IntersectionPerfTest_SOURCES = IntersectionPerfTest.cpp +IntersectionPerfTest_LDADD = $(top_builddir)/src/libgeos.la + +EXTRA_DIST = CMakeLists.txt diff --git a/benchmarks/capi/memleak_mp_prep.c b/benchmarks/capi/memleak_mp_prep.c new file mode 100644 index 0000000..27f8dca --- /dev/null +++ b/benchmarks/capi/memleak_mp_prep.c @@ -0,0 +1,42 @@ +#include +#include +#include "geos_c.h" + +int main(void) { + GEOSWKTReader *reader; + GEOSGeometry *mp; + GEOSGeometry *p; + const GEOSPreparedGeometry *prep_mp; + unsigned long int i; + unsigned long int count = 1e6; + + initGEOS(NULL, NULL); + + reader = GEOSWKTReader_create(); + + mp = GEOSWKTReader_read(reader, + "MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))"); + + p = GEOSWKTReader_read(reader, + "POLYGON((2 2, 6 2, 6 6, 2 6, 2 2))"); + + assert(GEOSisValid(mp)); + assert(GEOSisValid(p)); + + prep_mp = GEOSPrepare(mp); + + for (i=0; i +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ +add_subdirectory(buffer) +add_subdirectory(predicate) diff --git a/benchmarks/operation/Makefile.am b/benchmarks/operation/Makefile.am new file mode 100644 index 0000000..36ff948 --- /dev/null +++ b/benchmarks/operation/Makefile.am @@ -0,0 +1,9 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +SUBDIRS = \ + buffer \ + predicate + +EXTRA_DIST = CMakeLists.txt + diff --git a/benchmarks/operation/buffer/CMakeLists.txt b/benchmarks/operation/buffer/CMakeLists.txt new file mode 100644 index 0000000..abc0e03 --- /dev/null +++ b/benchmarks/operation/buffer/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ +add_executable(perf_iterated_buffer IteratedBufferStressTest.cpp) +target_link_libraries(perf_iterated_buffer PRIVATE geos) diff --git a/benchmarks/operation/buffer/IteratedBufferStressTest.cpp b/benchmarks/operation/buffer/IteratedBufferStressTest.cpp new file mode 100644 index 0000000..52910f3 --- /dev/null +++ b/benchmarks/operation/buffer/IteratedBufferStressTest.cpp @@ -0,0 +1,90 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2009 Sandro Santilli + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + ********************************************************************** + * + * Last port: perf/operation/buffer/IteratedBufferStressTest.java rev 1.1 + * + * - Added exit condition when number of vertices is zero + * + **********************************************************************/ + + +#include +#include +#include +#include +#include +#include + +using namespace geos::geom; +using namespace geos::io; +using namespace std; + +typedef unique_ptr GeomPtr; + +GeomPtr +doBuffer(const Geometry& g, double dist) +{ + cout << "Buffering with dist = " << dist << endl; + GeomPtr buf(g.buffer(dist)); + cout << "Buffer result has " << buf->getNumPoints() << " vertices" << endl; + +//cout << *buf << endl; + + return buf; +} + +// throws Exception +void +run(const Geometry* base) +{ + GeomPtr tmp; + + // profile here + geos::util::Profile totalSW("buffer"); + double dist = 1.0; + while(true) { + + totalSW.start(); + + GeomPtr b1 = doBuffer(*base, dist); + GeomPtr b2 = doBuffer(*b1, -dist); + + totalSW.stop(); + cout << "---------------------- " + << totalSW << endl; // totalSW.getTimeString() << endl; + + dist += 1; + base = b2.get(); + tmp = std::move(b2); // move as anti-optimisation? + + if(! base->getNumPoints()) { + break; + } + } +} + +int +main() +{ + PrecisionModel pm; + GeometryFactory::Ptr gf = GeometryFactory::create(&pm); + WKTReader rdr(gf.get()); + + string inputWKT = + "POLYGON ((110 320, 190 220, 60 200, 180 120, 120 40, 290 150, 410 40, 410 230, 500 340, 320 310, 260 370, 220 310, 110 320), (220 260, 250 180, 290 220, 360 150, 350 250, 260 280, 220 260))"; + + GeomPtr base(rdr.read(inputWKT)); + run(base.get()); +} + diff --git a/benchmarks/operation/buffer/Makefile.am b/benchmarks/operation/buffer/Makefile.am new file mode 100644 index 0000000..f270b5f --- /dev/null +++ b/benchmarks/operation/buffer/Makefile.am @@ -0,0 +1,17 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +prefix=@prefix@ +top_srcdir=@top_srcdir@ +top_builddir=@top_builddir@ + +noinst_PROGRAMS = IteratedBufferStressTest + +LIBS = $(top_builddir)/src/libgeos.la + +IteratedBufferStressTest_SOURCES = IteratedBufferStressTest.cpp +IteratedBufferStressTest_LDADD = $(LIBS) + +AM_CPPFLAGS = -I$(top_srcdir)/include + +EXTRA_DIST = CMakeLists.txt diff --git a/benchmarks/operation/predicate/CMakeLists.txt b/benchmarks/operation/predicate/CMakeLists.txt new file mode 100644 index 0000000..1ead38f --- /dev/null +++ b/benchmarks/operation/predicate/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ +add_executable(perf_rectangle_intersects RectangleIntersectsPerfTest.cpp) +target_link_libraries(perf_rectangle_intersects PRIVATE geos) diff --git a/benchmarks/operation/predicate/Makefile.am b/benchmarks/operation/predicate/Makefile.am new file mode 100644 index 0000000..621456e --- /dev/null +++ b/benchmarks/operation/predicate/Makefile.am @@ -0,0 +1,17 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +prefix=@prefix@ +top_srcdir=@top_srcdir@ +top_builddir=@top_builddir@ + +noinst_PROGRAMS = RectangleIntersectsPerfTest + +LIBS = $(top_builddir)/src/libgeos.la + +RectangleIntersectsPerfTest_SOURCES = RectangleIntersectsPerfTest.cpp +RectangleIntersectsPerfTest_LDADD = $(LIBS) + +AM_CPPFLAGS = -I$(top_srcdir)/include + +EXTRA_DIST = CMakeLists.txt diff --git a/benchmarks/operation/predicate/RectangleIntersectsPerfTest.cpp b/benchmarks/operation/predicate/RectangleIntersectsPerfTest.cpp new file mode 100644 index 0000000..9ff3b31 --- /dev/null +++ b/benchmarks/operation/predicate/RectangleIntersectsPerfTest.cpp @@ -0,0 +1,164 @@ +/********************************************************************** + * + * GEOS - Geometry Engine Open Source + * http://geos.osgeo.org + * + * Copyright (C) 2011 Sandro Santilli + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + ********************************************************************** + * + * Last port: perf/operation/predicate/RectangleIntersectsPerfTest.java r378 (JTS-1.12) + * + **********************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace geos::geom; +using namespace geos::io; +using namespace std; + +class RectangleIntersectsPerfTest { +public: + RectangleIntersectsPerfTest() + : + pm(), + fact(GeometryFactory::create(&pm, 0)) + {} + + void + test(int nPts) + { + double size = 100; + Coordinate origin(0, 0); + Geometry::Ptr sinePoly( + createSineStar(origin, size, nPts)->getBoundary() + ); + + /** + * Make the geometry "crinkly" by rounding off the points. + * This defeats the MonotoneChain optimization in the full relate + * algorithm, and provides a more realistic test. + */ + using geos::precision::SimpleGeometryPrecisionReducer; + PrecisionModel p_pm(size / 10); + SimpleGeometryPrecisionReducer reducer(&p_pm); + Geometry::Ptr sinePolyCrinkly(reducer.reduce(sinePoly.get())); + sinePoly.reset(); + + Geometry& target = *sinePolyCrinkly; + + testRectangles(target, 30, 5); + } + + +private: + + static const int MAX_ITER = 10; + + static const int NUM_AOI_PTS = 2000; + static const int NUM_LINES = 5000; + static const int NUM_LINE_PTS = 1000; + + PrecisionModel pm; + GeometryFactory::Ptr fact; + + void + testRectangles(const Geometry& target, int nRect, double rectSize) + { + vector rects; + createRectangles(*target.getEnvelopeInternal(), nRect, rectSize, rects); + test(rects, target); + for(vector::iterator i = rects.begin(), n = rects.end(); + i != n; ++i) { + delete *i; + } + } + + void + test(vector& rect, const Geometry& g) + { + typedef vector::size_type size_type; + + geos::util::Profile sw(""); + sw.start(); + + for(int i = 0; i < MAX_ITER; i++) { + for(size_type j = 0; j < rect.size(); j++) { + rect[j]->intersects(&g); + } + } + + sw.stop(); + cout << g.getNumPoints() << " points: " << sw.getTot() << " usecs" << endl; + + } + + // Push newly created geoms to rectLit + void + createRectangles(const Envelope& env, int nRect, double, + vector& rectList) + { + int nSide = 1 + (int)sqrt((double) nRect); + double dx = env.getWidth() / nSide; + double dy = env.getHeight() / nSide; + + for(int i = 0; i < nSide; i++) { + for(int j = 0; j < nSide; j++) { + double baseX = env.getMinX() + i * dx; + double baseY = env.getMinY() + j * dy; + Envelope envRect( + baseX, baseX + dx, + baseY, baseY + dy); + Geometry* rect = fact->toGeometry(&envRect).release(); + rectList.push_back(rect); + } + } + } + + Polygon::Ptr + createSineStar(const Coordinate& origin, + double size, int nPts) + { + using geos::geom::util::SineStarFactory; + + SineStarFactory gsf(fact.get()); + gsf.setCentre(origin); + gsf.setSize(size); + gsf.setNumPoints(nPts); + gsf.setArmLengthRatio(2); + gsf.setNumArms(20); + Polygon::Ptr poly = gsf.createSineStar(); + return poly; + } + + +}; + +int +main() +{ + + RectangleIntersectsPerfTest tester; + + tester.test(500); + tester.test(100000); +} + diff --git a/capi/CMakeLists.txt b/capi/CMakeLists.txt new file mode 100644 index 0000000..529869d --- /dev/null +++ b/capi/CMakeLists.txt @@ -0,0 +1,36 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ + +file(GLOB_RECURSE _headers ${CMAKE_CURRENT_LIST_DIR}/*.cpp CONFIGURE_DEPEND) +target_sources(geos_c PRIVATE ${_headers}) +unset(_headers) + +target_include_directories(geos_c + PUBLIC + $ + $) + +# Copy these over so they match the @VARIABLES@ used by autoconf +# in geos_c.h.in +set(VERSION ${GEOS_VERSION}) +set(VERSION_MAJOR ${GEOS_VERSION_MAJOR}) +set(VERSION_MINOR ${GEOS_VERSION_MINOR}) +set(VERSION_PATCH ${GEOS_VERSION_PATCH}) + +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/geos_c.h.in + ${CMAKE_CURRENT_BINARY_DIR}/geos_c.h + @ONLY) + +unset(VERSION) +unset(VERSION_MAJOR) +unset(VERSION_MINOR) +unset(VERSION_PATCH) diff --git a/capi/Makefile.am b/capi/Makefile.am new file mode 100644 index 0000000..9801c25 --- /dev/null +++ b/capi/Makefile.am @@ -0,0 +1,33 @@ +# +# This file is part of project GEOS (http://trac.osgeo.org/geos/) +# +prefix=@prefix@ +top_srcdir=@top_srcdir@ +GEOS_CAPI_VERSION="@VERSION@-CAPI-@CAPI_VERSION@" +GEOS_JTS_PORT="@JTS_PORT@" + +AM_CPPFLAGS = -I$(top_srcdir)/include + +capidir = $(includedir) + +nodist_capi_HEADERS = \ + geos_c.h + +lib_LTLIBRARIES = libgeos_c.la + +DIR_SOURCES = \ + geos_c.cpp \ + geos_ts_c.cpp \ + $(NULL) + +libgeos_c_la_SOURCES = $(DIR_SOURCES) +libgeos_c_la_CPPFLAGS = $(AM_CPPFLAGS) -DGEOS_CAPI_VERSION='$(GEOS_CAPI_VERSION)' -DGEOS_JTS_PORT='$(GEOS_JTS_PORT)' +libgeos_c_la_LIBADD = $(top_builddir)/src/libgeos.la +libgeos_c_la_LDFLAGS = \ + -version-info @CAPI_INTERFACE_CURRENT@:@CAPI_INTERFACE_REVISION@:@CAPI_INTERFACE_AGE@ \ + -no-undefined + +dist-local: + cp -p $(DIST_SOURCES) Makefile.am Makefile.in $(distdir) + +EXTRA_DIST = geos_c.h CMakeLists.txt diff --git a/capi/geos_c.cpp b/capi/geos_c.cpp new file mode 100644 index 0000000..ad8584f --- /dev/null +++ b/capi/geos_c.cpp @@ -0,0 +1,1476 @@ +/************************************************************************ + * + * + * C-Wrapper for GEOS library + * + * Copyright (C) 2010 2011 Sandro Santilli + * Copyright (C) 2005-2006 Refractions Research Inc. + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + * Author: Sandro Santilli + * + ***********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4099) +#endif + +// Some extra magic to make type declarations in geos_c.h work - for cross-checking of types in header. +#define GEOSGeometry geos::geom::Geometry +#define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry +#define GEOSCoordSequence geos::geom::CoordinateSequence +#define GEOSSTRtree geos::index::strtree::STRtree +#define GEOSWKTReader_t geos::io::WKTReader +#define GEOSWKTWriter_t geos::io::WKTWriter +#define GEOSWKBReader_t geos::io::WKBReader +#define GEOSWKBWriter_t geos::io::WKBWriter +typedef struct GEOSBufParams_t GEOSBufferParams; + +#include "geos_c.h" + +/// Define this if you want operations triggering Exceptions to +/// be printed (will use the NOTIFY channel - only implemented for GEOSUnion so far) +/// +#undef VERBOSE_EXCEPTIONS + +#include + +/* +#if defined(_MSC_VER) +# define GEOS_DLL __declspec(dllexport) +#else +# define GEOS_DLL +#endif +*/ + +// import the most frequently used definitions globally +using geos::geom::Geometry; +using geos::geom::LineString; +using geos::geom::Polygon; +using geos::geom::CoordinateSequence; +using geos::geom::GeometryFactory; + +using geos::io::WKTReader; +using geos::io::WKTWriter; +using geos::io::WKBReader; +using geos::io::WKBWriter; + +using geos::index::strtree::STRtree; + +using geos::operation::overlay::OverlayOp; +using geos::operation::overlay::overlayOp; +using geos::operation::geounion::CascadedPolygonUnion; + +typedef std::unique_ptr GeomPtr; + +//## GLOBALS ################################################ + +// NOTE: SRID will have to be changed after geometry creation +GEOSContextHandle_t handle = NULL; + +extern "C" { + + void + initGEOS(GEOSMessageHandler nf, GEOSMessageHandler ef) + { + if(! handle) { + handle = initGEOS_r(nf, ef); + } + else { + GEOSContext_setNoticeHandler_r(handle, nf); + GEOSContext_setErrorHandler_r(handle, ef); + } + + geos::util::Interrupt::cancel(); + } + + void + finishGEOS() + { + if(handle != NULL) { + finishGEOS_r(handle); + handle = NULL; + } + } + + GEOSInterruptCallback* + GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb) + { + return geos::util::Interrupt::registerCallback(cb); + } + + void + GEOS_interruptRequest() + { + geos::util::Interrupt::request(); + } + + void + GEOS_interruptCancel() + { + geos::util::Interrupt::cancel(); + } + + void + GEOSFree(void* buffer) + { + GEOSFree_r(handle, buffer); + } + + /**************************************************************** + ** relate()-related functions + ** return 0 = false, 1 = true, 2 = error occured + ** + */ + char + GEOSDisjoint(const Geometry* g1, const Geometry* g2) + { + return GEOSDisjoint_r(handle, g1, g2); + } + + char + GEOSTouches(const Geometry* g1, const Geometry* g2) + { + return GEOSTouches_r(handle, g1, g2); + } + + char + GEOSIntersects(const Geometry* g1, const Geometry* g2) + { + return GEOSIntersects_r(handle, g1, g2); + } + + char + GEOSCrosses(const Geometry* g1, const Geometry* g2) + { + return GEOSCrosses_r(handle, g1, g2); + } + + char + GEOSWithin(const Geometry* g1, const Geometry* g2) + { + return GEOSWithin_r(handle, g1, g2); + } + +// call g1->contains(g2) +// returns 0 = false +// 1 = true +// 2 = error was trapped + char + GEOSContains(const Geometry* g1, const Geometry* g2) + { + return GEOSContains_r(handle, g1, g2); + } + + char + GEOSOverlaps(const Geometry* g1, const Geometry* g2) + { + return GEOSOverlaps_r(handle, g1, g2); + } + + char + GEOSCovers(const Geometry* g1, const Geometry* g2) + { + return GEOSCovers_r(handle, g1, g2); + } + + char + GEOSCoveredBy(const Geometry* g1, const Geometry* g2) + { + return GEOSCoveredBy_r(handle, g1, g2); + } + + +//------------------------------------------------------------------- +// low-level relate functions +//------------------------------------------------------------------ + + char + GEOSRelatePattern(const Geometry* g1, const Geometry* g2, const char* pat) + { + return GEOSRelatePattern_r(handle, g1, g2, pat); + } + + char + GEOSRelatePatternMatch(const char* mat, const char* pat) + { + return GEOSRelatePatternMatch_r(handle, mat, pat); + } + + char* + GEOSRelate(const Geometry* g1, const Geometry* g2) + { + return GEOSRelate_r(handle, g1, g2); + } + + char* + GEOSRelateBoundaryNodeRule(const Geometry* g1, const Geometry* g2, int bnr) + { + return GEOSRelateBoundaryNodeRule_r(handle, g1, g2, bnr); + } + + +//----------------------------------------------------------------- +// isValid +//----------------------------------------------------------------- + + + char + GEOSisValid(const Geometry* g) + { + return GEOSisValid_r(handle, g); + } + + char* + GEOSisValidReason(const Geometry* g) + { + return GEOSisValidReason_r(handle, g); + } + + char + GEOSisValidDetail(const Geometry* g, int flags, + char** reason, Geometry** location) + { + return GEOSisValidDetail_r(handle, g, flags, reason, location); + } + +//----------------------------------------------------------------- +// general purpose +//----------------------------------------------------------------- + + char + GEOSEquals(const Geometry* g1, const Geometry* g2) + { + return GEOSEquals_r(handle, g1, g2); + } + + char + GEOSEqualsExact(const Geometry* g1, const Geometry* g2, double tolerance) + { + return GEOSEqualsExact_r(handle, g1, g2, tolerance); + } + + int + GEOSDistance(const Geometry* g1, const Geometry* g2, double* dist) + { + return GEOSDistance_r(handle, g1, g2, dist); + } + + int + GEOSDistanceIndexed(const Geometry* g1, const Geometry* g2, double* dist) + { + return GEOSDistanceIndexed_r(handle, g1, g2, dist); + } + + int + GEOSHausdorffDistance(const Geometry* g1, const Geometry* g2, double* dist) + { + return GEOSHausdorffDistance_r(handle, g1, g2, dist); + } + + int + GEOSHausdorffDistanceDensify(const Geometry* g1, const Geometry* g2, double densifyFrac, double* dist) + { + return GEOSHausdorffDistanceDensify_r(handle, g1, g2, densifyFrac, dist); + } + + int + GEOSFrechetDistance(const Geometry* g1, const Geometry* g2, double* dist) + { + return GEOSFrechetDistance_r(handle, g1, g2, dist); + } + + int + GEOSFrechetDistanceDensify(const Geometry* g1, const Geometry* g2, double densifyFrac, double* dist) + { + return GEOSFrechetDistanceDensify_r(handle, g1, g2, densifyFrac, dist); + } + + int + GEOSArea(const Geometry* g, double* area) + { + return GEOSArea_r(handle, g, area); + } + + int + GEOSLength(const Geometry* g, double* length) + { + return GEOSLength_r(handle, g, length); + } + + CoordinateSequence* + GEOSNearestPoints(const Geometry* g1, const Geometry* g2) + { + return GEOSNearestPoints_r(handle, g1, g2); + } + + Geometry* + GEOSGeomFromWKT(const char* wkt) + { + return GEOSGeomFromWKT_r(handle, wkt); + } + + char* + GEOSGeomToWKT(const Geometry* g) + { + return GEOSGeomToWKT_r(handle, g); + } + +// Remember to free the result! + unsigned char* + GEOSGeomToWKB_buf(const Geometry* g, size_t* size) + { + return GEOSGeomToWKB_buf_r(handle, g, size); + } + + Geometry* + GEOSGeomFromWKB_buf(const unsigned char* wkb, size_t size) + { + return GEOSGeomFromWKB_buf_r(handle, wkb, size); + } + + /* Read/write wkb hex values. Returned geometries are + owned by the caller.*/ + unsigned char* + GEOSGeomToHEX_buf(const Geometry* g, size_t* size) + { + return GEOSGeomToHEX_buf_r(handle, g, size); + } + + Geometry* + GEOSGeomFromHEX_buf(const unsigned char* hex, size_t size) + { + return GEOSGeomFromHEX_buf_r(handle, hex, size); + } + + char + GEOSisEmpty(const Geometry* g) + { + return GEOSisEmpty_r(handle, g); + } + + char + GEOSisSimple(const Geometry* g) + { + return GEOSisSimple_r(handle, g); + } + + char + GEOSisRing(const Geometry* g) + { + return GEOSisRing_r(handle, g); + } + + + +//free the result of this + char* + GEOSGeomType(const Geometry* g) + { + return GEOSGeomType_r(handle, g); + } + +// Return postgis geometry type index + int + GEOSGeomTypeId(const Geometry* g) + { + return GEOSGeomTypeId_r(handle, g); + } + + + + +//------------------------------------------------------------------- +// GEOS functions that return geometries +//------------------------------------------------------------------- + + Geometry* + GEOSEnvelope(const Geometry* g) + { + return GEOSEnvelope_r(handle, g); + } + + Geometry* + GEOSIntersection(const Geometry* g1, const Geometry* g2) + { + return GEOSIntersection_r(handle, g1, g2); + } + + Geometry* + GEOSBuffer(const Geometry* g, double width, int quadrantsegments) + { + return GEOSBuffer_r(handle, g, width, quadrantsegments); + } + + Geometry* + GEOSBufferWithStyle(const Geometry* g, double width, int quadsegs, + int endCapStyle, int joinStyle, double mitreLimit) + { + return GEOSBufferWithStyle_r(handle, g, width, quadsegs, endCapStyle, + joinStyle, mitreLimit); + } + + Geometry* + GEOSSingleSidedBuffer(const Geometry* g, double width, int quadsegs, + int joinStyle, double mitreLimit, int leftSide) + { + return GEOSSingleSidedBuffer_r(handle, g, width, quadsegs, + joinStyle, mitreLimit, leftSide); + } + + Geometry* + GEOSOffsetCurve(const Geometry* g, double width, int quadsegs, + int joinStyle, double mitreLimit) + { + return GEOSOffsetCurve_r(handle, g, width, quadsegs, + joinStyle, mitreLimit); + } + + Geometry* + GEOSConvexHull(const Geometry* g) + { + return GEOSConvexHull_r(handle, g); + } + + Geometry* + GEOSMinimumRotatedRectangle(const Geometry* g) + { + return GEOSMinimumRotatedRectangle_r(handle, g); + } + + Geometry* + GEOSMinimumWidth(const Geometry* g) + { + return GEOSMinimumWidth_r(handle, g); + } + + Geometry* + GEOSMinimumClearanceLine(const Geometry* g) + { + return GEOSMinimumClearanceLine_r(handle, g); + } + + int + GEOSMinimumClearance(const Geometry* g, double* d) + { + return GEOSMinimumClearance_r(handle, g, d); + } + + Geometry* + GEOSDifference(const Geometry* g1, const Geometry* g2) + { + return GEOSDifference_r(handle, g1, g2); + } + + Geometry* + GEOSBoundary(const Geometry* g) + { + return GEOSBoundary_r(handle, g); + } + + Geometry* + GEOSSymDifference(const Geometry* g1, const Geometry* g2) + { + return GEOSSymDifference_r(handle, g1, g2); + } + + Geometry* + GEOSUnion(const Geometry* g1, const Geometry* g2) + { + return GEOSUnion_r(handle, g1, g2); + } + + Geometry* + GEOSUnaryUnion(const Geometry* g) + { + return GEOSUnaryUnion_r(handle, g); + } + + Geometry* + GEOSCoverageUnion(const Geometry* g) + { + return GEOSCoverageUnion_r(handle, g); + } + + Geometry* + GEOSNode(const Geometry* g) + { + return GEOSNode_r(handle, g); + } + + Geometry* + GEOSUnionCascaded(const Geometry* g) + { + return GEOSUnionCascaded_r(handle, g); + } + + Geometry* + GEOSPointOnSurface(const Geometry* g) + { + return GEOSPointOnSurface_r(handle, g); + } + + + Geometry* + GEOSClipByRect(const Geometry* g, double xmin, double ymin, double xmax, double ymax) + { + return GEOSClipByRect_r(handle, g, xmin, ymin, xmax, ymax); + } + + + +//------------------------------------------------------------------- +// memory management functions +//------------------------------------------------------------------ + + + void + GEOSGeom_destroy(Geometry* a) + { + return GEOSGeom_destroy_r(handle, a); + } + + + int + GEOSGetNumCoordinates(const Geometry* g) + { + return GEOSGetNumCoordinates_r(handle, g); + } + + /* + * Return -1 on exception, 0 otherwise. + * Converts Geometry to normal form (or canonical form). + */ + int + GEOSNormalize(Geometry* g) + { + return GEOSNormalize_r(handle, g); + } + + int + GEOSGetNumInteriorRings(const Geometry* g) + { + return GEOSGetNumInteriorRings_r(handle, g); + } + + +// returns -1 on error and 1 for non-multi geometries + int + GEOSGetNumGeometries(const Geometry* g) + { + return GEOSGetNumGeometries_r(handle, g); + } + + + /* + * Call only on GEOMETRYCOLLECTION or MULTI*. + * Return a pointer to the internal Geometry. + */ + const Geometry* + GEOSGetGeometryN(const Geometry* g, int n) + { + return GEOSGetGeometryN_r(handle, g, n); + } + + /* + * Call only on LINESTRING + * Returns NULL on exception + */ + Geometry* + GEOSGeomGetPointN(const Geometry* g, int n) + { + return GEOSGeomGetPointN_r(handle, g, n); + } + + /* + * Call only on LINESTRING + */ + Geometry* + GEOSGeomGetStartPoint(const Geometry* g) + { + return GEOSGeomGetStartPoint_r(handle, g); + } + + /* + * Call only on LINESTRING + */ + Geometry* + GEOSGeomGetEndPoint(const Geometry* g) + { + return GEOSGeomGetEndPoint_r(handle, g); + } + + /* + * Call only on LINESTRING + * return 2 on exception, 1 on true, 0 on false + */ + char + GEOSisClosed(const Geometry* g) + { + return GEOSisClosed_r(handle, g); + } + + /* + * Call only on LINESTRING + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetLength(const Geometry* g, double* length) + { + return GEOSGeomGetLength_r(handle, g, length); + } + + /* + * Call only on LINESTRING + * returns -1 on exception + */ + int + GEOSGeomGetNumPoints(const Geometry* g) + { + return GEOSGeomGetNumPoints_r(handle, g); + } + + /* + * For POINT + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetX(const Geometry* g, double* x) + { + return GEOSGeomGetX_r(handle, g, x); + } + + /* + * For POINT + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetY(const Geometry* g, double* y) + { + return GEOSGeomGetY_r(handle, g, y); + } + + /* + * For POINT + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetZ(const Geometry* g1, double* z) + { + return GEOSGeomGetZ_r(handle, g1, z); + } + + /* + * Call only on polygon + * Return a copy of the internal Geometry. + */ + const Geometry* + GEOSGetExteriorRing(const Geometry* g) + { + return GEOSGetExteriorRing_r(handle, g); + } + + /* + * Call only on polygon + * Return a pointer to internal storage, do not destroy it. + */ + const Geometry* + GEOSGetInteriorRingN(const Geometry* g, int n) + { + return GEOSGetInteriorRingN_r(handle, g, n); + } + + Geometry* + GEOSGetCentroid(const Geometry* g) + { + return GEOSGetCentroid_r(handle, g); + } + + Geometry* + GEOSMinimumBoundingCircle(const Geometry* g, double* radius, Geometry** center) + { + return GEOSMinimumBoundingCircle_r(handle, g, radius, center); + } + + Geometry* + GEOSGeom_createCollection(int type, Geometry** geoms, unsigned int ngeoms) + { + return GEOSGeom_createCollection_r(handle, type, geoms, ngeoms); + } + + Geometry* + GEOSPolygonize(const Geometry* const* g, unsigned int ngeoms) + { + return GEOSPolygonize_r(handle, g, ngeoms); + } + + Geometry* + GEOSPolygonize_valid(const Geometry* const* g, unsigned int ngeoms) + { + return GEOSPolygonize_valid_r(handle, g, ngeoms); + } + + Geometry* + GEOSPolygonizer_getCutEdges(const Geometry* const* g, unsigned int ngeoms) + { + return GEOSPolygonizer_getCutEdges_r(handle, g, ngeoms); + } + + GEOSGeometry* + GEOSPolygonize_full(const GEOSGeometry* input, + GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid) + { + return GEOSPolygonize_full_r(handle, input, cuts, dangles, invalid); + } + + Geometry* + GEOSBuildArea(const Geometry* g) + { + return GEOSBuildArea_r(handle, g); + } + + Geometry* + GEOSMakeValid(const Geometry* g) + { + return GEOSMakeValid_r(handle, g); + } + + Geometry* + GEOSLineMerge(const Geometry* g) + { + return GEOSLineMerge_r(handle, g); + } + + Geometry* + GEOSReverse(const Geometry* g) + { + return GEOSReverse_r(handle, g); + } + + int + GEOSGetSRID(const Geometry* g) + { + return GEOSGetSRID_r(handle, g); + } + + void + GEOSSetSRID(Geometry* g, int srid) + { + return GEOSSetSRID_r(handle, g, srid); + } + + void* + GEOSGeom_getUserData(const Geometry* g) + { + return GEOSGeom_getUserData_r(handle, g); + } + + void + GEOSGeom_setUserData(Geometry* g, void* userData) + { + return GEOSGeom_setUserData_r(handle, g, userData); + } + + char + GEOSHasZ(const Geometry* g) + { + return GEOSHasZ_r(handle, g); + } + + int + GEOS_getWKBOutputDims() + { + return GEOS_getWKBOutputDims_r(handle); + } + + int + GEOS_setWKBOutputDims(int newdims) + { + return GEOS_setWKBOutputDims_r(handle, newdims); + } + + int + GEOS_getWKBByteOrder() + { + return GEOS_getWKBByteOrder_r(handle); + } + + int + GEOS_setWKBByteOrder(int byteOrder) + { + return GEOS_setWKBByteOrder_r(handle, byteOrder); + } + + + CoordinateSequence* + GEOSCoordSeq_create(unsigned int size, unsigned int dims) + { + return GEOSCoordSeq_create_r(handle, size, dims); + } + + int + GEOSCoordSeq_setOrdinate(CoordinateSequence* s, unsigned int idx, unsigned int dim, double val) + { + return GEOSCoordSeq_setOrdinate_r(handle, s, idx, dim, val); + } + + int + GEOSCoordSeq_setX(CoordinateSequence* s, unsigned int idx, double val) + { + return GEOSCoordSeq_setOrdinate(s, idx, 0, val); + } + + int + GEOSCoordSeq_setY(CoordinateSequence* s, unsigned int idx, double val) + { + return GEOSCoordSeq_setOrdinate(s, idx, 1, val); + } + + int + GEOSCoordSeq_setZ(CoordinateSequence* s, unsigned int idx, double val) + { + return GEOSCoordSeq_setOrdinate(s, idx, 2, val); + } + + int + GEOSCoordSeq_setXY(CoordinateSequence* s, unsigned int idx, double x, double y) + { + return GEOSCoordSeq_setXY_r(handle, s, idx, x, y); + } + + int + GEOSCoordSeq_setXYZ(CoordinateSequence* s, unsigned int idx, double x, double y, double z) + { + return GEOSCoordSeq_setXYZ_r(handle, s, idx, x, y, z); + } + + CoordinateSequence* + GEOSCoordSeq_clone(const CoordinateSequence* s) + { + return GEOSCoordSeq_clone_r(handle, s); + } + + int + GEOSCoordSeq_getOrdinate(const CoordinateSequence* s, unsigned int idx, unsigned int dim, double* val) + { + return GEOSCoordSeq_getOrdinate_r(handle, s, idx, dim, val); + } + + int + GEOSCoordSeq_getX(const CoordinateSequence* s, unsigned int idx, double* val) + { + return GEOSCoordSeq_getOrdinate(s, idx, 0, val); + } + + int + GEOSCoordSeq_getY(const CoordinateSequence* s, unsigned int idx, double* val) + { + return GEOSCoordSeq_getOrdinate(s, idx, 1, val); + } + + int + GEOSCoordSeq_getZ(const CoordinateSequence* s, unsigned int idx, double* val) + { + return GEOSCoordSeq_getOrdinate(s, idx, 2, val); + } + + int + GEOSCoordSeq_getXY(const CoordinateSequence* s, unsigned int idx, double* x, double* y) + { + return GEOSCoordSeq_getXY_r(handle, s, idx, x, y); + } + + int + GEOSCoordSeq_getXYZ(const CoordinateSequence* s, unsigned int idx, double* x, double* y, double* z) + { + return GEOSCoordSeq_getXYZ_r(handle, s, idx, x, y, z); + } + + int + GEOSCoordSeq_getSize(const CoordinateSequence* s, unsigned int* size) + { + return GEOSCoordSeq_getSize_r(handle, s, size); + } + + int + GEOSCoordSeq_getDimensions(const CoordinateSequence* s, unsigned int* dims) + { + return GEOSCoordSeq_getDimensions_r(handle, s, dims); + } + + int + GEOSCoordSeq_isCCW(const CoordinateSequence* s, char* is_ccw) + { + return GEOSCoordSeq_isCCW_r(handle, s, is_ccw); + } + + void + GEOSCoordSeq_destroy(CoordinateSequence* s) + { + return GEOSCoordSeq_destroy_r(handle, s); + } + + const CoordinateSequence* + GEOSGeom_getCoordSeq(const Geometry* g) + { + return GEOSGeom_getCoordSeq_r(handle, g); + } + + Geometry* + GEOSGeom_createPoint(CoordinateSequence* cs) + { + return GEOSGeom_createPoint_r(handle, cs); + } + + Geometry* + GEOSGeom_createPointFromXY(double x, double y) + { + return GEOSGeom_createPointFromXY_r(handle, x, y); + } + + Geometry* + GEOSGeom_createLinearRing(CoordinateSequence* cs) + { + return GEOSGeom_createLinearRing_r(handle, cs); + } + + Geometry* + GEOSGeom_createLineString(CoordinateSequence* cs) + { + return GEOSGeom_createLineString_r(handle, cs); + } + + Geometry* + GEOSGeom_createPolygon(Geometry* shell, Geometry** holes, unsigned int nholes) + { + return GEOSGeom_createPolygon_r(handle, shell, holes, nholes); + } + + Geometry* + GEOSGeom_clone(const Geometry* g) + { + return GEOSGeom_clone_r(handle, g); + } + + GEOSGeometry* + GEOSGeom_setPrecision(const GEOSGeometry* g, double gridSize, int flags) + { + return GEOSGeom_setPrecision_r(handle, g, gridSize, flags); + } + + double + GEOSGeom_getPrecision(const GEOSGeometry* g) + { + return GEOSGeom_getPrecision_r(handle, g); + } + + int + GEOSGeom_getDimensions(const Geometry* g) + { + return GEOSGeom_getDimensions_r(handle, g); + } + + int + GEOSGeom_getCoordinateDimension(const Geometry* g) + { + return GEOSGeom_getCoordinateDimension_r(handle, g); + } + + int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value) + { + return GEOSGeom_getXMin_r(handle, g, value); + } + + int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value) + { + return GEOSGeom_getYMin_r(handle, g, value); + } + + int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value) + { + return GEOSGeom_getXMax_r(handle, g, value); + } + + int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value) + { + return GEOSGeom_getYMax_r(handle, g, value); + } + + Geometry* + GEOSSimplify(const Geometry* g, double tolerance) + { + return GEOSSimplify_r(handle, g, tolerance); + } + + Geometry* + GEOSTopologyPreserveSimplify(const Geometry* g, double tolerance) + { + return GEOSTopologyPreserveSimplify_r(handle, g, tolerance); + } + + + /* WKT Reader */ + WKTReader* + GEOSWKTReader_create() + { + return GEOSWKTReader_create_r(handle); + } + + void + GEOSWKTReader_destroy(WKTReader* reader) + { + GEOSWKTReader_destroy_r(handle, reader); + } + + + Geometry* + GEOSWKTReader_read(WKTReader* reader, const char* wkt) + { + return GEOSWKTReader_read_r(handle, reader, wkt); + } + + /* WKT Writer */ + WKTWriter* + GEOSWKTWriter_create() + { + return GEOSWKTWriter_create_r(handle); + } + + void + GEOSWKTWriter_destroy(WKTWriter* Writer) + { + GEOSWKTWriter_destroy_r(handle, Writer); + } + + char* + GEOSWKTWriter_write(WKTWriter* writer, const Geometry* geom) + { + return GEOSWKTWriter_write_r(handle, writer, geom); + } + + void + GEOSWKTWriter_setTrim(WKTWriter* writer, char trim) + { + GEOSWKTWriter_setTrim_r(handle, writer, trim); + } + + void + GEOSWKTWriter_setRoundingPrecision(WKTWriter* writer, int precision) + { + return GEOSWKTWriter_setRoundingPrecision_r(handle, writer, precision); + } + + void + GEOSWKTWriter_setOutputDimension(WKTWriter* writer, int dim) + { + GEOSWKTWriter_setOutputDimension_r(handle, writer, dim); + } + + int + GEOSWKTWriter_getOutputDimension(WKTWriter* writer) + { + return GEOSWKTWriter_getOutputDimension_r(handle, writer); + } + + void + GEOSWKTWriter_setOld3D(WKTWriter* writer, int useOld3D) + { + GEOSWKTWriter_setOld3D_r(handle, writer, useOld3D); + } + + /* WKB Reader */ + WKBReader* + GEOSWKBReader_create() + { + return GEOSWKBReader_create_r(handle); + } + + void + GEOSWKBReader_destroy(WKBReader* reader) + { + GEOSWKBReader_destroy_r(handle, reader); + } + + + Geometry* + GEOSWKBReader_read(WKBReader* reader, const unsigned char* wkb, size_t size) + { + return GEOSWKBReader_read_r(handle, reader, wkb, size); + } + + Geometry* + GEOSWKBReader_readHEX(WKBReader* reader, const unsigned char* hex, size_t size) + { + return GEOSWKBReader_readHEX_r(handle, reader, hex, size); + } + + /* WKB Writer */ + WKBWriter* + GEOSWKBWriter_create() + { + return GEOSWKBWriter_create_r(handle); + } + + void + GEOSWKBWriter_destroy(WKBWriter* Writer) + { + GEOSWKBWriter_destroy_r(handle, Writer); + } + + + /* The caller owns the result */ + unsigned char* + GEOSWKBWriter_write(WKBWriter* writer, const Geometry* geom, size_t* size) + { + return GEOSWKBWriter_write_r(handle, writer, geom, size); + } + + /* The caller owns the result */ + unsigned char* + GEOSWKBWriter_writeHEX(WKBWriter* writer, const Geometry* geom, size_t* size) + { + return GEOSWKBWriter_writeHEX_r(handle, writer, geom, size); + } + + int + GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer) + { + return GEOSWKBWriter_getOutputDimension_r(handle, writer); + } + + void + GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension) + { + GEOSWKBWriter_setOutputDimension_r(handle, writer, newDimension); + } + + int + GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer) + { + return GEOSWKBWriter_getByteOrder_r(handle, writer); + } + + void + GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int newByteOrder) + { + GEOSWKBWriter_setByteOrder_r(handle, writer, newByteOrder); + } + + char + GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer) + { + return GEOSWKBWriter_getIncludeSRID_r(handle, writer); + } + + void + GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char newIncludeSRID) + { + GEOSWKBWriter_setIncludeSRID_r(handle, writer, newIncludeSRID); + } + + +//----------------------------------------------------------------- +// Prepared Geometry +//----------------------------------------------------------------- + + const geos::geom::prep::PreparedGeometry* + GEOSPrepare(const Geometry* g) + { + return GEOSPrepare_r(handle, g); + } + + void + GEOSPreparedGeom_destroy(const geos::geom::prep::PreparedGeometry* a) + { + GEOSPreparedGeom_destroy_r(handle, a); + } + + char + GEOSPreparedContains(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedContains_r(handle, pg1, g2); + } + + char + GEOSPreparedContainsProperly(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedContainsProperly_r(handle, pg1, g2); + } + + char + GEOSPreparedCoveredBy(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedCoveredBy_r(handle, pg1, g2); + } + + char + GEOSPreparedCovers(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedCovers_r(handle, pg1, g2); + } + + char + GEOSPreparedCrosses(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedCrosses_r(handle, pg1, g2); + } + + char + GEOSPreparedDisjoint(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedDisjoint_r(handle, pg1, g2); + } + + char + GEOSPreparedIntersects(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedIntersects_r(handle, pg1, g2); + } + + char + GEOSPreparedOverlaps(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedOverlaps_r(handle, pg1, g2); + } + + char + GEOSPreparedTouches(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedTouches_r(handle, pg1, g2); + } + + char + GEOSPreparedWithin(const geos::geom::prep::PreparedGeometry* pg1, const Geometry* g2) + { + return GEOSPreparedWithin_r(handle, pg1, g2); + } + + STRtree* + GEOSSTRtree_create(size_t nodeCapacity) + { + return GEOSSTRtree_create_r(handle, nodeCapacity); + } + + void + GEOSSTRtree_insert(geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g, + void* item) + { + GEOSSTRtree_insert_r(handle, tree, g, item); + } + + void + GEOSSTRtree_query(geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g, + GEOSQueryCallback cb, + void* userdata) + { + GEOSSTRtree_query_r(handle, tree, g, cb, userdata); + } + + const GEOSGeometry* + GEOSSTRtree_nearest(geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g) + { + return GEOSSTRtree_nearest_r(handle, tree, g); + } + + const void* GEOSSTRtree_nearest_generic(GEOSSTRtree* tree, + const void* item, + const GEOSGeometry* itemEnvelope, + GEOSDistanceCallback distancefn, + void* userdata) + { + return GEOSSTRtree_nearest_generic_r(handle, tree, item, itemEnvelope, distancefn, userdata); + } + + void + GEOSSTRtree_iterate(geos::index::strtree::STRtree* tree, + GEOSQueryCallback callback, + void* userdata) + { + GEOSSTRtree_iterate_r(handle, tree, callback, userdata); + } + + char + GEOSSTRtree_remove(geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g, + void* item) + { + return GEOSSTRtree_remove_r(handle, tree, g, item); + } + + void + GEOSSTRtree_destroy(geos::index::strtree::STRtree* tree) + { + GEOSSTRtree_destroy_r(handle, tree); + } + + double + GEOSProject(const geos::geom::Geometry* g, + const geos::geom::Geometry* p) + { + return GEOSProject_r(handle, g, p); + } + + geos::geom::Geometry* + GEOSInterpolate(const geos::geom::Geometry* g, + double d) + { + return GEOSInterpolate_r(handle, g, d); + } + + double + GEOSProjectNormalized(const geos::geom::Geometry* g, + const geos::geom::Geometry* p) + { + return GEOSProjectNormalized_r(handle, g, p); + } + + geos::geom::Geometry* + GEOSInterpolateNormalized(const geos::geom::Geometry* g, + double d) + { + return GEOSInterpolateNormalized_r(handle, g, d); + } + + geos::geom::Geometry* + GEOSGeom_extractUniquePoints(const geos::geom::Geometry* g) + { + return GEOSGeom_extractUniquePoints_r(handle, g); + } + + geos::geom::Geometry* + GEOSGeom_createEmptyCollection(int type) + { + return GEOSGeom_createEmptyCollection_r(handle, type); + } + + geos::geom::Geometry* + GEOSGeom_createEmptyPoint() + { + return GEOSGeom_createEmptyPoint_r(handle); + } + + geos::geom::Geometry* + GEOSGeom_createEmptyLineString() + { + return GEOSGeom_createEmptyLineString_r(handle); + } + + geos::geom::Geometry* + GEOSGeom_createEmptyPolygon() + { + return GEOSGeom_createEmptyPolygon_r(handle); + } + + int + GEOSOrientationIndex(double Ax, double Ay, double Bx, double By, + double Px, double Py) + { + return GEOSOrientationIndex_r(handle, Ax, Ay, Bx, By, Px, Py); + } + + GEOSGeometry* + GEOSSharedPaths(const GEOSGeometry* g1, const GEOSGeometry* g2) + { + return GEOSSharedPaths_r(handle, g1, g2); + } + + GEOSGeometry* + GEOSSnap(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance) + { + return GEOSSnap_r(handle, g1, g2, tolerance); + } + + GEOSBufferParams* + GEOSBufferParams_create() + { + return GEOSBufferParams_create_r(handle); + } + + void + GEOSBufferParams_destroy(GEOSBufferParams* p) + { + return GEOSBufferParams_destroy_r(handle, p); + } + + int + GEOSBufferParams_setEndCapStyle(GEOSBufferParams* p, int style) + { + return GEOSBufferParams_setEndCapStyle_r(handle, p, style); + } + + int + GEOSBufferParams_setJoinStyle(GEOSBufferParams* p, int joinStyle) + { + return GEOSBufferParams_setJoinStyle_r(handle, p, joinStyle); + } + + int + GEOSBufferParams_setMitreLimit(GEOSBufferParams* p, double l) + { + return GEOSBufferParams_setMitreLimit_r(handle, p, l); + } + + int + GEOSBufferParams_setQuadrantSegments(GEOSBufferParams* p, int joinStyle) + { + return GEOSBufferParams_setQuadrantSegments_r(handle, p, joinStyle); + } + + int + GEOSBufferParams_setSingleSided(GEOSBufferParams* p, int singleSided) + { + return GEOSBufferParams_setSingleSided_r(handle, p, singleSided); + } + + Geometry* + GEOSBufferWithParams(const Geometry* g, const GEOSBufferParams* p, double w) + { + return GEOSBufferWithParams_r(handle, g, p, w); + } + + Geometry* + GEOSDelaunayTriangulation(const Geometry* g, double tolerance, int onlyEdges) + { + return GEOSDelaunayTriangulation_r(handle, g, tolerance, onlyEdges); + } + + Geometry* + GEOSVoronoiDiagram(const Geometry* g, const Geometry* env, double tolerance, int onlyEdges) + { + return GEOSVoronoiDiagram_r(handle, g, env, tolerance, onlyEdges); + } + + int + GEOSSegmentIntersection(double ax0, double ay0, double ax1, double ay1, + double bx0, double by0, double bx1, double by1, + double* cx, double* cy) + { + return GEOSSegmentIntersection_r(handle, + ax0, ay0, ax1, ay1, + bx0, by0, bx1, by1, + cx, cy); + } + +} /* extern "C" */ diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in new file mode 100644 index 0000000..31da35e --- /dev/null +++ b/capi/geos_c.h.in @@ -0,0 +1,2194 @@ +/************************************************************************ + * + * + * C-Wrapper for GEOS library + * + * Copyright (C) 2010 2011 Sandro Santilli + * Copyright (C) 2005 Refractions Research Inc. + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + * Author: Sandro Santilli + * + *********************************************************************** + * + * GENERAL NOTES: + * + * - Remember to call initGEOS() before any use of this library's + * functions, and call finishGEOS() when done. + * + * - Currently you have to explicitly GEOSGeom_destroy() all + * GEOSGeom objects to avoid memory leaks, and GEOSFree() + * all returned char * (unless const). + * + * - Functions ending with _r are thread safe; see details in RFC 3 + * http://trac.osgeo.org/geos/wiki/RFC3. + * To avoid using by accident non _r functions, + * define GEOS_USE_ONLY_R_API before including geos_c.h + * + ***********************************************************************/ + +#ifndef GEOS_C_H_INCLUDED +#define GEOS_C_H_INCLUDED + +#ifndef __cplusplus +# include /* for size_t definition */ +#else +# include +using std::size_t; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************ + * + * Version + * + ***********************************************************************/ + +#ifndef GEOS_VERSION_MAJOR +#define GEOS_VERSION_MAJOR @VERSION_MAJOR@ +#endif +#ifndef GEOS_VERSION_MINOR +#define GEOS_VERSION_MINOR @VERSION_MINOR@ +#endif +#ifndef GEOS_VERSION_PATCH +#define GEOS_VERSION_PATCH @VERSION_PATCH@ +#endif +#ifndef GEOS_VERSION +#define GEOS_VERSION "@VERSION@" +#endif +#ifndef GEOS_JTS_PORT +#define GEOS_JTS_PORT "@JTS_PORT@" +#endif + +#define GEOS_CAPI_VERSION_MAJOR @CAPI_VERSION_MAJOR@ +#define GEOS_CAPI_VERSION_MINOR @CAPI_VERSION_MINOR@ +#define GEOS_CAPI_VERSION_PATCH @CAPI_VERSION_PATCH@ +#define GEOS_CAPI_VERSION "@VERSION@-CAPI-@CAPI_VERSION@" + +#define GEOS_CAPI_FIRST_INTERFACE GEOS_CAPI_VERSION_MAJOR +#define GEOS_CAPI_LAST_INTERFACE (GEOS_CAPI_VERSION_MAJOR+GEOS_CAPI_VERSION_MINOR) + + +/************************************************************************ + * + * (Abstract) type definitions + * + ************************************************************************/ + +typedef struct GEOSContextHandle_HS *GEOSContextHandle_t; + +typedef void (*GEOSMessageHandler)(const char *fmt, ...); + +/* + * A GEOS message handler function. + * + * @param message the message contents + * @param userdata the user data pointer that was passed to GEOS when registering this message handler. + * + * + * @see GEOSContext_setErrorMessageHandler + * @see GEOSContext_setNoticeMessageHandler + */ +typedef void (*GEOSMessageHandler_r)(const char *message, void *userdata); + +/* When we're included by geos_c.cpp, those are #defined to the original + * JTS definitions via preprocessor. We don't touch them to allow the + * compiler to cross-check the declarations. However, for all "normal" + * C-API users, we need to define them as "opaque" struct pointers, as + * those clients don't have access to the original C++ headers, by design. + */ +#ifndef GEOSGeometry +typedef struct GEOSGeom_t GEOSGeometry; +typedef struct GEOSPrepGeom_t GEOSPreparedGeometry; +typedef struct GEOSCoordSeq_t GEOSCoordSequence; +typedef struct GEOSSTRtree_t GEOSSTRtree; +typedef struct GEOSBufParams_t GEOSBufferParams; +#endif + +/* Those are compatibility definitions for source compatibility + * with GEOS 2.X clients relying on that type. + */ +typedef GEOSGeometry* GEOSGeom; +typedef GEOSCoordSequence* GEOSCoordSeq; + +/* Supported geometry types + * This was renamed from GEOSGeomTypeId in GEOS 2.2.X, which might + * break compatibility, this issue is still under investigation. + */ + +enum GEOSGeomTypes { + GEOS_POINT, + GEOS_LINESTRING, + GEOS_LINEARRING, + GEOS_POLYGON, + GEOS_MULTIPOINT, + GEOS_MULTILINESTRING, + GEOS_MULTIPOLYGON, + GEOS_GEOMETRYCOLLECTION +}; + +/* Byte orders exposed via the C API */ +enum GEOSByteOrders { + GEOS_WKB_XDR = 0, /* Big Endian */ + GEOS_WKB_NDR = 1 /* Little Endian */ +}; + +typedef void (*GEOSQueryCallback)(void *item, void *userdata); +typedef int (*GEOSDistanceCallback)(const void *item1, const void* item2, double* distance, void* userdata); + +/************************************************************************ + * + * Initialization, cleanup, version + * + ***********************************************************************/ + +#include + +/* + * Register an interruption checking callback + * + * The callback will be invoked _before_ checking for + * interruption, so can be used to request it. + */ +typedef void (GEOSInterruptCallback)(); +extern GEOSInterruptCallback GEOS_DLL *GEOS_interruptRegisterCallback(GEOSInterruptCallback* cb); +/* Request safe interruption of operations */ +extern void GEOS_DLL GEOS_interruptRequest(); +/* Cancel a pending interruption request */ +extern void GEOS_DLL GEOS_interruptCancel(); + +/* + * @deprecated in 3.5.0 + * initialize using GEOS_init_r() and set the message handlers using + * GEOSContext_setNoticeHandler_r and/or GEOSContext_setErrorHandler_r + */ +extern GEOSContextHandle_t GEOS_DLL initGEOS_r( + GEOSMessageHandler notice_function, + GEOSMessageHandler error_function); +/* + * @deprecated in 3.5.0 replaced by GEOS_finish_r. + */ +extern void GEOS_DLL finishGEOS_r(GEOSContextHandle_t handle); + +extern GEOSContextHandle_t GEOS_DLL GEOS_init_r(); +extern void GEOS_DLL GEOS_finish_r(GEOSContextHandle_t handle); + + +extern GEOSMessageHandler GEOS_DLL GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle, + GEOSMessageHandler nf); +extern GEOSMessageHandler GEOS_DLL GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle, + GEOSMessageHandler ef); + +/* + * Sets a notice message handler on the given GEOS context. + * + * @param extHandle the GEOS context + * @param nf the message handler + * @param userData optional user data pointer that will be passed to the message handler + * + * @return the previously configured message handler or NULL if no message handler was configured + */ +extern GEOSMessageHandler_r GEOS_DLL GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t extHandle, + GEOSMessageHandler_r nf, + void *userData); + +/* + * Sets an error message handler on the given GEOS context. + * + * @param extHandle the GEOS context + * @param ef the message handler + * @param userData optional user data pointer that will be passed to the message handler + * + * @return the previously configured message handler or NULL if no message handler was configured + */ +extern GEOSMessageHandler_r GEOS_DLL GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t extHandle, + GEOSMessageHandler_r ef, + void *userData); + +extern const char GEOS_DLL *GEOSversion(); + + +/************************************************************************ + * + * NOTE - These functions are DEPRECATED. Please use the new Reader and + * writer APIS! + * + ***********************************************************************/ + +extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT_r(GEOSContextHandle_t handle, + const char *wkt); +extern char GEOS_DLL *GEOSGeomToWKT_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Specify whether output WKB should be 2d or 3d. + * Return previously set number of dimensions. + */ + +extern int GEOS_DLL GEOS_getWKBOutputDims_r(GEOSContextHandle_t handle); +extern int GEOS_DLL GEOS_setWKBOutputDims_r(GEOSContextHandle_t handle, + int newDims); + +/* + * Specify whether the WKB byte order is big or little endian. + * The return value is the previous byte order. + */ + +extern int GEOS_DLL GEOS_getWKBByteOrder_r(GEOSContextHandle_t handle); +extern int GEOS_DLL GEOS_setWKBByteOrder_r(GEOSContextHandle_t handle, + int byteOrder); + +extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf_r(GEOSContextHandle_t handle, + const unsigned char *wkb, + size_t size); +extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + size_t *size); + +extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf_r(GEOSContextHandle_t handle, + const unsigned char *hex, + size_t size); +extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + size_t *size); + +/************************************************************************ + * + * Coordinate Sequence functions + * + ***********************************************************************/ + +/* + * Create a Coordinate sequence with ``size'' coordinates + * of ``dims'' dimensions. + * Return NULL on exception. + */ +extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_create_r( + GEOSContextHandle_t handle, + unsigned int size, + unsigned int dims); + +/* + * Clone a Coordinate Sequence. + * Return NULL on exception. + */ +extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_clone_r( + GEOSContextHandle_t handle, + const GEOSCoordSequence* s); + +/* + * Destroy a Coordinate Sequence. + */ +extern void GEOS_DLL GEOSCoordSeq_destroy_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s); + +/* + * Set ordinate values in a Coordinate Sequence. + * Return 0 on exception. + */ +extern int GEOS_DLL GEOSCoordSeq_setX_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s, unsigned int idx, + double val); +extern int GEOS_DLL GEOSCoordSeq_setY_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s, unsigned int idx, + double val); +extern int GEOS_DLL GEOSCoordSeq_setZ_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s, unsigned int idx, + double val); +extern int GEOS_DLL GEOSCoordSeq_setXY_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s, unsigned int idx, + double x, double y); +extern int GEOS_DLL GEOSCoordSeq_setXYZ_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s, unsigned int idx, + double x, double y, double z); + +extern int GEOS_DLL GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t handle, + GEOSCoordSequence* s, + unsigned int idx, + unsigned int dim, double val); + +/* + * Get ordinate values from a Coordinate Sequence. + * Return 0 on exception. + */ +extern int GEOS_DLL GEOSCoordSeq_getX_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int idx, double *val); +extern int GEOS_DLL GEOSCoordSeq_getY_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int idx, double *val); +extern int GEOS_DLL GEOSCoordSeq_getZ_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int idx, double *val); +extern int GEOS_DLL GEOSCoordSeq_getXY_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int idx, double *x, double *y); +extern int GEOS_DLL GEOSCoordSeq_getXYZ_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int idx, double *x, double *y, double *z); +extern int GEOS_DLL GEOSCoordSeq_getOrdinate_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int idx, + unsigned int dim, double *val); +/* + * Get size and dimensions info from a Coordinate Sequence. + * Return 0 on exception. + */ +extern int GEOS_DLL GEOSCoordSeq_getSize_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int *size); +extern int GEOS_DLL GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + unsigned int *dims); +/* + * Check orientation of a CoordinateSequence and set 'is_ccw' to 1 + * if it has counter-clockwise orientation, 0 otherwise. + * Return 0 on exception, 1 on success. + */ +extern int GEOS_DLL GEOSCoordSeq_isCCW_r(GEOSContextHandle_t handle, + const GEOSCoordSequence* s, + char* is_ccw); + +/************************************************************************ + * + * Linear referencing functions -- there are more, but these are + * probably sufficient for most purposes + * + ***********************************************************************/ + +/* + * GEOSGeometry ownership is retained by caller + */ + + +/* Return distance of point 'p' projected on 'g' from origin + * of 'g'. Geometry 'g' must be a lineal geometry */ +extern double GEOS_DLL GEOSProject_r(GEOSContextHandle_t handle, + const GEOSGeometry *g, + const GEOSGeometry *p); + +/* Return closest point to given distance within geometry + * Geometry must be a LineString */ +extern GEOSGeometry GEOS_DLL *GEOSInterpolate_r(GEOSContextHandle_t handle, + const GEOSGeometry *g, + double d); + +extern double GEOS_DLL GEOSProjectNormalized_r(GEOSContextHandle_t handle, + const GEOSGeometry *g, + const GEOSGeometry *p); + +extern GEOSGeometry GEOS_DLL *GEOSInterpolateNormalized_r( + GEOSContextHandle_t handle, + const GEOSGeometry *g, + double d); + +/************************************************************************ + * + * Buffer related functions + * + ***********************************************************************/ + + +/* @return NULL on exception */ +extern GEOSGeometry GEOS_DLL *GEOSBuffer_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + double width, int quadsegs); + +enum GEOSBufCapStyles { + GEOSBUF_CAP_ROUND=1, + GEOSBUF_CAP_FLAT=2, + GEOSBUF_CAP_SQUARE=3 +}; + +enum GEOSBufJoinStyles { + GEOSBUF_JOIN_ROUND=1, + GEOSBUF_JOIN_MITRE=2, + GEOSBUF_JOIN_BEVEL=3 +}; + +/* @return 0 on exception */ +extern GEOSBufferParams GEOS_DLL *GEOSBufferParams_create_r( + GEOSContextHandle_t handle); +extern void GEOS_DLL GEOSBufferParams_destroy_r( + GEOSContextHandle_t handle, + GEOSBufferParams* parms); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setEndCapStyle_r( + GEOSContextHandle_t handle, + GEOSBufferParams* p, + int style); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setJoinStyle_r( + GEOSContextHandle_t handle, + GEOSBufferParams* p, + int joinStyle); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setMitreLimit_r( + GEOSContextHandle_t handle, + GEOSBufferParams* p, + double mitreLimit); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setQuadrantSegments_r( + GEOSContextHandle_t handle, + GEOSBufferParams* p, + int quadSegs); + +/* @param singleSided: 1 for single sided, 0 otherwise */ +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setSingleSided_r( + GEOSContextHandle_t handle, + GEOSBufferParams* p, + int singleSided); + +/* @return NULL on exception */ +extern GEOSGeometry GEOS_DLL *GEOSBufferWithParams_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g, + const GEOSBufferParams* p, + double width); + +/* These functions return NULL on exception. */ +extern GEOSGeometry GEOS_DLL *GEOSBufferWithStyle_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, double width, int quadsegs, int endCapStyle, + int joinStyle, double mitreLimit); + +/* These functions return NULL on exception. Only LINESTRINGs are accepted. */ +/* @deprecated in 3.3.0: use GEOSOffsetCurve instead */ +extern GEOSGeometry GEOS_DLL *GEOSSingleSidedBuffer_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g, double width, int quadsegs, + int joinStyle, double mitreLimit, int leftSide); + +/* + * Only LINESTRINGs are accepted. + * @param width : offset distance. + * negative for right side offset. + * positive for left side offset. + * @return NULL on exception + */ +extern GEOSGeometry GEOS_DLL *GEOSOffsetCurve_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, double width, int quadsegs, + int joinStyle, double mitreLimit); + + +/************************************************************************ + * + * Geometry Constructors. + * GEOSCoordSequence* arguments will become ownership of the returned object. + * All functions return NULL on exception. + * + ***********************************************************************/ + +extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint_r( + GEOSContextHandle_t handle, + GEOSCoordSequence* s); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createPointFromXY_r( + GEOSContextHandle_t handle, + double x, + double y); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPoint_r( + GEOSContextHandle_t handle); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing_r( + GEOSContextHandle_t handle, + GEOSCoordSequence* s); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString_r( + GEOSContextHandle_t handle, + GEOSCoordSequence* s); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyLineString_r( + GEOSContextHandle_t handle); + +/* + * Second argument is an array of GEOSGeometry* objects. + * The caller remains owner of the array, but pointed-to + * objects become ownership of the returned GEOSGeometry. + */ +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPolygon_r( + GEOSContextHandle_t handle); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createPolygon_r( + GEOSContextHandle_t handle, + GEOSGeometry* shell, + GEOSGeometry** holes, + unsigned int nholes); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createCollection_r( + GEOSContextHandle_t handle, int type, + GEOSGeometry* *geoms, + unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCollection_r( + GEOSContextHandle_t handle, int type); + +extern GEOSGeometry GEOS_DLL *GEOSGeom_clone_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/************************************************************************ + * + * Memory management + * + ***********************************************************************/ + +extern void GEOS_DLL GEOSGeom_destroy_r(GEOSContextHandle_t handle, + GEOSGeometry* g); + +/************************************************************************ + * + * Topology operations - return NULL on exception. + * + ***********************************************************************/ + +extern GEOSGeometry GEOS_DLL *GEOSEnvelope_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSIntersection_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSConvexHull_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Returns the minimum rotated rectangular POLYGON which encloses the input geometry. The rectangle + * has width equal to the minimum diameter, and a longer length. If the convex hill of the input is + * degenerate (a line or point) a LINESTRING or POINT is returned. The minimum rotated rectangle can + * be used as an extremely generalized representation for the given geometry. + */ +extern GEOSGeometry GEOS_DLL *GEOSMinimumRotatedRectangle_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Returns a LINESTRING geometry which represents the minimum diameter of the geometry. + * The minimum diameter is defined to be the width of the smallest band that + * contains the geometry, where a band is a strip of the plane defined + * by two parallel lines. This can be thought of as the smallest hole that the geometry + * can be moved through, with a single rotation. + */ +extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +extern int GEOS_DLL GEOSMinimumClearance_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + double* distance); + +extern GEOSGeometry GEOS_DLL *GEOSDifference_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSSymDifference_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSBoundary_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSUnion_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSUnaryUnion_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +/* GEOSCoverageUnion is an optimized union algorithm for polygonal inputs that are correctly + * noded and do not overlap. It will not generate an error (return NULL) for inputs that + * do not satisfy this constraint. */ +extern GEOSGeometry GEOS_DLL *GEOSCoverageUnion_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +/* @deprecated in 3.3.0: use GEOSUnaryUnion_r instead */ +extern GEOSGeometry GEOS_DLL *GEOSUnionCascaded_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSGetCentroid_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSMinimumBoundingCircle_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, double* radius, + GEOSGeometry** center); +extern GEOSGeometry GEOS_DLL *GEOSNode_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +/* Fast, non-robust intersection between an arbitrary geometry and + * a rectangle. The returned geometry may be invalid. */ +extern GEOSGeometry GEOS_DLL *GEOSClipByRect_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + double xmin, double ymin, + double xmax, double ymax); + +/* + * all arguments remain ownership of the caller + * (both Geometries and pointers) + */ +/* + * Polygonizes a set of Geometries which contain linework that + * represents the edges of a planar graph. + * + * All types of Geometry are accepted as input; the constituent + * linework is extracted as the edges to be polygonized. + * + * The edges must be correctly noded; that is, they must only meet + * at their endpoints. Polygonization will accept incorrectly noded + * input but will not form polygons from non-noded edges, and reports + * them as errors. + * + * The Polygonizer reports the follow kinds of errors: + * + * - Dangles - edges which have one or both ends which are + * not incident on another edge endpoint + * - Cut Edges - edges which are connected at both ends but + * which do not form part of a polygon + * - Invalid Ring Lines - edges which form rings which are invalid + * (e.g. the component lines contain a self-intersection) + * + * Errors are reported to output parameters "cuts", "dangles" and + * "invalid" (if not-null). Formed polygons are returned as a + * collection. NULL is returned on exception. All returned + * geometries must be destroyed by caller. + * + * The GEOSPolygonize_valid_r variant allows extracting only polygons + * which form a valid polygonal result. The set of extracted polygons + * is guaranteed to be edge-disjoint. This is useful when it is known + * that the input lines form a valid polygonal geometry (which may + * include holes or nested polygons). + */ + +extern GEOSGeometry GEOS_DLL *GEOSPolygonize_r(GEOSContextHandle_t handle, + const GEOSGeometry *const geoms[], + unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSPolygonize_valid_r(GEOSContextHandle_t handle, + const GEOSGeometry *const geoms[], + unsigned int ngems); +extern GEOSGeometry GEOS_DLL *GEOSPolygonizer_getCutEdges_r( + GEOSContextHandle_t handle, + const GEOSGeometry * const geoms[], + unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full_r(GEOSContextHandle_t handle, + const GEOSGeometry* input, GEOSGeometry** cuts, + GEOSGeometry** dangles, GEOSGeometry** invalidRings); + +extern GEOSGeometry GEOS_DLL *GEOSBuildArea_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g); + +extern GEOSGeometry GEOS_DLL *GEOSLineMerge_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSReverse_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSSimplify_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + double tolerance); +extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g, double tolerance); + +/* + * Return all distinct vertices of input geometry as a MULTIPOINT. + * Note that only 2 dimensions of the vertices are considered when + * testing for equality. + */ +extern GEOSGeometry GEOS_DLL *GEOSGeom_extractUniquePoints_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Find paths shared between the two given lineal geometries. + * + * Returns a GEOMETRYCOLLECTION having two elements: + * - first element is a MULTILINESTRING containing shared paths + * having the _same_ direction on both inputs + * - second element is a MULTILINESTRING containing shared paths + * having the _opposite_ direction on the two inputs + * + * Returns NULL on exception + */ +extern GEOSGeometry GEOS_DLL *GEOSSharedPaths_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, const GEOSGeometry* g2); + +/* + * Snap first geometry on to second with given tolerance + * Returns a newly allocated geometry, or NULL on exception + */ +extern GEOSGeometry GEOS_DLL *GEOSSnap_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance); + +/* + * Return a Delaunay triangulation of the vertex of the given geometry + * + * @param g the input geometry whose vertex will be used as "sites" + * @param tolerance optional snapping tolerance to use for improved robustness + * @param onlyEdges if non-zero will return a MULTILINESTRING, otherwise it will + * return a GEOMETRYCOLLECTION containing triangular POLYGONs. + * + * @return a newly allocated geometry, or NULL on exception + */ +extern GEOSGeometry GEOS_DLL * GEOSDelaunayTriangulation_r( + GEOSContextHandle_t handle, + const GEOSGeometry *g, + double tolerance, + int onlyEdges); + +/* + * Returns the Voronoi polygons of a set of Vertices given as input + * + * @param g the input geometry whose vertex will be used as sites. + * @param tolerance snapping tolerance to use for improved robustness + * @param onlyEdges whether to return only edges of the Voronoi cells + * @param env clipping envelope for the returned diagram, automatically + * determined if NULL. + * The diagram will be clipped to the larger + * of this envelope or an envelope surrounding the sites. + * + * @return a newly allocated geometry, or NULL on exception. + */ +extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram_r( + GEOSContextHandle_t extHandle, + const GEOSGeometry *g, + const GEOSGeometry *env, + double tolerance, + int onlyEdges); + +/* + * Computes the coordinate where two line segments intersect, if any + * + * @param ax0 x-coordinate of first point in first segment + * @param ay0 y-coordinate of first point in first segment + * @param ax1 x-coordinate of second point in first segment + * @param ay1 y-coordinate of second point in first segment + * @param bx0 x-coordinate of first point in second segment + * @param by0 y-coordinate of first point in second segment + * @param bx1 x-coordinate of second point in second segment + * @param by1 y-coordinate of second point in second segment + * @param cx x-coordinate of intersection point + * @param cy y-coordinate of intersection point + * + * @return 0 on error, 1 on success, -1 if segments do not intersect + */ + +extern int GEOS_DLL GEOSSegmentIntersection_r( + GEOSContextHandle_t extHandle, + double ax0, double ay0, + double ax1, double ay1, + double bx0, double by0, + double bx1, double by1, + double* cx, double* cy); + +/************************************************************************ + * + * Binary predicates - return 2 on exception, 1 on true, 0 on false + * + ***********************************************************************/ + +extern char GEOS_DLL GEOSDisjoint_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSTouches_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSIntersects_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSCrosses_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSWithin_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSContains_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSOverlaps_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSEquals_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSEqualsExact_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2, + double tolerance); +extern char GEOS_DLL GEOSCovers_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSCoveredBy_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); + +/************************************************************************ + * + * Prepared Geometry Binary predicates - return 2 on exception, 1 on true, 0 on false + * + ***********************************************************************/ + +/* + * GEOSGeometry ownership is retained by caller + */ +extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g); + +extern void GEOS_DLL GEOSPreparedGeom_destroy_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* g); + +extern char GEOS_DLL GEOSPreparedContains_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedContainsProperly_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedCoveredBy_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedCovers_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedCrosses_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedDisjoint_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedIntersects_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedOverlaps_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedTouches_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedWithin_r(GEOSContextHandle_t handle, + const GEOSPreparedGeometry* pg1, + const GEOSGeometry* g2); + +/************************************************************************ + * + * STRtree functions + * + ***********************************************************************/ + +/* + * GEOSGeometry ownership is retained by caller + */ + +extern GEOSSTRtree GEOS_DLL *GEOSSTRtree_create_r( + GEOSContextHandle_t handle, + size_t nodeCapacity); +extern void GEOS_DLL GEOSSTRtree_insert_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree, + const GEOSGeometry *g, + void *item); +extern void GEOS_DLL GEOSSTRtree_query_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree, + const GEOSGeometry *g, + GEOSQueryCallback callback, + void *userdata); + +extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree, + const GEOSGeometry* geom); + + +extern const void GEOS_DLL *GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree, + const void* item, + const GEOSGeometry* itemEnvelope, + GEOSDistanceCallback distancefn, + void* userdata); + +extern void GEOS_DLL GEOSSTRtree_iterate_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree, + GEOSQueryCallback callback, + void *userdata); +extern char GEOS_DLL GEOSSTRtree_remove_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree, + const GEOSGeometry *g, + void *item); +extern void GEOS_DLL GEOSSTRtree_destroy_r(GEOSContextHandle_t handle, + GEOSSTRtree *tree); + + +/************************************************************************ + * + * Unary predicate - return 2 on exception, 1 on true, 0 on false + * + ***********************************************************************/ + +extern char GEOS_DLL GEOSisEmpty_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern char GEOS_DLL GEOSisSimple_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern char GEOS_DLL GEOSisRing_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern char GEOS_DLL GEOSHasZ_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +extern char GEOS_DLL GEOSisClosed_r(GEOSContextHandle_t handle, + const GEOSGeometry *g); + +/************************************************************************ + * + * Dimensionally Extended 9 Intersection Model related + * + ***********************************************************************/ + +/* These are for use with GEOSRelateBoundaryNodeRule (flags param) */ +enum GEOSRelateBoundaryNodeRules { + /* MOD2 and OGC are the same rule, and is the default + * used by GEOSRelatePattern + */ + GEOSRELATE_BNR_MOD2=1, + GEOSRELATE_BNR_OGC=1, + GEOSRELATE_BNR_ENDPOINT=2, + GEOSRELATE_BNR_MULTIVALENT_ENDPOINT=3, + GEOSRELATE_BNR_MONOVALENT_ENDPOINT=4 +}; + +/* return 2 on exception, 1 on true, 0 on false */ +extern char GEOS_DLL GEOSRelatePattern_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2, + const char *pat); + +/* return NULL on exception, a string to GEOSFree otherwise */ +extern char GEOS_DLL *GEOSRelate_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2); + +/* return 2 on exception, 1 on true, 0 on false */ +extern char GEOS_DLL GEOSRelatePatternMatch_r(GEOSContextHandle_t handle, + const char *mat, + const char *pat); + +/* return NULL on exception, a string to GEOSFree otherwise */ +extern char GEOS_DLL *GEOSRelateBoundaryNodeRule_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2, + int bnr); + +/************************************************************************ + * + * Validity checking + * + ***********************************************************************/ + +/* These are for use with GEOSisValidDetail (flags param) */ +enum GEOSValidFlags { + GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE=1 +}; + +/* return 2 on exception, 1 on true, 0 on false */ +extern char GEOS_DLL GEOSisValid_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* return NULL on exception, a string to GEOSFree otherwise */ +extern char GEOS_DLL *GEOSisValidReason_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Caller has the responsibility to destroy 'reason' (GEOSFree) + * and 'location' (GEOSGeom_destroy) params + * return 2 on exception, 1 when valid, 0 when invalid + */ +extern char GEOS_DLL GEOSisValidDetail_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, + int flags, + char** reason, + GEOSGeometry** location); + +extern GEOSGeometry GEOS_DLL *GEOSMakeValid_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/************************************************************************ + * + * Geometry info + * + ***********************************************************************/ + +/* Return NULL on exception, result must be freed by caller. */ +extern char GEOS_DLL *GEOSGeomType_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSGeomTypeId_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Return 0 on exception */ +extern int GEOS_DLL GEOSGetSRID_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +extern void GEOS_DLL GEOSSetSRID_r(GEOSContextHandle_t handle, + GEOSGeometry* g, int SRID); + +extern void GEOS_DLL *GEOSGeom_getUserData_r(GEOSContextHandle_t handle, +const GEOSGeometry* g); + +extern void GEOS_DLL GEOSGeom_setUserData_r(GEOSContextHandle_t handle, + GEOSGeometry* g, void* userData); + +/* May be called on all geometries in GEOS 3.x, returns -1 on error and 1 + * for non-multi geometries. Older GEOS versions only accept + * GeometryCollections or Multi* geometries here, and are likely to crash + * when fed simple geometries, so beware if you need compatibility with + * old GEOS versions. + */ +extern int GEOS_DLL GEOSGetNumGeometries_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Return NULL on exception. + * Returned object is a pointer to internal storage: + * it must NOT be destroyed directly. + * Up to GEOS 3.2.0 the input geometry must be a Collection, in + * later version it doesn't matter (getGeometryN(0) for a single will + * return the input). + */ +extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g, int n); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSNormalize_r(GEOSContextHandle_t handle, + GEOSGeometry* g); + +/** This option causes #GEOSGeom_setPrecision_r() + * to not attempt at preserving the topology */ +#define GEOS_PREC_NO_TOPO (1<<0) + +/** This option causes #GEOSGeom_setPrecision_r() + * to retain collapsed elements */ +#define GEOS_PREC_KEEP_COLLAPSED (1<<1) + +/** + * Set the geometry's precision, optionally rounding all its + * coordinates to the precision grid (if it changes). + * + * Note that operations will always be performed in the precision + * of the geometry with higher precision (smaller "gridSize"). + * That same precision will be attached to the operation outputs. + * + * @param gridSize size of the precision grid, or 0 for FLOATING + * precision. + * @param flags The bitwise OR of one of more of the + * @ref GEOS_PREC_NO_TOPO "precision options" + * @retuns NULL on exception or a new GEOSGeometry object + * + */ +extern GEOSGeometry GEOS_DLL *GEOSGeom_setPrecision_r( + GEOSContextHandle_t handle, + const GEOSGeometry *g, + double gridSize, int flags); + +/** + * Get a geometry's precision + * + * @return the size of the geometry's precision grid, 0 for FLOATING + * precision or -1 on exception + */ +extern double GEOS_DLL GEOSGeom_getPrecision_r( + GEOSContextHandle_t handle, + const GEOSGeometry *g); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSGetNumInteriorRings_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Return -1 on exception, Geometry must be a LineString. */ +extern int GEOS_DLL GEOSGeomGetNumPoints_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Return 0 on exception, otherwise 1, Geometry must be a Point. */ +extern int GEOS_DLL GEOSGeomGetX_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *x); +extern int GEOS_DLL GEOSGeomGetY_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *y); +extern int GEOS_DLL GEOSGeomGetZ_r(GEOSContextHandle_t handle, const GEOSGeometry *g, double *z); + +/* + * Return NULL on exception, Geometry must be a Polygon. + * Returned object is a pointer to internal storage: + * it must NOT be destroyed directly. + */ +extern const GEOSGeometry GEOS_DLL *GEOSGetInteriorRingN_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g, int n); + +/* + * Return NULL on exception, Geometry must be a Polygon. + * Returned object is a pointer to internal storage: + * it must NOT be destroyed directly. + */ +extern const GEOSGeometry GEOS_DLL *GEOSGetExteriorRing_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSGetNumCoordinates_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Return NULL on exception. + * Geometry must be a LineString, LinearRing or Point. + */ +extern const GEOSCoordSequence GEOS_DLL *GEOSGeom_getCoordSeq_r( + GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Return 0 on exception (or empty geometry) + */ +extern int GEOS_DLL GEOSGeom_getDimensions_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); + +/* + * Return 2 or 3. + */ +extern int GEOS_DLL GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t handle, + const GEOSGeometry* g); +/* + * Return 0 on exception + */ +extern int GEOS_DLL GEOSGeom_getXMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value); +extern int GEOS_DLL GEOSGeom_getYMin_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value); +extern int GEOS_DLL GEOSGeom_getXMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value); +extern int GEOS_DLL GEOSGeom_getYMax_r(GEOSContextHandle_t handle, const GEOSGeometry* g, double* value); + +/* + * Return NULL on exception. + * Must be LineString and must be freed by called. + */ +extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN_r(GEOSContextHandle_t handle, const GEOSGeometry *g, int n); +extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g); +extern GEOSGeometry GEOS_DLL *GEOSGeomGetEndPoint_r(GEOSContextHandle_t handle, const GEOSGeometry *g); + +/************************************************************************ + * + * Misc functions + * + ***********************************************************************/ + +/* Return 0 on exception, 1 otherwise */ +extern int GEOS_DLL GEOSArea_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, double *area); +extern int GEOS_DLL GEOSLength_r(GEOSContextHandle_t handle, + const GEOSGeometry* g, double *length); +extern int GEOS_DLL GEOSDistance_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2, double *dist); +extern int GEOS_DLL GEOSDistanceIndexed_r(GEOSContextHandle_t handle, + const GEOSGeometry* g1, + const GEOSGeometry* g2, double *dist); +extern int GEOS_DLL GEOSHausdorffDistance_r(GEOSContextHandle_t handle, + const GEOSGeometry *g1, + const GEOSGeometry *g2, + double *dist); +extern int GEOS_DLL GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t handle, + const GEOSGeometry *g1, + const GEOSGeometry *g2, + double densifyFrac, double *dist); +extern int GEOS_DLL GEOSFrechetDistance_r(GEOSContextHandle_t handle, + const GEOSGeometry *g1, + const GEOSGeometry *g2, + double *dist); +extern int GEOS_DLL GEOSFrechetDistanceDensify_r(GEOSContextHandle_t handle, + const GEOSGeometry *g1, + const GEOSGeometry *g2, + double densifyFrac, double *dist); +extern int GEOS_DLL GEOSGeomGetLength_r(GEOSContextHandle_t handle, + const GEOSGeometry *g, double *length); + +/* Return 0 on exception, the closest points of the two geometries otherwise. + * The first point comes from g1 geometry and the second point comes from g2. + */ +extern GEOSCoordSequence GEOS_DLL *GEOSNearestPoints_r( + GEOSContextHandle_t handle, const GEOSGeometry* g1, const GEOSGeometry* g2); + + +/************************************************************************ + * + * Algorithms + * + ***********************************************************************/ + +/* Walking from A to B: + * return -1 if reaching P takes a counter-clockwise (left) turn + * return 1 if reaching P takes a clockwise (right) turn + * return 0 if P is collinear with A-B + * + * On exceptions, return 2. + * + */ +extern int GEOS_DLL GEOSOrientationIndex_r(GEOSContextHandle_t handle, + double Ax, double Ay, double Bx, double By, double Px, double Py); + + +/************************************************************************ + * + * Reader and Writer APIs + * + ***********************************************************************/ + +typedef struct GEOSWKTReader_t GEOSWKTReader; +typedef struct GEOSWKTWriter_t GEOSWKTWriter; +typedef struct GEOSWKBReader_t GEOSWKBReader; +typedef struct GEOSWKBWriter_t GEOSWKBWriter; + + +/* WKT Reader */ +extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create_r( + GEOSContextHandle_t handle); +extern void GEOS_DLL GEOSWKTReader_destroy_r(GEOSContextHandle_t handle, + GEOSWKTReader* reader); +extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read_r(GEOSContextHandle_t handle, + GEOSWKTReader* reader, + const char *wkt); + +/* WKT Writer */ +extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create_r( + GEOSContextHandle_t handle); +extern void GEOS_DLL GEOSWKTWriter_destroy_r(GEOSContextHandle_t handle, + GEOSWKTWriter* writer); +extern char GEOS_DLL *GEOSWKTWriter_write_r(GEOSContextHandle_t handle, + GEOSWKTWriter* writer, + const GEOSGeometry* g); +extern void GEOS_DLL GEOSWKTWriter_setTrim_r(GEOSContextHandle_t handle, + GEOSWKTWriter *writer, + char trim); +extern void GEOS_DLL GEOSWKTWriter_setRoundingPrecision_r(GEOSContextHandle_t handle, + GEOSWKTWriter *writer, + int precision); +extern void GEOS_DLL GEOSWKTWriter_setOutputDimension_r(GEOSContextHandle_t handle, + GEOSWKTWriter *writer, + int dim); +extern int GEOS_DLL GEOSWKTWriter_getOutputDimension_r(GEOSContextHandle_t handle, + GEOSWKTWriter *writer); +extern void GEOS_DLL GEOSWKTWriter_setOld3D_r(GEOSContextHandle_t handle, + GEOSWKTWriter *writer, + int useOld3D); + +/* WKB Reader */ +extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create_r( + GEOSContextHandle_t handle); +extern void GEOS_DLL GEOSWKBReader_destroy_r(GEOSContextHandle_t handle, + GEOSWKBReader* reader); +extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read_r(GEOSContextHandle_t handle, + GEOSWKBReader* reader, + const unsigned char *wkb, + size_t size); +extern GEOSGeometry GEOS_DLL *GEOSWKBReader_readHEX_r( + GEOSContextHandle_t handle, + GEOSWKBReader* reader, + const unsigned char *hex, + size_t size); + +/* WKB Writer */ +extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create_r( + GEOSContextHandle_t handle); +extern void GEOS_DLL GEOSWKBWriter_destroy_r(GEOSContextHandle_t handle, + GEOSWKBWriter* writer); + +/* The caller owns the results for these two methods! */ +extern unsigned char GEOS_DLL *GEOSWKBWriter_write_r( + GEOSContextHandle_t handle, + GEOSWKBWriter* writer, + const GEOSGeometry* g, + size_t *size); +extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX_r( + GEOSContextHandle_t handle, + GEOSWKBWriter* writer, + const GEOSGeometry* g, + size_t *size); + +/* + * Specify whether output WKB should be 2d or 3d. + * Return previously set number of dimensions. + */ +extern int GEOS_DLL GEOSWKBWriter_getOutputDimension_r( + GEOSContextHandle_t handle, + const GEOSWKBWriter* writer); +extern void GEOS_DLL GEOSWKBWriter_setOutputDimension_r( + GEOSContextHandle_t handle, + GEOSWKBWriter* writer, int newDimension); + +/* + * Specify whether the WKB byte order is big or little endian. + * The return value is the previous byte order. + */ +extern int GEOS_DLL GEOSWKBWriter_getByteOrder_r(GEOSContextHandle_t handle, + const GEOSWKBWriter* writer); +extern void GEOS_DLL GEOSWKBWriter_setByteOrder_r(GEOSContextHandle_t handle, + GEOSWKBWriter* writer, + int byteOrder); + +/* + * Specify whether SRID values should be output. + */ +extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID_r(GEOSContextHandle_t handle, + const GEOSWKBWriter* writer); +extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID_r(GEOSContextHandle_t handle, + GEOSWKBWriter* writer, const char writeSRID); + + +/* + * Free buffers returned by stuff like GEOSWKBWriter_write(), + * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write(). + */ +extern void GEOS_DLL GEOSFree_r(GEOSContextHandle_t handle, void *buffer); + + +/* External code to GEOS can define GEOS_USE_ONLY_R_API to avoid the */ +/* non _r API to be available */ +#ifndef GEOS_USE_ONLY_R_API + +/************************************************************************ + * + * Initialization, cleanup, version + * + ***********************************************************************/ + +extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function, + GEOSMessageHandler error_function); +extern void GEOS_DLL finishGEOS(void); + +/************************************************************************ + * + * NOTE - These functions are DEPRECATED. Please use the new Reader and + * writer APIS! + * + ***********************************************************************/ + +extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKT(const char *wkt); +extern char GEOS_DLL *GEOSGeomToWKT(const GEOSGeometry* g); + +/* + * Specify whether output WKB should be 2d or 3d. + * Return previously set number of dimensions. + */ +extern int GEOS_DLL GEOS_getWKBOutputDims(); +extern int GEOS_DLL GEOS_setWKBOutputDims(int newDims); + +/* + * Specify whether the WKB byte order is big or little endian. + * The return value is the previous byte order. + */ +extern int GEOS_DLL GEOS_getWKBByteOrder(); +extern int GEOS_DLL GEOS_setWKBByteOrder(int byteOrder); + +extern GEOSGeometry GEOS_DLL *GEOSGeomFromWKB_buf(const unsigned char *wkb, size_t size); +extern unsigned char GEOS_DLL *GEOSGeomToWKB_buf(const GEOSGeometry* g, size_t *size); + +extern GEOSGeometry GEOS_DLL *GEOSGeomFromHEX_buf(const unsigned char *hex, size_t size); +extern unsigned char GEOS_DLL *GEOSGeomToHEX_buf(const GEOSGeometry* g, size_t *size); + +/************************************************************************ + * + * Coordinate Sequence functions + * + ***********************************************************************/ + +/* + * Create a Coordinate sequence with ``size'' coordinates + * of ``dims'' dimensions. + * Return NULL on exception. + */ +extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_create(unsigned int size, unsigned int dims); + +/* + * Clone a Coordinate Sequence. + * Return NULL on exception. + */ +extern GEOSCoordSequence GEOS_DLL *GEOSCoordSeq_clone(const GEOSCoordSequence* s); + +/* + * Destroy a Coordinate Sequence. + */ +extern void GEOS_DLL GEOSCoordSeq_destroy(GEOSCoordSequence* s); + +/* + * Set ordinate values in a Coordinate Sequence. + * Return 0 on exception. + */ +extern int GEOS_DLL GEOSCoordSeq_setX(GEOSCoordSequence* s, + unsigned int idx, double val); +extern int GEOS_DLL GEOSCoordSeq_setY(GEOSCoordSequence* s, + unsigned int idx, double val); +extern int GEOS_DLL GEOSCoordSeq_setZ(GEOSCoordSequence* s, + unsigned int idx, double val); +extern int GEOS_DLL GEOSCoordSeq_setXY(GEOSCoordSequence* s, + unsigned int idx, double x, double y); +extern int GEOS_DLL GEOSCoordSeq_setXYZ(GEOSCoordSequence* s, + unsigned int idx, double x, double y, double z); +extern int GEOS_DLL GEOSCoordSeq_setOrdinate(GEOSCoordSequence* s, + unsigned int idx, unsigned int dim, double val); + +/* + * Get ordinate values from a Coordinate Sequence. + * Return 0 on exception. + */ +extern int GEOS_DLL GEOSCoordSeq_getX(const GEOSCoordSequence* s, + unsigned int idx, double *val); +extern int GEOS_DLL GEOSCoordSeq_getY(const GEOSCoordSequence* s, + unsigned int idx, double *val); +extern int GEOS_DLL GEOSCoordSeq_getZ(const GEOSCoordSequence* s, + unsigned int idx, double *val); +extern int GEOS_DLL GEOSCoordSeq_getXY(const GEOSCoordSequence* s, + unsigned int idx, double *x, double *y); +extern int GEOS_DLL GEOSCoordSeq_getXYZ(const GEOSCoordSequence* s, + unsigned int idx, double *x, double *y, double *z); +extern int GEOS_DLL GEOSCoordSeq_getOrdinate(const GEOSCoordSequence* s, + unsigned int idx, unsigned int dim, double *val); +/* + * Get size and dimensions info from a Coordinate Sequence. + * Return 0 on exception. + */ +extern int GEOS_DLL GEOSCoordSeq_getSize(const GEOSCoordSequence* s, + unsigned int *size); +extern int GEOS_DLL GEOSCoordSeq_getDimensions(const GEOSCoordSequence* s, + unsigned int *dims); + +/* + * Check orientation of a CoordinateSequence and set 'is_ccw' to 1 + * if it has counter-clockwise orientation, 0 otherwise. + * Return 0 on exception, 1 on success. + */ +extern int GEOS_DLL GEOSCoordSeq_isCCW(const GEOSCoordSequence* s, char* is_ccw); + +/************************************************************************ + * + * Linear referencing functions -- there are more, but these are + * probably sufficient for most purposes + * + ***********************************************************************/ + +/* + * GEOSGeometry ownership is retained by caller + */ + + +/* Return distance of point 'p' projected on 'g' from origin + * of 'g'. Geometry 'g' must be a lineal geometry */ +extern double GEOS_DLL GEOSProject(const GEOSGeometry *g, + const GEOSGeometry* p); + +/* Return closest point to given distance within geometry + * Geometry must be a LineString */ +extern GEOSGeometry GEOS_DLL *GEOSInterpolate(const GEOSGeometry *g, + double d); + +extern double GEOS_DLL GEOSProjectNormalized(const GEOSGeometry *g, + const GEOSGeometry* p); + +extern GEOSGeometry GEOS_DLL *GEOSInterpolateNormalized(const GEOSGeometry *g, + double d); + +/************************************************************************ + * + * Buffer related functions + * + ***********************************************************************/ + + +/* @return NULL on exception */ +extern GEOSGeometry GEOS_DLL *GEOSBuffer(const GEOSGeometry* g, + double width, int quadsegs); + +/* @return 0 on exception */ +extern GEOSBufferParams GEOS_DLL *GEOSBufferParams_create(); +extern void GEOS_DLL GEOSBufferParams_destroy(GEOSBufferParams* parms); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setEndCapStyle( + GEOSBufferParams* p, + int style); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setJoinStyle( + GEOSBufferParams* p, + int joinStyle); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setMitreLimit( + GEOSBufferParams* p, + double mitreLimit); + +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setQuadrantSegments( + GEOSBufferParams* p, + int quadSegs); + +/* @param singleSided: 1 for single sided, 0 otherwise */ +/* @return 0 on exception */ +extern int GEOS_DLL GEOSBufferParams_setSingleSided( + GEOSBufferParams* p, + int singleSided); + +/* @return NULL on exception */ +extern GEOSGeometry GEOS_DLL *GEOSBufferWithParams( + const GEOSGeometry* g, + const GEOSBufferParams* p, + double width); + +/* These functions return NULL on exception. */ +extern GEOSGeometry GEOS_DLL *GEOSBufferWithStyle(const GEOSGeometry* g, + double width, int quadsegs, int endCapStyle, int joinStyle, + double mitreLimit); + +/* These functions return NULL on exception. Only LINESTRINGs are accepted. */ +/* @deprecated in 3.3.0: use GEOSOffsetCurve instead */ +extern GEOSGeometry GEOS_DLL *GEOSSingleSidedBuffer(const GEOSGeometry* g, + double width, int quadsegs, int joinStyle, double mitreLimit, + int leftSide); + +/* + * Only LINESTRINGs are accepted. + * @param width : offset distance. + * negative for right side offset. + * positive for left side offset. + * @return NULL on exception + */ +extern GEOSGeometry GEOS_DLL *GEOSOffsetCurve(const GEOSGeometry* g, + double width, int quadsegs, int joinStyle, double mitreLimit); + +/************************************************************************ + * + * Geometry Constructors. + * GEOSCoordSequence* arguments will become ownership of the returned object. + * All functions return NULL on exception. + * + ***********************************************************************/ + +extern GEOSGeometry GEOS_DLL *GEOSGeom_createPoint(GEOSCoordSequence* s); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createPointFromXY(double x, double y); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPoint(); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing(GEOSCoordSequence* s); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createLineString(GEOSCoordSequence* s); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyLineString(); + +/* + * Second argument is an array of GEOSGeometry* objects. + * The caller remains owner of the array, but pointed-to + * objects become ownership of the returned GEOSGeometry. + */ +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPolygon(); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createPolygon(GEOSGeometry* shell, + GEOSGeometry** holes, unsigned int nholes); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createCollection(int type, + GEOSGeometry* *geoms, unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyCollection(int type); + +extern GEOSGeometry GEOS_DLL *GEOSGeom_clone(const GEOSGeometry* g); + +/************************************************************************ + * + * Memory management + * + ***********************************************************************/ + +extern void GEOS_DLL GEOSGeom_destroy(GEOSGeometry* g); + +/************************************************************************ + * + * Topology operations - return NULL on exception. + * + ***********************************************************************/ + +extern GEOSGeometry GEOS_DLL *GEOSEnvelope(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSIntersection(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSConvexHull(const GEOSGeometry* g); + +/* Returns the minimum rotated rectangular POLYGON which encloses the input geometry. The rectangle + * has width equal to the minimum diameter, and a longer length. If the convex hill of the input is + * degenerate (a line or point) a LINESTRING or POINT is returned. The minimum rotated rectangle can + * be used as an extremely generalized representation for the given geometry. + */ +extern GEOSGeometry GEOS_DLL *GEOSMinimumRotatedRectangle(const GEOSGeometry* g); + +/* Returns a LINESTRING geometry which represents the minimum diameter of the geometry. + * The minimum diameter is defined to be the width of the smallest band that + * contains the geometry, where a band is a strip of the plane defined + * by two parallel lines. This can be thought of as the smallest hole that the geometry + * can be moved through, with a single rotation. + */ +extern GEOSGeometry GEOS_DLL *GEOSMinimumWidth(const GEOSGeometry* g); + +/* Computes the minimum clearance of a geometry. The minimum clearance is the smallest amount by which + * a vertex could be move to produce an invalid polygon, a non-simple linestring, or a multipoint with + * repeated points. If a geometry has a minimum clearance of 'eps', it can be said that: + * + * - No two distinct vertices in the geometry are separated by less than 'eps' + * - No vertex is closer than 'eps' to a line segment of which it is not an endpoint. + * + * If the minimum clearance cannot be defined for a geometry (such as with a single point, or a multipoint + * whose points are identical, a value of Infinity will be calculated. + * + * @param g the input geometry + * @param d a double to which the result can be stored + * + * @return 0 if no exception occurred + * 2 if an exception occurred + */ +extern int GEOS_DLL GEOSMinimumClearance(const GEOSGeometry* g, double* d); + +/* Returns a LineString whose endpoints define the minimum clearance of a geometry. + * If the geometry has no minimum clearance, an empty LineString will be returned. + * + * @param g the input geometry + * @return a LineString, or NULL if an exception occurred. + */ +extern GEOSGeometry GEOS_DLL *GEOSMinimumClearanceLine(const GEOSGeometry* g); + +extern GEOSGeometry GEOS_DLL *GEOSDifference(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSSymDifference(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSBoundary(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSUnion(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern GEOSGeometry GEOS_DLL *GEOSUnaryUnion(const GEOSGeometry* g); + +/* GEOSCoverageUnion is an optimized union algorithm for polygonal inputs that are correctly + * noded and do not overlap. It will not generate an error (return NULL) for inputs that + * do not satisfy this constraint. */ +extern GEOSGeometry GEOS_DLL *GEOSCoverageUnion(const GEOSGeometry *g); + +/* @deprecated in 3.3.0: use GEOSUnaryUnion instead */ +extern GEOSGeometry GEOS_DLL *GEOSUnionCascaded(const GEOSGeometry* g); + +extern GEOSGeometry GEOS_DLL *GEOSPointOnSurface(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSGetCentroid(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSMinimumBoundingCircle(const GEOSGeometry* g, double* radius, GEOSGeometry** center); +extern GEOSGeometry GEOS_DLL *GEOSNode(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSClipByRect(const GEOSGeometry* g, double xmin, double ymin, double xmax, double ymax); + +/* + * all arguments remain ownership of the caller + * (both Geometries and pointers) + */ +extern GEOSGeometry GEOS_DLL *GEOSPolygonize(const GEOSGeometry * const geoms[], unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSPolygonize_valid(const GEOSGeometry * const geoms[], unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSPolygonizer_getCutEdges(const GEOSGeometry * const geoms[], unsigned int ngeoms); +extern GEOSGeometry GEOS_DLL *GEOSPolygonize_full(const GEOSGeometry* input, + GEOSGeometry** cuts, GEOSGeometry** dangles, GEOSGeometry** invalid); + +extern GEOSGeometry GEOS_DLL *GEOSBuildArea(const GEOSGeometry* g); + +extern GEOSGeometry GEOS_DLL *GEOSLineMerge(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSReverse(const GEOSGeometry* g); +extern GEOSGeometry GEOS_DLL *GEOSSimplify(const GEOSGeometry* g, double tolerance); +extern GEOSGeometry GEOS_DLL *GEOSTopologyPreserveSimplify(const GEOSGeometry* g, + double tolerance); + +/* + * Return all distinct vertices of input geometry as a MULTIPOINT. + * Note that only 2 dimensions of the vertices are considered when + * testing for equality. + */ +extern GEOSGeometry GEOS_DLL *GEOSGeom_extractUniquePoints( + const GEOSGeometry* g); + +/* + * Find paths shared between the two given lineal geometries. + * + * Returns a GEOMETRYCOLLECTION having two elements: + * - first element is a MULTILINESTRING containing shared paths + * having the _same_ direction on both inputs + * - second element is a MULTILINESTRING containing shared paths + * having the _opposite_ direction on the two inputs + * + * Returns NULL on exception + */ +extern GEOSGeometry GEOS_DLL *GEOSSharedPaths(const GEOSGeometry* g1, + const GEOSGeometry* g2); + +/* + * Snap first geometry on to second with given tolerance + * Returns a newly allocated geometry, or NULL on exception + */ +extern GEOSGeometry GEOS_DLL *GEOSSnap(const GEOSGeometry* g1, + const GEOSGeometry* g2, double tolerance); + +/* + * Return a Delaunay triangulation of the vertex of the given geometry + * + * @param g the input geometry whose vertex will be used as "sites" + * @param tolerance optional snapping tolerance to use for improved robustness + * @param onlyEdges if non-zero will return a MULTILINESTRING, otherwise it will + * return a GEOMETRYCOLLECTION containing triangular POLYGONs. + * + * @return a newly allocated geometry, or NULL on exception + */ +extern GEOSGeometry GEOS_DLL * GEOSDelaunayTriangulation( + const GEOSGeometry *g, + double tolerance, + int onlyEdges); + +/* + * Returns the Voronoi polygons of a set of Vertices given as input + * + * @param g the input geometry whose vertex will be used as sites. + * @param tolerance snapping tolerance to use for improved robustness + * @param onlyEdges whether to return only edges of the voronoi cells + * @param env clipping envelope for the returned diagram, automatically + * determined if NULL. + * The diagram will be clipped to the larger + * of this envelope or an envelope surrounding the sites. + * + * @return a newly allocated geometry, or NULL on exception. + */ +extern GEOSGeometry GEOS_DLL * GEOSVoronoiDiagram( + const GEOSGeometry *g, + const GEOSGeometry *env, + double tolerance, + int onlyEdges); +/* + * Computes the coordinate where two line segments intersect, if any + * + * @param ax0 x-coordinate of first point in first segment + * @param ay0 y-coordinate of first point in first segment + * @param ax1 x-coordinate of second point in first segment + * @param ay1 y-coordinate of second point in first segment + * @param bx0 x-coordinate of first point in second segment + * @param by0 y-coordinate of first point in second segment + * @param bx1 x-coordinate of second point in second segment + * @param by1 y-coordinate of second point in second segment + * @param cx x-coordinate of intersection point + * @param cy y-coordinate of intersection point + * + * @return 0 on error, 1 on success, -1 if segments do not intersect + */ + +extern int GEOS_DLL GEOSSegmentIntersection( + double ax0, double ay0, + double ax1, double ay1, + double bx0, double by0, + double bx1, double by1, + double* cx, double* cy); + +/************************************************************************ + * + * Binary predicates - return 2 on exception, 1 on true, 0 on false + * + ***********************************************************************/ + +extern char GEOS_DLL GEOSDisjoint(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSTouches(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSIntersects(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSCrosses(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSWithin(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSContains(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSOverlaps(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSEquals(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSCovers(const GEOSGeometry* g1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSCoveredBy(const GEOSGeometry* g1, const GEOSGeometry* g2); + +/** + * Determine pointwise equivalence of two geometries, by checking if each vertex of g2 is + * within tolerance of the corresponding vertex in g1. + * Unlike GEOSEquals, geometries that are topologically equivalent but have different + * representations (e.g., LINESTRING (0 0, 1 1) and MULTILINESTRING ((0 0, 1 1)) ) are not + * considered equivalent by GEOSEqualsExact. + * returns 2 on exception, 1 on true, 0 on false + */ +extern char GEOS_DLL GEOSEqualsExact(const GEOSGeometry* g1, const GEOSGeometry* g2, double tolerance); + +/************************************************************************ + * + * Prepared Geometry Binary predicates - return 2 on exception, 1 on true, 0 on false + * + ***********************************************************************/ + +/* + * GEOSGeometry ownership is retained by caller + */ +extern const GEOSPreparedGeometry GEOS_DLL *GEOSPrepare(const GEOSGeometry* g); + +extern void GEOS_DLL GEOSPreparedGeom_destroy(const GEOSPreparedGeometry* g); + +extern char GEOS_DLL GEOSPreparedContains(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedContainsProperly(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedCoveredBy(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedCovers(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedCrosses(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedDisjoint(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedIntersects(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedOverlaps(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedTouches(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); +extern char GEOS_DLL GEOSPreparedWithin(const GEOSPreparedGeometry* pg1, const GEOSGeometry* g2); + +/************************************************************************ + * + * STRtree functions + * + ***********************************************************************/ + +/* + * GEOSGeometry ownership is retained by caller + */ + +/* + * Create a new R-tree using the Sort-Tile-Recursive algorithm (STRtree) for two-dimensional + * spatial data. + * + * @param nodeCapacity the maximum number of child nodes that a node may have. The minimum + * recommended capacity value is 4. If unsure, use a default node capacity of 10. + * @return a pointer to the created tree + */ +extern GEOSSTRtree GEOS_DLL *GEOSSTRtree_create(size_t nodeCapacity); + +/* + * Insert an item into an STRtree + * + * @param tree the STRtree in which the item should be inserted + * @param g a GEOSGeometry whose envelope corresponds to the extent of 'item' + * @param item the item to insert into the tree + */ +extern void GEOS_DLL GEOSSTRtree_insert(GEOSSTRtree *tree, + const GEOSGeometry *g, + void *item); + +/* + * Query an STRtree for items intersecting a specified envelope + * + * @param tree the STRtree to search + * @param g a GEOSGeomety from which a query envelope will be extracted + * @param callback a function to be executed for each item in the tree whose envelope intersects + * the envelope of 'g'. The callback function should take two parameters: a void + * pointer representing the located item in the tree, and a void userdata pointer. + * @param userdata an optional pointer to pe passed to 'callback' as an argument + */ +extern void GEOS_DLL GEOSSTRtree_query(GEOSSTRtree *tree, + const GEOSGeometry *g, + GEOSQueryCallback callback, + void *userdata); +/* + * Returns the nearest item in the STRtree to the supplied GEOSGeometry. + * All items in the tree MUST be of type GEOSGeometry. If this is not the case, use + * GEOSSTRtree_nearest_generic instead. +* + * @param tree the STRtree to search + * @param geom the geometry with which the tree should be queried + * @return a const pointer to the nearest GEOSGeometry in the tree to 'geom', or NULL in + * case of exception + */ +extern const GEOSGeometry GEOS_DLL *GEOSSTRtree_nearest(GEOSSTRtree *tree, const GEOSGeometry* geom); + +/* + * Returns the nearest item in the STRtree to the supplied item + * + * @param tree the STRtree to search + * @param item the item with which the tree should be queried + * @param itemEnvelope a GEOSGeometry having the bounding box of 'item' + * @param distancefn a function that can compute the distance between two items + * in the STRtree. The function should return zero in case of error, + * and should store the computed distance to the location pointed to by + * the 'distance' argument. The computed distance between two items + * must not exceed the Cartesian distance between their envelopes. + * @param userdata optional pointer to arbitrary data; will be passed to distancefn + * each time it is called. + * @return a const pointer to the nearest item in the tree to 'item', or NULL in + * case of exception + */ +extern const void GEOS_DLL *GEOSSTRtree_nearest_generic(GEOSSTRtree *tree, + const void* item, + const GEOSGeometry* itemEnvelope, + GEOSDistanceCallback distancefn, + void* userdata); +/* + * Iterates over all items in the STRtree + * + * @param tree the STRtree over which to iterate + * @param callback a function to be executed for each item in the tree. + */ +extern void GEOS_DLL GEOSSTRtree_iterate(GEOSSTRtree *tree, + GEOSQueryCallback callback, + void *userdata); + +/* + * Removes an item from the STRtree + * + * @param tree the STRtree from which to remove an item + * @param g the envelope of the item to remove + * @param the item to remove + * @return 0 if the item was not removed; + * 1 if the item was removed; + * 2 if an exception occurred + */ +extern char GEOS_DLL GEOSSTRtree_remove(GEOSSTRtree *tree, + const GEOSGeometry *g, + void *item); +extern void GEOS_DLL GEOSSTRtree_destroy(GEOSSTRtree *tree); + + +/************************************************************************ + * + * Unary predicate - return 2 on exception, 1 on true, 0 on false + * + ***********************************************************************/ + +extern char GEOS_DLL GEOSisEmpty(const GEOSGeometry* g); +extern char GEOS_DLL GEOSisSimple(const GEOSGeometry* g); +extern char GEOS_DLL GEOSisRing(const GEOSGeometry* g); +extern char GEOS_DLL GEOSHasZ(const GEOSGeometry* g); +extern char GEOS_DLL GEOSisClosed(const GEOSGeometry *g); + +/************************************************************************ + * + * Dimensionally Extended 9 Intersection Model related + * + ***********************************************************************/ + +/* return 2 on exception, 1 on true, 0 on false */ +extern char GEOS_DLL GEOSRelatePattern(const GEOSGeometry* g1, const GEOSGeometry* g2, const char *pat); + +/* return NULL on exception, a string to GEOSFree otherwise */ +extern char GEOS_DLL *GEOSRelate(const GEOSGeometry* g1, const GEOSGeometry* g2); + +/* return 2 on exception, 1 on true, 0 on false */ +extern char GEOS_DLL GEOSRelatePatternMatch(const char *mat, const char *pat); + +/* return NULL on exception, a string to GEOSFree otherwise */ +extern char GEOS_DLL *GEOSRelateBoundaryNodeRule(const GEOSGeometry* g1, + const GEOSGeometry* g2, + int bnr); + +/************************************************************************ + * + * Validity checking + * + ***********************************************************************/ + +/* return 2 on exception, 1 on true, 0 on false */ +extern char GEOS_DLL GEOSisValid(const GEOSGeometry* g); + +/* return NULL on exception, a string to GEOSFree otherwise */ +extern char GEOS_DLL *GEOSisValidReason(const GEOSGeometry *g); +/* + * Caller has the responsibility to destroy 'reason' (GEOSFree) + * and 'location' (GEOSGeom_destroy) params + * return 2 on exception, 1 when valid, 0 when invalid + * Use enum GEOSValidFlags values for the flags param. + */ +extern char GEOS_DLL GEOSisValidDetail(const GEOSGeometry* g, + int flags, + char** reason, GEOSGeometry** location); + +extern GEOSGeometry GEOS_DLL *GEOSMakeValid(const GEOSGeometry* g); + +/************************************************************************ + * + * Geometry info + * + ***********************************************************************/ + +/* Return NULL on exception, result must be freed by caller. */ +extern char GEOS_DLL *GEOSGeomType(const GEOSGeometry* g); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSGeomTypeId(const GEOSGeometry* g); + +/* Return 0 on exception */ +extern int GEOS_DLL GEOSGetSRID(const GEOSGeometry* g); + +extern void GEOS_DLL GEOSSetSRID(GEOSGeometry* g, int SRID); + +extern void GEOS_DLL *GEOSGeom_getUserData(const GEOSGeometry* g); + +extern void GEOS_DLL GEOSGeom_setUserData(GEOSGeometry* g, void* userData); + + +/* May be called on all geometries in GEOS 3.x, returns -1 on error and 1 + * for non-multi geometries. Older GEOS versions only accept + * GeometryCollections or Multi* geometries here, and are likely to crash + * when fed simple geometries, so beware if you need compatibility with + * old GEOS versions. + */ +extern int GEOS_DLL GEOSGetNumGeometries(const GEOSGeometry* g); + +/* + * Return NULL on exception. + * Returned object is a pointer to internal storage: + * it must NOT be destroyed directly. + * Up to GEOS 3.2.0 the input geometry must be a Collection, in + * later version it doesn't matter (getGeometryN(0) for a single will + * return the input). + */ +extern const GEOSGeometry GEOS_DLL *GEOSGetGeometryN(const GEOSGeometry* g, int n); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSNormalize(GEOSGeometry* g); + +/* Return NULL on exception */ +extern GEOSGeometry GEOS_DLL *GEOSGeom_setPrecision( + const GEOSGeometry *g, double gridSize, int flags); + +/* Return -1 on exception */ +extern double GEOS_DLL GEOSGeom_getPrecision(const GEOSGeometry *g); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSGetNumInteriorRings(const GEOSGeometry* g); + +/* Return -1 on exception, Geometry must be a LineString. */ +extern int GEOS_DLL GEOSGeomGetNumPoints(const GEOSGeometry* g); + +/* Return 0 on exception, otherwise 1, Geometry must be a Point. */ +extern int GEOS_DLL GEOSGeomGetX(const GEOSGeometry *g, double *x); +extern int GEOS_DLL GEOSGeomGetY(const GEOSGeometry *g, double *y); +extern int GEOS_DLL GEOSGeomGetZ(const GEOSGeometry *g, double *z); + +/* + * Return NULL on exception, Geometry must be a Polygon. + * Returned object is a pointer to internal storage: + * it must NOT be destroyed directly. + */ +extern const GEOSGeometry GEOS_DLL *GEOSGetInteriorRingN(const GEOSGeometry* g, int n); + +/* + * Return NULL on exception, Geometry must be a Polygon. + * Returned object is a pointer to internal storage: + * it must NOT be destroyed directly. + */ +extern const GEOSGeometry GEOS_DLL *GEOSGetExteriorRing(const GEOSGeometry* g); + +/* Return -1 on exception */ +extern int GEOS_DLL GEOSGetNumCoordinates(const GEOSGeometry* g); + +/* + * Return NULL on exception. + * Geometry must be a LineString, LinearRing or Point. + */ +extern const GEOSCoordSequence GEOS_DLL *GEOSGeom_getCoordSeq(const GEOSGeometry* g); + +/* + * Return 0 on exception (or empty geometry) + */ +extern int GEOS_DLL GEOSGeom_getDimensions(const GEOSGeometry* g); + +/* + * Return 2 or 3. + */ +extern int GEOS_DLL GEOSGeom_getCoordinateDimension(const GEOSGeometry* g); + +/* + * Return 0 on exception + */ +extern int GEOS_DLL GEOSGeom_getXMin(const GEOSGeometry* g, double* value); +extern int GEOS_DLL GEOSGeom_getYMin(const GEOSGeometry* g, double* value); +extern int GEOS_DLL GEOSGeom_getXMax(const GEOSGeometry* g, double* value); +extern int GEOS_DLL GEOSGeom_getYMax(const GEOSGeometry* g, double* value); + +/* + * Return NULL on exception. + * Must be LineString and must be freed by called. + */ +extern GEOSGeometry GEOS_DLL *GEOSGeomGetPointN(const GEOSGeometry *g, int n); +extern GEOSGeometry GEOS_DLL *GEOSGeomGetStartPoint(const GEOSGeometry *g); +extern GEOSGeometry GEOS_DLL *GEOSGeomGetEndPoint(const GEOSGeometry *g); + +/************************************************************************ + * + * Misc functions + * + ***********************************************************************/ + +/* Return 0 on exception, 1 otherwise */ +extern int GEOS_DLL GEOSArea(const GEOSGeometry* g, double *area); +extern int GEOS_DLL GEOSLength(const GEOSGeometry* g, double *length); +extern int GEOS_DLL GEOSDistance(const GEOSGeometry* g1, const GEOSGeometry* g2, + double *dist); +extern int GEOS_DLL GEOSDistanceIndexed(const GEOSGeometry* g1, const GEOSGeometry* g2, + double *dist); +extern int GEOS_DLL GEOSHausdorffDistance(const GEOSGeometry *g1, + const GEOSGeometry *g2, double *dist); +extern int GEOS_DLL GEOSHausdorffDistanceDensify(const GEOSGeometry *g1, + const GEOSGeometry *g2, double densifyFrac, double *dist); +extern int GEOS_DLL GEOSFrechetDistance(const GEOSGeometry *g1, + const GEOSGeometry *g2, double *dist); +extern int GEOS_DLL GEOSFrechetDistanceDensify(const GEOSGeometry *g1, + const GEOSGeometry *g2, double densifyFrac, double *dist); +extern int GEOS_DLL GEOSGeomGetLength(const GEOSGeometry *g, double *length); + +/* Return 0 on exception, the closest points of the two geometries otherwise. + * The first point comes from g1 geometry and the second point comes from g2. + */ +extern GEOSCoordSequence GEOS_DLL *GEOSNearestPoints( + const GEOSGeometry* g1, const GEOSGeometry* g2); + + +/************************************************************************ + * + * Algorithms + * + ***********************************************************************/ + +/* Walking from A to B: + * return -1 if reaching P takes a counter-clockwise (left) turn + * return 1 if reaching P takes a clockwise (right) turn + * return 0 if P is collinear with A-B + * + * On exceptions, return 2. + * + */ +extern int GEOS_DLL GEOSOrientationIndex(double Ax, double Ay, double Bx, double By, + double Px, double Py); + +/************************************************************************ + * + * Reader and Writer APIs + * + ***********************************************************************/ + +/* WKT Reader */ +extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create(); +extern void GEOS_DLL GEOSWKTReader_destroy(GEOSWKTReader* reader); +extern GEOSGeometry GEOS_DLL *GEOSWKTReader_read(GEOSWKTReader* reader, const char *wkt); + +/* WKT Writer */ +extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create(); +extern void GEOS_DLL GEOSWKTWriter_destroy(GEOSWKTWriter* writer); +extern char GEOS_DLL *GEOSWKTWriter_write(GEOSWKTWriter* writer, const GEOSGeometry* g); +extern void GEOS_DLL GEOSWKTWriter_setTrim(GEOSWKTWriter *writer, char trim); +extern void GEOS_DLL GEOSWKTWriter_setRoundingPrecision(GEOSWKTWriter *writer, int precision); +extern void GEOS_DLL GEOSWKTWriter_setOutputDimension(GEOSWKTWriter *writer, int dim); +extern int GEOS_DLL GEOSWKTWriter_getOutputDimension(GEOSWKTWriter *writer); +extern void GEOS_DLL GEOSWKTWriter_setOld3D(GEOSWKTWriter *writer, int useOld3D); + +/* WKB Reader */ +extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create(); +extern void GEOS_DLL GEOSWKBReader_destroy(GEOSWKBReader* reader); +extern GEOSGeometry GEOS_DLL *GEOSWKBReader_read(GEOSWKBReader* reader, const unsigned char *wkb, size_t size); +extern GEOSGeometry GEOS_DLL *GEOSWKBReader_readHEX(GEOSWKBReader* reader, const unsigned char *hex, size_t size); + +/* WKB Writer */ +extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create(); +extern void GEOS_DLL GEOSWKBWriter_destroy(GEOSWKBWriter* writer); + +/* The caller owns the results for these two methods! */ +extern unsigned char GEOS_DLL *GEOSWKBWriter_write(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size); +extern unsigned char GEOS_DLL *GEOSWKBWriter_writeHEX(GEOSWKBWriter* writer, const GEOSGeometry* g, size_t *size); + +/* + * Specify whether output WKB should be 2d or 3d. + * Return previously set number of dimensions. + */ +extern int GEOS_DLL GEOSWKBWriter_getOutputDimension(const GEOSWKBWriter* writer); +extern void GEOS_DLL GEOSWKBWriter_setOutputDimension(GEOSWKBWriter* writer, int newDimension); + +/* + * Specify whether the WKB byte order is big or little endian. + * The return value is the previous byte order. + */ +extern int GEOS_DLL GEOSWKBWriter_getByteOrder(const GEOSWKBWriter* writer); +extern void GEOS_DLL GEOSWKBWriter_setByteOrder(GEOSWKBWriter* writer, int byteOrder); + +/* + * Specify whether SRID values should be output. + */ +extern char GEOS_DLL GEOSWKBWriter_getIncludeSRID(const GEOSWKBWriter* writer); +extern void GEOS_DLL GEOSWKBWriter_setIncludeSRID(GEOSWKBWriter* writer, const char writeSRID); + +/* + * Free buffers returned by stuff like GEOSWKBWriter_write(), + * GEOSWKBWriter_writeHEX() and GEOSWKTWriter_write(). + */ +extern void GEOS_DLL GEOSFree(void *buffer); + +#endif /* #ifndef GEOS_USE_ONLY_R_API */ + + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* #ifndef GEOS_C_H_INCLUDED */ diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp new file mode 100644 index 0000000..4391b9b --- /dev/null +++ b/capi/geos_ts_c.cpp @@ -0,0 +1,6812 @@ +/************************************************************************ + * + * + * C-Wrapper for GEOS library + * + * Copyright (C) 2010-2012 Sandro Santilli + * Copyright (C) 2005-2006 Refractions Research Inc. + * + * This is free software; you can redistribute and/or modify it under + * the terms of the GNU Lesser General Public Licence as published + * by the Free Software Foundation. + * See the COPYING file for more information. + * + * Author: Sandro Santilli + * Thread Safety modifications: Chuck Thibert + * + ***********************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// This should go away +#include // finite +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4099) +#endif + +// Some extra magic to make type declarations in geos_c.h work - +// for cross-checking of types in header. +#define GEOSGeometry geos::geom::Geometry +#define GEOSPreparedGeometry geos::geom::prep::PreparedGeometry +#define GEOSCoordSequence geos::geom::CoordinateSequence +#define GEOSBufferParams geos::operation::buffer::BufferParameters +#define GEOSSTRtree geos::index::strtree::STRtree +#define GEOSWKTReader_t geos::io::WKTReader +#define GEOSWKTWriter_t geos::io::WKTWriter +#define GEOSWKBReader_t geos::io::WKBReader +#define GEOSWKBWriter_t geos::io::WKBWriter + +#include "geos_c.h" + +// Intentional, to allow non-standard C elements like C99 functions to be +// imported through C++ headers of C library, like . +using namespace std; + +/// Define this if you want operations triggering Exceptions to +/// be printed. +/// (will use the NOTIFY channel - only implemented for GEOSUnion so far) +/// +#undef VERBOSE_EXCEPTIONS + +#include +#include + + +// import the most frequently used definitions globally +using geos::geom::Geometry; +using geos::geom::LineString; +using geos::geom::LinearRing; +using geos::geom::MultiLineString; +using geos::geom::MultiPolygon; +using geos::geom::Polygon; +using geos::geom::CoordinateSequence; +using geos::geom::GeometryCollection; +using geos::geom::GeometryFactory; + +using geos::io::WKTReader; +using geos::io::WKTWriter; +using geos::io::WKBReader; +using geos::io::WKBWriter; + +using geos::operation::overlay::OverlayOp; +using geos::operation::overlay::overlayOp; +using geos::operation::geounion::CascadedPolygonUnion; +using geos::operation::distance::IndexedFacetDistance; +using geos::operation::buffer::BufferParameters; +using geos::operation::buffer::BufferBuilder; +using geos::precision::GeometryPrecisionReducer; +using geos::util::IllegalArgumentException; +using geos::algorithm::distance::DiscreteHausdorffDistance; +using geos::algorithm::distance::DiscreteFrechetDistance; + +typedef std::unique_ptr GeomPtr; + +typedef struct GEOSContextHandle_HS { + const GeometryFactory* geomFactory; + char msgBuffer[1024]; + GEOSMessageHandler noticeMessageOld; + GEOSMessageHandler_r noticeMessageNew; + void* noticeData; + GEOSMessageHandler errorMessageOld; + GEOSMessageHandler_r errorMessageNew; + void* errorData; + int WKBOutputDims; + int WKBByteOrder; + int initialized; + + GEOSContextHandle_HS() + : + geomFactory(0), + noticeMessageOld(0), + noticeMessageNew(0), + noticeData(0), + errorMessageOld(0), + errorMessageNew(0), + errorData(0) + { + memset(msgBuffer, 0, sizeof(msgBuffer)); + geomFactory = GeometryFactory::getDefaultInstance(); + WKBOutputDims = 2; + WKBByteOrder = getMachineByteOrder(); + setNoticeHandler(NULL); + setErrorHandler(NULL); + initialized = 1; + } + + GEOSMessageHandler + setNoticeHandler(GEOSMessageHandler nf) + { + GEOSMessageHandler f = noticeMessageOld; + noticeMessageOld = nf; + noticeMessageNew = NULL; + noticeData = NULL; + + return f; + } + + GEOSMessageHandler + setErrorHandler(GEOSMessageHandler nf) + { + GEOSMessageHandler f = errorMessageOld; + errorMessageOld = nf; + errorMessageNew = NULL; + errorData = NULL; + + return f; + } + + GEOSMessageHandler_r + setNoticeHandler(GEOSMessageHandler_r nf, void* userData) + { + GEOSMessageHandler_r f = noticeMessageNew; + noticeMessageOld = NULL; + noticeMessageNew = nf; + noticeData = userData; + + return f; + } + + GEOSMessageHandler_r + setErrorHandler(GEOSMessageHandler_r ef, void* userData) + { + GEOSMessageHandler_r f = errorMessageNew; + errorMessageOld = NULL; + errorMessageNew = ef; + errorData = userData; + + return f; + } + + void + NOTICE_MESSAGE(string fmt, ...) + { + if(NULL == noticeMessageOld && NULL == noticeMessageNew) { + return; + } + + va_list args; + va_start(args, fmt); + int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt.c_str(), args); + va_end(args); + + if(result > 0) { + if(noticeMessageOld) { + noticeMessageOld("%s", msgBuffer); + } + else { + noticeMessageNew(msgBuffer, noticeData); + } + } + } + + void + ERROR_MESSAGE(string fmt, ...) + { + if(NULL == errorMessageOld && NULL == errorMessageNew) { + return; + } + + va_list args; + va_start(args, fmt); + int result = vsnprintf(msgBuffer, sizeof(msgBuffer) - 1, fmt.c_str(), args); + va_end(args); + + if(result > 0) { + if(errorMessageOld) { + errorMessageOld("%s", msgBuffer); + } + else { + errorMessageNew(msgBuffer, errorData); + } + } + } +} GEOSContextHandleInternal_t; + +// CAPI_ItemVisitor is used internally by the CAPI STRtree +// wrappers. It's defined here just to keep it out of the +// extern "C" block. +class CAPI_ItemVisitor : public geos::index::ItemVisitor { + GEOSQueryCallback callback; + void* userdata; +public: + CAPI_ItemVisitor(GEOSQueryCallback cb, void* ud) + : ItemVisitor(), callback(cb), userdata(ud) {} + void + visitItem(void* item) override + { + callback(item, userdata); + } +}; + + +//## PROTOTYPES ############################################# + +extern "C" const char GEOS_DLL* GEOSjtsport(); +extern "C" char GEOS_DLL* GEOSasText(Geometry* g1); + + +namespace { // anonymous + +char* +gstrdup_s(const char* str, const std::size_t size) +{ + char* out = static_cast(malloc(size + 1)); + if(0 != out) { + // as no strlen call necessary, memcpy may be faster than strcpy + std::memcpy(out, str, size + 1); + } + + assert(0 != out); + + // we haven't been checking allocation before ticket #371 + if(0 == out) { + throw(std::runtime_error("Failed to allocate memory for duplicate string")); + } + + return out; +} + +char* +gstrdup(std::string const& str) +{ + return gstrdup_s(str.c_str(), str.size()); +} + +} // namespace anonymous + +extern "C" { + + GEOSContextHandle_t + initGEOS_r(GEOSMessageHandler nf, GEOSMessageHandler ef) + { + GEOSContextHandle_t handle = GEOS_init_r(); + + if(0 != handle) { + GEOSContext_setNoticeHandler_r(handle, nf); + GEOSContext_setErrorHandler_r(handle, ef); + } + + return handle; + } + + GEOSContextHandle_t + GEOS_init_r() + { + GEOSContextHandleInternal_t* handle = new GEOSContextHandleInternal_t(); + + geos::util::Interrupt::cancel(); + + return static_cast(handle); + } + + GEOSMessageHandler + GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf) + { + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + return handle->setNoticeHandler(nf); + } + + GEOSMessageHandler + GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf) + { + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + return handle->setErrorHandler(nf); + } + + GEOSMessageHandler_r + GEOSContext_setNoticeMessageHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler_r nf, void* userData) + { + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + return handle->setNoticeHandler(nf, userData); + } + + GEOSMessageHandler_r + GEOSContext_setErrorMessageHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler_r ef, void* userData) + { + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + return handle->setErrorHandler(ef, userData); + } + + void + finishGEOS_r(GEOSContextHandle_t extHandle) + { + // Fix up freeing handle w.r.t. malloc above + delete extHandle; + extHandle = NULL; + } + + void + GEOS_finish_r(GEOSContextHandle_t extHandle) + { + finishGEOS_r(extHandle); + } + + void + GEOSFree_r(GEOSContextHandle_t extHandle, void* buffer) + { + assert(0 != extHandle); + + free(buffer); + } + +//----------------------------------------------------------- +// relate()-related functions +// return 0 = false, 1 = true, 2 = error occurred +//----------------------------------------------------------- + + char + GEOSDisjoint_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(handle->initialized == 0) { + return 2; + } + + try { + bool result = g1->disjoint(g2); + return result; + } + + // TODO: mloskot is going to replace these double-catch block + // with a macro to remove redundant code in this and + // following functions. + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSTouches_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->touches(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSIntersects_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->intersects(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSCrosses_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->crosses(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSWithin_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->within(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + +// call g1->contains(g2) +// returns 0 = false +// 1 = true +// 2 = error was trapped + char + GEOSContains_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->contains(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSOverlaps_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->overlaps(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSCovers_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->covers(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSCoveredBy_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->coveredBy(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + +//------------------------------------------------------------------- +// low-level relate functions +//------------------------------------------------------------------ + + char + GEOSRelatePattern_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, const char* pat) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + std::string s(pat); + bool result = g1->relate(g2, s); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSRelatePatternMatch_r(GEOSContextHandle_t extHandle, const char* mat, + const char* pat) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + using geos::geom::IntersectionMatrix; + + std::string m(mat); + std::string p(pat); + IntersectionMatrix im(m); + + bool result = im.matches(p); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char* + GEOSRelate_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::geom::IntersectionMatrix; + + auto im = g1->relate(g2); + if(im == nullptr) { + return 0; + } + + char* result = gstrdup(im->toString()); + + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + char* + GEOSRelateBoundaryNodeRule_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, int bnr) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::operation::relate::RelateOp; + using geos::geom::IntersectionMatrix; + using geos::algorithm::BoundaryNodeRule; + + std::unique_ptr im; + switch(bnr) { + case GEOSRELATE_BNR_MOD2: /* same as OGC */ + im = RelateOp::relate(g1, g2, + BoundaryNodeRule::getBoundaryRuleMod2()); + break; + case GEOSRELATE_BNR_ENDPOINT: + im = RelateOp::relate(g1, g2, + BoundaryNodeRule::getBoundaryEndPoint()); + break; + case GEOSRELATE_BNR_MULTIVALENT_ENDPOINT: + im = RelateOp::relate(g1, g2, + BoundaryNodeRule::getBoundaryMultivalentEndPoint()); + break; + case GEOSRELATE_BNR_MONOVALENT_ENDPOINT: + im = RelateOp::relate(g1, g2, + BoundaryNodeRule::getBoundaryMonovalentEndPoint()); + break; + default: + handle->ERROR_MESSAGE("Invalid boundary node rule %d", bnr); + return 0; + break; + } + + if(0 == im) { + return 0; + } + + char* result = gstrdup(im->toString()); + + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + + +//----------------------------------------------------------------- +// isValid +//----------------------------------------------------------------- + + + char + GEOSisValid_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + using geos::operation::valid::IsValidOp; + using geos::operation::valid::TopologyValidationError; + + IsValidOp ivo(g1); + TopologyValidationError* err = ivo.getValidationError(); + if(err) { + handle->NOTICE_MESSAGE("%s", err->toString().c_str()); + return 0; + } + else { + return 1; + } + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char* + GEOSisValidReason_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::operation::valid::IsValidOp; + using geos::operation::valid::TopologyValidationError; + + char* result = 0; + char const* const validstr = "Valid Geometry"; + + IsValidOp ivo(g1); + TopologyValidationError* err = ivo.getValidationError(); + if(0 != err) { + std::ostringstream ss; + ss.precision(15); + ss << err->getCoordinate(); + const std::string errloc = ss.str(); + std::string errmsg(err->getMessage()); + errmsg += "[" + errloc + "]"; + result = gstrdup(errmsg); + } + else { + result = gstrdup(std::string(validstr)); + } + + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + char + GEOSisValidDetail_r(GEOSContextHandle_t extHandle, const Geometry* g, + int flags, char** reason, Geometry** location) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + using geos::operation::valid::IsValidOp; + using geos::operation::valid::TopologyValidationError; + + IsValidOp ivo(g); + if(flags & GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE) { + ivo.setSelfTouchingRingFormingHoleValid(true); + } + TopologyValidationError* err = ivo.getValidationError(); + if(0 != err) { + if(location) { + *location = handle->geomFactory->createPoint(err->getCoordinate()); + } + if(reason) { + std::string errmsg(err->getMessage()); + *reason = gstrdup(errmsg); + } + return 0; + } + + if(location) { + *location = 0; + } + if(reason) { + *reason = 0; + } + return 1; /* valid */ + + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; /* exception */ + } + +//----------------------------------------------------------------- +// general purpose +//----------------------------------------------------------------- + + char + GEOSEquals_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->equals(g2); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSEqualsExact_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double tolerance) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = g1->equalsExact(g2, tolerance); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + int + GEOSDistance_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) + { + assert(0 != dist); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *dist = g1->distance(g2); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSDistanceIndexed_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) + { + assert(0 != dist); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *dist = IndexedFacetDistance::distance(g1, g2); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSHausdorffDistance_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) + { + assert(0 != dist); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *dist = DiscreteHausdorffDistance::distance(*g1, *g2); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSHausdorffDistanceDensify_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, + double densifyFrac, double* dist) + { + assert(0 != dist); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *dist = DiscreteHausdorffDistance::distance(*g1, *g2, densifyFrac); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSFrechetDistance_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double* dist) + { + assert(0 != dist); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *dist = DiscreteFrechetDistance::distance(*g1, *g2); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSFrechetDistanceDensify_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2, double densifyFrac, + double* dist) + { + assert(0 != dist); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *dist = DiscreteFrechetDistance::distance(*g1, *g2, densifyFrac); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSArea_r(GEOSContextHandle_t extHandle, const Geometry* g, double* area) + { + assert(0 != area); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *area = g->getArea(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSLength_r(GEOSContextHandle_t extHandle, const Geometry* g, double* length) + { + assert(0 != length); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + *length = g->getLength(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + CoordinateSequence* + GEOSNearestPoints_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + if(g1->isEmpty() || g2->isEmpty()) { + return 0; + } + return geos::operation::distance::DistanceOp::nearestPoints(g1, g2).release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + + Geometry* + GEOSGeomFromWKT_r(GEOSContextHandle_t extHandle, const char* wkt) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const std::string wktstring(wkt); + WKTReader r(static_cast(handle->geomFactory)); + + auto g = r.read(wktstring); + return g.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + char* + GEOSGeomToWKT_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + + char* result = gstrdup(g1->toString()); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + return NULL; + } + +// Remember to free the result! + unsigned char* + GEOSGeomToWKB_buf_r(GEOSContextHandle_t extHandle, const Geometry* g, size_t* size) + { + assert(0 != size); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::io::WKBWriter; + try { + int byteOrder = handle->WKBByteOrder; + WKBWriter w(handle->WKBOutputDims, byteOrder); + std::ostringstream os(std::ios_base::binary); + w.write(*g, os); + std::string wkbstring(os.str()); + const std::size_t len = wkbstring.length(); + + unsigned char* result = 0; + result = static_cast(malloc(len)); + if(0 != result) { + std::memcpy(result, wkbstring.c_str(), len); + *size = len; + } + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeomFromWKB_buf_r(GEOSContextHandle_t extHandle, const unsigned char* wkb, size_t size) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::io::WKBReader; + try { + std::string wkbstring(reinterpret_cast(wkb), size); // make it binary ! + WKBReader r(*(static_cast(handle->geomFactory))); + std::istringstream is(std::ios_base::binary); + is.str(wkbstring); + is.seekg(0, std::ios::beg); // rewind reader pointer + auto g = r.read(is); + return g.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* Read/write wkb hex values. Returned geometries are + owned by the caller.*/ + unsigned char* + GEOSGeomToHEX_buf_r(GEOSContextHandle_t extHandle, const Geometry* g, size_t* size) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::io::WKBWriter; + try { + int byteOrder = handle->WKBByteOrder; + WKBWriter w(handle->WKBOutputDims, byteOrder); + std::ostringstream os(std::ios_base::binary); + w.writeHEX(*g, os); + std::string hexstring(os.str()); + + char* result = gstrdup(hexstring); + if(0 != result) { + *size = hexstring.length(); + } + + return reinterpret_cast(result); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeomFromHEX_buf_r(GEOSContextHandle_t extHandle, const unsigned char* hex, size_t size) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::io::WKBReader; + try { + std::string hexstring(reinterpret_cast(hex), size); + WKBReader r(*(static_cast(handle->geomFactory))); + std::istringstream is(std::ios_base::binary); + is.str(hexstring); + is.seekg(0, std::ios::beg); // rewind reader pointer + + auto g = r.readHEX(is); + return g.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + char + GEOSisEmpty_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + return g1->isEmpty(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSisSimple_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + return g1->isSimple(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 2; + } + + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 2; + } + } + + char + GEOSisRing_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + const LineString* ls = dynamic_cast(g); + if(ls) { + return (ls->isRing()); + } + else { + return 0; + } + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 2; + } + + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 2; + } + } + + + +//free the result of this + char* + GEOSGeomType_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + std::string s = g1->getGeometryType(); + + char* result = gstrdup(s); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + +// Return postgis geometry type index + int + GEOSGeomTypeId_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + return g1->getGeometryTypeId(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + +//------------------------------------------------------------------- +// GEOS functions that return geometries +//------------------------------------------------------------------- + + Geometry* + GEOSEnvelope_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry* g3 = g1->getEnvelope().release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSIntersection_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry* g3 = g1->intersection(g2).release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSBuffer_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadrantsegments) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry* g3 = g1->buffer(width, quadrantsegments).release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSBufferWithStyle_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadsegs, int endCapStyle, + int joinStyle, double mitreLimit) + { + using geos::operation::buffer::BufferParameters; + using geos::operation::buffer::BufferOp; + using geos::util::IllegalArgumentException; + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + BufferParameters bp; + bp.setQuadrantSegments(quadsegs); + + if(endCapStyle > BufferParameters::CAP_SQUARE) { + throw IllegalArgumentException("Invalid buffer endCap style"); + } + bp.setEndCapStyle( + static_cast(endCapStyle) + ); + + if(joinStyle > BufferParameters::JOIN_BEVEL) { + throw IllegalArgumentException("Invalid buffer join style"); + } + bp.setJoinStyle( + static_cast(joinStyle) + ); + bp.setMitreLimit(mitreLimit); + BufferOp op(g1, bp); + Geometry* g3 = op.getResultGeometry(width); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSOffsetCurve_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadsegs, int joinStyle, + double mitreLimit) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + BufferParameters bp; + bp.setEndCapStyle(BufferParameters::CAP_FLAT); + bp.setQuadrantSegments(quadsegs); + + if(joinStyle > BufferParameters::JOIN_BEVEL) { + throw IllegalArgumentException("Invalid buffer join style"); + } + bp.setJoinStyle( + static_cast(joinStyle) + ); + bp.setMitreLimit(mitreLimit); + + bool isLeftSide = true; + if(width < 0) { + isLeftSide = false; + width = -width; + } + BufferBuilder bufBuilder(bp); + Geometry* g3 = bufBuilder.bufferLineSingleSided(g1, width, isLeftSide); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* @deprecated in 3.3.0 */ + Geometry* + GEOSSingleSidedBuffer_r(GEOSContextHandle_t extHandle, const Geometry* g1, double width, int quadsegs, int joinStyle, + double mitreLimit, int leftSide) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + BufferParameters bp; + bp.setEndCapStyle(BufferParameters::CAP_FLAT); + bp.setQuadrantSegments(quadsegs); + + if(joinStyle > BufferParameters::JOIN_BEVEL) { + throw IllegalArgumentException("Invalid buffer join style"); + } + bp.setJoinStyle( + static_cast(joinStyle) + ); + bp.setMitreLimit(mitreLimit); + + bool isLeftSide = leftSide == 0 ? false : true; + BufferBuilder bufBuilder(bp); + Geometry* g3 = bufBuilder.bufferLineSingleSided(g1, width, isLeftSide); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSConvexHull_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry* g3 = g1->convexHull().release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + + Geometry* + GEOSMinimumRotatedRectangle_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + geos::algorithm::MinimumDiameter m(g); + Geometry* g3 = m.getMinimumRectangle().release(); + g3->setSRID(g->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSMinimumWidth_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + geos::algorithm::MinimumDiameter m(g); + Geometry* g3 = m.getDiameter().release(); + g3->setSRID(g->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSMinimumClearanceLine_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + geos::precision::MinimumClearance mc(g); + Geometry *g3 = mc.getLine().release(); + g3->setSRID(g->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + int + GEOSMinimumClearance_r(GEOSContextHandle_t extHandle, const Geometry* g, double* d) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + geos::precision::MinimumClearance mc(g); + double res = mc.getDistance(); + *d = res; + return 0; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + + Geometry* + GEOSDifference_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry *g3 = g1->difference(g2).release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSBoundary_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry* g3 = g1->getBoundary().release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSSymDifference_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry *g3 = g1->symDifference(g2).release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return NULL; + } + + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return NULL; + } + } + + Geometry* + GEOSUnion_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* g2) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry *g3 = g1->Union(g2).release(); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { +#if VERBOSE_EXCEPTIONS + std::ostringstream s; + s << "Exception on GEOSUnion_r with following inputs:" << std::endl; + s << "A: " << g1->toString() << std::endl; + s << "B: " << g2->toString() << std::endl; + handle->NOTICE_MESSAGE("%s", s.str().c_str()); +#endif // VERBOSE_EXCEPTIONS + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSCoverageUnion_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry *g3 = geos::operation::geounion::CoverageUnion::Union(g).release(); + g3->setSRID(g->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSUnaryUnion_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + GeomPtr g3(g->Union()); + g3->setSRID(g->getSRID()); + return g3.release(); + } + catch(const std::exception& e) { +#if VERBOSE_EXCEPTIONS + std::ostringstream s; + s << "Exception on GEOSUnaryUnion_r with following inputs:" << std::endl; + s << "A: " << g1->toString() << std::endl; + s << "B: " << g2->toString() << std::endl; + handle->NOTICE_MESSAGE("%s", s.str().c_str()); +#endif // VERBOSE_EXCEPTIONS + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSNode_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + std::unique_ptr g3 = geos::noding::GeometryNoder::node(*g); + g3->setSRID(g->getSRID()); + return g3.release(); + } + catch(const std::exception& e) { +#if VERBOSE_EXCEPTIONS + std::ostringstream s; + s << "Exception on GEOSNode_r with following inputs:" << std::endl; + s << "A: " << g1->toString() << std::endl; + s << "B: " << g2->toString() << std::endl; + handle->NOTICE_MESSAGE("%s", s.str().c_str()); +#endif // VERBOSE_EXCEPTIONS + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSUnionCascaded_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const geos::geom::MultiPolygon* p = dynamic_cast(g1); + if(! p) { + handle->ERROR_MESSAGE("Invalid argument (must be a MultiPolygon)"); + return NULL; + } + + using geos::operation::geounion::CascadedPolygonUnion; + Geometry *g3 = CascadedPolygonUnion::Union(p); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSPointOnSurface_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + auto ret = g1->getInteriorPoint(); + if(ret == nullptr) { + const GeometryFactory* gf = handle->geomFactory; + // return an empty point + return gf->createPoint().release(); + } + ret->setSRID(g1->getSRID()); + return ret.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSClipByRect_r(GEOSContextHandle_t extHandle, const Geometry* g, double xmin, double ymin, double xmax, double ymax) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::operation::intersection::Rectangle; + using geos::operation::intersection::RectangleIntersection; + Rectangle rect(xmin, ymin, xmax, ymax); + std::unique_ptr g3 = RectangleIntersection::clip(*g, rect); + g3->setSRID(g->getSRID()); + return g3.release(); + } + catch(const std::exception& e) { +#if VERBOSE_EXCEPTIONS + std::ostringstream s; + s << "Exception on GEOSClipByRect_r with following inputs:" << std::endl; + s << "A: " << g1->toString() << std::endl; + s << "B: " << g2->toString() << std::endl; + handle->NOTICE_MESSAGE("%s", s.str().c_str()); +#endif // VERBOSE_EXCEPTIONS + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + +//------------------------------------------------------------------- +// memory management functions +//------------------------------------------------------------------ + + void + GEOSGeom_destroy_r(GEOSContextHandle_t extHandle, Geometry* a) + { + GEOSContextHandleInternal_t* handle = 0; + + // FIXME: mloskot: Does this try-catch around delete means that + // destructors in GEOS may throw? If it does, this is a serious + // violation of "never throw an exception from a destructor" principle + + try { + delete a; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + void + GEOSGeom_setUserData_r(GEOSContextHandle_t extHandle, Geometry* g, void* userData) + { + assert(0 != g); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + g->setUserData(userData); + } + + void + GEOSSetSRID_r(GEOSContextHandle_t extHandle, Geometry* g, int srid) + { + assert(0 != g); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + g->setSRID(srid); + } + + + int + GEOSGetNumCoordinates_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + return static_cast(g->getNumPoints()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + + /* + * Return -1 on exception, 0 otherwise. + * Converts Geometry to normal form (or canonical form). + */ + int + GEOSNormalize_r(GEOSContextHandle_t extHandle, Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + g->normalize(); + return 0; // SUCCESS + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + + int + GEOSGetNumInteriorRings_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + const Polygon* p = dynamic_cast(g1); + if(! p) { + handle->ERROR_MESSAGE("Argument is not a Polygon"); + return -1; + } + return static_cast(p->getNumInteriorRing()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + + +// returns -1 on error and 1 for non-multi geometries + int + GEOSGetNumGeometries_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + return static_cast(g1->getNumGeometries()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + + + /* + * Call only on GEOMETRYCOLLECTION or MULTI*. + * Return a pointer to the internal Geometry. + */ + const Geometry* + GEOSGetGeometryN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + return g1->getGeometryN(n); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* + * Call only on LINESTRING + * Returns NULL on exception + */ + Geometry* + GEOSGeomGetPointN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::geom::LineString; + const LineString* ls = dynamic_cast(g1); + if(! ls) { + handle->ERROR_MESSAGE("Argument is not a LineString"); + return NULL; + } + return ls->getPointN(n).release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* + * Call only on LINESTRING + */ + Geometry* + GEOSGeomGetStartPoint_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::geom::LineString; + const LineString* ls = dynamic_cast(g1); + if(! ls) { + handle->ERROR_MESSAGE("Argument is not a LineString"); + return NULL; + } + return ls->getStartPoint().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* + * Call only on LINESTRING + */ + Geometry* + GEOSGeomGetEndPoint_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::geom::LineString; + const LineString* ls = dynamic_cast(g1); + if(! ls) { + handle->ERROR_MESSAGE("Argument is not a LineString"); + return NULL; + } + return ls->getEndPoint().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* + * Call only on LINESTRING or MULTILINESTRING + * return 2 on exception, 1 on true, 0 on false + */ + char + GEOSisClosed_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + using geos::geom::LineString; + using geos::geom::MultiLineString; + + const LineString* ls = dynamic_cast(g1); + if(ls) { + return ls->isClosed(); + } + + const MultiLineString* mls = dynamic_cast(g1); + if(mls) { + return mls->isClosed(); + } + + handle->ERROR_MESSAGE("Argument is not a LineString or MultiLineString"); + return 2; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + /* + * Call only on LINESTRING + * return 0 on exception, otherwise 1 + */ + int + GEOSGeomGetLength_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* length) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + using geos::geom::LineString; + const LineString* ls = dynamic_cast(g1); + if(! ls) { + handle->ERROR_MESSAGE("Argument is not a LineString"); + return 0; + } + *length = ls->getLength(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + /* + * Call only on LINESTRING + */ + int + GEOSGeomGetNumPoints_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + using geos::geom::LineString; + const LineString* ls = dynamic_cast(g1); + if(! ls) { + handle->ERROR_MESSAGE("Argument is not a LineString"); + return -1; + } + return static_cast(ls->getNumPoints()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + + /* + * For POINT + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetX_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* x) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + using geos::geom::Point; + const Point* po = dynamic_cast(g1); + if(! po) { + handle->ERROR_MESSAGE("Argument is not a Point"); + return 0; + } + *x = po->getX(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + /* + * For POINT + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetY_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* y) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + using geos::geom::Point; + const Point* po = dynamic_cast(g1); + if(! po) { + handle->ERROR_MESSAGE("Argument is not a Point"); + return 0; + } + *y = po->getY(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + /* + * For POINT + * returns 0 on exception, otherwise 1 + */ + int + GEOSGeomGetZ_r(GEOSContextHandle_t extHandle, const Geometry* g1, double* z) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + using geos::geom::Point; + const Point* po = dynamic_cast(g1); + if(! po) { + handle->ERROR_MESSAGE("Argument is not a Point"); + return 0; + } + *z = po->getZ(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + /* + * Call only on polygon + * Return a copy of the internal Geometry. + */ + const Geometry* + GEOSGetExteriorRing_r(GEOSContextHandle_t extHandle, const Geometry* g1) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const Polygon* p = dynamic_cast(g1); + if(! p) { + handle->ERROR_MESSAGE("Invalid argument (must be a Polygon)"); + return NULL; + } + return p->getExteriorRing(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + /* + * Call only on polygon + * Return a pointer to internal storage, do not destroy it. + */ + const Geometry* + GEOSGetInteriorRingN_r(GEOSContextHandle_t extHandle, const Geometry* g1, int n) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const Polygon* p = dynamic_cast(g1); + if(! p) { + handle->ERROR_MESSAGE("Invalid argument (must be a Polygon)"); + return NULL; + } + return p->getInteriorRingN(n); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGetCentroid_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + Geometry* ret = g->getCentroid().release(); + if(0 == ret) { + const GeometryFactory* gf = handle->geomFactory; + return gf->createPoint().release(); + } + ret->setSRID(g->getSRID()); + return ret; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSMinimumBoundingCircle_r(GEOSContextHandle_t extHandle, const Geometry* g, + double* radius, Geometry** center) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + geos::algorithm::MinimumBoundingCircle mc(g); + std::unique_ptr ret = mc.getCircle(); + const GeometryFactory* gf = handle->geomFactory; + if(!ret) { + if (center) *center = NULL; + if (radius) *radius = 0.0; + return gf->createPolygon().release(); + } + if (center) *center = static_cast(gf->createPoint(mc.getCentre())); + if (radius) *radius = mc.getRadius(); + ret->setSRID(g->getSRID()); + return ret.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_createEmptyCollection_r(GEOSContextHandle_t extHandle, int type) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + +#ifdef GEOS_DEBUG + char buf[256]; + sprintf(buf, "createCollection: requested type %d", type); + handle->NOTICE_MESSAGE("%s", buf);// TODO: Can handle->NOTICE_MESSAGE format that directly? +#endif + + try { + const GeometryFactory* gf = handle->geomFactory; + + std::unique_ptr g = 0; + switch(type) { + case GEOS_GEOMETRYCOLLECTION: + g = gf->createGeometryCollection(); + break; + case GEOS_MULTIPOINT: + g = gf->createMultiPoint(); + break; + case GEOS_MULTILINESTRING: + g = gf->createMultiLineString(); + break; + case GEOS_MULTIPOLYGON: + g = gf->createMultiPolygon(); + break; + default: + handle->ERROR_MESSAGE("Unsupported type request for GEOSGeom_createEmptyCollection_r"); + g = 0; + + } + + return g.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSGeom_createCollection_r(GEOSContextHandle_t extHandle, int type, Geometry** geoms, unsigned int ngeoms) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + +#ifdef GEOS_DEBUG + char buf[256]; + sprintf(buf, "PostGIS2GEOS_collection: requested type %d, ngeoms: %d", + type, ngeoms); + handle->NOTICE_MESSAGE("%s", buf);// TODO: Can handle->NOTICE_MESSAGE format that directly? +#endif + + try { + const GeometryFactory* gf = handle->geomFactory; + std::vector* vgeoms = new std::vector(geoms, geoms + ngeoms); + + Geometry* g = 0; + switch(type) { + case GEOS_GEOMETRYCOLLECTION: + g = gf->createGeometryCollection(vgeoms); + break; + case GEOS_MULTIPOINT: + g = gf->createMultiPoint(vgeoms); + break; + case GEOS_MULTILINESTRING: + g = gf->createMultiLineString(vgeoms); + break; + case GEOS_MULTIPOLYGON: + g = gf->createMultiPolygon(vgeoms); + break; + default: + handle->ERROR_MESSAGE("Unsupported type request for PostGIS2GEOS_collection"); + delete vgeoms; + g = 0; + + } + + return g; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSPolygonize_r(GEOSContextHandle_t extHandle, const Geometry* const* g, unsigned int ngeoms) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + Geometry* out = 0; + + try { + // Polygonize + using geos::operation::polygonize::Polygonizer; + Polygonizer plgnzr; + for(std::size_t i = 0; i < ngeoms; ++i) { + plgnzr.add(g[i]); + } + +#if GEOS_DEBUG + handle->NOTICE_MESSAGE("geometry vector added to polygonizer"); +#endif + + auto polys = plgnzr.getPolygons(); + assert(0 != polys); + +#if GEOS_DEBUG + handle->NOTICE_MESSAGE("output polygons got"); +#endif + + // We need a vector of Geometry pointers, not Polygon pointers. + // STL vector doesn't allow transparent upcast of this + // nature, so we explicitly convert. + // (it's just a waste of processor and memory, btw) + // + // XXX mloskot: Why not to extent GeometryFactory to accept + // vector of polygons or extend Polygonizer to return list of Geometry* + // or add a wrapper which semantic is similar to: + // std::vector > + std::vector* polyvec = new std::vector(polys->size()); + + for(std::size_t i = 0; i < polys->size(); ++i) { + (*polyvec)[i] = (*polys)[i].release(); + } + polys = 0; + + const GeometryFactory* gf = handle->geomFactory; + + // The below takes ownership of the passed vector, + // so we must *not* delete it + out = gf->createGeometryCollection(polyvec); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return out; + } + + Geometry* + GEOSPolygonize_valid_r(GEOSContextHandle_t extHandle, const Geometry* const* g, unsigned int ngeoms) + { + if(nullptr == extHandle) { + return nullptr; + } + + GEOSContextHandleInternal_t* handle = nullptr; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return nullptr; + } + + Geometry* out = nullptr; + + try { + // Polygonize + using geos::operation::polygonize::Polygonizer; + Polygonizer plgnzr(true); + int srid = 0; + for(std::size_t i = 0; i < ngeoms; ++i) { + plgnzr.add(g[i]); + srid = g[i]->getSRID(); + } + + auto polys = plgnzr.getPolygons(); + if (polys->empty()) { + out = handle->geomFactory->createGeometryCollection().release(); + } else if (polys->size() == 1) { + out = (*polys)[0].release(); + } else { + auto geoms = new std::vector(polys->size()); + for (size_t i = 0; i < polys->size(); i++) { + (*geoms)[i] = (*polys)[i].release(); + } + + out = handle->geomFactory->createMultiPolygon(geoms); + } + out->setSRID(srid); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return out; + } + + + Geometry* + GEOSBuildArea_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return nullptr; + } + + GEOSContextHandleInternal_t* handle = nullptr; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return nullptr; + } + + Geometry* out = nullptr; + + try { + using geos::operation::polygonize::BuildArea; + BuildArea builder; + out = builder.build(g).release(); + out->setSRID(g->getSRID()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return out; + } + + Geometry* + GEOSMakeValid_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return nullptr; + } + + GEOSContextHandleInternal_t* handle = nullptr; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return nullptr; + } + + Geometry* out = nullptr; + + try { + // BuildArea + using geos::operation::valid::MakeValid; + MakeValid makeValid; + out = makeValid.build(g).release(); + out->setSRID(g->getSRID()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return out; + } + + Geometry* + GEOSPolygonizer_getCutEdges_r(GEOSContextHandle_t extHandle, const Geometry* const* g, unsigned int ngeoms) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + Geometry* out = 0; + + try { + // Polygonize + using geos::operation::polygonize::Polygonizer; + Polygonizer plgnzr; + int srid = 0; + for(std::size_t i = 0; i < ngeoms; ++i) { + plgnzr.add(g[i]); + srid = g[i]->getSRID(); + } + +#if GEOS_DEBUG + handle->NOTICE_MESSAGE("geometry vector added to polygonizer"); +#endif + + const std::vector& lines = plgnzr.getCutEdges(); + +#if GEOS_DEBUG + handle->NOTICE_MESSAGE("output polygons got"); +#endif + + // We need a vector of Geometry pointers, not Polygon pointers. + // STL vector doesn't allow transparent upcast of this + // nature, so we explicitly convert. + // (it's just a waste of processor and memory, btw) + // XXX mloskot: See comment for GEOSPolygonize_r + std::vector* linevec = new std::vector(lines.size()); + + for(std::size_t i = 0, n = lines.size(); i < n; ++i) { + (*linevec)[i] = lines[i]->clone().release(); + } + + const GeometryFactory* gf = handle->geomFactory; + + // The below takes ownership of the passed vector, + // so we must *not* delete it + out = gf->createGeometryCollection(linevec); + out->setSRID(srid); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return out; + } + + Geometry* + GEOSPolygonize_full_r(GEOSContextHandle_t extHandle, const Geometry* g, + Geometry** cuts, Geometry** dangles, Geometry** invalid) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + // Polygonize + using geos::operation::polygonize::Polygonizer; + Polygonizer plgnzr; + for(std::size_t i = 0; i < g->getNumGeometries(); ++i) { + plgnzr.add(g->getGeometryN(i)); + } + +#if GEOS_DEBUG + handle->NOTICE_MESSAGE("geometry vector added to polygonizer"); +#endif + const GeometryFactory* gf = handle->geomFactory; + + if(cuts) { + + const std::vector& lines = plgnzr.getCutEdges(); + std::vector* linevec = new std::vector(lines.size()); + for(std::size_t i = 0, n = lines.size(); i < n; ++i) { + (*linevec)[i] = lines[i]->clone().release(); + } + + // The below takes ownership of the passed vector, + // so we must *not* delete it + *cuts = gf->createGeometryCollection(linevec); + } + + if(dangles) { + + const std::vector& lines = plgnzr.getDangles(); + std::vector* linevec = new std::vector(lines.size()); + for(std::size_t i = 0, n = lines.size(); i < n; ++i) { + (*linevec)[i] = lines[i]->clone().release(); + } + + // The below takes ownership of the passed vector, + // so we must *not* delete it + *dangles = gf->createGeometryCollection(linevec); + } + + if(invalid) { + + const std::vector>& lines = plgnzr.getInvalidRingLines(); + std::vector* linevec = new std::vector(lines.size()); + for(std::size_t i = 0, n = lines.size(); i < n; ++i) { + (*linevec)[i] = lines[i]->clone().release(); + } + + // The below takes ownership of the passed vector, + // so we must *not* delete it + *invalid = gf->createGeometryCollection(linevec); + } + + auto polys = plgnzr.getPolygons(); + std::vector* polyvec = new std::vector(polys->size()); + for(std::size_t i = 0; i < polys->size(); ++i) { + (*polyvec)[i] = (*polys)[i].release(); + } + + Geometry* out = gf->createGeometryCollection(polyvec); + out->setSRID(g->getSRID()); + return out; + + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 0; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 0; + } + } + + Geometry* + GEOSLineMerge_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + Geometry* out = 0; + + try { + using geos::operation::linemerge::LineMerger; + LineMerger lmrgr; + lmrgr.add(g); + + std::vector* lines = lmrgr.getMergedLineStrings(); + assert(0 != lines); + +#if GEOS_DEBUG + handle->NOTICE_MESSAGE("output lines got"); +#endif + + std::vector* geoms = new std::vector(lines->size()); + for(std::vector::size_type i = 0; i < lines->size(); ++i) { + (*geoms)[i] = (*lines)[i]; + } + delete lines; + lines = 0; + + const GeometryFactory* gf = handle->geomFactory; + out = gf->buildGeometry(geoms); + out->setSRID(g->getSRID()); + + // XXX: old version + //out = gf->createGeometryCollection(geoms); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return out; + } + + Geometry* + GEOSReverse_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return nullptr; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return nullptr; + } + + try { + Geometry* g3 = g->reverse().release(); + g3->setSRID(g->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return nullptr; + } + + void* + GEOSGeom_getUserData_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + return g->getUserData(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + int + GEOSGetSRID_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + return g->getSRID(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + const char* GEOSversion() + { + static char version[256]; + sprintf(version, "%s", GEOS_CAPI_VERSION); + return version; + } + + const char* GEOSjtsport() + { + return GEOS_JTS_PORT; + } + + char + GEOSHasZ_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + if(g->isEmpty()) { + return false; + } + assert(0 != g->getCoordinate()); + + double az = g->getCoordinate()->z; + //handle->ERROR_MESSAGE("ZCoord: %g", az); + + return static_cast(std::isfinite(az)); + } + + int + GEOS_getWKBOutputDims_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + return handle->WKBOutputDims; + } + + int + GEOS_setWKBOutputDims_r(GEOSContextHandle_t extHandle, int newdims) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + if(newdims < 2 || newdims > 3) { + handle->ERROR_MESSAGE("WKB output dimensions out of range 2..3"); + } + + const int olddims = handle->WKBOutputDims; + handle->WKBOutputDims = newdims; + + return olddims; + } + + int + GEOS_getWKBByteOrder_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + return handle->WKBByteOrder; + } + + int + GEOS_setWKBByteOrder_r(GEOSContextHandle_t extHandle, int byteOrder) + { + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + const int oldByteOrder = handle->WKBByteOrder; + handle->WKBByteOrder = byteOrder; + + return oldByteOrder; + } + + + CoordinateSequence* + GEOSCoordSeq_create_r(GEOSContextHandle_t extHandle, unsigned int size, unsigned int dims) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + switch (size) { + case 1: + return new geos::geom::FixedSizeCoordinateSequence<1>(dims); + case 2: + return new geos::geom::FixedSizeCoordinateSequence<2>(dims); + default: { + const GeometryFactory *gf = handle->geomFactory; + return gf->getCoordinateSequenceFactory()->create(size, dims).release(); + } + } + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + int + GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs, + unsigned int idx, unsigned int dim, double val) + { + assert(0 != cs); + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + cs->setOrdinate(idx, dim, val); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_setX_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) + { + return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, 0, val); + } + + int + GEOSCoordSeq_setY_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) + { + return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, 1, val); + } + + int + GEOSCoordSeq_setZ_r(GEOSContextHandle_t extHandle, CoordinateSequence* s, unsigned int idx, double val) + { + return GEOSCoordSeq_setOrdinate_r(extHandle, s, idx, 2, val); + } + + int + GEOSCoordSeq_setXY_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs, unsigned int idx, double x, double y) + { + assert(0 != cs); + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + cs->setAt({x, y}, idx); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_setXYZ_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs, unsigned int idx, double x, double y, double z) + { + assert(0 != cs); + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + cs->setAt({x, y, z}, idx); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + CoordinateSequence* + GEOSCoordSeq_clone_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs) + { + assert(0 != cs); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + return cs->clone().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + int + GEOSCoordSeq_getOrdinate_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, + unsigned int idx, unsigned int dim, double* val) + { + assert(0 != cs); + assert(0 != val); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + double d = cs->getOrdinate(idx, dim); + *val = d; + + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_getX_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) + { + return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, 0, val); + } + + int + GEOSCoordSeq_getY_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) + { + return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, 1, val); + } + + int + GEOSCoordSeq_getZ_r(GEOSContextHandle_t extHandle, const CoordinateSequence* s, unsigned int idx, double* val) + { + return GEOSCoordSeq_getOrdinate_r(extHandle, s, idx, 2, val); + } + + int + GEOSCoordSeq_getXY_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int idx, double* x, double* y) + { + assert(0 != cs); + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + auto& c = cs->getAt(idx); + *x = c.x; + *y = c.y; + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_getXYZ_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int idx, double* x, double* y, double* z) + { + assert(0 != cs); + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + auto& c = cs->getAt(idx); + *x = c.x; + *y = c.y; + *z = c.z; + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_getSize_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int* size) + { + assert(0 != cs); + assert(0 != size); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + const std::size_t sz = cs->getSize(); + *size = static_cast(sz); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_getDimensions_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, unsigned int* dims) + { + assert(0 != cs); + assert(0 != dims); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + const std::size_t dim = cs->getDimension(); + *dims = static_cast(dim); + + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSCoordSeq_isCCW_r(GEOSContextHandle_t extHandle, const CoordinateSequence* cs, char* val) + { + assert(cs != nullptr); + assert(val != nullptr); + + if(extHandle == nullptr) { + return 0; + } + + GEOSContextHandleInternal_t* handle = nullptr; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + try { + *val = geos::algorithm::Orientation::isCCW(cs); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + void + GEOSCoordSeq_destroy_r(GEOSContextHandle_t extHandle, CoordinateSequence* s) + { + GEOSContextHandleInternal_t* handle = 0; + + try { + delete s; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + const CoordinateSequence* + GEOSGeom_getCoordSeq_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + using geos::geom::Point; + + const LineString* ls = dynamic_cast(g); + if(ls) { + return ls->getCoordinatesRO(); + } + + const Point* p = dynamic_cast(g); + if(p) { + return p->getCoordinatesRO(); + } + + handle->ERROR_MESSAGE("Geometry must be a Point or LineString"); + return 0; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSGeom_createEmptyPoint_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + return gf->createPoint().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_createPoint_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + return gf->createPoint(cs); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSGeom_createPointFromXY_r(GEOSContextHandle_t extHandle, double x, double y) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + geos::geom::Coordinate c(x, y); + return gf->createPoint(c); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSGeom_createLinearRing_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + + return gf->createLinearRing(cs); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_createEmptyLineString_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + + return gf->createLineString().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_createLineString_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + + return gf->createLineString(cs); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_createEmptyPolygon_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const GeometryFactory* gf = handle->geomFactory; + return gf->createPolygon().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_createPolygon_r(GEOSContextHandle_t extHandle, Geometry* shell, Geometry** holes, unsigned int nholes) + { + // FIXME: holes must be non-nullptr or may be nullptr? + //assert(0 != holes); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::geom::LinearRing; + + auto vholes = geos::detail::make_unique>(nholes); + + for (size_t i = 0; i < nholes; i++) { + (*vholes)[i] = dynamic_cast(holes[i]); + if ((*vholes)[i] == nullptr) { + handle->ERROR_MESSAGE("Hole is not a LinearRing"); + return NULL; + } + } + + LinearRing* nshell = dynamic_cast(shell); + if(! nshell) { + handle->ERROR_MESSAGE("Shell is not a LinearRing"); + return NULL; + } + const GeometryFactory* gf = handle->geomFactory; + + return gf->createPolygon(nshell, vholes.release()); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSGeom_clone_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + assert(0 != g); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + return g->clone().release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + GEOSGeometry* + GEOSGeom_setPrecision_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g, + double gridSize, int flags) + { + using namespace geos::geom; + + assert(0 != g); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + const PrecisionModel* pm = g->getPrecisionModel(); + double cursize = pm->isFloating() ? 0 : 1.0 / pm->getScale(); + std::unique_ptr newpm; + if(gridSize != 0) { + newpm.reset(new PrecisionModel(1.0 / gridSize)); + } + else { + newpm.reset(new PrecisionModel()); + } + GeometryFactory::Ptr gf = + GeometryFactory::create(newpm.get(), g->getSRID()); + Geometry* ret; + if(gridSize != 0 && cursize != gridSize) { + // We need to snap the geometry + GeometryPrecisionReducer reducer(*gf); + reducer.setPointwise(flags & GEOS_PREC_NO_TOPO); + reducer.setRemoveCollapsedComponents(!(flags & GEOS_PREC_KEEP_COLLAPSED)); + ret = reducer.reduce(*g).release(); + } + else { + // No need or willing to snap, just change the factory + ret = gf->createGeometry(g); + } + return ret; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + double + GEOSGeom_getPrecision_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g) + { + using namespace geos::geom; + + assert(0 != g); + + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + try { + const PrecisionModel* pm = g->getPrecisionModel(); + double cursize = pm->isFloating() ? 0 : 1.0 / pm->getScale(); + return cursize; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return -1; + } + + int + GEOSGeom_getDimensions_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + return (int) g->getDimension(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSGeom_getCoordinateDimension_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + return g->getCoordinateDimension(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSGeom_getXMin_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + if(g->isEmpty()) { + return 0; + } + + *value = g->getEnvelopeInternal()->getMinX(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSGeom_getXMax_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + if(g->isEmpty()) { + return 0; + } + + *value = g->getEnvelopeInternal()->getMaxX(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSGeom_getYMin_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + if(g->isEmpty()) { + return 0; + } + + *value = g->getEnvelopeInternal()->getMinY(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSGeom_getYMax_r(GEOSContextHandle_t extHandle, const Geometry* g, double* value) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + if(g->isEmpty()) { + return 0; + } + + *value = g->getEnvelopeInternal()->getMaxY(); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSSimplify_r(GEOSContextHandle_t extHandle, const Geometry* g1, double tolerance) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using namespace geos::simplify; + Geometry::Ptr g3(DouglasPeuckerSimplifier::simplify(g1, tolerance)); + g3->setSRID(g1->getSRID()); + return g3.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSTopologyPreserveSimplify_r(GEOSContextHandle_t extHandle, const Geometry* g1, double tolerance) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using namespace geos::simplify; + Geometry::Ptr g3(TopologyPreservingSimplifier::simplify(g1, tolerance)); + g3->setSRID(g1->getSRID()); + return g3.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + + /* WKT Reader */ + WKTReader* + GEOSWKTReader_create_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::io::WKTReader; + return new WKTReader((GeometryFactory*)handle->geomFactory); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + void + GEOSWKTReader_destroy_r(GEOSContextHandle_t extHandle, WKTReader* reader) + { + GEOSContextHandleInternal_t* handle = 0; + + try { + delete reader; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + + Geometry* + GEOSWKTReader_read_r(GEOSContextHandle_t extHandle, WKTReader* reader, const char* wkt) + { + assert(0 != reader); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + const std::string wktstring(wkt); + return reader->read(wktstring).release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + /* WKT Writer */ + WKTWriter* + GEOSWKTWriter_create_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + using geos::io::WKTWriter; + return new WKTWriter(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + void + GEOSWKTWriter_destroy_r(GEOSContextHandle_t extHandle, WKTWriter* Writer) + { + + GEOSContextHandleInternal_t* handle = 0; + + try { + delete Writer; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + + char* + GEOSWKTWriter_write_r(GEOSContextHandle_t extHandle, WKTWriter* writer, const Geometry* geom) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + std::string sgeom(writer->write(geom)); + char* result = gstrdup(sgeom); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + void + GEOSWKTWriter_setTrim_r(GEOSContextHandle_t extHandle, WKTWriter* writer, char trim) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + writer->setTrim(0 != trim); + } + + void + GEOSWKTWriter_setRoundingPrecision_r(GEOSContextHandle_t extHandle, WKTWriter* writer, int precision) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + writer->setRoundingPrecision(precision); + } + + void + GEOSWKTWriter_setOutputDimension_r(GEOSContextHandle_t extHandle, WKTWriter* writer, int dim) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + try { + writer->setOutputDimension(dim); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + int + GEOSWKTWriter_getOutputDimension_r(GEOSContextHandle_t extHandle, WKTWriter* writer) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return -1; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return -1; + } + + int dim = -1; + + try { + dim = writer->getOutputDimension(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return dim; + } + + void + GEOSWKTWriter_setOld3D_r(GEOSContextHandle_t extHandle, WKTWriter* writer, int useOld3D) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + writer->setOld3D(0 != useOld3D); + } + + /* WKB Reader */ + WKBReader* + GEOSWKBReader_create_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::io::WKBReader; + try { + return new WKBReader(*(GeometryFactory*)handle->geomFactory); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + void + GEOSWKBReader_destroy_r(GEOSContextHandle_t extHandle, WKBReader* reader) + { + GEOSContextHandleInternal_t* handle = 0; + + try { + delete reader; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + struct membuf : public std::streambuf { + membuf(char* s, std::size_t n) + { + setg(s, s, s + n); + } + }; + + Geometry* + GEOSWKBReader_read_r(GEOSContextHandle_t extHandle, WKBReader* reader, const unsigned char* wkb, size_t size) + { + assert(0 != reader); + assert(0 != wkb); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + //std::string wkbstring(reinterpret_cast(wkb), size); // make it binary ! + //std::istringstream is(std::ios_base::binary); + //is.str(wkbstring); + //is.seekg(0, std::ios::beg); // rewind reader pointer + + // http://stackoverflow.com/questions/2079912/simpler-way-to-create-a-c-memorystream-from-char-size-t-without-copying-t + membuf mb((char*)wkb, size); + istream is(&mb); + + return reader->read(is).release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSWKBReader_readHEX_r(GEOSContextHandle_t extHandle, WKBReader* reader, const unsigned char* hex, size_t size) + { + assert(0 != reader); + assert(0 != hex); + + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + std::string hexstring(reinterpret_cast(hex), size); + std::istringstream is(std::ios_base::binary); + is.str(hexstring); + is.seekg(0, std::ios::beg); // rewind reader pointer + + return reader->readHEX(is).release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + /* WKB Writer */ + WKBWriter* + GEOSWKBWriter_create_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + using geos::io::WKBWriter; + return new WKBWriter(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + void + GEOSWKBWriter_destroy_r(GEOSContextHandle_t extHandle, WKBWriter* Writer) + { + GEOSContextHandleInternal_t* handle = 0; + + try { + delete Writer; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + + /* The caller owns the result */ + unsigned char* + GEOSWKBWriter_write_r(GEOSContextHandle_t extHandle, WKBWriter* writer, const Geometry* geom, size_t* size) + { + assert(0 != writer); + assert(0 != geom); + assert(0 != size); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + std::ostringstream os(std::ios_base::binary); + writer->write(*geom, os); + + const std::string& wkbstring = os.str(); + const std::size_t len = wkbstring.length(); + + unsigned char* result = NULL; + result = (unsigned char*) malloc(len); + std::memcpy(result, wkbstring.c_str(), len); + *size = len; + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + return NULL; + } + + /* The caller owns the result */ + unsigned char* + GEOSWKBWriter_writeHEX_r(GEOSContextHandle_t extHandle, WKBWriter* writer, const Geometry* geom, size_t* size) + { + assert(0 != writer); + assert(0 != geom); + assert(0 != size); + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + std::ostringstream os(std::ios_base::binary); + writer->writeHEX(*geom, os); + std::string wkbstring(os.str()); + const std::size_t len = wkbstring.length(); + + unsigned char* result = NULL; + result = (unsigned char*) malloc(len); + std::memcpy(result, wkbstring.c_str(), len); + *size = len; + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + int + GEOSWKBWriter_getOutputDimension_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return 0; + } + + int ret = 0; + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 != handle->initialized) { + try { + ret = writer->getOutputDimension(); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + return ret; + } + + void + GEOSWKBWriter_setOutputDimension_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int newDimension) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 != handle->initialized) { + try { + writer->setOutputDimension(newDimension); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + } + + int + GEOSWKBWriter_getByteOrder_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return 0; + } + + int ret = 0; + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 != handle->initialized) { + try { + ret = writer->getByteOrder(); + } + + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + return ret; + } + + void + GEOSWKBWriter_setByteOrder_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, int newByteOrder) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 != handle->initialized) { + try { + writer->setByteOrder(newByteOrder); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + } + + char + GEOSWKBWriter_getIncludeSRID_r(GEOSContextHandle_t extHandle, const GEOSWKBWriter* writer) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return -1; + } + + int ret = -1; + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 != handle->initialized) { + try { + int srid = writer->getIncludeSRID(); + ret = srid; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + return static_cast(ret); + } + + void + GEOSWKBWriter_setIncludeSRID_r(GEOSContextHandle_t extHandle, GEOSWKBWriter* writer, const char newIncludeSRID) + { + assert(0 != writer); + + if(nullptr == extHandle) { + return; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 != handle->initialized) { + try { + writer->setIncludeSRID(newIncludeSRID); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + } + + +//----------------------------------------------------------------- +// Prepared Geometry +//----------------------------------------------------------------- + + const geos::geom::prep::PreparedGeometry* + GEOSPrepare_r(GEOSContextHandle_t extHandle, const Geometry* g) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + const geos::geom::prep::PreparedGeometry* prep = 0; + + try { + prep = geos::geom::prep::PreparedGeometryFactory::prepare(g).release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return prep; + } + + void + GEOSPreparedGeom_destroy_r(GEOSContextHandle_t extHandle, const geos::geom::prep::PreparedGeometry* a) + { + GEOSContextHandleInternal_t* handle = 0; + + try { + delete a; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + char + GEOSPreparedContains_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->contains(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedContainsProperly_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->containsProperly(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedCoveredBy_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->coveredBy(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedCovers_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->covers(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedCrosses_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->crosses(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedDisjoint_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->disjoint(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedIntersects_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->intersects(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedOverlaps_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->overlaps(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedTouches_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->touches(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + char + GEOSPreparedWithin_r(GEOSContextHandle_t extHandle, + const geos::geom::prep::PreparedGeometry* pg, const Geometry* g) + { + assert(0 != pg); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = pg->within(g); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + +//----------------------------------------------------------------- +// STRtree +//----------------------------------------------------------------- + + geos::index::strtree::STRtree* + GEOSSTRtree_create_r(GEOSContextHandle_t extHandle, + size_t nodeCapacity) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + geos::index::strtree::STRtree* tree = 0; + + try { + tree = new geos::index::strtree::STRtree(nodeCapacity); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return tree; + } + + void + GEOSSTRtree_insert_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g, + void* item) + { + GEOSContextHandleInternal_t* handle = 0; + assert(tree != 0); + assert(g != 0); + + try { + tree->insert(g->getEnvelopeInternal(), item); + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + void + GEOSSTRtree_query_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g, + GEOSQueryCallback callback, + void* userdata) + { + GEOSContextHandleInternal_t* handle = 0; + assert(tree != 0); + assert(g != 0); + assert(callback != 0); + + try { + CAPI_ItemVisitor visitor(callback, userdata); + tree->query(g->getEnvelopeInternal(), visitor); + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + const GEOSGeometry* + GEOSSTRtree_nearest_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* geom) + { + return (const GEOSGeometry*) GEOSSTRtree_nearest_generic_r(extHandle, tree, geom, geom, nullptr, nullptr); + } + + const void* + GEOSSTRtree_nearest_generic_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree, + const void* item, + const geos::geom::Geometry* itemEnvelope, + GEOSDistanceCallback distancefn, + void* userdata) + { + using namespace geos::index::strtree; + + GEOSContextHandleInternal_t* handle = 0; + + struct CustomItemDistance : public ItemDistance { + CustomItemDistance(GEOSDistanceCallback p_distancefn, void* p_userdata) + : m_distancefn(p_distancefn), m_userdata(p_userdata) {} + + GEOSDistanceCallback m_distancefn; + void* m_userdata; + + double + distance(const ItemBoundable* item1, const ItemBoundable* item2) override + { + const void* a = item1->getItem(); + const void* b = item2->getItem(); + double d; + + if(!m_distancefn(a, b, &d, m_userdata)) { + throw std::runtime_error(std::string("Failed to compute distance.")); + } + + return d; + } + }; + + try { + if(distancefn) { + CustomItemDistance itemDistance(distancefn, userdata); + return tree->nearestNeighbour(itemEnvelope->getEnvelopeInternal(), item, &itemDistance); + } + else { + GeometryItemDistance itemDistance = GeometryItemDistance(); + return tree->nearestNeighbour(itemEnvelope->getEnvelopeInternal(), item, &itemDistance); + } + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return NULL; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return NULL; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + void + GEOSSTRtree_iterate_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree, + GEOSQueryCallback callback, + void* userdata) + { + GEOSContextHandleInternal_t* handle = 0; + assert(tree != 0); + assert(callback != 0); + + try { + CAPI_ItemVisitor visitor(callback, userdata); + tree->iterate(visitor); + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + char + GEOSSTRtree_remove_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree, + const geos::geom::Geometry* g, + void* item) + { + assert(0 != tree); + assert(0 != g); + + if(nullptr == extHandle) { + return 2; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + bool result = tree->remove(g->getEnvelopeInternal(), item); + return result; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 2; + } + + void + GEOSSTRtree_destroy_r(GEOSContextHandle_t extHandle, + geos::index::strtree::STRtree* tree) + { + GEOSContextHandleInternal_t* handle = 0; + + try { + delete tree; + } + catch(const std::exception& e) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + if(nullptr == extHandle) { + return; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return; + } + + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + } + + double + GEOSProject_r(GEOSContextHandle_t extHandle, + const Geometry* g, + const Geometry* p) + { + if(nullptr == extHandle) { + return -1.0; + } + GEOSContextHandleInternal_t* handle = + reinterpret_cast(extHandle); + if(handle->initialized == 0) { + return -1.0; + } + + const geos::geom::Point* point = dynamic_cast(p); + if(!point) { + handle->ERROR_MESSAGE("third argument of GEOSProject_r must be Point*"); + return -1.0; + } + + const geos::geom::Coordinate* inputPt = p->getCoordinate(); + + try { + return geos::linearref::LengthIndexedLine(g).project(*inputPt); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return -1.0; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return -1.0; + } + } + + + Geometry* + GEOSInterpolate_r(GEOSContextHandle_t extHandle, const Geometry* g, double d) + { + if(nullptr == extHandle) { + return 0; + } + GEOSContextHandleInternal_t* handle = + reinterpret_cast(extHandle); + if(handle->initialized == 0) { + return 0; + } + + try { + geos::linearref::LengthIndexedLine lil(g); + geos::geom::Coordinate coord = lil.extractPoint(d); + const GeometryFactory* gf = handle->geomFactory; + Geometry* point = gf->createPoint(coord); + point->setSRID(g->getSRID()); + return point; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 0; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 0; + } + } + + + double + GEOSProjectNormalized_r(GEOSContextHandle_t extHandle, const Geometry* g, + const Geometry* p) + { + + double length; + GEOSLength_r(extHandle, g, &length); + return GEOSProject_r(extHandle, g, p) / length; + } + + + Geometry* + GEOSInterpolateNormalized_r(GEOSContextHandle_t extHandle, const Geometry* g, + double d) + { + double length; + GEOSLength_r(extHandle, g, &length); + return GEOSInterpolate_r(extHandle, g, d * length); + } + + GEOSGeometry* + GEOSGeom_extractUniquePoints_r(GEOSContextHandle_t extHandle, + const GEOSGeometry* g) + { + if(nullptr == extHandle) { + return 0; + } + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(handle->initialized == 0) { + return 0; + } + + using namespace geos::geom; + using namespace geos::util; + + try { + + /* 1: extract points */ + std::vector coords; + UniqueCoordinateArrayFilter filter(coords); + g->apply_ro(&filter); + + /* 2: for each point, create a geometry and put into a vector */ + std::vector* points = new std::vector(); + points->reserve(coords.size()); + const GeometryFactory* factory = g->getFactory(); + for(std::vector::iterator it = coords.begin(), + itE = coords.end(); + it != itE; ++it) { + Geometry* point = factory->createPoint(*(*it)); + points->push_back(point); + } + + /* 3: create a multipoint */ + Geometry* out = factory->createMultiPoint(points); + out->setSRID(g->getSRID()); + return out; + + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 0; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 0; + } + } + + int GEOSOrientationIndex_r(GEOSContextHandle_t extHandle, + double Ax, double Ay, double Bx, double By, double Px, double Py) + { + GEOSContextHandleInternal_t* handle = 0; + + using geos::geom::Coordinate; + using geos::algorithm::Orientation; + + if(nullptr == extHandle) { + return 2; + } + + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 2; + } + + try { + Coordinate A(Ax, Ay); + Coordinate B(Bx, By); + Coordinate P(Px, Py); + return Orientation::index(A, B, P); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 2; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 2; + } + } + + GEOSGeometry* + GEOSSharedPaths_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, const GEOSGeometry* g2) + { + using namespace geos::operation::sharedpaths; + + if(nullptr == extHandle) { + return 0; + } + GEOSContextHandleInternal_t* handle = + reinterpret_cast(extHandle); + if(handle->initialized == 0) { + return 0; + } + + SharedPathsOp::PathList forw, back; + try { + SharedPathsOp::sharedPathsOp(*g1, *g2, forw, back); + } + catch(const std::exception& e) { + SharedPathsOp::clearEdges(forw); + SharedPathsOp::clearEdges(back); + handle->ERROR_MESSAGE("%s", e.what()); + return 0; + } + catch(...) { + SharedPathsOp::clearEdges(forw); + SharedPathsOp::clearEdges(back); + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 0; + } + + // Now forw and back have the geoms we want to use to construct + // our output GeometryCollections... + + const GeometryFactory* factory = g1->getFactory(); + size_t count; + + std::unique_ptr< std::vector > out1( + new std::vector() + ); + count = forw.size(); + out1->reserve(count); + for(size_t i = 0; i < count; ++i) { + out1->push_back(forw[i]); + } + std::unique_ptr out1g( + factory->createMultiLineString(out1.release()) + ); + + std::unique_ptr< std::vector > out2( + new std::vector() + ); + count = back.size(); + out2->reserve(count); + for(size_t i = 0; i < count; ++i) { + out2->push_back(back[i]); + } + std::unique_ptr out2g( + factory->createMultiLineString(out2.release()) + ); + + std::unique_ptr< std::vector > out( + new std::vector() + ); + out->reserve(2); + out->push_back(out1g.release()); + out->push_back(out2g.release()); + + std::unique_ptr outg( + factory->createGeometryCollection(out.release()) + ); + + outg->setSRID(g1->getSRID()); + return outg.release(); + + } + + GEOSGeometry* + GEOSSnap_r(GEOSContextHandle_t extHandle, const GEOSGeometry* g1, + const GEOSGeometry* g2, double tolerance) + { + using namespace geos::operation::overlay::snap; + + if(nullptr == extHandle) { + return 0; + } + GEOSContextHandleInternal_t* handle = + reinterpret_cast(extHandle); + if(handle->initialized == 0) { + return 0; + } + + try { + GeometrySnapper snapper(*g1); + std::unique_ptr ret = snapper.snapTo(*g2, tolerance); + ret->setSRID(g1->getSRID()); + return ret.release(); + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + return 0; + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + return 0; + } + } + + BufferParameters* + GEOSBufferParams_create_r(GEOSContextHandle_t extHandle) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + BufferParameters* p = new BufferParameters(); + return p; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + void + GEOSBufferParams_destroy_r(GEOSContextHandle_t extHandle, BufferParameters* p) + { + (void)extHandle; + delete p; + } + + int + GEOSBufferParams_setEndCapStyle_r(GEOSContextHandle_t extHandle, + GEOSBufferParams* p, int style) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + if(style > BufferParameters::CAP_SQUARE) { + throw IllegalArgumentException("Invalid buffer endCap style"); + } + p->setEndCapStyle(static_cast(style)); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSBufferParams_setJoinStyle_r(GEOSContextHandle_t extHandle, + GEOSBufferParams* p, int style) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + if(style > BufferParameters::JOIN_BEVEL) { + throw IllegalArgumentException("Invalid buffer join style"); + } + p->setJoinStyle(static_cast(style)); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSBufferParams_setMitreLimit_r(GEOSContextHandle_t extHandle, + GEOSBufferParams* p, double limit) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + p->setMitreLimit(limit); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSBufferParams_setQuadrantSegments_r(GEOSContextHandle_t extHandle, + GEOSBufferParams* p, int segs) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + p->setQuadrantSegments(segs); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + int + GEOSBufferParams_setSingleSided_r(GEOSContextHandle_t extHandle, + GEOSBufferParams* p, int ss) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + p->setSingleSided((ss != 0)); + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + + Geometry* + GEOSBufferWithParams_r(GEOSContextHandle_t extHandle, const Geometry* g1, const BufferParameters* bp, double width) + { + using geos::operation::buffer::BufferOp; + + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + try { + BufferOp op(g1, *bp); + Geometry* g3 = op.getResultGeometry(width); + g3->setSRID(g1->getSRID()); + return g3; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + Geometry* + GEOSDelaunayTriangulation_r(GEOSContextHandle_t extHandle, const Geometry* g1, double tolerance, int onlyEdges) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::triangulate::DelaunayTriangulationBuilder; + + try { + DelaunayTriangulationBuilder builder; + builder.setTolerance(tolerance); + builder.setSites(*g1); + + if(onlyEdges) { + Geometry* out = builder.getEdges(*g1->getFactory()).release(); + out->setSRID(g1->getSRID()); + return out; + } + else { + Geometry* out = builder.getTriangles(*g1->getFactory()).release(); + out->setSRID(g1->getSRID()); + return out; + } + + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + Geometry* + GEOSVoronoiDiagram_r(GEOSContextHandle_t extHandle, const Geometry* g1, const Geometry* env, double tolerance, + int onlyEdges) + { + if(nullptr == extHandle) { + return NULL; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return NULL; + } + + using geos::triangulate::VoronoiDiagramBuilder; + + try { + VoronoiDiagramBuilder builder; + builder.setSites(*g1); + builder.setTolerance(tolerance); + if(env) { + builder.setClipEnvelope(env->getEnvelopeInternal()); + } + if(onlyEdges) { + Geometry* out = builder.getDiagramEdges(*g1->getFactory()).release(); + out->setSRID(g1->getSRID()); + return out; + } + else { + Geometry* out = builder.getDiagram(*g1->getFactory()).release(); + out->setSRID(g1->getSRID()); + return out; + } + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return NULL; + } + + int + GEOSSegmentIntersection_r(GEOSContextHandle_t extHandle, + double ax0, double ay0, double ax1, double ay1, + double bx0, double by0, double bx1, double by1, + double* cx, double* cy) + { + if(nullptr == extHandle) { + return 0; + } + + GEOSContextHandleInternal_t* handle = 0; + handle = reinterpret_cast(extHandle); + if(0 == handle->initialized) { + return 0; + } + + try { + geos::geom::LineSegment a(ax0, ay0, ax1, ay1); + geos::geom::LineSegment b(bx0, by0, bx1, by1); + geos::geom::Coordinate isect = a.intersection(b); + + if(isect.isNull()) { + return -1; + } + + *cx = isect.x; + *cy = isect.y; + + return 1; + } + catch(const std::exception& e) { + handle->ERROR_MESSAGE("%s", e.what()); + } + catch(...) { + handle->ERROR_MESSAGE("Unknown exception thrown"); + } + + return 0; + } + +} /* extern "C" */ + diff --git a/cmake/FindMakeDistCheck.cmake b/cmake/FindMakeDistCheck.cmake new file mode 100644 index 0000000..78096c2 --- /dev/null +++ b/cmake/FindMakeDistCheck.cmake @@ -0,0 +1,61 @@ +# Inspired by CMake Distcheck for LAAS-CNRS +# +# DEFINE_DISTCHECK +# --------------- +# +# Add a distcheck target to check the generated tarball. +# +# This step calls `make dist' to generate a copy of the sources as it +# stands in the current git HEAD i.e., unversioned files are skipped. +# +# Then: +# - create _build and _inst to respectively create a build +# and an installation directory. +# - run cmake with _inst as the installation prefix +# - run make, make check, make install and make uninstall +# - remove _build and _inst. +# - remove dist directory and confirm success. +# +# During the compilation phase, all files in the source tree are modified +# to *not* be writeable to detect bad compilation steps which tries to modify +# the source tree. Permissions are reverted at the end of the check. +# +macro(AddMakeDistCheck) + find_program(_tar tar) + find_program(_bzip2 bzip2) + string(TOLOWER "${CPACK_SOURCE_PACKAGE_FILE_NAME}" _distbasename) + set(_distname "${_distbasename}.tar.bz2") + set(_builddir "${CMAKE_BINARY_DIR}/${_distbasename}/_build") + set(_instdir "${CMAKE_BINARY_DIR}/${_distbasename}/_inst") + # message(STATUS "GEOS: _distbasename: ${_distbasename}") + # message(STATUS "GEOS: _distname: ${_distname}") + # message(STATUS "GEOS: _builddir: ${_builddir}") + # message(STATUS "GEOS: _instdir: ${_instdir}") + + add_custom_target(distcheck + COMMAND rm -rf "${_distbasename}" + && \(${_bzip2} -d -c "${_distname}" | ${_tar} xf -\) + && mkdir -vp "${_builddir}" + && mkdir -vp "${_instdir}" + && cd "${_builddir}" + && ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH="${_instdir}" .. + || \(echo "ERROR: the cmake configuration failed." && false\) + && make + || \(echo "ERROR: the compilation failed." && false\) + && make test + || \(echo "ERROR: the test suite failed." && false\) + && make install + || \(echo "ERROR: the install target failed." && false\) + && make uninstall + || \(echo "ERROR: the uninstall target failed." && false\) + && make clean + || \(echo "ERROR: the clean target failed." && false\) + && cd ../.. + && rm -rf "${_distbasename}" + && echo "==============================================================" + && echo "${_distname} is ready for distribution." + && echo "==============================================================" + ) + + add_dependencies(distcheck dist) +endmacro() diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in new file mode 100644 index 0000000..7c63427 --- /dev/null +++ b/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,48 @@ +################################################################################# +# +# This file is a part of CMake build configuration of GEOS library +# +# Defines commands used by make uninstall target of CMake build configuration. +# +# Author: Credit to the CMake mailing list archives for providing this solution. +# Modifications: Mateusz Loskot +# +################################################################################# +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR + "Cannot find install manifest: + @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif() + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") + +set(GEOS_INCLUDE_DIR) +foreach(file ${files}) + + if(${file} MATCHES "geom.h") + get_filename_component(GEOS_INCLUDE_DIR ${file} PATH) + endif() + + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(NOT EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + message(STATUS "\tTrying to execute remove command anyway.") + endif() + + exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif() +endforeach() + +message(STATUS "Deleting ${GEOS_INCLUDE_DIR} directory") +exec_program("@CMAKE_COMMAND@" + ARGS "-E remove_directory \"${GEOS_INCLUDE_DIR}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) +if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"${GEOS_INCLUDE_DIR}\"") +endif() diff --git a/cmake/geos-config.cmake b/cmake/geos-config.cmake new file mode 100644 index 0000000..402c4c1 --- /dev/null +++ b/cmake/geos-config.cmake @@ -0,0 +1,11 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ +include("${CMAKE_CURRENT_LIST_DIR}/geos-targets.cmake") diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..8677887 --- /dev/null +++ b/configure.ac @@ -0,0 +1,520 @@ +dnl +dnl configure.in - autoconf input template to produce ./configure script +dnl +dnl version 2.52 is required for Cygwin libtool support +AC_PREREQ([2.63]) + +dnl local vars to hold user's preferences -------------------------------- +AC_INIT([include/geos.h]) +AC_CANONICAL_SYSTEM + +AC_CONFIG_MACRO_DIR([macros]) + +dnl +dnl -- Release versions / C++ library SONAME will use these +dnl -- encoding ABI break at every release +dnl +VERTXT=${srcdir}/Version.txt +VERSION_MAJOR=`cat $VERTXT | awk -F= '/^GEOS_VERSION_MAJOR/ {print $2}'` +VERSION_MINOR=`cat $VERTXT | awk -F= '/^GEOS_VERSION_MINOR/ {print $2}'` +VERSION_PATCH=`cat $VERTXT | awk -F= '/^GEOS_VERSION_PATCH/ {print $2}'` +PATCH_WORD=`cat $VERTXT | awk -F= '/^GEOS_PATCH_WORD/ {print $2}'` + +VERSION_PATCH=${VERSION_PATCH}${PATCH_WORD} +VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" +VERSION_RELEASE=`echo "$VERSION" | sed -E 's/^([[0-9]+\.[0-9]+\.[0-9]+]).*$/\1/'` + +AC_MSG_CHECKING([for GEOS version]) +AC_MSG_RESULT(["$VERSION"]) + +CAPI_INTERFACE_CURRENT=`cat $VERTXT | awk -F= '/^CAPI_INTERFACE_CURRENT/ {print $2}'` +CAPI_INTERFACE_REVISION=`cat $VERTXT | awk -F= '/^CAPI_INTERFACE_REVISION/ {print $2}'` +CAPI_INTERFACE_AGE=`cat $VERTXT | awk -F= '/^CAPI_INTERFACE_AGE/ {print $2}'` + +dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE)) +dnl the following should be more portable +CAPI_VERSION_MAJOR=`expr $CAPI_INTERFACE_CURRENT - $CAPI_INTERFACE_AGE` +CAPI_VERSION_MINOR=$CAPI_INTERFACE_AGE +CAPI_VERSION_PATCH=$CAPI_INTERFACE_REVISION +CAPI_VERSION="$CAPI_VERSION_MAJOR.$CAPI_VERSION_MINOR.$CAPI_VERSION_PATCH" + +AC_MSG_CHECKING([for GEOS CAPI version]) +AC_MSG_RESULT(["$CAPI_VERSION"]) + +AM_INIT_AUTOMAKE([geos], [$VERSION], [no-define]) +AM_MAINTAINER_MODE +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) +AC_CONFIG_HEADERS([include/config.h]) +AC_PROG_CC + +AC_CONFIG_LINKS([tools/astyle.sh:tools/astyle.sh]) + +dnl -- JTS_PORT: the version of JTS this release is bound to +dnl JTS_PORT=1.13.0 +JTS_PORT=`cat $VERTXT | awk -F= '/^JTS_PORT/ {print $2}'` + +DOXYGEN_LOGFILE= +AC_SUBST(DOXYGEN_LOGFILE) + +dnl Hush warnings +AC_DEFINE(USE_UNSTABLE_GEOS_CPP_API, [1], [We know]) + +dnl use libtool ---------------------------------------------------------- +AC_LIBTOOL_DLOPEN +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + +dnl check for programs ---------------------------------------------------- +AC_PROG_CXX +AC_ISC_POSIX +AC_PROG_INSTALL +AC_PROG_MAKE_SET + +dnl function checks ------------------------------------------------------ +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_MEMCMP +AC_FUNC_STRFTIME +AC_FUNC_VPRINTF +AC_FUNC_ALLOCA +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS([memory.h]) +AC_CHECK_HEADERS([unistd.h]) +AC_CHECK_HEADERS([ieeefp.h]) +AC_CHECK_HEADERS([sys/file.h]) +AC_CHECK_HEADERS([sys/time.h]) +AC_CHECK_FUNCS([strchr memcpy gettimeofday]) +AC_HEADER_STAT +AC_STRUCT_TM +AC_TYPE_SIZE_T +AC_C_CONST + +dnl -------------------------------------------------------------------- +dnl - Check for inline and cassert settings +dnl -------------------------------------------------------------------- + + +AC_ARG_ENABLE([inline], [ --disable-inline Disable inlining], + [case "${enableval}" in + yes) enable_inline=true ;; + no) enable_inline=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-inline);; + esac], + [enable_inline=true] +) + +AC_ARG_ENABLE([cassert], [ --disable-cassert Disable assertion checking], + [case "${enableval}" in + yes) enable_cassert=true ;; + no) enable_cassert=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-cassert);; + esac], + [enable_cassert=true] +) + +AC_ARG_ENABLE([glibcxx-debug], [ --enable-glibcxx-debug Enable libstdc++ debug mode], + [case "${enableval}" in + yes) enable_glibcxx_debug=true ;; + no) enable_glibcxx_debug=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-glibcxx-debug);; + esac], + [enable_glibcxx_debug=false] +) + + +AC_MSG_CHECKING([if requested to force inline functions]) +INLINE_FLAGS= +AC_SUBST(INLINE_FLAGS) +if test x"$enable_inline" = xtrue; then + INLINE_FLAGS="-DGEOS_INLINE" + AM_CXXFLAGS="$AM_CXXFLAGS $INLINE_FLAGS" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +AC_MSG_CHECKING([if requested to enable assert macros]) +if test x"$enable_cassert" = xfalse; then + AM_CXXFLAGS="$AM_CXXFLAGS -DNDEBUG" + AC_MSG_RESULT([no]) +else + AC_MSG_RESULT([yes]) +fi + +AC_MSG_CHECKING([if requested libstdc++ debug mode]) +if test x"$enable_glibcxx_debug" = xtrue; then + AM_CXXFLAGS="$AM_CXXFLAGS -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +dnl -------------------------------------------------------------------- +dnl - Append default C++ and C flags +dnl -------------------------------------------------------------------- + +AX_CXX_COMPILE_STDCXX_11([noext],[mandatory]) + +WARNFLAGS="" +AC_LANG_PUSH([C++]) +dnl Available in GCC 5.1 +AX_CHECK_COMPILE_FLAG([-Wsuggest-override -Werror], [WARNFLAGS="$WARNFLAGS -Wsuggest-override"]) +dnl Available in clang 3.5 +AX_CHECK_COMPILE_FLAG([-Wmissing-override -Werror], [WARNFLAGS="$WARNFLAGS -Wmissing-override"]) +AC_LANG_POP([C++]) + +dnl In order for AC_LIBTOOL_COMPILER_OPTION to use +dnl the C compiler we need the hack below. +dnl It is likely a bug in the libtool macro file to +dnl require AC_LIBTOOL_LANG_CXX_CONFIG in *addition* +dnl to AC_LANG(CXX) or AC_LANG_PUSH(CXX)/AC_LANG_POP() +dnl +AC_LIBTOOL_LANG_CXX_CONFIG + +# Set default AM_CXXFLAGS and AM_CFLAGS +# -pedantic: ISO does not support long long +# we add -Wno-long-long to avoid those messages +AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -pedantic], [dummy_cv_pedantic], [-pedantic], [], [WARNFLAGS="$WARNFLAGS -pedantic"], []) +AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wall], [dummy_cv_wall], [-Wall], [], [WARNFLAGS="$WARNFLAGS -Wall"], []) +AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -Wno-long-long], [dummy_cv_wno_long_long], [-Wno-long-long], [], [WARNFLAGS="$WARNFLAGS -Wno-long-long"], []) + +# To make numerical computation more stable, we use --ffloat-store +NUMERICFLAGS="" +AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -ffloat-store], [dummy_cv_ffloat_store], [-ffloat-store], [], [NUMERICFLAGS="$NUMERICFLAGS -ffloat-store"], []) + +HUSHWARNING="-DUSE_UNSTABLE_GEOS_CPP_API" +DEFAULTFLAGS="${WARNFLAGS} ${NUMERICFLAGS} ${HUSHWARNING}" + +AM_CXXFLAGS="${AM_CXXFLAGS} ${DEFAULTFLAGS}" +AM_CFLAGS="${AM_CFLAGS} ${DEFAULTFLAGS}" +AC_SUBST(AM_CXXFLAGS) +AC_SUBST(AM_CFLAGS) + +dnl -------------------------------------------------------------------- +dnl - Look for finite and/or isfinite macros/functions +dnl -------------------------------------------------------------------- + +dnl These two tests need the math library or they won't link +dnl on OpenBSD, even if the functions exist. +save_LIBS=$LIBS +LIBS="$LIBS -lm" +AC_CACHE_CHECK([for finite], ac_cv_finite, + [AC_TRY_LINK([#include ], + [double x; int y; y = finite(x);], + ac_cv_finite=yes, + ac_cv_finite=no +)]) +if test x"$ac_cv_finite" = x"yes"; then + AC_DEFINE(HAVE_FINITE, [1], [Has finite]) +fi + +AC_CACHE_CHECK([for isfinite], ac_cv_isfinite, + [AC_TRY_LINK([#include ], + [double x; int y; y = isfinite(x);], + ac_cv_isfinite=yes, + ac_cv_isfinite=no +)]) +if test x"$ac_cv_isfinite" = x"yes"; then + AC_DEFINE(HAVE_ISFINITE, [1], [Has isfinite]) +fi + +dnl -------------------------------------------------------------------- +dnl Test for presence of isnan function when using C++ and +dnl This is for a particular bug in OS/X where drops the definition +dnl of isnan(). + +AC_LANG_PUSH([C++]) +AC_CACHE_CHECK([for isnan], ac_cv_isnan, + [AC_TRY_LINK([#include ], + [double x; int y; y = std::isnan(x);], + ac_cv_isnan=yes, + ac_cv_isnan=no +)]) +if test x"$ac_cv_isnan" = x"yes"; then + AC_DEFINE(HAVE_ISNAN, [1], [Has isnan]) +fi +AC_LANG_POP([C++]) + +dnl -------------------------------------------------------------------- + +LIBS=$save_LIBS + +dnl -------------------------------------------------------------------- +dnl - Look for a 64bit integer (do after CFLAGS is set) +dnl -------------------------------------------------------------------- + +dnl Find a working 64bit integer +PGAC_TYPE_64BIT_INT([int64_t]) +if test x"$HAVE_INT64_T_64" = x"no" ; then + PGAC_TYPE_64BIT_INT([long long int]) + if test x"$HAVE_LONG_LONG_INT_64" = x"no" ; then + PGAC_TYPE_64BIT_INT([long int]) + if test x"$HAVE_LONG_INT_64" = x"no" ; then + AC_MSG_WARN([Could not find a working 64bit int type, you may experience weird bugs (undefined behaviour)]); + fi + fi +fi + + + +dnl -------------------------------------------------------------------- +dnl - check whether python is required for the build +dnl -------------------------------------------------------------------- + +AC_ARG_ENABLE([python], [ --enable-python Enable build of python module], + [case "${enableval}" in + yes) use_python=true ;; + no) use_python=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;; + esac], + [use_python=false] +) + + +dnl -------------------------------------------------------------------- +dnl - check whether ruby is required for the build +dnl -------------------------------------------------------------------- + +AC_ARG_ENABLE([ruby], [ --enable-ruby Enable build of ruby module], + [case "${enableval}" in + yes) use_ruby=true ;; + no) use_ruby=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ruby) ;; + esac], + [use_ruby=false] +) + +dnl -------------------------------------------------------------------- +dnl - check for swig if python or ruby are enabled +dnl -------------------------------------------------------------------- + +use_swig=false +if test x"$use_python" = xtrue || + test x"$use_ruby" = xtrue; then + AC_PROG_SWIG(1.3.28) + if test x"$SWIG" != "x"; then + SWIG_ENABLE_CXX + AC_SUBST(SWIG) + use_swig=true + else + use_python=false + use_ruby=false + fi +fi +AM_CONDITIONAL(ENABLE_SWIG, [ test x"$use_swig" = xtrue ]) + + +dnl -------------------------------------------------------------------- +dnl - check for python if enabled +dnl -------------------------------------------------------------------- + +if test x"$use_python" = xtrue; then + dnl Check for Python + AM_PATH_PYTHON + SWIG_PYTHON + + if test x"$PYTHON" = "x"; then + use_python=false + fi + + AC_SUBST(PYTHON) + AC_SUBST(SWIG_PYTHON_CPPFLAGS) + AC_SUBST(SWIG_PYTHON_OPT) +fi +AM_CONDITIONAL(ENABLE_PYTHON, [test x"$use_python" = xtrue]) + + +dnl -------------------------------------------------------------------- +dnl - check for ruby if enabled +dnl -------------------------------------------------------------------- + +if test x"$use_ruby" = xtrue; then + dnl Check for Ruby + AC_RUBY_DEVEL + + if test x"$RUBY" = x; then + use_ruby=false + fi + +fi +AM_CONDITIONAL(ENABLE_RUBY, [ test x"$use_ruby" = xtrue ]) + +dnl -------------------------------------------------------------------- +dnl - do operating-system specific things +dnl -------------------------------------------------------------------- + +AC_MSG_CHECKING([OS-specific settings]) + +case "${host_os}" in + *darwin*) + AC_MSG_RESULT([${host_os}]) + AC_MSG_CHECKING([for OS/X version]) + kernel=`uname -r` + + # "Darwin 9.6.0" is Mac OSX 10.5.6 + # "Darwin 10.x" would presumably be Mac OS X 10.6.x + case "${kernel}" in + 8.*) + AC_MSG_RESULT([Mac OS X 10.4 Tiger]) + ;; + 9.*) + AC_MSG_RESULT([Mac OS X 10.5 Leopard]) + ;; + 10.*) +dnl AM_CXXFLAGS="$AM_CXXFLAGS -Wnon-virtual-dtor -Woverloaded-virtual" + AC_MSG_RESULT([Mac OS X 10.6 Snow Leopard]) + ;; + *) + AC_MSG_RESULT([Mac OS X (Darwin ${kernel} kernel)]) + ;; + esac + ;; +esac + +dnl -------------------------------------------------------------------- +dnl - check for boost +dnl -------------------------------------------------------------------- + +dnl -- AX_BOOST(1.32) +dnl -- if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then +dnl -- use_boost_utf=yes +dnl -- else +dnl -- use_boost_utf=no +dnl -- fi +dnl -- AM_CONDITIONAL(ENABLE_BOOST_UTF, [test "x$use_boost_utf" = "xyes"]) + +dnl things to substitute in output ---------------------------------------- +AC_SUBST(VERSION) +AC_SUBST(VERSION_MAJOR) +AC_SUBST(VERSION_MINOR) +AC_SUBST(VERSION_PATCH) +AC_SUBST(VERSION_RELEASE) +AC_SUBST(JTS_PORT) +AC_SUBST(CAPI_VERSION) +AC_SUBST(CAPI_VERSION_MAJOR) +AC_SUBST(CAPI_VERSION_MINOR) +AC_SUBST(CAPI_VERSION_PATCH) +AC_SUBST(CAPI_INTERFACE_CURRENT) +AC_SUBST(CAPI_INTERFACE_REVISION) +AC_SUBST(CAPI_INTERFACE_AGE) + +dnl output stuff ---------------------------------------------------------- + +AC_OUTPUT([ + Makefile + capi/Makefile + capi/geos_c.h + doc/Doxyfile + doc/Makefile + macros/Makefile + src/Makefile + src/algorithm/Makefile + src/algorithm/locate/Makefile + src/algorithm/distance/Makefile + src/geom/Makefile + src/geom/prep/Makefile + src/geom/util/Makefile + src/geomgraph/Makefile + src/geomgraph/index/Makefile + include/Makefile + include/geos/Makefile + include/geos/algorithm/Makefile + include/geos/algorithm/locate/Makefile + include/geos/algorithm/distance/Makefile + include/geos/algorithm/ttmath/Makefile + include/geos/geom/Makefile + include/geos/geom/prep/Makefile + include/geos/geom/util/Makefile + include/geos/geomgraph/Makefile + include/geos/geomgraph/index/Makefile + include/geos/index/Makefile + include/geos/index/bintree/Makefile + include/geos/index/chain/Makefile + include/geos/index/intervalrtree/Makefile + include/geos/index/quadtree/Makefile + include/geos/index/strtree/Makefile + include/geos/index/sweepline/Makefile + include/geos/io/Makefile + include/geos/linearref/Makefile + include/geos/noding/Makefile + include/geos/noding/snapround/Makefile + include/geos/operation/Makefile + include/geos/operation/buffer/Makefile + include/geos/operation/distance/Makefile + include/geos/operation/intersection/Makefile + include/geos/operation/linemerge/Makefile + include/geos/operation/overlay/Makefile + include/geos/operation/overlay/snap/Makefile + include/geos/operation/polygonize/Makefile + include/geos/operation/predicate/Makefile + include/geos/operation/relate/Makefile + include/geos/operation/sharedpaths/Makefile + include/geos/operation/union/Makefile + include/geos/operation/valid/Makefile + include/geos/planargraph/Makefile + include/geos/planargraph/algorithm/Makefile + include/geos/precision/Makefile + include/geos/simplify/Makefile + include/geos/triangulate/Makefile + include/geos/triangulate/quadedge/Makefile + include/geos/util/Makefile + include/geos/version.h + src/index/Makefile + src/index/bintree/Makefile + src/index/chain/Makefile + src/index/intervalrtree/Makefile + src/index/quadtree/Makefile + src/index/strtree/Makefile + src/index/sweepline/Makefile + src/io/Makefile + src/linearref/Makefile + src/noding/Makefile + src/noding/snapround/Makefile + src/operation/Makefile + src/operation/buffer/Makefile + src/operation/distance/Makefile + src/operation/intersection/Makefile + src/operation/linemerge/Makefile + src/operation/overlay/Makefile + src/operation/polygonize/Makefile + src/operation/predicate/Makefile + src/operation/relate/Makefile + src/operation/sharedpaths/Makefile + src/operation/union/Makefile + src/operation/valid/Makefile + src/planargraph/Makefile + src/precision/Makefile + src/simplify/Makefile + src/triangulate/Makefile + src/triangulate/quadedge/Makefile + src/util/Makefile + swig/geos.i + swig/Makefile + swig/python/Makefile + swig/python/tests/Makefile + swig/ruby/Makefile + swig/ruby/test/Makefile + tests/Makefile + tests/bigtest/Makefile + tests/unit/Makefile + benchmarks/Makefile + benchmarks/algorithm/Makefile + benchmarks/operation/Makefile + benchmarks/operation/buffer/Makefile + benchmarks/operation/predicate/Makefile + benchmarks/capi/Makefile + tests/xmltester/Makefile + tests/geostest/Makefile + tests/thread/Makefile + tools/Makefile + tools/geos-config + tools/astyle/Makefile + ]) + +dnl -- echo "---------------------------------------" +dnl -- echo "Boost UTF: $use_boost_utf" +echo "Swig: $use_swig" +echo "Python bindings: $use_python" +echo "Ruby bindings: $use_ruby" + +dnl -- echo "---------------------------------------" diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..4342a59 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,41 @@ + +hello all, + +to make binary .deb packages, do the following: +cd +cd .. +fakeroot debian/rules binary +cd .. + +here you have the .deb files. +you may first check them for standards compliance: lintian *.deb +root may install the packages to your system: dpkg -i *.deb + +a few notes: + +this package should work with any version of geos (provided geos is been made +in the same way), and debian (made on sarge, but tested to work under woody +without change. package versioning is been done automatically from geos. + +this debian package has been made under sarge, and then backported to Woody. +to avoid duplication, woody shortcomings have been bypassed only: + +dh_install was not working for woody with wildcards, so i have added +dh_movefiles, which works on definition files in the format used later by +dh_install. hence the symlinks pkg.files (for dh_movefiles) -> pkg.install +(for dh_install). + +the woody binaries are bigger then those on sarge, due to lesser stripping +options in woody dh_strip. + +under woody, doxygen is creating less html documentation files. if problematic, +woody users may use a libgeos-doc package made for any other architecture and +linux version. + +during my first tests on woody, dh_shlibdeps has sometimes failed, but this +phenomenum has diisappeared before i had a chance to further investigate. this +might be due to woody upgrade. + +please enjoy, + +alex diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3f35aa8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,12 @@ +geos (2.1.0-1) unstable; urgency=low + + * Debian Package rebuild. + + -- Alex Bodnaru Sat, 27 Nov 2004 04:03:01 +0200 + +geos (2.0.1-1) unstable; urgency=low + + * Initial Release. + + -- Alex Bodnaru Mon, 8 Nov 2004 06:47:01 +0200 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..d86299a --- /dev/null +++ b/debian/control @@ -0,0 +1,51 @@ +Source: geos +Section: science +Priority: optional +Maintainer: Alex Bodnaru +Build-Depends: debhelper (>= 4.0.0), c++-compiler, doxygen, autoconf2.13, autotools-dev +Standards-Version: 3.6.1 + +Package: libgeos-dev +Section: science +Priority: optional +Architecture: any +Depends: libgeos (= ${Source-Version}) +Recommends: libgeos-doc (= ${Source-Version}) +Description: GEOS (Geometry Engine - Open Source) development files + GEOS (Geometry Engine - Open Source) is a C++ port of the + Java Topology Suite (JTS). As such, it aims to contain the + complete functionality of JTS in C++. This includes all + the OpenGIS "Simple Features for SQL" spatial predicate + functions and spatial operators, as well as specific JTS + topology functions such as IsValid(). + . + This package contains the files required to compile and + link a program with GEOS. + +Package: libgeos +Section: science +Priority: optional +Architecture: any +Depends: ${shlibs:Depends} +Description: GEOS (Geometry Engine - Open Source) library + GEOS (Geometry Engine - Open Source) is a C++ port of the + Java Topology Suite (JTS). As such, it aims to contain the + complete functionality of JTS in C++. This includes all + the OpenGIS "Simple Features for SQL" spatial predicate + functions and spatial operators, as well as specific JTS + topology functions such as IsValid(). + +Package: libgeos-doc +Section: doc +Priority: optional +Architecture: all +Description: GEOS (Geometry Engine - Open Source) documentation + GEOS (Geometry Engine - Open Source) is a C++ port of the + Java Topology Suite (JTS). As such, it aims to contain the + complete functionality of JTS in C++. This includes all + the OpenGIS "Simple Features for SQL" spatial predicate + functions and spatial operators, as well as specific JTS + topology functions such as IsValid(). + . + This package contains a reference manual for the GEOS library + claees. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..1b6a712 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,28 @@ +This package was debianized by Alex Bodnaru on +Mon, 8 Nov 2004 06:47:01 +0200. + +It was downloaded from http://geos.osgeo.org + +Upstream Authors: See /usr/share/libgeos/AUTHORS + +License: LGPL + +Copyright: + +This package is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This package is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this package; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +On Debian systems, the complete text of the GNU Lesser General +Public License can be found in `/usr/share/common-licenses/LGPL'. + diff --git a/debian/geos-config.1 b/debian/geos-config.1 new file mode 100644 index 0000000..1b4c54a --- /dev/null +++ b/debian/geos-config.1 @@ -0,0 +1,63 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH GEOS 1 "November 8, 2004" +.\" Please adjust this date whenever revising the manpage. +.SH NAME +geos-config - script to get information about the installed version of GEOS +.SH SYNOPSIS +.B geos-config +[\-\-prefix\fI[=DIR]\fP] [\-\-version] [\-\-libs] [\-\-cflags] [\-\-includes] [\-\-jtsport] +.br +.SH DESCRIPTION +.PP +\fIgeos-config\fP is a tool that is used to configure to determine +the compiler and linker flags that should be used to compile +and link programs that use \fIGEOS\fP. It is also used internally +to the .m4 macros for GNU autoconf that are included with \fIGEOS\fP. +. +\fIGEOS (Geometry Engine - Open Source)\fP is a C++ port of the +\fIJava Topology Suite (JTS)\fP. As such, it aims to contain the +complete functionality of JTS in C++. This includes all the +\fIOpenGIS "Simple Features for SQL"\fP spatial predicate functions +and spatial operators, as well as specific JTS topology +functions such as IsValid(). +. +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +.l +\fIgeos-config\fP accepts the following options: +.TP 8 +.B \-\-version +Print the currently installed version of \fIGEOS\fP on the standard output. +.TP 8 +.B \-\-libs +Print the linker flags that are necessary to link a \fIGEOS\fP program. +.TP 8 +.B \-\-cflags +Print the compiler flags that are necessary to compile a \fIGEOS\fP program. +.TP 8 +.B \-\-prefix=PREFIX +If specified, use PREFIX instead of the installation prefix that \fIGEOS\fP +was built with when computing the output for the \-\-cflags and +\-\-libs options. This option must be specified before any +\-\-libs or \-\-cflags options. +.TP 8 +.B \-\-jtsport +Print the version of Java Topology Suite library, which is implemented +by the current \fIGEOS\fP library. + +.SH SEE ALSO +.BR /usr/share/doc/libgeos-doc/html/index.html +.br +The installed \fIGEOS\fP library is fully documented in the GEOS documentation +package, at +.IR /usr/share/doc/libgeos-doc/html/index.html +and the pages at the same location, viewable with a web browser. +. +For further information, see the \fIGEOS\fP home page, at +http://geos.osgeo.org/. +.SH AUTHOR +See /usr/share/doc/libgeos/AUTHORS +.PP +This manual page was written by Alex Bodnaru , +for the Debian project (but may be used by others). diff --git a/debian/libgeos-dev.dirs b/debian/libgeos-dev.dirs new file mode 100644 index 0000000..c2de429 --- /dev/null +++ b/debian/libgeos-dev.dirs @@ -0,0 +1,4 @@ +usr/bin +usr/lib +usr/include +usr/include/geos diff --git a/debian/libgeos-dev.docs b/debian/libgeos-dev.docs new file mode 100644 index 0000000..b0f9c78 --- /dev/null +++ b/debian/libgeos-dev.docs @@ -0,0 +1,4 @@ +README +NEWS +TODO +AUTHORS diff --git a/debian/libgeos-dev.install b/debian/libgeos-dev.install new file mode 100644 index 0000000..81e73c2 --- /dev/null +++ b/debian/libgeos-dev.install @@ -0,0 +1,6 @@ +usr/bin/* +usr/include/* +usr/lib/lib*.a +usr/lib/lib*.so +usr/lib/*.la +usr/share/man/man1/* diff --git a/debian/libgeos-dev.manpages b/debian/libgeos-dev.manpages new file mode 100644 index 0000000..136d5cd --- /dev/null +++ b/debian/libgeos-dev.manpages @@ -0,0 +1 @@ +debian/geos-config.1 diff --git a/debian/libgeos-doc.doc-base b/debian/libgeos-doc.doc-base new file mode 100644 index 0000000..9a93248 --- /dev/null +++ b/debian/libgeos-doc.doc-base @@ -0,0 +1,10 @@ +Document: geos-reference-manual +Title: GEOS Reference Manual +Author: See /usr/share/doc/libgeos/AUTHORS +Abstract: This manual provides the libgeos + API reference. +Section: science + +Format: HTML +Index: /usr/share/doc/libgeos-doc/html/index.html +Files: /usr/share/doc/libgeos-doc/html/*.html diff --git a/debian/libgeos-doc.docs b/debian/libgeos-doc.docs new file mode 100644 index 0000000..924bae5 --- /dev/null +++ b/debian/libgeos-doc.docs @@ -0,0 +1,3 @@ +doc/doxygen_docs/html +README +AUTHORS diff --git a/debian/libgeos.dirs b/debian/libgeos.dirs new file mode 100644 index 0000000..6845771 --- /dev/null +++ b/debian/libgeos.dirs @@ -0,0 +1 @@ +usr/lib diff --git a/debian/libgeos.docs b/debian/libgeos.docs new file mode 100644 index 0000000..0b4cf0a --- /dev/null +++ b/debian/libgeos.docs @@ -0,0 +1,3 @@ +NEWS +TODO +AUTHORS diff --git a/debian/libgeos.install b/debian/libgeos.install new file mode 100644 index 0000000..d0dbfd1 --- /dev/null +++ b/debian/libgeos.install @@ -0,0 +1 @@ +usr/lib/lib*.so.* diff --git a/debian/makedoc b/debian/makedoc new file mode 100755 index 0000000..d3ddb2c --- /dev/null +++ b/debian/makedoc @@ -0,0 +1,8 @@ +#!/bin/sh + +cd doc +make doxygen-html +cd doxygen_docs +cd ../.. +mkdir -p debian/tmp/usr/share/man/man1 +cp debian/geos-config.1 debian/tmp/usr/share/man/man1 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..321ed53 --- /dev/null +++ b/debian/rules @@ -0,0 +1,127 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +# shared library versions +version=`ls source/geom/.libs/lib*.so.* | \ + awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'` +major=`ls source/geom/.libs/lib*.so.* | \ + awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'` + +#ifeq "2" "$(major)" +# POSTGIS_CONFLICT='-u-DConflicts="libpostgis (<< 0.9.0)"' +# echo "ver 2" +#endif + +config.status: configure + dh_testdir + # Add here commands to configure the package. + CFLAGS="$(CFLAGS)" \ + ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info + + +build: build-stamp +build-stamp: config.status + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + $(MAKE) check + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + rm -f debian/shlibs.local + + # Add here commands to clean up after the build process. + -$(MAKE) distclean +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp + $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp + $(MAKE) installcheck DESTDIR=$(CURDIR)/debian/tmp + $(CURDIR)/debian/makedoc + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installchangelogs debian/changelog + dh_installdocs + dh_installexamples doc/example.cpp + dh_movefiles --sourcedir=debian/tmp #woody uses wildcards in pkg.files +# dh_install --sourcedir=$(CURDIR)debian/tmp #woody doesn't use wildcards +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_python + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol $(POSTGIS_CONFLICT) + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..6590f12 --- /dev/null +++ b/debian/watch @@ -0,0 +1,6 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# Site Directory Pattern Version Script +version=2 +geos.refractions.net / geos-(.*)\.tar.bz2 debian uupdate diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..9365381 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,55 @@ +################################################################################ +# Part of CMake configuration for GEOS +# +# Copyright (C) 2018 Mateusz Loskot +# Copyright (C) 2019 Daniel Baston +# +# This is free software; you can redistribute and/or modify it under +# the terms of the GNU Lesser General Public Licence as published +# by the Free Software Foundation. +# See the COPYING file for more information. +################################################################################ + +add_executable(example example.cpp) + +target_link_libraries(example PRIVATE geos) +target_include_directories(test_geos_unit + PRIVATE + $) + +option(BUILD_DOCUMENTATION "Build Doxygen documentation" OFF) + +if(BUILD_DOCUMENTATION) + find_package(Doxygen) + + if(NOT DOXYGEN_FOUND) + message(FATAL_ERROR "Doxygen was not found.") + endif() + + set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) + set(VERSION ${GEOS_VERSION_FULL}) + set(DOXYGEN_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxygen.log) + set(CHECK_ERROR_SCRIPT "check_doxygen_errors.cmake") + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/${CHECK_ERROR_SCRIPT}" + "${CMAKE_CURRENT_BINARY_DIR}/${CHECK_ERROR_SCRIPT}" + COPYONLY) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in + ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + @ONLY) + unset(srcdir) + unset(VERSION) + + add_custom_target(docs + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + BYPRODUCTS ${DOXYGEN_LOGFILE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen_docs) + + add_test(NAME test_docs + COMMAND ${CMAKE_COMMAND} + -D DOXYGEN_LOGFILE="${DOXYGEN_LOGFILE}" + -P "${CMAKE_CURRENT_BINARY_DIR}/${CHECK_ERROR_SCRIPT}") + + unset(DOXYGEN_LOGFILE) + unset(CHECK_ERROR_SCRIPT) +endif() diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in new file mode 100644 index 0000000..c841508 --- /dev/null +++ b/doc/Doxyfile.in @@ -0,0 +1,2450 @@ +# Doxyfile 1.8.14 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = GEOS + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = @VERSION@ + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = doxygen_docs + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = NO + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = NO + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = @DOXYGEN_LOGFILE@ + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = @srcdir@/../src \ + @srcdir@/../include \ + @srcdir@/../capi + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.h + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = */examples/* \ + */test/* \ + */bigtest/* \ + */io/markup/* \ + */ttmath/* \ + config.h \ + acconfig.h \ + CoordinateList.cpp \ + NonRobustLineIntersector.cpp \ + RobustLineIntersector.cpp + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/ + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /