View | Details | Raw Unified | Return to bug 242979 | Differences between
and this patch

Collapse All | Expand All

(-)graphics/ossim/Makefile (-2 / +1 lines)
Lines 2-9 Link Here
2
2
3
PORTNAME=	ossim
3
PORTNAME=	ossim
4
DISTVERSIONPREFIX=	Neptune-
4
DISTVERSIONPREFIX=	Neptune-
5
DISTVERSION=	2.10.0
5
DISTVERSION=	2.10.1
6
PORTREVISION=	1
7
CATEGORIES=	graphics geography
6
CATEGORIES=	graphics geography
8
7
9
MAINTAINER=	lbartoletti@tuxfamily.org
8
MAINTAINER=	lbartoletti@tuxfamily.org
(-)graphics/ossim/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1571682169
1
TIMESTAMP = 1577481364
2
SHA256 (ossimlabs-ossim-Neptune-2.10.0_GH0.tar.gz) = b394cf1f157c00b28af6e1d8ccaff471569a3e08a1c1bbddb7ff76f8201d54e5
2
SHA256 (ossimlabs-ossim-Neptune-2.10.1_GH0.tar.gz) = b3d29e9f2c662a2a33bd9421415abdbabe7034bb0c45789135cf0e5872a0dfcc
3
SIZE (ossimlabs-ossim-Neptune-2.10.0_GH0.tar.gz) = 6920171
3
SIZE (ossimlabs-ossim-Neptune-2.10.1_GH0.tar.gz) = 6928598
(-)graphics/ossim/files/patch-include-ossim-base-ossimPolyArea2d.h (-207 lines)
Removed Link Here
1
Obtained from:	https://github.com/ossimlabs/ossim/commit/c456397821cf369af4d9ff1fb60a5dfd1bcefc24
2
3
--- include/ossim/base/ossimPolyArea2d.h.orig	2019-10-17 21:54:21 UTC
4
+++ include/ossim/base/ossimPolyArea2d.h
5
@@ -5,10 +5,8 @@
6
 // Author: Garrett Potts
7
 //*******************************************************************
8
 //$Id: ossimPolyArea2d.h 23608 2015-10-28 13:51:35Z gpotts $
9
-
10
 #ifndef ossimPolyArea2d_HEADER
11
 #define ossimPolyArea2d_HEADER 1
12
-
13
 #include <ossim/base/ossimDpt.h>
14
 #include <ossim/base/ossimGpt.h>
15
 #include <ossim/base/ossimKeywordlist.h>
16
@@ -16,137 +14,76 @@
17
 #include <ossim/base/ossimReferenced.h>
18
 #include <vector>
19
 
20
-class ossimDrect;
21
-class ossimIrect;
22
-class OssimPolyArea2dPrivate;
23
-
24
-namespace geos
25
-{
26
-   namespace geom
27
-   {
28
-      class Geometry;
29
-   }
30
-}
31
+class ossimPolyArea2dPrivate;
32
 
33
-class OSSIM_DLL ossimPolyArea2d : public ossimReferenced
34
+class OSSIM_DLL ossimPolyArea2d
35
 {
36
 public:
37
-   friend class OssimPolyArea2dPrivate;
38
-   friend OSSIM_DLL std::ostream& operator <<(std::ostream& out, const ossimPolyArea2d& data);
39
-   
40
+   friend OSSIM_DLL std::ostream &operator<<(std::ostream &out, const ossimPolyArea2d &data);
41
+   friend class ossimPolyArea2dPrivate;
42
    ossimPolyArea2d();
43
-   ossimPolyArea2d(const std::vector<ossimGpt>& polygon);
44
-   ossimPolyArea2d(const std::vector<ossimDpt>& polygon);
45
-   ossimPolyArea2d(const ossimPolygon& shell, const std::vector<ossimPolygon>& holes);
46
-   
47
-   ossimPolyArea2d(const ossimDpt& p1,
48
-                   const ossimDpt& p2,
49
-                   const ossimDpt& p3,
50
-                   const ossimDpt& p4);
51
-   ossimPolyArea2d(const ossimPolyArea2d& rhs);
52
-   
53
-   ossimPolyArea2d(const ossimIrect& rect);
54
-   ossimPolyArea2d(const ossimDrect& rect);
55
-   ossimPolyArea2d(const ossimPolygon& polygon);
56
+   ossimPolyArea2d(const std::vector<ossimGpt> &polygon);
57
+   ossimPolyArea2d(const std::vector<ossimDpt> &polygon);
58
+   ossimPolyArea2d(const ossimPolygon &shell, const std::vector<ossimPolygon> &holes);
59
+
60
+   ossimPolyArea2d(const ossimDpt &p1,
61
+                   const ossimDpt &p2,
62
+                   const ossimDpt &p3,
63
+                   const ossimDpt &p4);
64
+   ossimPolyArea2d(const ossimPolyArea2d &rhs);
65
+
66
+   ossimPolyArea2d(const ossimIrect &rect);
67
+   ossimPolyArea2d(const ossimDrect &rect);
68
+   ossimPolyArea2d(const ossimPolygon &polygon);
69
    ~ossimPolyArea2d();
70
-   
71
+
72
    void clear()
73
    {
74
       clearPolygons();
75
    }
76
-   const ossimPolyArea2d& operator =(const ossimPolyArea2d& rhs);
77
-   const ossimPolyArea2d& operator =(const ossimPolygon& rhs);
78
-   const ossimPolyArea2d& operator =(const ossimIrect& rect);
79
-   const ossimPolyArea2d& operator =(const ossimDrect& rect);
80
-   const ossimPolyArea2d& operator =(const std::vector<ossimGpt>& polygon);
81
-   const ossimPolyArea2d& operator =(const std::vector<ossimDpt>& polygon);
82
-   const ossimPolyArea2d& operator &=(const ossimPolyArea2d& rhs);
83
-   ossimPolyArea2d operator &(const ossimPolyArea2d& rhs)const;
84
-   ossimPolyArea2d operator +(const ossimPolyArea2d& rhs)const;
85
-   const ossimPolyArea2d& operator +=(const ossimPolyArea2d& rhs);
86
-   ossimPolyArea2d operator -(const ossimPolyArea2d& rhs)const;
87
-   const ossimPolyArea2d& operator -=(const ossimPolyArea2d& rhs);
88
-   
89
-   bool intersects(const ossimPolyArea2d& rhs)const;
90
-   
91
-   void add(const ossimPolyArea2d& rhs);
92
-   bool getVisiblePolygons(std::vector<ossimPolygon>& polyList)const;
93
-   bool getPolygonHoles(std::vector<ossimPolygon>& polyList)const;
94
-   
95
-   /**
96
-    * @brief Gets all of the polygons stored with their holes embedded. This
97
-    * may be useful if an operation was performed on the original ossimPolyArea2d 
98
-    * that caused multiple polygons to be created internally.
99
-    *	 
100
-    * For example, if a rectangle is intersected with a U shape, the two top
101
-    * portions of the U would be their own separate polygon. It's also possible 
102
-    * for these polygons to contain their own holes. This function will return 
103
-    * the two top polygons as separate ossimPolyArea2d objects (with any of 
104
-    * their holes embedded inside them).
105
-    *
106
-    *  --------------------------------		 
107
-    * |                                |
108
-    * |                                |
109
-    * | ........           .........   |
110
-    * | .      .           .       .   |
111
-    *  -.------.-----------.-------.---
112
-    *   .      .           .       .
113
-    *   .      .............       .
114
-    *   .                          .
115
-    *   ............................
116
-    *   
117
-    * @param polylist an empty vector of ossimPolyArea2d that will be filled
118
-    * @return returns true if it successfully places polygons in the input vector
119
-    */
120
-   bool getCompletePolygons(std::vector<ossimPolyArea2d>& polyList)const;
121
-   
122
-   bool isEmpty()const;
123
-   bool isValid(bool displayValidationError = false)const;
124
-   bool isPointWithin(const ossimDpt& point)const;
125
-   bool isPointWithin(double x, double y)const;
126
-   void getBoundingRect(ossimDrect& rect);
127
-   
128
+   const ossimPolyArea2d &operator=(const ossimPolyArea2d &rhs);
129
+   const ossimPolyArea2d &operator=(const ossimPolygon &rhs);
130
+   const ossimPolyArea2d &operator=(const ossimIrect &rect);
131
+   const ossimPolyArea2d &operator=(const ossimDrect &rect);
132
+   const ossimPolyArea2d &operator=(const std::vector<ossimGpt> &polygon);
133
+   const ossimPolyArea2d &operator=(const std::vector<ossimDpt> &polygon);
134
+   const ossimPolyArea2d &operator&=(const ossimPolyArea2d &rhs);
135
+   ossimPolyArea2d operator&(const ossimPolyArea2d &rhs) const;
136
+   ossimPolyArea2d operator+(const ossimPolyArea2d &rhs) const;
137
+   const ossimPolyArea2d &operator+=(const ossimPolyArea2d &rhs);
138
+   ossimPolyArea2d operator-(const ossimPolyArea2d &rhs) const;
139
+   const ossimPolyArea2d &operator-=(const ossimPolyArea2d &rhs);
140
+
141
+   ossim_float64 getArea()const;
142
+   bool isEmpty() const;
143
+   void makeValid();
144
+   bool isValid(bool displayValidationError = false) const;
145
+   bool isPointWithin(const ossimDpt &point) const;
146
+   bool isPointWithin(double x, double y) const;
147
+   void getBoundingRect(ossimDrect &rect) const;
148
+
149
+   bool intersects(const ossimPolyArea2d &rhs) const;
150
+   void add(const ossimPolyArea2d &rhs);
151
+   bool getVisiblePolygons(std::vector<ossimPolygon> &polyList) const;
152
+   bool getPolygonHoles(std::vector<ossimPolygon> &polyList) const;
153
+
154
+   ossimPolyArea2d &toMultiPolygon();
155
+
156
    /**
157
    * Returns the Well Known Text string
158
    */
159
-   std::string toString()const;
160
+   std::string toString() const;
161
+   bool setFromWkt(const std::string &s);
162
 
163
-   /**
164
-    * @brief Buffers the ossimPolyArea2d shape and returns a copy. This method
165
-    * does not alter polygon.
166
-    *  
167
-    * @param distance is the distance to buffer the shape by. Positive values
168
-    * will expand the shape, and negative values will shrink the shape.
169
-    * @return A shape that is a buffered (expanded/contracted) version of this
170
-    * shape
171
-    */
172
-   ossimPolyArea2d getBufferedShape(double distance=FLT_EPSILON) const;
173
-   
174
-   ossimPolyArea2d& setToBufferedShape(double distance=FLT_EPSILON);
175
+   bool saveState(ossimKeywordlist &kwl,
176
+                  const char *prefix = 0) const;
177
+   bool loadState(const ossimKeywordlist &kwl,
178
+                  const char *prefix = 0);
179
 
180
-   ossimPolyArea2d& toMultiPolygon();
181
-   bool saveState(ossimKeywordlist& kwl,
182
-                  const char* prefix=0)const;
183
-   bool loadState(const ossimKeywordlist& kwl,
184
-                  const char* prefix=0);
185
-   
186
 protected:
187
-   
188
+   ossimPolyArea2dPrivate *m_privateData;
189
+
190
    void clearPolygons();
191
-   void recurseVisibleGeometries(ossimPolygon::Vector& polyList,
192
-                                 const geos::geom::Geometry* geom) const;
193
-   
194
-   void recurseHoles(ossimPolygon::Vector& polyList,
195
-                     const geos::geom::Geometry* geom) const;
196
-   
197
-   /**
198
-    * @brief Recurses over the Geometry object to load all complete polygons
199
-    * (a shell and any internal holes) into the ossimPolyArea2d.
200
-    */
201
-   void recurseCompleteGeometries(std::vector<ossimPolyArea2d>& polyList,
202
-                                  const geos::geom::Geometry* geom) const;
203
-   
204
-   OssimPolyArea2dPrivate* m_privateData;
205
 };
206
 
207
 #endif /* #ifndef ossimPolyArea2d_HEADER */
(-)graphics/ossim/files/patch-src-base-ossimPolyArea2d.cpp (-1336 lines)
Removed Link Here
1
Obtained from:	https://github.com/ossimlabs/ossim/commit/c456397821cf369af4d9ff1fb60a5dfd1bcefc24
2
		https://github.com/ossimlabs/ossim/commit/c0d97536f9ac967941b6ca48a6a7a4dde44f4ee3
3
4
--- src/base/ossimPolyArea2d.cpp.orig	2019-10-17 21:54:21 UTC
5
+++ src/base/ossimPolyArea2d.cpp
6
@@ -3,153 +3,169 @@
7
 //
8
 // $Id: ossimPolyArea2d.cpp 23623 2015-11-13 18:24:28Z gpotts $
9
 //---
10
-
11
 #include <ossim/base/ossimPolyArea2d.h>
12
-#include <ossim/base/ossimDrect.h>
13
-#include <ossim/base/ossimIrect.h>
14
+#include <ossim/base/ossimReferenced.h>
15
+#include <ossim/base/ossimPolygon.h>
16
+#include <ossim/base/ossimNotifyContext.h>
17
+#include <ossim/base/ossimKeywordlist.h>
18
 #include <ossim/base/ossimKeywordNames.h>
19
-#include <ossim/base/ossimNotify.h>
20
-#include <ossim/base/ossimRefPtr.h>
21
-#include <ossim/base/ossimString.h>
22
-#include <geos/geom/Coordinate.h>
23
-#include <geos/geom/CoordinateArraySequence.h>
24
-#include <geos/geom/GeometryFactory.h>
25
-#include <geos/geom/LinearRing.h>
26
-#include <geos/opBuffer.h>
27
-#include <geos/geom/Point.h>
28
-#include <geos/geom/Polygon.h>
29
-#include <geos/geom/MultiPolygon.h>
30
-#include <geos/geom/PrecisionModel.h>
31
-#include <geos/io/WKTReader.h>
32
-#include <geos/io/WKTWriter.h>
33
-#include <geos/util/GEOSException.h>
34
-#include <geos/operation/valid/IsValidOp.h>
35
-#include <geos/opBuffer.h>
36
-#include <cstdlib>
37
-#include <exception>
38
-#include <memory>
39
 #include <vector>
40
-#include <mutex>
41
-
42
-using namespace std;
43
+#include <cstdio>
44
+#include <cstdarg>
45
+#include <geos_c.h>
46
 
47
-class MyGeomFactory : public geos::geom::GeometryFactory
48
+class ossimPolyArea2dPrivate
49
 {
50
 public:
51
-   MyGeomFactory():
52
-   geos::geom::GeometryFactory(new geos::geom::PrecisionModel(geos::geom::PrecisionModel::FLOATING),
53
-                             -1)
54
+   typedef GEOSGeometry *GEOSGeometryPtr;
55
+   typedef const GEOSGeometry *ConstGEOSGeometryPtr;
56
+   ossimPolyArea2dPrivate() : m_geometry(GEOSGeom_createEmptyPolygon()) {}
57
+   virtual ~ossimPolyArea2dPrivate() { deleteGeometry(); }
58
+   void deleteGeometry()
59
    {
60
+      if (m_geometry)
61
+         GEOSGeom_destroy(m_geometry);
62
+      m_geometry = 0;
63
+   }
64
 
65
+   void setGeometry(GEOSGeometryPtr geom)
66
+   {
67
+      if(geom != m_geometry)
68
+      {
69
+         deleteGeometry();
70
+         m_geometry = geom;
71
+      }
72
    }
73
-}; 
74
-class ossimGeometryFactoryWrapper : public ossimReferenced
75
-{
76
-public:
77
-   ossimGeometryFactoryWrapper()
78
-      : m_geomFactory(0)
79
+   void setGeometry(const ossimPolygon &polygon, const std::vector<ossimPolygon> &holes = std::vector<ossimPolygon>());
80
+
81
+   void ringToPoints(const ConstGEOSGeometryPtr geom, std::vector<ossimDpt> &points) const;
82
+   void recurseVisibleGeometries(ossimPolygon::Vector &polyList) const
83
    {
84
-      //geos::geom::PrecisionModel *pm =
85
-      //   new geos::geom::PrecisionModel(geos::geom::PrecisionModel::FLOATING);
86
-      m_geomFactory = new MyGeomFactory();//new geos::geom::GeometryFactory(pm, -1); 
87
+      recurseVisibleGeometries(m_geometry, polyList);
88
    }
89
-   virtual ~ossimGeometryFactoryWrapper(){if(m_geomFactory) delete m_geomFactory;m_geomFactory=0;}
90
-   
91
-   MyGeomFactory* m_geomFactory;
92
-};
93
 
94
-class OssimPolyArea2dPrivate
95
-{
96
-public:
97
-   typedef geos::geom::Geometry* GeometryPtr;
98
-   typedef const geos::geom::Geometry* ConstGeometryPtr;
99
-   
100
-   OssimPolyArea2dPrivate(GeometryPtr geom=0);
101
-   ~OssimPolyArea2dPrivate();
102
-   
103
-   void deleteGeometry() { if(m_geometry) { delete m_geometry; m_geometry = 0; }}
104
-   void setGeometry(const ossimPolygon& polygon, const vector<ossimPolygon>& holes = vector<ossimPolygon>());
105
-   void setGeometry(GeometryPtr geom){deleteGeometry();m_geometry=geom;}
106
-   geos::geom::GeometryFactory* geomFactory(){{return m_globalFactory.valid()?m_globalFactory->m_geomFactory:0;}}
107
-   GeometryPtr m_geometry;
108
-   static ossimRefPtr<ossimGeometryFactoryWrapper> m_globalFactory; 
109
-};
110
+   void recurseVisibleGeometries(ConstGEOSGeometryPtr geom,
111
+                                 ossimPolygon::Vector &polygons) const;
112
 
113
-ossimRefPtr<ossimGeometryFactoryWrapper> OssimPolyArea2dPrivate::m_globalFactory;
114
+   void getVisiblePolygons(ConstGEOSGeometryPtr geom,
115
+                           ossimPolygon::Vector &polygons) const;
116
 
117
-OssimPolyArea2dPrivate::OssimPolyArea2dPrivate(GeometryPtr geom)
118
-:m_geometry(geom)
119
-{
120
-   static std::mutex globalFactoryMutex;
121
-   
122
+   bool getVisiblePolygons(ossimPolygon::Vector &polygons) const;
123
+
124
+   void getHoles(ConstGEOSGeometryPtr geom,
125
+                 ossimPolygon::Vector &polygons) const;
126
+   bool getPolygonHoles(ossimPolygon::Vector &polygons) const;
127
+   bool getPolygonHoles(ConstGEOSGeometryPtr geom,
128
+                        ossimPolygon::Vector &polygons) const;
129
+   void recurseGeometryHoles(ConstGEOSGeometryPtr geom,
130
+                             ossimPolygon::Vector &polygons) const;
131
+   void getBoundingRect(ossimDrect &bounds) const
132
    {
133
-      std::lock_guard<std::mutex> lock(globalFactoryMutex);
134
-      if(!m_globalFactory.valid())
135
+      bounds.makeNan();
136
+      if (!isEmpty())
137
       {
138
-         m_globalFactory = new ossimGeometryFactoryWrapper();
139
-      }    
140
+         GEOSGeometry *geom = GEOSEnvelope(m_geometry);
141
+
142
+         if (geom)
143
+         {
144
+            ossimPolygon::Vector polys;
145
+            getVisiblePolygons(geom, polys);
146
+            for (ossim_int32 idx = 0; idx < polys.size(); ++idx)
147
+            {
148
+               if (bounds.isNan())
149
+               {
150
+                  polys[idx].getBoundingRect(bounds);
151
+               }
152
+               else
153
+               {
154
+                  ossimDrect tempRect;
155
+                  polys[idx].getBoundingRect(tempRect);
156
+                  bounds = bounds.combine(tempRect);
157
+               }
158
+            }
159
+            GEOSGeom_destroy(geom);
160
+            geom = 0;
161
+         }
162
+      }
163
    }
164
-}
165
+   std::string toString() const;
166
+   bool setFromWkt(const std::string &s);
167
 
168
-OssimPolyArea2dPrivate::~OssimPolyArea2dPrivate()
169
-{
170
-   deleteGeometry();
171
-}
172
+   bool isEmpty() const;
173
+   bool isValid(bool displayValidationError = false) const;
174
+   bool isPointWithin(const ossimDpt &pt) const;
175
+   GEOSGeometryPtr m_geometry;
176
+};
177
 
178
-void OssimPolyArea2dPrivate::setGeometry(
179
-   const ossimPolygon& exteriorRing, const vector<ossimPolygon>& interiorRings)
180
+void ossimPolyArea2dPrivate::setGeometry(const ossimPolygon &exteriorRing,
181
+                                         const std::vector<ossimPolygon> &interiorRings)
182
 {
183
+
184
    deleteGeometry();
185
-   
186
-   geos::geom::CoordinateArraySequence *cas = new geos::geom::CoordinateArraySequence();
187
-   
188
-   const std::vector<ossimDpt>& pts = exteriorRing.getVertexList();
189
 
190
-   int idx = 0;
191
-   int n = (int)pts.size();
192
-   
193
-   if(n > 0)
194
+   if (exteriorRing.getNumberOfVertices() < 1)
195
+      return;
196
+   GEOSGeometryPtr shell = 0;
197
+   std::vector<GEOSGeometryPtr> holes;
198
+   const std::vector<ossimDpt> &pts = exteriorRing.getVertexList();
199
+   ossim_int32 idx = 0;
200
+   ossim_int32 n = (int)pts.size();
201
+
202
+   bool firstAndLastSame = ((pts[0].x == pts[n - 1].x) && (pts[0].y == pts[n - 1].y));
203
+   if (n > 0)
204
    {
205
+      GEOSCoordSequence *shellSeq = GEOSCoordSeq_create(
206
+          n + ((firstAndLastSame) ? 0 : 1), 2);
207
+
208
       //fill the exterior ring
209
       for (idx = 0; idx < n; idx++)
210
       {
211
-         cas->add(geos::geom::Coordinate(pts[idx].x, pts[idx].y));
212
+         GEOSCoordSeq_setXY(shellSeq, idx, pts[idx].x, pts[idx].y);
213
       }
214
-      
215
       //if the original polygon didn't have the first and last point the same, make it so
216
-      if((pts[0].x != pts[n-1].x) || (pts[0].y!=pts[n-1].y))
217
+      if (!firstAndLastSame)
218
       {
219
-         cas->add(geos::geom::Coordinate(pts[0].x, pts[0].y));
220
+         GEOSCoordSeq_setXY(shellSeq, n, pts[0].x, pts[0].y);
221
       }
222
-      
223
+      shell = GEOSGeom_createLinearRing(shellSeq);
224
       //fill the interior rings
225
-      vector<geos::geom::Geometry*> *holes = new vector<geos::geom::Geometry*>();
226
-      for (ossim_uint32 interiorRingIdx = 0; interiorRingIdx < interiorRings.size(); ++interiorRingIdx)
227
+      if (!interiorRings.empty())
228
       {
229
-         geos::geom::CoordinateArraySequence *interiorCas =
230
-            new geos::geom::CoordinateArraySequence();
231
-         const std::vector<ossimDpt>& vertexPts = interiorRings[interiorRingIdx].getVertexList();
232
-         for(ossim_uint32 vertexIndex=0; vertexIndex < vertexPts.size(); ++vertexIndex)
233
-         {
234
-            interiorCas->add(geos::geom::Coordinate(vertexPts[vertexIndex].x,
235
-                                                    vertexPts[vertexIndex].y));
236
-         }
237
-         
238
-         //if the original polygon didn't have the first and last point the same, make it so
239
-         if((vertexPts[0].x != vertexPts[vertexPts.size()-1].x) ||
240
-            (vertexPts[0].y!=vertexPts[vertexPts.size()-1].y))
241
+         for (ossim_uint32 interiorRingIdx = 0; interiorRingIdx < interiorRings.size(); ++interiorRingIdx)
242
          {
243
-            interiorCas->add(geos::geom::Coordinate(vertexPts[0].x, vertexPts[0].y));
244
+            if (interiorRings[interiorRingIdx].getNumberOfVertices() > 0)
245
+            {
246
+               const std::vector<ossimDpt> &vertexPts = interiorRings[interiorRingIdx].getVertexList();
247
+               firstAndLastSame = ((vertexPts[0].x == vertexPts[n - 1].x) && (vertexPts[0].y == vertexPts[n - 1].y));
248
+
249
+               GEOSCoordSequence *ring = GEOSCoordSeq_create(
250
+                   vertexPts.size() + ((firstAndLastSame) ? 0 : 1), 2);
251
+               for (ossim_uint32 vertexIndex = 0; vertexIndex < vertexPts.size(); ++vertexIndex)
252
+               {
253
+                  GEOSCoordSeq_setXY(ring, vertexIndex, vertexPts[vertexIndex].x, vertexPts[vertexIndex].y);
254
+               }
255
+
256
+               //if the original polygon didn't have the first and last point the same, make it so
257
+               if (!firstAndLastSame)
258
+               {
259
+                  GEOSCoordSeq_setXY(ring, vertexPts.size(), vertexPts[0].x, vertexPts[0].y);
260
+               }
261
+               GEOSGeometryPtr hole = GEOSGeom_createLinearRing(ring);
262
+               holes.push_back(hole);
263
+            }
264
          }
265
-         
266
-         geos::geom::LinearRing *hole = geomFactory()->createLinearRing(interiorCas);
267
-         holes->push_back(hole);
268
       }
269
-      
270
-      geos::geom::LinearRing* shell = geomFactory()->createLinearRing(cas);
271
-      if ( shell )
272
+
273
+      if (shell)
274
       {
275
-         m_geometry = geomFactory()->createPolygon(shell, holes);
276
+         if (holes.size())
277
+         {
278
+            m_geometry = GEOSGeom_createPolygon(shell, &holes.front(), holes.size());
279
+         }
280
+         else
281
+         {
282
+            m_geometry = GEOSGeom_createPolygon(shell, 0, 0);
283
+         }
284
       }
285
       else
286
       {
287
@@ -158,708 +174,540 @@ void OssimPolyArea2dPrivate::setGeometry
288
    }
289
 }
290
 
291
-void ossimPolyArea2d::recurseVisibleGeometries(
292
-   std::vector<ossimPolygon>& polyList, const geos::geom::Geometry* geom) const
293
+void ossimPolyArea2dPrivate::ringToPoints(const ConstGEOSGeometryPtr geom, std::vector<ossimDpt> &points) const
294
 {
295
-   int nGeoms = (int)geom->getNumGeometries();
296
-   
297
-   if(nGeoms < 2 )
298
+   double x, y;
299
+   if (!geom)
300
+      return;
301
+   ossim_int32 nPoints = GEOSGetNumCoordinates(geom);
302
+   if (nPoints > 0)
303
    {
304
-      const geos::geom::Polygon* poly = dynamic_cast<const geos::geom::Polygon*> (geom);
305
-      
306
-      if (poly)
307
+      const GEOSCoordSequence *seq = GEOSGeom_getCoordSeq(geom);
308
+      ossim_int32 i = 0;
309
+      for (i = 0; i < nPoints; i++)
310
       {
311
-         const geos::geom::LineString* lineString = dynamic_cast<const geos::geom::LineString*> (poly->getExteriorRing());
312
-         if (lineString)
313
-         {
314
-            int currentPolyIdx = (int)polyList.size();
315
-            int nPoints = (int)lineString->getNumPoints();
316
-            int idx = 0;
317
-            
318
-            polyList.push_back(ossimPolygon());
319
-            
320
-            for (idx=0; idx<nPoints; idx++)
321
-            {
322
-               std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
323
-               polyList[currentPolyIdx].addPoint(point->getX(), point->getY());
324
-            }
325
-         }
326
+         GEOSCoordSeq_getX(seq, i, &x);
327
+         GEOSCoordSeq_getY(seq, i, &y);
328
+         points.push_back(ossimDpt(x, y));
329
       }
330
    }
331
-   else
332
+}
333
+
334
+void ossimPolyArea2dPrivate::getHoles(ConstGEOSGeometryPtr geom,
335
+                                      ossimPolygon::Vector &polygons) const
336
+{
337
+   int geomType = GEOSGeomTypeId(geom);
338
+   std::vector<ossimDpt> points;
339
+   switch (geomType)
340
    {
341
-      for (int idx=0; idx < nGeoms; ++idx)
342
-      {
343
-         recurseVisibleGeometries(polyList, geom->getGeometryN(idx));
344
-      }
345
+   case GEOS_LINESTRING:
346
+   case GEOS_LINEARRING:
347
+   {
348
+      ringToPoints(geom, points);
349
+      polygons.push_back(ossimPolygon(points));
350
+      break;
351
+   }
352
    }
353
 }
354
 
355
-void ossimPolyArea2d::recurseHoles(std::vector<ossimPolygon>& polyList,
356
-                                   const geos::geom::Geometry* geom) const
357
+void ossimPolyArea2dPrivate::getVisiblePolygons(ConstGEOSGeometryPtr geom,
358
+                                                ossimPolygon::Vector &polygons) const
359
 {
360
-   int nGeoms = (int)geom->getNumGeometries();
361
-   
362
-   if(nGeoms < 2 )
363
+   int geomType = GEOSGeomTypeId(geom);
364
+   std::vector<ossimDpt> points;
365
+
366
+   switch (geomType)
367
    {
368
-      const geos::geom::Polygon* poly = dynamic_cast<const geos::geom::Polygon*> (geom);
369
+   case GEOS_LINESTRING:
370
+   case GEOS_LINEARRING:
371
+   {
372
+      ringToPoints(geom, points);
373
+      polygons.push_back(ossimPolygon(points));
374
+      break;
375
+   }
376
+   case GEOS_POLYGON:
377
+   {
378
+      ConstGEOSGeometryPtr geom2 = GEOSGetExteriorRing(geom);
379
+      ringToPoints(geom2, points);
380
+      polygons.push_back(ossimPolygon(points));
381
 
382
-      if (poly)
383
+      break;
384
+   }
385
+   }
386
+}
387
+void ossimPolyArea2dPrivate::recurseVisibleGeometries(ConstGEOSGeometryPtr geom,
388
+                                                      ossimPolygon::Vector &polygons) const
389
+{
390
+   ossim_int32 nGeoms = GEOSGetNumGeometries(geom);
391
+   ConstGEOSGeometryPtr geomPtr = 0;
392
+   if (nGeoms < 2)
393
+   {
394
+      geomPtr = GEOSGetGeometryN(geom, 0);
395
+      if (geomPtr)
396
       {
397
-         ossim_uint32 nInteriorRings = (ossim_uint32)poly->getNumInteriorRing();
398
-         ossim_uint32 idx = 0;
399
-         
400
-         for(idx = 0; idx < nInteriorRings; ++idx)
401
-         {
402
-            const geos::geom::LineString* lineString = poly->getInteriorRingN(idx);
403
-            if (lineString)
404
-            {
405
-               int currentPolyIdx = (int)polyList.size();
406
-               int nPoints = (int)lineString->getNumPoints();
407
-               int idx = 0;
408
-
409
-               polyList.push_back(ossimPolygon());
410
-
411
-               for (idx=0; idx<nPoints; idx++)
412
-               {
413
-                  std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
414
-                  polyList[currentPolyIdx].addPoint(point->getX(), point->getY());
415
-               }
416
-            }
417
-         }
418
+         getVisiblePolygons(geomPtr, polygons);
419
       }
420
    }
421
    else
422
    {
423
-      int idx = 0;
424
-      
425
-      for (idx=0; idx < nGeoms; idx++)
426
+      for (int idx = 0; idx < nGeoms; ++idx)
427
       {
428
-         recurseHoles(polyList, geom->getGeometryN(idx));
429
+         geomPtr = GEOSGetGeometryN(geom, idx);
430
+         recurseVisibleGeometries(geomPtr, polygons);
431
       }
432
    }
433
 }
434
 
435
-void ossimPolyArea2d::recurseCompleteGeometries(std::vector<ossimPolyArea2d>& polyList,
436
-                                                const geos::geom::Geometry* geom) const
437
+void ossimPolyArea2dPrivate::recurseGeometryHoles(ConstGEOSGeometryPtr geom,
438
+                                                  ossimPolygon::Vector &polygons) const
439
 {
440
-   int nGeoms = (int)geom->getNumGeometries();
441
-   if(nGeoms < 2 )
442
+   ossim_int32 nGeoms = GEOSGetNumGeometries(geom);
443
+   ConstGEOSGeometryPtr geomPtr = 0;
444
+   if (nGeoms < 2)
445
    {
446
-      const geos::geom::Polygon* poly = dynamic_cast<const geos::geom::Polygon*> (geom);
447
+      ossim_int32 nInteriorRings = GEOSGetNumInteriorRings(geom);
448
+      ossim_int32 idx = 0;
449
 
450
-      if (poly)
451
+      for (idx = 0; idx < nInteriorRings; ++idx)
452
       {
453
-         //get exterior shell for the geometry
454
-         ossimPolygon shell;
455
-         const geos::geom::LineString* lineString =
456
-            dynamic_cast<const geos::geom::LineString*> (poly->getExteriorRing());
457
-         if (lineString)
458
-         {
459
-            int nPoints = (int)lineString->getNumPoints();
460
-            for (int idx = 0; idx<nPoints; idx++)
461
-            {
462
-               std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
463
-               shell.addPoint(point->getX(), point->getY());
464
-            }
465
-         }
466
-         
467
-         // Get interior rings for the geometry.
468
-         std::size_t nInteriorRings = poly->getNumInteriorRing();
469
-         vector<ossimPolygon> holes(nInteriorRings);
470
-         for(std::size_t holeIdx = 0; holeIdx < nInteriorRings; ++holeIdx)
471
-         {
472
-            const geos::geom::LineString* lineString = poly->getInteriorRingN(holeIdx);
473
-            if (lineString)
474
-            {
475
-               std::size_t nPoints = lineString->getNumPoints();
476
-               for (std::size_t idx = 0; idx<nPoints; ++idx)
477
-               {
478
-                  std::unique_ptr<const geos::geom::Point> point(lineString->getPointN(idx));
479
-                  holes[holeIdx].addPoint(point->getX(), point->getY());
480
-               }
481
-            }
482
-         }
483
-         polyList.push_back(ossimPolyArea2d(shell, holes));
484
+         const GEOSGeometry *ringGeom = GEOSGetInteriorRingN(geom, idx);
485
+         getHoles(ringGeom, polygons);
486
       }
487
    }
488
    else
489
    {
490
-      int idx = 0;
491
-      
492
-      for (idx=0; idx < nGeoms; idx++)
493
+      for (int idx = 0; idx < nGeoms; ++idx)
494
       {
495
-         recurseCompleteGeometries(polyList, geom->getGeometryN(idx));
496
+         geomPtr = GEOSGetGeometryN(geom, idx);
497
+         recurseGeometryHoles(geomPtr, polygons);
498
       }
499
    }
500
 }
501
 
502
-std::ostream& operator <<(std::ostream& out, const ossimPolyArea2d& rhs)
503
+bool ossimPolyArea2dPrivate::getVisiblePolygons(ossimPolygon::Vector &polygons) const
504
 {
505
-   if(rhs.m_privateData->m_geometry)
506
+   bool foundPolys = false;
507
+   if (m_geometry)
508
    {
509
-      out << rhs.m_privateData->m_geometry->toString();
510
+      ossim_uint32 sizeBefore = (ossim_uint32)polygons.size();
511
+      recurseVisibleGeometries(m_geometry, polygons);
512
+      foundPolys = (sizeBefore != polygons.size());
513
    }
514
-   return out;
515
-}
516
 
517
-ossimPolyArea2d::ossimPolyArea2d()
518
-   :m_privateData(new OssimPolyArea2dPrivate)
519
-{
520
+   return foundPolys;
521
 }
522
-
523
-ossimPolyArea2d::ossimPolyArea2d(const vector<ossimGpt>& polygon)
524
-   :m_privateData(new OssimPolyArea2dPrivate)
525
+bool ossimPolyArea2dPrivate::getPolygonHoles(ossimPolygon::Vector &polygons) const
526
 {
527
-   (*this) = polygon;
528
+   return getPolygonHoles(m_geometry, polygons);
529
 }
530
 
531
-ossimPolyArea2d::ossimPolyArea2d(const vector<ossimDpt>& polygon)
532
-   :m_privateData(new OssimPolyArea2dPrivate)
533
+bool ossimPolyArea2dPrivate::getPolygonHoles(ConstGEOSGeometryPtr geom,
534
+                                             ossimPolygon::Vector &polygons) const
535
 {
536
-   (*this) = polygon;
537
-}
538
+   bool foundPolys = false;
539
+   if (m_geometry)
540
+   {
541
+      ossim_uint32 sizeBefore = (ossim_uint32)polygons.size();
542
+      recurseGeometryHoles(m_geometry, polygons);
543
+      foundPolys = (sizeBefore != polygons.size());
544
+   }
545
 
546
-ossimPolyArea2d::ossimPolyArea2d(const ossimIrect& rect)
547
-   :m_privateData(new OssimPolyArea2dPrivate)
548
-{
549
-   (*this) = rect;
550
+   return foundPolys;
551
 }
552
 
553
-ossimPolyArea2d::ossimPolyArea2d(const ossimDrect& rect)
554
-   :m_privateData(new OssimPolyArea2dPrivate)
555
+std::string ossimPolyArea2dPrivate::toString() const
556
 {
557
-   (*this) = rect;
558
-}
559
+   std::string result;
560
 
561
-ossimPolyArea2d::ossimPolyArea2d(const ossimPolygon& polygon)
562
-   :m_privateData(new OssimPolyArea2dPrivate)
563
-{
564
-   (*this) = polygon;
565
-}
566
+   if (m_geometry)
567
+   {
568
+      GEOSWKTWriter *wktWriter = GEOSWKTWriter_create();
569
+      GEOSWKTWriter_setRoundingPrecision(wktWriter, 20);
570
+      char *wkt_c = GEOSWKTWriter_write(wktWriter, m_geometry);
571
 
572
-ossimPolyArea2d::ossimPolyArea2d(const ossimPolygon& exteriorRing, const vector<ossimPolygon>& interiorRings)
573
-   :m_privateData(new OssimPolyArea2dPrivate)
574
-{	
575
-	m_privateData->setGeometry(exteriorRing, interiorRings);
576
-}
577
+      result = wkt_c;
578
+      GEOSWKTWriter_destroy(wktWriter);
579
 
580
-ossimPolyArea2d::ossimPolyArea2d(const ossimPolyArea2d& rhs)
581
-   :m_privateData(new OssimPolyArea2dPrivate) 
582
-{
583
-   *this = rhs;
584
-}
585
+      GEOSFree(wkt_c);
586
+   }
587
 
588
-ossimPolyArea2d::ossimPolyArea2d(const ossimDpt& p1,
589
-                                 const ossimDpt& p2,
590
-                                 const ossimDpt& p3,
591
-                                 const ossimDpt& p4)
592
-   :
593
-   m_privateData(new OssimPolyArea2dPrivate)
594
+   return result;
595
+}
596
+bool ossimPolyArea2dPrivate::setFromWkt(const std::string &s)
597
 {
598
-   ossimPolygon temp(p1,p2,p3,p4);
599
-   *this = temp;
600
+   bool result = false;
601
+
602
+   GEOSWKTReader *reader = GEOSWKTReader_create();
603
+   GEOSGeometry *geom = GEOSWKTReader_read(reader, s.c_str());
604
+   result = (geom != 0);
605
+   setGeometry(geom);
606
+
607
+   GEOSWKTReader_destroy(reader);
608
+
609
+   return result;
610
 }
611
 
612
-ossimPolyArea2d::~ossimPolyArea2d()
613
+
614
+bool ossimPolyArea2dPrivate::isEmpty() const
615
 {
616
-   if(m_privateData)
617
+   bool result = true;
618
+   if (m_geometry)
619
    {
620
-      delete m_privateData;
621
-      m_privateData = 0;
622
+      result = (GEOSisEmpty(m_geometry) == 1);
623
    }
624
+
625
+   return result;
626
 }
627
 
628
-const ossimPolyArea2d& ossimPolyArea2d::operator =(const ossimPolyArea2d& rhs)
629
-{ 
630
-   if(this != &rhs)
631
+bool ossimPolyArea2dPrivate::isValid(bool displayValidationError) const
632
+{
633
+   bool result = false;
634
+
635
+   if (!displayValidationError)
636
    {
637
-      if(rhs.m_privateData->m_geometry)
638
+      result = GEOSisValid(m_geometry) == 1;
639
+   }
640
+   else
641
+   {
642
+      char *reason = GEOSisValidReason(m_geometry);
643
+      if (reason)
644
       {
645
-         m_privateData->setGeometry(rhs.m_privateData->m_geometry->clone());
646
+         ossimNotify(ossimNotifyLevel_INFO)
647
+             << "ossimPolyArea2dPrivate::isValid: " << reason << "\n";
648
+
649
+         GEOSFree(reason);
650
+         reason = 0;
651
       }
652
    }
653
-   return *this;
654
+
655
+   return result;
656
 }
657
+bool ossimPolyArea2dPrivate::isPointWithin(const ossimDpt &pt) const
658
+{
659
+   bool result = false;
660
 
661
-const ossimPolyArea2d& ossimPolyArea2d::operator =(const ossimPolygon& polygon)
662
+   if (!isEmpty())
663
+   {
664
+      GEOSCoordSequence *pointSeq = GEOSCoordSeq_create(1, 2);
665
+      GEOSCoordSeq_setXY(pointSeq, 0, pt.x, pt.y);
666
+      GEOSGeometry *geom = GEOSGeom_createPoint(pointSeq);
667
+      result = (GEOSWithin(geom, m_geometry) == 1);
668
+
669
+      GEOSGeom_destroy(geom);
670
+   }
671
+
672
+   return result;
673
+}
674
+
675
+
676
+ossimPolyArea2d::ossimPolyArea2d()
677
+    : m_privateData(new ossimPolyArea2dPrivate())
678
 {
679
-   m_privateData->setGeometry(polygon);
680
+}
681
 
682
-   return *this;
683
+ossimPolyArea2d::ossimPolyArea2d(const std::vector<ossimGpt> &polygon)
684
+    : m_privateData(new ossimPolyArea2dPrivate())
685
+{
686
+   m_privateData->setGeometry(polygon);
687
 }
688
 
689
-const ossimPolyArea2d& ossimPolyArea2d::operator =(const ossimIrect& rect)
690
+ossimPolyArea2d::ossimPolyArea2d(const std::vector<ossimDpt> &polygon)
691
+    : m_privateData(new ossimPolyArea2dPrivate())
692
 {
693
-   return (*this = ossimPolygon(rect));
694
+   m_privateData->setGeometry(polygon);
695
 }
696
 
697
-const ossimPolyArea2d& ossimPolyArea2d::operator =(const ossimDrect& rect)
698
+ossimPolyArea2d::ossimPolyArea2d(const ossimPolygon &shell, const std::vector<ossimPolygon> &holes)
699
+    : m_privateData(new ossimPolyArea2dPrivate())
700
 {
701
-   return (*this = ossimPolygon(rect));
702
+   m_privateData->setGeometry(shell, holes);
703
 }
704
 
705
-const ossimPolyArea2d& ossimPolyArea2d::operator =(const vector<ossimGpt>& polygon)
706
+ossimPolyArea2d::ossimPolyArea2d(const ossimDpt &p1,
707
+                                 const ossimDpt &p2,
708
+                                 const ossimDpt &p3,
709
+                                 const ossimDpt &p4)
710
+    : m_privateData(new ossimPolyArea2dPrivate())
711
 {
712
-   std::vector<ossimDpt> pts;
713
-   int idx = 0;
714
-   int n = (int)polygon.size();
715
-   for(idx = 0; idx < n;++idx)
716
-   {
717
-      pts.push_back(polygon[idx]);
718
-   }
719
-  
720
-   return (*this = ossimPolygon(pts));
721
+   m_privateData->setGeometry(ossimPolygon(p1, p2, p3, p4));
722
 }
723
 
724
-const ossimPolyArea2d& ossimPolyArea2d::operator =(const vector<ossimDpt>& polygon)
725
+ossimPolyArea2d::ossimPolyArea2d(const ossimPolyArea2d &rhs)
726
+    : m_privateData(new ossimPolyArea2dPrivate())
727
 {
728
-   return (*this = ossimPolygon(polygon));
729
+   m_privateData->deleteGeometry();
730
+   m_privateData->m_geometry = GEOSGeom_clone(rhs.m_privateData->m_geometry);
731
 }
732
 
733
-bool ossimPolyArea2d::intersects(const ossimPolyArea2d& rhs)const
734
+ossimPolyArea2d::ossimPolyArea2d(const ossimIrect &rect)
735
+    : m_privateData(new ossimPolyArea2dPrivate())
736
 {
737
-   bool result = false;
738
+   m_privateData->setGeometry(ossimPolygon(rect));
739
+}
740
 
741
-   if(m_privateData->m_geometry&&rhs.m_privateData->m_geometry)
742
-   {
743
-      result = m_privateData->m_geometry->intersects(rhs.m_privateData->m_geometry); 
744
-   }
745
+ossimPolyArea2d::ossimPolyArea2d(const ossimDrect &rect)
746
+    : m_privateData(new ossimPolyArea2dPrivate())
747
+{
748
+   m_privateData->setGeometry(ossimPolygon(rect));
749
+}
750
 
751
-   return result;
752
+ossimPolyArea2d::ossimPolyArea2d(const ossimPolygon &polygon)
753
+    : m_privateData(new ossimPolyArea2dPrivate())
754
+{
755
+   m_privateData->setGeometry(polygon);
756
 }
757
 
758
-ossimPolyArea2d ossimPolyArea2d::operator &(const ossimPolyArea2d& rhs)const
759
+ossimPolyArea2d::~ossimPolyArea2d()
760
 {
761
-   if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
762
+   if (m_privateData)
763
    {
764
-      ossimPolyArea2d result;
765
-      try // GEOS code throws exceptions...
766
-      {
767
-         result.m_privateData->setGeometry(m_privateData->m_geometry->intersection(
768
-                                              rhs.m_privateData->m_geometry));
769
-      }
770
-      catch( const std::exception& e )
771
-      {
772
-         ossimNotify(ossimNotifyLevel_DEBUG)
773
-            << "ossimPolyArea2d::operator& Caught exception: " << e.what() << std::endl;
774
-         result.clearPolygons();
775
-      }
776
-      catch( ... )
777
-      {
778
-         ossimNotify(ossimNotifyLevel_DEBUG)
779
-            << "ossimPolyArea2d::operator& Caught exception!" << std::endl;
780
-         result.clearPolygons();
781
-      }
782
-      return result;
783
+      delete m_privateData;
784
    }
785
-   return *this;
786
+   m_privateData = 0;
787
 }
788
 
789
-ossimPolyArea2d ossimPolyArea2d::operator +(const ossimPolyArea2d& rhs)const
790
+void ossimPolyArea2d::clearPolygons()
791
 {
792
-   if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
793
-   {
794
-      ossimPolyArea2d result;
795
-      try // GEOS code throws exceptions...
796
-      {
797
-         result.m_privateData->setGeometry(m_privateData->m_geometry->Union(
798
-                                              rhs.m_privateData->m_geometry));
799
-      }  
800
-      catch( const std::exception& e )
801
-      {
802
-         ossimNotify(ossimNotifyLevel_DEBUG)
803
-            << "ossimPolyArea2d::operator+ Caught exception: " << e.what() << std::endl;
804
-         result.clearPolygons();
805
-      }
806
-      catch( ... )
807
-      {
808
-         ossimNotify(ossimNotifyLevel_DEBUG)
809
-            << "ossimPolyArea2d::operator+ Caught exception!" << std::endl;
810
-         result.clearPolygons();
811
-      }
812
-      return result;
813
-   }
814
-   return *this;
815
+   m_privateData->setGeometry(GEOSGeom_createEmptyPolygon());
816
 }
817
-ossimPolyArea2d ossimPolyArea2d::operator -(const ossimPolyArea2d& rhs)const
818
+
819
+const ossimPolyArea2d &ossimPolyArea2d::operator=(const ossimPolyArea2d &rhs)
820
 {
821
-   if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
822
+   if (&rhs != this)
823
    {
824
-      ossimPolyArea2d result;
825
-      try // GEOS code throws exceptions...
826
-      {
827
-         result.m_privateData->setGeometry(m_privateData->m_geometry->difference(
828
-                                              rhs.m_privateData->m_geometry));
829
-      }
830
-      catch( const std::exception& e )
831
-      {
832
-         ossimNotify(ossimNotifyLevel_DEBUG)
833
-            << "ossimPolyArea2d::operator- Caught exception: " << e.what() << std::endl;
834
-         result.clearPolygons();
835
-      }
836
-      catch( ... )
837
-      {
838
-         ossimNotify(ossimNotifyLevel_DEBUG)
839
-            << "ossimPolyArea2d::operator- Caught exception!" << std::endl;
840
-         result.clearPolygons();
841
-      }
842
-      return result;
843
+      m_privateData->deleteGeometry();
844
+      m_privateData->m_geometry = GEOSGeom_clone(rhs.m_privateData->m_geometry);
845
    }
846
+
847
    return *this;
848
 }
849
 
850
-const ossimPolyArea2d& ossimPolyArea2d::operator &=(const ossimPolyArea2d& rhs)
851
+const ossimPolyArea2d &ossimPolyArea2d::operator=(const ossimPolygon &rhs)
852
 {
853
-   if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
854
-   {
855
-      try // GEOS code throws exceptions...
856
-      {
857
-         m_privateData->setGeometry(m_privateData->m_geometry->intersection(
858
-                                       rhs.m_privateData->m_geometry));
859
-      }
860
-      catch( const std::exception& e )
861
-      {
862
-         ossimNotify(ossimNotifyLevel_DEBUG)
863
-            << "ossimPolyArea2d::operator&= Caught exception: " << e.what() << std::endl;
864
-         this->clearPolygons();
865
-      }
866
-      catch( ... )
867
-      {
868
-         ossimNotify(ossimNotifyLevel_DEBUG)
869
-            << "ossimPolyArea2d::operator&= Caught exception!" << std::endl;
870
-         this->clearPolygons();
871
-      }      
872
-   }
873
+   m_privateData->setGeometry(rhs);
874
+
875
    return *this;
876
 }
877
 
878
-const ossimPolyArea2d& ossimPolyArea2d::operator +=(const ossimPolyArea2d& rhs)
879
+const ossimPolyArea2d &ossimPolyArea2d::operator=(const ossimIrect &rect)
880
 {
881
-   if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
882
-   {
883
-      try // GEOS code throws exceptions...
884
-      {
885
-         m_privateData->setGeometry(m_privateData->m_geometry->Union(
886
-                                       rhs.m_privateData->m_geometry));
887
-      }
888
-      catch( const std::exception& e )
889
-      {
890
-         ossimNotify(ossimNotifyLevel_DEBUG)
891
-            << "ossimPolyArea2d::operator+= Caught exception: " << e.what() << std::endl;
892
-         this->clearPolygons();
893
-      }
894
-      catch( ... )
895
-      {
896
-         ossimNotify(ossimNotifyLevel_DEBUG)
897
-            << "ossimPolyArea2d::operator+= Caught exception!" << std::endl;
898
-         this->clearPolygons();
899
-      }      
900
-   }
901
+   m_privateData->setGeometry(ossimPolygon(rect));
902
+
903
    return *this;
904
 }
905
 
906
-const ossimPolyArea2d& ossimPolyArea2d::operator -=(const ossimPolyArea2d& rhs)
907
+const ossimPolyArea2d &ossimPolyArea2d::operator=(const ossimDrect &rect)
908
 {
909
-   if((this!=&rhs) && m_privateData->m_geometry && rhs.m_privateData->m_geometry)
910
-   {
911
-      try // GEOS code throws exceptions...
912
-      {
913
-         m_privateData->setGeometry(m_privateData->m_geometry->difference(
914
-                                       rhs.m_privateData->m_geometry));
915
-      }
916
-      catch( const std::exception& e )
917
-      {
918
-         ossimNotify(ossimNotifyLevel_DEBUG)
919
-            << "ossimPolyArea2d::operator-= Caught exception: " << e.what() << std::endl;
920
-         this->clearPolygons();
921
-      }
922
-      catch( ... )
923
-      {
924
-         ossimNotify(ossimNotifyLevel_DEBUG)
925
-            << "ossimPolyArea2d::operator-= Caught exception!" << std::endl;
926
-         this->clearPolygons();
927
-      }      
928
-   }
929
+   m_privateData->setGeometry(ossimPolygon(rect));
930
+
931
    return *this;
932
 }
933
 
934
-void ossimPolyArea2d::add(const ossimPolyArea2d& rhs)
935
+const ossimPolyArea2d &ossimPolyArea2d::operator=(const std::vector<ossimGpt> &polygon)
936
 {
937
-   if(isEmpty())
938
-   {
939
-      *this=rhs;
940
-   }
941
-   else
942
-   {
943
-      geos::geom::Geometry* geom = m_privateData->m_geometry->Union(rhs.m_privateData->m_geometry);
944
-      if(geom) m_privateData->setGeometry(geom);
945
-   }
946
+   m_privateData->setGeometry(ossimPolygon(polygon));
947
+
948
+   return *this;
949
 }
950
 
951
-void ossimPolyArea2d::clearPolygons()
952
+const ossimPolyArea2d &ossimPolyArea2d::operator=(const std::vector<ossimDpt> &polygon)
953
 {
954
-   m_privateData->deleteGeometry();
955
-#if 0
956
-   clearEngine();
957
-#endif
958
+   m_privateData->setGeometry(ossimPolygon(polygon));
959
+
960
+   return *this;
961
 }
962
 
963
-bool ossimPolyArea2d::getVisiblePolygons(vector<ossimPolygon>& polyList)const
964
+const ossimPolyArea2d &ossimPolyArea2d::operator&=(const ossimPolyArea2d &rhs)
965
 {
966
-   bool foundPolys = false;
967
-   if(m_privateData->m_geometry)
968
-   {
969
-      ossim_uint32 sizeBefore = (ossim_uint32)polyList.size();
970
-      recurseVisibleGeometries(polyList, m_privateData->m_geometry);
971
-      foundPolys = (sizeBefore != polyList.size());
972
-   }
973
+   GEOSGeometry *geom = GEOSIntersection(m_privateData->m_geometry, rhs.m_privateData->m_geometry);
974
+   m_privateData->setGeometry(geom);
975
 
976
-   return foundPolys;
977
+   return *this;
978
 }
979
 
980
-bool ossimPolyArea2d::getPolygonHoles(vector<ossimPolygon>& polyList)const
981
+ossimPolyArea2d ossimPolyArea2d::operator&(const ossimPolyArea2d &rhs) const
982
 {
983
-   bool foundPolys = false;
984
-   if(m_privateData->m_geometry)
985
-   {
986
-      ossim_uint32 sizeBefore = (ossim_uint32)polyList.size();
987
-      recurseHoles(polyList, m_privateData->m_geometry);
988
-      foundPolys = (sizeBefore != polyList.size());
989
-   }
990
+   ossimPolyArea2d result(*this);
991
 
992
-   return foundPolys;
993
+   result &= rhs;
994
+
995
+   return result;
996
 }
997
 
998
-bool ossimPolyArea2d::getCompletePolygons(vector<ossimPolyArea2d>& polyList)const
999
+ossimPolyArea2d ossimPolyArea2d::operator+(const ossimPolyArea2d &rhs) const
1000
 {
1001
-	bool foundPolys = false;
1002
-	if(m_privateData->m_geometry){
1003
-		ossim_uint32 sizeBefore = (ossim_uint32)polyList.size();
1004
-		recurseCompleteGeometries(polyList, m_privateData->m_geometry);
1005
-		foundPolys = (sizeBefore != polyList.size());
1006
-	}
1007
-	return foundPolys;
1008
+   ossimPolyArea2d result(*this);
1009
+
1010
+   result += rhs;
1011
+
1012
+   return result;
1013
 }
1014
 
1015
-bool ossimPolyArea2d::isEmpty()const
1016
+const ossimPolyArea2d &ossimPolyArea2d::operator+=(const ossimPolyArea2d &rhs)
1017
 {
1018
-   bool result = true;
1019
-   if (m_privateData&&m_privateData->m_geometry)
1020
-   {
1021
-      result = m_privateData->m_geometry->isEmpty();
1022
-   }
1023
+   GEOSGeometry *geom = GEOSUnion(m_privateData->m_geometry, rhs.m_privateData->m_geometry);
1024
 
1025
-   return result;
1026
+   m_privateData->setGeometry(geom);
1027
+
1028
+   return *this;
1029
 }
1030
 
1031
-bool ossimPolyArea2d::isValid(bool displayValidationError)const
1032
+ossimPolyArea2d ossimPolyArea2d::operator-(const ossimPolyArea2d &rhs) const
1033
 {
1034
-   bool result = false;
1035
-   
1036
-   if(m_privateData&&m_privateData->m_geometry)
1037
-   {
1038
-      if(displayValidationError)
1039
-      {
1040
-         geos::operation::valid::IsValidOp validityCheck(m_privateData->m_geometry);
1041
-         geos::operation::valid::TopologyValidationError*
1042
-            topologyValidationError(validityCheck.getValidationError());
1043
-         // if(topologyValidationError == nullptr)
1044
-         if(topologyValidationError == 0)
1045
-         {
1046
-            result = true;
1047
-         }
1048
-         else
1049
-         {
1050
-            ossimNotify(ossimNotifyLevel_INFO)
1051
-               << "ossimPolyArea2d::isValid: " << topologyValidationError->toString() << std::endl;
1052
-         }
1053
-      }
1054
-      else
1055
-      {
1056
-         result = m_privateData->m_geometry->isValid();
1057
-      }
1058
-   }
1059
-   
1060
+   ossimPolyArea2d result(*this);
1061
+
1062
+   result -= rhs;
1063
+
1064
    return result;
1065
 }
1066
 
1067
-bool ossimPolyArea2d::isPointWithin(const ossimDpt& point)const
1068
+const ossimPolyArea2d &ossimPolyArea2d::operator-=(const ossimPolyArea2d &rhs)
1069
 {
1070
-   return isPointWithin(point.x, point.y);
1071
+   GEOSGeometry *geom = GEOSDifference(m_privateData->m_geometry, rhs.m_privateData->m_geometry);
1072
+
1073
+   m_privateData->setGeometry(geom);
1074
+
1075
+   return *this;
1076
 }
1077
 
1078
-bool ossimPolyArea2d::isPointWithin(double x, double y)const
1079
+ossim_float64 ossimPolyArea2d::getArea()const
1080
 {
1081
-   bool result = false;
1082
-
1083
+   double result = 0.0;
1084
+   
1085
    if(!isEmpty())
1086
    {
1087
-      geos::geom::Coordinate c(x,y);
1088
-      geos::geom::Geometry* geom = m_privateData->geomFactory()->createPoint(c);
1089
-  
1090
-      result = m_privateData->m_geometry->intersects(geom);
1091
-
1092
-      delete geom;
1093
+      GEOSArea(m_privateData->m_geometry, &result);
1094
    }
1095
 
1096
    return result;
1097
 }
1098
 
1099
-void ossimPolyArea2d::getBoundingRect(ossimDrect& rect)
1100
+bool ossimPolyArea2d::isEmpty() const
1101
 {
1102
-   rect.makeNan();
1103
+   return m_privateData->isEmpty();
1104
+}
1105
 
1106
-   if(!isEmpty())
1107
-   {
1108
-      const geos::geom::Envelope* envelope = m_privateData->m_geometry->getEnvelopeInternal();
1109
+bool ossimPolyArea2d::isValid(bool displayValidationError) const
1110
+{
1111
+   return m_privateData->isValid(displayValidationError);
1112
+}
1113
 
1114
-      rect = ossimDrect(envelope->getMinX(), envelope->getMinY(), envelope->getMaxX(), envelope->getMaxY());
1115
-   }
1116
+bool ossimPolyArea2d::isPointWithin(const ossimDpt &point) const
1117
+{
1118
+   return m_privateData->isPointWithin(point);
1119
 }
1120
 
1121
-std::string ossimPolyArea2d::toString()const
1122
+bool ossimPolyArea2d::isPointWithin(double x, double y) const
1123
 {
1124
-   std::string result = "";
1125
+   return isPointWithin(ossimDpt(x, y));
1126
+}
1127
 
1128
-   if(m_privateData->m_geometry)
1129
-   {
1130
-      result = m_privateData->m_geometry->toString();
1131
-   }
1132
+void ossimPolyArea2d::getBoundingRect(ossimDrect &rect) const
1133
+{
1134
+   m_privateData->getBoundingRect(rect);
1135
+}
1136
 
1137
-   return result;
1138
+bool ossimPolyArea2d::intersects(const ossimPolyArea2d &rhs) const
1139
+{
1140
+   return (GEOSIntersects(m_privateData->m_geometry,
1141
+                          rhs.m_privateData->m_geometry) == 1);
1142
 }
1143
 
1144
-ossimPolyArea2d ossimPolyArea2d::getBufferedShape(double distance) const{
1145
-	ossimPolyArea2d result;
1146
-	try{
1147
-		geos::operation::buffer::BufferOp buffer_operation(m_privateData->m_geometry);
1148
-		result.m_privateData->setGeometry( buffer_operation.getResultGeometry(distance));
1149
-	}catch( const std::exception& e ){
1150
-		ossimNotify(ossimNotifyLevel_DEBUG)
1151
-			<< "ossimPolyArea2d::getBufferedShape Caught exception: " << e.what() << std::endl;
1152
-		result.clearPolygons();
1153
-	}catch( ... ){
1154
-		ossimNotify(ossimNotifyLevel_DEBUG)
1155
-			<< "ossimPolyArea2d::getBufferedShape Caught exception!" << std::endl;
1156
-		result.clearPolygons();
1157
-	}
1158
-	return result;
1159
+void ossimPolyArea2d::makeValid()
1160
+{
1161
+   ossimPolyArea2dPrivate::GEOSGeometryPtr geom = GEOSMakeValid(m_privateData->m_geometry);
1162
+   if(geom) m_privateData->setGeometry(geom);
1163
 }
1164
-ossimPolyArea2d& ossimPolyArea2d::setToBufferedShape(double distance)
1165
+
1166
+
1167
+void ossimPolyArea2d::add(const ossimPolyArea2d &rhs)
1168
 {
1169
-   try{
1170
-      geos::operation::buffer::BufferOp buffer_operation(m_privateData->m_geometry);
1171
-      m_privateData->setGeometry( buffer_operation.getResultGeometry(distance));
1172
-   }catch( const std::exception& e ){
1173
-      ossimNotify(ossimNotifyLevel_DEBUG)
1174
-         << "ossimPolyArea2d::getBufferedShape Caught exception: " << e.what() << std::endl;
1175
-   }catch( ... ){
1176
-      ossimNotify(ossimNotifyLevel_DEBUG)
1177
-         << "ossimPolyArea2d::getBufferedShape Caught exception!" << std::endl;
1178
-   }
1179
-   return *this;
1180
+   *this += rhs;
1181
 }
1182
 
1183
-ossimPolyArea2d& ossimPolyArea2d::toMultiPolygon()
1184
+bool ossimPolyArea2d::getVisiblePolygons(std::vector<ossimPolygon> &polyList) const
1185
 {
1186
+   m_privateData->getVisiblePolygons(polyList);
1187
 
1188
+   return (polyList.size() > 0);
1189
+}
1190
 
1191
-   try{
1192
-      if(m_privateData->m_geometry)
1193
-      {
1194
-         switch(m_privateData->m_geometry->getGeometryTypeId())
1195
-         {
1196
-            case geos::geom::GEOS_POLYGON:
1197
-            {
1198
-               std::vector<geos::geom::Geometry*> values;
1199
-               values.push_back(m_privateData->m_geometry->clone());
1200
+bool ossimPolyArea2d::getPolygonHoles(std::vector<ossimPolygon> &polyList) const
1201
+{
1202
+   m_privateData->getPolygonHoles(polyList);
1203
 
1204
-               m_privateData->setGeometry(m_privateData->m_geometry->getFactory()->createMultiPolygon(values));
1205
-               break;
1206
-            }
1207
-            case geos::geom::GEOS_MULTIPOLYGON:
1208
-            {
1209
-               // intentionally left blank
1210
-               break;
1211
-            }
1212
-            default:
1213
-            {  
1214
-               // might need an error at a later date
1215
-               ossimNotify(ossimNotifyLevel_WARN)
1216
-                  << "ossimPolyArea2d::toMultiPolygon Geometry type can not be converted to a multi polygon: " <<m_privateData->m_geometry->getGeometryType()<< std::endl;
1217
+   return (polyList.size() > 0);
1218
+}
1219
 
1220
-               break;
1221
-            }
1222
-         }
1223
-      }
1224
-   }
1225
-   catch(const std::exception& e)
1226
-   {
1227
-      ossimNotify(ossimNotifyLevel_WARN)
1228
-         << "ossimPolyArea2d::toMultiPolygon Caught exception: " << e.what() << std::endl;
1229
-   }
1230
-   catch(...)
1231
+ossimPolyArea2d &ossimPolyArea2d::toMultiPolygon()
1232
+{
1233
+   int geomType = GEOSGeomTypeId(m_privateData->m_geometry);
1234
+
1235
+   if (geomType != GEOS_MULTIPOLYGON)
1236
    {
1237
-      ossimNotify(ossimNotifyLevel_WARN)
1238
-         << "ossimPolyArea2d::toMultiPolygon Caught exception!" << std::endl;
1239
+      std::vector<GEOSGeometry *> geoms(1);
1240
+      geoms[0] = GEOSGeom_clone(m_privateData->m_geometry);
1241
+      GEOSGeometry *result = GEOSGeom_createCollection(GEOS_MULTIPOLYGON,
1242
+                                                       &geoms.front(), 1);
1243
+      m_privateData->setGeometry(result);
1244
    }
1245
 
1246
    return *this;
1247
 }
1248
 
1249
-bool ossimPolyArea2d::saveState(ossimKeywordlist& kwl,
1250
-                                const char* prefix)const
1251
+std::string ossimPolyArea2d::toString() const
1252
+{
1253
+   return m_privateData->toString();
1254
+}
1255
+
1256
+bool ossimPolyArea2d::setFromWkt(const std::string &s)
1257
+{
1258
+   return m_privateData->setFromWkt(s);
1259
+}
1260
+
1261
+bool ossimPolyArea2d::saveState(ossimKeywordlist &kwl,
1262
+                                const char *prefix) const
1263
 {
1264
    kwl.add(prefix,
1265
            ossimKeywordNames::TYPE_KW,
1266
            "ossimPolyArea2d",
1267
            true);
1268
 
1269
-   if(!isEmpty())
1270
+   if (!isEmpty())
1271
    {
1272
-      geos::io::WKTWriter writer;
1273
 
1274
       kwl.add(prefix,
1275
               "wkt",
1276
-              writer.write(m_privateData->m_geometry).c_str(),
1277
+              toString().c_str(),
1278
               true);
1279
    }
1280
-   // else
1281
-   // {
1282
-   //
1283
-   // }
1284
-
1285
    return true;
1286
 }
1287
 
1288
-bool ossimPolyArea2d::loadState(const ossimKeywordlist& kwl,
1289
-                                const char* prefix)
1290
+bool ossimPolyArea2d::loadState(const ossimKeywordlist &kwl,
1291
+                                const char *prefix)
1292
 {
1293
-   if(m_privateData)
1294
+   bool result = true;
1295
+
1296
+   if (m_privateData)
1297
    {
1298
       ossimString wkt = kwl.find(prefix, "wkt");
1299
 
1300
-      if(!wkt.empty())
1301
+      if (!wkt.empty())
1302
       {
1303
-         geos::io::WKTReader reader(m_privateData->geomFactory());
1304
-         try
1305
-         {
1306
-            m_privateData->setGeometry(reader.read(wkt.c_str()));
1307
-         }
1308
-         catch( const std::exception& e )
1309
-         {
1310
-            ossimNotify(ossimNotifyLevel_DEBUG)
1311
-               << "ossimPolyArea2d::loadState Caught exception: " << e.what() << std::endl;
1312
-            this->clearPolygons();
1313
-         }
1314
-         catch(...)
1315
-         {
1316
-            ossimNotify(ossimNotifyLevel_DEBUG)
1317
-               << "ossimPolyArea2d::loadState Caught exception!" << std::endl;
1318
-            this->clearPolygons(); 
1319
-         }
1320
+         result = setFromWkt(wkt.string());
1321
       }
1322
    }
1323
-   return true;
1324
+
1325
+   return result;
1326
+}
1327
+
1328
+std::ostream &operator<<(std::ostream &out, const ossimPolyArea2d &rhs)
1329
+{
1330
+   if (!rhs.isEmpty())
1331
+   {
1332
+      out << rhs.toString();
1333
+   }
1334
+
1335
+   return out;
1336
 }
(-)graphics/ossim/files/patch-src-imaging-ossimImageGeometry.cpp (-13 lines)
Removed Link Here
1
Obtained from:	https://github.com/ossimlabs/ossim/commit/c456397821cf369af4d9ff1fb60a5dfd1bcefc24
2
3
--- src/imaging/ossimImageGeometry.cpp.orig	2019-10-17 21:54:21 UTC
4
+++ src/imaging/ossimImageGeometry.cpp
5
@@ -1240,7 +1240,7 @@ void ossimImageGeometry::calculatePolyBo
6
       }
7
       result.add(ossimPolygon(gPoints));
8
    }
9
-   if(!result.isValid()) result.setToBufferedShape();
10
+   if(!result.isValid()) result.makeValid();
11
 }
12
 
13
 
(-)graphics/ossim/files/patch-src-init-ossimInit.cpp (-157 lines)
Removed Link Here
1
Obtained from:	https://github.com/ossimlabs/ossim/commit/c456397821cf369af4d9ff1fb60a5dfd1bcefc24
2
		https://github.com/ossimlabs/ossim/commit/0498f71e811ff3068ba491929c09aa5137ea0cca
3
		https://github.com/ossimlabs/ossim/commit/c0d97536f9ac967941b6ca48a6a7a4dde44f4ee3
4
5
--- src/init/ossimInit.cpp.orig	2019-10-17 21:54:21 UTC
6
+++ src/init/ossimInit.cpp
7
@@ -65,12 +65,61 @@
8
 
9
 #include <algorithm>
10
 #include <mutex>
11
-
12
+#include <geos_c.h>
13
+#include <cstdio>
14
+#include <cstdarg>
15
+#include <cstddef>
16
 using namespace std;
17
 
18
 static ossimTrace traceExec = ossimTrace("ossimInit:exec");
19
 static ossimTrace traceDebug = ossimTrace("ossimInit:debug");
20
 
21
+extern "C"
22
+{
23
+   void geosNoticeFunction(const char *fmt, ...);
24
+   void geosErrorFunction(const char *fmt, ...);
25
+}
26
+
27
+ossimString geosErrorV(const char *fmt, va_list args)
28
+{
29
+   char temp[2024];
30
+   if (fmt)
31
+   {
32
+      vsprintf(temp, fmt, args);
33
+   }
34
+   else
35
+   {
36
+      sprintf(temp, "%s", "");
37
+   }
38
+
39
+   return temp;
40
+}
41
+
42
+void geosNoticeFunction(const char *fmt, ...)
43
+{
44
+   // NOTE: This code has an infinite loop in it!!! (drb)
45
+   //std::lock_guard<std::mutex> lock(theMutex);
46
+   // theMutex.lock();
47
+   va_list args;
48
+
49
+   va_start(args, fmt);
50
+   ossimString result = geosErrorV(fmt, args);
51
+   va_end(args);
52
+   // theMutex.unlock();
53
+   ossimNotify(ossimNotifyLevel_WARN) << result << "\n";
54
+}
55
+
56
+void geosErrorFunction(const char *fmt, ...)
57
+{
58
+   va_list args;
59
+
60
+   va_start(args, fmt);
61
+   ossimString result = geosErrorV(fmt, args);
62
+   va_end(args);
63
+   // theMutex.unlock();
64
+   ossimNotify(ossimNotifyLevel_WARN) << result << "\n";
65
+}
66
+
67
 ossimInit* ossimInit::theInstance = 0;
68
 
69
 ossimInit::~ossimInit()
70
@@ -122,6 +171,8 @@ void ossimInit::initialize(int& argc, ch
71
 {
72
    static std::mutex m;
73
    std::lock_guard<std::mutex> lock(m);
74
+   initGEOS(geosNoticeFunction, geosErrorFunction);
75
+
76
    if( !theInitializedFlag )
77
    {
78
       ossimArgumentParser argumentParser(&argc, argv);
79
@@ -144,6 +195,8 @@ void ossimInit::initialize(ossimArgument
80
       }
81
       return;
82
    }
83
+   initGEOS(geosNoticeFunction, geosErrorFunction);
84
+
85
    theInstance->parseEnvOptions(parser);
86
    theInstance->parseNotifyOption(parser);
87
    theInstance->parsePrefsOptions(parser);
88
@@ -202,7 +255,7 @@ void ossimInit::initialize()
89
       }
90
       return;
91
    }
92
-   
93
+
94
    int argc = 1;
95
    char* argv[1];
96
 
97
@@ -210,59 +263,11 @@ void ossimInit::initialize()
98
    argv[0][0] = '\0';
99
    initialize(argc, argv);
100
    delete [] argv[0];
101
-
102
-#if 0   
103
-    static std::mutex m;
104
-   std::lock_guard<std::mutex> lock(m);
105
-   if(theInitializedFlag)
106
-   {
107
-      if (traceDebug())
108
-      {
109
-         ossimNotify(ossimNotifyLevel_DEBUG)
110
-            << "DEBUG ossimInit::initialize(): Already initialized, returning......" << std::endl;
111
-      }
112
-      return;
113
-   }
114
-
115
-   theInstance->theAppName  = "";
116
-   theInstance->thePreferences = ossimPreferences::instance();
117
-   theInstance->initializeDefaultFactories();
118
-   
119
-   if ( theElevEnabledFlag )
120
-   {
121
-      theInstance->initializeElevation();
122
-   }
123
-
124
-   theInstance->initializeLogFile();
125
-
126
-   //---
127
-   // To do:
128
-   // We need a mechanism to register factories to the "front" or the
129
-   // "back" of factory list so that plugins can override things.  For
130
-   // now we will initialize the plugins last...
131
-   //---
132
-   if(thePluginLoaderEnabledFlag)
133
-   {
134
-      theInstance->initializePlugins();
135
-   }
136
-
137
-   if (traceDebug())
138
-   {
139
-      ossimNotify(ossimNotifyLevel_DEBUG)
140
-         << "ossim preferences file: "
141
-         << theInstance->thePreferences->getPreferencesFilename()
142
-         << "\nVersion: " << version()
143
-         << "\nossimInit::initialize() leaving..."
144
-         << std::endl;
145
-   } 
146
-   
147
-   theInitializedFlag = true;
148
-#endif
149
 }
150
 
151
 void ossimInit::finalize()
152
 {
153
-   
154
+   finishGEOS();
155
 }
156
 /*!****************************************************************************
157
  *  Prints to stdout the list of command line options that this object parses.
(-)graphics/ossim/pkg-plist (+6 lines)
Lines 873-878 include/ossim/support_data/ossimLasPointRecordInterface.h Link Here
873
include/ossim/support_data/ossimNitfAcftbTag.h
873
include/ossim/support_data/ossimNitfAcftbTag.h
874
include/ossim/support_data/ossimNitfAimidbTag.h
874
include/ossim/support_data/ossimNitfAimidbTag.h
875
include/ossim/support_data/ossimNitfBlockaTag.h
875
include/ossim/support_data/ossimNitfBlockaTag.h
876
include/ossim/support_data/ossimNitfCamsdaTag.h
876
include/ossim/support_data/ossimNitfCommon.h
877
include/ossim/support_data/ossimNitfCommon.h
877
include/ossim/support_data/ossimNitfCompressionHeader.h
878
include/ossim/support_data/ossimNitfCompressionHeader.h
878
include/ossim/support_data/ossimNitfCsccgaTag.h
879
include/ossim/support_data/ossimNitfCsccgaTag.h
Lines 914-920 include/ossim/support_data/ossimNitfJ2klraTag.h Link Here
914
include/ossim/support_data/ossimNitfLabelHeader.h
915
include/ossim/support_data/ossimNitfLabelHeader.h
915
include/ossim/support_data/ossimNitfLabelHeaderV2_0.h
916
include/ossim/support_data/ossimNitfLabelHeaderV2_0.h
916
include/ossim/support_data/ossimNitfLocalCartographicTag.h
917
include/ossim/support_data/ossimNitfLocalCartographicTag.h
918
include/ossim/support_data/ossimNitfMicidaTag.h
919
include/ossim/support_data/ossimNitfMimcsaTag.h
917
include/ossim/support_data/ossimNitfMstgtaTag.h
920
include/ossim/support_data/ossimNitfMstgtaTag.h
921
include/ossim/support_data/ossimNitfMtimfaTag.h
922
include/ossim/support_data/ossimNitfMtimsaTag.h
918
include/ossim/support_data/ossimNitfNameConversionTables.h
923
include/ossim/support_data/ossimNitfNameConversionTables.h
919
include/ossim/support_data/ossimNitfPiaimcTag.h
924
include/ossim/support_data/ossimNitfPiaimcTag.h
920
include/ossim/support_data/ossimNitfProjectionParameterTag.h
925
include/ossim/support_data/ossimNitfProjectionParameterTag.h
Lines 943-948 include/ossim/support_data/ossimNitfTagInformation.h Link Here
943
include/ossim/support_data/ossimNitfTextHeader.h
948
include/ossim/support_data/ossimNitfTextHeader.h
944
include/ossim/support_data/ossimNitfTextHeaderV2_0.h
949
include/ossim/support_data/ossimNitfTextHeaderV2_0.h
945
include/ossim/support_data/ossimNitfTextHeaderV2_1.h
950
include/ossim/support_data/ossimNitfTextHeaderV2_1.h
951
include/ossim/support_data/ossimNitfTmintaTag.h
946
include/ossim/support_data/ossimNitfUnknownTag.h
952
include/ossim/support_data/ossimNitfUnknownTag.h
947
include/ossim/support_data/ossimNitfUse00aTag.h
953
include/ossim/support_data/ossimNitfUse00aTag.h
948
include/ossim/support_data/ossimNitfVqCompressionHeader.h
954
include/ossim/support_data/ossimNitfVqCompressionHeader.h

Return to bug 242979