File Coverage

Geos.xs
Criterion Covered Total %
statement 34 40 85.0
branch 14 36 38.8
condition n/a
subroutine n/a
pod n/a
total 48 76 63.1


line stmt bran cond sub pod time code
1             #include "xs/geos.h"
2             #include "panda/Geos/Helper.h"
3             #include "panda/Geos/tesselate.h"
4             #include "xsi/private_typemaps.h"
5              
6             using xs::my_perl;
7             using xs::Sv;
8             using namespace geos::geom;
9             using namespace geos::geom::prep;
10             using namespace geos::algorithm;
11             using namespace geos::noding;
12             using namespace geos::noding::snapround;
13             using namespace geos::io;
14             using namespace geos::index::chain;
15             using namespace geos::index;
16             using namespace geos::precision;
17             using namespace geos::operation::buffer;
18             using namespace geos::operation::distance;
19             using namespace geos::operation::overlay;
20             using namespace geos::operation::valid;
21             using namespace geos::operation::relate;
22             using namespace geos::operation::linemerge;
23             using namespace geos::triangulate;
24             using namespace xs;
25             using namespace Geo::Geos;
26             using namespace panda;
27              
28 2           struct IntersectionFinderAdder_payload {
29             using vector_t = std::vector<::geos::geom::Coordinate>;
30              
31             xs::Object lineIntersector;
32             vector_t coords;
33             };
34              
35 20           struct Noder_payload {
36             using vector_t = std::vector<::geos::noding::SegmentString*>;
37              
38             xs::Ref array_ref;
39             vector_t segments;
40             };
41              
42              
43 8           struct MonotoneChain_payload {
44             std::unique_ptr seq;
45             };
46              
47 4 50         struct SubItemVisitor: public geos::index::ItemVisitor {
48             xs::Sub sub;
49             Helper::lookup_map_t& lookup_map;
50              
51 2 50         SubItemVisitor(Sub sub_, Helper::lookup_map_t& lookup_map_):sub{sub_}, lookup_map{lookup_map_} {};
52 2           void visitItem (void *data) {
53 2           SV* key = static_cast(data);
54 2 50         HE* he = hv_fetch_ent(lookup_map, key, 0, 0);
55 2 50         if (!he) throw ("Cannot lookup key in map");
56 4 50         Scalar arg {HeVAL(he)};
57 2 50         sub(arg);
58 2           }
59             };
60              
61 16           struct SVs_map_payload {
62             Helper::lookup_map_t map;
63 16           SVs_map_payload(): map{Hash::create()} {}
64             };
65              
66             static xs::Sv::payload_marker_t payload_marker{};
67             static xs::Sv::payload_marker_t payload_marker_IntersectionFinderAdder{};
68             static xs::Sv::payload_marker_t payload_marker_Noder{};
69             static xs::Sv::payload_marker_t payload_marker_MonotoneChain{};
70             static xs::Sv::payload_marker_t payload_marker_SVs_map{};
71              
72 1           static int payload_marker_IntersectionFinderAdder_free(pTHX_ SV*, MAGIC* mg) {
73 1 50         if (mg->mg_virtual == &payload_marker_IntersectionFinderAdder) {
74 1           auto* payload = static_cast((void*)mg->mg_ptr);
75 1 50         delete payload;
76             }
77 1           return 0;
78             }
79              
80 5           static int payload_marker_Noder_free(pTHX_ SV*, MAGIC* mg) {
81 5 50         if (mg->mg_virtual == &payload_marker_Noder) {
82 5           auto* payload = static_cast((void*)mg->mg_ptr);
83 5 50         delete payload;
84             }
85 5           return 0;
86             }
87              
88 2           static int payload_marker_MonotoneChain_free(pTHX_ SV*, MAGIC* mg) {
89 2 50         if (mg->mg_virtual == &payload_marker_MonotoneChain) {
90 2           auto* payload = static_cast((void*)mg->mg_ptr);
91 2 50         delete payload;
92             }
93 2           return 0;
94             }
95              
96 8           static int payload_marker_SVs_map_free(pTHX_ SV*, MAGIC* mg) {
97 8 50         if (mg->mg_virtual == &payload_marker_SVs_map) {
98 8           auto* payload = static_cast((void*)mg->mg_ptr);
99 8 50         delete payload;
100             }
101 8           return 0;
102             }
103              
104              
105 0           static Sv coordinate_create_null () {
106 0 0         Sv ret = xs::out(aTHX_ new Coordinate());
    0          
    0          
107 0           return ret;
108             }
109              
110 0           static Sv coordinate_get_null () {
111 0 0         static thread_local Sv obj = coordinate_create_null();
112 0           return obj;
113             }
114              
115             //static Sv::payload_marker_t payload_marker;
116              
117             MODULE = Geo::Geos PACKAGE = Geo::Geos
118             PROTOTYPES: DISABLE
119              
120              
121             INCLUDE: xsi/Coordinate.xsi
122              
123             INCLUDE: xsi/Dimension.xsi
124              
125             INCLUDE: xsi/Envelope.xsi
126              
127             INCLUDE: xsi/PrecisionModel.xsi
128              
129             INCLUDE: xsi/IntersectionMatrix.xsi
130              
131             INCLUDE: xsi/Triangle.xsi
132              
133             INCLUDE: xsi/LineSegment.xsi
134              
135             INCLUDE: xsi/GeometryFactory.xsi
136              
137             INCLUDE: xsi/Geometry.xsi
138              
139             INCLUDE: xsi/GeometryCollection.xsi
140              
141             INCLUDE: xsi/Point.xsi
142              
143             INCLUDE: xsi/MultiPoint.xsi
144              
145             INCLUDE: xsi/LineString.xsi
146              
147             INCLUDE: xsi/MultiLineString.xsi
148              
149             INCLUDE: xsi/LinearRing.xsi
150              
151             INCLUDE: xsi/Polygon.xsi
152              
153             INCLUDE: xsi/MultiPolygon.xsi
154              
155             INCLUDE: xsi/WKBConstants.xsi
156              
157             INCLUDE: xsi/WKBWriter.xsi
158              
159             INCLUDE: xsi/WKBReader.xsi
160              
161             INCLUDE: xsi/WKTWriter.xsi
162              
163             INCLUDE: xsi/WKTReader.xsi
164              
165             INCLUDE: xsi/PrepGeometry.xsi
166              
167             INCLUDE: xsi/PrepGeometryFactory.xsi
168              
169             INCLUDE: xsi/algorithm.xsi
170              
171             INCLUDE: xsi/algorithm/HCoordinate.xsi
172              
173             INCLUDE: xsi/algorithm/MinimumDiameter.xsi
174              
175             INCLUDE: xsi/algorithm/LineIntersector.xsi
176              
177             INCLUDE: xsi/noding.xsi
178              
179             INCLUDE: xsi/noding/SegmentString.xsi
180              
181             INCLUDE: xsi/noding/SegmentNode.xsi
182              
183             INCLUDE: xsi/noding/NodedSegmentString.xsi
184              
185             INCLUDE: xsi/noding/BasicSegmentString.xsi
186              
187             INCLUDE: xsi/noding/SegmentIntersector.xsi
188              
189             INCLUDE: xsi/noding/SegmentIntersectionDetector.xsi
190              
191             INCLUDE: xsi/noding/SingleInteriorIntersectionFinder.xsi
192              
193             INCLUDE: xsi/noding/IntersectionAdder.xsi
194              
195             INCLUDE: xsi/noding/IntersectionFinderAdder.xsi
196              
197             INCLUDE: xsi/noding/Noder.xsi
198              
199             INCLUDE: xsi/noding/IteratedNoder.xsi
200              
201             INCLUDE: xsi/noding/ScaledNoder.xsi
202              
203             INCLUDE: xsi/noding/SinglePassNoder.xsi
204              
205             INCLUDE: xsi/noding/SimpleNoder.xsi
206              
207             INCLUDE: xsi/noding/SimpleSnapRounder.xsi
208              
209             INCLUDE: xsi/index/MonotoneChain.xsi
210              
211             INCLUDE: xsi/index/MonotoneChainOverlapAction.xsi
212              
213             INCLUDE: xsi/index/SpatialIndex.xsi
214              
215             INCLUDE: xsi/index/Quadtree.xsi
216              
217             INCLUDE: xsi/index/STRtree.xsi
218              
219             INCLUDE: xsi/precision.xsi
220              
221             INCLUDE: xsi/precision/GeometryPrecisionReducer.xsi
222              
223             INCLUDE: xsi/precision/SimpleGeometryPrecisionReducer.xsi
224              
225             INCLUDE: xsi/operation.xsi
226              
227             INCLUDE: xsi/triangulate/DelaunayTriangulationBuilder.xsi
228              
229             INCLUDE: xsi/triangulate/VoronoiDiagramBuilder.xsi