Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add options for offset curve (join style, quadseg, mitre limit)
  • Loading branch information
mhugent committed Feb 21, 2012
1 parent 80108fd commit 41dd81b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 24 deletions.
6 changes: 5 additions & 1 deletion src/app/qgsmaptooloffsetcurve.cpp
Expand Up @@ -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 );
Expand Down
12 changes: 12 additions & 0 deletions src/app/qgsoptions.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
//
Expand Down
76 changes: 53 additions & 23 deletions src/ui/qgsoptionsbase.ui
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down

0 comments on commit 41dd81b

Please sign in to comment.