Skip to content
Permalink
Browse files
-Propogated updates for QgsRect setYMin/setYMax
git-svn-id: http://svn.osgeo.org/qgis/trunk@9177 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts committed Aug 26, 2008
1 parent 6e8b4a2 commit dfcacb69a33cbcd0a4d29d39bcd369f5b706a4c3
@@ -31,9 +31,9 @@ class QgsRect
//! Set the maximum x value
void setXMaximum(double x);
//! Set the maximum y value
void setYmin(double y);
void setYMinimum(double y);
//! Set the maximum y value
void setYmax(double y);
void setYMaximum(double y);
//! Set a rectangle so that min corner is at max
// and max corner is at min. It is NOT normalized.
void setMinimal();
@@ -244,8 +244,8 @@ void QgsMapToolIdentify::identifyVectorLayer( const QgsPoint& point )
QgsRect r;
r.setXMinimum( point.x() - searchRadius );
r.setXMaximum( point.x() + searchRadius );
r.setYmin( point.y() - searchRadius );
r.setYmax( point.y() + searchRadius );
r.setYMinimum( point.y() - searchRadius );
r.setYMaximum( point.y() + searchRadius );

r = toLayerCoords( layer, r );

@@ -263,8 +263,8 @@ void QgsComposerMap::moveContent( double dx, double dy )

mExtent.setXMinimum( mExtent.xMin() + xMoveMapCoord );
mExtent.setXMaximum( mExtent.xMax() + xMoveMapCoord );
mExtent.setYmin( mExtent.yMin() + yMoveMapCoord );
mExtent.setYmax( mExtent.yMax() + yMoveMapCoord );
mExtent.setYMinimum( mExtent.yMin() + yMoveMapCoord );
mExtent.setYMaximum( mExtent.yMax() + yMoveMapCoord );
emit extentChanged();
cache();
update();
@@ -182,8 +182,8 @@ void QgsMapRenderer::adjustExtentToSize()
// update extent
mExtent.setXMinimum( dxmin );
mExtent.setXMaximum( dxmax );
mExtent.setYmin( dymin );
mExtent.setYmax( dymax );
mExtent.setYMinimum( dymin );
mExtent.setYMaximum( dymax );

// update the scale
updateScale();
@@ -326,7 +326,7 @@ void QgsMapRenderer::render( QPainter* painter )
bk_mapToPixel = mRenderContext.mapToPixel();
rasterMapToPixel = mRenderContext.mapToPixel();
rasterMapToPixel.setMapUnitsPerPixel( mRenderContext.mapToPixel().mapUnitsPerPixel() / rasterScaleFactor );
rasterMapToPixel.setYmax( mSize.height() * rasterScaleFactor );
rasterMapToPixel.setYMaximum( mSize.height() * rasterScaleFactor );
mRenderContext.setMapToPixel( rasterMapToPixel );
mRenderContext.painter()->save();
mRenderContext.painter()->scale( 1.0 / rasterScaleFactor, 1.0 / rasterScaleFactor );
@@ -754,15 +754,15 @@ bool QgsMapRenderer::readXML( QDomNode & theNode )

exElement = yminNode.toElement();
double ymin = exElement.text().toDouble();
aoi.setYmin( ymin );
aoi.setYMinimum( ymin );

exElement = xmaxNode.toElement();
double xmax = exElement.text().toDouble();
aoi.setXMaximum( xmax );

exElement = ymaxNode.toElement();
double ymax = exElement.text().toDouble();
aoi.setYmax( ymax );
aoi.setYMaximum( ymax );

setExtent( aoi );

@@ -64,12 +64,12 @@ double QgsMapToPixel::mapUnitsPerPixel() const
return mMapUnitsPerPixel;
}

void QgsMapToPixel::setYmax( double ymax )
void QgsMapToPixel::setYMaximum( double ymax )
{
yMax = ymax;
}

void QgsMapToPixel::setYmin( double ymin )
void QgsMapToPixel::setYMinimum( double ymin )
{
yMin = ymin;
}
@@ -91,9 +91,9 @@ class CORE_EXPORT QgsMapToPixel
double mapUnitsPerPixel() const;

//! Set maximum y value
void setYmax( double ymax );
void setYMaximum( double ymax );
//! Set minimum y value
void setYmin( double ymin );
void setYMinimum( double ymin );
//! set minimum x value
void setXMinimum( double xmin );
/*! Set parameters for use in tranfsorming coordinates
@@ -145,12 +145,12 @@ inline void QgsRect::setXMaximum( double x )
xmax = x;
}

inline void QgsRect::setYmin( double y )
inline void QgsRect::setYMinimum( double y )
{
ymin = y;
}

inline void QgsRect::setYmax( double y )
inline void QgsRect::setYMaximum( double y )
{
ymax = y;
}
@@ -1535,8 +1535,8 @@ int QgsVectorLayer::addRing( const QList<QgsPoint>& ring )

if ( boundingBoxFromPointList( ring, xMin, yMin, xMax, yMax ) == 0 )
{
bBox.setXMinimum( xMin ); bBox.setYmin( yMin );
bBox.setXMaximum( xMax ); bBox.setYmax( yMax );
bBox.setXMinimum( xMin ); bBox.setYMinimum( yMin );
bBox.setXMaximum( xMax ); bBox.setYMaximum( yMax );
}
else
{
@@ -1661,8 +1661,8 @@ int QgsVectorLayer::splitFeatures( const QList<QgsPoint>& splitLine, bool topolo
{
if ( boundingBoxFromPointList( splitLine, xMin, yMin, xMax, yMax ) == 0 )
{
bBox.setXMinimum( xMin ); bBox.setYmin( yMin );
bBox.setXMaximum( xMax ); bBox.setYmax( yMax );
bBox.setXMinimum( xMin ); bBox.setYMinimum( yMin );
bBox.setXMaximum( xMax ); bBox.setYMaximum( yMax );
}
else
{
@@ -1679,8 +1679,8 @@ int QgsVectorLayer::splitFeatures( const QList<QgsPoint>& splitLine, bool topolo
}
else if ( bBox.height() == 0.0 && bBox.width() > 0 )
{
bBox.setYmin( bBox.yMin() - bBox.width() / 2 );
bBox.setYmax( bBox.yMax() + bBox.width() / 2 );
bBox.setYMinimum( bBox.yMin() - bBox.width() / 2 );
bBox.setYMaximum( bBox.yMax() + bBox.width() / 2 );
}
else
{
@@ -2176,8 +2176,8 @@ bool QgsVectorLayer::setDataProvider( QString const & provider )
// store the extent
mLayerExtent.setXMaximum( mbr.xMax() );
mLayerExtent.setXMinimum( mbr.xMin() );
mLayerExtent.setYmax( mbr.yMax() );
mLayerExtent.setYmin( mbr.yMin() );
mLayerExtent.setYMaximum( mbr.yMax() );
mLayerExtent.setYMinimum( mbr.yMin() );

// get and store the feature type
mGeometryType = mDataProvider->geometryType();
@@ -483,8 +483,8 @@ bool QgsRasterLayer::readFile( QString const & fileName )
// The affine transform reduces to these values at the
// top-left corner of the raster
mLayerExtent.setXMinimum( mGeoTransform[0] );
mLayerExtent.setYmax( mGeoTransform[3] );
mLayerExtent.setYmin( myYMin );
mLayerExtent.setYMaximum( mGeoTransform[3] );
mLayerExtent.setYMinimum( myYMin );

//
// Set up the x and y dimensions of this raster layer
@@ -4864,8 +4864,8 @@ void QgsRasterLayer::setDataProvider( QString const & provider,
// store the extent
mLayerExtent.setXMaximum( mbr.xMax() );
mLayerExtent.setXMinimum( mbr.xMin() );
mLayerExtent.setYmax( mbr.yMax() );
mLayerExtent.setYmin( mbr.yMin() );
mLayerExtent.setYMaximum( mbr.yMax() );
mLayerExtent.setYMinimum( mbr.yMin() );

// upper case the first letter of the layer name
QgsDebugMsg( "mLayerName: " + name() );
@@ -628,17 +628,17 @@ void QgsMapCanvas::keyPressEvent( QKeyEvent * e )
case Qt::Key_Up:
QgsDebugMsg( "Pan up" );

currentExtent.setYmax( currentExtent.yMax() + dy );
currentExtent.setYmin( currentExtent.yMin() + dy );
currentExtent.setYMaximum( currentExtent.yMax() + dy );
currentExtent.setYMinimum( currentExtent.yMin() + dy );
setExtent( currentExtent );
refresh();
break;

case Qt::Key_Down:
QgsDebugMsg( "Pan down" );

currentExtent.setYmax( currentExtent.yMax() - dy );
currentExtent.setYmin( currentExtent.yMin() - dy );
currentExtent.setYMaximum( currentExtent.yMax() - dy );
currentExtent.setYMinimum( currentExtent.yMin() - dy );
setExtent( currentExtent );
refresh();
break;
@@ -1134,14 +1134,14 @@ void QgsMapCanvas::panActionEnd( QPoint releasePoint )

if ( end.y() < start.y() )
{
r.setYmax( r.yMax() + dy );
r.setYmin( r.yMin() + dy );
r.setYMaximum( r.yMax() + dy );
r.setYMinimum( r.yMin() + dy );

}
else
{
r.setYmax( r.yMax() - dy );
r.setYmin( r.yMin() - dy );
r.setYMaximum( r.yMax() - dy );
r.setYMinimum( r.yMin() - dy );

}

@@ -188,8 +188,8 @@ void QgsMapOverviewCanvas::mouseReleaseEvent( QMouseEvent * e )
QgsRect ext;
ext.setXMinimum( center.x() - oldExtent.width() / 2 );
ext.setXMaximum( center.x() + oldExtent.width() / 2 );
ext.setYmin( center.y() - oldExtent.height() / 2 );
ext.setYmax( center.y() + oldExtent.height() / 2 );
ext.setYMinimum( center.y() - oldExtent.height() / 2 );
ext.setYMaximum( center.y() + oldExtent.height() / 2 );

QgsDebugMsg( QString( "panning: new position: [%1,%2] [%3x%4]" ).arg( rect.left() ).arg( rect.top() ).arg( rect.width() ).arg( rect.height() ) );

@@ -92,8 +92,8 @@ QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPoint & mapPosition, Qgs
QgsRect r;
r.setXMinimum( mapPosition.x() - searchRadius );
r.setXMaximum( mapPosition.x() + searchRadius );
r.setYmin( mapPosition.y() - searchRadius );
r.setYmax( mapPosition.y() + searchRadius );
r.setYMinimum( mapPosition.y() - searchRadius );
r.setYMaximum( mapPosition.y() + searchRadius );

// Get the data provider
QgsVectorDataProvider* dataProvider = dynamic_cast<QgsVectorLayer*>( layer )->dataProvider();
@@ -85,9 +85,9 @@ void QgsMapToolZoom::canvasReleaseEvent( QMouseEvent * e )

QgsRect r;
r.setXMinimum( ll.x() );
r.setYmin( ll.y() );
r.setYMinimum( ll.y() );
r.setXMaximum( ur.x() );
r.setYmax( ur.y() );
r.setYMaximum( ur.y() );
r.normalize();

// prevent zooming to an empty extent
@@ -137,8 +137,8 @@ void QgsPostgresExtentThread::run()
/*
layerExtent.setXMaximum(maxx);
layerExtent.setXMinimum(minx);
layerExtent.setYmax(maxy);
layerExtent.setYmin(miny);
layerExtent.setYMaximum(maxy);
layerExtent.setYMinimum(miny);
*/


@@ -698,8 +698,8 @@ void QgsPostgresProvider::setExtent( QgsRect& newExtent )
{
layerExtent.setXMaximum( newExtent.xMax() );
layerExtent.setXMinimum( newExtent.xMin() );
layerExtent.setYmax( newExtent.yMax() );
layerExtent.setYmin( newExtent.yMin() );
layerExtent.setYMaximum( newExtent.yMax() );
layerExtent.setYMinimum( newExtent.yMin() );
}

// TODO - make this function return the real extent_
@@ -2388,8 +2388,8 @@ void QgsPostgresProvider::calculateExtents()

layerExtent.setXMaximum( maxx );
layerExtent.setXMinimum( minx );
layerExtent.setYmax( maxy );
layerExtent.setYmin( miny );
layerExtent.setYMaximum( maxy );
layerExtent.setYMinimum( miny );
}
}
else
@@ -620,10 +620,10 @@ int QgsWFSProvider::getExtentFromGML2( QgsRect* extent, const QDomElement& wfsCo

std::list<QgsPoint>::const_iterator it = boundingPoints.begin();
extent->setXMinimum( it->x() );
extent->setYmin( it->y() );
extent->setYMinimum( it->y() );
++it;
extent->setXMaximum( it->x() );
extent->setYmax( it->y() );
extent->setYMaximum( it->y() );
return 0;
}
else if ( coordinatesNode.localName() == "coord" )
@@ -659,9 +659,9 @@ int QgsWFSProvider::getExtentFromGML2( QgsRect* extent, const QDomElement& wfsCo
return 10;
}
extent->setXMinimum( x1 );
extent->setYmin( y1 );
extent->setYMinimum( y1 );
extent->setXMaximum( x2 );
extent->setYmax( y2 );
extent->setYMaximum( y2 );
return 0;
}
else

0 comments on commit dfcacb6

Please sign in to comment.