OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimPolyArea2d.cpp
Go to the documentation of this file.
1 //---
2 // License: See top level LICENSE.txt file.
3 //
4 // $Id: ossimPolyArea2d.cpp 23623 2015-11-13 18:24:28Z gpotts $
5 //---
6 
11 #include <ossim/base/ossimNotify.h>
12 #include <ossim/base/ossimRefPtr.h>
13 #include <ossim/base/ossimString.h>
14 #include <geos/geom/Coordinate.h>
15 #include <geos/geom/CoordinateArraySequence.h>
16 #include <geos/geom/GeometryFactory.h>
17 #include <geos/geom/LinearRing.h>
18 #include <geos/opBuffer.h>
19 #include <geos/geom/Point.h>
20 #include <geos/geom/Polygon.h>
21 #include <geos/geom/MultiPolygon.h>
22 #include <geos/geom/PrecisionModel.h>
23 #include <geos/io/WKTReader.h>
24 #include <geos/io/WKTWriter.h>
25 #include <geos/util/GEOSException.h>
26 #include <geos/operation/valid/IsValidOp.h>
27 #include <geos/opBuffer.h>
28 #include <cstdlib>
29 #include <exception>
30 #include <vector>
31 #include <mutex>
32 
33 class MyGeomFactory : public geos::geom::GeometryFactory
34 {
35 public:
37  geos::geom::GeometryFactory(new geos::geom::PrecisionModel(geos::geom::PrecisionModel::FLOATING),
38  -1)
39  {
40 
41  }
42 };
44 {
45 public:
47  : m_geomFactory(0)
48  {
49  //geos::geom::PrecisionModel *pm =
50  // new geos::geom::PrecisionModel(geos::geom::PrecisionModel::FLOATING);
51  m_geomFactory = new MyGeomFactory();//new geos::geom::GeometryFactory(pm, -1);
52  }
54 
56 };
57 
59 {
60 public:
61  typedef geos::geom::Geometry* GeometryPtr;
62  typedef const geos::geom::Geometry* ConstGeometryPtr;
63 
66 
67  void deleteGeometry() { if(m_geometry) { delete m_geometry; m_geometry = 0; }}
68  void setGeometry(const ossimPolygon& polygon, const vector<ossimPolygon>& holes = vector<ossimPolygon>());
70  geos::geom::GeometryFactory* geomFactory(){{return m_globalFactory.valid()?m_globalFactory->m_geomFactory:0;}}
73 };
74 
76 
78 :m_geometry(geom)
79 {
80  static std::mutex globalFactoryMutex;
81 
82  {
83  std::lock_guard<std::mutex> lock(globalFactoryMutex);
84  if(!m_globalFactory.valid())
85  {
87  }
88  }
89 }
90 
92 {
94 }
95 
97  const ossimPolygon& exteriorRing, const vector<ossimPolygon>& interiorRings)
98 {
100 
101  geos::geom::CoordinateArraySequence *cas = new geos::geom::CoordinateArraySequence();
102 
103  const std::vector<ossimDpt>& pts = exteriorRing.getVertexList();
104 
105  int idx = 0;
106  int n = (int)pts.size();
107 
108  if(n > 0)
109  {
110  //fill the exterior ring
111  for (idx = 0; idx < n; idx++)
112  {
113  cas->add(geos::geom::Coordinate(pts[idx].x, pts[idx].y));
114  }
115 
116  //if the original polygon didn't have the first and last point the same, make it so
117  if((pts[0].x != pts[n-1].x) || (pts[0].y!=pts[n-1].y))
118  {
119  cas->add(geos::geom::Coordinate(pts[0].x, pts[0].y));
120  }
121 
122  //fill the interior rings
123  vector<geos::geom::Geometry*> *holes = new vector<geos::geom::Geometry*>();
124  for (ossim_uint32 interiorRingIdx = 0; interiorRingIdx < interiorRings.size(); ++interiorRingIdx)
125  {
126  geos::geom::CoordinateArraySequence *interiorCas =
127  new geos::geom::CoordinateArraySequence();
128  const std::vector<ossimDpt>& vertexPts = interiorRings[interiorRingIdx].getVertexList();
129  for(ossim_uint32 vertexIndex=0; vertexIndex < vertexPts.size(); ++vertexIndex)
130  {
131  interiorCas->add(geos::geom::Coordinate(vertexPts[vertexIndex].x,
132  vertexPts[vertexIndex].y));
133  }
134 
135  //if the original polygon didn't have the first and last point the same, make it so
136  if((vertexPts[0].x != vertexPts[vertexPts.size()-1].x) ||
137  (vertexPts[0].y!=vertexPts[vertexPts.size()-1].y))
138  {
139  interiorCas->add(geos::geom::Coordinate(vertexPts[0].x, vertexPts[0].y));
140  }
141 
142  geos::geom::LinearRing *hole = geomFactory()->createLinearRing(interiorCas);
143  holes->push_back(hole);
144  }
145 
146  geos::geom::LinearRing* shell = geomFactory()->createLinearRing(cas);
147  if ( shell )
148  {
149  m_geometry = geomFactory()->createPolygon(shell, holes);
150  }
151  else
152  {
153  m_geometry = 0;
154  }
155  }
156 }
157 
159  std::vector<ossimPolygon>& polyList, const geos::geom::Geometry* geom) const
160 {
161  int nGeoms = (int)geom->getNumGeometries();
162 
163  if(nGeoms < 2 )
164  {
165  const geos::geom::Polygon* poly = dynamic_cast<const geos::geom::Polygon*> (geom);
166 
167  if (poly)
168  {
169  const geos::geom::LineString* lineString = dynamic_cast<const geos::geom::LineString*> (poly->getExteriorRing());
170  if (lineString)
171  {
172  int currentPolyIdx = (int)polyList.size();
173  int nPoints = (int)lineString->getNumPoints();
174  int idx = 0;
175 
176  polyList.push_back(ossimPolygon());
177 
178  for (idx=0; idx<nPoints; idx++)
179  {
180  std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
181  polyList[currentPolyIdx].addPoint(point->getX(), point->getY());
182  }
183  }
184  }
185  }
186  else
187  {
188  for (int idx=0; idx < nGeoms; ++idx)
189  {
190  recurseVisibleGeometries(polyList, geom->getGeometryN(idx));
191  }
192  }
193 }
194 
195 void ossimPolyArea2d::recurseHoles(std::vector<ossimPolygon>& polyList,
196  const geos::geom::Geometry* geom) const
197 {
198  int nGeoms = (int)geom->getNumGeometries();
199 
200  if(nGeoms < 2 )
201  {
202  const geos::geom::Polygon* poly = dynamic_cast<const geos::geom::Polygon*> (geom);
203 
204  if (poly)
205  {
206  ossim_uint32 nInteriorRings = (ossim_uint32)poly->getNumInteriorRing();
207  ossim_uint32 idx = 0;
208 
209  for(idx = 0; idx < nInteriorRings; ++idx)
210  {
211  const geos::geom::LineString* lineString = poly->getInteriorRingN(idx);
212  if (lineString)
213  {
214  int currentPolyIdx = (int)polyList.size();
215  int nPoints = (int)lineString->getNumPoints();
216  int idx = 0;
217 
218  polyList.push_back(ossimPolygon());
219 
220  for (idx=0; idx<nPoints; idx++)
221  {
222  std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
223  polyList[currentPolyIdx].addPoint(point->getX(), point->getY());
224  }
225  }
226  }
227  }
228  }
229  else
230  {
231  int idx = 0;
232 
233  for (idx=0; idx < nGeoms; idx++)
234  {
235  recurseHoles(polyList, geom->getGeometryN(idx));
236  }
237  }
238 }
239 
240 void ossimPolyArea2d::recurseCompleteGeometries(std::vector<ossimPolyArea2d>& polyList,
241  const geos::geom::Geometry* geom) const
242 {
243  int nGeoms = (int)geom->getNumGeometries();
244  if(nGeoms < 2 )
245  {
246  const geos::geom::Polygon* poly = dynamic_cast<const geos::geom::Polygon*> (geom);
247 
248  if (poly)
249  {
250  //get exterior shell for the geometry
251  ossimPolygon shell;
252  const geos::geom::LineString* lineString =
253  dynamic_cast<const geos::geom::LineString*> (poly->getExteriorRing());
254  if (lineString)
255  {
256  int nPoints = (int)lineString->getNumPoints();
257  for (int idx = 0; idx<nPoints; idx++)
258  {
259  std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
260  shell.addPoint(point->getX(), point->getY());
261  }
262  }
263 
264  // Get interior rings for the geometry.
265  std::size_t nInteriorRings = poly->getNumInteriorRing();
266  vector<ossimPolygon> holes(nInteriorRings);
267  for(std::size_t holeIdx = 0; holeIdx < nInteriorRings; ++holeIdx)
268  {
269  const geos::geom::LineString* lineString = poly->getInteriorRingN(holeIdx);
270  if (lineString)
271  {
272  std::size_t nPoints = lineString->getNumPoints();
273  for (std::size_t idx = 0; idx<nPoints; ++idx)
274  {
275  std::auto_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
276  holes[holeIdx].addPoint(point->getX(), point->getY());
277  }
278  }
279  }
280  polyList.push_back(ossimPolyArea2d(shell, holes));
281  }
282  }
283  else
284  {
285  int idx = 0;
286 
287  for (idx=0; idx < nGeoms; idx++)
288  {
289  recurseCompleteGeometries(polyList, geom->getGeometryN(idx));
290  }
291  }
292 }
293 
295 {
296  if(rhs.m_privateData->m_geometry)
297  {
298  out << rhs.m_privateData->m_geometry->toString();
299  }
300  return out;
301 }
302 
304  :m_privateData(new OssimPolyArea2dPrivate)
305 {
306 }
307 
308 ossimPolyArea2d::ossimPolyArea2d(const vector<ossimGpt>& polygon)
309  :m_privateData(new OssimPolyArea2dPrivate)
310 {
311  (*this) = polygon;
312 }
313 
314 ossimPolyArea2d::ossimPolyArea2d(const vector<ossimDpt>& polygon)
315  :m_privateData(new OssimPolyArea2dPrivate)
316 {
317  (*this) = polygon;
318 }
319 
321  :m_privateData(new OssimPolyArea2dPrivate)
322 {
323  (*this) = rect;
324 }
325 
327  :m_privateData(new OssimPolyArea2dPrivate)
328 {
329  (*this) = rect;
330 }
331 
333  :m_privateData(new OssimPolyArea2dPrivate)
334 {
335  (*this) = polygon;
336 }
337 
338 ossimPolyArea2d::ossimPolyArea2d(const ossimPolygon& exteriorRing, const vector<ossimPolygon>& interiorRings)
339  :m_privateData(new OssimPolyArea2dPrivate)
340 {
341  m_privateData->setGeometry(exteriorRing, interiorRings);
342 }
343 
345  :m_privateData(new OssimPolyArea2dPrivate)
346 {
347  *this = rhs;
348 }
349 
351  const ossimDpt& p2,
352  const ossimDpt& p3,
353  const ossimDpt& p4)
354  :
355  m_privateData(new OssimPolyArea2dPrivate)
356 {
357  ossimPolygon temp(p1,p2,p3,p4);
358  *this = temp;
359 }
360 
362 {
363  if(m_privateData)
364  {
365  delete m_privateData;
366  m_privateData = 0;
367  }
368 }
369 
371 {
372  if(this != &rhs)
373  {
374  if(rhs.m_privateData->m_geometry)
375  {
377  }
378  }
379  return *this;
380 }
381 
383 {
384  m_privateData->setGeometry(polygon);
385 
386  return *this;
387 }
388 
390 {
391  return (*this = ossimPolygon(rect));
392 }
393 
395 {
396  return (*this = ossimPolygon(rect));
397 }
398 
399 const ossimPolyArea2d& ossimPolyArea2d::operator =(const vector<ossimGpt>& polygon)
400 {
401  std::vector<ossimDpt> pts;
402  int idx = 0;
403  int n = (int)polygon.size();
404  for(idx = 0; idx < n;++idx)
405  {
406  pts.push_back(polygon[idx]);
407  }
408 
409  return (*this = ossimPolygon(pts));
410 }
411 
412 const ossimPolyArea2d& ossimPolyArea2d::operator =(const vector<ossimDpt>& polygon)
413 {
414  return (*this = ossimPolygon(polygon));
415 }
416 
418 {
419  bool result = false;
420 
422  {
423  result = m_privateData->m_geometry->intersects(rhs.m_privateData->m_geometry);
424  }
425 
426  return result;
427 }
428 
430 {
431  if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
432  {
433  ossimPolyArea2d result;
434  try // GEOS code throws exceptions...
435  {
436  result.m_privateData->setGeometry(m_privateData->m_geometry->intersection(
437  rhs.m_privateData->m_geometry));
438  }
439  catch( const std::exception& e )
440  {
442  << "ossimPolyArea2d::operator& Caught exception: " << e.what() << std::endl;
443  result.clearPolygons();
444  }
445  catch( ... )
446  {
448  << "ossimPolyArea2d::operator& Caught exception!" << std::endl;
449  result.clearPolygons();
450  }
451  return result;
452  }
453  return *this;
454 }
455 
457 {
458  if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
459  {
460  ossimPolyArea2d result;
461  try // GEOS code throws exceptions...
462  {
464  rhs.m_privateData->m_geometry));
465  }
466  catch( const std::exception& e )
467  {
469  << "ossimPolyArea2d::operator+ Caught exception: " << e.what() << std::endl;
470  result.clearPolygons();
471  }
472  catch( ... )
473  {
475  << "ossimPolyArea2d::operator+ Caught exception!" << std::endl;
476  result.clearPolygons();
477  }
478  return result;
479  }
480  return *this;
481 }
483 {
484  if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
485  {
486  ossimPolyArea2d result;
487  try // GEOS code throws exceptions...
488  {
489  result.m_privateData->setGeometry(m_privateData->m_geometry->difference(
490  rhs.m_privateData->m_geometry));
491  }
492  catch( const std::exception& e )
493  {
495  << "ossimPolyArea2d::operator- Caught exception: " << e.what() << std::endl;
496  result.clearPolygons();
497  }
498  catch( ... )
499  {
501  << "ossimPolyArea2d::operator- Caught exception!" << std::endl;
502  result.clearPolygons();
503  }
504  return result;
505  }
506  return *this;
507 }
508 
510 {
511  if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
512  {
513  try // GEOS code throws exceptions...
514  {
516  rhs.m_privateData->m_geometry));
517  }
518  catch( const std::exception& e )
519  {
521  << "ossimPolyArea2d::operator&= Caught exception: " << e.what() << std::endl;
522  this->clearPolygons();
523  }
524  catch( ... )
525  {
527  << "ossimPolyArea2d::operator&= Caught exception!" << std::endl;
528  this->clearPolygons();
529  }
530  }
531  return *this;
532 }
533 
535 {
536  if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
537  {
538  try // GEOS code throws exceptions...
539  {
541  rhs.m_privateData->m_geometry));
542  }
543  catch( const std::exception& e )
544  {
546  << "ossimPolyArea2d::operator+= Caught exception: " << e.what() << std::endl;
547  this->clearPolygons();
548  }
549  catch( ... )
550  {
552  << "ossimPolyArea2d::operator+= Caught exception!" << std::endl;
553  this->clearPolygons();
554  }
555  }
556  return *this;
557 }
558 
560 {
561  if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
562  {
563  try // GEOS code throws exceptions...
564  {
566  rhs.m_privateData->m_geometry));
567  }
568  catch( const std::exception& e )
569  {
571  << "ossimPolyArea2d::operator-= Caught exception: " << e.what() << std::endl;
572  this->clearPolygons();
573  }
574  catch( ... )
575  {
577  << "ossimPolyArea2d::operator-= Caught exception!" << std::endl;
578  this->clearPolygons();
579  }
580  }
581  return *this;
582 }
583 
585 {
586  if(isEmpty())
587  {
588  *this=rhs;
589  }
590  else
591  {
592  geos::geom::Geometry* geom = m_privateData->m_geometry->Union(rhs.m_privateData->m_geometry);
593  if(geom) m_privateData->setGeometry(geom);
594  }
595 }
596 
598 {
600 #if 0
601  clearEngine();
602 #endif
603 }
604 
605 bool ossimPolyArea2d::getVisiblePolygons(vector<ossimPolygon>& polyList)const
606 {
607  bool foundPolys = false;
609  {
610  ossim_uint32 sizeBefore = (ossim_uint32)polyList.size();
612  foundPolys = (sizeBefore != polyList.size());
613  }
614 
615  return foundPolys;
616 }
617 
618 bool ossimPolyArea2d::getPolygonHoles(vector<ossimPolygon>& polyList)const
619 {
620  bool foundPolys = false;
622  {
623  ossim_uint32 sizeBefore = (ossim_uint32)polyList.size();
625  foundPolys = (sizeBefore != polyList.size());
626  }
627 
628  return foundPolys;
629 }
630 
631 bool ossimPolyArea2d::getCompletePolygons(vector<ossimPolyArea2d>& polyList)const
632 {
633  bool foundPolys = false;
635  ossim_uint32 sizeBefore = (ossim_uint32)polyList.size();
637  foundPolys = (sizeBefore != polyList.size());
638  }
639  return foundPolys;
640 }
641 
643 {
644  bool result = true;
646  {
647  result = m_privateData->m_geometry->isEmpty();
648  }
649 
650  return result;
651 }
652 
653 bool ossimPolyArea2d::isValid(bool displayValidationError)const
654 {
655  bool result = false;
656 
658  {
659  if(displayValidationError)
660  {
661  geos::operation::valid::IsValidOp validityCheck(m_privateData->m_geometry);
662  geos::operation::valid::TopologyValidationError*
663  topologyValidationError(validityCheck.getValidationError());
664  // if(topologyValidationError == nullptr)
665  if(topologyValidationError == 0)
666  {
667  result = true;
668  }
669  else
670  {
672  << "ossimPolyArea2d::isValid: " << topologyValidationError->toString() << std::endl;
673  }
674  }
675  else
676  {
677  result = m_privateData->m_geometry->isValid();
678  }
679  }
680 
681  return result;
682 }
683 
685 {
686  return isPointWithin(point.x, point.y);
687 }
688 
689 bool ossimPolyArea2d::isPointWithin(double x, double y)const
690 {
691  bool result = false;
692 
693  if(!isEmpty())
694  {
695  geos::geom::Coordinate c(x,y);
696  geos::geom::Geometry* geom = m_privateData->geomFactory()->createPoint(c);
697 
698  result = m_privateData->m_geometry->intersects(geom);
699 
700  delete geom;
701  }
702 
703  return result;
704 }
705 
707 {
708  rect.makeNan();
709 
710  if(!isEmpty())
711  {
712  const geos::geom::Envelope* envelope = m_privateData->m_geometry->getEnvelopeInternal();
713 
714  rect = ossimDrect(envelope->getMinX(), envelope->getMinY(), envelope->getMaxX(), envelope->getMaxY());
715  }
716 }
717 
718 std::string ossimPolyArea2d::toString()const
719 {
720  std::string result = "";
721 
723  {
724  result = m_privateData->m_geometry->toString();
725  }
726 
727  return result;
728 }
729 
731  ossimPolyArea2d result;
732  try{
733  geos::operation::buffer::BufferOp buffer_operation(m_privateData->m_geometry);
734  result.m_privateData->setGeometry( buffer_operation.getResultGeometry(distance));
735  }catch( const std::exception& e ){
737  << "ossimPolyArea2d::getBufferedShape Caught exception: " << e.what() << std::endl;
738  result.clearPolygons();
739  }catch( ... ){
741  << "ossimPolyArea2d::getBufferedShape Caught exception!" << std::endl;
742  result.clearPolygons();
743  }
744  return result;
745 }
747 {
748  try{
749  geos::operation::buffer::BufferOp buffer_operation(m_privateData->m_geometry);
750  m_privateData->setGeometry( buffer_operation.getResultGeometry(distance));
751  }catch( const std::exception& e ){
753  << "ossimPolyArea2d::getBufferedShape Caught exception: " << e.what() << std::endl;
754  }catch( ... ){
756  << "ossimPolyArea2d::getBufferedShape Caught exception!" << std::endl;
757  }
758  return *this;
759 }
760 
762 {
763 
764 
765  try{
767  {
768  switch(m_privateData->m_geometry->getGeometryTypeId())
769  {
770  case geos::geom::GEOS_POLYGON:
771  {
772  std::vector<geos::geom::Geometry*> values;
773  values.push_back(m_privateData->m_geometry->clone());
774 
775  m_privateData->setGeometry(m_privateData->m_geometry->getFactory()->createMultiPolygon(values));
776  break;
777  }
778  case geos::geom::GEOS_MULTIPOLYGON:
779  {
780  // intentionally left blank
781  break;
782  }
783  default:
784  {
785  // might need an error at a later date
787  << "ossimPolyArea2d::toMultiPolygon Geometry type can not be converted to a multi polygon: " <<m_privateData->m_geometry->getGeometryType()<< std::endl;
788 
789  break;
790  }
791  }
792  }
793  }
794  catch(const std::exception& e)
795  {
797  << "ossimPolyArea2d::toMultiPolygon Caught exception: " << e.what() << std::endl;
798  }
799  catch(...)
800  {
802  << "ossimPolyArea2d::toMultiPolygon Caught exception!" << std::endl;
803  }
804 
805  return *this;
806 }
807 
809  const char* prefix)const
810 {
811  kwl.add(prefix,
813  "ossimPolyArea2d",
814  true);
815 
816  if(!isEmpty())
817  {
818  geos::io::WKTWriter writer;
819 
820  kwl.add(prefix,
821  "wkt",
822  writer.write(m_privateData->m_geometry).c_str(),
823  true);
824  }
825  // else
826  // {
827  //
828  // }
829 
830  return true;
831 }
832 
834  const char* prefix)
835 {
836  if(m_privateData)
837  {
838  ossimString wkt = kwl.find(prefix, "wkt");
839 
840  if(!wkt.empty())
841  {
842  geos::io::WKTReader reader(m_privateData->geomFactory());
843  try
844  {
845  m_privateData->setGeometry(reader.read(wkt.c_str()));
846  }
847  catch( const std::exception& e )
848  {
850  << "ossimPolyArea2d::loadState Caught exception: " << e.what() << std::endl;
851  this->clearPolygons();
852  }
853  catch(...)
854  {
856  << "ossimPolyArea2d::loadState Caught exception!" << std::endl;
857  this->clearPolygons();
858  }
859  }
860  }
861  return true;
862 }
bool isPointWithin(const ossimDpt &point) const
ossimPolyArea2d operator+(const ossimPolyArea2d &rhs) const
std::ostream & operator<<(std::ostream &out, const ossimPolyArea2d &rhs)
void makeNan()
Definition: ossimDrect.h:388
ossim_uint32 x
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
ossimPolyArea2d operator&(const ossimPolyArea2d &rhs) const
void getBoundingRect(ossimDrect &rect)
ossimPolyArea2d getBufferedShape(double distance=FLT_EPSILON) const
Buffers the ossimPolyArea2d shape and returns a copy.
ossimPolyArea2d operator-(const ossimPolyArea2d &rhs) const
Represents serializable keyword/value map.
const ossimPolyArea2d & operator-=(const ossimPolyArea2d &rhs)
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
bool isValid(bool displayValidationError=false) const
const char * find(const char *key) const
ossimReferenced allows for shared object ref counting if the reference count ever gets to 0 or less i...
void addPoint(const ossimDpt &pt)
const geos::geom::Geometry * ConstGeometryPtr
void recurseVisibleGeometries(ossimPolygon::Vector &polyList, const geos::geom::Geometry *geom) const
double y
Definition: ossimDpt.h:165
std::string toString() const
Returns the Well Known Text string.
bool intersects(const ossimPolyArea2d &rhs) const
OssimPolyArea2dPrivate * m_privateData
void recurseCompleteGeometries(std::vector< ossimPolyArea2d > &polyList, const geos::geom::Geometry *geom) const
Recurses over the Geometry object to load all complete polygons (a shell and any internal holes) into...
bool isEmpty() const
void setGeometry(const ossimPolygon &polygon, const vector< ossimPolygon > &holes=vector< ossimPolygon >())
void setGeometry(GeometryPtr geom)
static const char * TYPE_KW
bool getCompletePolygons(vector< ossimPolyArea2d > &polyList) const
Gets all of the polygons stored with their holes embedded.
geos::geom::Geometry * GeometryPtr
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimPolyArea2d & toMultiPolygon()
const ossimPolyArea2d & operator&=(const ossimPolyArea2d &rhs)
os2<< "> n<< " > nendobj n
unsigned int ossim_uint32
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
static ossimRefPtr< ossimGeometryFactoryWrapper > m_globalFactory
void add(const ossimPolyArea2d &rhs)
const vector< ossimDpt > & getVertexList() const
bool getPolygonHoles(vector< ossimPolygon > &polyList) const
const ossimPolyArea2d & operator=(const ossimPolyArea2d &rhs)
double x
Definition: ossimDpt.h:164
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
ossimPolyArea2d & setToBufferedShape(double distance=FLT_EPSILON)
const ossimPolyArea2d & operator+=(const ossimPolyArea2d &rhs)
float distance(double lat1, double lon1, double lat2, double lon2, int units)
bool getVisiblePolygons(vector< ossimPolygon > &polyList) const
geos::geom::GeometryFactory * geomFactory()
void recurseHoles(ossimPolygon::Vector &polyList, const geos::geom::Geometry *geom) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
OssimPolyArea2dPrivate(GeometryPtr geom=0)