File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -6208,12 +6208,13 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
6208
6208
// convert geometry to match destination layer
6209
6209
QGis::GeometryType destType = pasteVectorLayer->geometryType();
6210
6210
bool destIsMulti = QGis::isMultiType( pasteVectorLayer->wkbType() );
6211
- if ( pasteVectorLayer->storageType() == "ESRI Shapefile" && destType != QGis::Point )
6211
+ if ( pasteVectorLayer->dataProvider() &&
6212
+ !pasteVectorLayer->dataProvider()->doesStrictFeatureTypeCheck() )
6212
6213
{
6213
- // force destination to multi if shapefile if it's not a point file
6214
- // Should we really force anything here? Isn't it better to just transform?
6214
+ // force destination to multi if provider doesn't do a feature strict check
6215
6215
destIsMulti = true;
6216
6216
}
6217
+
6217
6218
if ( destType != QGis::UnknownGeometry )
6218
6219
{
6219
6220
QgsGeometry* newGeometry = featureIt->geometry()->convertToType( destType, destIsMulti );
Original file line number Diff line number Diff line change @@ -2526,6 +2526,12 @@ void QgsOgrProvider::recalculateFeatureCount()
2526
2526
}
2527
2527
}
2528
2528
2529
+ bool QgsOgrProvider::doesStrictFeatureTypeCheck () const
2530
+ {
2531
+ // FIXME probably other drivers too...
2532
+ return ogrDriverName != " ESRI Shapefile" || geomType == wkbPoint;
2533
+ }
2534
+
2529
2535
OGRwkbGeometryType QgsOgrProvider::ogrWkbSingleFlatten ( OGRwkbGeometryType type )
2530
2536
{
2531
2537
type = wkbFlatten ( type );
Original file line number Diff line number Diff line change @@ -243,9 +243,9 @@ class QgsOgrProvider : public QgsVectorDataProvider
243
243
QString description () const override ;
244
244
245
245
/* * Returns true if the provider is strict about the type of inserted features
246
- (e.g. no multipolygon in a polygon layer)
247
- */
248
- virtual bool doesStrictFeatureTypeCheck () const override { return false ;}
246
+ (e.g. no multipolygon in a polygon layer)
247
+ */
248
+ virtual bool doesStrictFeatureTypeCheck () const override ;
249
249
250
250
/* * return OGR geometry type */
251
251
static OGRwkbGeometryType getOgrGeomType ( OGRLayerH ogrLayer );
You can’t perform that action at this time.
0 commit comments