Skip to content

Commit b40ceb2

Browse files
author
timlinux
committed
API cleanups for QgsRect that got overlooked...
git-svn-id: http://svn.osgeo.org/qgis/trunk@9605 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a96b47f commit b40ceb2

File tree

115 files changed

+670
-670
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+670
-670
lines changed

python/core/qgscoordinatetransform.sip

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ class QgsCoordinateTransform : QObject
103103
*/
104104
QgsPoint transform(const double x, const double y,TransformDirection direction=ForwardTransform);
105105

106-
/*! Transform a QgsRect to the dest Coordinate system
106+
/*! Transform a QgsRectangle to the dest Coordinate system
107107
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
108108
* otherwise points are transformed from map canvas CS to layerCS.
109109
* It assumes that rect is a bounding box, and creates a bounding box
110110
* in the proejcted CS, so that all points in source rectangle is within
111111
* returned rectangle.
112-
* @param QgsRect rect to transform
112+
* @param QgsRectangle rect to transform
113113
* @param direction TransformDirection (defaults to ForwardTransform)
114-
* @return QgsRect in Destination Coordinate System
114+
* @return QgsRectangle in Destination Coordinate System
115115
*/
116-
QgsRect transformBoundingBox(const QgsRect theRect,TransformDirection direction=ForwardTransform);
116+
QgsRectangle transformBoundingBox(const QgsRectangle theRect,TransformDirection direction=ForwardTransform);
117117

118118
// Same as for the other transform() functions, but alters the x
119119
// and y variables in place. The second one works with good old-fashioned
@@ -124,22 +124,22 @@ class QgsCoordinateTransform : QObject
124124
//void transformInPlace(std::vector<double>& x, std::vector<double>& y, std::vector<double>& z,
125125
// TransformDirection direction = ForwardTransform);
126126

127-
/*! Transform a QgsRect to the dest Coordinate system
127+
/*! Transform a QgsRectangle to the dest Coordinate system
128128
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
129129
* otherwise points are transformed from map canvas CS to layerCS.
130-
* @param QgsRect rect to transform
130+
* @param QgsRectangle rect to transform
131131
* @param direction TransformDirection (defaults to ForwardTransform)
132-
* @return QgsRect in Destination Coordinate System
132+
* @return QgsRectangle in Destination Coordinate System
133133
*/
134-
QgsRect transform(const QgsRect theRect,TransformDirection direction=ForwardTransform);
134+
QgsRectangle transform(const QgsRectangle theRect,TransformDirection direction=ForwardTransform);
135135

136136
/*! Transform an array of coordinates to a different Coordinate System
137137
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
138138
* otherwise points are transformed from map canvas CS to layerCS.
139139
* @param x x cordinate of point to transform
140140
* @param y y coordinate of point to transform
141141
* @param direction TransformDirection (defaults to ForwardTransform)
142-
* @return QgsRect in Destination Coordinate System
142+
* @return QgsRectangle in Destination Coordinate System
143143
*/
144144
void transformCoords( const int &numPoint, double *x, double *y, double *z,TransformDirection direction=ForwardTransform);
145145

python/core/qgsdataprovider.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class QgsDataProvider : QObject
4040

4141
/**
4242
* Get the extent of the layer
43-
* @return QgsRect containing the extent of the layer
43+
* @return QgsRectangle containing the extent of the layer
4444
*/
45-
virtual QgsRect extent() = 0;
45+
virtual QgsRectangle extent() = 0;
4646

4747

4848
/**

python/core/qgsgeometry.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class QgsGeometry
5050
/** construct geometry from a multipolygon */
5151
static QgsGeometry* fromMultiPolygon(const QgsMultiPolygon& multipoly) /Factory/;
5252
/** construct geometry from a rectangle */
53-
static QgsGeometry* fromRect(const QgsRect& rect) /Factory/;
53+
static QgsGeometry* fromRect(const QgsRectangle& rect) /Factory/;
5454

5555
typedef unsigned int size_t;
5656

@@ -210,10 +210,10 @@ not disjoint with existing polygons of the feature*/
210210
int makeDifference(QgsGeometry* other);
211211

212212
/**Returns the bounding box of this feature*/
213-
QgsRect boundingBox();
213+
QgsRectangle boundingBox();
214214

215215
/** Test for intersection with a rectangle (uses GEOS) */
216-
bool intersects(const QgsRect& r);
216+
bool intersects(const QgsRectangle& r);
217217
/** Test for intersection with a geoemetry (uses GEOS) */
218218
bool intersects(QgsGeometry* geometry);
219219

python/core/qgslabel.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public:
4444
/** \brief render label
4545
* \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
4646
*/
47-
void renderLabel ( QPainter* painter, QgsRect& viewExtent,
47+
void renderLabel ( QPainter* painter, QgsRectangle& viewExtent,
4848
QgsCoordinateTransform* coordinateTransform,
4949
QgsMapToPixel *transform,
5050
QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0, double sizeScale = 1, double rasterScaleFactor = 1);

python/core/qgsmaplayer.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public:
7171
virtual void drawLabels(QgsRenderContext& rendererContext);
7272

7373
/** Return the extent of the layer as a QRect */
74-
const QgsRect extent();
74+
const QgsRectangle extent();
7575

7676
/*! Return the status of the layer. An invalid layer is one which has a bad datasource
7777
* or other problem. Child classes set this flag when intialized

python/core/qgsmaprenderer.sip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class QgsMapRenderer : QObject
2323
void render(QPainter* painter);
2424

2525
//! sets extent and checks whether suitable (returns false if not)
26-
bool setExtent(const QgsRect& extent);
26+
bool setExtent(const QgsRectangle& extent);
2727

2828
//! returns current extent
29-
QgsRect extent();
29+
QgsRectangle extent();
3030

3131
const QgsMapToPixel* coordinateTransform();
3232

@@ -54,7 +54,7 @@ class QgsMapRenderer : QObject
5454
QSize outputSize();
5555

5656
//! transform extent in layer's CRS to extent in output CRS
57-
QgsRect layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRect extent);
57+
QgsRectangle layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRectangle extent);
5858

5959
//! transform coordinates from layer's CRS to output CRS
6060
QgsPoint layerToMapCoordinates(QgsMapLayer* theLayer, QgsPoint point);
@@ -63,7 +63,7 @@ class QgsMapRenderer : QObject
6363
QgsPoint mapToLayerCoordinates(QgsMapLayer* theLayer, QgsPoint point);
6464

6565
//! transform rect's coordinates from output CRS to layer's CRS
66-
QgsRect mapToLayerCoordinates(QgsMapLayer* theLayer, QgsRect rect);
66+
QgsRectangle mapToLayerCoordinates(QgsMapLayer* theLayer, QgsRectangle rect);
6767

6868
//! sets whether to use projections for this layer set
6969
void setProjectionsEnabled(bool enabled);
@@ -78,7 +78,7 @@ class QgsMapRenderer : QObject
7878
const QgsCoordinateReferenceSystem& destinationSrs();
7979

8080
//! returns current extent of layer set
81-
QgsRect fullExtent();
81+
QgsRectangle fullExtent();
8282

8383
//! returns current layer set
8484
QStringList& layerSet();
@@ -126,7 +126,7 @@ class QgsMapRenderer : QObject
126126
* source CRS coordinates, and if it was split, returns true, and
127127
* also sets the contents of the r2 parameter
128128
*/
129-
bool splitLayersExtent(QgsMapLayer* layer, QgsRect& extent, QgsRect& r2);
129+
bool splitLayersExtent(QgsMapLayer* layer, QgsRectangle& extent, QgsRectangle& r2);
130130

131131
};
132132

python/core/qgsrasterdataprovider.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public:
5757
// TODO: Document this better.
5858
/** \brief Renders the layer as an image
5959
*/
60-
virtual QImage* draw(const QgsRect & viewExtent, int pixelWidth, int pixelHeight) = 0;
60+
virtual QImage* draw(const QgsRectangle & viewExtent, int pixelWidth, int pixelHeight) = 0;
6161

6262
/** Returns a bitmask containing the supported capabilities
6363
Note, some capabilities may change depending on whether

python/core/qgsrect.sip

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

2-
/*! \class QgsRect
2+
/*! \class QgsRectangle
33
* \brief A rectangle specified with double values.
44
*
5-
* QgsRect is used to store a rectangle when double values are required.
5+
* QgsRectangle is used to store a rectangle when double values are required.
66
* Examples are storing a layer extent or the current view extent of a map
77
*/
8-
class QgsRect
8+
class QgsRectangle
99
{
1010
%TypeHeaderCode
11-
#include <qgsrect.h>
11+
#include <qgsrectangle.h>
1212
%End
1313

1414
public:
1515
//! Constructor
16-
QgsRect(double xmin=0, double ymin=0, double xmax=0, double ymax=0);
16+
QgsRectangle(double xmin=0, double ymin=0, double xmax=0, double ymax=0);
1717
//! Construct a rectangle from two points. The rectangle is normalized after construction.
18-
QgsRect(const QgsPoint & p1, const QgsPoint & p2);
18+
QgsRectangle(const QgsPoint & p1, const QgsPoint & p2);
1919
//! Copy constructor
20-
QgsRect(const QgsRect &other);
20+
QgsRectangle(const QgsRectangle &other);
2121
//! Destructor
22-
~QgsRect();
22+
~QgsRectangle();
2323
//! Set the rectangle from two QgsPoints. The rectangle is
2424
//normalised after construction.
2525
void set(const QgsPoint& p1, const QgsPoint& p2);
@@ -38,13 +38,13 @@ class QgsRect
3838
// and max corner is at min. It is NOT normalized.
3939
void setMinimal();
4040
//! Get the x maximum value (right side of rectangle)
41-
double xMax() const;
41+
double xMaximum() const;
4242
//! Get the x maximum value (right side of rectangle)
43-
double xMin() const;
43+
double xMinimum() const;
4444
//! Get the x minimum value (left side of rectangle)
45-
double yMax() const;
45+
double yMaximum() const;
4646
//! Get the y maximum value (top side of rectangle)
47-
double yMin() const;
47+
double yMinimum() const;
4848
//! Normalize the rectangle so it has non-negative width/height
4949
void normalize();
5050
//! Width of the rectangle
@@ -58,11 +58,11 @@ class QgsRect
5858
//! Expand the rectangle to support zoom out scaling
5959
void expand(double, const QgsPoint *c = 0);
6060
//! return the intersection with the given rectangle
61-
QgsRect intersect(QgsRect *rect);
61+
QgsRectangle intersect(QgsRectangle *rect);
6262
//! returns true when rectangle intersects with other rectangle
63-
bool intersects(const QgsRect& rect) const;
63+
bool intersects(const QgsRectangle& rect) const;
6464
//! expand the rectangle so that covers both the original rectangle and the given rectangle
65-
void combineExtentWith(QgsRect *rect);
65+
void combineExtentWith(QgsRectangle *rect);
6666
//! expand the rectangle so that covers both the original rectangle and the given point
6767
void combineExtentWith(double x, double y);
6868
//! test if rectangle is empty
@@ -78,14 +78,14 @@ class QgsRect
7878
/*! Comparison operator
7979
@return True if rectangles are equal
8080
*/
81-
bool operator==(const QgsRect &r1) const;
81+
bool operator==(const QgsRectangle &r1) const;
8282
/*! Comparison operator
8383
@return False if rectangles are equal
8484
*/
85-
bool operator!=(const QgsRect &r1) const;
85+
bool operator!=(const QgsRectangle &r1) const;
8686

8787
/** updates rectangle to include passed argument */
88-
void unionRect(const QgsRect& rect);
88+
void unionRect(const QgsRectangle& rect);
8989

9090

9191
};

python/core/qgsrendercontext.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class QgsRenderContext
1616

1717
const QgsCoordinateTransform* coordinateTransform() const;
1818

19-
const QgsRect& extent() const;
19+
const QgsRectangle& extent() const;
2020

2121
const QgsMapToPixel& mapToPixel() const;
2222

@@ -35,7 +35,7 @@ class QgsRenderContext
3535
/**Sets coordinate transformation. QgsRenderContext takes ownership and deletes if necessary*/
3636
void setCoordinateTransform(QgsCoordinateTransform* t);
3737
void setMapToPixel(const QgsMapToPixel& mtp);
38-
void setExtent(const QgsRect& extent);
38+
void setExtent(const QgsRectangle& extent);
3939
void setDrawEditingInformation(bool b);
4040
void setRenderingStopped(bool stopped);
4141
void setScaleFactor(double factor);

python/core/qgsscalecalculator.sip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ class QgsScaleCalculator
4747

4848
/**
4949
* Calculate the scale
50-
* @param mapExtent QgsRect containing the current map extent
50+
* @param mapExtent QgsRectangle containing the current map extent
5151
* @param canvasWidth Width of the map canvas in pixel (physical) units
5252
* @return scale of current map view
5353
*/
54-
double calculate(QgsRect &mapExtent, int canvasWidth);
54+
double calculate(QgsRectangle &mapExtent, int canvasWidth);
5555

5656
/**
5757
* Calculate the distance between to points in geographic coordinates.
5858
* Used to calculate scale for map views with geographic (decimal degree)
5959
* data.
60-
* @param mapExtent QgsRect containing the current map extent
60+
* @param mapExtent QgsRectangle containing the current map extent
6161
*/
62-
double calculateGeographicDistance(QgsRect &mapExtent);
62+
double calculateGeographicDistance(QgsRectangle &mapExtent);
6363

6464
};
6565

python/core/qgsspatialindex.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public:
3434
/* queries */
3535

3636
/** returns features that intersect the specified rectangle */
37-
QList<int> intersects(QgsRect rect);
37+
QList<int> intersects(QgsRectangle rect);
3838

3939
/** returns nearest neighbors (their count is specified by second parameter) */
4040
QList<int> nearestNeighbor(QgsPoint point, int neighbors);

python/core/qgsvectordataprovider.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class QgsVectorDataProvider : QgsDataProvider
5252
* false if a test based on bounding box is sufficient
5353
*/
5454
virtual void select(QList<int> fetchAttributes = QList<int>(),
55-
QgsRect rect = QgsRect(),
55+
QgsRectangle rect = QgsRectangle(),
5656
bool fetchGeometry = true,
5757
bool useIntersect = false) = 0;
5858

python/core/qgsvectorlayer.sip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public:
6565
int selectedFeatureCount();
6666

6767
/** Select features found within the search rectangle (in layer's coordinates) */
68-
void select(QgsRect & rect, bool lock);
68+
void select(QgsRectangle & rect, bool lock);
6969

7070
/** Select not selected features and deselect selected ones */
7171
void invertSelection();
@@ -79,8 +79,8 @@ public:
7979
/** Change selection to the new set of features */
8080
void setSelectedFeatures(const QSet<int>& ids);
8181

82-
/** Returns the bounding box of the selected features. If there is no selection, QgsRect(0,0,0,0) is returned */
83-
QgsRect boundingBoxOfSelected();
82+
/** Returns the bounding box of the selected features. If there is no selection, QgsRectangle(0,0,0,0) is returned */
83+
QgsRectangle boundingBoxOfSelected();
8484

8585
/** Copies the symbology settings from another layer. Returns true in case of success */
8686
bool copySymbologySettings(const QgsMapLayer& other);
@@ -158,7 +158,7 @@ public:
158158
virtual QString subsetString();
159159

160160
void select(QList<int> fetchAttributes = QList<int>(),
161-
QgsRect rect = QgsRect(),
161+
QgsRectangle rect = QgsRectangle(),
162162
bool fetchGeometry = true,
163163
bool useIntersect = false);
164164

python/gui/qgsmapcanvas.sip

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ class QgsMapCanvas : QGraphicsView
7777
double mapUnitsPerPixel() const;
7878

7979
//! Returns the current zoom exent of the map canvas
80-
QgsRect extent() const;
80+
QgsRectangle extent() const;
8181
//! Returns the combined exent for all layers on the map canvas
82-
QgsRect fullExtent() const;
82+
QgsRectangle fullExtent() const;
8383

8484
//! Set the extent of the map canvas
85-
void setExtent(const QgsRect & r);
85+
void setExtent(const QgsRectangle & r);
8686

8787
//! Zoom to the full extent of all layers
8888
void zoomToFullExtent();

python/gui/qgsmapcanvasitem.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class QgsMapCanvasItem : QGraphicsItem
3636
void setPanningOffset(const QPoint& point);
3737

3838
//! returns canvas item rectangle
39-
QgsRect rect() const;
39+
QgsRectangle rect() const;
4040

4141
//! sets canvas item rectangle
42-
void setRect(const QgsRect& r);
42+
void setRect(const QgsRectangle& r);
4343

4444
//! transformation from screen coordinates to map coordinates
4545
QgsPoint toMapCoordinates(const QPoint& point);

python/gui/qgsmapoverviewcanvas.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget
2626

2727
void enableAntiAliasing(bool flag);
2828

29-
void updateFullExtent(const QgsRect& rect);
29+
void updateFullExtent(const QgsRectangle& rect);
3030

3131
public slots:
3232

python/gui/qgsmaptool.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class QgsMapTool : QObject
8585
QgsPoint toLayerCoordinates(QgsMapLayer* layer, const QgsPoint& point);
8686

8787
//! trnasformation of the rect from map coordinates to layer's coordinates
88-
QgsRect toLayerCoordinates(QgsMapLayer* layer, const QgsRect& rect);
88+
QgsRectangle toLayerCoordinates(QgsMapLayer* layer, const QgsRectangle& rect);
8989

9090
//! transformation from map coordinates to screen coordinates
9191
QPoint toCanvasCoordinates(const QgsPoint& point);

0 commit comments

Comments
 (0)