Skip to content
Permalink
Browse files

also rename file and class

  • Loading branch information
3nids committed Feb 25, 2019
1 parent 0a2d3ba commit 36fc62cfcab5012feb211552c15741fa05efd113
@@ -120,7 +120,7 @@ SET(QGIS_APP_SRCS
decorations/qgsdecorationgrid.cpp
decorations/qgsdecorationgriddialog.cpp

vertextool/qgsselectedfeature.cpp
vertextool/qgslockedfeature.cpp
vertextool/qgsvertexentry.cpp
vertextool/qgsvertexeditor.cpp
vertextool/qgsvertextool.cpp
@@ -372,7 +372,7 @@ SET (QGIS_APP_MOC_HDRS
decorations/qgsdecorationgrid.h
decorations/qgsdecorationgriddialog.h

vertextool/qgsselectedfeature.h
vertextool/qgslockedfeature.h
vertextool/qgsvertexeditor.h
vertextool/qgsvertextool.h

@@ -1,5 +1,5 @@
/***************************************************************************
qgsselectedfeature.cpp - selected feature of vertextool
qgslockedfeature.cpp - locked feature of vertextool
---------------------
begin : April 2009
copyright : (C) 2009 by Richard Kostecky
@@ -13,7 +13,7 @@
* *
***************************************************************************/

#include "vertextool/qgsselectedfeature.h"
#include "vertextool/qgslockedfeature.h"
#include "vertextool/qgsvertexentry.h"

#include "qgsfeatureiterator.h"
@@ -32,16 +32,16 @@
#include "qgsmapcanvas.h"


QgsSelectedFeature::QgsSelectedFeature( QgsFeatureId featureId,
QgsVectorLayer *vlayer,
QgsMapCanvas *canvas )
QgsLockedFeature::QgsLockedFeature( QgsFeatureId featureId,
QgsVectorLayer *vlayer,
QgsMapCanvas *canvas )
: mFeatureId( featureId )
, mChangingGeometry( false )
{
setSelectedFeature( featureId, vlayer, canvas );
}

QgsSelectedFeature::~QgsSelectedFeature()
QgsLockedFeature::~QgsLockedFeature()
{
deleteVertexMap();

@@ -61,13 +61,13 @@ QgsSelectedFeature::~QgsSelectedFeature()
delete mGeometry;
}

void QgsSelectedFeature::currentLayerChanged( QgsMapLayer *layer )
void QgsLockedFeature::currentLayerChanged( QgsMapLayer *layer )
{
if ( layer == mLayer )
deleteLater();
}

void QgsSelectedFeature::updateGeometry( const QgsGeometry *geom )
void QgsLockedFeature::updateGeometry( const QgsGeometry *geom )
{
delete mGeometry;

@@ -86,7 +86,7 @@ void QgsSelectedFeature::updateGeometry( const QgsGeometry *geom )
}
}

void QgsSelectedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLayer *layer, QgsMapCanvas *canvas )
void QgsLockedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLayer *layer, QgsMapCanvas *canvas )
{
mFeatureId = featureId;
mLayer = layer;
@@ -96,58 +96,58 @@ void QgsSelectedFeature::setSelectedFeature( QgsFeatureId featureId, QgsVectorLa
mGeometry = nullptr;

// signal changing of current layer
connect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, this, &QgsSelectedFeature::currentLayerChanged );
connect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, this, &QgsLockedFeature::currentLayerChanged );

// feature was deleted
connect( mLayer, &QgsVectorLayer::featureDeleted, this, &QgsSelectedFeature::featureDeleted );
connect( mLayer, &QgsVectorLayer::featureDeleted, this, &QgsLockedFeature::featureDeleted );

// rolling back
connect( mLayer, &QgsVectorLayer::beforeRollBack, this, &QgsSelectedFeature::beforeRollBack );
connect( mLayer, &QgsVectorLayer::beforeRollBack, this, &QgsLockedFeature::beforeRollBack );

// projection or extents changed
connect( canvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsSelectedFeature::updateVertexMarkersPosition );
connect( canvas, &QgsMapCanvas::extentsChanged, this, &QgsSelectedFeature::updateVertexMarkersPosition );
connect( canvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsLockedFeature::updateVertexMarkersPosition );
connect( canvas, &QgsMapCanvas::extentsChanged, this, &QgsLockedFeature::updateVertexMarkersPosition );

// geometry was changed
connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged );
connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsLockedFeature::geometryChanged );

replaceVertexMap();
}

void QgsSelectedFeature::beforeRollBack()
void QgsLockedFeature::beforeRollBack()
{
disconnect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged );
disconnect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsLockedFeature::geometryChanged );
deleteVertexMap();
}

void QgsSelectedFeature::beginGeometryChange()
void QgsLockedFeature::beginGeometryChange()
{
Q_ASSERT( !mChangingGeometry );
mChangingGeometry = true;

disconnect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged );
disconnect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsLockedFeature::geometryChanged );
}

void QgsSelectedFeature::endGeometryChange()
void QgsLockedFeature::endGeometryChange()
{
Q_ASSERT( mChangingGeometry );
mChangingGeometry = false;

connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsSelectedFeature::geometryChanged );
connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsLockedFeature::geometryChanged );
}

void QgsSelectedFeature::canvasLayersChanged()
void QgsLockedFeature::canvasLayersChanged()
{
currentLayerChanged( mCanvas->currentLayer() );
}

void QgsSelectedFeature::featureDeleted( QgsFeatureId fid )
void QgsLockedFeature::featureDeleted( QgsFeatureId fid )
{
if ( fid == mFeatureId )
deleteLater();
}

void QgsSelectedFeature::geometryChanged( QgsFeatureId fid, const QgsGeometry &geom )
void QgsLockedFeature::geometryChanged( QgsFeatureId fid, const QgsGeometry &geom )
{
QgsDebugCall;

@@ -159,7 +159,7 @@ void QgsSelectedFeature::geometryChanged( QgsFeatureId fid, const QgsGeometry &g
replaceVertexMap();
}

void QgsSelectedFeature::validateGeometry( QgsGeometry *g )
void QgsLockedFeature::validateGeometry( QgsGeometry *g )
{
QgsSettings settings;
if ( settings.value( QStringLiteral( "qgis/digitizing/validate_geometries" ), 1 ).toInt() == 0 )
@@ -190,15 +190,15 @@ void QgsSelectedFeature::validateGeometry( QgsGeometry *g )
if ( settings.value( QStringLiteral( "qgis/digitizing/validate_geometries" ), 1 ).toInt() == 2 )
method = QgsGeometry::ValidatorGeos;
mValidator = new QgsGeometryValidator( *g, nullptr, method );
connect( mValidator, &QgsGeometryValidator::errorFound, this, &QgsSelectedFeature::addError );
connect( mValidator, &QThread::finished, this, &QgsSelectedFeature::validationFinished );
connect( mValidator, &QgsGeometryValidator::errorFound, this, &QgsLockedFeature::addError );
connect( mValidator, &QThread::finished, this, &QgsLockedFeature::validationFinished );
mValidator->start();

QgsStatusBar *sb = QgisApp::instance()->statusBarIface();
sb->showMessage( tr( "Validation started." ) );
}

void QgsSelectedFeature::addError( QgsGeometry::Error e )
void QgsLockedFeature::addError( QgsGeometry::Error e )
{
mGeomErrors << e;
if ( !mTip.isEmpty() )
@@ -223,13 +223,13 @@ void QgsSelectedFeature::addError( QgsGeometry::Error e )
sb->setToolTip( mTip );
}

void QgsSelectedFeature::validationFinished()
void QgsLockedFeature::validationFinished()
{
QgsStatusBar *sb = QgisApp::instance()->statusBarIface();
sb->showMessage( tr( "Validation finished (%n error(s) found).", "number of geometry errors", mGeomErrorMarkers.size() ) );
}

void QgsSelectedFeature::replaceVertexMap()
void QgsLockedFeature::replaceVertexMap()
{
// delete old map
deleteVertexMap();
@@ -243,7 +243,7 @@ void QgsSelectedFeature::replaceVertexMap()
emit vertexMapChanged();
}

void QgsSelectedFeature::deleteVertexMap()
void QgsLockedFeature::deleteVertexMap()
{
Q_FOREACH ( QgsVertexEntry *entry, mVertexMap )
{
@@ -253,18 +253,18 @@ void QgsSelectedFeature::deleteVertexMap()
mVertexMap.clear();
}

bool QgsSelectedFeature::isSelected( int vertexNr )
bool QgsLockedFeature::isSelected( int vertexNr )
{
return mVertexMap.at( vertexNr )->isSelected();
}

QgsGeometry *QgsSelectedFeature::geometry()
QgsGeometry *QgsLockedFeature::geometry()
{
Q_ASSERT( mGeometry );
return mGeometry;
}

void QgsSelectedFeature::createVertexMap()
void QgsLockedFeature::createVertexMap()
{

if ( !mGeometry )
@@ -292,7 +292,7 @@ void QgsSelectedFeature::createVertexMap()
}
}

void QgsSelectedFeature::selectVertex( int vertexNr )
void QgsLockedFeature::selectVertex( int vertexNr )
{
if ( vertexNr < 0 || vertexNr >= mVertexMap.size() )
return;
@@ -303,7 +303,7 @@ void QgsSelectedFeature::selectVertex( int vertexNr )
emit selectionChanged();
}

void QgsSelectedFeature::deselectVertex( int vertexNr )
void QgsLockedFeature::deselectVertex( int vertexNr )
{
if ( vertexNr < 0 || vertexNr >= mVertexMap.size() )
return;
@@ -314,7 +314,7 @@ void QgsSelectedFeature::deselectVertex( int vertexNr )
emit selectionChanged();
}

void QgsSelectedFeature::deselectAllVertices()
void QgsLockedFeature::deselectAllVertices()
{
for ( int i = 0; i < mVertexMap.size(); i++ )
{
@@ -323,7 +323,7 @@ void QgsSelectedFeature::deselectAllVertices()
emit selectionChanged();
}

void QgsSelectedFeature::invertVertexSelection( int vertexNr )
void QgsLockedFeature::invertVertexSelection( int vertexNr )
{
if ( vertexNr < 0 || vertexNr >= mVertexMap.size() )
return;
@@ -336,7 +336,7 @@ void QgsSelectedFeature::invertVertexSelection( int vertexNr )
emit selectionChanged();
}

void QgsSelectedFeature::invertVertexSelection( const QVector<int> &vertexIndices )
void QgsLockedFeature::invertVertexSelection( const QVector<int> &vertexIndices )
{
Q_FOREACH ( int index, vertexIndices )
{
@@ -349,25 +349,25 @@ void QgsSelectedFeature::invertVertexSelection( const QVector<int> &vertexIndice
emit selectionChanged();
}

void QgsSelectedFeature::updateVertexMarkersPosition()
void QgsLockedFeature::updateVertexMarkersPosition()
{
Q_FOREACH ( QgsVertexEntry *vertexEntry, mVertexMap )
{
vertexEntry->placeMarker();
}
}

QgsFeatureId QgsSelectedFeature::featureId()
QgsFeatureId QgsLockedFeature::featureId()
{
return mFeatureId;
}

QList<QgsVertexEntry *> &QgsSelectedFeature::vertexMap()
QList<QgsVertexEntry *> &QgsLockedFeature::vertexMap()
{
return mVertexMap;
}

QgsVectorLayer *QgsSelectedFeature::layer()
QgsVectorLayer *QgsLockedFeature::layer()
{
return mLayer;
}
@@ -1,5 +1,5 @@
/***************************************************************************
qgsselectedfeature.h - selected feature of vertextool
qgslockedfeature.h - selected feature of vertextool
---------------------
begin : April 2009
copyright : (C) 2009 by Richard Kostecky
@@ -13,8 +13,8 @@
* *
***************************************************************************/

#ifndef QGSSELECTEDFEATURE_H
#define QGSSELECTEDFEATURE_H
#ifndef QGSLOCKEDFEATURE_H
#define QGSLOCKEDFEATURE_H

#include "qgsgeometry.h"
#include "qgsfeatureid.h"
@@ -38,13 +38,13 @@ static const double ZERO_TOLERANCE = 0.000000001;
/**
* Class that keeps the selected feature
*/
class QgsSelectedFeature: public QObject
class QgsLockedFeature: public QObject
{
Q_OBJECT

public:
QgsSelectedFeature( QgsFeatureId id, QgsVectorLayer *layer, QgsMapCanvas *canvas );
~QgsSelectedFeature() override;
QgsLockedFeature( QgsFeatureId id, QgsVectorLayer *layer, QgsMapCanvas *canvas );
~QgsLockedFeature() override;

/**
* Setting selected feature
@@ -19,7 +19,7 @@
#include "qgsvertexeditor.h"
#include "qgsmapcanvas.h"
#include "qgsmessagelog.h"
#include "qgsselectedfeature.h"
#include "qgslockedfeature.h"
#include "qgsvertexentry.h"
#include "qgsvectorlayer.h"
#include "qgsgeometryutils.h"
@@ -47,7 +47,7 @@ QgsVertexEditorModel::QgsVertexEditorModel( QgsMapCanvas *canvas, QObject *paren
mWidgetFont = parentWidget->font();
}

void QgsVertexEditorModel::setFeature( QgsSelectedFeature *selectedFeature )
void QgsVertexEditorModel::setFeature( QgsLockedFeature *selectedFeature )
{
beginResetModel();

@@ -332,7 +332,7 @@ QgsVertexEditor::QgsVertexEditor( QgsMapCanvas *canvas )
setWidget( content );
}

void QgsVertexEditor::updateEditor( QgsSelectedFeature *selectedFeature )
void QgsVertexEditor::updateEditor( QgsLockedFeature *selectedFeature )
{

mSelectedFeature = selectedFeature;
@@ -344,7 +344,7 @@ void QgsVertexEditor::updateEditor( QgsSelectedFeature *selectedFeature )
mHintLabel->setVisible( false );
mTableView->setVisible( true );

connect( mSelectedFeature, &QgsSelectedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
connect( mSelectedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
}
else
{

0 comments on commit 36fc62c

Please sign in to comment.
You can’t perform that action at this time.