210
210
#include " qgsmaptoolmeasureangle.h"
211
211
#include " qgsmaptoolmovefeature.h"
212
212
#include " qgsmaptoolmovevertex.h"
213
+ #include " qgsmaptooloffsetcurve.h"
213
214
#include " qgsmaptoolpan.h"
214
215
#include " qgsmaptoolselect.h"
215
216
#include " qgsmaptoolselectrectangle.h"
@@ -627,7 +628,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
627
628
628
629
#ifdef ANDROID
629
630
// add reacting to long click in android
630
- grabGesture (Qt::TapAndHoldGesture);
631
+ grabGesture ( Qt::TapAndHoldGesture );
631
632
#endif
632
633
633
634
// update windows
@@ -740,9 +741,9 @@ bool QgisApp::event( QEvent * event )
740
741
done = true ;
741
742
}
742
743
#ifdef ANDROID
743
- else if (event->type () == QEvent::Gesture )
744
+ else if ( event->type () == QEvent::Gesture )
744
745
{
745
- done = gestureEvent (static_cast <QGestureEvent*>(event) );
746
+ done = gestureEvent ( static_cast <QGestureEvent*>( event ) );
746
747
}
747
748
#endif
748
749
else
@@ -814,6 +815,7 @@ void QgisApp::createActions()
814
815
connect ( mActionNodeTool , SIGNAL ( triggered () ), this , SLOT ( nodeTool () ) );
815
816
connect ( mActionRotatePointSymbols , SIGNAL ( triggered () ), this , SLOT ( rotatePointSymbols () ) );
816
817
connect ( mActionSnappingOptions , SIGNAL ( triggered () ), this , SLOT ( snappingOptions () ) );
818
+ connect ( mActionOffsetCurve , SIGNAL ( triggered () ), this , SLOT ( offsetCurve () ) );
817
819
818
820
// View Menu Items
819
821
@@ -1016,6 +1018,7 @@ void QgisApp::createActionGroups()
1016
1018
mMapToolGroup ->addAction ( mActionMeasureAngle );
1017
1019
mMapToolGroup ->addAction ( mActionAddFeature );
1018
1020
mMapToolGroup ->addAction ( mActionMoveFeature );
1021
+ mMapToolGroup ->addAction ( mActionOffsetCurve );
1019
1022
mMapToolGroup ->addAction ( mActionReshapeFeatures );
1020
1023
mMapToolGroup ->addAction ( mActionSplitFeatures );
1021
1024
mMapToolGroup ->addAction ( mActionDeleteSelected );
@@ -1664,6 +1667,8 @@ void QgisApp::createCanvasTools()
1664
1667
mMapTools .mAddFeature ->setAction ( mActionAddFeature );
1665
1668
mMapTools .mMoveFeature = new QgsMapToolMoveFeature ( mMapCanvas );
1666
1669
mMapTools .mMoveFeature ->setAction ( mActionMoveFeature );
1670
+ mMapTools .mOffsetCurve = new QgsMapToolOffsetCurve ( mMapCanvas );
1671
+ mMapTools .mOffsetCurve ->setAction ( mActionOffsetCurve );
1667
1672
mMapTools .mReshapeFeatures = new QgsMapToolReshape ( mMapCanvas );
1668
1673
mMapTools .mReshapeFeatures ->setAction ( mActionReshapeFeatures );
1669
1674
mMapTools .mSplitFeatures = new QgsMapToolSplitFeatures ( mMapCanvas );
@@ -3588,6 +3593,11 @@ void QgisApp::moveFeature()
3588
3593
mMapCanvas ->setMapTool ( mMapTools .mMoveFeature );
3589
3594
}
3590
3595
3596
+ void QgisApp::offsetCurve ()
3597
+ {
3598
+ mMapCanvas ->setMapTool ( mMapTools .mOffsetCurve );
3599
+ }
3600
+
3591
3601
void QgisApp::simplifyFeature ()
3592
3602
{
3593
3603
mMapCanvas ->setMapTool ( mMapTools .mSimplifyFeature );
@@ -6127,6 +6137,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
6127
6137
mActionFeatureAction ->setEnabled ( false );
6128
6138
mActionAddFeature ->setEnabled ( false );
6129
6139
mActionMoveFeature ->setEnabled ( false );
6140
+ mActionOffsetCurve ->setEnabled ( false );
6130
6141
mActionNodeTool ->setEnabled ( false );
6131
6142
mActionDeleteSelected ->setEnabled ( false );
6132
6143
mActionCutFeatures ->setEnabled ( false );
@@ -6141,6 +6152,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
6141
6152
mActionDeleteRing ->setEnabled ( false );
6142
6153
mActionDeletePart ->setEnabled ( false );
6143
6154
mActionReshapeFeatures ->setEnabled ( false );
6155
+ mActionOffsetCurve ->setEnabled ( false );
6144
6156
mActionSplitFeatures ->setEnabled ( false );
6145
6157
mActionMergeFeatures ->setEnabled ( false );
6146
6158
mActionMergeFeatureAttributes ->setEnabled ( false );
@@ -6259,6 +6271,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
6259
6271
mActionAddPart ->setEnabled ( false );
6260
6272
mActionDeletePart ->setEnabled ( false );
6261
6273
mActionMoveFeature ->setEnabled ( false );
6274
+ mActionOffsetCurve ->setEnabled ( false );
6262
6275
mActionNodeTool ->setEnabled ( false );
6263
6276
}
6264
6277
@@ -6291,6 +6304,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
6291
6304
mActionReshapeFeatures ->setEnabled ( true );
6292
6305
mActionSplitFeatures ->setEnabled ( true );
6293
6306
mActionSimplifyFeature ->setEnabled ( true );
6307
+ mActionOffsetCurve ->setEnabled ( dprovider->capabilities () & QgsVectorDataProvider::ChangeAttributeValues );
6294
6308
}
6295
6309
else
6296
6310
{
@@ -6370,6 +6384,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
6370
6384
mActionAddPart ->setEnabled ( false );
6371
6385
mActionNodeTool ->setEnabled ( false );
6372
6386
mActionMoveFeature ->setEnabled ( false );
6387
+ mActionOffsetCurve ->setEnabled ( false );
6373
6388
mActionCopyFeatures ->setEnabled ( false );
6374
6389
mActionCutFeatures ->setEnabled ( false );
6375
6390
mActionPasteFeatures ->setEnabled ( false );
@@ -7278,18 +7293,19 @@ QMenu* QgisApp::createPopupMenu()
7278
7293
}
7279
7294
7280
7295
#ifdef ANDROID
7281
- bool QgisApp::gestureEvent (QGestureEvent *event)
7296
+ bool QgisApp::gestureEvent ( QGestureEvent *event )
7282
7297
{
7283
- if (QGesture *tapAndHold = event->gesture (Qt::TapAndHoldGesture) )
7298
+ if ( QGesture *tapAndHold = event->gesture ( Qt::TapAndHoldGesture ) )
7284
7299
{
7285
- tapAndHoldTriggered (static_cast <QTapAndHoldGesture *>(tapAndHold) );
7300
+ tapAndHoldTriggered ( static_cast <QTapAndHoldGesture *>( tapAndHold ) );
7286
7301
}
7287
7302
return true ;
7288
7303
}
7289
7304
7290
- void QgisApp::tapAndHoldTriggered (QTapAndHoldGesture *gesture)
7305
+ void QgisApp::tapAndHoldTriggered ( QTapAndHoldGesture *gesture )
7291
7306
{
7292
- if (gesture->state () == Qt::GestureFinished) {
7307
+ if ( gesture->state () == Qt::GestureFinished )
7308
+ {
7293
7309
QPoint pos = gesture->position ().toPoint ();
7294
7310
QWidget * receiver = QApplication::widgetAt ( pos );
7295
7311
qDebug () << " tapAndHoldTriggered: LONG CLICK gesture happened at " << pos;
0 commit comments