Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add debugging method
- Loading branch information
Showing
with
34 additions
and
0 deletions.
-
+29
−0
src/core/pal/pointset.cpp
-
+5
−0
src/core/pal/pointset.h
|
@@ -1041,3 +1041,32 @@ bool PointSet::isClosed() const |
|
|
{ |
|
|
return qgsDoubleNear( x[0], x[nbPoints - 1] ) && qgsDoubleNear( y[0], y[nbPoints - 1] ); |
|
|
} |
|
|
|
|
|
QString PointSet::toWkt() const |
|
|
{ |
|
|
if ( !mGeos ) |
|
|
createGeosGeom(); |
|
|
|
|
|
GEOSContextHandle_t geosctxt = QgsGeos::getGEOSHandler(); |
|
|
|
|
|
try |
|
|
{ |
|
|
GEOSWKTWriter *writer = GEOSWKTWriter_create_r( geosctxt ); |
|
|
|
|
|
char *wkt = GEOSWKTWriter_write_r( geosctxt, writer, mGeos ); |
|
|
const QString res( wkt ); |
|
|
|
|
|
GEOSFree_r( geosctxt, wkt ); |
|
|
|
|
|
GEOSWKTWriter_destroy_r( geosctxt, writer ); |
|
|
writer = nullptr; |
|
|
|
|
|
return res; |
|
|
} |
|
|
catch ( GEOSException &e ) |
|
|
{ |
|
|
qWarning( "GEOS exception: %s", e.what() ); |
|
|
QgsMessageLog::logMessage( QObject::tr( "Exception: %1" ).arg( e.what() ), QObject::tr( "GEOS" ) ); |
|
|
return QString(); |
|
|
} |
|
|
} |
|
@@ -200,6 +200,11 @@ namespace pal |
|
|
*/ |
|
|
bool isClosed() const; |
|
|
|
|
|
/** |
|
|
* Returns a WKT representation of the point set. |
|
|
*/ |
|
|
QString toWkt() const; |
|
|
|
|
|
int nbPoints; |
|
|
std::vector< double > x; |
|
|
std::vector< double > y; // points order is counterclockwise |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.