mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Add default Z value option. Added the ability to create shape with 2.5d geometry. Change add feature tool fo create geometry with default Z value.
This commit is contained in:
parent
0a686c4fca
commit
d2f41ac902
@ -146,7 +146,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
}
|
||||
else if ( layerWKBType == QgsWkbTypes::Point25D )
|
||||
{
|
||||
g = QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), 0.0 ) );
|
||||
g = QgsGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), getDefaultZValue() ) );
|
||||
}
|
||||
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(), 0.0 ) );
|
||||
mp->addGeometry( new QgsPointV2( QgsWkbTypes::PointZ, savePoint.x(), savePoint.y(), getDefaultZValue() ) );
|
||||
g = QgsGeometry( mp );
|
||||
}
|
||||
else
|
||||
|
@ -854,6 +854,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
|
||||
|
||||
mLineGhostCheckBox->setChecked( mSettings->value( QStringLiteral( "/qgis/digitizing/line_ghost" ), false ).toBool() );
|
||||
|
||||
mDefaultZValueSpinBox->setValue(
|
||||
mSettings->value( QStringLiteral( "/qgis/digitizing/default_z_value" ), Qgis::DEFAULT_Z_COORDINATE ).toDouble()
|
||||
);
|
||||
|
||||
//default snap mode
|
||||
mSnappingEnabledDefault->setChecked( mSettings->value( QStringLiteral( "/qgis/digitizing/default_snap_enabled" ), false ).toBool() );
|
||||
mDefaultSnapModeComboBox->addItem( tr( "Vertex" ), QgsSnappingConfig::Vertex );
|
||||
@ -1362,6 +1366,8 @@ void QgsOptions::saveOptions()
|
||||
|
||||
settings.setValue( QStringLiteral( "/qgis/digitizing/line_ghost" ), mLineGhostCheckBox->isChecked() );
|
||||
|
||||
mSettings->setValue( QStringLiteral( "/qgis/digitizing/default_z_value" ), mDefaultZValueSpinBox->value() );
|
||||
|
||||
//default snap mode
|
||||
mSettings->setValue( QStringLiteral( "/qgis/digitizing/default_snap_enabled" ), mSnappingEnabledDefault->isChecked() );
|
||||
mSettings->setValue( QStringLiteral( "/qgis/digitizing/default_snap_type" ), mDefaultSnapModeComboBox->currentData().toInt() );
|
||||
|
@ -87,6 +87,7 @@ double Qgis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM = 1.0;
|
||||
|
||||
double Qgis::SCALE_PRECISION = 0.9999999999;
|
||||
|
||||
double Qgis::DEFAULT_Z_COORDINATE = 0.0;
|
||||
|
||||
double qgsPermissiveToDouble( QString string, bool &ok )
|
||||
{
|
||||
|
@ -113,6 +113,11 @@ class CORE_EXPORT Qgis
|
||||
* @note added in 2.15*/
|
||||
static double SCALE_PRECISION;
|
||||
|
||||
/**
|
||||
*
|
||||
* @note added in 3.0 */
|
||||
static double DEFAULT_Z_COORDINATE;
|
||||
|
||||
private:
|
||||
// String representation of unit types (set in qgis.cpp)
|
||||
static const char *qgisUnitTypes[];
|
||||
|
@ -46,6 +46,7 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizin
|
||||
#ifdef Q_OS_WIN
|
||||
, mSkipNextContextMenuEvent( 0 )
|
||||
#endif
|
||||
, mDefaultZValue(Qgis::DEFAULT_Z_COORDINATE)
|
||||
{
|
||||
mCaptureMode = mode;
|
||||
|
||||
@ -84,6 +85,8 @@ void QgsMapToolCapture::activate()
|
||||
mTempRubberBand->show();
|
||||
|
||||
QgsMapToolAdvancedDigitizing::activate();
|
||||
|
||||
mDefaultZValue = QSettings().value( QStringLiteral( "/qgis/digitizing/default_z_value" ), Qgis::DEFAULT_Z_COORDINATE ).toDouble();
|
||||
}
|
||||
|
||||
void QgsMapToolCapture::deactivate()
|
||||
@ -332,7 +335,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( 0.0 );
|
||||
layerPoint.addZValue( getDefaultZValue() );
|
||||
if ( QgsWkbTypes::hasM( vlayer->wkbType() ) )
|
||||
layerPoint.addMValue( 0.0 );
|
||||
}
|
||||
|
@ -82,6 +82,11 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
|
||||
*/
|
||||
void deleteTempRubberBand();
|
||||
|
||||
/**
|
||||
* Return defalut Z value
|
||||
*/
|
||||
double getDefaultZValue() {return mDefaultZValue;};
|
||||
|
||||
private slots:
|
||||
void validationFinished();
|
||||
void currentLayerChanged( QgsMapLayer *layer );
|
||||
@ -212,6 +217,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
|
||||
|
||||
QgsVertexMarker* mSnappingMarker;
|
||||
|
||||
double mDefaultZValue;
|
||||
#ifdef Q_OS_WIN
|
||||
int mSkipNextContextMenuEvent;
|
||||
#endif
|
||||
|
@ -147,14 +147,20 @@ QgsWkbTypes::Type QgsNewVectorLayerDialog::selectedType() const
|
||||
{
|
||||
if ( mPointRadioButton->isChecked() )
|
||||
{
|
||||
if (mGeometryWithZCheckBox->isChecked())
|
||||
return QgsWkbTypes::Point25D;
|
||||
return QgsWkbTypes::Point;
|
||||
}
|
||||
else if ( mLineRadioButton->isChecked() )
|
||||
{
|
||||
if (mGeometryWithZCheckBox->isChecked())
|
||||
return QgsWkbTypes::LineString25D;
|
||||
return QgsWkbTypes::LineString;
|
||||
}
|
||||
else if ( mPolygonRadioButton->isChecked() )
|
||||
{
|
||||
if (mGeometryWithZCheckBox->isChecked())
|
||||
return QgsWkbTypes::Polygon25D;
|
||||
return QgsWkbTypes::Polygon;
|
||||
}
|
||||
return QgsWkbTypes::Unknown;
|
||||
|
@ -2671,21 +2671,39 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
|
||||
case QgsWkbTypes::Point:
|
||||
OGRvectortype = wkbPoint;
|
||||
break;
|
||||
case QgsWkbTypes::Point25D:
|
||||
OGRvectortype = wkbPoint25D;
|
||||
break;
|
||||
case QgsWkbTypes::LineString:
|
||||
OGRvectortype = wkbLineString;
|
||||
break;
|
||||
case QgsWkbTypes::LineString25D:
|
||||
OGRvectortype = wkbLineString25D;
|
||||
break;
|
||||
case QgsWkbTypes::Polygon:
|
||||
OGRvectortype = wkbPolygon;
|
||||
break;
|
||||
case QgsWkbTypes::Polygon25D:
|
||||
OGRvectortype = wkbPolygon25D;
|
||||
break;
|
||||
case QgsWkbTypes::MultiPoint:
|
||||
OGRvectortype = wkbMultiPoint;
|
||||
break;
|
||||
case QgsWkbTypes::MultiPoint25D:
|
||||
OGRvectortype = wkbMultiPoint25D;
|
||||
break;
|
||||
case QgsWkbTypes::MultiLineString:
|
||||
OGRvectortype = wkbMultiLineString;
|
||||
break;
|
||||
case QgsWkbTypes::MultiLineString25D:
|
||||
OGRvectortype = wkbMultiLineString25D;
|
||||
break;
|
||||
case QgsWkbTypes::MultiPolygon:
|
||||
OGRvectortype = wkbMultiPolygon;
|
||||
break;
|
||||
case QgsWkbTypes::MultiPolygon25D:
|
||||
OGRvectortype = wkbMultiPolygon25D;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
QgsMessageLog::logMessage( QObject::tr( "Unknown vector type of %1" ).arg(( int )( vectortype ) ), QObject::tr( "OGR" ) );
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>444</width>
|
||||
<width>471</width>
|
||||
<height>578</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -69,22 +69,29 @@
|
||||
<property name="title">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="mPointRadioButton">
|
||||
<property name="text">
|
||||
<string>Point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="mLineRadioButton">
|
||||
<property name="text">
|
||||
<string>Line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="mPointRadioButton">
|
||||
<property name="text">
|
||||
<string>Point</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="mGeometryWithZCheckBox">
|
||||
<property name="text">
|
||||
<string>Geometries with Z coordinate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="mPolygonRadioButton">
|
||||
<property name="text">
|
||||
<string>Polygon</string>
|
||||
|
@ -1023,7 +1023,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>607</width>
|
||||
<width>839</width>
|
||||
<height>850</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1813,7 +1813,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-299</y>
|
||||
<y>0</y>
|
||||
<width>839</width>
|
||||
<height>982</height>
|
||||
</rect>
|
||||
@ -3755,8 +3755,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>586</width>
|
||||
<height>701</height>
|
||||
<width>839</width>
|
||||
<height>734</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_31">
|
||||
@ -3769,16 +3769,6 @@
|
||||
<string>Feature creation</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_28">
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="mValidateGeometries">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
@ -3819,6 +3809,39 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="mDefaultZValueLabel">
|
||||
<property name="text">
|
||||
<string>Default Z value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="mDefaultZValueSpinBox">
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.998999999952503</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="mValidateGeometries">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user