Skip to content

Commit 81a9593

Browse files
author
mhugent
committed
Remove the error dialog if using the add feature tool on 25d shapefiles
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13122 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e8517af commit 81a9593

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/app/qgsmaptooladdfeature.cpp

+6-15
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
5454

5555
QGis::WkbType layerWKBType = vlayer->wkbType();
5656

57-
//no support for adding features to 2.5D types yet
58-
if ( layerWKBType == QGis::WKBLineString25D || layerWKBType == QGis::WKBPolygon25D ||
59-
layerWKBType == QGis::WKBMultiLineString25D || layerWKBType == QGis::WKBPoint25D || layerWKBType == QGis::WKBMultiPoint25D )
60-
{
61-
QMessageBox::critical( 0, tr( "2.5D shape type not supported" ), tr( "Adding features to 2.5D shapetypes is not supported yet" ) );
62-
stopCapturing();
63-
return;
64-
}
65-
6657
QgsVectorDataProvider* provider = vlayer->dataProvider();
6758

6859
if ( !( provider->capabilities() & QgsVectorDataProvider::AddFeatures ) )
@@ -131,7 +122,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
131122
double x = savePoint.x();
132123
double y = savePoint.y();
133124

134-
if ( layerWKBType == QGis::WKBPoint )
125+
if ( layerWKBType == QGis::WKBPoint || layerWKBType == QGis::WKBPoint25D )
135126
{
136127
size = 1 + sizeof( int ) + 2 * sizeof( double );
137128
wkb = new unsigned char[size];
@@ -141,7 +132,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
141132
memcpy( &wkb[5], &x, sizeof( double ) );
142133
memcpy( &wkb[5] + sizeof( double ), &y, sizeof( double ) );
143134
}
144-
else if ( layerWKBType == QGis::WKBMultiPoint )
135+
else if ( layerWKBType == QGis::WKBMultiPoint || layerWKBType == QGis::WKBMultiPoint25D )
145136
{
146137
size = 2 + 3 * sizeof( int ) + 2 * sizeof( double );
147138
wkb = new unsigned char[size];
@@ -268,7 +259,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
268259

269260
if ( mode() == CaptureLine )
270261
{
271-
if ( layerWKBType == QGis::WKBLineString )
262+
if ( layerWKBType == QGis::WKBLineString || layerWKBType == QGis::WKBLineString25D )
272263
{
273264
wkbsize = 1 + 2 * sizeof( int ) + 2 * size() * sizeof( double );
274265
wkb = new unsigned char[wkbsize];
@@ -292,7 +283,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
292283
position += sizeof( double );
293284
}
294285
}
295-
else if ( layerWKBType == QGis::WKBMultiLineString )
286+
else if ( layerWKBType == QGis::WKBMultiLineString || layerWKBType == QGis::WKBMultiLineString25D )
296287
{
297288
wkbsize = 1 + 2 * sizeof( int ) + 1 + 2 * sizeof( int ) + 2 * size() * sizeof( double );
298289
wkb = new unsigned char[wkbsize];
@@ -337,7 +328,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
337328
}
338329
else // polygon
339330
{
340-
if ( layerWKBType == QGis::WKBPolygon )
331+
if ( layerWKBType == QGis::WKBPolygon || layerWKBType == QGis::WKBPolygon25D )
341332
{
342333
wkbsize = 1 + 3 * sizeof( int ) + 2 * ( size() + 1 ) * sizeof( double );
343334
wkb = new unsigned char[wkbsize];
@@ -374,7 +365,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
374365

375366
memcpy( &wkb[position], &y, sizeof( double ) );
376367
}
377-
else if ( layerWKBType == QGis::WKBMultiPolygon )
368+
else if ( layerWKBType == QGis::WKBMultiPolygon || layerWKBType == QGis::WKBMultiPolygon25D )
378369
{
379370
wkbsize = 2 + 5 * sizeof( int ) + 2 * ( size() + 1 ) * sizeof( double );
380371
wkb = new unsigned char[wkbsize];

0 commit comments

Comments
 (0)