[Git][debian-gis-team/geos][upstream] New upstream version 3.9.0~beta2
Bas Couwenberg
gitlab at salsa.debian.org
Thu Dec 3 07:04:57 GMT 2020
Bas Couwenberg pushed to branch upstream at Debian GIS Project / geos
Commits:
a513a481 by Bas Couwenberg at 2020-12-03T05:38:58+01:00
New upstream version 3.9.0~beta2
- - - - -
28 changed files:
- CMakeLists.txt
- ChangeLog
- Version.txt
- capi/geos_ts_c.cpp
- configure
- configure.ac
- doc/CMakeLists.txt
- doc/Doxyfile
- include/geos/geom/FixedSizeCoordinateSequence.h
- include/geos/geom/LineSegment.h
- include/geos/geom/LineSegment.inl
- include/geos/geom/PrecisionModel.h
- include/geos/geom/PrecisionModel.inl
- include/geos/index/strtree/SimpleSTRnode.h
- include/geos/index/strtree/SimpleSTRtree.h
- src/geom/CoordinateArraySequence.cpp
- src/geom/PrecisionModel.cpp
- src/index/kdtree/KdTree.cpp
- src/index/strtree/SimpleSTRnode.cpp
- src/index/strtree/SimpleSTRtree.cpp
- src/io/WKTReader.cpp
- src/operation/buffer/BufferOp.cpp
- src/operation/overlayng/LineLimiter.cpp
- tests/unit/capi/GEOSCoordSeqTest.cpp
- tests/unit/capi/GEOSSTRtreeTest.cpp
- tests/unit/index/strtree/SimpleSTRtreeTest.cpp
- tests/unit/io/WKTReaderTest.cpp
- tests/unit/operation/buffer/BufferOpTest.cpp
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -125,10 +125,10 @@ project(GEOS VERSION "${_version_major}.${_version_minor}.${_version_patch}"
LANGUAGES C CXX
${_project_info})
-if("${_version_patch_word}" STREQUAL "")
- set(GEOS_VERSION_FULL "${GEOS_VERSION}")
-else()
- set(GEOS_VERSION_FULL "${GEOS_VERSION}${_version_patch_word}")
+if(NOT "${_version_patch_word}" STREQUAL "")
+ # Re-write VERSION variables after project()
+ set(GEOS_VERSION "${GEOS_VERSION}${_version_patch_word}")
+ set(GEOS_VERSION_PATCH "${_version_patch}${_version_patch_word}")
endif()
unset(_version_major)
@@ -136,7 +136,7 @@ unset(_version_minor)
unset(_version_patch)
unset(_version_patch_word)
-message(STATUS "GEOS: Version ${GEOS_VERSION_FULL}")
+message(STATUS "GEOS: Version ${GEOS_VERSION}")
message(STATUS "GEOS: C API Version ${CAPI_VERSION}")
message(STATUS "GEOS: JTS port ${JTS_PORT}")
@@ -348,7 +348,7 @@ if(NOT _is_multi_config_generator)
set(CPACK_PACKAGE_VERSION_MAJOR ${GEOS_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${GEOS_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${GEOS_VERSION_PATCH})
- set(CPACK_SOURCE_PACKAGE_FILE_NAME "geos-${GEOS_VERSION_FULL}")
+ set(CPACK_SOURCE_PACKAGE_FILE_NAME "geos-${GEOS_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES
"/\\\\.git"
=====================================
ChangeLog
=====================================
@@ -1,3 +1,128 @@
+2020-12-02 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * Version.txt: bump version for beta2
+
+2020-12-02 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * include/geos/index/strtree/SimpleSTRtree.h: quiet build noise
+
+2020-12-02 Mike Taves <mwtoews at gmail.com>
+
+ * CMakeLists.txt, doc/CMakeLists.txt: CMake: re-write GEOS_VERSION
+ and GEOS_VERSION_PATCH after project() This is only done if
+ GEOS_PATCH_WORD is used. Remove GEOS_VERSION_FULL. Closes #1082
+
+2020-12-01 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * src/index/kdtree/KdTree.cpp,
+ src/operation/overlayng/LineLimiter.cpp: Add <algorithm> to allow
+ GEOSwift build issues
+
+2020-12-01 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ Return WKT parsing to 3.8 model for inputs with mixed
+ dimensionality.
+
+2020-11-30 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * src/operation/buffer/BufferOp.cpp,
+ tests/unit/operation/buffer/BufferOpTest.cpp: Use SnapRoundingNoder
+ in BufferOp This avoids doing a precision reduction on the input
+ geometry. It maps more closely to the implementation in JTS. It
+ still does an increasing loop of larger tolerance, in the event of a
+ failure. This is to address the regression reported by GEOSwift
+ downstream on 3.9.0beta1
+
+2020-11-30 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * src/io/WKTReader.cpp, tests/unit/io/WKTReaderTest.cpp: Match WKT
+ reader behaviour to 3.8 For mixed dimension WKT, take the first
+ coordinate as gospel and then coerce all following coordinates into
+ that dimension. This should be updated in the next release with a
+ stricter parser (no mixed dimensions? or at least be consistent,
+ since MULTIPOINT doesn't quite follow this behaviour).
+
+2020-11-30 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * tests/xmltester/Makefile.am,
+ tests/xmltester/tests/issue/issue-geos-1046.xml: Remove duplicate
+ XML test file
+
+2020-11-30 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ Merge branch 'mwtoews-trac-1046'
+
+2020-11-30 Mike Taves <mwtoews at gmail.com>
+
+ * tests/xmltester/Makefile.am,
+ tests/xmltester/tests/issue/issue-geos-1046.xml: Validate complex
+ UnaryUnion test with OverlayNG Closes #1046
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * include/geos/index/strtree/SimpleSTRnode.h,
+ include/geos/index/strtree/SimpleSTRtree.h,
+ src/index/strtree/SimpleSTRnode.cpp,
+ src/index/strtree/SimpleSTRtree.cpp,
+ tests/unit/index/strtree/SimpleSTRtreeTest.cpp: Clean-ups that
+ hopefully will make python downstream happier
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * include/geos/index/strtree/SimpleSTRnode.h,
+ tests/unit/capi/GEOSSTRtreeTest.cpp: Allow nullptr to be a valid
+ item in the tree
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * tests/unit/capi/GEOSSTRtreeTest.cpp: Remove shadow var warning
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * tests/unit/capi/GEOSSTRtreeTest.cpp: Add another test like the
+ Python tests currently failing
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * src/index/strtree/SimpleSTRnode.cpp: Rename parameter variable
+ shadowing member var
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ Merge branch 'jorisvandenbossche-fix-setordinate-error'
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ Merge branch 'fix-setordinate-error' of
+ https://github.com/jorisvandenbossche/geos into
+ jorisvandenbossche-fix-setordinate-error
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ Merge branch 'master' of https://git.osgeo.org/gitea/geos/geos
+
+2020-11-28 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * tests/unit/capi/GEOSSTRtreeTest.cpp: Add unit test that matches
+ failure described by python community
+
+2020-11-28 Joris Van den Bossche <jorisvandenbossche at gmail.com>
+
+ * capi/geos_ts_c.cpp,
+ include/geos/geom/FixedSizeCoordinateSequence.h,
+ src/geom/CoordinateArraySequence.cpp,
+ tests/unit/capi/GEOSCoordSeqTest.cpp: Fix return error code of
+ GEOSCoordSeq_setOrdinate (closes #1078)
+
+2020-11-27 Daniel Baston <dbaston at gmail.com>
+
+ Merge branch 'dbaston/clear-assignment-warnings'
+
+2020-11-27 Paul Ramsey <pramsey at cleverelephant.ca>
+
+ * NEWS, capi/Makefile.am, configure.ac: Fixes to harmonize
+ cmake/automake builds for release
+
2020-11-27 Paul Ramsey <pramsey at cleverelephant.ca>
Merge branch 'master' of https://git.osgeo.org/gitea/geos/geos
@@ -7,6 +132,18 @@
* HOWTO_RELEASE, benchmarks/capi/Makefile.am, tools/Makefile.am:
Minor changes to fix up release
+2020-11-13 Daniel Baston <dbaston at gmail.com>
+
+ * include/geos/geom/LineSegment.h,
+ include/geos/geom/LineSegment.inl,
+ include/geos/geom/PrecisionModel.h,
+ include/geos/geom/PrecisionModel.inl, src/geom/PrecisionModel.cpp:
+ Clear warnings about deprecated assignment operator The LineSegment
+ and PrecisionModel assignment operators were implicitly declared
+ because these classes have declared destructors and/or copy
+ constructors. Since the destructors and copy constructors are not
+ needed, the warning can be removed by deleting them.
+
2020-11-28 Sandro Santilli <strk at kbt.io>
* include/geos/operation/overlayng/ElevationModel.h,
=====================================
Version.txt
=====================================
@@ -5,7 +5,7 @@ GEOS_VERSION_MINOR=9
GEOS_VERSION_PATCH=0
# OPTIONS: "", "dev", "rc1" etc.
-GEOS_PATCH_WORD=beta1
+GEOS_PATCH_WORD=beta2
# GEOS CAPI Versions
#
@@ -14,7 +14,7 @@ GEOS_PATCH_WORD=beta1
# added, removed or changed.
# Increase the age value only if the changes made to the ABI
# are backward compatible.
-CAPI_INTERFACE_CURRENT=16
+CAPI_INTERFACE_CURRENT=15
CAPI_INTERFACE_REVISION=1
CAPI_INTERFACE_AGE=15
=====================================
capi/geos_ts_c.cpp
=====================================
@@ -2164,7 +2164,7 @@ extern "C" {
GEOSCoordSeq_setOrdinate_r(GEOSContextHandle_t extHandle, CoordinateSequence* cs,
unsigned int idx, unsigned int dim, double val)
{
- return execute(extHandle, 1, [&]() {
+ return execute(extHandle, 0, [&]() {
cs->setOrdinate(idx, dim, val);
return 1;
});
=====================================
configure
=====================================
@@ -21785,5 +21785,3 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
-echo "OverlayNG: $use_overlayng"
-
=====================================
configure.ac
=====================================
@@ -426,6 +426,5 @@ AC_OUTPUT([
dnl -- echo "---------------------------------------"
dnl -- echo "Boost UTF: $use_boost_utf"
-echo "OverlayNG: $use_overlayng"
-
+dnl -- echo "OverlayNG: $use_overlayng"
dnl -- echo "---------------------------------------"
=====================================
doc/CMakeLists.txt
=====================================
@@ -29,7 +29,7 @@ if(BUILD_DOCUMENTATION)
endif()
set(srcdir ${CMAKE_CURRENT_SOURCE_DIR})
- set(VERSION ${GEOS_VERSION_FULL})
+ set(VERSION ${GEOS_VERSION})
set(DOXYGEN_LOGFILE ${CMAKE_CURRENT_BINARY_DIR}/doxygen.log)
set(CHECK_ERROR_SCRIPT "check_doxygen_errors.cmake")
configure_file(
=====================================
doc/Doxyfile
=====================================
@@ -38,7 +38,7 @@ PROJECT_NAME = GEOS
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 3.9.0beta1
+PROJECT_NUMBER = 3.9.0beta2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
=====================================
include/geos/geom/FixedSizeCoordinateSequence.h
=====================================
@@ -74,7 +74,7 @@ namespace geom {
break;
default: {
std::stringstream ss;
- ss << "Unknown ordinate index " << index;
+ ss << "Unknown ordinate index " << ordinateIndex;
throw geos::util::IllegalArgumentException(ss.str());
break;
}
=====================================
include/geos/geom/LineSegment.h
=====================================
@@ -67,15 +67,11 @@ public:
LineSegment();
- LineSegment(const LineSegment& ls);
-
/// Constructs a LineSegment with the given start and end Coordinates.
LineSegment(const Coordinate& c0, const Coordinate& c1);
LineSegment(double x0, double y0, double x1, double y1);
- virtual ~LineSegment();
-
void setCoordinates(const Coordinate& c0, const Coordinate& c1);
// obsoleted, use operator[] instead
=====================================
include/geos/geom/LineSegment.inl
=====================================
@@ -31,14 +31,6 @@
namespace geos {
namespace geom { // geos::geom
-INLINE
-LineSegment::LineSegment(const LineSegment& ls)
- :
- p0(ls.p0),
- p1(ls.p1)
-{
-}
-
INLINE
LineSegment::LineSegment(const Coordinate& c0, const Coordinate& c1)
:
@@ -60,11 +52,6 @@ LineSegment::LineSegment()
{
}
-INLINE
-LineSegment::~LineSegment()
-{
-}
-
INLINE double
LineSegment::distancePerpendicular(const Coordinate& p) const
{
=====================================
include/geos/geom/PrecisionModel.h
=====================================
@@ -157,13 +157,6 @@ public:
*/
PrecisionModel(double newScale);
- // copy constructor
- PrecisionModel(const PrecisionModel& pm);
-
- /// destructor
- ~PrecisionModel(void);
-
-
/// The maximum precise value representable in a double.
///
/// Since IEE754 double-precision numbers allow 53 bits of mantissa,
=====================================
include/geos/geom/PrecisionModel.inl
=====================================
@@ -27,12 +27,6 @@
namespace geos {
namespace geom { // geos::geom
-/*public*/
-INLINE
-PrecisionModel::~PrecisionModel(void)
-{
-}
-
/*public*/
INLINE void
PrecisionModel::makePrecise(Coordinate* coord) const
=====================================
include/geos/index/strtree/SimpleSTRnode.h
=====================================
@@ -114,7 +114,7 @@ public:
bool isLeaf() const override
{
- return item != nullptr;
+ return level == 0;
}
bool isComposite() const
=====================================
include/geos/index/strtree/SimpleSTRtree.h
=====================================
@@ -71,7 +71,6 @@ private:
std::deque<SimpleSTRnode> nodesQue;
std::vector<SimpleSTRnode*> nodes;
std::size_t nodeCapacity;
- SimpleSTRnode* root;
bool built;
/*
@@ -111,14 +110,17 @@ private:
public:
+ /* Member */
+ SimpleSTRnode* root;
+
/**
* Constructs an STRtree with the given maximum number of child nodes that
* a node may have
*/
SimpleSTRtree(std::size_t capacity = 10)
: nodeCapacity(capacity)
- , root(nullptr)
, built(false)
+ , root(nullptr)
{};
std::size_t getNodeCapacity() const {
@@ -126,7 +128,10 @@ public:
}
std::size_t getNumLeafNodes() const {
- return root->getNumLeafNodes();
+ if (!root)
+ return 0;
+ else
+ return root->getNumLeafNodes();
}
=====================================
src/geom/CoordinateArraySequence.cpp
=====================================
@@ -228,7 +228,7 @@ CoordinateArraySequence::setOrdinate(size_t index, size_t ordinateIndex,
break;
default: {
std::stringstream ss;
- ss << "Unknown ordinate index " << index;
+ ss << "Unknown ordinate index " << ordinateIndex;
throw util::IllegalArgumentException(ss.str());
break;
}
=====================================
src/geom/PrecisionModel.cpp
=====================================
@@ -135,17 +135,6 @@ PrecisionModel::PrecisionModel(double newScale)
setScale(newScale);
}
-
-PrecisionModel::PrecisionModel(const PrecisionModel& pm)
- :
- modelType(pm.modelType),
- scale(pm.scale)
-{
-#if GEOS_DEBUG
- cerr << "PrecisionModel[" << this << "] ctor(pm[" << &pm << "])" << endl;
-#endif
-}
-
/*public*/
bool
PrecisionModel::isFloating() const
=====================================
src/index/kdtree/KdTree.cpp
=====================================
@@ -16,6 +16,7 @@
#include <geos/geom/Envelope.h>
#include <vector>
+#include <algorithm>
using namespace geos::geom;
=====================================
src/index/strtree/SimpleSTRnode.cpp
=====================================
@@ -31,7 +31,7 @@ SimpleSTRnode::toString(std::ostream& os, int indentLevel) const
for (int i = 0; i < indentLevel; i++) {
os << " ";
}
- os << bounds << std::endl;
+ os << bounds << " [" << level << "]" << std::endl;
for (auto* node: childNodes) {
node->toString(os, indentLevel+1);
}
@@ -74,10 +74,10 @@ SimpleSTRnode::getNumLeafNodes() const
}
bool
-SimpleSTRnode::removeItem(void *item)
+SimpleSTRnode::removeItem(void *itemToRemove)
{
for (auto it = childNodes.begin(); it != childNodes.end(); ++it) {
- if ((*it)->getItem() == item) {
+ if ((*it)->getItem() == itemToRemove) {
childNodes.erase(it);
return true;
}
=====================================
src/index/strtree/SimpleSTRtree.cpp
=====================================
@@ -181,7 +181,7 @@ SimpleSTRtree::build()
root = nullptr;
}
else {
- std::vector<SimpleSTRnode*> nodeTree = createHigherLevels(nodes, -1);
+ std::vector<SimpleSTRnode*> nodeTree = createHigherLevels(nodes, 0);
assert(nodeTree.size()==1);
root = nodeTree[0];
}
@@ -309,20 +309,18 @@ SimpleSTRtree::remove(const geom::Envelope* searchBounds,
return found;
}
-
/*public static*/
std::ostream&
-operator<<(std::ostream& os, SimpleSTRtree& tree)
+operator<<(std::ostream& os, const SimpleSTRtree& tree)
{
os << "nodeCapacity: " << tree.getNodeCapacity() << std::endl;
os << "nodes.size(): " << tree.getNumLeafNodes() << std::endl;
os << "built: " << tree.getBuilt() << std::endl;
-
- if (tree.getRoot()) {
+ if (tree.root) {
os << "tree: " << std::endl;
- tree.getRoot()->toString(os, 1);
+ tree.root->toString(os, 1);
}
else {
os << "tree: empty" << std::endl;
=====================================
src/io/WKTReader.cpp
=====================================
@@ -78,18 +78,17 @@ WKTReader::getCoordinates(StringTokenizer* tokenizer)
Coordinate coord;
getPreciseCoordinate(tokenizer, coord, dim);
-
- std::vector<Coordinate> v;
- v.push_back(coord);
+ auto coordinates = detail::make_unique<CoordinateArraySequence>(0, dim);
+ coordinates->add(coord);
nextToken = getNextCloserOrComma(tokenizer);
while(nextToken == ",") {
getPreciseCoordinate(tokenizer, coord, dim);
- v.push_back(coord);
+ coordinates->add(coord);
nextToken = getNextCloserOrComma(tokenizer);
}
- return geometryFactory->getCoordinateSequenceFactory()->create(std::move(v), dim);
+ return std::move(coordinates);
}
=====================================
src/operation/buffer/BufferOp.cpp
=====================================
@@ -34,6 +34,7 @@
#include <geos/noding/snapround/MCIndexSnapRounder.h>
#include <geos/noding/snapround/MCIndexPointSnapper.h>
+#include <geos/noding/snapround/SnapRoundingNoder.h>
//FIXME: for temporary use, see other FIXME in file
#include <geos/algorithm/LineIntersector.h>
@@ -222,26 +223,37 @@ BufferOp::bufferReducedPrecision(int precisionDigits)
void
BufferOp::bufferFixedPrecision(const PrecisionModel& fixedPM)
{
+ PrecisionModel pm(1.0); // fixed as well
+#define SNAP_WITH_NODER
+#ifdef SNAP_WITH_NODER
+ // Reduce precision using SnapRoundingNoder
+ //
+ // This more closely aligns with JTS implementation,
+ // and avoids reducing the precision of the input
+ // geometry.
+ //
+ // TODO: Add a finer fallback sequence. Full
+ // precision, then SnappingNoder, then
+ // SnapRoundingNoder.
- PrecisionModel pm(1.0); // fixed as well
+ snapround::SnapRoundingNoder inoder(&pm);
+ ScaledNoder noder(inoder, fixedPM.getScale());
+ BufferBuilder bufBuilder(bufParams);
+ bufBuilder.setWorkingPrecisionModel(&fixedPM);
+ bufBuilder.setNoder(&noder);
+ resultGeometry = bufBuilder.buffer(argGeom, distance);
-#if 0 /* FIXME: MCIndexSnapRounder seems to be still bogus */
- snapround::MCIndexSnapRounder inoder(pm);
#else
algorithm::LineIntersector li(&fixedPM);
IntersectionAdder ia(li);
MCIndexNoder inoder(&ia);
-#endif
-
ScaledNoder noder(inoder, fixedPM.getScale());
-
BufferBuilder bufBuilder(bufParams);
bufBuilder.setWorkingPrecisionModel(&fixedPM);
-
bufBuilder.setNoder(&noder);
- // Reduce precision of the input geometry
+ // Snap by reducing the precision of the input geometry
//
// NOTE: this reduction is not in JTS and should supposedly
// not be needed because the PrecisionModel we pass
@@ -266,6 +278,7 @@ BufferOp::bufferFixedPrecision(const PrecisionModel& fixedPM)
// this may throw an exception, if robustness errors are encountered
resultGeometry = bufBuilder.buffer(workGeom, distance);
+#endif
}
} // namespace geos.operation.buffer
=====================================
src/operation/overlayng/LineLimiter.cpp
=====================================
@@ -17,6 +17,7 @@
#include <geos/geom/Envelope.h>
#include <geos/geom/Coordinate.h>
+#include <algorithm>
namespace geos { // geos
namespace operation { // geos.operation
=====================================
tests/unit/capi/GEOSCoordSeqTest.cpp
=====================================
@@ -151,9 +151,9 @@ void object::test<3>
double z = 12;
// X, Y, Z
- GEOSCoordSeq_setOrdinate(cs_, 0, 0, x);
- GEOSCoordSeq_setOrdinate(cs_, 0, 1, y);
- GEOSCoordSeq_setOrdinate(cs_, 0, 2, z);
+ ensure(0 != GEOSCoordSeq_setOrdinate(cs_, 0, 0, x));
+ ensure(0 != GEOSCoordSeq_setOrdinate(cs_, 0, 1, y));
+ ensure(0 != GEOSCoordSeq_setOrdinate(cs_, 0, 2, z));
double xcheck, ycheck, zcheck;
ensure(0 != GEOSCoordSeq_getOrdinate(cs_, 0, 1, &ycheck));
@@ -163,6 +163,9 @@ void object::test<3>
ensure_equals(xcheck, x);
ensure_equals(ycheck, y);
ensure_equals(zcheck, z);
+
+ // correct error on wrong ordinate index
+ ensure(0 == GEOSCoordSeq_setOrdinate(cs_, 0, 3, z));
}
// Test swapped setX calls (see bug #133, fixed)
=====================================
tests/unit/capi/GEOSSTRtreeTest.cpp
=====================================
@@ -62,7 +62,6 @@ struct test_capistrtree_data {
std::fprintf(stdout, "\n");
}
-
};
typedef test_group<test_capistrtree_data> group;
@@ -259,6 +258,79 @@ void object::test<7>
GEOSSTRtree_destroy(tree);
}
+// querying tree with box
+template<>
+template<>
+void object::test<8>
+()
+{
+ GEOSSTRtree* tree = GEOSSTRtree_create(10);
+
+ GEOSGeometry* g = GEOSGeomFromWKT("POINT (2 3)");
+ int payload = 876;
+ GEOSSTRtree_insert(tree, g, &payload);
+
+ GEOSGeometry* q = GEOSGeomFromWKT("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))");
+
+ typedef std::vector<int*> IList;
+ IList items;
+ ensure_equals(items.size(), 0);
+ GEOSSTRtree_query(
+ tree,
+ q,
+ [](void* item, void* userdata) {
+ IList* il = (IList*)userdata;
+ il->push_back((int*)item);
+ },
+ &items);
+
+ ensure_equals(items.size(), 1);
+
+ ensure_equals(*(items[0]), payload);
+
+ GEOSGeom_destroy(q);
+ GEOSGeom_destroy(g);
+ GEOSSTRtree_destroy(tree);
+}
+
+
+// Index a null pointer
+template<>
+template<>
+void object::test<9>
+()
+{
+ GEOSSTRtree* tree = GEOSSTRtree_create(10);
+
+ GEOSGeometry* g = GEOSGeomFromWKT("POINT (2 3)");
+ GEOSSTRtree_insert(tree, g, (void*)0);
+
+ GEOSGeometry* q = GEOSGeomFromWKT("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))");
+
+ typedef std::vector<int*> IList;
+ IList items;
+ ensure_equals(items.size(), 0);
+ GEOSSTRtree_query(
+ tree,
+ q,
+ [](void* item, void* userdata) {
+ IList* il = (IList*)userdata;
+ il->push_back((int*)item);
+ },
+ &items);
+
+ ensure_equals(items.size(), 1);
+
+ ensure_equals(items[0], (void*)0);
+
+ GEOSGeom_destroy(q);
+ GEOSGeom_destroy(g);
+ GEOSSTRtree_destroy(tree);
+}
+
+
+
+
} // namespace tut
=====================================
tests/unit/index/strtree/SimpleSTRtreeTest.cpp
=====================================
@@ -8,6 +8,7 @@
#include <geos/index/ItemVisitor.h>
#include <geos/io/WKTReader.h>
+#include <iostream>
using namespace geos;
@@ -42,14 +43,14 @@ void object::test<1>
}
}
- // std::cout << t << std::endl;
-
geom::Envelope qe(-0.5, 1.5, -0.5, 1.5);
std::vector<void*> matches;
t.query(&qe, matches);
// std::cout << matches.size() << std::endl;
ensure(matches.size() == 4);
+ // std::cout << t << std::endl;
+
class SimpleTestVisitor: public index::ItemVisitor {
public:
std::size_t count;
@@ -140,6 +141,8 @@ void object::test<3>
ensure(leaf_before = 4u);
ensure(all_before = 5u);
+ // std::cout << t << std::endl;
+
t.remove(geoms[3]->getEnvelopeInternal(), geoms[3].get());
std::size_t leaf_after = t.getRoot()->getNumLeafNodes();
=====================================
tests/unit/io/WKTReaderTest.cpp
=====================================
@@ -219,4 +219,39 @@ void object::test<9>
}
+// Handle WKT with mixed dimensionality in
+// coordinate sequence. This is the old behaviour, wherein
+// the first coordinate of a coordinate sequence dictates the
+// dimensionality of the following coordinates. This ignores
+// dimensionality tags (Z/M). It also has strange behaviour
+// in the multipoint case, but we leave this unchanged for now
+// as this test is being written just prior to 3.9 release.
+template<>
+template<>
+void object::test<10>
+()
+{
+ GeomPtr geom;
+ geom = wktreader.read("MULTIPOINT (1 1, 2 2)");
+ ensure("dimension(MULTIPOINT (1 1, 2 2)) == 2", geom->getCoordinateDimension() == 2);
+
+ geom = wktreader.read("LINESTRING (1 1, 2 2)");
+ ensure("dimension(LINESTRING (1 1, 2 2)) == 2", geom->getCoordinateDimension() == 2);
+
+ geom = wktreader.read("MULTIPOINT (1 1 1, 2 2)");
+ ensure("dimension(MULTIPOINT (1 1 1, 2 2)) == 3", geom->getCoordinateDimension() == 3);
+
+ geom = wktreader.read("MULTIPOINT (1 1, 2 2 2)");
+ ensure("dimension(MULTIPOINT (1 1, 2 2 2)) == 3", geom->getCoordinateDimension() == 3);
+
+ geom = wktreader.read("LINESTRING (1 1 1, 2 2)");
+ ensure("dimension(LINESTRING (1 1 1, 2 2)) == 3", geom->getCoordinateDimension() == 3);
+
+ geom = wktreader.read("LINESTRING (1 1, 2 2 2)");
+ ensure("dimension(LINESTRING (1 1, 2 2 2)) == 2", geom->getCoordinateDimension() == 2);
+
+ geom = wktreader.read("POLYGON ((0 0, 1 0, 1 1 1, 0 1, 0 0))");
+ ensure("dimension(POLYGON ((0 0, 1 0, 1 1 1, 0 1, 0 0)) == 2", geom->getCoordinateDimension() == 2);
+}
+
} // namespace tut
=====================================
tests/unit/operation/buffer/BufferOpTest.cpp
=====================================
@@ -12,6 +12,7 @@
#include <geos/geom/Geometry.h>
#include <geos/algorithm/PointLocator.h>
#include <geos/io/WKTReader.h>
+#include <geos/io/WKTWriter.h>
#include <geos/geom/CoordinateSequence.h>
// std
#include <memory>
@@ -27,6 +28,7 @@ namespace tut {
struct test_bufferop_data {
const geos::geom::GeometryFactory& gf;
geos::io::WKTReader wktreader;
+ geos::io::WKTWriter wktwriter;
int const default_quadrant_segments;
typedef geos::geom::Geometry::Ptr GeomPtr;
@@ -363,7 +365,7 @@ MULTILINESTRING( \
// We're basically only interested an rough sense of a
// meaningful result.
- ensure_equals(gBuffer->getNumPoints(), std::size_t(47));
+ ensure_equals(gBuffer->getNumPoints(), std::size_t(46));
ensure_equals(int(gBuffer->getArea()), 3520);
}
@@ -421,5 +423,29 @@ void object::test<13>
ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_POLYGON);
}
+// Test for GEOSwift regression failure
+template<>
+template<>
+void object::test<14>
+()
+{
+ using geos::operation::buffer::BufferOp;
+ using geos::operation::buffer::BufferParameters;
+
+ std::string wkt0("GEOMETRYCOLLECTION (POINT (1 2), MULTIPOINT ((1 2), (3 4)), LINESTRING (1 2, 3 4), MULTILINESTRING ((1 2, 3 4), (5 6, 7 8)), POLYGON ((2 2, -2 2, -2 -2, 2 -2, 2 2), (1 1, 1 -1, -1 -1, -1 1, 1 1)), MULTIPOLYGON (((2 2, -2 2, -2 -2, 2 -2, 2 2), (1 1, 1 -1, -1 -1, -1 1, 1 1)), ((7 2, 3 2, 3 -2, 7 -2, 7 2))))");
+
+ GeomPtr g0(wktreader.read(wkt0));
+ BufferOp op(g0.get());
+
+ double const distance = 0.5;
+ GeomPtr gBuffer(op.getResultGeometry(distance));
+
+ // std::cout << wktwriter.write(gBuffer.get()) << std::endl;
+
+ ensure_not(gBuffer->isEmpty());
+ ensure(gBuffer->isValid());
+ ensure_equals(gBuffer->getGeometryTypeId(), geos::geom::GEOS_MULTIPOLYGON);
+}
+
} // namespace tut
View it on GitLab: https://salsa.debian.org/debian-gis-team/geos/-/commit/a513a481d9bd3d7d60545bddd933b4690d0e3f6c
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/geos/-/commit/a513a481d9bd3d7d60545bddd933b4690d0e3f6c
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20201203/7c5737cf/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list