Skip to content
Permalink
Browse files

Fix Z and M support for add point feature (fixes #17427)

  • Loading branch information
nirvn committed Nov 9, 2017
1 parent ba62ffc commit 0ccf6fa1710108640f84192045026fd09d28af8b
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/app/qgsmaptooladdfeature.cpp
@@ -154,15 +154,15 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
g = QgsGeometry::fromPointXY( savePoint );
}
else if ( layerWKBType == QgsWkbTypes::Point25D )
else if ( !QgsWkbTypes::isMultiType( layerWKBType ) && QgsWkbTypes::hasZ( layerWKBType ) )
{
g = QgsGeometry( new QgsPoint( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) );
}
else if ( layerWKBType == QgsWkbTypes::MultiPoint )
else if ( QgsWkbTypes::isMultiType( layerWKBType ) && !QgsWkbTypes::hasZ( layerWKBType ) )
{
g = QgsGeometry::fromMultiPointXY( QgsMultiPointXY() << savePoint );
}
else if ( layerWKBType == QgsWkbTypes::MultiPoint25D )
else if ( QgsWkbTypes::isMultiType( layerWKBType ) && QgsWkbTypes::hasZ( layerWKBType ) )
{
QgsMultiPoint *mp = new QgsMultiPoint();
mp->addGeometry( new QgsPoint( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) );
@@ -174,6 +174,11 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
g = QgsGeometry::fromPointXY( savePoint );
}

if ( QgsWkbTypes::hasM( layerWKBType ) )
{
g.get()->addMValue();
}

f.setGeometry( g );
f.setValid( true );

0 comments on commit 0ccf6fa

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