Skip to content
Permalink
Browse files
Moved remaining digitizing settings (enum/flag)
  • Loading branch information
domi4484 committed Apr 26, 2021
1 parent eaf18f6 commit 91f96a2fba63c4ca7bf2e27c7b26044390baee68
@@ -5,6 +5,66 @@
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsSettingsEntryEnumFlag_settingsDigitizingOffsetCapStyle
{
%TypeHeaderCode
#include "qgssettingsregistrycore.h"
#include "qgssettingsentry.h"
typedef QgsSettingsEntryEnumFlag<QgsGeometry::EndCapStyle> QgsSettingsEntryEnumFlag_settingsDigitizingOffsetCapStyle;
%End
public:
QgsSettingsEntryEnumFlag_settingsDigitizingOffsetCapStyle( const QString &key, QgsSettings::Section section, const QgsGeometry::EndCapStyle &defaultValue, const QString &description = QString() );
QString key( const QString &dynamicKeyPart = QString() ) const;
QgsGeometry::EndCapStyle value( const QString &dynamicKeyPart = QString(), bool useDefaultValueOverride = false, const QgsGeometry::EndCapStyle &defaultValueOverride = QgsGeometry::EndCapStyle() ) const;
};
class QgsSettingsEntryEnumFlag_settingsDigitizingOffsetJoinStyle
{
%TypeHeaderCode
#include "qgssettingsregistrycore.h"
#include "qgssettingsentry.h"
typedef QgsSettingsEntryEnumFlag<QgsGeometry::JoinStyle> QgsSettingsEntryEnumFlag_settingsDigitizingOffsetJoinStyle;
%End
public:
QgsSettingsEntryEnumFlag_settingsDigitizingOffsetJoinStyle( const QString &key, QgsSettings::Section section, const QgsGeometry::JoinStyle &defaultValue, const QString &description = QString() );
QString key( const QString &dynamicKeyPart = QString() ) const;
QgsGeometry::JoinStyle value( const QString &dynamicKeyPart = QString(), bool useDefaultValueOverride = false, const QgsGeometry::JoinStyle &defaultValueOverride = QgsGeometry::JoinStyle() ) const;
};
class QgsSettingsEntryEnumFlag_settingsDigitizingSearchRadiusVertexEditUnit
{
%TypeHeaderCode
#include "qgssettingsregistrycore.h"
#include "qgssettingsentry.h"
typedef QgsSettingsEntryEnumFlag<QgsTolerance::UnitType> QgsSettingsEntryEnumFlag_settingsDigitizingSearchRadiusVertexEditUnit;
%End
public:
QgsSettingsEntryEnumFlag_settingsDigitizingSearchRadiusVertexEditUnit( const QString &key, QgsSettings::Section section, const QgsTolerance::UnitType &defaultValue, const QString &description = QString() );
QString key( const QString &dynamicKeyPart = QString() ) const;
QgsTolerance::UnitType value( const QString &dynamicKeyPart = QString(), bool useDefaultValueOverride = false, const QgsTolerance::UnitType &defaultValueOverride = QgsTolerance::UnitType() ) const;
};
class QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnappingToleranceUnit
{
%TypeHeaderCode
#include "qgssettingsregistrycore.h"
#include "qgssettingsentry.h"
typedef QgsSettingsEntryEnumFlag<QgsTolerance::UnitType> QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnappingToleranceUnit;
%End
public:
QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnappingToleranceUnit( const QString &key, QgsSettings::Section section, const QgsTolerance::UnitType &defaultValue, const QString &description = QString() );
QString key( const QString &dynamicKeyPart = QString() ) const;
QgsTolerance::UnitType value( const QString &dynamicKeyPart = QString(), bool useDefaultValueOverride = false, const QgsTolerance::UnitType &defaultValueOverride = QgsTolerance::UnitType() ) const;
};
class QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType
{
%TypeHeaderCode
#include "qgssettingsregistrycore.h"
#include "qgssettingsentry.h"
typedef QgsSettingsEntryEnumFlag<QgsSnappingConfig::SnappingTypes> QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType;
%End
public:
QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType( const QString &key, QgsSettings::Section section, const QgsSnappingConfig::SnappingTypes &defaultValue, const QString &description = QString() );
QString key( const QString &dynamicKeyPart = QString() ) const;
QgsSnappingConfig::SnappingTypes value( const QString &dynamicKeyPart = QString(), bool useDefaultValueOverride = false, const QgsSnappingConfig::SnappingTypes &defaultValueOverride = QgsSnappingConfig::SnappingTypes() ) const;
};



@@ -72,12 +132,15 @@ Add ``settingsEntry`` to the register.

const QgsSettingsEntryBool settingsDigitizingDefaultSnapEnabled;

const QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType settingsDigitizingDefaultSnapType;

const QgsSettingsEntryDouble settingsDigitizingDefaultSnappingTolerance;

const QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnappingToleranceUnit settingsDigitizingDefaultSnappingToleranceUnit;

const QgsSettingsEntryDouble settingsDigitizingSearchRadiusVertexEdit;

const QgsSettingsEntryEnumFlag_settingsDigitizingSearchRadiusVertexEditUnit settingsDigitizingSearchRadiusVertexEditUnit;

const QgsSettingsEntryColor settingsDigitizingSnapColor;

@@ -97,6 +160,7 @@ Add ``settingsEntry`` to the register.

const QgsSettingsEntryInteger settingsDigitizingValidateGeometries;

const QgsSettingsEntryEnumFlag_settingsDigitizingOffsetJoinStyle settingsDigitizingOffsetJoinStyle;

const QgsSettingsEntryInteger settingsDigitizingOffsetQuadSeg;

@@ -108,6 +172,7 @@ Add ``settingsEntry`` to the register.

const QgsSettingsEntryDouble settingsDigitizingConvertToCurveDistanceTolerance;

const QgsSettingsEntryEnumFlag_settingsDigitizingOffsetCapStyle settingsDigitizingOffsetCapStyle;

const QgsSettingsEntryBool settingsDigitizingOffsetShowAdvanced;

@@ -1091,13 +1091,13 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
type );
}

QgsSnappingConfig::SnappingTypeFlag defaultSnapMode = mSettings->flagValue( QStringLiteral( "/qgis/digitizing/default_snap_type" ), QgsSnappingConfig::VertexFlag );
QgsSnappingConfig::SnappingTypeFlag defaultSnapMode = QgsSettingsRegistryCore::settingsDigitizingDefaultSnapType.value();
mDefaultSnapModeComboBox->setCurrentIndex( mDefaultSnapModeComboBox->findData( static_cast<int>( defaultSnapMode ) ) );
mDefaultSnappingToleranceSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.value() );
mDefaultSnappingToleranceSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.defaultValue() );
mSearchRadiusVertexEditSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.value() );
mSearchRadiusVertexEditSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.defaultValue() );
QgsTolerance::UnitType defSnapUnits = mSettings->enumValue( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance_unit" ), Qgis::DEFAULT_SNAP_UNITS );
QgsTolerance::UnitType defSnapUnits = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.value();
if ( defSnapUnits == QgsTolerance::ProjectUnits || defSnapUnits == QgsTolerance::LayerUnits )
{
index = mDefaultSnappingToleranceComboBox->findText( tr( "map units" ) );
@@ -1107,7 +1107,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
index = mDefaultSnappingToleranceComboBox->findText( tr( "pixels" ) );
}
mDefaultSnappingToleranceComboBox->setCurrentIndex( index );
QgsTolerance::UnitType defRadiusUnits = mSettings->enumValue( QStringLiteral( "/qgis/digitizing/search_radius_vertex_edit_unit" ), QgsTolerance::Pixels );
QgsTolerance::UnitType defRadiusUnits = QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEditUnit.value();
if ( defRadiusUnits == QgsTolerance::ProjectUnits || defRadiusUnits == QgsTolerance::LayerUnits )
{
index = mSearchRadiusVertexEditComboBox->findText( tr( "map units" ) );
@@ -1755,13 +1755,13 @@ void QgsOptions::saveOptions()

//default snap mode
QgsSettingsRegistryCore::settingsDigitizingDefaultSnapEnabled.setValue( mSnappingEnabledDefault->isChecked() );
mSettings->setFlagValue( QStringLiteral( "/qgis/digitizing/default_snap_type" ), static_cast<QgsSnappingConfig::SnappingTypeFlag>( mDefaultSnapModeComboBox->currentData().toInt() ) );
QgsSettingsRegistryCore::settingsDigitizingDefaultSnapType.setValue( static_cast<QgsSnappingConfig::SnappingTypes>( mDefaultSnapModeComboBox->currentData().toInt() ) );
QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.setValue( mDefaultSnappingToleranceSpinBox->value() );
QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.setValue( mSearchRadiusVertexEditSpinBox->value() );
mSettings->setEnumValue( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance_unit" ),
( mDefaultSnappingToleranceComboBox->currentIndex() == 0 ? QgsTolerance::ProjectUnits : QgsTolerance::Pixels ) );
mSettings->setEnumValue( QStringLiteral( "/qgis/digitizing/search_radius_vertex_edit_unit" ),
( mSearchRadiusVertexEditComboBox->currentIndex() == 0 ? QgsTolerance::ProjectUnits : QgsTolerance::Pixels ) );
QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.setValue(
( mDefaultSnappingToleranceComboBox->currentIndex() == 0 ? QgsTolerance::ProjectUnits : QgsTolerance::Pixels ) );
QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEditUnit.setValue(
( mSearchRadiusVertexEditComboBox->currentIndex() == 0 ? QgsTolerance::ProjectUnits : QgsTolerance::Pixels ) );

QgsSettingsRegistryCore::settingsDigitizingSnapColor.setValue( mSnappingMarkerColorButton->color() );
QgsSettingsRegistryCore::settingsDigitizingSnapTooltip.setValue( mSnappingTooltipsCheckbox->isChecked() );
@@ -197,9 +197,9 @@ void QgsSnappingConfig::reset()
// could be removed in 3.4+
mode = AllLayers;
}
QgsSnappingConfig::SnappingTypeFlag type = QgsSettings().flagValue( QStringLiteral( "/qgis/digitizing/default_snap_type" ), VertexFlag );
QgsSnappingConfig::SnappingTypeFlag type = QgsSettingsRegistryCore::settingsDigitizingDefaultSnapType.value();
double tolerance = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.value();
QgsTolerance::UnitType units = QgsSettings().enumValue( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance_unit" ), Qgis::DEFAULT_SNAP_UNITS );
QgsTolerance::UnitType units = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.value();

// assign main (standard) config
mEnabled = enabled;
@@ -598,9 +598,9 @@ bool QgsSnappingConfig::addLayers( const QList<QgsMapLayer *> &layers )
{
bool changed = false;
bool enabled = QgsSettingsRegistryCore::settingsDigitizingDefaultSnapEnabled.value( QString(), true, true );
QgsSnappingConfig::SnappingTypeFlag type = QgsSettings().enumValue( QStringLiteral( "/qgis/digitizing/default_snap_type" ), VertexFlag );
QgsSnappingConfig::SnappingTypeFlag type = QgsSettingsRegistryCore::settingsDigitizingDefaultSnapType.value();
double tolerance = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.value();
QgsTolerance::UnitType units = QgsSettings().enumValue( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance_unit" ), Qgis::DEFAULT_SNAP_UNITS );
QgsTolerance::UnitType units = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.value();

const auto constLayers = layers;
for ( QgsMapLayer *ml : constLayers )
@@ -72,27 +72,24 @@ double QgsTolerance::toleranceInMapUnits( double tolerance, QgsMapLayer *layer,

double QgsTolerance::vertexSearchRadius( const QgsMapSettings &mapSettings )
{
QgsSettings settings;
double tolerance = QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.value();
UnitType units = settings.enumValue( QStringLiteral( "qgis/digitizing/search_radius_vertex_edit_unit" ), QgsTolerance::Pixels );
UnitType units = QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEditUnit.value();
if ( units == LayerUnits )
units = ProjectUnits;
return toleranceInProjectUnits( tolerance, nullptr, mapSettings, units );
}

double QgsTolerance::vertexSearchRadius( QgsMapLayer *layer, const QgsMapSettings &mapSettings )
{
QgsSettings settings;
double tolerance = QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.value();
UnitType units = settings.enumValue( QStringLiteral( "qgis/digitizing/search_radius_vertex_edit_unit" ), QgsTolerance::Pixels );
UnitType units = QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEditUnit.value();
return toleranceInMapUnits( tolerance, layer, mapSettings, units );
}

double QgsTolerance::defaultTolerance( QgsMapLayer *layer, const QgsMapSettings &mapSettings )
{
QgsSettings settings;
double tolerance = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.value();
UnitType units = settings.enumValue( QStringLiteral( "qgis/digitizing/default_snapping_tolerance_unit" ), Qgis::DEFAULT_SNAP_UNITS );
UnitType units = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.value();
return toleranceInMapUnits( tolerance, layer, mapSettings, units );
}

@@ -72,11 +72,11 @@ QgsSettingsRegistryCore::QgsSettingsRegistryCore()
addSettingsEntry( &settingsDigitizingLineGhost );
addSettingsEntry( &settingsDigitizingDefaultZValue );
addSettingsEntry( &settingsDigitizingDefaultSnapEnabled );
// addSettingsEntry( &settingsDigitizingDefaultSnapType );
addSettingsEntry( &settingsDigitizingDefaultSnapType );
addSettingsEntry( &settingsDigitizingDefaultSnappingTolerance );
// addSettingsEntry( &settingsDigitizingDefaultSnappingToleranceUnit );
addSettingsEntry( &settingsDigitizingDefaultSnappingToleranceUnit );
addSettingsEntry( &settingsDigitizingSearchRadiusVertexEdit );
// addSettingsEntry( &settingsDigitizingSearchRadiusVertexEditUnit );
addSettingsEntry( &settingsDigitizingSearchRadiusVertexEditUnit );
addSettingsEntry( &settingsDigitizingSnapColor );
addSettingsEntry( &settingsDigitizingSnapTooltip );
addSettingsEntry( &settingsDigitizingSnapInvisibleFeature );
@@ -86,13 +86,13 @@ QgsSettingsRegistryCore::QgsSettingsRegistryCore()
addSettingsEntry( &settingsDigitizingReuseLastValues );
addSettingsEntry( &settingsDigitizingDisableEnterAttributeValuesDialog );
addSettingsEntry( &settingsDigitizingValidateGeometries );
// addSettingsEntry( &settingsDigitizingOffsetJoinStyle );
addSettingsEntry( &settingsDigitizingOffsetJoinStyle );
addSettingsEntry( &settingsDigitizingOffsetQuadSeg );
addSettingsEntry( &settingsDigitizingOffsetMiterLimit );
addSettingsEntry( &settingsDigitizingConvertToCurve );
addSettingsEntry( &settingsDigitizingConvertToCurveAngleTolerance );
addSettingsEntry( &settingsDigitizingConvertToCurveDistanceTolerance );
// addSettingsEntry( &settingsDigitizingOffsetCapStyle );
addSettingsEntry( &settingsDigitizingOffsetCapStyle );
addSettingsEntry( &settingsDigitizingOffsetShowAdvanced );
addSettingsEntry( &settingsDigitizingTracingMaxFeatureCount );
}
@@ -91,19 +91,19 @@ class CORE_EXPORT QgsSettingsRegistryCore : public QgsSettingsRegistry
static const inline QgsSettingsEntryBool settingsDigitizingDefaultSnapEnabled = QgsSettingsEntryBool( QStringLiteral( "/qgis/digitizing/default_snap_enabled" ), QgsSettings::NoSection, false );

//! Settings entry digitizing default snap type
// static const inline QgsSettingsEntryEnumFlag<QgsSnappingConfig::SnappingTypes> settingsDigitizingDefaultSnapType = QgsSettingsEntryEnumFlag<QgsSnappingConfig::SnappingTypes>( QStringLiteral( "/qgis/digitizing/default_snap_type" ), QgsSettings::NoSection, QgsSnappingConfig::VertexFlag );
static const inline QgsSettingsEntryEnumFlag<QgsSnappingConfig::SnappingTypes> settingsDigitizingDefaultSnapType = QgsSettingsEntryEnumFlag<QgsSnappingConfig::SnappingTypes>( QStringLiteral( "/qgis/digitizing/default_snap_type" ), QgsSettings::NoSection, QgsSnappingConfig::VertexFlag );

//! Settings entry digitizing default snapping tolerance
static const inline QgsSettingsEntryDouble settingsDigitizingDefaultSnappingTolerance = QgsSettingsEntryDouble( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance" ), QgsSettings::NoSection, Qgis::DEFAULT_SNAP_TOLERANCE );

//! Settings entry digitizing default snapping tolerance unit
// static const inline QgsSettingsEntryEnum settingsDigitizingDefaultSnappingToleranceUnit = QgsSettingsEntryEnum( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance_unit" ), QgsSettings::NoSection, Qgis::DEFAULT_SNAP_UNITS );
static const inline QgsSettingsEntryEnumFlag<QgsTolerance::UnitType> settingsDigitizingDefaultSnappingToleranceUnit = QgsSettingsEntryEnumFlag<QgsTolerance::UnitType>( QStringLiteral( "/qgis/digitizing/default_snapping_tolerance_unit" ), QgsSettings::NoSection, Qgis::DEFAULT_SNAP_UNITS );

//! Settings entry digitizing search radius vertex edit
static const inline QgsSettingsEntryDouble settingsDigitizingSearchRadiusVertexEdit = QgsSettingsEntryDouble( QStringLiteral( "/qgis/digitizing/search_radius_vertex_edit" ), QgsSettings::NoSection, 10 );

//! Settings entry digitizing search radius vertex edit unit
// static const inline QgsSettingsEntryEnum settingsDigitizingSearchRadiusVertexEditUnit = QgsSettingsEntryEnum( QStringLiteral( "/qgis/digitizing/search_radius_vertex_edit_unit" ), QgsSettings::NoSection, QgsTolerance::Pixels );
static const inline QgsSettingsEntryEnumFlag<QgsTolerance::UnitType> settingsDigitizingSearchRadiusVertexEditUnit = QgsSettingsEntryEnumFlag<QgsTolerance::UnitType>( QStringLiteral( "/qgis/digitizing/search_radius_vertex_edit_unit" ), QgsSettings::NoSection, QgsTolerance::Pixels );

//! Settings entry digitizing snap color
static const inline QgsSettingsEntryColor settingsDigitizingSnapColor = QgsSettingsEntryColor( QStringLiteral( "/qgis/digitizing/snap_color" ), QgsSettings::NoSection, QColor( Qt::magenta ) );
@@ -133,7 +133,7 @@ class CORE_EXPORT QgsSettingsRegistryCore : public QgsSettingsRegistry
static const inline QgsSettingsEntryInteger settingsDigitizingValidateGeometries = QgsSettingsEntryInteger( QStringLiteral( "/qgis/digitizing/validate_geometries" ), QgsSettings::NoSection, 1 );

//! Settings entry digitizing offset join style
// static const inline QgsSettingsEntryEnum settingsDigitizingOffsetJoinStyle = QgsSettingsEntryEnum( QStringLiteral( "/qgis/digitizing/offset_join_style" ), QgsSettings::NoSection, QgsGeometry::JoinStyleRound );
static const inline QgsSettingsEntryEnumFlag<QgsGeometry::JoinStyle> settingsDigitizingOffsetJoinStyle = QgsSettingsEntryEnumFlag<QgsGeometry::JoinStyle>( QStringLiteral( "/qgis/digitizing/offset_join_style" ), QgsSettings::NoSection, QgsGeometry::JoinStyleRound );

//! Settings entry digitizing offset quad seg
static const inline QgsSettingsEntryInteger settingsDigitizingOffsetQuadSeg = QgsSettingsEntryInteger( QStringLiteral( "/qgis/digitizing/offset_quad_seg" ), QgsSettings::NoSection, 8 );
@@ -151,7 +151,7 @@ class CORE_EXPORT QgsSettingsRegistryCore : public QgsSettingsRegistry
static const inline QgsSettingsEntryDouble settingsDigitizingConvertToCurveDistanceTolerance = QgsSettingsEntryDouble( QStringLiteral( "/qgis/digitizing/convert_to_curve_distance_tolerance" ), QgsSettings::NoSection, 1e-6 );

//! Settings entry digitizing offset cap style
// static const inline QgsSettingsEntryEnum settingsDigitizingOffsetCapStyle = QgsSettingsEntryEnum( QStringLiteral( "/qgis/digitizing/offset_cap_style" ), QgsSettings::NoSection, QgsGeometry::CapRound );
static const inline QgsSettingsEntryEnumFlag<QgsGeometry::EndCapStyle> settingsDigitizingOffsetCapStyle = QgsSettingsEntryEnumFlag<QgsGeometry::EndCapStyle>( QStringLiteral( "/qgis/digitizing/offset_cap_style" ), QgsSettings::NoSection, QgsGeometry::CapRound );

//! Settings entry digitizing offset show advanced
static const inline QgsSettingsEntryBool settingsDigitizingOffsetShowAdvanced = QgsSettingsEntryBool( QStringLiteral( "/qgis/digitizing/offset_show_advanced" ), QgsSettings::NoSection, false );

0 comments on commit 91f96a2

Please sign in to comment.