Skip to content

Commit

Permalink
Fix #10747 - Don't force multi type on point features
Browse files Browse the repository at this point in the history
Ref #10672 - Commited fix to force multitypes on shapefiles
  • Loading branch information
NathanW2 committed Sep 28, 2014
1 parent 4de0d83 commit a8ce356
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5965,9 +5965,10 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )
// convert geometry to match destination layer
QGis::GeometryType destType = pasteVectorLayer->geometryType();
bool destIsMulti = QGis::isMultiType( pasteVectorLayer->wkbType() );
if ( pasteVectorLayer->storageType() == "ESRI Shapefile" )
if ( pasteVectorLayer->storageType() == "ESRI Shapefile" && destType != QGis::Point)
{
// force destination to multi if shapefile
// force destination to multi if shapefile if it's not a point file
// Should we really force anything here? Isn't it better to just transform?
destIsMulti = true;
}
if ( destType != QGis::UnknownGeometry )
Expand Down

5 comments on commit a8ce356

@3nids
Copy link
Member

@3nids 3nids commented on a8ce356 Sep 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that you never know with shapefiles if they are multi or not, hence the idea of forcing multi.
Or do you have another idea how to handle this?

(backport to 2.4?)

@NathanW2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So destIsMulti is not right with shapefiles?

Forcing multi-type break copy and paste for point files so I don't think we should force it here.

@3nids
Copy link
Member

@3nids 3nids commented on a8ce356 Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, your fix seems perfect to me.

@pcav
Copy link
Member

@pcav pcav commented on a8ce356 Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the default shouold be POINT, not MULTIPOINT, used only in very specialized cases. Multipoints are really a PITA, almost always.

@3nids
Copy link
Member

@3nids 3nids commented on a8ce356 Sep 29, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for any other sources than shapefiles, it is based on the layer definition. If layer is single, transformation is to single.
But for shapefiles, the multi-type is undefined, hence we need to force the conversion to multi. This does not cause any trouble since there is no distinction between single- and multi-line/polygon in the format. But, apparently, this is not the case for points. This commit is fixing the case for the points.

Please sign in to comment.