Skip to content
Permalink
Browse files

Replace manual square by creation of a ICON_FULL_BOX icon type for

rubber band
  • Loading branch information
leyan authored and 3nids committed Oct 29, 2013
1 parent a7409b7 commit 4d6be5568ae193480da61703ec7bb27745b00b69
Showing with 12 additions and 13 deletions.
  1. +4 −13 src/app/nodetool/qgsmaptoolnodetool.cpp
  2. +4 −0 src/gui/qgsrubberband.cpp
  3. +4 −0 src/gui/qgsrubberband.h
@@ -720,23 +720,14 @@ void QgsMapToolNodeTool::keyReleaseEvent( QKeyEvent* e )

QgsRubberBand* QgsMapToolNodeTool::createRubberBandMarker( QgsPoint center, QgsVectorLayer* vlayer )
{

// create rubberband marker for moving points
QgsRubberBand* marker = new QgsRubberBand( mCanvas, QGis::Polygon );
QgsRubberBand* marker = new QgsRubberBand( mCanvas, QGis::Point );
marker->setColor( Qt::red );
marker->setWidth( 2 );
double movement = 4;
double s = QgsTolerance::toleranceInMapUnits( movement, vlayer, mCanvas->mapRenderer(), QgsTolerance::Pixels );
marker->setIcon( QgsRubberBand::ICON_FULL_BOX );
marker->setIconSize( 8 );
QgsPoint pom = toMapCoordinates( vlayer, center );
pom.setX( pom.x() - s );
pom.setY( pom.y() - s );
marker->addPoint( pom );
pom.setX( pom.x() + 2*s );
marker->addPoint( pom );
pom.setY( pom.y() + 2*s );
marker->addPoint( pom );
pom.setX( pom.x() - 2*s );
marker->addPoint( pom );
pom.setY( pom.y() - 2*s );
marker->addPoint( pom );
return marker;
}
@@ -473,6 +473,10 @@ void QgsRubberBand::paint( QPainter* p )
p->drawLine( QLineF( x - s, y + s, x - s, y - s ) );
break;

case ICON_FULL_BOX:
p->drawRect( x - s, y - s, mIconSize, mIconSize );
break;

case ICON_CIRCLE:
p->drawEllipse( x - s, y - s, mIconSize, mIconSize );
break;
@@ -53,6 +53,10 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem
* A box is used to highlight points (□)
*/
ICON_BOX,
/**
* A full box is used to highlight points (■)
*/
ICON_FULL_BOX,
/**
* A circle is used to highlight points (○)
*/

0 comments on commit 4d6be55

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