Skip to content
Permalink
Browse files
Add options for offset curve (join style, quadseg, mitre limit)
  • Loading branch information
mhugent committed Feb 21, 2012
1 parent 80108fd commit 41dd81ba0c86802ce28da30ec202b6c5a72d644a
Showing with 70 additions and 24 deletions.
  1. +5 −1 src/app/qgsmaptooloffsetcurve.cpp
  2. +12 −0 src/app/qgsoptions.cpp
  3. +53 −23 src/ui/qgsoptionsbase.ui
@@ -310,7 +310,11 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
GEOSGeometry* geosGeom = geomCopy.asGeos();
if ( geosGeom )
{
GEOSGeometry* offsetGeom = GEOSSingleSidedBuffer( geosGeom, offset, 8, 1, 1, leftSide ? 1 : 0 );
QSettings s;
int joinStyle = s.value( "/qgis/digitizing/offset_join_style", 0 ).toInt();
int quadSegments = s.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt();
double mitreLimit = s.value( "/qgis/digitizine/offset_miter_limit", 5.0 ).toDouble();
GEOSGeometry* offsetGeom = GEOSSingleSidedBuffer( geosGeom, offset, quadSegments, joinStyle, mitreLimit, leftSide ? 1 : 0 );
if ( offsetGeom )
{
mModifiedGeometry.fromGeos( offsetGeom );
@@ -420,6 +420,14 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
chkDisableAttributeValuesDlg->setChecked( settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool() );
mValidateGeometries->setCurrentIndex( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() );

mOffsetJoinStyleComboBox->addItem( tr( "Round" ), 0 );
mOffsetJoinStyleComboBox->addItem( tr( "Mitre" ), 1 );
mOffsetJoinStyleComboBox->addItem( tr( "Bevel" ), 2 );
mOffsetJoinStyleComboBox->setCurrentIndex( settings.value( "/qgis/digitizing/offset_join_style", 0 ).toInt() );
mOffsetQuadSegSpinBox->setValue( settings.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt() );
mCurveOffsetMiterLimitComboBox->setValue( settings.value( "/qgis/digitizine/offset_miter_limit", 5.0 ).toDouble() );


#ifdef Q_WS_MAC //MH: disable incremental update on Mac for now to avoid problems with resizing
groupBox_5->setEnabled( false );
#endif //Q_WS_MAC
@@ -773,6 +781,10 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/digitizing/disable_enter_attribute_values_dialog", chkDisableAttributeValuesDlg->isChecked() );
settings.setValue( "/qgis/digitizing/validate_geometries", mValidateGeometries->currentIndex() );

settings.setValue( "/qgis/digitizing/offset_join_style", mOffsetJoinStyleComboBox->itemData( mOffsetJoinStyleComboBox->currentIndex() ).toInt() );
settings.setValue( "/qgis/digitizing/offset_quad_seg", mOffsetQuadSegSpinBox->value() );
settings.setValue( "/qgis/digitizine/offset_miter_limit", mCurveOffsetMiterLimitComboBox->value() );

//
// Locale settings
//
@@ -66,8 +66,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>779</width>
<height>791</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@@ -684,8 +684,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>494</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@@ -858,8 +858,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>483</width>
<height>478</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
@@ -1144,8 +1144,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>257</width>
<height>93</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_10">
@@ -1219,8 +1219,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>569</width>
<height>510</height>
<width>795</width>
<height>764</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_13">
@@ -1487,8 +1487,8 @@
<property name="title">
<string>Other settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_26">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_12">
<item row="0" column="0">
<widget class="QCheckBox" name="chkDisableAttributeValuesDlg">
<property name="text">
<string>Suppress attributes pop-up windows after each created feature</string>
@@ -1498,7 +1498,7 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="1" column="0">
<widget class="QCheckBox" name="chkReuseLastValues">
<property name="text">
<string>Reuse last entered attribute values</string>
@@ -1508,20 +1508,50 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mValidateGeometries"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Validate geometries</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mValidateGeometries"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Join style for curve offset</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="mOffsetJoinStyleComboBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Quadrantsegments for curve offset</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="mOffsetQuadSegSpinBox"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Miter limit for curve offset</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="mCurveOffsetMiterLimitComboBox"/>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -1565,8 +1595,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>412</width>
<height>411</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
@@ -1739,8 +1769,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>523</width>
<height>560</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_17">
@@ -1836,8 +1866,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>321</width>
<height>541</height>
<width>809</width>
<height>778</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_20">

0 comments on commit 41dd81b

Please sign in to comment.