Skip to content
Permalink
Browse files
simplify code
  • Loading branch information
m-kuhn committed Nov 19, 2021
1 parent b15c520 commit 4ba46b868dae9bc2f02b2572ee5b33e0fbe404cd
Showing with 4 additions and 11 deletions.
  1. +4 −11 src/providers/postgres/qgspostgresprovider.cpp
@@ -354,12 +354,6 @@ void QgsPostgresProvider::setTransaction( QgsTransaction *transaction )
mTransaction = static_cast<QgsPostgresTransaction *>( transaction );
}

struct Ewkt
{
int srid = -1;
QString wkt;
};

QgsReferencedGeometry QgsPostgresProvider::fromEwkt( const QString &ewkt, QgsPostgresConn *conn )
{
thread_local const QRegularExpression regularExpressionSRID( "^SRID=(\\d+);" );
@@ -368,13 +362,12 @@ QgsReferencedGeometry QgsPostgresProvider::fromEwkt( const QString &ewkt, QgsPos
if ( !regularExpressionMatch.hasMatch() )
return QgsReferencedGeometry();

Ewkt ewktInfo;
ewktInfo.wkt = ewkt.mid( regularExpressionMatch.captured( 0 ).size() );
ewktInfo.srid = regularExpressionMatch.captured( 1 ).toInt();
QString wkt = ewkt.mid( regularExpressionMatch.captured( 0 ).size() );
int srid = regularExpressionMatch.captured( 1 ).toInt();


QgsGeometry geom = QgsGeometry::fromWkt( ewktInfo.wkt );
return QgsReferencedGeometry( geom, sridToCrs( ewktInfo.srid, conn ) );
QgsGeometry geom = QgsGeometry::fromWkt( wkt );
return QgsReferencedGeometry( geom, sridToCrs( srid, conn ) );
}

QString QgsPostgresProvider::toEwkt( const QgsReferencedGeometry &geom, QgsPostgresConn *conn )

0 comments on commit 4ba46b8

Please sign in to comment.