[geos-commits] [SCM] GEOS branch master updated. 395ebff81baf36176fbd529b32cacd4c76927d53
git at osgeo.org
git at osgeo.org
Mon Aug 26 19:24:54 PDT 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, master has been updated
via 395ebff81baf36176fbd529b32cacd4c76927d53 (commit)
via 423263f8fc7ead2f4ff038ca4cc78eaf6dbbbf91 (commit)
from 50f558821f63ef7f8dd41b4ef3bdb581763936d6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 395ebff81baf36176fbd529b32cacd4c76927d53
Merge: 50f5588 423263f
Author: Daniel Baston <dbaston at gmail.com>
Date: Mon Aug 26 22:24:39 2019 -0400
Merge remote-tracking branch 'dbaston/precisionmodel-value'
commit 423263f8fc7ead2f4ff038ca4cc78eaf6dbbbf91
Author: Daniel Baston <dbaston at gmail.com>
Date: Mon Aug 26 14:34:27 2019 -0400
Store PrecisionModel as a value
diff --git a/include/geos/geom/GeometryFactory.h b/include/geos/geom/GeometryFactory.h
index 74d3122..fb9f206 100644
--- a/include/geos/geom/GeometryFactory.h
+++ b/include/geos/geom/GeometryFactory.h
@@ -25,6 +25,7 @@
#include <geos/geom/MultiPoint.h>
#include <geos/geom/MultiLineString.h>
#include <geos/geom/MultiPolygon.h>
+#include <geos/geom/PrecisionModel.h>
#include <geos/export.h>
#include <geos/inline.h>
@@ -46,7 +47,6 @@ class MultiLineString;
class MultiPoint;
class MultiPolygon;
class Polygon;
-class PrecisionModel;
}
}
@@ -490,7 +490,7 @@ protected:
private:
- const PrecisionModel* precisionModel;
+ PrecisionModel precisionModel;
int SRID;
const CoordinateSequenceFactory* coordinateListFactory;
diff --git a/src/geom/GeometryFactory.cpp b/src/geom/GeometryFactory.cpp
index 161b36f..42f28a6 100644
--- a/src/geom/GeometryFactory.cpp
+++ b/src/geom/GeometryFactory.cpp
@@ -82,7 +82,6 @@ public:
/*protected*/
GeometryFactory::GeometryFactory()
:
- precisionModel(new PrecisionModel()),
SRID(0),
coordinateListFactory(CoordinateArraySequenceFactory::instance())
, _refCount(0), _autoDestroy(false)
@@ -111,11 +110,8 @@ GeometryFactory::GeometryFactory(const PrecisionModel* pm, int newSRID,
std::cerr << "GEOS_DEBUG: GeometryFactory[" << this << "]::GeometryFactory(PrecisionModel[" << pm << "], SRID)" <<
std::endl;
#endif
- if(! pm) {
- precisionModel = new PrecisionModel();
- }
- else {
- precisionModel = new PrecisionModel(*pm);
+ if(pm) {
+ precisionModel = *pm;
}
if(! nCoordinateSequenceFactory) {
@@ -140,7 +136,6 @@ GeometryFactory::create(const PrecisionModel* pm, int newSRID,
GeometryFactory::GeometryFactory(
CoordinateSequenceFactory* nCoordinateSequenceFactory)
:
- precisionModel(new PrecisionModel()),
SRID(0)
, _refCount(0), _autoDestroy(false)
{
@@ -176,11 +171,8 @@ GeometryFactory::GeometryFactory(const PrecisionModel* pm)
#if GEOS_DEBUG
std::cerr << "GEOS_DEBUG: GeometryFactory[" << this << "]::GeometryFactory(PrecisionModel[" << pm << "])" << std::endl;
#endif
- if(! pm) {
- precisionModel = new PrecisionModel();
- }
- else {
- precisionModel = new PrecisionModel(*pm);
+ if(pm) {
+ precisionModel = *pm;
}
}
@@ -204,11 +196,8 @@ GeometryFactory::GeometryFactory(const PrecisionModel* pm, int newSRID)
std::cerr << "GEOS_DEBUG: GeometryFactory[" << this << "]::GeometryFactory(PrecisionModel[" << pm << "], SRID)" <<
std::endl;
#endif
- if(! pm) {
- precisionModel = new PrecisionModel();
- }
- else {
- precisionModel = new PrecisionModel(*pm);
+ if(pm) {
+ precisionModel = *pm;
}
}
@@ -222,15 +211,13 @@ GeometryFactory::create(const PrecisionModel* pm, int newSRID)
}
/*protected*/
-GeometryFactory::GeometryFactory(const GeometryFactory& gf)
-{
- assert(gf.precisionModel);
- precisionModel = new PrecisionModel(*(gf.precisionModel));
- SRID = gf.SRID;
- coordinateListFactory = gf.coordinateListFactory;
- _autoDestroy = false;
- _refCount = 0;
-}
+GeometryFactory::GeometryFactory(const GeometryFactory& gf) :
+precisionModel(gf.precisionModel),
+SRID(gf.SRID),
+coordinateListFactory(gf.coordinateListFactory),
+_refCount(0),
+_autoDestroy(false)
+{}
/*public static*/
GeometryFactory::Ptr
@@ -247,7 +234,6 @@ GeometryFactory::~GeometryFactory()
#if GEOS_DEBUG
std::cerr << "GEOS_DEBUG: GeometryFactory[" << this << "]::~GeometryFactory()" << std::endl;
#endif
- delete precisionModel;
}
/*public*/
@@ -307,7 +293,7 @@ GeometryFactory::toGeometry(const Envelope* envelope) const
const PrecisionModel*
GeometryFactory::getPrecisionModel() const
{
- return precisionModel;
+ return &precisionModel;
}
/*public*/
@@ -670,7 +656,7 @@ const
Geometry*
GeometryFactory::buildGeometry(vector<Geometry*>* newGeoms) const
{
- if(!newGeoms->size()) {
+ if(newGeoms->empty()) {
// we do not need the vector anymore
delete newGeoms;
return createGeometryCollection();
-----------------------------------------------------------------------
Summary of changes:
include/geos/geom/GeometryFactory.h | 4 ++--
src/geom/GeometryFactory.cpp | 44 +++++++++++++------------------------
2 files changed, 17 insertions(+), 31 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list