Skip to content

Commit

Permalink
speed up QgsRubberBand::setToGeometry()
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9916 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jan 2, 2009
1 parent 0bbbe00 commit 80a8b8b
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/gui/qgsrubberband.cpp
Expand Up @@ -186,10 +186,10 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
{
pt = geom->asPoint();
}
addPoint( QgsPoint( pt.x() - d, pt.y() - d ) );
addPoint( QgsPoint( pt.x() + d, pt.y() - d ) );
addPoint( QgsPoint( pt.x() + d, pt.y() + d ) );
addPoint( QgsPoint( pt.x() - d, pt.y() + d ) );
addPoint( QgsPoint( pt.x() - d, pt.y() - d ), false );
addPoint( QgsPoint( pt.x() + d, pt.y() - d ), false );
addPoint( QgsPoint( pt.x() + d, pt.y() + d ), false );
addPoint( QgsPoint( pt.x() - d, pt.y() + d ), false );
}
break;

Expand All @@ -204,17 +204,17 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
QgsPoint pt = mpt[i];
if ( layer )
{
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() - d ) ) );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() - d ) ) );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() + d ) ) );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() + d ) ) );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() - d ) ), false );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() - d ) ), false );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() + d, pt.y() + d ) ), false );
addPoint( mr->layerToMapCoordinates( layer, QgsPoint( pt.x() - d, pt.y() + d ) ), false );
}
else
{
addPoint( QgsPoint( pt.x() - d, pt.y() - d ) );
addPoint( QgsPoint( pt.x() + d, pt.y() - d ) );
addPoint( QgsPoint( pt.x() + d, pt.y() + d ) );
addPoint( QgsPoint( pt.x() - d, pt.y() + d ) );
addPoint( QgsPoint( pt.x() - d, pt.y() - d ), false );
addPoint( QgsPoint( pt.x() + d, pt.y() - d ), false );
addPoint( QgsPoint( pt.x() + d, pt.y() + d ), false );
addPoint( QgsPoint( pt.x() - d, pt.y() + d ), false );
}
}
}
Expand All @@ -229,11 +229,11 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
{
if ( layer )
{
addPoint( mr->layerToMapCoordinates( layer, line[i] ) );
addPoint( mr->layerToMapCoordinates( layer, line[i] ), false );
}
else
{
addPoint( line[i] );
addPoint( line[i], false );
}
}
}
Expand All @@ -259,7 +259,7 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
}
else
{
addPoint( line[j] );
addPoint( line[j], false, i );
}
}
}
Expand All @@ -276,11 +276,11 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
{
if ( layer )
{
addPoint( mr->layerToMapCoordinates( layer, line[i] ) );
addPoint( mr->layerToMapCoordinates( layer, line[i] ), false );
}
else
{
addPoint( line[i] );
addPoint( line[i], false );
}
}
}
Expand All @@ -307,7 +307,7 @@ void QgsRubberBand::setToGeometry( QgsGeometry* geom, QgsVectorLayer* layer )
}
else
{
addPoint( line[j] );
addPoint( line[j], false, i );
}
}
}
Expand Down

0 comments on commit 80a8b8b

Please sign in to comment.