Skip to content

Commit 41dd81b

Browse files
committed
Add options for offset curve (join style, quadseg, mitre limit)
1 parent 80108fd commit 41dd81b

File tree

3 files changed

+70
-24
lines changed

3 files changed

+70
-24
lines changed

src/app/qgsmaptooloffsetcurve.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,11 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
310310
GEOSGeometry* geosGeom = geomCopy.asGeos();
311311
if ( geosGeom )
312312
{
313-
GEOSGeometry* offsetGeom = GEOSSingleSidedBuffer( geosGeom, offset, 8, 1, 1, leftSide ? 1 : 0 );
313+
QSettings s;
314+
int joinStyle = s.value( "/qgis/digitizing/offset_join_style", 0 ).toInt();
315+
int quadSegments = s.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt();
316+
double mitreLimit = s.value( "/qgis/digitizine/offset_miter_limit", 5.0 ).toDouble();
317+
GEOSGeometry* offsetGeom = GEOSSingleSidedBuffer( geosGeom, offset, quadSegments, joinStyle, mitreLimit, leftSide ? 1 : 0 );
314318
if ( offsetGeom )
315319
{
316320
mModifiedGeometry.fromGeos( offsetGeom );

src/app/qgsoptions.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,14 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
420420
chkDisableAttributeValuesDlg->setChecked( settings.value( "/qgis/digitizing/disable_enter_attribute_values_dialog", false ).toBool() );
421421
mValidateGeometries->setCurrentIndex( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() );
422422

423+
mOffsetJoinStyleComboBox->addItem( tr( "Round" ), 0 );
424+
mOffsetJoinStyleComboBox->addItem( tr( "Mitre" ), 1 );
425+
mOffsetJoinStyleComboBox->addItem( tr( "Bevel" ), 2 );
426+
mOffsetJoinStyleComboBox->setCurrentIndex( settings.value( "/qgis/digitizing/offset_join_style", 0 ).toInt() );
427+
mOffsetQuadSegSpinBox->setValue( settings.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt() );
428+
mCurveOffsetMiterLimitComboBox->setValue( settings.value( "/qgis/digitizine/offset_miter_limit", 5.0 ).toDouble() );
429+
430+
423431
#ifdef Q_WS_MAC //MH: disable incremental update on Mac for now to avoid problems with resizing
424432
groupBox_5->setEnabled( false );
425433
#endif //Q_WS_MAC
@@ -773,6 +781,10 @@ void QgsOptions::saveOptions()
773781
settings.setValue( "/qgis/digitizing/disable_enter_attribute_values_dialog", chkDisableAttributeValuesDlg->isChecked() );
774782
settings.setValue( "/qgis/digitizing/validate_geometries", mValidateGeometries->currentIndex() );
775783

784+
settings.setValue( "/qgis/digitizing/offset_join_style", mOffsetJoinStyleComboBox->itemData( mOffsetJoinStyleComboBox->currentIndex() ).toInt() );
785+
settings.setValue( "/qgis/digitizing/offset_quad_seg", mOffsetQuadSegSpinBox->value() );
786+
settings.setValue( "/qgis/digitizine/offset_miter_limit", mCurveOffsetMiterLimitComboBox->value() );
787+
776788
//
777789
// Locale settings
778790
//

src/ui/qgsoptionsbase.ui

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<rect>
6767
<x>0</x>
6868
<y>0</y>
69-
<width>779</width>
70-
<height>791</height>
69+
<width>809</width>
70+
<height>778</height>
7171
</rect>
7272
</property>
7373
<layout class="QGridLayout" name="gridLayout">
@@ -684,8 +684,8 @@
684684
<rect>
685685
<x>0</x>
686686
<y>0</y>
687-
<width>604</width>
688-
<height>494</height>
687+
<width>809</width>
688+
<height>778</height>
689689
</rect>
690690
</property>
691691
<layout class="QGridLayout" name="gridLayout_8">
@@ -858,8 +858,8 @@
858858
<rect>
859859
<x>0</x>
860860
<y>0</y>
861-
<width>483</width>
862-
<height>478</height>
861+
<width>809</width>
862+
<height>778</height>
863863
</rect>
864864
</property>
865865
<layout class="QGridLayout" name="gridLayout_4">
@@ -1144,8 +1144,8 @@
11441144
<rect>
11451145
<x>0</x>
11461146
<y>0</y>
1147-
<width>257</width>
1148-
<height>93</height>
1147+
<width>809</width>
1148+
<height>778</height>
11491149
</rect>
11501150
</property>
11511151
<layout class="QGridLayout" name="gridLayout_10">
@@ -1219,8 +1219,8 @@
12191219
<rect>
12201220
<x>0</x>
12211221
<y>0</y>
1222-
<width>569</width>
1223-
<height>510</height>
1222+
<width>795</width>
1223+
<height>764</height>
12241224
</rect>
12251225
</property>
12261226
<layout class="QGridLayout" name="gridLayout_13">
@@ -1487,8 +1487,8 @@
14871487
<property name="title">
14881488
<string>Other settings</string>
14891489
</property>
1490-
<layout class="QGridLayout" name="gridLayout_26">
1491-
<item row="0" column="0" colspan="2">
1490+
<layout class="QGridLayout" name="gridLayout_12">
1491+
<item row="0" column="0">
14921492
<widget class="QCheckBox" name="chkDisableAttributeValuesDlg">
14931493
<property name="text">
14941494
<string>Suppress attributes pop-up windows after each created feature</string>
@@ -1498,7 +1498,7 @@
14981498
</property>
14991499
</widget>
15001500
</item>
1501-
<item row="1" column="0" colspan="2">
1501+
<item row="1" column="0">
15021502
<widget class="QCheckBox" name="chkReuseLastValues">
15031503
<property name="text">
15041504
<string>Reuse last entered attribute values</string>
@@ -1508,20 +1508,50 @@
15081508
</property>
15091509
</widget>
15101510
</item>
1511-
<item row="2" column="1">
1512-
<widget class="QComboBox" name="mValidateGeometries"/>
1513-
</item>
15141511
<item row="2" column="0">
15151512
<widget class="QLabel" name="label_19">
15161513
<property name="text">
15171514
<string>Validate geometries</string>
15181515
</property>
15191516
</widget>
15201517
</item>
1518+
<item row="2" column="1">
1519+
<widget class="QComboBox" name="mValidateGeometries"/>
1520+
</item>
1521+
<item row="3" column="0">
1522+
<widget class="QLabel" name="label_21">
1523+
<property name="text">
1524+
<string>Join style for curve offset</string>
1525+
</property>
1526+
</widget>
1527+
</item>
1528+
<item row="3" column="1">
1529+
<widget class="QComboBox" name="mOffsetJoinStyleComboBox"/>
1530+
</item>
1531+
<item row="4" column="0">
1532+
<widget class="QLabel" name="label_22">
1533+
<property name="text">
1534+
<string>Quadrantsegments for curve offset</string>
1535+
</property>
1536+
</widget>
1537+
</item>
1538+
<item row="4" column="1">
1539+
<widget class="QSpinBox" name="mOffsetQuadSegSpinBox"/>
1540+
</item>
1541+
<item row="5" column="0">
1542+
<widget class="QLabel" name="label_23">
1543+
<property name="text">
1544+
<string>Miter limit for curve offset</string>
1545+
</property>
1546+
</widget>
1547+
</item>
1548+
<item row="5" column="1">
1549+
<widget class="QDoubleSpinBox" name="mCurveOffsetMiterLimitComboBox"/>
1550+
</item>
15211551
</layout>
15221552
</widget>
15231553
</item>
1524-
<item row="5" column="0">
1554+
<item row="4" column="0">
15251555
<spacer>
15261556
<property name="orientation">
15271557
<enum>Qt::Vertical</enum>
@@ -1565,8 +1595,8 @@
15651595
<rect>
15661596
<x>0</x>
15671597
<y>0</y>
1568-
<width>412</width>
1569-
<height>411</height>
1598+
<width>809</width>
1599+
<height>778</height>
15701600
</rect>
15711601
</property>
15721602
<layout class="QGridLayout" name="gridLayout_15">
@@ -1739,8 +1769,8 @@
17391769
<rect>
17401770
<x>0</x>
17411771
<y>0</y>
1742-
<width>523</width>
1743-
<height>560</height>
1772+
<width>809</width>
1773+
<height>778</height>
17441774
</rect>
17451775
</property>
17461776
<layout class="QGridLayout" name="gridLayout_17">
@@ -1836,8 +1866,8 @@
18361866
<rect>
18371867
<x>0</x>
18381868
<y>0</y>
1839-
<width>321</width>
1840-
<height>541</height>
1869+
<width>809</width>
1870+
<height>778</height>
18411871
</rect>
18421872
</property>
18431873
<layout class="QGridLayout" name="gridLayout_20">

0 commit comments

Comments
 (0)