File tree 3 files changed +13
-6
lines changed
3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -6296,12 +6296,13 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
6296
6296
// convert geometry to match destination layer
6297
6297
QGis::GeometryType destType = pasteVectorLayer->geometryType();
6298
6298
bool destIsMulti = QGis::isMultiType( pasteVectorLayer->wkbType() );
6299
- if ( pasteVectorLayer->storageType() == "ESRI Shapefile" && destType != QGis::Point )
6299
+ if ( pasteVectorLayer->dataProvider() &&
6300
+ !pasteVectorLayer->dataProvider()->doesStrictFeatureTypeCheck() )
6300
6301
{
6301
- // force destination to multi if shapefile if it's not a point file
6302
- // Should we really force anything here? Isn't it better to just transform?
6302
+ // force destination to multi if provider doesn't do a feature strict check
6303
6303
destIsMulti = true;
6304
6304
}
6305
+
6305
6306
if ( destType != QGis::UnknownGeometry )
6306
6307
{
6307
6308
QgsGeometry* newGeometry = featureIt->constGeometry()->convertToType( destType, destIsMulti );
Original file line number Diff line number Diff line change @@ -2530,6 +2530,12 @@ void QgsOgrProvider::recalculateFeatureCount()
2530
2530
QgsOgrConnPool::instance ()->invalidateConnections ( filePath () );
2531
2531
}
2532
2532
2533
+ bool QgsOgrProvider::doesStrictFeatureTypeCheck () const
2534
+ {
2535
+ // FIXME probably other drivers too...
2536
+ return ogrDriverName != " ESRI Shapefile" || geomType == wkbPoint;
2537
+ }
2538
+
2533
2539
OGRwkbGeometryType QgsOgrProvider::ogrWkbSingleFlatten ( OGRwkbGeometryType type )
2534
2540
{
2535
2541
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