Skip to content

Commit

Permalink
draw grass region without fill
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15842 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 28, 2011
1 parent c6b1b90 commit badda87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions src/plugins/grass/qgsgrassregion.cpp
Expand Up @@ -101,8 +101,8 @@ void QgsGrassRegionEdit::setRegion( const QgsPoint& ul, const QgsPoint& lr )
mStartPoint = ul;
mEndPoint = lr;
calcSrcRegion();
drawRegion( canvas(), mRubberBand, mSrcRectangle, &mCoordinateTransform );
drawRegion( canvas(), mSrcRubberBand, QgsRectangle( mStartPoint, mEndPoint ) );
drawRegion( canvas(), mRubberBand, mSrcRectangle, &mCoordinateTransform, true );
drawRegion( canvas(), mSrcRubberBand, QgsRectangle( mStartPoint, mEndPoint ), 0, true );
}

void QgsGrassRegionEdit::calcSrcRegion()
Expand Down Expand Up @@ -142,19 +142,23 @@ void QgsGrassRegionEdit::transform( QgsMapCanvas *canvas, QVector<QgsPoint> &poi
}
}

void QgsGrassRegionEdit::drawRegion( QgsMapCanvas *canvas, QgsRubberBand* rubberBand, const QgsRectangle &rect, QgsCoordinateTransform * coordinateTransform )
void QgsGrassRegionEdit::drawRegion( QgsMapCanvas *canvas, QgsRubberBand* rubberBand, const QgsRectangle &rect, QgsCoordinateTransform * coordinateTransform, bool isPolygon )
{
QVector<QgsPoint> points;
points.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) );
points.append( QgsPoint( rect.xMaximum(), rect.yMinimum() ) );
points.append( QgsPoint( rect.xMaximum(), rect.yMaximum() ) );
points.append( QgsPoint( rect.xMinimum(), rect.yMaximum() ) );
if ( !isPolygon )
{
points.append( QgsPoint( rect.xMinimum(), rect.yMinimum() ) );
}

if ( coordinateTransform )
{
transform( canvas, points, coordinateTransform );
}
rubberBand->reset( true );
rubberBand->reset( isPolygon );
for ( int i = 0; i < points.size(); i++ )
{
bool update = false; // true to update canvas
Expand Down Expand Up @@ -519,4 +523,4 @@ void QgsGrassRegion::saveWindowLocation()
{
QSettings settings;
settings.setValue( "/GRASS/windows/region/geometry", saveGeometry() );
}
}
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassregion.h
Expand Up @@ -157,7 +157,7 @@ class QgsGrassRegionEdit : public QgsMapTool
void setSrcRegion( const QgsRectangle &rect );

void setTransform();
static void drawRegion( QgsMapCanvas *canvas, QgsRubberBand* rubberBand, const QgsRectangle &rect, QgsCoordinateTransform *coordinateTransform = 0 );
static void drawRegion( QgsMapCanvas *canvas, QgsRubberBand* rubberBand, const QgsRectangle &rect, QgsCoordinateTransform *coordinateTransform = 0, bool isPolygon = false );
void calcSrcRegion();
static void transform( QgsMapCanvas *canvas, QVector<QgsPoint> &points, QgsCoordinateTransform *coordinateTransform, QgsCoordinateTransform::TransformDirection direction = QgsCoordinateTransform::ForwardTransform );

Expand Down

0 comments on commit badda87

Please sign in to comment.