Skip to content
Permalink
Browse files

use QgsWkbTypes methods to simplify code

  • Loading branch information
alexbruy committed Oct 5, 2016
1 parent 5b67d2a commit 33644efeba3275843ee6507562fab405d091ad32
Showing with 2 additions and 75 deletions.
  1. +2 −75 src/providers/memory/qgsmemoryprovider.cpp
@@ -47,35 +47,7 @@ QgsMemoryProvider::QgsMemoryProvider( const QString& uri )
geometry = url.path();
}

geometry = geometry.toLower();
if ( geometry == "point" )
mWkbType = QgsWkbTypes::Point;
else if ( geometry == "linestring" )
mWkbType = QgsWkbTypes::LineString;
else if ( geometry == "polygon" )
mWkbType = QgsWkbTypes::Polygon;
else if ( geometry == "multipoint" )
mWkbType = QgsWkbTypes::MultiPoint;
else if ( geometry == "multilinestring" )
mWkbType = QgsWkbTypes::MultiLineString;
else if ( geometry == "multipolygon" )
mWkbType = QgsWkbTypes::MultiPolygon;
else if ( geometry == "point25d" )
mWkbType = QgsWkbTypes::Point25D;
else if ( geometry == "linestring25d" )
mWkbType = QgsWkbTypes::LineString25D;
else if ( geometry == "polygon25d" )
mWkbType = QgsWkbTypes::Polygon25D;
else if ( geometry == "multipoint25d" )
mWkbType = QgsWkbTypes::MultiPoint25D;
else if ( geometry == "multilinestring25d" )
mWkbType = QgsWkbTypes::MultiLineString25D;
else if ( geometry == "multipolygon25d" )
mWkbType = QgsWkbTypes::MultiPolygon25D;
else if ( geometry == "none" )
mWkbType = QgsWkbTypes::NoGeometry;
else
mWkbType = QgsWkbTypes::Unknown;
mWkbType = QgsWkbTypes::parseType( geometry );

if ( url.hasQueryItem( "crs" ) )
{
@@ -220,52 +192,7 @@ QString QgsMemoryProvider::dataSourceUri( bool expandAuthConfig ) const
Q_UNUSED( expandAuthConfig )

QUrl uri( "memory" );
QString geometry;
switch ( mWkbType )
{
case QgsWkbTypes::Point :
geometry = "Point";
break;
case QgsWkbTypes::LineString :
geometry = "LineString";
break;
case QgsWkbTypes::Polygon :
geometry = "Polygon";
break;
case QgsWkbTypes::MultiPoint :
geometry = "MultiPoint";
break;
case QgsWkbTypes::MultiLineString :
geometry = "MultiLineString";
break;
case QgsWkbTypes::MultiPolygon :
geometry = "MultiPolygon";
break;
case QgsWkbTypes::Point25D :
geometry = "Point25D";
break;
case QgsWkbTypes::LineString25D :
geometry = "LineString25D";
break;
case QgsWkbTypes::Polygon25D :
geometry = "Polygon25D";
break;
case QgsWkbTypes::MultiPoint25D :
geometry = "MultiPoint25D";
break;
case QgsWkbTypes::MultiLineString25D :
geometry = "MultiLineString25D";
break;
case QgsWkbTypes::MultiPolygon25D :
geometry = "MultiPolygon25D";
break;
case QgsWkbTypes::NoGeometry :
geometry = "None";
break;
default:
geometry = "";
break;
}
QString geometry = QgsWkbTypes::displayString( mWkbType );
uri.addQueryItem( "geometry", geometry );

if ( mCrs.isValid() )

0 comments on commit 33644ef

Please sign in to comment.
You can’t perform that action at this time.