[geos-commits] [SCM] GEOS branch master updated. 0dc5ed1e087cbfecd73254f603e7ad2151ecddcd

git at osgeo.org git at osgeo.org
Wed Jun 5 10:29:57 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  0dc5ed1e087cbfecd73254f603e7ad2151ecddcd (commit)
      from  89dbddd529eb3864fac733bf2cd0a6dc8a2094ec (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 0dc5ed1e087cbfecd73254f603e7ad2151ecddcd
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Jun 4 17:16:39 2019 -0400

    Implement CoordinateSequence::toString()
    
    Instead of being a pure virtual function that all implementations must
    provide, CoordinateSequence::toString() now uses the existing ostream
    operator to provide a consistent string representation for any
    CoordinateSequence.

diff --git a/include/geos/geom/CoordinateArraySequence.h b/include/geos/geom/CoordinateArraySequence.h
index 67fdf12..e3c6dd4 100644
--- a/include/geos/geom/CoordinateArraySequence.h
+++ b/include/geos/geom/CoordinateArraySequence.h
@@ -103,8 +103,6 @@ public:
 
     void setAt(const Coordinate& c, std::size_t pos) override;
 
-    std::string toString() const override;
-
     void setPoints(const std::vector<Coordinate>& v) override;
 
     double getOrdinate(std::size_t index,
diff --git a/include/geos/geom/CoordinateSequence.h b/include/geos/geom/CoordinateSequence.h
index 711f06a..ab33375 100644
--- a/include/geos/geom/CoordinateSequence.h
+++ b/include/geos/geom/CoordinateSequence.h
@@ -176,7 +176,7 @@ public:
     virtual void setAt(const Coordinate& c, std::size_t pos) = 0;
 
     /// Get a string representation of CoordinateSequence
-    virtual	std::string toString() const = 0;
+    std::string toString() const;
 
     /// Substitute Coordinate list with a copy of the given vector
     virtual void setPoints(const std::vector<Coordinate>& v) = 0;
diff --git a/src/geom/CoordinateArraySequence.cpp b/src/geom/CoordinateArraySequence.cpp
index a43a5d8..ae611aa 100644
--- a/src/geom/CoordinateArraySequence.cpp
+++ b/src/geom/CoordinateArraySequence.cpp
@@ -182,25 +182,6 @@ CoordinateArraySequence::setAt(const Coordinate& c, size_t pos)
     (*vect)[pos] = c;
 }
 
-string
-CoordinateArraySequence::toString() const
-{
-    string result("(");
-    if(getSize() > 0) {
-        //char buffer[100];
-        for(size_t i = 0, n = vect->size(); i < n; i++) {
-            Coordinate& c = (*vect)[i];
-            if(i) {
-                result.append(", ");
-            }
-            result.append(c.toString());
-        }
-    }
-    result.append(")");
-
-    return result;
-}
-
 CoordinateArraySequence::~CoordinateArraySequence()
 {
     delete vect;
diff --git a/src/geom/CoordinateSequence.cpp b/src/geom/CoordinateSequence.cpp
index 9e9e244..ba942ad 100644
--- a/src/geom/CoordinateSequence.cpp
+++ b/src/geom/CoordinateSequence.cpp
@@ -25,6 +25,7 @@
 #include <vector>
 #include <cassert>
 #include <iterator>
+#include <sstream>
 
 using namespace std;
 
@@ -251,6 +252,14 @@ operator<< (std::ostream& os, const CoordinateSequence& cs)
     return os;
 }
 
+std::string
+CoordinateSequence::toString() const
+{
+    std::stringstream ss;
+    ss << *this;
+    return ss.str();
+}
+
 bool
 operator== (const CoordinateSequence& s1, const CoordinateSequence& s2)
 {

-----------------------------------------------------------------------

Summary of changes:
 include/geos/geom/CoordinateArraySequence.h |  2 --
 include/geos/geom/CoordinateSequence.h      |  2 +-
 src/geom/CoordinateArraySequence.cpp        | 19 -------------------
 src/geom/CoordinateSequence.cpp             |  9 +++++++++
 4 files changed, 10 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list