[geos-commits] [SCM] GEOS branch master updated. 6c8ed469f0475d36a68c15912c170e55d2c3ac02
git at osgeo.org
git at osgeo.org
Tue Feb 23 16:48:25 PST 2021
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 6c8ed469f0475d36a68c15912c170e55d2c3ac02 (commit)
from 0738016155bba63fb456e31c952522e6d3140441 (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 6c8ed469f0475d36a68c15912c170e55d2c3ac02
Author: Martin Davis <mtnclimb at gmail.com>
Date: Tue Feb 23 16:48:18 2021 -0800
Fix geosop compile warnings
diff --git a/util/geosop/GeomFunction.cpp b/util/geosop/GeomFunction.cpp
index 5493792..b63f8e2 100644
--- a/util/geosop/GeomFunction.cpp
+++ b/util/geosop/GeomFunction.cpp
@@ -74,39 +74,48 @@ GeomFunction::init()
{
add("area",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->getArea() );
});
add("boundary",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->getBoundary() );
});
add("buffer", "computes the buffer of geometry A to a distance", 1, 1,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; // prevent unused variable warning
return new Result( geom->buffer( d ) );
});
add("centroid",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->getCentroid() );
});
add("copy",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->clone() );
});
add("convexHull",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->convexHull() );
});
add("contains", "tests if geometry A contains geometry B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->contains( geomB.get() ) );
});
add("covers", "tests if geometry A covers geometry B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->covers( geomB.get() ) );
});
add("densify", "densifies geometry A to a distance ", 1, 1,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)geomB; // prevent unused variable warning
geom::util::Densifier densifier( geom.get() );
densifier.setDistanceTolerance( d );
return new Result( densifier.getResultGeometry() );
@@ -114,57 +123,68 @@ GeomFunction::init()
add("distance", "computes distance between geometry A and B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->distance( geomB.get() ) );
});
add("envelope",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->getCentroid() );
});
add("interiorPoint",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->getInteriorPoint() );
});
add("intersects", "tests if geometry A and B intersect", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->intersects( geomB.get() ) );
});
add("isEmpty", "tests if geometry A is empty", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->isEmpty() );
});
add("isSimple", "tests if geometry A is simple", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->isSimple() );
});
add("isValid", "tests if geometry A is valid", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->isValid() );
});
add("length",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->getLength() );
});
add("makeValid",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geos::operation::valid::MakeValid().build( geom.get() ) );
});
add("maxInscribedCircle", "computes maximum inscribed circle radius of Polygon A up to a distance tolerance", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
geos::algorithm::construct::MaximumInscribedCircle mc( geom.get(), d );
std::unique_ptr<Geometry> res = mc.getRadiusLine();
return new Result( std::move(res) );
});
add("minBoundingCircle",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
geos::algorithm::MinimumBoundingCircle mc( geom.get() );
std::unique_ptr<Geometry> res = mc.getCircle();
return new Result( std::move(res) );
@@ -172,6 +192,7 @@ GeomFunction::init()
add("nearestPoints", "computes a line containing the nearest points of geometry A and B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
std::unique_ptr<CoordinateSequence> cs = geos::operation::distance::DistanceOp::nearestPoints(geom.get(), geomB.get());
auto factory = geom->getFactory();
auto res = factory->createLineString( std::move(cs) );
@@ -179,6 +200,7 @@ GeomFunction::init()
});
add("normalize", "normalizes geometry A", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
auto res = geom->clone();
res->normalize();
return new Result( std::move(res) );
@@ -186,6 +208,7 @@ GeomFunction::init()
add("lineMerge", "merges the lines of geometry A", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
geos::operation::linemerge::LineMerger lmrgr;
lmrgr.add(geom.get());
@@ -200,6 +223,7 @@ GeomFunction::init()
add("delaunay", "computes the Delaunay Triangulation of geometry A vertices", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
geos::triangulate::DelaunayTriangulationBuilder builder;
builder.setTolerance(0);
builder.setSites( *geom );
@@ -215,6 +239,7 @@ GeomFunction::init()
add("voronoi", "computes the Voronoi Diagram of geometry A vertices", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
geos::triangulate::VoronoiDiagramBuilder builder;
builder.setTolerance(0);
builder.setSites( *geom );
@@ -230,6 +255,7 @@ GeomFunction::init()
add("polygonize",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
geos::operation::polygonize::Polygonizer p;
p.add(geom.get());
@@ -243,51 +269,62 @@ GeomFunction::init()
add("reducePrecision", "reduces precision of geometry to a precision scale factor", 1, 1,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)geomB; // prevent unused variable warning
PrecisionModel pm(d);
return new Result( geos::precision::GeometryPrecisionReducer::reduce( *geom, pm ) );
});
add("relate", "computes DE-9IM matrix for geometry A and B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
std::unique_ptr<geom::IntersectionMatrix> im(geom->relate( geomB.get() ));
return new Result( im->toString() );
});
add("reverse", "reverses geometry A", 1, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void) geomB; (void)d; // prevent unused variable warning
return new Result( geom->reverse() );
});
add("simplifyDP", "simplifies geometry A using Douglas-Peucker with a distance tolerance", 1, 1,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)geomB; // prevent unused variable warning
return new Result( geos::simplify::DouglasPeuckerSimplifier::simplify(geom.get(), d) );
});
add("simplifyTP", "simplifies geometry A using Douglas-Peucker with a distance tolerance, preserving topology", 1, 1,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)geomB; // prevent unused variable warning
return new Result( geos::simplify::TopologyPreservingSimplifier::simplify(geom.get(), d) );
});
add("containsPrep", "tests if geometry A contains geometry B, using PreparedGeometry", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( prepGeomCache.get(geom.get())->contains( geomB.get() ) );
});
add("containsProperlyPrep", "tests if geometry A properly contains geometry B using PreparedGeometry", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( prepGeomCache.get(geom.get())->containsProperly( geomB.get() ) );
});
add("coversPrep", "tests if geometry A covers geometry B using PreparedGeometry", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( prepGeomCache.get(geom.get())->covers( geomB.get() ) );
});
add("intersectsPrep", "tests if geometry A intersects B using PreparedGeometry", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( prepGeomCache.get(geom.get())->intersects( geomB.get() ) );
});
add("distancePrep", "computes distance between geometry A and B using PreparedGeometry", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( prepGeomCache.get(geom.get())->distance( geomB.get() ) );
});
add("nearestPointsPrep", "computes a line containing the nearest points of geometry A and B using PreparedGeometry", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
auto cs = prepGeomCache.get(geom.get())->nearestPoints( geomB.get() );
auto factory = geom->getFactory();
auto res = factory->createLineString( std::move(cs) );
@@ -298,22 +335,27 @@ GeomFunction::init()
add("difference", "computes difference of geometry A from B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->difference( geomB.get() ) );
});
add("intersection", "computes intersection of geometry A and B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->intersection( geomB.get() ) );
});
add("symDifference", "computes symmetric difference of geometry A and B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->symDifference( geomB.get() ) );
});
add("unaryUnion",
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)geomB; (void)d; // prevent unused variable warning
return new Result( geom->Union() );
});
add("union", "computes union of geometry A and B", 2, 0,
[](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+ (void)d; // prevent unused variable warning
return new Result( geom->Union( geomB.get() ) );
});
diff --git a/util/geosop/GeosOp.cpp b/util/geosop/GeosOp.cpp
index bbeb4c4..fcefbbf 100644
--- a/util/geosop/GeosOp.cpp
+++ b/util/geosop/GeosOp.cpp
@@ -143,10 +143,10 @@ GeosOp::GeosOp(GeosOpArgs& arg)
GeosOp::~GeosOp() {
}
-std::string formatNum(int n)
+std::string formatNum(long n)
{
auto fmt = std::to_string(n);
- int insertPosition = static_cast<int>(fmt.length()) - 3;
+ size_t insertPosition = fmt.length() - 3;
while (insertPosition > 0) {
fmt.insert(insertPosition, ",");
insertPosition-=3;
@@ -167,7 +167,7 @@ bool isWKTLiteral(std::string s) {
if (endsWith(s, " EMPTY")) return true;
// assume if string contains a ( it is WKT
- int numLParen = std::count(s.begin(), s.end(), '(');
+ long numLParen = std::count(s.begin(), s.end(), '(');
return numLParen > 0;
}
@@ -293,7 +293,7 @@ GeosOp::loadInput(std::string name, std::string src, int limit) {
auto geoms = readInput( name, src, limit );
sw.stop();
auto stats = summaryStats(geoms);
- log("Read " + stats + " -- " + formatNum( sw.getTot() ) + " usec");
+ log("Read " + stats + " -- " + formatNum( (long) sw.getTot() ) + " usec");
return geoms;
}
@@ -321,7 +321,7 @@ void GeosOp::run() {
std::cout
<< "Ran " << formatNum( opCount ) << " " << args.opName << " ops ( "
<< formatNum( vertexCount ) << " vertices)"
- << " -- " << formatNum( totalTime ) << " usec"
+ << " -- " << formatNum( (long) totalTime ) << " usec"
<< " (GEOS " << geosversion() << ")"
<< std::endl;
}
@@ -372,7 +372,7 @@ void GeosOp::executeBinary(GeomFunction * fun) {
}
}
-std::string inputDesc(std::string name, int index, const std::unique_ptr<Geometry>& geom)
+std::string inputDesc(std::string name, unsigned int index, const std::unique_ptr<Geometry>& geom)
{
if (geom == nullptr) {
return "";
@@ -383,29 +383,29 @@ std::string inputDesc(std::string name, int index, const std::unique_ptr<Geometr
}
Result* GeosOp::executeOpRepeat(GeomFunction * fun,
- int indexA,
- const std::unique_ptr<Geometry>& geomA,
- int indexB,
- const std::unique_ptr<Geometry>& geomB)
+ unsigned int indexA,
+ const std::unique_ptr<Geometry>& gA,
+ unsigned int indexB,
+ const std::unique_ptr<Geometry>& gB)
{
Result * res;
for (int i = 0; i < args.repeatNum; i++) {
- res = executeOp(fun, indexA, geomA, indexB, geomB);
+ res = executeOp(fun, indexA, gA, indexB, gB);
}
return res;
}
Result* GeosOp::executeOp(GeomFunction * fun,
- int indexA,
- const std::unique_ptr<Geometry>& geomA,
- int indexB,
- const std::unique_ptr<Geometry>& geomB) {
+ unsigned int indexA,
+ const std::unique_ptr<Geometry>& gA,
+ unsigned int indexB,
+ const std::unique_ptr<Geometry>& gB) {
opCount++;
geos::util::Profile sw( "op" );
sw.start();
- Result* result = fun->execute( geomA, geomB, args.opArg1 );
+ Result* result = fun->execute( gA, gB, args.opArg1 );
sw.stop();
double time = sw.getTot();
totalTime += time;
@@ -414,10 +414,10 @@ Result* GeosOp::executeOp(GeomFunction * fun,
if (args.isVerbose) {
log(
"[ " + std::to_string(opCount) + "] " + fun->name() + ": "
- + inputDesc("A", indexA, geomA) + " "
- + inputDesc("B", indexB, geomB)
+ + inputDesc("A", indexA, gA) + " "
+ + inputDesc("B", indexB, gB)
+ " -> " + result->metadata()
- + " -- " + formatNum( time ) + " usec"
+ + " -- " + formatNum( (int) time ) + " usec"
);
}
diff --git a/util/geosop/GeosOp.h b/util/geosop/GeosOp.h
index df8d2f9..1aea4fa 100644
--- a/util/geosop/GeosOp.h
+++ b/util/geosop/GeosOp.h
@@ -75,11 +75,11 @@ private:
void executeUnary(GeomFunction * fun);
void executeBinary(GeomFunction * fun);
Result* executeOpRepeat(GeomFunction * fun,
- int indexA, const std::unique_ptr<Geometry>& geomA,
- int indexB, const std::unique_ptr<Geometry>& geomB);
+ unsigned int indexA, const std::unique_ptr<Geometry>& geomA,
+ unsigned int indexB, const std::unique_ptr<Geometry>& geomB);
Result* executeOp(GeomFunction * fun,
- int indexA, const std::unique_ptr<Geometry>& geomA,
- int indexB, const std::unique_ptr<Geometry>& geomB);
+ unsigned int indexA, const std::unique_ptr<Geometry>& geomA,
+ unsigned int indexB, const std::unique_ptr<Geometry>& geomB);
void output(Result* result);
void outputExplode(std::unique_ptr<Geometry>& geom);
void outputGeometry( const Geometry* geom);
-----------------------------------------------------------------------
Summary of changes:
util/geosop/GeomFunction.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
util/geosop/GeosOp.cpp | 38 +++++++++++++++++++-------------------
util/geosop/GeosOp.h | 8 ++++----
3 files changed, 65 insertions(+), 23 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list