Skip to content
Permalink
Browse files

Fix descriptions and code style. Change Z geomtry type for memory lay…

…er from ..25D to ..Z.
  • Loading branch information
alisovenko committed Dec 29, 2016
1 parent adba280 commit 50962b02fdf6fa9721f6cb7d419f206ee300ae23
@@ -63,7 +63,7 @@ class QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
/**
* Return defalut Z value
*/
double getDefaultZValue();
double defaultZValue();

private slots:
void validationFinished();
@@ -146,7 +146,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
}
else if ( layerWKBType == QgsWkbTypes::Point25D )
{
g = QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), getDefaultZValue() ) );
g = QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) );
}
else if ( layerWKBType == QgsWkbTypes::MultiPoint )
{
@@ -155,7 +155,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
else if ( layerWKBType == QgsWkbTypes::MultiPoint25D )
{
QgsMultiPointV2* mp = new QgsMultiPointV2();
mp->addGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), getDefaultZValue() ) );
mp->addGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), defaultZValue() ) );
g = QgsGeometry( mp );
}
else
@@ -113,8 +113,8 @@ class CORE_EXPORT Qgis
* @note added in 2.15*/
static double SCALE_PRECISION;

/**
*
/** Default Z coordinate value for 2.5d geometry
* This value have to be assigned to the Z coordinate for the new 2.5d geometry vertex.
* @note added in 3.0 */
static double DEFAULT_Z_COORDINATE;

@@ -46,7 +46,6 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizin
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
, mDefaultZValue( Qgis::DEFAULT_Z_COORDINATE )
{
mCaptureMode = mode;

@@ -85,8 +84,6 @@ void QgsMapToolCapture::activate()
mTempRubberBand->show();

QgsMapToolAdvancedDigitizing::activate();

mDefaultZValue = QSettings().value( QStringLiteral( "/qgis/digitizing/default_z_value" ), Qgis::DEFAULT_Z_COORDINATE ).toDouble();
}

void QgsMapToolCapture::deactivate()
@@ -335,7 +332,7 @@ int QgsMapToolCapture::nextPoint( const QgsPointV2& mapPoint, QgsPointV2& layerP
QgsPoint mapP( mapPoint.x(), mapPoint.y() );
layerPoint = QgsPointV2( toLayerCoordinates( vlayer, mapP ) ); //transform snapped point back to layer crs
if ( QgsWkbTypes::hasZ( vlayer->wkbType() ) )
layerPoint.addZValue( getDefaultZValue() );
layerPoint.addZValue( defaultZValue() );
if ( QgsWkbTypes::hasM( vlayer->wkbType() ) )
layerPoint.addMValue( 0.0 );
}
@@ -614,6 +611,11 @@ void QgsMapToolCapture::deleteTempRubberBand()
}
}

double QgsMapToolCapture::defaultZValue()
{
QSettings().value( QStringLiteral( "/qgis/digitizing/default_z_value" ), Qgis::DEFAULT_Z_COORDINATE ).toDouble();
}

void QgsMapToolCapture::closePolygon()
{
mCaptureCurve.close();
@@ -83,9 +83,10 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
void deleteTempRubberBand();

/**
* Return defalut Z value
* Return default Z value
* Use for set Z coordinate to new vertex for 2.5d geometries
*/
double getDefaultZValue() {return mDefaultZValue;};
double defaultZValue();

private slots:
void validationFinished();
@@ -217,7 +218,6 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing

QgsVertexMarker* mSnappingMarker;

double mDefaultZValue;
#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent;
#endif
@@ -110,7 +110,7 @@ QgsWkbTypes::Type QgsNewMemoryLayerDialog::selectedType() const
}

if ( mGeometryWithZCheckBox->isChecked() && wkbType != QgsWkbTypes::Unknown && wkbType != QgsWkbTypes::NoGeometry )
wkbType = QgsWkbTypes::to25D( wkbType );
wkbType = QgsWkbTypes::zmType( wkbType, true, false );

return wkbType;
}

0 comments on commit 50962b0

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