Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 19, 2021
1 parent b15c520 commit 4ba46b8
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -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+);" );
Expand All @@ -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 )
Expand Down

0 comments on commit 4ba46b8

Please sign in to comment.