Skip to content
Permalink
Browse files

remove vertex highlighting from editor

  • Loading branch information
3nids committed Feb 25, 2019
1 parent 5b7cb3f commit dfac826f35316f176db2330459358ee8c9d54935
@@ -48,10 +48,6 @@ QgsLockedFeature::QgsLockedFeature( QgsFeatureId featureId,
// rolling back
connect( mLayer, &QgsVectorLayer::beforeRollBack, this, &QgsLockedFeature::beforeRollBack );

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

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

@@ -277,7 +273,7 @@ void QgsLockedFeature::createVertexMap()
QgsPoint pt;
while ( geom->nextVertex( vertexId, pt ) )
{
mVertexMap.append( new QgsVertexEntry( mCanvas, mLayer, pt, vertexId, tr( "ring %1, vertex %2" ).arg( vertexId.ring ).arg( vertexId.vertex ) ) );
mVertexMap.append( new QgsVertexEntry( pt, vertexId ) );
}
}

@@ -338,14 +334,6 @@ void QgsLockedFeature::invertVertexSelection( const QVector<int> &vertexIndices
emit selectionChanged();
}

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

QgsFeatureId QgsLockedFeature::featureId()
{
return mFeatureId;
@@ -24,10 +24,8 @@
class QgsMapCanvas;
class QgsVectorLayer;
class QgsMapLayer;
class QgsRubberBand;
class QgsGeometryValidator;
class QgsVertexMarker;

class QgsVertexEntry;

/**
@@ -136,11 +134,6 @@ class QgsLockedFeature: public QObject
*/
void validationFinished();

/**
* Updates vertex markers position accoording to changed feature geometry
*/
void updateVertexMarkersPosition();

/*
* a feature was removed from the layer - might be the selected
*/
@@ -19,65 +19,19 @@
#include "qgsmaplayer.h"
#include "qgsmapcanvas.h"

QgsVertexEntry::QgsVertexEntry( QgsMapCanvas *canvas, QgsMapLayer *layer, const QgsPoint &p, QgsVertexId vertexId, const QString &tooltip, QgsVertexMarker::IconType type, int penWidth )
QgsVertexEntry::QgsVertexEntry( const QgsPoint &p, QgsVertexId vertexId )
: mSelected( false )
, mPoint( p )
, mVertexId( vertexId )
, mPenWidth( penWidth )
, mToolTip( tooltip )
, mType( type )
, mCanvas( canvas )
, mLayer( layer )
{
placeMarker();
}

QgsVertexEntry::~QgsVertexEntry()
{
delete mMarker;
}

void QgsVertexEntry::placeMarker()
{
QgsPointXY pm = mCanvas->mapSettings().layerToMapCoordinates( mLayer, pointV1() );

if ( mCanvas->extent().contains( pm ) )
{
if ( !mMarker )
{
mMarker = new QgsVertexMarker( mCanvas );
QColor c = mSelected ? QColor( Qt::blue ) : QColor( Qt::red );
if ( mVertexId.type == QgsVertexId::CurveVertex )
{
mMarker->setIconType( QgsVertexMarker::ICON_CIRCLE );
}
else
{
mMarker->setIconType( mType );
}
mMarker->setColor( c );
mMarker->setIconSize( QgsGuiUtils::scaleIconSize( 10 ) );
mMarker->setPenWidth( QgsGuiUtils::scaleIconSize( mPenWidth ) );
mMarker->setToolTip( mToolTip );
}

mMarker->setCenter( pm );
mMarker->update();
}
else if ( mMarker )
{
delete mMarker;
mMarker = nullptr;
}
}

void QgsVertexEntry::setSelected( bool selected )
{
mSelected = selected;
if ( mMarker )
{
QColor c = mSelected ? QColor( Qt::blue ) : QColor( Qt::red );
mMarker->setColor( c );
mMarker->update();
}
}
@@ -17,7 +17,6 @@
#define QGSVERTEXENTRY_H

#include "qgspoint.h"
#include "qgsvertexmarker.h"

class QgsMapLayer;
class QgsMapCanvas;
@@ -27,21 +26,10 @@ class QgsVertexEntry
bool mSelected;
QgsPoint mPoint;
QgsVertexId mVertexId;
int mPenWidth;
QString mToolTip;
QgsVertexMarker::IconType mType;
QgsVertexMarker *mMarker = nullptr;
QgsMapCanvas *mCanvas = nullptr;
QgsMapLayer *mLayer = nullptr;

public:
QgsVertexEntry( QgsMapCanvas *canvas,
QgsMapLayer *layer,
const QgsPoint &p,
QgsVertexId vertexId,
const QString &tooltip = QString(),
QgsVertexMarker::IconType type = QgsVertexMarker::ICON_BOX,
int penWidth = 2 );
QgsVertexEntry( const QgsPoint &p,
QgsVertexId vertexId );
~QgsVertexEntry();

QgsVertexEntry( const QgsVertexEntry &rh ) = delete;
@@ -52,8 +40,6 @@ class QgsVertexEntry
QgsVertexId vertexId() const { return mVertexId; }
bool isSelected() const { return mSelected; }

void placeMarker();

void setSelected( bool selected = true );

};
@@ -65,11 +65,10 @@ class APP_EXPORT QgsVertexTool : public QgsMapToolAdvancedDigitizing
public:

enum VertexToolMode
{
ActiveLayer,

AllLayers
};
Q_ENUM( VertexToolMode );
Q_ENUM( VertexToolMode )

QgsVertexTool( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDock, VertexToolMode mode = QgsVertexTool::AllLayers );

@@ -453,7 +452,11 @@ class APP_EXPORT QgsVertexTool : public QgsMapToolAdvancedDigitizing
};

//! Keeps information about other possible features to select with right click. Null if no info is currently held.
<<<<<<< HEAD
std::unique_ptr<LockedFeatureAlternatives> mLockedFeatureAlternatives;
=======
std::unique_ptr<SelectedFeatureAlternatives> mLockedFeatureAlternatives;
>>>>>>> remove vertex highlighting from editor

// support for validation of geometries

0 comments on commit dfac826

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