[geos-commits] [SCM] GEOS branch master updated. a00aa60de9f1524fbb656a483b69d1afca7aa46d
git at osgeo.org
git at osgeo.org
Thu May 23 17:22:49 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 a00aa60de9f1524fbb656a483b69d1afca7aa46d (commit)
via 4a6813e0594aa76ef92a765496c76b12066c562e (commit)
from 1ccc019387d4902557396ed2d251efcb477655fa (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 a00aa60de9f1524fbb656a483b69d1afca7aa46d
Merge: 1ccc019 4a6813e
Author: Daniel Baston <dbaston at gmail.com>
Date: Thu May 23 20:22:35 2019 -0400
Merge branch 'remove-coordseq-to-vector'
commit 4a6813e0594aa76ef92a765496c76b12066c562e
Author: Daniel Baston <dbaston at gmail.com>
Date: Thu May 23 16:24:23 2019 -0400
Remove CoordinateSequence::toVector()
Deprecated a decade ago, but still used a couple of times within GEOS.
Supports the goal of a smaller CoordinateSequence interface.
diff --git a/include/geos/geom/CoordinateArraySequence.h b/include/geos/geom/CoordinateArraySequence.h
index f25103e..7ce2799 100644
--- a/include/geos/geom/CoordinateArraySequence.h
+++ b/include/geos/geom/CoordinateArraySequence.h
@@ -52,9 +52,6 @@ public:
//int size() const;
size_t getSize() const override;
- // @deprecated
- const std::vector<Coordinate>* toVector() const override;
-
// See dox in CoordinateSequence.h
void toVector(std::vector<Coordinate>&) const override;
diff --git a/include/geos/geom/CoordinateSequence.h b/include/geos/geom/CoordinateSequence.h
index f4c5764..70eb4c4 100644
--- a/include/geos/geom/CoordinateSequence.h
+++ b/include/geos/geom/CoordinateSequence.h
@@ -120,30 +120,8 @@ public:
return getSize();
}
- /** \brief
- * Returns a read-only vector with the Coordinates in this collection.
- *
- * Whether or not the Coordinates returned are the actual underlying
- * Coordinates or merely copies depends on the implementation.
- * Note that if this implementation does not store its data as an
- * array of Coordinates, this method will incur a performance penalty
- * because the array needs to be built from scratch.
- *
- * This method is a port of the toCoordinateArray() method of JTS.
- * It is not much used as memory management requires us to
- * know whether we should or not delete the returned object
- * in a consistent way. Our options are: use shared_ptr<Coordinate>
- * or always keep ownership of an eventual newly created vector.
- * We opted for the second, so the returned object is a const, to
- * also ensure that returning an internal pointer doesn't make
- * the object mutable.
- *
- * @deprecated use toVector(std::vector<Coordinate>&) instead
- */
- virtual const std::vector<Coordinate>* toVector() const = 0;
-
- /// Pushes all Coordinates of this sequence onto the provided vector.
- //
+ /// Pushes all Coordinates of this sequence into the provided vector.
+ ///
/// This method is a port of the toCoordinateArray() method of JTS.
///
virtual void toVector(std::vector<Coordinate>& coords) const = 0;
@@ -206,7 +184,7 @@ public:
/// Delete Coordinate at position pos (list will shrink).
virtual void deleteAt(std::size_t pos) = 0;
- /// Get a string rapresentation of CoordinateSequence
+ /// Get a string representation of CoordinateSequence
virtual std::string toString() const = 0;
/// Substitute Coordinate list with a copy of the given vector
diff --git a/src/geom/CoordinateArraySequence.cpp b/src/geom/CoordinateArraySequence.cpp
index f30735f..48f068c 100644
--- a/src/geom/CoordinateArraySequence.cpp
+++ b/src/geom/CoordinateArraySequence.cpp
@@ -85,12 +85,6 @@ CoordinateArraySequence::setPoints(const vector<Coordinate>& v)
vect->assign(v.begin(), v.end());
}
-const vector<Coordinate>*
-CoordinateArraySequence::toVector() const
-{
- return vect; //new vector<Coordinate>(vect->begin(),vect->end());
-}
-
std::size_t
CoordinateArraySequence::getDimension() const
{
diff --git a/src/geom/LinearRing.cpp b/src/geom/LinearRing.cpp
index b6fe05a..c254a4d 100644
--- a/src/geom/LinearRing.cpp
+++ b/src/geom/LinearRing.cpp
@@ -111,9 +111,7 @@ LinearRing::getGeometryType() const
void
LinearRing::setPoints(const CoordinateSequence* cl)
{
- const vector<Coordinate>* v = cl->toVector();
- points->setPoints(*(v));
- //delete v;
+ points = cl->clone();
}
GeometryTypeId
diff --git a/src/operation/overlay/snap/GeometrySnapper.cpp b/src/operation/overlay/snap/GeometrySnapper.cpp
index 36b7e6b..87e9e68 100644
--- a/src/operation/overlay/snap/GeometrySnapper.cpp
+++ b/src/operation/overlay/snap/GeometrySnapper.cpp
@@ -59,8 +59,9 @@ private:
using std::unique_ptr;
assert(srcPts);
- assert(srcPts->toVector());
- LineStringSnapper snapper(*(srcPts->toVector()), snapTol);
+ std::vector<Coordinate> coords;
+ srcPts->toVector(coords);
+ LineStringSnapper snapper(coords, snapTol);
unique_ptr<Coordinate::Vect> newPts = snapper.snapTo(snapPts);
const CoordinateSequenceFactory* cfact = factory->getCoordinateSequenceFactory();
diff --git a/src/operation/overlay/validate/OverlayResultValidator.cpp b/src/operation/overlay/validate/OverlayResultValidator.cpp
index 2cee56e..5900cb5 100644
--- a/src/operation/overlay/validate/OverlayResultValidator.cpp
+++ b/src/operation/overlay/validate/OverlayResultValidator.cpp
@@ -146,8 +146,11 @@ OverlayResultValidator::addVertices(const Geometry& g)
// TODO: optimize this by not copying coordinates
// and pre-allocating memory
unique_ptr<CoordinateSequence> cs(g.getCoordinates());
- const vector<Coordinate>* coords = cs->toVector();
- testCoords.insert(testCoords.end(), coords->begin(), coords->end());
+
+ testCoords.reserve(testCoords.size() + cs->size());
+ for (size_t i = 0; i < cs->size(); i++) {
+ testCoords.push_back(cs->getAt(i));
+ }
}
/*private*/
diff --git a/src/simplify/DouglasPeuckerSimplifier.cpp b/src/simplify/DouglasPeuckerSimplifier.cpp
index d76030f..cad62a1 100644
--- a/src/simplify/DouglasPeuckerSimplifier.cpp
+++ b/src/simplify/DouglasPeuckerSimplifier.cpp
@@ -105,12 +105,11 @@ DPTransformer::transformCoordinates(
{
::geos::ignore_unused_variable_warning(parent);
- const Coordinate::Vect* inputPts = coords->toVector();
- assert(inputPts);
+ Coordinate::Vect inputPts;
+ coords->toVector(inputPts);
std::unique_ptr<Coordinate::Vect> newPts =
- DouglasPeuckerLineSimplifier::simplify(*inputPts,
- distanceTolerance);
+ DouglasPeuckerLineSimplifier::simplify(inputPts, distanceTolerance);
return CoordinateSequence::Ptr(
factory->getCoordinateSequenceFactory()->create(
-----------------------------------------------------------------------
Summary of changes:
include/geos/geom/CoordinateArraySequence.h | 3 ---
include/geos/geom/CoordinateSequence.h | 28 +++-------------------
src/geom/CoordinateArraySequence.cpp | 6 -----
src/geom/LinearRing.cpp | 4 +---
src/operation/overlay/snap/GeometrySnapper.cpp | 5 ++--
.../overlay/validate/OverlayResultValidator.cpp | 7 ++++--
src/simplify/DouglasPeuckerSimplifier.cpp | 7 +++---
7 files changed, 15 insertions(+), 45 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list