Skip to content

Commit

Permalink
allow to create a QgsGeometryRubberBand as the alternative band
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Dec 21, 2015
1 parent 7afa9e3 commit aad8027
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/gui/qgsmaptooledit.cpp
Expand Up @@ -97,14 +97,19 @@ int QgsMapToolEdit::addTopologicalPoints( const QList<QgsPoint>& geom )
return 0;
}

QgsGeometryRubberBand* QgsMapToolEdit::createGeometryRubberBand( QGis::GeometryType geometryType ) const
QgsGeometryRubberBand* QgsMapToolEdit::createGeometryRubberBand( QGis::GeometryType geometryType, bool alternativeBand ) const
{
QSettings settings;
QgsGeometryRubberBand* rb = new QgsGeometryRubberBand( mCanvas, geometryType );
QColor color( settings.value( "/qgis/digitizing/line_color_red", 255 ).toInt(),
settings.value( "/qgis/digitizing/line_color_green", 0 ).toInt(),
settings.value( "/qgis/digitizing/line_color_blue", 0 ).toInt() );
double myAlpha = settings.value( "/qgis/digitizing/line_color_alpha", 200 ).toInt() / 255.0 ;
if ( alternativeBand )
{
myAlpha = myAlpha * settings.value( "/qgis/digitizing/line_color_alpha_scale", 0.75 ).toDouble();
rb->setLineStyle( Qt::DotLine );
}
color.setAlphaF( myAlpha );
rb->setOutlineColor( color );
rb->setFillColor( color );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaptooledit.h
Expand Up @@ -49,7 +49,7 @@ class GUI_EXPORT QgsMapToolEdit: public QgsMapTool
*/
QgsRubberBand* createRubberBand( QGis::GeometryType geometryType = QGis::Line, bool alternativeBand = false );

QgsGeometryRubberBand* createGeometryRubberBand( QGis::GeometryType geometryType = QGis::Line ) const;
QgsGeometryRubberBand* createGeometryRubberBand( QGis::GeometryType geometryType = QGis::Line , bool alternativeBand = false ) const;

/** Returns the current vector layer of the map canvas or 0*/
QgsVectorLayer* currentVectorLayer();
Expand Down

0 comments on commit aad8027

Please sign in to comment.