Change QgsRectangle::combineExtentWith(const QgsRectangle*) into QgsRectangle::combineExtentWith(const QgsRectangle&)

This commit is contained in:
Sandro Mani 2016-05-29 00:24:03 +02:00
parent d5f8255a0d
commit d5512a931f
20 changed files with 33 additions and 33 deletions

View File

@ -74,7 +74,7 @@ class QgsRectangle
//! return true when rectangle contains a point //! return true when rectangle contains a point
bool contains( const QgsPoint &p ) const; bool contains( const QgsPoint &p ) const;
//! expand the rectangle so that covers both the original rectangle and the given rectangle //! expand the rectangle so that covers both the original rectangle and the given rectangle
void combineExtentWith( const QgsRectangle *rect ); void combineExtentWith( const QgsRectangle& rect );
//! expand the rectangle so that covers both the original rectangle and the given point //! expand the rectangle so that covers both the original rectangle and the given point
void combineExtentWith( double x, double y ); void combineExtentWith( double x, double y );
//! test if rectangle is empty. //! test if rectangle is empty.

View File

@ -3706,7 +3706,7 @@ QgsRectangle QgsDxfExport::dxfExtent() const
else else
{ {
QgsRectangle layerExtent = layerIt->first->extent(); QgsRectangle layerExtent = layerIt->first->extent();
extent.combineExtentWith( &layerExtent ); extent.combineExtentWith( layerExtent );
} }
} }
} }

View File

@ -78,7 +78,7 @@ QgsRectangle QgsCircularStringV2::calculateBoundingBox() const
else else
{ {
QgsRectangle segmentBox = segmentBoundingBox( QgsPointV2( mX[i], mY[i] ), QgsPointV2( mX[i + 1], mY[i + 1] ), QgsPointV2( mX[i + 2], mY[i + 2] ) ); QgsRectangle segmentBox = segmentBoundingBox( QgsPointV2( mX[i], mY[i] ), QgsPointV2( mX[i + 1], mY[i + 1] ), QgsPointV2( mX[i + 2], mY[i + 2] ) );
bbox.combineExtentWith( &segmentBox ); bbox.combineExtentWith( segmentBox );
} }
} }

View File

@ -95,7 +95,7 @@ QgsRectangle QgsCompoundCurveV2::calculateBoundingBox() const
for ( int i = 1; i < mCurves.size(); ++i ) for ( int i = 1; i < mCurves.size(); ++i )
{ {
QgsRectangle curveBox = mCurves.at( i )->boundingBox(); QgsRectangle curveBox = mCurves.at( i )->boundingBox();
bbox.combineExtentWith( &curveBox ); bbox.combineExtentWith( curveBox );
} }
return bbox; return bbox;
} }

View File

@ -336,7 +336,7 @@ QgsRectangle QgsGeometryCollectionV2::calculateBoundingBox() const
for ( int i = 1; i < mGeometries.size(); ++i ) for ( int i = 1; i < mGeometries.size(); ++i )
{ {
QgsRectangle geomBox = mGeometries.at( i )->boundingBox(); QgsRectangle geomBox = mGeometries.at( i )->boundingBox();
bbox.combineExtentWith( &geomBox ); bbox.combineExtentWith( geomBox );
} }
return bbox; return bbox;
} }

View File

@ -194,14 +194,14 @@ bool QgsRectangle::contains( const QgsPoint &p ) const
ymin <= p.y() && p.y() <= ymax; ymin <= p.y() && p.y() <= ymax;
} }
void QgsRectangle::combineExtentWith( const QgsRectangle * rect ) void QgsRectangle::combineExtentWith( const QgsRectangle &rect )
{ {
xmin = (( xmin < rect->xMinimum() ) ? xmin : rect->xMinimum() ); xmin = (( xmin < rect.xMinimum() ) ? xmin : rect.xMinimum() );
xmax = (( xmax > rect->xMaximum() ) ? xmax : rect->xMaximum() ); xmax = (( xmax > rect.xMaximum() ) ? xmax : rect.xMaximum() );
ymin = (( ymin < rect->yMinimum() ) ? ymin : rect->yMinimum() ); ymin = (( ymin < rect.yMinimum() ) ? ymin : rect.yMinimum() );
ymax = (( ymax > rect->yMaximum() ) ? ymax : rect->yMaximum() ); ymax = (( ymax > rect.yMaximum() ) ? ymax : rect.yMaximum() );
} }

View File

@ -97,7 +97,7 @@ class CORE_EXPORT QgsRectangle
//! return true when rectangle contains a point //! return true when rectangle contains a point
bool contains( const QgsPoint &p ) const; bool contains( const QgsPoint &p ) const;
//! expand the rectangle so that covers both the original rectangle and the given rectangle //! expand the rectangle so that covers both the original rectangle and the given rectangle
void combineExtentWith( const QgsRectangle *rect ); void combineExtentWith( const QgsRectangle& rect );
//! expand the rectangle so that covers both the original rectangle and the given point //! expand the rectangle so that covers both the original rectangle and the given point
void combineExtentWith( double x, double y ); void combineExtentWith( double x, double y );
//! test if rectangle is empty. //! test if rectangle is empty.

View File

@ -716,7 +716,7 @@ QgsRectangle QgsVectorLayer::boundingBoxOfSelected()
if ( !fet.constGeometry() || fet.constGeometry()->isEmpty() ) if ( !fet.constGeometry() || fet.constGeometry()->isEmpty() )
continue; continue;
r = fet.constGeometry()->boundingBox(); r = fet.constGeometry()->boundingBox();
retval.combineExtentWith( &r ); retval.combineExtentWith( r );
} }
} }
else else
@ -731,7 +731,7 @@ QgsRectangle QgsVectorLayer::boundingBoxOfSelected()
if ( fet.constGeometry() ) if ( fet.constGeometry() )
{ {
r = fet.constGeometry()->boundingBox(); r = fet.constGeometry()->boundingBox();
retval.combineExtentWith( &r ); retval.combineExtentWith( r );
} }
} }
} }
@ -999,7 +999,7 @@ QgsRectangle QgsVectorLayer::extent()
if ( mDataProvider->featureCount() != 0 ) if ( mDataProvider->featureCount() != 0 )
{ {
QgsRectangle r = mDataProvider->extent(); QgsRectangle r = mDataProvider->extent();
rect.combineExtentWith( &r ); rect.combineExtentWith( r );
} }
if ( mEditBuffer ) if ( mEditBuffer )
@ -1009,7 +1009,7 @@ QgsRectangle QgsVectorLayer::extent()
if ( it->constGeometry() ) if ( it->constGeometry() )
{ {
QgsRectangle r = it->constGeometry()->boundingBox(); QgsRectangle r = it->constGeometry()->boundingBox();
rect.combineExtentWith( &r ); rect.combineExtentWith( r );
} }
} }
} }
@ -1025,7 +1025,7 @@ QgsRectangle QgsVectorLayer::extent()
if ( fet.constGeometry() && fet.constGeometry()->type() != QGis::UnknownGeometry ) if ( fet.constGeometry() && fet.constGeometry()->type() != QGis::UnknownGeometry )
{ {
QgsRectangle bb = fet.constGeometry()->boundingBox(); QgsRectangle bb = fet.constGeometry()->boundingBox();
rect.combineExtentWith( &bb ); rect.combineExtentWith( bb );
} }
} }
} }

View File

@ -617,7 +617,7 @@ void QgsRelationReferenceWidget::highlightFeature( QgsFeature f, CanvasExtent ca
QgsRectangle extent = mCanvas->extent(); QgsRectangle extent = mCanvas->extent();
if ( !extent.contains( featBBox ) ) if ( !extent.contains( featBBox ) )
{ {
extent.combineExtentWith( &featBBox ); extent.combineExtentWith( featBBox );
extent.scale( 1.1 ); extent.scale( 1.1 );
mCanvas->setExtent( extent ); mCanvas->setExtent( extent );
mCanvas->refresh(); mCanvas->refresh();

View File

@ -242,7 +242,7 @@ void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas* canvas, const Q
if ( canvas->hasCrsTransformEnabled() ) if ( canvas->hasCrsTransformEnabled() )
layerExtent = canvas->mapSettings().layerExtentToOutputExtent( layer, layerExtent ); layerExtent = canvas->mapSettings().layerExtentToOutputExtent( layer, layerExtent );
extent.combineExtentWith( &layerExtent ); extent.combineExtentWith( layerExtent );
} }
if ( extent.isNull() ) if ( extent.isNull() )

View File

@ -1166,7 +1166,7 @@ void QgsMapCanvas::zoomToFeatureIds( QgsVectorLayer* layer, const QgsFeatureIds&
return; return;
} }
QgsRectangle r = mapSettings().layerExtentToOutputExtent( layer, geom->boundingBox() ); QgsRectangle r = mapSettings().layerExtentToOutputExtent( layer, geom->boundingBox() );
rect.combineExtentWith( &r ); rect.combineExtentWith( r );
featureCount++; featureCount++;
} }

View File

@ -558,7 +558,7 @@ void QgsRubberBand::updateRect()
} }
else else
{ {
r.combineExtentWith( &rect ); r.combineExtentWith( rect );
} }
} }
} }

View File

@ -772,7 +772,7 @@ void GlobePlugin::refreshQGISMapLayer( QgsRectangle rect )
rect = mLayerExtents.values().front(); rect = mLayerExtents.values().front();
foreach ( const QgsRectangle& extent, mLayerExtents.values() ) foreach ( const QgsRectangle& extent, mLayerExtents.values() )
{ {
rect.combineExtentWith( &extent ); rect.combineExtentWith( extent );
} }
} }
mOsgViewer->getDatabasePager()->clear(); mOsgViewer->getDatabasePager()->clear();
@ -903,7 +903,7 @@ void GlobePlugin::updateLayers()
QgsRectangle fullExtent = mLayerExtents.isEmpty() ? QgsRectangle() : mLayerExtents.values().front(); QgsRectangle fullExtent = mLayerExtents.isEmpty() ? QgsRectangle() : mLayerExtents.values().front();
foreach ( const QgsRectangle& rect, mLayerExtents.values() ) foreach ( const QgsRectangle& rect, mLayerExtents.values() )
{ {
fullExtent.combineExtentWith( &rect ); fullExtent.combineExtentWith( rect );
} }
mLayerExtents.clear(); mLayerExtents.clear();
@ -958,7 +958,7 @@ void GlobePlugin::updateLayers()
} }
else else
{ {
fullExtent.combineExtentWith( &extent ); fullExtent.combineExtentWith( extent );
} }
} }
} }
@ -1034,7 +1034,7 @@ void GlobePlugin::layerChanged( QgsMapLayer* mapLayer )
QgsRectangle updateExtent = layerExtent; QgsRectangle updateExtent = layerExtent;
if ( mLayerExtents.contains( mapLayer->id() ) ) if ( mLayerExtents.contains( mapLayer->id() ) )
{ {
updateExtent.combineExtentWith( &mLayerExtents[mapLayer->id()] ); updateExtent.combineExtentWith( mLayerExtents[mapLayer->id()] );
} }
mLayerExtents[mapLayer->id()] = layerExtent; mLayerExtents[mapLayer->id()] = layerExtent;
refreshQGISMapLayer( updateExtent ); refreshQGISMapLayer( updateExtent );

View File

@ -458,7 +458,7 @@ QgsRectangle QgsInterpolationDialog::boundingBoxOfLayers()
} }
else else
{ {
combinedLayerExtent.combineExtentWith( &currentLayerExtent ); combinedLayerExtent.combineExtentWith( currentLayerExtent );
} }
} }
return combinedLayerExtent; return combinedLayerExtent;

View File

@ -1171,7 +1171,7 @@ ErrorList topolTest::checkOverlapWithLayer( double tolerance, QgsVectorLayer* la
{ {
QgsRectangle r = bb; QgsRectangle r = bb;
QgsRectangle r2 = g2->boundingBox(); QgsRectangle r2 = g2->boundingBox();
r.combineExtentWith( &r2 ); r.combineExtentWith( r2 );
QScopedPointer<QgsGeometry> conflictGeom( g1->intersection( g2 ) ); QScopedPointer<QgsGeometry> conflictGeom( g1->intersection( g2 ) );
// could this for some reason return NULL? // could this for some reason return NULL?

View File

@ -474,7 +474,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes )
mNumberFeatures++; mNumberFeatures++;
if ( geom->isMultipart() ) mWkbType = type; if ( geom->isMultipart() ) mWkbType = type;
QgsRectangle bbox( geom->boundingBox() ); QgsRectangle bbox( geom->boundingBox() );
mExtent.combineExtentWith( &bbox ); mExtent.combineExtentWith( bbox );
} }
if ( buildSpatialIndex ) if ( buildSpatialIndex )
{ {
@ -797,7 +797,7 @@ void QgsDelimitedTextProvider::rescanFile()
else else
{ {
QgsRectangle bbox( f.constGeometry()->boundingBox() ); QgsRectangle bbox( f.constGeometry()->boundingBox() );
mExtent.combineExtentWith( &bbox ); mExtent.combineExtentWith( bbox );
} }
if ( buildSpatialIndex ) mSpatialIndex->insertFeature( f ); if ( buildSpatialIndex ) mSpatialIndex->insertFeature( f );
} }

View File

@ -1256,7 +1256,7 @@ bool QgsWmsProvider::calculateExtent()
} }
else else
{ {
mLayerExtent.combineExtentWith( &extent ); mLayerExtent.combineExtentWith( extent );
} }
firstLayer = false; firstLayer = false;

View File

@ -725,7 +725,7 @@ void QgsServerProjectParser::combineExtentAndCrsOfGroupChildren( QDomElement& gr
} }
else else
{ {
combinedBBox.combineExtentWith( &bbox ); combinedBBox.combineExtentWith( bbox );
} }
} }

View File

@ -1707,7 +1707,7 @@ void QgsWMSProjectParser::addOWSLayers( QDomDocument &doc,
} }
else else
{ {
combinedBBox.combineExtentWith( &BBox ); combinedBBox.combineExtentWith( BBox );
} }
addOWSLayerStyles( currentLayer, doc, layerElem ); addOWSLayerStyles( currentLayer, doc, layerElem );

View File

@ -2260,7 +2260,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
} }
else else
{ {
featureBBox->combineExtentWith( &box ); featureBBox->combineExtentWith( box );
} }
} }
} }
@ -2600,7 +2600,7 @@ void QgsWMSServer::applyRequestedLayerFilters( const QStringList& layerList , QH
} }
else else
{ {
filterExtent.combineExtentWith( &layerExtent ); filterExtent.combineExtentWith( layerExtent );
} }
} }
mMapRenderer->setExtent( filterExtent ); mMapRenderer->setExtent( filterExtent );