Skip to content

Commit

Permalink
Fix descriptions and code style. Change Z geomtry type for memory lay…
Browse files Browse the repository at this point in the history
…er from ..25D to ..Z.
  • Loading branch information
alisovenko committed Dec 29, 2016
1 parent adba280 commit 50962b0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion python/gui/qgsmaptoolcapture.sip
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
/**
* Return defalut Z value
*/
double getDefaultZValue();
double defaultZValue();

private slots:
void validationFinished();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooladdfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 6 additions & 4 deletions src/gui/qgsmaptoolcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizin
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
, mDefaultZValue( Qgis::DEFAULT_Z_COORDINATE )
{
mCaptureMode = mode;

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsmaptoolcapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -217,7 +218,6 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing

QgsVertexMarker* mSnappingMarker;

double mDefaultZValue;
#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsnewmemorylayerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 50962b0

Please sign in to comment.