Skip to content
Permalink
Browse files

fix #1311

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10994 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jul 1, 2009
1 parent c5f5e7f commit 9eec5dd8e047f1bddd27a74b383a484db3073d67
Showing with 24 additions and 50 deletions.
  1. +0 −31 src/core/qgsvectorlayer.cpp
  2. +24 −19 src/gui/qgsmapcanvas.cpp
@@ -583,26 +583,6 @@ unsigned char *QgsVectorLayer::drawPolygon(
delete rings[i];
}

#ifdef QGISDEBUGVERBOSE
// this is only for verbose debug output -- no optimzation is
// needed :)
QgsDebugMsg( "Pixel points are:" );
for ( int i = 0; i < pa.size(); ++i )
{
QgsDebugMsgLevel( "i" + QString::number( i ), 2 );
QgsDebugMsgLevel( "pa[i].x()" + QString::number( pa[i].x() ), 2 );
QgsDebugMsgLevel( "pa[i].y()" + QString::number( pa[i].y() ), 2 );
}
QgsDebugMsg( "Ring positions are:" );
QgsDebugMsg( "Ring positions are:" );
for ( int i = 0; i < ringDetails.size(); ++i )
{
QgsDebugMsgLevel( "ringDetails[i].first" + QString::number( ringDetails[i].first ), 2 );
QgsDebugMsgLevel( "ringDetails[i].second" + QString::number( ringDetails[i].second ), 2 );
}
QgsDebugMsg( "Outer ring point is " + QString::number( outerRingPt.x() ) + ", " + QString::number( outerRingPt.y() ) );
#endif

#if 0
// A bit of code to aid in working out what values of
// QgsClipper::minX, etc cause the X11 zoom bug.
@@ -1063,17 +1043,6 @@ QgsRectangle QgsVectorLayer::boundingBoxOfSelected()
{
retval.set( -1.0, -1.0, 1.0, 1.0 );
}
else
{
const double padFactor = 1e-8;
double widthPad = retval.xMinimum() * padFactor;
double heightPad = retval.yMinimum() * padFactor;
double xmin = retval.xMinimum() - widthPad;
double xmax = retval.xMaximum() + widthPad;
double ymin = retval.yMinimum() - heightPad;
double ymax = retval.yMaximum() + heightPad;
retval.set( xmin, ymin, xmax, ymax );
}
}

return retval;
@@ -626,28 +626,33 @@ void QgsMapCanvas::zoomToSelected( QgsVectorLayer* layer )
layer = dynamic_cast < QgsVectorLayer * >( mCurrentLayer );
}

if ( layer )
if ( layer == NULL )
{
QgsRectangle rect = mMapRenderer->layerExtentToOutputExtent( layer, layer->boundingBoxOfSelected() );
return;
}

// no selected features, only one selected point feature
//or two point features with the same x- or y-coordinates
if ( rect.isEmpty() )
{
return;
}
//zoom to an area
else
{
// Expand rect to give a bit of space around the selected
// objects so as to keep them clear of the map boundaries
// The same 5% should apply to all margins.
rect.scale( 1.05 );
setExtent( rect );
refresh();
return;
}
QgsRectangle rect = mMapRenderer->layerExtentToOutputExtent( layer, layer->boundingBoxOfSelected() );

// no selected features, only one selected point feature
//or two point features with the same x- or y-coordinates
if ( rect.isEmpty() )
{
// zoom in
QgsPoint c = rect.center();
rect = extent();
rect.expand( 0.25, &c );
}
//zoom to an area
else
{
// Expand rect to give a bit of space around the selected
// objects so as to keep them clear of the map boundaries
// The same 5% should apply to all margins.
rect.scale( 1.05 );
}

setExtent( rect );
refresh();
} // zoomToSelected

void QgsMapCanvas::keyPressEvent( QKeyEvent * e )

0 comments on commit 9eec5dd

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