mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Fully replace node* by vertex*
This commit is contained in:
parent
5461d3c52a
commit
91a80759bf
@ -130,6 +130,8 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
|
||||
<tr><td>QgsMultiPolylineV2<td>QgsPolyline
|
||||
<tr><td>QgsMultiSurfaceV2<td>QgsMultiSurface
|
||||
<tr><td>QgsNMEAConnection<td>QgsNmeaConnection
|
||||
<tr><td>QgsNodeEditor<td>QgsVertexEditor
|
||||
<tr><td>QgsNodeTool<td>QgsVertexTool
|
||||
<tr><td>QgsNumericScaleBarStyle<td>QgsNumericScaleBarRenderer
|
||||
<tr><td>QgsPoint<td>QgsPointXY
|
||||
<tr><td>QgsPointSequenceV2<td>QgsPointSequence
|
||||
|
@ -273,7 +273,7 @@
|
||||
<file>themes/default/mActionNewSpatiaLiteLayer.svg</file>
|
||||
<file>themes/default/mActionNewGeoPackageLayer.svg</file>
|
||||
<file>themes/default/mActionNewVectorLayer.svg</file>
|
||||
<file>themes/default/mActionNodeTool.svg</file>
|
||||
<file>themes/default/mActionVertexTool.svg</file>
|
||||
<file>themes/default/mActionOffsetCurve.svg</file>
|
||||
<file>themes/default/mActionOpenTable.svg</file>
|
||||
<file>themes/default/mActionAddTable.svg</file>
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@ -230,7 +230,7 @@ Show layout manager action
|
||||
virtual QAction *actionSimplifyFeature() = 0;
|
||||
virtual QAction *actionDeleteRing() = 0;
|
||||
virtual QAction *actionDeletePart() = 0;
|
||||
virtual QAction *actionNodeTool() = 0;
|
||||
virtual QAction *actionVertexTool() = 0;
|
||||
|
||||
virtual QAction *actionPan() = 0;
|
||||
%Docstring
|
||||
|
@ -75,7 +75,7 @@ Unregisters this maptool from the cad dock widget
|
||||
Returns whether functionality of advanced digitizing dock widget is currently allowed.
|
||||
|
||||
Tools may decide to switch this support on/off based on the current state of the map tool.
|
||||
For example, in node tool before user picks a vertex to move, advanced digitizing dock
|
||||
For example, in vertex tool before user picks a vertex to move, advanced digitizing dock
|
||||
widget should be disabled and only enabled once a vertex is being moved. Other map tools
|
||||
may keep advanced digitizing allowed all the time.
|
||||
|
||||
|
@ -106,10 +106,10 @@ SET(QGIS_APP_SRCS
|
||||
qgsmaptoolsvgannotation.cpp
|
||||
qgsmaptooltextannotation.cpp
|
||||
|
||||
nodetool/qgsselectedfeature.cpp
|
||||
nodetool/qgsvertexentry.cpp
|
||||
nodetool/qgsnodeeditor.cpp
|
||||
nodetool/qgsnodetool.cpp
|
||||
vertextool/qgsselectedfeature.cpp
|
||||
vertextool/qgsvertexentry.cpp
|
||||
vertextool/qgsvertexeditor.cpp
|
||||
vertextool/qgsvertextool.cpp
|
||||
|
||||
qgslayerstylingwidget.cpp
|
||||
qgsmeasuredialog.cpp
|
||||
@ -337,9 +337,9 @@ SET (QGIS_APP_MOC_HDRS
|
||||
qgsmaptoolregularpolygoncenterpoint.h
|
||||
qgsmaptoolregularpolygoncentercorner.h
|
||||
|
||||
nodetool/qgsselectedfeature.h
|
||||
nodetool/qgsnodeeditor.h
|
||||
nodetool/qgsnodetool.h
|
||||
vertextool/qgsselectedfeature.h
|
||||
vertextool/qgsvertexeditor.h
|
||||
vertextool/qgsvertextool.h
|
||||
|
||||
qgslayerstylingwidget.h
|
||||
qgsmeasuredialog.h
|
||||
|
@ -396,7 +396,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
|
||||
#include "qgsmaptoolrotatelabel.h"
|
||||
#include "qgsmaptoolchangelabelproperties.h"
|
||||
|
||||
#include "nodetool/qgsnodetool.h"
|
||||
#include "vertextool/qgsvertextool.h"
|
||||
|
||||
// Editor widgets
|
||||
#include "qgseditorwidgetregistry.h"
|
||||
@ -1343,7 +1343,7 @@ QgisApp::~QgisApp()
|
||||
delete mMapTools.mMoveFeature;
|
||||
delete mMapTools.mMoveFeatureCopy;
|
||||
delete mMapTools.mMoveLabel;
|
||||
delete mMapTools.mNodeTool;
|
||||
delete mMapTools.mVertexTool;
|
||||
delete mMapTools.mOffsetCurve;
|
||||
delete mMapTools.mPinLabels;
|
||||
delete mMapTools.mReshapeFeatures;
|
||||
@ -1904,7 +1904,7 @@ void QgisApp::createActions()
|
||||
connect( mActionMergeFeatures, &QAction::triggered, this, &QgisApp::mergeSelectedFeatures );
|
||||
connect( mActionMergeFeatureAttributes, &QAction::triggered, this, &QgisApp::mergeAttributesOfSelectedFeatures );
|
||||
connect( mActionMultiEditAttributes, &QAction::triggered, this, &QgisApp::modifyAttributesOfSelectedFeatures );
|
||||
connect( mActionNodeTool, &QAction::triggered, this, &QgisApp::nodeTool );
|
||||
connect( mActionVertexTool, &QAction::triggered, this, &QgisApp::vertexTool );
|
||||
connect( mActionRotatePointSymbols, &QAction::triggered, this, &QgisApp::rotatePointSymbols );
|
||||
connect( mActionOffsetPointSymbol, &QAction::triggered, this, &QgisApp::offsetPointSymbol );
|
||||
connect( mActionSnappingOptions, &QAction::triggered, this, &QgisApp::snappingOptions );
|
||||
@ -2190,7 +2190,7 @@ void QgisApp::createActionGroups()
|
||||
mMapToolGroup->addAction( mActionDeletePart );
|
||||
mMapToolGroup->addAction( mActionMergeFeatures );
|
||||
mMapToolGroup->addAction( mActionMergeFeatureAttributes );
|
||||
mMapToolGroup->addAction( mActionNodeTool );
|
||||
mMapToolGroup->addAction( mActionVertexTool );
|
||||
mMapToolGroup->addAction( mActionRotatePointSymbols );
|
||||
mMapToolGroup->addAction( mActionOffsetPointSymbol );
|
||||
mMapToolGroup->addAction( mActionPinLabels );
|
||||
@ -2681,7 +2681,7 @@ void QgisApp::createToolBars()
|
||||
tbAddCircularString->addAction( mActionCircularStringRadius );
|
||||
tbAddCircularString->setDefaultAction( mActionCircularStringCurvePoint );
|
||||
connect( tbAddCircularString, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionNodeTool, tbAddCircularString );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionVertexTool, tbAddCircularString );
|
||||
|
||||
//circle digitize tool button
|
||||
QToolButton *tbAddCircle = new QToolButton( mRegularShapeDigitizeToolBar );
|
||||
@ -2693,7 +2693,7 @@ void QgisApp::createToolBars()
|
||||
tbAddCircle->addAction( mActionCircleCenterPoint );
|
||||
tbAddCircle->setDefaultAction( mActionCircle2Points );
|
||||
connect( tbAddCircle, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionNodeTool, tbAddCircle );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionVertexTool, tbAddCircle );
|
||||
|
||||
//ellipse digitize tool button
|
||||
QToolButton *tbAddEllipse = new QToolButton( mRegularShapeDigitizeToolBar );
|
||||
@ -2704,7 +2704,7 @@ void QgisApp::createToolBars()
|
||||
tbAddEllipse->addAction( mActionEllipseFoci );
|
||||
tbAddEllipse->setDefaultAction( mActionEllipseCenter2Points );
|
||||
connect( tbAddEllipse, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionNodeTool, tbAddEllipse );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionVertexTool, tbAddEllipse );
|
||||
|
||||
//Rectangle digitize tool button
|
||||
QToolButton *tbAddRectangle = new QToolButton( mRegularShapeDigitizeToolBar );
|
||||
@ -2714,7 +2714,7 @@ void QgisApp::createToolBars()
|
||||
tbAddRectangle->addAction( mActionRectangle3Points );
|
||||
tbAddRectangle->setDefaultAction( mActionRectangleCenterPoint );
|
||||
connect( tbAddRectangle, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionNodeTool, tbAddRectangle );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionVertexTool, tbAddRectangle );
|
||||
|
||||
//Regular polygon digitize tool button
|
||||
QToolButton *tbAddRegularPolygon = new QToolButton( mRegularShapeDigitizeToolBar );
|
||||
@ -2724,7 +2724,7 @@ void QgisApp::createToolBars()
|
||||
tbAddRegularPolygon->addAction( mActionRegularPolygonCenterCorner );
|
||||
tbAddRegularPolygon->setDefaultAction( mActionRegularPolygon2Points );
|
||||
connect( tbAddRegularPolygon, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionNodeTool, tbAddRegularPolygon );
|
||||
mRegularShapeDigitizeToolBar->insertWidget( mActionVertexTool, tbAddRegularPolygon );
|
||||
|
||||
// move feature tool button
|
||||
QToolButton *moveFeatureButton = new QToolButton( mDigitizeToolBar );
|
||||
@ -2743,7 +2743,7 @@ void QgisApp::createToolBars()
|
||||
};
|
||||
moveFeatureButton->setDefaultAction( defAction );
|
||||
connect( moveFeatureButton, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
|
||||
mDigitizeToolBar->insertWidget( mActionNodeTool, moveFeatureButton );
|
||||
mDigitizeToolBar->insertWidget( mActionVertexTool, moveFeatureButton );
|
||||
|
||||
bt = new QToolButton();
|
||||
bt->setPopupMode( QToolButton::MenuButtonPopup );
|
||||
@ -3051,7 +3051,7 @@ void QgisApp::setTheme( const QString &themeName )
|
||||
mActionSplitFeatures->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSplitFeatures.svg" ) ) );
|
||||
mActionSplitParts->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSplitParts.svg" ) ) );
|
||||
mActionDeleteSelected->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionDeleteSelected.svg" ) ) );
|
||||
mActionNodeTool->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNodeTool.svg" ) ) );
|
||||
mActionVertexTool->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionVertexTool.svg" ) ) );
|
||||
mActionSimplifyFeature->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionSimplify.svg" ) ) );
|
||||
mActionUndo->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionUndo.svg" ) ) );
|
||||
mActionRedo->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRedo.svg" ) ) );
|
||||
@ -3341,8 +3341,8 @@ void QgisApp::createCanvasTools()
|
||||
mMapTools.mDeleteRing->setAction( mActionDeleteRing );
|
||||
mMapTools.mDeletePart = new QgsMapToolDeletePart( mMapCanvas );
|
||||
mMapTools.mDeletePart->setAction( mActionDeletePart );
|
||||
mMapTools.mNodeTool = new QgsNodeTool( mMapCanvas, mAdvancedDigitizingDockWidget );
|
||||
mMapTools.mNodeTool->setAction( mActionNodeTool );
|
||||
mMapTools.mVertexTool = new QgsVertexTool( mMapCanvas, mAdvancedDigitizingDockWidget );
|
||||
mMapTools.mVertexTool->setAction( mActionVertexTool );
|
||||
mMapTools.mRotatePointSymbolsTool = new QgsMapToolRotatePointSymbols( mMapCanvas );
|
||||
mMapTools.mRotatePointSymbolsTool->setAction( mActionRotatePointSymbols );
|
||||
mMapTools.mOffsetPointSymbolTool = new QgsMapToolOffsetPointSymbol( mMapCanvas );
|
||||
@ -7904,9 +7904,9 @@ void QgisApp::mergeSelectedFeatures()
|
||||
vl->triggerRepaint();
|
||||
}
|
||||
|
||||
void QgisApp::nodeTool()
|
||||
void QgisApp::vertexTool()
|
||||
{
|
||||
mMapCanvas->setMapTool( mMapTools.mNodeTool );
|
||||
mMapCanvas->setMapTool( mMapTools.mVertexTool );
|
||||
}
|
||||
|
||||
void QgisApp::rotatePointSymbols()
|
||||
@ -11432,7 +11432,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
|
||||
mActionMoveFeatureCopy->setEnabled( false );
|
||||
mActionRotateFeature->setEnabled( false );
|
||||
mActionOffsetCurve->setEnabled( false );
|
||||
mActionNodeTool->setEnabled( false );
|
||||
mActionVertexTool->setEnabled( false );
|
||||
mActionDeleteSelected->setEnabled( false );
|
||||
mActionCutFeatures->setEnabled( false );
|
||||
mActionCopyFeatures->setEnabled( false );
|
||||
@ -11609,7 +11609,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
|
||||
mActionMoveFeature->setEnabled( isEditable && canChangeGeometry );
|
||||
mActionMoveFeatureCopy->setEnabled( isEditable && canChangeGeometry );
|
||||
mActionRotateFeature->setEnabled( isEditable && canChangeGeometry );
|
||||
mActionNodeTool->setEnabled( isEditable && canChangeGeometry );
|
||||
mActionVertexTool->setEnabled( isEditable && canChangeGeometry );
|
||||
|
||||
if ( vlayer->geometryType() == QgsWkbTypes::PointGeometry )
|
||||
{
|
||||
@ -11763,7 +11763,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
|
||||
mActionAddRing->setEnabled( false );
|
||||
mActionFillRing->setEnabled( false );
|
||||
mActionAddPart->setEnabled( false );
|
||||
mActionNodeTool->setEnabled( false );
|
||||
mActionVertexTool->setEnabled( false );
|
||||
mActionMoveFeature->setEnabled( false );
|
||||
mActionMoveFeatureCopy->setEnabled( false );
|
||||
mActionRotateFeature->setEnabled( false );
|
||||
|
@ -448,7 +448,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
QAction *actionSimplifyFeature() { return mActionSimplifyFeature; }
|
||||
QAction *actionDeleteRing() { return mActionDeleteRing; }
|
||||
QAction *actionDeletePart() { return mActionDeletePart; }
|
||||
QAction *actionNodeTool() { return mActionNodeTool; }
|
||||
QAction *actionVertexTool() { return mActionVertexTool; }
|
||||
QAction *actionSnappingOptions() { return mActionSnappingOptions; }
|
||||
QAction *actionOffsetCurve() { return mActionOffsetCurve; }
|
||||
QAction *actionPan() { return mActionPan; }
|
||||
@ -1343,7 +1343,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
//! Modifies the attributes of selected features via feature form
|
||||
void modifyAttributesOfSelectedFeatures();
|
||||
//! provides operations with nodes
|
||||
void nodeTool();
|
||||
void vertexTool();
|
||||
//! activates the rotate points tool
|
||||
void rotatePointSymbols();
|
||||
//! activates the offset point symbol tool
|
||||
@ -1939,7 +1939,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
QgsMapTool *mSimplifyFeature = nullptr;
|
||||
QgsMapTool *mDeleteRing = nullptr;
|
||||
QgsMapTool *mDeletePart = nullptr;
|
||||
QgsMapTool *mNodeTool = nullptr;
|
||||
QgsMapTool *mVertexTool = nullptr;
|
||||
QgsMapTool *mRotatePointSymbolsTool = nullptr;
|
||||
QgsMapTool *mOffsetPointSymbolTool = nullptr;
|
||||
QgsMapTool *mAnnotation = nullptr;
|
||||
|
@ -603,7 +603,7 @@ QAction *QgisAppInterface::actionAddPart() { return qgis->actionAddPart(); }
|
||||
QAction *QgisAppInterface::actionSimplifyFeature() { return qgis->actionSimplifyFeature(); }
|
||||
QAction *QgisAppInterface::actionDeleteRing() { return qgis->actionDeleteRing(); }
|
||||
QAction *QgisAppInterface::actionDeletePart() { return qgis->actionDeletePart(); }
|
||||
QAction *QgisAppInterface::actionNodeTool() { return qgis->actionNodeTool(); }
|
||||
QAction *QgisAppInterface::actionVertexTool() { return qgis->actionVertexTool(); }
|
||||
|
||||
QAction *QgisAppInterface::actionPan() { return qgis->actionPan(); }
|
||||
QAction *QgisAppInterface::actionPanToSelected() { return qgis->actionPanToSelected(); }
|
||||
|
@ -404,7 +404,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
|
||||
QAction *actionSimplifyFeature() override;
|
||||
QAction *actionDeleteRing() override;
|
||||
QAction *actionDeletePart() override;
|
||||
QAction *actionNodeTool() override;
|
||||
QAction *actionVertexTool() override;
|
||||
|
||||
//! View menu actions
|
||||
QAction *actionPan() override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsselectedfeature.cpp - selected feature of nodetool
|
||||
qgsselectedfeature.cpp - selected feature of vertextool
|
||||
---------------------
|
||||
begin : April 2009
|
||||
copyright : (C) 2009 by Richard Kostecky
|
||||
@ -13,8 +13,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "nodetool/qgsselectedfeature.h"
|
||||
#include "nodetool/qgsvertexentry.h"
|
||||
#include "vertextool/qgsselectedfeature.h"
|
||||
#include "vertextool/qgsvertexentry.h"
|
||||
|
||||
#include "qgsfeatureiterator.h"
|
||||
#include "qgspoint.h"
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsselectedfeature.h - selected feature of nodetool
|
||||
qgsselectedfeature.h - selected feature of vertextool
|
||||
---------------------
|
||||
begin : April 2009
|
||||
copyright : (C) 2009 by Richard Kostecky
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsnodeeditor.cpp
|
||||
qgsvertexeditor.cpp
|
||||
-----------------
|
||||
begin : Tue Mar 24 2015
|
||||
copyright : (C) 2015 Sandro Mani / Sourcepole AG
|
||||
@ -16,7 +16,7 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsnodeeditor.h"
|
||||
#include "qgsvertexeditor.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsselectedfeature.h"
|
||||
#include "qgsvertexentry.h"
|
||||
@ -35,7 +35,7 @@
|
||||
static const int MIN_RADIUS_ROLE = Qt::UserRole + 1;
|
||||
|
||||
|
||||
QgsNodeEditorModel::QgsNodeEditorModel( QgsVectorLayer *layer, QgsSelectedFeature *selectedFeature, QgsMapCanvas *canvas, QObject *parent )
|
||||
QgsVertexEditorModel::QgsVertexEditorModel( QgsVectorLayer *layer, QgsSelectedFeature *selectedFeature, QgsMapCanvas *canvas, QObject *parent )
|
||||
: QAbstractTableModel( parent )
|
||||
, mLayer( layer )
|
||||
, mSelectedFeature( selectedFeature )
|
||||
@ -70,7 +70,7 @@ QgsNodeEditorModel::QgsNodeEditorModel( QgsVectorLayer *layer, QgsSelectedFeatur
|
||||
|
||||
}
|
||||
|
||||
int QgsNodeEditorModel::rowCount( const QModelIndex &parent ) const
|
||||
int QgsVertexEditorModel::rowCount( const QModelIndex &parent ) const
|
||||
{
|
||||
if ( parent.isValid() )
|
||||
return 0;
|
||||
@ -78,13 +78,13 @@ int QgsNodeEditorModel::rowCount( const QModelIndex &parent ) const
|
||||
return mSelectedFeature->vertexMap().count();
|
||||
}
|
||||
|
||||
int QgsNodeEditorModel::columnCount( const QModelIndex &parent ) const
|
||||
int QgsVertexEditorModel::columnCount( const QModelIndex &parent ) const
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
return 2 + ( mHasZ ? 1 : 0 ) + ( mHasM ? 1 : 0 ) + ( mHasR ? 1 : 0 );
|
||||
}
|
||||
|
||||
QVariant QgsNodeEditorModel::data( const QModelIndex &index, int role ) const
|
||||
QVariant QgsVertexEditorModel::data( const QModelIndex &index, int role ) const
|
||||
{
|
||||
if ( !index.isValid() ||
|
||||
( role != Qt::DisplayRole && role != Qt::EditRole && role != MIN_RADIUS_ROLE && role != Qt::FontRole ) )
|
||||
@ -158,7 +158,7 @@ QVariant QgsNodeEditorModel::data( const QModelIndex &index, int role ) const
|
||||
|
||||
}
|
||||
|
||||
QVariant QgsNodeEditorModel::headerData( int section, Qt::Orientation orientation, int role ) const
|
||||
QVariant QgsVertexEditorModel::headerData( int section, Qt::Orientation orientation, int role ) const
|
||||
{
|
||||
if ( role == Qt::DisplayRole )
|
||||
{
|
||||
@ -188,7 +188,7 @@ QVariant QgsNodeEditorModel::headerData( int section, Qt::Orientation orientatio
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsNodeEditorModel::setData( const QModelIndex &index, const QVariant &value, int role )
|
||||
bool QgsVertexEditorModel::setData( const QModelIndex &index, const QVariant &value, int role )
|
||||
{
|
||||
if ( !index.isValid() || role != Qt::EditRole )
|
||||
{
|
||||
@ -234,7 +234,7 @@ bool QgsNodeEditorModel::setData( const QModelIndex &index, const QVariant &valu
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags QgsNodeEditorModel::flags( const QModelIndex &index ) const
|
||||
Qt::ItemFlags QgsVertexEditorModel::flags( const QModelIndex &index ) const
|
||||
{
|
||||
Qt::ItemFlags flags = QAbstractItemModel::flags( index );
|
||||
|
||||
@ -248,7 +248,7 @@ Qt::ItemFlags QgsNodeEditorModel::flags( const QModelIndex &index ) const
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsNodeEditorModel::calcR( int row, double &r, double &minRadius ) const
|
||||
bool QgsVertexEditorModel::calcR( int row, double &r, double &minRadius ) const
|
||||
{
|
||||
if ( row <= 0 || row >= mSelectedFeature->vertexMap().count() - 1 )
|
||||
return false;
|
||||
@ -273,7 +273,7 @@ bool QgsNodeEditorModel::calcR( int row, double &r, double &minRadius ) const
|
||||
}
|
||||
|
||||
|
||||
QgsNodeEditor::QgsNodeEditor(
|
||||
QgsVertexEditor::QgsVertexEditor(
|
||||
QgsVectorLayer *layer,
|
||||
QgsSelectedFeature *selectedFeature,
|
||||
QgsMapCanvas *canvas )
|
||||
@ -287,7 +287,7 @@ QgsNodeEditor::QgsNodeEditor(
|
||||
mCanvas = canvas;
|
||||
|
||||
mTableView = new QTableView( this );
|
||||
mNodeModel = new QgsNodeEditorModel( mLayer, mSelectedFeature, mCanvas, this );
|
||||
mNodeModel = new QgsVertexEditorModel( mLayer, mSelectedFeature, mCanvas, this );
|
||||
mTableView->setModel( mNodeModel );
|
||||
|
||||
mTableView->setSelectionMode( QTableWidget::ExtendedSelection );
|
||||
@ -300,11 +300,11 @@ QgsNodeEditor::QgsNodeEditor(
|
||||
|
||||
setWidget( mTableView );
|
||||
|
||||
connect( mSelectedFeature, &QgsSelectedFeature::selectionChanged, this, &QgsNodeEditor::updateTableSelection );
|
||||
connect( mTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsNodeEditor::updateNodeSelection );
|
||||
connect( mSelectedFeature, &QgsSelectedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
|
||||
connect( mTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsVertexEditor::updateNodeSelection );
|
||||
}
|
||||
|
||||
void QgsNodeEditor::updateTableSelection()
|
||||
void QgsVertexEditor::updateTableSelection()
|
||||
{
|
||||
if ( mUpdatingNodeSelection )
|
||||
return;
|
||||
@ -331,7 +331,7 @@ void QgsNodeEditor::updateTableSelection()
|
||||
mUpdatingTableSelection = false;
|
||||
}
|
||||
|
||||
void QgsNodeEditor::updateNodeSelection( const QItemSelection &selected, const QItemSelection & )
|
||||
void QgsVertexEditor::updateNodeSelection( const QItemSelection &selected, const QItemSelection & )
|
||||
{
|
||||
if ( mUpdatingTableSelection )
|
||||
return;
|
||||
@ -355,7 +355,7 @@ void QgsNodeEditor::updateNodeSelection( const QItemSelection &selected, const Q
|
||||
mUpdatingNodeSelection = false;
|
||||
}
|
||||
|
||||
void QgsNodeEditor::zoomToNode( int idx )
|
||||
void QgsVertexEditor::zoomToNode( int idx )
|
||||
{
|
||||
double x = mSelectedFeature->vertexMap().at( idx )->point().x();
|
||||
double y = mSelectedFeature->vertexMap().at( idx )->point().y();
|
||||
@ -376,7 +376,7 @@ void QgsNodeEditor::zoomToNode( int idx )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeEditor::keyPressEvent( QKeyEvent *e )
|
||||
void QgsVertexEditor::keyPressEvent( QKeyEvent *e )
|
||||
{
|
||||
if ( e->key() == Qt::Key_Backspace || e->key() == Qt::Key_Delete )
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsnodeeditor.h
|
||||
qgsvertexeditor.h
|
||||
---------------
|
||||
begin : Tue Mar 24 2015
|
||||
copyright : (C) 2015 Sandro Mani / Sourcepole AG
|
||||
@ -16,8 +16,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSNODEEDITOR_H
|
||||
#define QGSNODEEDITOR_H
|
||||
#ifndef QGSVERTEXEDITOR_H
|
||||
#define QGSVERTEXEDITOR_H
|
||||
|
||||
#include "qgsdockwidget.h"
|
||||
#include <QAbstractTableModel>
|
||||
@ -30,12 +30,12 @@ class QgsSelectedFeature;
|
||||
class QgsVectorLayer;
|
||||
class QTableView;
|
||||
|
||||
class QgsNodeEditorModel : public QAbstractTableModel
|
||||
class QgsVertexEditorModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
QgsNodeEditorModel( QgsVectorLayer *layer,
|
||||
QgsVertexEditorModel( QgsVectorLayer *layer,
|
||||
QgsSelectedFeature *selectedFeature,
|
||||
QgsMapCanvas *canvas, QObject *parent = nullptr );
|
||||
|
||||
@ -66,11 +66,11 @@ class QgsNodeEditorModel : public QAbstractTableModel
|
||||
|
||||
};
|
||||
|
||||
class QgsNodeEditor : public QgsDockWidget
|
||||
class QgsVertexEditor : public QgsDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsNodeEditor( QgsVectorLayer *layer,
|
||||
QgsVertexEditor( QgsVectorLayer *layer,
|
||||
QgsSelectedFeature *selectedFeature,
|
||||
QgsMapCanvas *canvas );
|
||||
|
||||
@ -79,7 +79,7 @@ class QgsNodeEditor : public QgsDockWidget
|
||||
QgsSelectedFeature *mSelectedFeature = nullptr;
|
||||
QgsMapCanvas *mCanvas = nullptr;
|
||||
QTableView *mTableView = nullptr;
|
||||
QgsNodeEditorModel *mNodeModel = nullptr;
|
||||
QgsVertexEditorModel *mNodeModel = nullptr;
|
||||
|
||||
signals:
|
||||
void deleteSelectedRequested();
|
||||
@ -114,4 +114,4 @@ class CoordinateItemDelegate : public QStyledItemDelegate
|
||||
void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const override;
|
||||
};
|
||||
|
||||
#endif // QGSNODEEDITOR_H
|
||||
#endif // QGSVERTEXEDITOR_H
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvertexentry.cpp - entry for vertex of nodetool
|
||||
qgsvertexentry.cpp - entry for vertex of vertextool
|
||||
---------------------
|
||||
begin : April 2009
|
||||
copyright : (C) 2009 by Richard Kostecky
|
||||
@ -13,7 +13,7 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "nodetool/qgsvertexentry.h"
|
||||
#include "vertextool/qgsvertexentry.h"
|
||||
|
||||
QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, const QgsPoint &p, QgsVertexId vertexId, const QString &tooltip, QgsVertexMarker::IconType type, int penWidth )
|
||||
: mSelected( false )
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvertexentry.h - entry for vertex of nodetool
|
||||
qgsvertexentry.h - entry for vertex of vertextool
|
||||
---------------------
|
||||
begin : April 2009
|
||||
copyright : (C) 2009 by Richard Kostecky
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsnodetool.cpp
|
||||
qgsvertextool.cpp
|
||||
--------------------------------------
|
||||
Date : February 2017
|
||||
Copyright : (C) 2017 by Martin Dobias
|
||||
@ -13,7 +13,7 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsnodetool.h"
|
||||
#include "qgsvertextool.h"
|
||||
|
||||
#include "qgsadvanceddigitizingdockwidget.h"
|
||||
#include "qgscurve.h"
|
||||
@ -35,7 +35,7 @@
|
||||
#include "qgsstatusbar.h"
|
||||
#include "qgisapp.h"
|
||||
#include "qgsselectedfeature.h"
|
||||
#include "qgsnodeeditor.h"
|
||||
#include "qgsvertexeditor.h"
|
||||
#include "qgsvertexentry.h"
|
||||
|
||||
#include <QMenu>
|
||||
@ -162,10 +162,10 @@ class MatchCollectingFilter : public QgsPointLocator::MatchFilter
|
||||
{
|
||||
public:
|
||||
QList<QgsPointLocator::Match> matches;
|
||||
QgsNodeTool *nodetool = nullptr;
|
||||
QgsVertexTool *vertextool = nullptr;
|
||||
|
||||
MatchCollectingFilter( QgsNodeTool *nodetool )
|
||||
: nodetool( nodetool ) {}
|
||||
MatchCollectingFilter( QgsVertexTool *vertextool )
|
||||
: vertextool( vertextool ) {}
|
||||
|
||||
bool acceptMatch( const QgsPointLocator::Match &match ) override
|
||||
{
|
||||
@ -175,7 +175,7 @@ class MatchCollectingFilter : public QgsPointLocator::MatchFilter
|
||||
|
||||
// there may be multiple points at the same location, but we get only one
|
||||
// result... the locator API needs a new method verticesInRect()
|
||||
QgsGeometry matchGeom = nodetool->cachedGeometry( match.layer(), match.featureId() );
|
||||
QgsGeometry matchGeom = vertextool->cachedGeometry( match.layer(), match.featureId() );
|
||||
QgsVertexId vid;
|
||||
QgsPoint pt;
|
||||
while ( matchGeom.constGet()->nextVertex( vid, pt ) )
|
||||
@ -197,7 +197,7 @@ class MatchCollectingFilter : public QgsPointLocator::MatchFilter
|
||||
//
|
||||
|
||||
|
||||
QgsNodeTool::QgsNodeTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDock )
|
||||
QgsVertexTool::QgsVertexTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDock )
|
||||
: QgsMapToolAdvancedDigitizing( canvas, cadDock )
|
||||
{
|
||||
setAdvancedDigitizingAllowed( false );
|
||||
@ -240,7 +240,7 @@ QgsNodeTool::QgsNodeTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget
|
||||
mEndpointMarker->setVisible( false );
|
||||
}
|
||||
|
||||
QgsNodeTool::~QgsNodeTool()
|
||||
QgsVertexTool::~QgsVertexTool()
|
||||
{
|
||||
delete mEdgeCenterMarker;
|
||||
delete mFeatureBand;
|
||||
@ -250,11 +250,11 @@ QgsNodeTool::~QgsNodeTool()
|
||||
delete mEndpointMarker;
|
||||
}
|
||||
|
||||
void QgsNodeTool::deactivate()
|
||||
void QgsVertexTool::deactivate()
|
||||
{
|
||||
setHighlightedNodes( QList<Vertex>() );
|
||||
removeTemporaryRubberBands();
|
||||
cleanupNodeEditor();
|
||||
cleanupVertexEditor();
|
||||
|
||||
mSnapIndicator->setMatch( QgsPointLocator::Match() );
|
||||
|
||||
@ -266,12 +266,12 @@ void QgsNodeTool::deactivate()
|
||||
QgsMapToolAdvancedDigitizing::deactivate();
|
||||
}
|
||||
|
||||
void QgsNodeTool::addDragBand( const QgsPointXY &v1, const QgsPointXY &v2 )
|
||||
void QgsVertexTool::addDragBand( const QgsPointXY &v1, const QgsPointXY &v2 )
|
||||
{
|
||||
addDragStraightBand( nullptr, v1, v2, false, true, v2 );
|
||||
}
|
||||
|
||||
void QgsNodeTool::addDragStraightBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, bool moving0, bool moving1, const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::addDragStraightBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, bool moving0, bool moving1, const QgsPointXY &mapPoint )
|
||||
{
|
||||
// if layer is not null, the input coordinates are coming in the layer's CRS rather than map CRS
|
||||
if ( layer )
|
||||
@ -295,7 +295,7 @@ void QgsNodeTool::addDragStraightBand( QgsVectorLayer *layer, QgsPointXY v0, Qgs
|
||||
mDragStraightBands << b;
|
||||
}
|
||||
|
||||
void QgsNodeTool::addDragCircularBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, QgsPointXY v2, bool moving0, bool moving1, bool moving2, const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::addDragCircularBand( QgsVectorLayer *layer, QgsPointXY v0, QgsPointXY v1, QgsPointXY v2, bool moving0, bool moving1, bool moving2, const QgsPointXY &mapPoint )
|
||||
{
|
||||
// if layer is not null, the input coordinates are coming in the layer's CRS rather than map CRS
|
||||
if ( layer )
|
||||
@ -321,7 +321,7 @@ void QgsNodeTool::addDragCircularBand( QgsVectorLayer *layer, QgsPointXY v0, Qgs
|
||||
mDragCircularBands << b;
|
||||
}
|
||||
|
||||
void QgsNodeTool::clearDragBands()
|
||||
void QgsVertexTool::clearDragBands()
|
||||
{
|
||||
qDeleteAll( mDragPointMarkers );
|
||||
mDragPointMarkers.clear();
|
||||
@ -336,7 +336,7 @@ void QgsNodeTool::clearDragBands()
|
||||
mDragCircularBands.clear();
|
||||
}
|
||||
|
||||
void QgsNodeTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
if ( mSelectionMethod == SelectionRange )
|
||||
{
|
||||
@ -344,7 +344,7 @@ void QgsNodeTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
|
||||
return;
|
||||
}
|
||||
|
||||
cleanupNodeEditor();
|
||||
cleanupVertexEditor();
|
||||
|
||||
if ( !mDraggingVertex && !mSelectedNodes.isEmpty() && !( e->modifiers() & Qt::ShiftModifier ) && !( e->modifiers() & Qt::ControlModifier ) )
|
||||
{
|
||||
@ -407,15 +407,15 @@ void QgsNodeTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
|
||||
if ( mLastMouseMoveMatch.isValid() && mLastMouseMoveMatch.layer() )
|
||||
{
|
||||
QMenu menu;
|
||||
QAction *actionNodeEditor = menu.addAction( tr( "Vertex editor" ) );
|
||||
connect( actionNodeEditor, &QAction::triggered, this, &QgsNodeTool::showNodeEditor );
|
||||
QAction *actionVertexEditor = menu.addAction( tr( "Vertex editor" ) );
|
||||
connect( actionVertexEditor, &QAction::triggered, this, &QgsVertexTool::showVertexEditor );
|
||||
menu.exec( mCanvas->mapToGlobal( e->pos() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
if ( mSelectionMethod == SelectionRange )
|
||||
{
|
||||
@ -504,7 +504,7 @@ void QgsNodeTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
mSelectionRectStartPos.reset();
|
||||
}
|
||||
|
||||
void QgsNodeTool::cadCanvasMoveEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::cadCanvasMoveEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
if ( mSelectionMethod == SelectionRange )
|
||||
{
|
||||
@ -538,7 +538,7 @@ void QgsNodeTool::cadCanvasMoveEvent( QgsMapMouseEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::mouseMoveDraggingVertex( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::mouseMoveDraggingVertex( QgsMapMouseEvent *e )
|
||||
{
|
||||
mSnapIndicator->setMatch( e->mapPointMatch() );
|
||||
mEdgeCenterMarker->setVisible( false );
|
||||
@ -546,7 +546,7 @@ void QgsNodeTool::mouseMoveDraggingVertex( QgsMapMouseEvent *e )
|
||||
moveDragBands( e->mapPoint() );
|
||||
}
|
||||
|
||||
void QgsNodeTool::moveDragBands( const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::moveDragBands( const QgsPointXY &mapPoint )
|
||||
{
|
||||
for ( int i = 0; i < mDragStraightBands.count(); ++i )
|
||||
{
|
||||
@ -575,7 +575,7 @@ void QgsNodeTool::moveDragBands( const QgsPointXY &mapPoint )
|
||||
removeTemporaryRubberBands();
|
||||
}
|
||||
|
||||
void QgsNodeTool::mouseMoveDraggingEdge( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::mouseMoveDraggingEdge( QgsMapMouseEvent *e )
|
||||
{
|
||||
mSnapIndicator->setMatch( QgsPointLocator::Match() );
|
||||
mEdgeCenterMarker->setVisible( false );
|
||||
@ -585,7 +585,7 @@ void QgsNodeTool::mouseMoveDraggingEdge( QgsMapMouseEvent *e )
|
||||
moveDragBands( mapPoint );
|
||||
}
|
||||
|
||||
void QgsNodeTool::canvasDoubleClickEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::canvasDoubleClickEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
QgsPointLocator::Match m = snapToEditableLayer( e );
|
||||
if ( !m.hasEdge() )
|
||||
@ -594,7 +594,7 @@ void QgsNodeTool::canvasDoubleClickEvent( QgsMapMouseEvent *e )
|
||||
mNewVertexFromDoubleClick.reset( new QgsPointLocator::Match( m ) );
|
||||
}
|
||||
|
||||
void QgsNodeTool::removeTemporaryRubberBands()
|
||||
void QgsVertexTool::removeTemporaryRubberBands()
|
||||
{
|
||||
mFeatureBand->setVisible( false );
|
||||
mFeatureBandMarkers->setVisible( false );
|
||||
@ -606,7 +606,7 @@ void QgsNodeTool::removeTemporaryRubberBands()
|
||||
mEndpointMarker->setVisible( false );
|
||||
}
|
||||
|
||||
QgsPointLocator::Match QgsNodeTool::snapToEditableLayer( QgsMapMouseEvent *e )
|
||||
QgsPointLocator::Match QgsVertexTool::snapToEditableLayer( QgsMapMouseEvent *e )
|
||||
{
|
||||
QgsSnappingUtils *snapUtils = canvas()->snappingUtils();
|
||||
QgsSnappingConfig oldConfig = snapUtils->config();
|
||||
@ -683,7 +683,7 @@ QgsPointLocator::Match QgsNodeTool::snapToEditableLayer( QgsMapMouseEvent *e )
|
||||
return m;
|
||||
}
|
||||
|
||||
bool QgsNodeTool::isNearEndpointMarker( const QgsPointXY &mapPoint )
|
||||
bool QgsVertexTool::isNearEndpointMarker( const QgsPointXY &mapPoint )
|
||||
{
|
||||
if ( !mEndpointMarkerCenter )
|
||||
return false;
|
||||
@ -699,7 +699,7 @@ bool QgsNodeTool::isNearEndpointMarker( const QgsPointXY &mapPoint )
|
||||
return distMarker < tol && distMarker < distVertex;
|
||||
}
|
||||
|
||||
bool QgsNodeTool::isMatchAtEndpoint( const QgsPointLocator::Match &match )
|
||||
bool QgsVertexTool::isMatchAtEndpoint( const QgsPointLocator::Match &match )
|
||||
{
|
||||
QgsGeometry geom = cachedGeometry( match.layer(), match.featureId() );
|
||||
|
||||
@ -709,7 +709,7 @@ bool QgsNodeTool::isMatchAtEndpoint( const QgsPointLocator::Match &match )
|
||||
return isEndpointAtVertexIndex( geom, match.vertexIndex() );
|
||||
}
|
||||
|
||||
QgsPointXY QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match &match )
|
||||
QgsPointXY QgsVertexTool::positionForEndpointMarker( const QgsPointLocator::Match &match )
|
||||
{
|
||||
QgsGeometry geom = cachedGeometry( match.layer(), match.featureId() );
|
||||
|
||||
@ -728,7 +728,7 @@ QgsPointXY QgsNodeTool::positionForEndpointMarker( const QgsPointLocator::Match
|
||||
return QgsPointXY( x, y );
|
||||
}
|
||||
|
||||
void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::mouseMoveNotDragging( QgsMapMouseEvent *e )
|
||||
{
|
||||
if ( mMouseAtEndpoint )
|
||||
{
|
||||
@ -839,7 +839,7 @@ void QgsNodeTool::mouseMoveNotDragging( QgsMapMouseEvent *e )
|
||||
updateFeatureBand( m );
|
||||
}
|
||||
|
||||
void QgsNodeTool::updateVertexBand( const QgsPointLocator::Match &m )
|
||||
void QgsVertexTool::updateVertexBand( const QgsPointLocator::Match &m )
|
||||
{
|
||||
if ( m.hasVertex() && m.layer() )
|
||||
{
|
||||
@ -859,7 +859,7 @@ void QgsNodeTool::updateVertexBand( const QgsPointLocator::Match &m )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::updateFeatureBand( const QgsPointLocator::Match &m )
|
||||
void QgsVertexTool::updateFeatureBand( const QgsPointLocator::Match &m )
|
||||
{
|
||||
// highlight feature
|
||||
if ( m.isValid() && m.layer() )
|
||||
@ -885,7 +885,7 @@ void QgsNodeTool::updateFeatureBand( const QgsPointLocator::Match &m )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::keyPressEvent( QKeyEvent *e )
|
||||
void QgsVertexTool::keyPressEvent( QKeyEvent *e )
|
||||
{
|
||||
if ( !mDraggingVertex && !mDraggingEdge && e->key() == Qt::Key_R && e->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
@ -921,12 +921,12 @@ void QgsNodeTool::keyPressEvent( QKeyEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
QgsGeometry QgsNodeTool::cachedGeometry( const QgsVectorLayer *layer, QgsFeatureId fid )
|
||||
QgsGeometry QgsVertexTool::cachedGeometry( const QgsVectorLayer *layer, QgsFeatureId fid )
|
||||
{
|
||||
if ( !mCache.contains( layer ) )
|
||||
{
|
||||
connect( layer, &QgsVectorLayer::geometryChanged, this, &QgsNodeTool::onCachedGeometryChanged );
|
||||
connect( layer, &QgsVectorLayer::featureDeleted, this, &QgsNodeTool::onCachedGeometryDeleted );
|
||||
connect( layer, &QgsVectorLayer::geometryChanged, this, &QgsVertexTool::onCachedGeometryChanged );
|
||||
connect( layer, &QgsVectorLayer::featureDeleted, this, &QgsVertexTool::onCachedGeometryDeleted );
|
||||
// TODO: also clear cache when layer is deleted
|
||||
}
|
||||
|
||||
@ -941,12 +941,12 @@ QgsGeometry QgsNodeTool::cachedGeometry( const QgsVectorLayer *layer, QgsFeature
|
||||
return layerCache[fid];
|
||||
}
|
||||
|
||||
QgsGeometry QgsNodeTool::cachedGeometryForVertex( const Vertex &vertex )
|
||||
QgsGeometry QgsVertexTool::cachedGeometryForVertex( const Vertex &vertex )
|
||||
{
|
||||
return cachedGeometry( vertex.layer, vertex.fid );
|
||||
}
|
||||
|
||||
void QgsNodeTool::onCachedGeometryChanged( QgsFeatureId fid, const QgsGeometry &geom )
|
||||
void QgsVertexTool::onCachedGeometryChanged( QgsFeatureId fid, const QgsGeometry &geom )
|
||||
{
|
||||
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( sender() );
|
||||
Q_ASSERT( mCache.contains( layer ) );
|
||||
@ -961,7 +961,7 @@ void QgsNodeTool::onCachedGeometryChanged( QgsFeatureId fid, const QgsGeometry &
|
||||
validateGeometry( layer, fid );
|
||||
}
|
||||
|
||||
void QgsNodeTool::onCachedGeometryDeleted( QgsFeatureId fid )
|
||||
void QgsVertexTool::onCachedGeometryDeleted( QgsFeatureId fid )
|
||||
{
|
||||
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( sender() );
|
||||
Q_ASSERT( mCache.contains( layer ) );
|
||||
@ -974,23 +974,23 @@ void QgsNodeTool::onCachedGeometryDeleted( QgsFeatureId fid )
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::showNodeEditor()
|
||||
void QgsVertexTool::showVertexEditor()
|
||||
{
|
||||
QgsPointLocator::Match m = mLastMouseMoveMatch;
|
||||
if ( !m.isValid() || !m.layer() )
|
||||
return;
|
||||
|
||||
mSelectedFeature.reset( new QgsSelectedFeature( m.featureId(), m.layer(), mCanvas ) );
|
||||
mNodeEditor.reset( new QgsNodeEditor( m.layer(), mSelectedFeature.get(), mCanvas ) );
|
||||
QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mNodeEditor.get() );
|
||||
connect( mNodeEditor.get(), &QgsNodeEditor::deleteSelectedRequested, this, &QgsNodeTool::deleteNodeEditorSelection );
|
||||
connect( mSelectedFeature.get()->vlayer(), &QgsVectorLayer::featureDeleted, this, [ = ]( QgsFeatureId id ) { if ( mSelectedFeature.get()->featureId() == id ) cleanupNodeEditor(); } );
|
||||
mVertexEditor.reset( new QgsVertexEditor( m.layer(), mSelectedFeature.get(), mCanvas ) );
|
||||
QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mVertexEditor.get() );
|
||||
connect( mVertexEditor.get(), &QgsVertexEditor::deleteSelectedRequested, this, &QgsVertexTool::deleteVertexEditorSelection );
|
||||
connect( mSelectedFeature.get()->vlayer(), &QgsVectorLayer::featureDeleted, this, [ = ]( QgsFeatureId id ) { if ( mSelectedFeature.get()->featureId() == id ) cleanupVertexEditor(); } );
|
||||
}
|
||||
|
||||
void QgsNodeTool::cleanupNodeEditor()
|
||||
void QgsVertexTool::cleanupVertexEditor()
|
||||
{
|
||||
mSelectedFeature.reset();
|
||||
mNodeEditor.reset();
|
||||
mVertexEditor.reset();
|
||||
}
|
||||
|
||||
static int _firstSelectedVertex( QgsSelectedFeature &selectedFeature )
|
||||
@ -1012,7 +1012,7 @@ static void _safeSelectVertex( QgsSelectedFeature &selectedFeature, int vertexNr
|
||||
selectedFeature.selectVertex( ( vertexNr + n ) % n );
|
||||
}
|
||||
|
||||
void QgsNodeTool::deleteNodeEditorSelection()
|
||||
void QgsVertexTool::deleteVertexEditorSelection()
|
||||
{
|
||||
if ( !mSelectedFeature )
|
||||
return;
|
||||
@ -1056,7 +1056,7 @@ void QgsNodeTool::deleteNodeEditorSelection()
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::startDragging( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::startDragging( QgsMapMouseEvent *e )
|
||||
{
|
||||
QgsPointXY mapPoint = toMapCoordinates( e->pos() );
|
||||
if ( isNearEndpointMarker( mapPoint ) )
|
||||
@ -1089,7 +1089,7 @@ void QgsNodeTool::startDragging( QgsMapMouseEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::startDraggingMoveVertex( const QgsPointLocator::Match &m )
|
||||
void QgsVertexTool::startDraggingMoveVertex( const QgsPointLocator::Match &m )
|
||||
{
|
||||
Q_ASSERT( m.hasVertex() );
|
||||
|
||||
@ -1161,7 +1161,7 @@ void QgsNodeTool::startDraggingMoveVertex( const QgsPointLocator::Match &m )
|
||||
buildDragBandsForVertices( movingVertices, dragVertexMapPoint );
|
||||
}
|
||||
|
||||
void QgsNodeTool::buildDragBandsForVertices( const QSet<Vertex> &movingVertices, const QgsPointXY &dragVertexMapPoint )
|
||||
void QgsVertexTool::buildDragBandsForVertices( const QSet<Vertex> &movingVertices, const QgsPointXY &dragVertexMapPoint )
|
||||
{
|
||||
QSet<Vertex> verticesInStraightBands; // always the vertex with lower index
|
||||
|
||||
@ -1288,7 +1288,7 @@ void QgsNodeTool::buildDragBandsForVertices( const QSet<Vertex> &movingVertices,
|
||||
}
|
||||
}
|
||||
|
||||
QList<QgsPointLocator::Match> QgsNodeTool::layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPointXY &mapPoint )
|
||||
QList<QgsPointLocator::Match> QgsVertexTool::layerVerticesSnappedToPoint( QgsVectorLayer *layer, const QgsPointXY &mapPoint )
|
||||
{
|
||||
MatchCollectingFilter myfilter( this );
|
||||
QgsPointLocator *loc = canvas()->snappingUtils()->locatorForLayer( layer );
|
||||
@ -1296,7 +1296,7 @@ QList<QgsPointLocator::Match> QgsNodeTool::layerVerticesSnappedToPoint( QgsVecto
|
||||
return myfilter.matches;
|
||||
}
|
||||
|
||||
void QgsNodeTool::startDraggingAddVertex( const QgsPointLocator::Match &m )
|
||||
void QgsVertexTool::startDraggingAddVertex( const QgsPointLocator::Match &m )
|
||||
{
|
||||
Q_ASSERT( m.hasEdge() );
|
||||
|
||||
@ -1325,7 +1325,7 @@ void QgsNodeTool::startDraggingAddVertex( const QgsPointLocator::Match &m )
|
||||
cadDockWidget()->setPoints( QList<QgsPointXY>() << m.point() << m.point() );
|
||||
}
|
||||
|
||||
void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint )
|
||||
{
|
||||
Q_ASSERT( mMouseAtEndpoint );
|
||||
|
||||
@ -1350,7 +1350,7 @@ void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint )
|
||||
cadDockWidget()->setPoints( QList<QgsPointXY>() << pt0 << pt1 << pt1 );
|
||||
}
|
||||
|
||||
void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint )
|
||||
{
|
||||
Q_ASSERT( m.hasEdge() );
|
||||
|
||||
@ -1390,7 +1390,7 @@ void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsP
|
||||
cadDockWidget()->setPoints( QList<QgsPointXY>() << m.point() << m.point() );
|
||||
}
|
||||
|
||||
void QgsNodeTool::stopDragging()
|
||||
void QgsVertexTool::stopDragging()
|
||||
{
|
||||
// deactivate advanced digitizing
|
||||
setAdvancedDigitizingAllowed( false );
|
||||
@ -1406,7 +1406,7 @@ void QgsNodeTool::stopDragging()
|
||||
mSnapIndicator->setMatch( QgsPointLocator::Match() );
|
||||
}
|
||||
|
||||
QgsPointXY QgsNodeTool::matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPointXY &mapPoint, const QgsPointLocator::Match *match )
|
||||
QgsPointXY QgsVertexTool::matchToLayerPoint( const QgsVectorLayer *destLayer, const QgsPointXY &mapPoint, const QgsPointLocator::Match *match )
|
||||
{
|
||||
// try to use point coordinates in the original CRS if it is the same
|
||||
if ( match && match->hasVertex() && match->layer() && match->layer()->crs() == destLayer->crs() )
|
||||
@ -1421,7 +1421,7 @@ QgsPointXY QgsNodeTool::matchToLayerPoint( const QgsVectorLayer *destLayer, cons
|
||||
return toLayerCoordinates( destLayer, mapPoint );
|
||||
}
|
||||
|
||||
void QgsNodeTool::moveEdge( const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::moveEdge( const QgsPointXY &mapPoint )
|
||||
{
|
||||
stopDragging();
|
||||
|
||||
@ -1431,7 +1431,7 @@ void QgsNodeTool::moveEdge( const QgsPointXY &mapPoint )
|
||||
applyEditsToLayers( edits );
|
||||
}
|
||||
|
||||
void QgsNodeTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match *mapPointMatch )
|
||||
void QgsVertexTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocator::Match *mapPointMatch )
|
||||
{
|
||||
// deactivate advanced digitizing
|
||||
setAdvancedDigitizingAllowed( false );
|
||||
@ -1509,7 +1509,7 @@ void QgsNodeTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocator:
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::addExtraVerticesToEdits( QgsNodeTool::NodeEdits &edits, const QgsPointXY &mapPoint, QgsVectorLayer *dragLayer, const QgsPointXY &layerPoint )
|
||||
void QgsVertexTool::addExtraVerticesToEdits( QgsVertexTool::NodeEdits &edits, const QgsPointXY &mapPoint, QgsVectorLayer *dragLayer, const QgsPointXY &layerPoint )
|
||||
{
|
||||
Q_ASSERT( mDraggingExtraVertices.count() == mDraggingExtraVerticesOffset.count() );
|
||||
// add moved vertices from other layers
|
||||
@ -1546,7 +1546,7 @@ void QgsNodeTool::addExtraVerticesToEdits( QgsNodeTool::NodeEdits &edits, const
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::applyEditsToLayers( QgsNodeTool::NodeEdits &edits )
|
||||
void QgsVertexTool::applyEditsToLayers( QgsVertexTool::NodeEdits &edits )
|
||||
{
|
||||
QHash<QgsVectorLayer *, QHash<QgsFeatureId, QgsGeometry> >::iterator it = edits.begin();
|
||||
for ( ; it != edits.end(); ++it )
|
||||
@ -1563,7 +1563,7 @@ void QgsNodeTool::applyEditsToLayers( QgsNodeTool::NodeEdits &edits )
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::deleteVertex()
|
||||
void QgsVertexTool::deleteVertex()
|
||||
{
|
||||
QSet<Vertex> toDelete;
|
||||
if ( !mSelectedNodes.isEmpty() )
|
||||
@ -1719,7 +1719,7 @@ void QgsNodeTool::deleteVertex()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::setHighlightedNodes( const QList<Vertex> &listNodes, HighlightMode mode )
|
||||
void QgsVertexTool::setHighlightedNodes( const QList<Vertex> &listNodes, HighlightMode mode )
|
||||
{
|
||||
if ( mode == ModeReset )
|
||||
{
|
||||
@ -1780,13 +1780,13 @@ void QgsNodeTool::setHighlightedNodes( const QList<Vertex> &listNodes, Highlight
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::setHighlightedNodesVisible( bool visible )
|
||||
void QgsVertexTool::setHighlightedNodesVisible( bool visible )
|
||||
{
|
||||
for ( QgsVertexMarker *marker : qgis::as_const( mSelectedNodesMarkers ) )
|
||||
marker->setVisible( visible );
|
||||
}
|
||||
|
||||
void QgsNodeTool::highlightAdjacentVertex( double offset )
|
||||
void QgsVertexTool::highlightAdjacentVertex( double offset )
|
||||
{
|
||||
if ( mSelectedNodes.isEmpty() )
|
||||
return;
|
||||
@ -1812,7 +1812,7 @@ void QgsNodeTool::highlightAdjacentVertex( double offset )
|
||||
zoomToNode( node ); // make sure the node is visible
|
||||
}
|
||||
|
||||
void QgsNodeTool::startSelectionRect( const QPoint &point0 )
|
||||
void QgsVertexTool::startSelectionRect( const QPoint &point0 )
|
||||
{
|
||||
Q_ASSERT( !mSelectionRect );
|
||||
mSelectionRect.reset( new QRect() );
|
||||
@ -1820,7 +1820,7 @@ void QgsNodeTool::startSelectionRect( const QPoint &point0 )
|
||||
mSelectionRectItem = new QRubberBand( QRubberBand::Rectangle, canvas() );
|
||||
}
|
||||
|
||||
void QgsNodeTool::updateSelectionRect( const QPoint &point1 )
|
||||
void QgsVertexTool::updateSelectionRect( const QPoint &point1 )
|
||||
{
|
||||
Q_ASSERT( mSelectionRect );
|
||||
mSelectionRect->setBottomRight( point1 );
|
||||
@ -1828,7 +1828,7 @@ void QgsNodeTool::updateSelectionRect( const QPoint &point1 )
|
||||
mSelectionRectItem->show();
|
||||
}
|
||||
|
||||
void QgsNodeTool::stopSelectionRect()
|
||||
void QgsVertexTool::stopSelectionRect()
|
||||
{
|
||||
Q_ASSERT( mSelectionRect );
|
||||
mSelectionRectItem->deleteLater();
|
||||
@ -1836,7 +1836,7 @@ void QgsNodeTool::stopSelectionRect()
|
||||
mSelectionRect.reset();
|
||||
}
|
||||
|
||||
bool QgsNodeTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint, QgsPointXY *edgeCenterPtr )
|
||||
bool QgsVertexTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint, QgsPointXY *edgeCenterPtr )
|
||||
{
|
||||
QgsPointXY p0, p1;
|
||||
m.edgePoints( p0, p1 );
|
||||
@ -1868,7 +1868,7 @@ bool QgsNodeTool::matchEdgeCenterTest( const QgsPointLocator::Match &m, const Qg
|
||||
return isNearCenter;
|
||||
}
|
||||
|
||||
void QgsNodeTool::CircularBand::updateRubberBand( const QgsPointXY &mapPoint )
|
||||
void QgsVertexTool::CircularBand::updateRubberBand( const QgsPointXY &mapPoint )
|
||||
{
|
||||
QgsPointSequence points;
|
||||
QgsPointXY v0 = moving0 ? mapPoint + offset0 : p0;
|
||||
@ -1882,7 +1882,7 @@ void QgsNodeTool::CircularBand::updateRubberBand( const QgsPointXY &mapPoint )
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::validationErrorFound( const QgsGeometry::Error &e )
|
||||
void QgsVertexTool::validationErrorFound( const QgsGeometry::Error &e )
|
||||
{
|
||||
QgsGeometryValidator *validator = qobject_cast<QgsGeometryValidator *>( sender() );
|
||||
if ( !validator )
|
||||
@ -1900,7 +1900,7 @@ void QgsNodeTool::validationErrorFound( const QgsGeometry::Error &e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::validationFinished()
|
||||
void QgsVertexTool::validationFinished()
|
||||
{
|
||||
QgsGeometryValidator *validator = qobject_cast<QgsGeometryValidator *>( sender() );
|
||||
if ( !validator )
|
||||
@ -1925,7 +1925,7 @@ void QgsNodeTool::validationFinished()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::GeometryValidation::start( QgsGeometry &geom, QgsNodeTool *t, QgsVectorLayer *l )
|
||||
void QgsVertexTool::GeometryValidation::start( QgsGeometry &geom, QgsVertexTool *t, QgsVectorLayer *l )
|
||||
{
|
||||
tool = t;
|
||||
layer = l;
|
||||
@ -1935,12 +1935,12 @@ void QgsNodeTool::GeometryValidation::start( QgsGeometry &geom, QgsNodeTool *t,
|
||||
method = QgsGeometry::ValidatorGeos;
|
||||
|
||||
validator = new QgsGeometryValidator( geom, nullptr, method );
|
||||
connect( validator, &QgsGeometryValidator::errorFound, tool, &QgsNodeTool::validationErrorFound );
|
||||
connect( validator, &QThread::finished, tool, &QgsNodeTool::validationFinished );
|
||||
connect( validator, &QgsGeometryValidator::errorFound, tool, &QgsVertexTool::validationErrorFound );
|
||||
connect( validator, &QThread::finished, tool, &QgsVertexTool::validationFinished );
|
||||
validator->start();
|
||||
}
|
||||
|
||||
void QgsNodeTool::GeometryValidation::addError( QgsGeometry::Error e )
|
||||
void QgsVertexTool::GeometryValidation::addError( QgsGeometry::Error e )
|
||||
{
|
||||
if ( !errors.isEmpty() )
|
||||
errors += '\n';
|
||||
@ -1963,7 +1963,7 @@ void QgsNodeTool::GeometryValidation::addError( QgsGeometry::Error e )
|
||||
sb->setToolTip( errors );
|
||||
}
|
||||
|
||||
void QgsNodeTool::GeometryValidation::cleanup()
|
||||
void QgsVertexTool::GeometryValidation::cleanup()
|
||||
{
|
||||
if ( validator )
|
||||
{
|
||||
@ -1977,7 +1977,7 @@ void QgsNodeTool::GeometryValidation::cleanup()
|
||||
errorMarkers.clear();
|
||||
}
|
||||
|
||||
void QgsNodeTool::validateGeometry( QgsVectorLayer *layer, QgsFeatureId featureId )
|
||||
void QgsVertexTool::validateGeometry( QgsVectorLayer *layer, QgsFeatureId featureId )
|
||||
{
|
||||
QgsSettings settings;
|
||||
if ( settings.value( QStringLiteral( "qgis/digitizing/validate_geometries" ), 1 ).toInt() == 0 )
|
||||
@ -1996,7 +1996,7 @@ void QgsNodeTool::validateGeometry( QgsVectorLayer *layer, QgsFeatureId featureI
|
||||
mValidations.insert( id, validation );
|
||||
}
|
||||
|
||||
void QgsNodeTool::zoomToNode( const Vertex &node )
|
||||
void QgsVertexTool::zoomToNode( const Vertex &node )
|
||||
{
|
||||
QgsPointXY newCenter = cachedGeometryForVertex( node ).vertexAt( node.vertexId );
|
||||
QgsPointXY mapPoint = mCanvas->mapSettings().layerToMapCoordinates( node.layer, newCenter );
|
||||
@ -2008,7 +2008,7 @@ void QgsNodeTool::zoomToNode( const Vertex &node )
|
||||
}
|
||||
}
|
||||
|
||||
QList<Vertex> QgsNodeTool::verticesInRange( QgsVectorLayer *layer, QgsFeatureId fid, int vertexId0, int vertexId1, bool longWay )
|
||||
QList<Vertex> QgsVertexTool::verticesInRange( QgsVectorLayer *layer, QgsFeatureId fid, int vertexId0, int vertexId1, bool longWay )
|
||||
{
|
||||
QgsGeometry geom = cachedGeometry( layer, fid );
|
||||
|
||||
@ -2075,13 +2075,13 @@ QList<Vertex> QgsNodeTool::verticesInRange( QgsVectorLayer *layer, QgsFeatureId
|
||||
return lst;
|
||||
}
|
||||
|
||||
void QgsNodeTool::rangeMethodPressEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::rangeMethodPressEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
// nothing to do here for now...
|
||||
Q_UNUSED( e );
|
||||
}
|
||||
|
||||
void QgsNodeTool::rangeMethodReleaseEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::rangeMethodReleaseEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
if ( e->button() == Qt::RightButton )
|
||||
{
|
||||
@ -2118,7 +2118,7 @@ void QgsNodeTool::rangeMethodReleaseEvent( QgsMapMouseEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsNodeTool::rangeMethodMoveEvent( QgsMapMouseEvent *e )
|
||||
void QgsVertexTool::rangeMethodMoveEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
if ( e->buttons() )
|
||||
return; // only with no buttons pressed
|
||||
@ -2149,14 +2149,14 @@ void QgsNodeTool::rangeMethodMoveEvent( QgsMapMouseEvent *e )
|
||||
}
|
||||
|
||||
|
||||
void QgsNodeTool::startRangeVertexSelection()
|
||||
void QgsVertexTool::startRangeVertexSelection()
|
||||
{
|
||||
mSelectionMethod = SelectionRange;
|
||||
setHighlightedNodes( QList<Vertex>() );
|
||||
mRangeSelectionFirstVertex.reset();
|
||||
}
|
||||
|
||||
void QgsNodeTool::stopRangeVertexSelection()
|
||||
void QgsVertexTool::stopRangeVertexSelection()
|
||||
{
|
||||
mSelectionMethod = SelectionNormal;
|
||||
setHighlightedNodes( QList<Vertex>() );
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsnodetool.h
|
||||
qgsvertextool.h
|
||||
--------------------------------------
|
||||
Date : February 2017
|
||||
Copyright : (C) 2017 by Martin Dobias
|
||||
@ -13,8 +13,8 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSNODETOOL_H
|
||||
#define QGSNODETOOL_H
|
||||
#ifndef QGSVERTEXTOOL_H
|
||||
#define QGSVERTEXTOOL_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
class QRubberBand;
|
||||
|
||||
class QgsGeometryValidator;
|
||||
class QgsNodeEditor;
|
||||
class QgsVertexEditor;
|
||||
class QgsSelectedFeature;
|
||||
class QgsSnapIndicator;
|
||||
class QgsVertexMarker;
|
||||
@ -57,14 +57,14 @@ uint qHash( const Vertex &v );
|
||||
|
||||
|
||||
|
||||
class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing
|
||||
class APP_EXPORT QgsVertexTool : public QgsMapToolAdvancedDigitizing
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QgsNodeTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDock );
|
||||
QgsVertexTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDock );
|
||||
|
||||
//! Cleanup canvas items we have created
|
||||
~QgsNodeTool() override;
|
||||
~QgsVertexTool() override;
|
||||
|
||||
void cadCanvasPressEvent( QgsMapMouseEvent *e ) override;
|
||||
|
||||
@ -87,9 +87,9 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing
|
||||
|
||||
void onCachedGeometryDeleted( QgsFeatureId fid );
|
||||
|
||||
void showNodeEditor();
|
||||
void showVertexEditor();
|
||||
|
||||
void deleteNodeEditorSelection();
|
||||
void deleteVertexEditorSelection();
|
||||
|
||||
void validationErrorFound( const QgsGeometry::Error &e );
|
||||
|
||||
@ -200,7 +200,7 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing
|
||||
*/
|
||||
bool matchEdgeCenterTest( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint, QgsPointXY *edgeCenterPtr = nullptr );
|
||||
|
||||
void cleanupNodeEditor();
|
||||
void cleanupVertexEditor();
|
||||
|
||||
//! Run validation on a geometry (in a background thread)
|
||||
void validateGeometry( QgsVectorLayer *layer, QgsFeatureId featureId );
|
||||
@ -369,20 +369,20 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing
|
||||
//! Selected feature for the vertex editor
|
||||
std::unique_ptr<QgsSelectedFeature> mSelectedFeature;
|
||||
//! Dock widget which allows editing vertices
|
||||
std::unique_ptr<QgsNodeEditor> mNodeEditor;
|
||||
std::unique_ptr<QgsVertexEditor> mVertexEditor;
|
||||
|
||||
// support for validation of geometries
|
||||
|
||||
//! data structure for validation of one geometry of a vector layer
|
||||
struct GeometryValidation
|
||||
{
|
||||
QgsNodeTool *tool = nullptr; //!< Pointer to the parent vertex tool (for connections / canvas)
|
||||
QgsVertexTool *tool = nullptr; //!< Pointer to the parent vertex tool (for connections / canvas)
|
||||
QgsVectorLayer *layer = nullptr; //!< Pointer to the layer of the validated geometry (for reporojection)
|
||||
QgsGeometryValidator *validator = nullptr; //!< Object that does validation. Non-null if active
|
||||
QList<QgsVertexMarker *> errorMarkers; //!< Markers created by validation
|
||||
QString errors; //!< Full error text from validation
|
||||
|
||||
void start( QgsGeometry &geom, QgsNodeTool *tool, QgsVectorLayer *l ); //!< Start validation
|
||||
void start( QgsGeometry &geom, QgsVertexTool *tool, QgsVectorLayer *l ); //!< Start validation
|
||||
void addError( QgsGeometry::Error e ); //!< Add another error to the validation
|
||||
void cleanup(); //!< Delete everything
|
||||
};
|
||||
@ -405,4 +405,4 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing
|
||||
};
|
||||
|
||||
|
||||
#endif // QGSNODETOOL_H
|
||||
#endif // QGSVERTEXTOOL_H
|
@ -250,7 +250,7 @@ class GUI_EXPORT QgisInterface : public QObject
|
||||
virtual QAction *actionSimplifyFeature() = 0;
|
||||
virtual QAction *actionDeleteRing() = 0;
|
||||
virtual QAction *actionDeletePart() = 0;
|
||||
virtual QAction *actionNodeTool() = 0;
|
||||
virtual QAction *actionVertexTool() = 0;
|
||||
|
||||
// View menu actions
|
||||
//! Get access to the native pan action. Call trigger() on it to set the default pan map tool.
|
||||
|
@ -67,7 +67,7 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
|
||||
* Returns whether functionality of advanced digitizing dock widget is currently allowed.
|
||||
*
|
||||
* Tools may decide to switch this support on/off based on the current state of the map tool.
|
||||
* For example, in node tool before user picks a vertex to move, advanced digitizing dock
|
||||
* For example, in vertex tool before user picks a vertex to move, advanced digitizing dock
|
||||
* widget should be disabled and only enabled once a vertex is being moved. Other map tools
|
||||
* may keep advanced digitizing allowed all the time.
|
||||
*
|
||||
|
@ -1128,7 +1128,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mActionNodeTool.svg</normaloff>:/images/themes/default/mActionNodeTool.svg</iconset>
|
||||
<normaloff>:/images/themes/default/mActionVertexTool.svg</normaloff>:/images/themes/default/mActionVertexTool.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Nodes Item</string>
|
||||
|
@ -333,7 +333,7 @@
|
||||
<addaction name="mActionSplitParts"/>
|
||||
<addaction name="mActionMergeFeatures"/>
|
||||
<addaction name="mActionMergeFeatureAttributes"/>
|
||||
<addaction name="mActionNodeTool"/>
|
||||
<addaction name="mActionVertexTool"/>
|
||||
<addaction name="mActionRotatePointSymbols"/>
|
||||
<addaction name="mActionOffsetPointSymbol"/>
|
||||
</widget>
|
||||
@ -411,7 +411,7 @@
|
||||
<addaction name="mActionToggleEditing"/>
|
||||
<addaction name="mActionSaveLayerEdits"/>
|
||||
<addaction name="mActionAddFeature"/>
|
||||
<addaction name="mActionNodeTool"/>
|
||||
<addaction name="mActionVertexTool"/>
|
||||
<addaction name="mActionDeleteSelected"/>
|
||||
<addaction name="mActionCutFeatures"/>
|
||||
<addaction name="mActionCopyFeatures"/>
|
||||
@ -967,13 +967,13 @@
|
||||
<string>Merge Attributes of Selected Features</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="mActionNodeTool">
|
||||
<action name="mActionVertexTool">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images/images.qrc">
|
||||
<normaloff>:/images/themes/default/mActionNodeTool.svg</normaloff>:/images/themes/default/mActionNodeTool.svg</iconset>
|
||||
<normaloff>:/images/themes/default/mActionVertexTool.svg</normaloff>:/images/themes/default/mActionVertexTool.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Vertex Tool</string>
|
||||
|
@ -257,7 +257,7 @@ ACCEPTABLE_MISSING_DOCS = {
|
||||
"QgsPointLocator_VisitorNearestEdge": ["QgsPointLocator_VisitorNearestEdge(QgsPointLocator *pl, QgsPointLocator::Match &m, const QgsPointXY &srcPoint, QgsPointLocator::MatchFilter *filter=nullptr)"],
|
||||
"ParametricLine": ["getControlPoint(int number) const =0", "getDegree() const =0", "calcPoint(float t, QgsPoint *p)=0", "calcFirstDer(float t, Vector3D *v)=0", "remove(int i)=0", "setParent(ParametricLine *paral)=0", "calcSecDer(float t, Vector3D *v)=0", "getParent() const =0", "changeDirection()=0", "add(ParametricLine *pl)=0", "getControlPoly() const =0", "setControlPoly(QVector< QgsPoint * > *cp)=0"],
|
||||
"QgsComposerAttributeTable": ["QgsComposerAttributeTable(QgsComposition *composition)"],
|
||||
"QgisInterface": ["helpToolBar()=0", "actionToggleFullScreen()=0", "newLayerMenu()=0", "actionNodeTool()=0", "actionCopyFeatures()=0", "actionNewProject()=0", "actionNewVectorLayer()=0", "actionCancelEdits()=0", "actionSplitParts()=0", "actionShowComposerManager()=0", "actionHelpContents()=0", "actionOpenFieldCalculator()=0", "actionSaveProjectAs()=0", "actionLayerProperties()=0", "helpMenu()=0", "actionSimplifyFeature()=0", "actionAddAllToOverview()=0", "databaseMenu()=0", "actionCheckQgisVersion()=0", "actionSaveProject()=0", "actionCancelAllEdits()=0", "layerTreeView()=0", "advancedDigitizeToolBar()=0", "actionAbout()=0", "webMenu()=0", "actionDuplicateLayer()=0", "actionShowPythonDialog()=0", "vectorToolBar()=0", "actionPasteFeatures()=0", "actionPrintComposer()=0", "actionSplitFeatures()=0", "actionPluginListSeparator()=0", "pluginManagerInterface()=0", "actionRemoveAllFromOverview()=0", "digitizeToolBar()=0", "actionSaveActiveLayerEdits()=0", "firstRightStandardMenu()=0", "projectMenu()=0", "actionProjectProperties()=0", "actionCopyLayerStyle()=0", "actionAllEdits()=0", "actionAddOgrLayer()=0", "actionDeleteRing()=0", "actionAddWmsLayer()=0", "settingsMenu()=0", "actionAddRing()=0", "fileToolBar()=0", "editMenu()=0", "pluginMenu()=0", "mapNavToolToolBar()=0", "vectorMenu()=0", "actionCutFeatures()=0", "actionSaveMapAsImage()=0", "actionMoveFeature()=0", "windowMenu()=0", "actionShowSelectedLayers()=0", "actionDeleteSelected()=0", "actionOptions()=0", "layerToolBar()=0", "actionDeletePart()=0", "actionAddPgLayer()=0", "databaseToolBar()=0", "actionRollbackAllEdits()=0", "actionShowAllLayers()=0", "viewMenu()=0", "actionRollbackEdits()=0", "actionSaveAllEdits()=0", "actionPasteLayerStyle()=0", "actionQgisHomePage()=0", "attributesToolBar()=0", "actionExit()=0", "rasterToolBar()=0", "actionHideAllLayers()=0", "actionAddToOverview()=0", "layerMenu()=0", "actionToggleEditing()=0", "actionLayerSaveAs()=0", "actionManagePlugins()=0", "actionCustomProjection()=0", "rasterMenu()=0", "actionAddPart()=0", "pluginToolBar()=0", "actionRemoveLayer()=0", "actionOpenTable()=0", "actionSaveEdits()=0", "actionOpenProject()=0", "webToolBar()=0", "actionAddFeature()=0", "actionHideSelectedLayers()=0", "actionAddRasterLayer()=0"],
|
||||
"QgisInterface": ["helpToolBar()=0", "actionToggleFullScreen()=0", "newLayerMenu()=0", "actionVertexTool()=0", "actionCopyFeatures()=0", "actionNewProject()=0", "actionNewVectorLayer()=0", "actionCancelEdits()=0", "actionSplitParts()=0", "actionShowComposerManager()=0", "actionHelpContents()=0", "actionOpenFieldCalculator()=0", "actionSaveProjectAs()=0", "actionLayerProperties()=0", "helpMenu()=0", "actionSimplifyFeature()=0", "actionAddAllToOverview()=0", "databaseMenu()=0", "actionCheckQgisVersion()=0", "actionSaveProject()=0", "actionCancelAllEdits()=0", "layerTreeView()=0", "advancedDigitizeToolBar()=0", "actionAbout()=0", "webMenu()=0", "actionDuplicateLayer()=0", "actionShowPythonDialog()=0", "vectorToolBar()=0", "actionPasteFeatures()=0", "actionPrintComposer()=0", "actionSplitFeatures()=0", "actionPluginListSeparator()=0", "pluginManagerInterface()=0", "actionRemoveAllFromOverview()=0", "digitizeToolBar()=0", "actionSaveActiveLayerEdits()=0", "firstRightStandardMenu()=0", "projectMenu()=0", "actionProjectProperties()=0", "actionCopyLayerStyle()=0", "actionAllEdits()=0", "actionAddOgrLayer()=0", "actionDeleteRing()=0", "actionAddWmsLayer()=0", "settingsMenu()=0", "actionAddRing()=0", "fileToolBar()=0", "editMenu()=0", "pluginMenu()=0", "mapNavToolToolBar()=0", "vectorMenu()=0", "actionCutFeatures()=0", "actionSaveMapAsImage()=0", "actionMoveFeature()=0", "windowMenu()=0", "actionShowSelectedLayers()=0", "actionDeleteSelected()=0", "actionOptions()=0", "layerToolBar()=0", "actionDeletePart()=0", "actionAddPgLayer()=0", "databaseToolBar()=0", "actionRollbackAllEdits()=0", "actionShowAllLayers()=0", "viewMenu()=0", "actionRollbackEdits()=0", "actionSaveAllEdits()=0", "actionPasteLayerStyle()=0", "actionQgisHomePage()=0", "attributesToolBar()=0", "actionExit()=0", "rasterToolBar()=0", "actionHideAllLayers()=0", "actionAddToOverview()=0", "layerMenu()=0", "actionToggleEditing()=0", "actionLayerSaveAs()=0", "actionManagePlugins()=0", "actionCustomProjection()=0", "rasterMenu()=0", "actionAddPart()=0", "pluginToolBar()=0", "actionRemoveLayer()=0", "actionOpenTable()=0", "actionSaveEdits()=0", "actionOpenProject()=0", "webToolBar()=0", "actionAddFeature()=0", "actionHideSelectedLayers()=0", "actionAddRasterLayer()=0"],
|
||||
"QgsCollapsibleGroupBoxBasic": ["QgsCollapsibleGroupBoxBasic(const QString &title, QWidget *parent=nullptr)", "checkToggled(bool ckd)", "QgsCollapsibleGroupBoxBasic(QWidget *parent=nullptr)", "init()", "clearModifiers()", "titleRect() const ", "checkClicked(bool ckd)", "updateStyle()", "toggleCollapsed()"],
|
||||
"QgsOptionsDialogBase": ["setSettings(QgsSettings *settings)", "updateOptionsListVerticalTabs()", "optionsStackedWidget_CurrentChanged(int indx)", "warnAboutMissingObjects()", "optionsStackedWidget_WidgetRemoved(int indx)", "updateWindowTitle()"],
|
||||
"QgsAttributeEditor": ["QgsAttributeEditor(QObject *parent, QgsVectorLayer *vl=nullptr, int idx=-1)", "setValue(QWidget *widget, QgsVectorLayer *vl, int idx, const QVariant &value)", "retrieveValue(QWidget *widget, QgsVectorLayer *vl, int idx, QVariant &value)"],
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
/**
|
||||
* \ingroup UnitTests
|
||||
* This is a unit test for the node tool
|
||||
* This is a unit test for the vertex tool
|
||||
*/
|
||||
class TestQgs3DUtils : public QObject
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ bool checkTriangleOutput( const QVector<float> &data, bool withNormals, const QL
|
||||
|
||||
/**
|
||||
* \ingroup UnitTests
|
||||
* This is a unit test for the node tool
|
||||
* This is a unit test for the vertex tool
|
||||
*/
|
||||
class TestQgsTessellator : public QObject
|
||||
{
|
||||
|
@ -100,5 +100,5 @@ ADD_QGIS_TEST(maptoolidentifyaction testqgsmaptoolidentifyaction.cpp)
|
||||
ADD_QGIS_TEST(maptoolselect testqgsmaptoolselect.cpp)
|
||||
ADD_QGIS_TEST(maptoolreshape testqgsmaptoolreshape.cpp)
|
||||
ADD_QGIS_TEST(measuretool testqgsmeasuretool.cpp)
|
||||
ADD_QGIS_TEST(nodetool testqgsnodetool.cpp)
|
||||
ADD_QGIS_TEST(vertextool testqgsvertextool.cpp)
|
||||
ADD_QGIS_TEST(vectorlayersaveasdialogtest testqgsvectorlayersaveasdialog.cpp)
|
||||
|
@ -66,7 +66,7 @@ static QgsFeatureId _newFeatureId( QgsVectorLayer *layer, QSet<QgsFeatureId> old
|
||||
|
||||
/**
|
||||
* \ingroup UnitTests
|
||||
* This is a unit test for the node tool
|
||||
* This is a unit test for the vertex tool
|
||||
*/
|
||||
class TestQgsMapToolAddFeature : public QObject
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
testqgsnodetool.cpp
|
||||
testqgsvertextool.cpp
|
||||
----------------------
|
||||
Date : 2017-03-01
|
||||
Copyright : (C) 2017 by Martin Dobias
|
||||
@ -22,7 +22,7 @@
|
||||
#include "qgsproject.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
#include "nodetool/qgsnodetool.h"
|
||||
#include "vertextool/qgsvertextool.h"
|
||||
|
||||
bool operator==( const QgsGeometry &g1, const QgsGeometry &g2 )
|
||||
{
|
||||
@ -44,13 +44,13 @@ namespace QTest
|
||||
|
||||
/**
|
||||
* \ingroup UnitTests
|
||||
* This is a unit test for the node tool
|
||||
* This is a unit test for the vertex tool
|
||||
*/
|
||||
class TestQgsNodeTool : public QObject
|
||||
class TestQgsVertexTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TestQgsNodeTool();
|
||||
TestQgsVertexTool();
|
||||
|
||||
private slots:
|
||||
void initTestCase();// will be called before the first testfunction is executed.
|
||||
@ -76,19 +76,19 @@ class TestQgsNodeTool : public QObject
|
||||
void mouseMove( double mapX, double mapY )
|
||||
{
|
||||
QgsMapMouseEvent e( mCanvas, QEvent::MouseMove, mapToScreen( mapX, mapY ) );
|
||||
mNodeTool->cadCanvasMoveEvent( &e );
|
||||
mVertexTool->cadCanvasMoveEvent( &e );
|
||||
}
|
||||
|
||||
void mousePress( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
|
||||
{
|
||||
QgsMapMouseEvent e1( mCanvas, QEvent::MouseButtonPress, mapToScreen( mapX, mapY ), button, button, stateKey );
|
||||
mNodeTool->cadCanvasPressEvent( &e1 );
|
||||
mVertexTool->cadCanvasPressEvent( &e1 );
|
||||
}
|
||||
|
||||
void mouseRelease( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
|
||||
{
|
||||
QgsMapMouseEvent e2( mCanvas, QEvent::MouseButtonRelease, mapToScreen( mapX, mapY ), button, Qt::MouseButton(), stateKey );
|
||||
mNodeTool->cadCanvasReleaseEvent( &e2 );
|
||||
mVertexTool->cadCanvasReleaseEvent( &e2 );
|
||||
}
|
||||
|
||||
void mouseClick( double mapX, double mapY, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = Qt::KeyboardModifiers() )
|
||||
@ -100,16 +100,16 @@ class TestQgsNodeTool : public QObject
|
||||
void keyClick( int key )
|
||||
{
|
||||
QKeyEvent e1( QEvent::KeyPress, key, Qt::KeyboardModifiers() );
|
||||
mNodeTool->keyPressEvent( &e1 );
|
||||
mVertexTool->keyPressEvent( &e1 );
|
||||
|
||||
QKeyEvent e2( QEvent::KeyRelease, key, Qt::KeyboardModifiers() );
|
||||
mNodeTool->keyReleaseEvent( &e2 );
|
||||
mVertexTool->keyReleaseEvent( &e2 );
|
||||
}
|
||||
|
||||
private:
|
||||
QgsMapCanvas *mCanvas = nullptr;
|
||||
QgsAdvancedDigitizingDockWidget *mAdvancedDigitizingDockWidget = nullptr;
|
||||
QgsNodeTool *mNodeTool = nullptr;
|
||||
QgsVertexTool *mVertexTool = nullptr;
|
||||
QgsVectorLayer *mLayerLine = nullptr;
|
||||
QgsVectorLayer *mLayerPolygon = nullptr;
|
||||
QgsVectorLayer *mLayerPoint = nullptr;
|
||||
@ -118,11 +118,11 @@ class TestQgsNodeTool : public QObject
|
||||
QgsFeatureId mFidPointF1 = 0;
|
||||
};
|
||||
|
||||
TestQgsNodeTool::TestQgsNodeTool() = default;
|
||||
TestQgsVertexTool::TestQgsVertexTool() = default;
|
||||
|
||||
|
||||
//runs before all tests
|
||||
void TestQgsNodeTool::initTestCase()
|
||||
void TestQgsVertexTool::initTestCase()
|
||||
{
|
||||
qDebug() << "TestQgisAppClipboard::initTestCase()";
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
@ -198,22 +198,22 @@ void TestQgsNodeTool::initTestCase()
|
||||
|
||||
mCanvas->setSnappingUtils( new QgsMapCanvasSnappingUtils( mCanvas, this ) );
|
||||
|
||||
// create node tool
|
||||
mNodeTool = new QgsNodeTool( mCanvas, mAdvancedDigitizingDockWidget );
|
||||
// create vertex tool
|
||||
mVertexTool = new QgsVertexTool( mCanvas, mAdvancedDigitizingDockWidget );
|
||||
|
||||
mCanvas->setMapTool( mNodeTool );
|
||||
mCanvas->setMapTool( mVertexTool );
|
||||
}
|
||||
|
||||
//runs after all tests
|
||||
void TestQgsNodeTool::cleanupTestCase()
|
||||
void TestQgsVertexTool::cleanupTestCase()
|
||||
{
|
||||
delete mNodeTool;
|
||||
delete mVertexTool;
|
||||
delete mAdvancedDigitizingDockWidget;
|
||||
delete mCanvas;
|
||||
QgsApplication::exitQgis();
|
||||
}
|
||||
|
||||
void TestQgsNodeTool::testMoveVertex()
|
||||
void TestQgsVertexTool::testMoveVertex()
|
||||
{
|
||||
QCOMPARE( mCanvas->mapSettings().outputSize(), QSize( 512, 512 ) );
|
||||
QCOMPARE( mCanvas->mapSettings().visibleExtent(), QgsRectangle( 0, 0, 8, 8 ) );
|
||||
@ -290,7 +290,7 @@ void TestQgsNodeTool::testMoveVertex()
|
||||
QCOMPARE( mLayerPoint->undoStack()->index(), 1 );
|
||||
}
|
||||
|
||||
void TestQgsNodeTool::testMoveEdge()
|
||||
void TestQgsVertexTool::testMoveEdge()
|
||||
{
|
||||
// move edge of linestring
|
||||
|
||||
@ -324,7 +324,7 @@ void TestQgsNodeTool::testMoveEdge()
|
||||
}
|
||||
|
||||
|
||||
void TestQgsNodeTool::testAddVertex()
|
||||
void TestQgsVertexTool::testAddVertex()
|
||||
{
|
||||
// add vertex in linestring
|
||||
|
||||
@ -358,9 +358,9 @@ void TestQgsNodeTool::testAddVertex()
|
||||
}
|
||||
|
||||
|
||||
void TestQgsNodeTool::testAddVertexAtEndpoint()
|
||||
void TestQgsVertexTool::testAddVertexAtEndpoint()
|
||||
{
|
||||
// offset of the endpoint marker - currently set as 15px away from the last node in direction of the line
|
||||
// offset of the endpoint marker - currently set as 15px away from the last vertex in direction of the line
|
||||
double offsetInMapUnits = 15 * mCanvas->mapSettings().mapUnitsPerPixel();
|
||||
|
||||
// add vertex at the end
|
||||
@ -393,7 +393,7 @@ void TestQgsNodeTool::testAddVertexAtEndpoint()
|
||||
}
|
||||
|
||||
|
||||
void TestQgsNodeTool::testDeleteVertex()
|
||||
void TestQgsVertexTool::testDeleteVertex()
|
||||
{
|
||||
// delete vertex in linestring
|
||||
|
||||
@ -453,7 +453,7 @@ void TestQgsNodeTool::testDeleteVertex()
|
||||
QCOMPARE( mLayerPoint->undoStack()->index(), 1 );
|
||||
}
|
||||
|
||||
void TestQgsNodeTool::testMoveMultipleVertices()
|
||||
void TestQgsVertexTool::testMoveMultipleVertices()
|
||||
{
|
||||
// select two vertices
|
||||
mousePress( 0.5, 0.5, Qt::LeftButton );
|
||||
@ -473,7 +473,7 @@ void TestQgsNodeTool::testMoveMultipleVertices()
|
||||
QCOMPARE( mLayerLine->getFeature( mFidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 3)" ) );
|
||||
}
|
||||
|
||||
void TestQgsNodeTool::testMoveVertexTopo()
|
||||
void TestQgsVertexTool::testMoveVertexTopo()
|
||||
{
|
||||
// test moving of vertices of two features at once
|
||||
|
||||
@ -483,7 +483,7 @@ void TestQgsNodeTool::testMoveVertexTopo()
|
||||
mouseClick( 4, 1, Qt::LeftButton );
|
||||
mouseClick( 2, 1, Qt::LeftButton );
|
||||
|
||||
// move shared node of linestring and polygon
|
||||
// move shared vertex of linestring and polygon
|
||||
mouseClick( 2, 1, Qt::LeftButton );
|
||||
mouseClick( 3, 3, Qt::LeftButton );
|
||||
|
||||
@ -491,7 +491,7 @@ void TestQgsNodeTool::testMoveVertexTopo()
|
||||
QCOMPARE( mLayerPolygon->getFeature( mFidPolygonF1 ).geometry(), QgsGeometry::fromWkt( "POLYGON((3 3, 7 1, 7 4, 4 4, 3 3))" ) );
|
||||
|
||||
QCOMPARE( mLayerLine->undoStack()->index(), 2 );
|
||||
QCOMPARE( mLayerPolygon->undoStack()->index(), 3 ); // one more move of node from earlier
|
||||
QCOMPARE( mLayerPolygon->undoStack()->index(), 3 ); // one more move of vertex from earlier
|
||||
mLayerLine->undoStack()->undo();
|
||||
mLayerPolygon->undoStack()->undo();
|
||||
mLayerPolygon->undoStack()->undo();
|
||||
@ -502,7 +502,7 @@ void TestQgsNodeTool::testMoveVertexTopo()
|
||||
QgsProject::instance()->setTopologicalEditing( false );
|
||||
}
|
||||
|
||||
void TestQgsNodeTool::testDeleteVertexTopo()
|
||||
void TestQgsVertexTool::testDeleteVertexTopo()
|
||||
{
|
||||
// test deletion of vertices with topological editing enabled
|
||||
|
||||
@ -512,7 +512,7 @@ void TestQgsNodeTool::testDeleteVertexTopo()
|
||||
mouseClick( 4, 1, Qt::LeftButton );
|
||||
mouseClick( 2, 1, Qt::LeftButton );
|
||||
|
||||
// move shared node of linestring and polygon
|
||||
// move shared vertex of linestring and polygon
|
||||
mouseClick( 2, 1, Qt::LeftButton );
|
||||
keyClick( Qt::Key_Delete );
|
||||
|
||||
@ -520,7 +520,7 @@ void TestQgsNodeTool::testDeleteVertexTopo()
|
||||
QCOMPARE( mLayerPolygon->getFeature( mFidPolygonF1 ).geometry(), QgsGeometry::fromWkt( "POLYGON((7 1, 7 4, 4 4, 7 1))" ) );
|
||||
|
||||
QCOMPARE( mLayerLine->undoStack()->index(), 2 );
|
||||
QCOMPARE( mLayerPolygon->undoStack()->index(), 3 ); // one more move of node from earlier
|
||||
QCOMPARE( mLayerPolygon->undoStack()->index(), 3 ); // one more move of vertex from earlier
|
||||
mLayerLine->undoStack()->undo();
|
||||
mLayerPolygon->undoStack()->undo();
|
||||
mLayerPolygon->undoStack()->undo();
|
||||
@ -531,7 +531,7 @@ void TestQgsNodeTool::testDeleteVertexTopo()
|
||||
QgsProject::instance()->setTopologicalEditing( false );
|
||||
}
|
||||
|
||||
void TestQgsNodeTool::testActiveLayerPriority()
|
||||
void TestQgsVertexTool::testActiveLayerPriority()
|
||||
{
|
||||
// check that features from current layer get priority when picking points
|
||||
|
||||
@ -576,5 +576,5 @@ void TestQgsNodeTool::testActiveLayerPriority()
|
||||
QgsProject::instance()->removeMapLayer( layerLine2 );
|
||||
}
|
||||
|
||||
QGSTEST_MAIN( TestQgsNodeTool )
|
||||
#include "testqgsnodetool.moc"
|
||||
QGSTEST_MAIN( TestQgsVertexTool )
|
||||
#include "testqgsvertextool.moc"
|
Loading…
x
Reference in New Issue
Block a user