Skip to content
Permalink
Browse files
draw grass region without fill
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 badda874e8754338cdff5218880bab1f9679c0eb
Showing with 10 additions and 6 deletions.
  1. +9 −5 src/plugins/grass/qgsgrassregion.cpp
  2. +1 −1 src/plugins/grass/qgsgrassregion.h
@@ -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()
@@ -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
@@ -519,4 +523,4 @@ void QgsGrassRegion::saveWindowLocation()
{
QSettings settings;
settings.setValue( "/GRASS/windows/region/geometry", saveGeometry() );
}
}
@@ -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 );

0 comments on commit badda87

Please sign in to comment.