Skip to content

Commit 7b1983e

Browse files
committed
More node -> vertex moves
1 parent 91a8075 commit 7b1983e

File tree

4 files changed

+127
-127
lines changed

4 files changed

+127
-127
lines changed

src/app/vertextool/qgsvertexeditor.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ QgsVertexEditor::QgsVertexEditor(
278278
QgsSelectedFeature *selectedFeature,
279279
QgsMapCanvas *canvas )
280280
: mUpdatingTableSelection( false )
281-
, mUpdatingNodeSelection( false )
281+
, mUpdatingVertexSelection( false )
282282
{
283283
setWindowTitle( tr( "Vertex Editor" ) );
284284

@@ -287,8 +287,8 @@ QgsVertexEditor::QgsVertexEditor(
287287
mCanvas = canvas;
288288

289289
mTableView = new QTableView( this );
290-
mNodeModel = new QgsVertexEditorModel( mLayer, mSelectedFeature, mCanvas, this );
291-
mTableView->setModel( mNodeModel );
290+
mVertexModel = new QgsVertexEditorModel( mLayer, mSelectedFeature, mCanvas, this );
291+
mTableView->setModel( mVertexModel );
292292

293293
mTableView->setSelectionMode( QTableWidget::ExtendedSelection );
294294
mTableView->setSelectionBehavior( QTableWidget::SelectRows );
@@ -301,12 +301,12 @@ QgsVertexEditor::QgsVertexEditor(
301301
setWidget( mTableView );
302302

303303
connect( mSelectedFeature, &QgsSelectedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
304-
connect( mTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsVertexEditor::updateNodeSelection );
304+
connect( mTableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsVertexEditor::updateVertexSelection );
305305
}
306306

307307
void QgsVertexEditor::updateTableSelection()
308308
{
309-
if ( mUpdatingNodeSelection )
309+
if ( mUpdatingVertexSelection )
310310
return;
311311

312312
mUpdatingTableSelection = true;
@@ -320,42 +320,42 @@ void QgsVertexEditor::updateTableSelection()
320320
{
321321
if ( firstSelectedRow < 0 )
322322
firstSelectedRow = i;
323-
selection.select( mNodeModel->index( i, 0 ), mNodeModel->index( i, mNodeModel->columnCount() - 1 ) );
323+
selection.select( mVertexModel->index( i, 0 ), mVertexModel->index( i, mVertexModel->columnCount() - 1 ) );
324324
}
325325
}
326326
mTableView->selectionModel()->select( selection, QItemSelectionModel::Select );
327327

328328
if ( firstSelectedRow >= 0 )
329-
mTableView->scrollTo( mNodeModel->index( firstSelectedRow, 0 ), QAbstractItemView::PositionAtTop );
329+
mTableView->scrollTo( mVertexModel->index( firstSelectedRow, 0 ), QAbstractItemView::PositionAtTop );
330330

331331
mUpdatingTableSelection = false;
332332
}
333333

334-
void QgsVertexEditor::updateNodeSelection( const QItemSelection &selected, const QItemSelection & )
334+
void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, const QItemSelection & )
335335
{
336336
if ( mUpdatingTableSelection )
337337
return;
338338

339-
mUpdatingNodeSelection = true;
339+
mUpdatingVertexSelection = true;
340340

341341
mSelectedFeature->deselectAllVertices();
342342
Q_FOREACH ( const QModelIndex &index, mTableView->selectionModel()->selectedRows() )
343343
{
344-
int nodeIdx = index.row();
345-
mSelectedFeature->selectVertex( nodeIdx );
344+
int vertexIdx = index.row();
345+
mSelectedFeature->selectVertex( vertexIdx );
346346
}
347347

348-
//ensure that newly selected node is visible in canvas
348+
//ensure that newly selected vertex is visible in canvas
349349
if ( !selected.indexes().isEmpty() )
350350
{
351351
int newRow = selected.indexes().first().row();
352-
zoomToNode( newRow );
352+
zoomToVertex( newRow );
353353
}
354354

355-
mUpdatingNodeSelection = false;
355+
mUpdatingVertexSelection = false;
356356
}
357357

358-
void QgsVertexEditor::zoomToNode( int idx )
358+
void QgsVertexEditor::zoomToVertex( int idx )
359359
{
360360
double x = mSelectedFeature->vertexMap().at( idx )->point().x();
361361
double y = mSelectedFeature->vertexMap().at( idx )->point().y();
@@ -368,8 +368,8 @@ void QgsVertexEditor::zoomToNode( int idx )
368368
//close polygon
369369
ext.append( ext.first() );
370370
QgsGeometry extGeom( QgsGeometry::fromQPolygonF( ext ) );
371-
QgsGeometry nodeGeom( QgsGeometry::fromPointXY( tCenter ) );
372-
if ( !nodeGeom.within( extGeom ) )
371+
QgsGeometry vertexGeom( QgsGeometry::fromPointXY( tCenter ) );
372+
if ( !vertexGeom.within( extGeom ) )
373373
{
374374
mCanvas->setCenter( tCenter );
375375
mCanvas->refresh();

src/app/vertextool/qgsvertexeditor.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class QgsVertexEditorModel : public QAbstractTableModel
3636
public:
3737

3838
QgsVertexEditorModel( QgsVectorLayer *layer,
39-
QgsSelectedFeature *selectedFeature,
40-
QgsMapCanvas *canvas, QObject *parent = nullptr );
39+
QgsSelectedFeature *selectedFeature,
40+
QgsMapCanvas *canvas, QObject *parent = nullptr );
4141

4242
int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
4343
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
@@ -71,15 +71,15 @@ class QgsVertexEditor : public QgsDockWidget
7171
Q_OBJECT
7272
public:
7373
QgsVertexEditor( QgsVectorLayer *layer,
74-
QgsSelectedFeature *selectedFeature,
75-
QgsMapCanvas *canvas );
74+
QgsSelectedFeature *selectedFeature,
75+
QgsMapCanvas *canvas );
7676

7777
public:
7878
QgsVectorLayer *mLayer = nullptr;
7979
QgsSelectedFeature *mSelectedFeature = nullptr;
8080
QgsMapCanvas *mCanvas = nullptr;
8181
QTableView *mTableView = nullptr;
82-
QgsVertexEditorModel *mNodeModel = nullptr;
82+
QgsVertexEditorModel *mVertexModel = nullptr;
8383

8484
signals:
8585
void deleteSelectedRequested();
@@ -89,13 +89,13 @@ class QgsVertexEditor : public QgsDockWidget
8989

9090
private slots:
9191
void updateTableSelection();
92-
void updateNodeSelection( const QItemSelection &selected, const QItemSelection &deselected );
93-
void zoomToNode( int idx );
92+
void updateVertexSelection( const QItemSelection &selected, const QItemSelection &deselected );
93+
void zoomToVertex( int idx );
9494

9595
private:
9696

9797
bool mUpdatingTableSelection;
98-
bool mUpdatingNodeSelection;
98+
bool mUpdatingVertexSelection;
9999
};
100100

101101

0 commit comments

Comments
 (0)