-
Notifications
You must be signed in to change notification settings - Fork 345
/
BufferBuilder.cpp
724 lines (602 loc) · 23.1 KB
/
BufferBuilder.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2009-2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2008-2010 Safe Software Inc.
* Copyright (C) 2005-2007 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions 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.
*
**********************************************************************
*
* Last port: operation/buffer/BufferBuilder.java r378 (JTS-1.12)
*
**********************************************************************/
#include <geos/geom/CoordinateSequenceFactory.h>
#include <geos/geom/GeometryFactory.h>
#include <geos/geom/Location.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/Polygon.h>
#include <geos/geom/GeometryCollection.h>
#include <geos/geom/LineString.h>
#include <geos/geom/MultiLineString.h>
#include <geos/operation/buffer/BufferBuilder.h>
#include <geos/operation/buffer/OffsetCurveBuilder.h>
#include <geos/operation/buffer/BufferCurveSetBuilder.h>
#include <geos/operation/buffer/BufferSubgraph.h>
#include <geos/operation/buffer/SubgraphDepthLocater.h>
#include <geos/operation/overlay/OverlayOp.h>
#include <geos/operation/overlay/snap/SnapOverlayOp.h>
#include <geos/operation/overlay/PolygonBuilder.h>
#include <geos/operation/overlay/OverlayNodeFactory.h>
#include <geos/operation/valid/RepeatedPointRemover.h>
#include <geos/operation/linemerge/LineMerger.h>
#include <geos/algorithm/LineIntersector.h>
#include <geos/noding/IntersectionAdder.h>
#include <geos/noding/SegmentString.h>
#include <geos/noding/MCIndexNoder.h>
#include <geos/noding/NodedSegmentString.h>
#include <geos/geom/Position.h>
#include <geos/geomgraph/PlanarGraph.h>
#include <geos/geomgraph/Label.h>
#include <geos/geomgraph/Node.h>
#include <geos/geomgraph/Edge.h>
#include <geos/util/GEOSException.h>
#include <geos/io/WKTWriter.h> // for debugging
#include <geos/util/IllegalArgumentException.h>
#include <geos/profiler.h>
#include <geos/util/Interrupt.h>
#include <cassert>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <iostream>
// Debug single sided buffer
//#define GEOS_DEBUG_SSB 1
#ifndef GEOS_DEBUG
#define GEOS_DEBUG 0
#endif
#ifndef JTS_DEBUG
#define JTS_DEBUG 0
#endif
//
using namespace geos::geom;
using namespace geos::geomgraph;
using namespace geos::noding;
using namespace geos::algorithm;
using namespace geos::operation::overlay;
using namespace geos::operation::linemerge;
namespace {
// Debug routine
template <class Iterator>
std::unique_ptr<Geometry>
convertSegStrings(const GeometryFactory* fact, Iterator it, Iterator et)
{
std::vector<Geometry*> lines;
while(it != et) {
const SegmentString* ss = *it;
LineString* line = fact->createLineString(ss->getCoordinates()->clone().release());
lines.push_back(line);
++it;
}
return std::unique_ptr<Geometry>(fact->buildGeometry(lines.begin(), lines.end()));
}
}
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
#if PROFILE
static Profiler* profiler = Profiler::instance();
#endif
int
BufferBuilder::depthDelta(const Label& label)
{
Location lLoc = label.getLocation(0, Position::LEFT);
Location rLoc = label.getLocation(0, Position::RIGHT);
if(lLoc == Location::INTERIOR && rLoc == Location::EXTERIOR) {
return 1;
}
else if(lLoc == Location::EXTERIOR && rLoc == Location::INTERIOR) {
return -1;
}
return 0;
}
BufferBuilder::~BufferBuilder()
{
delete li; // could be NULL
delete intersectionAdder;
}
/*public*/
std::unique_ptr<Geometry>
BufferBuilder::bufferLineSingleSided(const Geometry* g, double distance,
bool leftSide)
{
// Returns the line used to create a single-sided buffer.
// Input requirement: Must be a LineString.
const LineString* l = dynamic_cast< const LineString* >(g);
if(!l) {
throw util::IllegalArgumentException("BufferBuilder::bufferLineSingleSided only accept linestrings");
}
// Nothing to do for a distance of zero
if(distance == 0) {
return g->clone();
}
// Get geometry factory and precision model.
const PrecisionModel* precisionModel = workingPrecisionModel;
if(!precisionModel) {
precisionModel = l->getPrecisionModel();
}
assert(precisionModel);
assert(l);
geomFact = l->getFactory();
// First, generate the two-sided buffer using a butt-cap.
BufferParameters modParams = bufParams;
modParams.setEndCapStyle(BufferParameters::CAP_FLAT);
modParams.setSingleSided(false); // ignore parameter for areal-only geometries
// This is a (temp?) hack to workaround the fact that
// BufferBuilder BufferParameters are immutable after
// construction, while we want to force the end cap
// style to FLAT for single-sided buffering
BufferBuilder tmpBB(modParams);
std::unique_ptr<Geometry> buf(tmpBB.buffer(l, distance));
// Create MultiLineStrings from this polygon.
std::unique_ptr<Geometry> bufLineString(buf->getBoundary());
#ifdef GEOS_DEBUG_SSB
std::cerr << "input|" << *l << std::endl;
std::cerr << "buffer|" << *bufLineString << std::endl;
#endif
// Then, get the raw (i.e. unnoded) single sided offset curve.
OffsetCurveBuilder curveBuilder(precisionModel, modParams);
std::vector< CoordinateSequence* > lineList;
{
std::unique_ptr< CoordinateSequence > coords(g->getCoordinates());
curveBuilder.getSingleSidedLineCurve(coords.get(), distance,
lineList, leftSide, !leftSide);
coords.reset();
}
// Create a SegmentString from these coordinates.
SegmentString::NonConstVect curveList;
for(unsigned int i = 0; i < lineList.size(); ++i) {
CoordinateSequence* seq = lineList[i];
// SegmentString takes ownership of CoordinateSequence
SegmentString* ss = new NodedSegmentString(seq, nullptr);
curveList.push_back(ss);
}
lineList.clear();
// Node these SegmentStrings.
Noder* noder = getNoder(precisionModel);
noder->computeNodes(&curveList);
SegmentString::NonConstVect* nodedEdges = noder->getNodedSubstrings();
// Create a geometry out of the noded substrings.
std::vector< Geometry* >* singleSidedNodedEdges =
new std::vector< Geometry* >();
singleSidedNodedEdges->reserve(nodedEdges->size());
for(std::size_t i = 0, n = nodedEdges->size(); i < n; ++i) {
SegmentString* ss = (*nodedEdges)[i];
Geometry* tmp = geomFact->createLineString(
ss->getCoordinates()->clone().release()
);
delete ss;
singleSidedNodedEdges->push_back(tmp);
}
delete nodedEdges;
for(std::size_t i = 0, n = curveList.size(); i < n; ++i) {
delete curveList[i];
}
curveList.clear();
std::unique_ptr<Geometry> singleSided(geomFact->createMultiLineString(
singleSidedNodedEdges));
#ifdef GEOS_DEBUG_SSB
std::cerr << "edges|" << *singleSided << std::endl;
#endif
// Use the boolean operation intersect to obtain the line segments lying
// on both the butt-cap buffer and this multi-line.
//Geometry* intersectedLines = singleSided->intersection( bufLineString );
// NOTE: we use Snapped overlay because the actual buffer boundary might
// diverge from original offset curves due to the addition of
// intersections with caps and joins curves
using geos::operation::overlay::snap::SnapOverlayOp;
std::unique_ptr<Geometry> intersectedLines = SnapOverlayOp::overlayOp(*singleSided, *bufLineString,
OverlayOp::opINTERSECTION);
#ifdef GEOS_DEBUG_SSB
std::cerr << "intersection" << "|" << *intersectedLines << std::endl;
#endif
// Merge result lines together.
LineMerger lineMerge;
lineMerge.add(intersectedLines.get());
auto mergedLines = lineMerge.getMergedLineStrings();
// Convert the result into a std::vector< Geometry* >.
std::vector< Geometry* >* mergedLinesGeom = new std::vector< Geometry* >();
const Coordinate& startPoint = l->getCoordinatesRO()->front();
const Coordinate& endPoint = l->getCoordinatesRO()->back();
while(!mergedLines.empty()) {
// Remove end points if they are a part of the original line to be
// buffered.
CoordinateSequence::Ptr coords(mergedLines.back()->getCoordinates());
if(nullptr != coords) {
// Use 98% of the buffer width as the point-distance requirement - this
// is to ensure that the point that is "distance" +/- epsilon is not
// included.
//
// Let's try and estimate a more accurate bound instead of just assuming
// 98%. With 98%, the epsilon grows as the buffer distance grows,
// so that at large distance, artifacts may skip through this filter
// Let the length of the line play a factor in the distance, which is still
// going to be bounded by 98%. Take 10% of the length of the line from the buffer distance
// to try and minimize any artifacts.
const double ptDistAllowance = std::max(distance - l->getLength() * 0.1, distance * 0.98);
// Use 102% of the buffer width as the line-length requirement - this
// is to ensure that line segments that is length "distance" +/-
// epsilon is removed.
const double segLengthAllowance = 1.02 * distance;
std::size_t front = 0;
std::size_t back = coords->size() - 1;
std::size_t sz = back - front + 1;
// Clean up the front of the list.
// Loop until the line's end is not inside the buffer width from
// the startPoint.
while (sz > 1 && coords->getAt(front).distance(startPoint) < ptDistAllowance) {
// Record the end segment length.
double segLength = coords->getAt(front).distance(coords->getAt(front + 1));
// Stop looping if there are no more points, or if the segment
// length is larger than the buffer width.
if(segLength > segLengthAllowance) {
break;
}
// If the first point is less than buffer width away from the
// reference point, then delete the point.
front++;
sz--;
}
while(sz > 1 && coords->getAt(front).distance(endPoint) < ptDistAllowance) {
double segLength = coords->getAt(front).distance(coords->getAt(front + 1));
if(segLength > segLengthAllowance) {
break;
}
front++;
sz--;
}
// Clean up the back of the list.
while(sz > 1 && coords->getAt(back).distance(startPoint) < ptDistAllowance) {
double segLength = coords->getAt(back).distance(coords->getAt(back - 1));
if(segLength > segLengthAllowance) {
break;
}
back--;
sz--;
}
while(sz > 1 && coords->getAt(back).distance(endPoint) < ptDistAllowance) {
double segLength = coords->getAt(back).distance(coords->getAt(back - 1));
if(segLength > segLengthAllowance) {
break;
}
back--;
sz--;
}
if (sz > 1) {
if (sz < coords->size()) {
// Points were removed; make a new CoordinateSequence
auto seqFactory = geomFact->getCoordinateSequenceFactory();
auto newSeq = seqFactory->create(sz, coords->getDimension());
for (std::size_t i = 0; i < sz; i++) {
newSeq->setAt(coords->getAt(i + front), i);
}
coords = std::move(newSeq);
}
// Add the coordinates to the resultant line string.
mergedLinesGeom->push_back(geomFact->createLineString(coords.release()));
}
}
mergedLines.pop_back();
}
// Clean up.
if(noder != workingNoder) {
delete noder;
}
buf.reset();
singleSided.reset();
intersectedLines.reset();
if(mergedLinesGeom->size() > 1) {
return std::unique_ptr<Geometry>(geomFact->createMultiLineString(mergedLinesGeom));
}
else if(mergedLinesGeom->size() == 1) {
std::unique_ptr<Geometry> single((*mergedLinesGeom)[0]);
delete mergedLinesGeom;
return single;
}
else {
delete mergedLinesGeom;
return geomFact->createLineString();
}
}
/*public*/
std::unique_ptr<Geometry>
BufferBuilder::buffer(const Geometry* g, double distance)
// throw(GEOSException *)
{
const PrecisionModel* precisionModel = workingPrecisionModel;
if(precisionModel == nullptr) {
precisionModel = g->getPrecisionModel();
}
assert(precisionModel);
assert(g);
// factory must be the same as the one used by the input
geomFact = g->getFactory();
{
// This scope is here to force release of resources owned by
// BufferCurveSetBuilder when we're doing with it
BufferCurveSetBuilder curveSetBuilder(*g, distance, precisionModel, bufParams);
curveSetBuilder.setInvertOrientation(isInvertOrientation);
GEOS_CHECK_FOR_INTERRUPTS();
std::vector<SegmentString*>& bufferSegStrList = curveSetBuilder.getCurves();
#if GEOS_DEBUG
std::cerr << "BufferCurveSetBuilder got " << bufferSegStrList.size()
<< " curves" << std::endl;
#endif
// short-circuit test
if(bufferSegStrList.empty()) {
return createEmptyResultGeometry();
}
#if GEOS_DEBUG
std::cerr << "BufferBuilder::buffer computing NodedEdges" << std::endl;
#endif
computeNodedEdges(bufferSegStrList, precisionModel);
GEOS_CHECK_FOR_INTERRUPTS();
} // bufferSegStrList and contents are released here
#if GEOS_DEBUG > 1
std::cerr << std::endl << edgeList << std::endl;
#endif
std::unique_ptr<Geometry> resultGeom(nullptr);
std::unique_ptr< std::vector<Geometry*> > resultPolyList;
std::vector<BufferSubgraph*> subgraphList;
try {
PlanarGraph graph(OverlayNodeFactory::instance());
graph.addEdges(edgeList.getEdges());
GEOS_CHECK_FOR_INTERRUPTS();
createSubgraphs(&graph, subgraphList);
#if GEOS_DEBUG
std::cerr << "Created " << subgraphList.size() << " subgraphs" << std::endl;
#if GEOS_DEBUG > 1
for(std::size_t i = 0, n = subgraphList.size(); i < n; i++) {
std::cerr << std::setprecision(10) << *(subgraphList[i]) << std::endl;
}
#endif
#endif
GEOS_CHECK_FOR_INTERRUPTS();
{
// scope for earlier PolygonBuilder cleanup
PolygonBuilder polyBuilder(geomFact);
buildSubgraphs(subgraphList, polyBuilder);
resultPolyList.reset(polyBuilder.getPolygons());
}
// Get rid of the subgraphs, shouldn't be needed anymore
for(std::size_t i = 0, n = subgraphList.size(); i < n; i++) {
delete subgraphList[i];
}
subgraphList.clear();
#if GEOS_DEBUG
std::cerr << "PolygonBuilder got " << resultPolyList->size()
<< " polygons" << std::endl;
#if GEOS_DEBUG > 1
for(std::size_t i = 0, n = resultPolyList->size(); i < n; i++) {
std::cerr << (*resultPolyList)[i]->toString() << std::endl;
}
#endif
#endif
// just in case ...
if(resultPolyList->empty()) {
return createEmptyResultGeometry();
}
// resultPolyList ownership transferred here
resultGeom.reset(geomFact->buildGeometry(resultPolyList.release()));
}
catch(const util::GEOSException& /* exc */) {
// In case they're still around
for(std::size_t i = 0, n = subgraphList.size(); i < n; i++) {
delete subgraphList[i];
}
subgraphList.clear();
throw;
}
return resultGeom;
}
/*private*/
Noder*
BufferBuilder::getNoder(const PrecisionModel* pm)
{
// this doesn't change workingNoder precisionModel!
if(workingNoder != nullptr) {
return workingNoder;
}
// otherwise use a fast (but non-robust) noder
if(li) { // reuse existing IntersectionAdder and LineIntersector
li->setPrecisionModel(pm);
assert(intersectionAdder != nullptr);
}
else {
li = new LineIntersector(pm);
intersectionAdder = new IntersectionAdder(*li);
}
MCIndexNoder* noder = new MCIndexNoder(intersectionAdder);
#if 0
/* CoordinateArraySequence.cpp:84:
* virtual const geos::Coordinate& geos::CoordinateArraySequence::getAt(std::size_t) const:
* Assertion `pos<vect->size()' failed.
*/
Noder* noder = new IteratedNoder(pm);
Noder noder = new MCIndexSnapRounder(pm);
Noder noder = new ScaledNoder(
new MCIndexSnapRounder(new PrecisionModel(1.0)),
pm.getScale());
#endif
return noder;
}
/* private */
void
BufferBuilder::computeNodedEdges(SegmentString::NonConstVect& bufferSegStrList,
const PrecisionModel* precisionModel) // throw(GEOSException)
{
Noder* noder = getNoder(precisionModel);
#if JTS_DEBUG
geos::io::WKTWriter wktWriter;
wktWriter.setTrim(true);
std::cerr << "before noding: "
<< wktWriter.write(
convertSegStrings(geomFact, bufferSegStrList.begin(),
bufferSegStrList.end()).get()
) << std::endl;
#endif
noder->computeNodes(&bufferSegStrList);
SegmentString::NonConstVect* nodedSegStrings = \
noder->getNodedSubstrings();
#if JTS_DEBUG
std::cerr << "after noding: "
<< wktWriter.write(
convertSegStrings(geomFact, bufferSegStrList.begin(),
bufferSegStrList.end()).get()
) << std::endl;
#endif
for(SegmentString::NonConstVect::iterator
i = nodedSegStrings->begin(), e = nodedSegStrings->end();
i != e;
++i) {
SegmentString* segStr = *i;
const Label* oldLabel = static_cast<const Label*>(segStr->getData());
auto cs = operation::valid::RepeatedPointRemover::removeRepeatedPoints(segStr->getCoordinates());
delete segStr;
if(cs->size() < 2) {
// don't insert collapsed edges
// we need to take care of the memory here as cs is a new sequence
continue;
}
// Edge takes ownership of the CoordinateSequence
Edge* edge = new Edge(cs.release(), *oldLabel);
// will take care of the Edge ownership
insertUniqueEdge(edge);
}
delete nodedSegStrings;
if(noder != workingNoder) {
delete noder;
}
}
/*private*/
void
BufferBuilder::insertUniqueEdge(Edge* e)
{
//<FIX> MD 8 Oct 03 speed up identical edge lookup
// fast lookup
Edge* existingEdge = edgeList.findEqualEdge(e);
// If an identical edge already exists, simply update its label
if(existingEdge != nullptr) {
Label& existingLabel = existingEdge->getLabel();
Label labelToMerge = e->getLabel();
// check if new edge is in reverse direction to existing edge
// if so, must flip the label before merging it
if(! existingEdge->isPointwiseEqual(e)) {
labelToMerge = e->getLabel();
labelToMerge.flip();
}
existingLabel.merge(labelToMerge);
// compute new depth delta of sum of edges
int mergeDelta = depthDelta(labelToMerge);
int existingDelta = existingEdge->getDepthDelta();
int newDelta = existingDelta + mergeDelta;
existingEdge->setDepthDelta(newDelta);
// we have memory release responsibility
delete e;
}
else { // no matching existing edge was found
// add this new edge to the list of edges in this graph
edgeList.add(e);
e->setDepthDelta(depthDelta(e->getLabel()));
}
}
bool
BufferSubgraphGT(BufferSubgraph* first, BufferSubgraph* second)
{
if(first->compareTo(second) > 0) {
return true;
}
else {
return false;
}
}
/*private*/
void
BufferBuilder::createSubgraphs(PlanarGraph* graph, std::vector<BufferSubgraph*>& subgraphList)
{
std::vector<Node*> nodes;
graph->getNodes(nodes);
for(std::size_t i = 0, n = nodes.size(); i < n; i++) {
Node* node = nodes[i];
if(!node->isVisited()) {
BufferSubgraph* subgraph = new BufferSubgraph();
subgraph->create(node);
subgraphList.push_back(subgraph);
}
}
/*
* Sort the subgraphs in descending order of their rightmost coordinate
* This ensures that when the Polygons for the subgraphs are built,
* subgraphs for shells will have been built before the subgraphs for
* any holes they contain
*/
std::sort(subgraphList.begin(), subgraphList.end(), BufferSubgraphGT);
}
/*private*/
void
BufferBuilder::buildSubgraphs(const std::vector<BufferSubgraph*>& subgraphList,
PolygonBuilder& polyBuilder)
{
#if GEOS_DEBUG
std::cerr << __FUNCTION__ << " got " << subgraphList.size() << " subgraphs" << std::endl;
#endif
std::vector<BufferSubgraph*> processedGraphs;
for(std::size_t i = 0, n = subgraphList.size(); i < n; i++) {
BufferSubgraph* subgraph = subgraphList[i];
Coordinate* p = subgraph->getRightmostCoordinate();
assert(p);
#if GEOS_DEBUG
std::cerr << " " << i << ") Subgraph[" << subgraph << "]" << std::endl;
std::cerr << " rightmost Coordinate " << *p;
#endif
SubgraphDepthLocater locater(&processedGraphs);
#if GEOS_DEBUG
std::cerr << " after SubgraphDepthLocater processedGraphs contain "
<< processedGraphs.size()
<< " elements" << std::endl;
#endif
int outsideDepth = locater.getDepth(*p);
#if GEOS_DEBUG
std::cerr << " Depth of rightmost coordinate: " << outsideDepth << std::endl;
#endif
subgraph->computeDepth(outsideDepth);
subgraph->findResultEdges();
#if GEOS_DEBUG
std::cerr << " after computeDepth and findResultEdges subgraph contain:" << std::endl
<< " " << subgraph->getDirectedEdges()->size() << " DirecteEdges " << std::endl
<< " " << subgraph->getNodes()->size() << " Nodes " << std::endl;
#endif
processedGraphs.push_back(subgraph);
#if GEOS_DEBUG
std::cerr << " added " << subgraph << " to processedGraphs, new size is "
<< processedGraphs.size() << std::endl;
#endif
polyBuilder.add(subgraph->getDirectedEdges(), subgraph->getNodes());
}
}
/*private*/
std::unique_ptr<geom::Geometry>
BufferBuilder::createEmptyResultGeometry() const
{
return geomFact->createPolygon();
}
} // namespace geos.operation.buffer
} // namespace geos.operation
} // namespace geos