Skip to content
Permalink
Browse files
Slightly improved markers for highlighted nodes and circular nodes
  • Loading branch information
wonder-sk committed Apr 5, 2017
1 parent 52113d7 commit 61ace1cc61be79083b88030da79b6ef7d7bed0a9
Showing with 34 additions and 3 deletions.
  1. +3 −1 python/gui/qgsrubberband.sip
  2. +2 −1 src/app/nodetool/qgsnodetool2.cpp
  3. +16 −0 src/gui/qgsrubberband.cpp
  4. +13 −1 src/gui/qgsrubberband.h
@@ -13,7 +13,9 @@ class QgsRubberBand: QgsMapCanvasItem
ICON_X,
ICON_BOX,
ICON_CIRCLE,
ICON_FULL_BOX
ICON_FULL_BOX,
ICON_DIAMOND,
ICON_FULL_DIAMOND
};

QgsRubberBand( QgsMapCanvas* mapCanvas /TransferThis/, QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::LineGeometry );
@@ -656,7 +656,7 @@ void QgsNodeTool2::mouseMoveNotDragging( QgsMapMouseEvent *e )
isCircular = isCircularVertex( cachedGeometry( m.layer(), m.featureId() ), m.vertexIndex() );
}

mVertexBand->setIcon( isCircular ? QgsRubberBand::ICON_FULL_BOX : QgsRubberBand::ICON_CIRCLE );
mVertexBand->setIcon( isCircular ? QgsRubberBand::ICON_FULL_DIAMOND : QgsRubberBand::ICON_CIRCLE );
// if we are at an endpoint, let's show also the endpoint indicator
// so user can possibly add a new vertex at the end
if ( isMatchAtEndpoint( m ) )
@@ -1436,6 +1436,7 @@ void QgsNodeTool2::setHighlightedNodes( const QList<Vertex> &listNodes )
marker->setIconType( QgsVertexMarker::ICON_CIRCLE );
marker->setPenWidth( 3 );
marker->setColor( Qt::blue );
marker->setFillColor( Qt::blue );
marker->setCenter( toMapCoordinates( node.layer, geom.vertexAt( node.vertexId ) ) );
mSelectedNodesMarkers.append( marker );
}
@@ -519,6 +519,22 @@ void QgsRubberBand::drawShape( QPainter *p, QVector<QPointF> &pts )
case ICON_CIRCLE:
p->drawEllipse( x - s, y - s, mIconSize, mIconSize );
break;

case ICON_DIAMOND:
case ICON_FULL_DIAMOND:
{
QPointF pts[] =
{
QPointF( x, y - s ),
QPointF( x + s, y ),
QPointF( x, y + s ),
QPointF( x - s, y )
};
if ( mIconType == ICON_FULL_DIAMOND )
p->drawPolygon( pts, 4 );
else
p->drawPolyline( pts, 4 );
}
}
}
}
@@ -66,7 +66,19 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
/**
* A full box is used to highlight points (■)
*/
ICON_FULL_BOX
ICON_FULL_BOX,

/**
* A diamond is used to highlight points (◇)
* @note added in QGIS 3.0
*/
ICON_DIAMOND,

/**
* A diamond is used to highlight points (◆)
* @note added in QGIS 3.0
*/
ICON_FULL_DIAMOND,
};

/**

0 comments on commit 61ace1c

Please sign in to comment.