Skip to content

Commit

Permalink
API cleanups for QgsRect that got overlooked...
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9605 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Nov 9, 2008
1 parent 06200b4 commit 3c391cf
Show file tree
Hide file tree
Showing 115 changed files with 670 additions and 670 deletions.
18 changes: 9 additions & 9 deletions python/core/qgscoordinatetransform.sip
Expand Up @@ -103,17 +103,17 @@ class QgsCoordinateTransform : QObject
*/
QgsPoint transform(const double x, const double y,TransformDirection direction=ForwardTransform);

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

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsdataprovider.sip
Expand Up @@ -40,9 +40,9 @@ class QgsDataProvider : QObject

/**
* Get the extent of the layer
* @return QgsRect containing the extent of the layer
* @return QgsRectangle containing the extent of the layer
*/
virtual QgsRect extent() = 0;
virtual QgsRectangle extent() = 0;


/**
Expand Down
6 changes: 3 additions & 3 deletions python/core/qgsgeometry.sip
Expand Up @@ -50,7 +50,7 @@ class QgsGeometry
/** construct geometry from a multipolygon */
static QgsGeometry* fromMultiPolygon(const QgsMultiPolygon& multipoly) /Factory/;
/** construct geometry from a rectangle */
static QgsGeometry* fromRect(const QgsRect& rect) /Factory/;
static QgsGeometry* fromRect(const QgsRectangle& rect) /Factory/;

typedef unsigned int size_t;

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

/**Returns the bounding box of this feature*/
QgsRect boundingBox();
QgsRectangle boundingBox();

/** Test for intersection with a rectangle (uses GEOS) */
bool intersects(const QgsRect& r);
bool intersects(const QgsRectangle& r);
/** Test for intersection with a geoemetry (uses GEOS) */
bool intersects(QgsGeometry* geometry);

Expand Down
2 changes: 1 addition & 1 deletion python/core/qgslabel.sip
Expand Up @@ -44,7 +44,7 @@ public:
/** \brief render label
* \param sizeScale global scale factor for size in pixels, labels in map units are not scaled
*/
void renderLabel ( QPainter* painter, QgsRect& viewExtent,
void renderLabel ( QPainter* painter, QgsRectangle& viewExtent,
QgsCoordinateTransform* coordinateTransform,
QgsMapToPixel *transform,
QgsFeature &feature, bool selected, QgsLabelAttributes *classAttributes=0, double sizeScale = 1, double rasterScaleFactor = 1);
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsmaplayer.sip
Expand Up @@ -71,7 +71,7 @@ public:
virtual void drawLabels(QgsRenderContext& rendererContext);

/** Return the extent of the layer as a QRect */
const QgsRect extent();
const QgsRectangle extent();

/*! Return the status of the layer. An invalid layer is one which has a bad datasource
* or other problem. Child classes set this flag when intialized
Expand Down
12 changes: 6 additions & 6 deletions python/core/qgsmaprenderer.sip
Expand Up @@ -23,10 +23,10 @@ class QgsMapRenderer : QObject
void render(QPainter* painter);

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

//! returns current extent
QgsRect extent();
QgsRectangle extent();

const QgsMapToPixel* coordinateTransform();

Expand Down Expand Up @@ -54,7 +54,7 @@ class QgsMapRenderer : QObject
QSize outputSize();

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

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

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

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

//! returns current extent of layer set
QgsRect fullExtent();
QgsRectangle fullExtent();

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

};

2 changes: 1 addition & 1 deletion python/core/qgsrasterdataprovider.sip
Expand Up @@ -57,7 +57,7 @@ public:
// TODO: Document this better.
/** \brief Renders the layer as an image
*/
virtual QImage* draw(const QgsRect & viewExtent, int pixelWidth, int pixelHeight) = 0;
virtual QImage* draw(const QgsRectangle & viewExtent, int pixelWidth, int pixelHeight) = 0;

/** Returns a bitmask containing the supported capabilities
Note, some capabilities may change depending on whether
Expand Down
36 changes: 18 additions & 18 deletions python/core/qgsrect.sip
@@ -1,25 +1,25 @@

/*! \class QgsRect
/*! \class QgsRectangle
* \brief A rectangle specified with double values.
*
* QgsRect is used to store a rectangle when double values are required.
* QgsRectangle is used to store a rectangle when double values are required.
* Examples are storing a layer extent or the current view extent of a map
*/
class QgsRect
class QgsRectangle
{
%TypeHeaderCode
#include <qgsrect.h>
#include <qgsrectangle.h>
%End

public:
//! Constructor
QgsRect(double xmin=0, double ymin=0, double xmax=0, double ymax=0);
QgsRectangle(double xmin=0, double ymin=0, double xmax=0, double ymax=0);
//! Construct a rectangle from two points. The rectangle is normalized after construction.
QgsRect(const QgsPoint & p1, const QgsPoint & p2);
QgsRectangle(const QgsPoint & p1, const QgsPoint & p2);
//! Copy constructor
QgsRect(const QgsRect &other);
QgsRectangle(const QgsRectangle &other);
//! Destructor
~QgsRect();
~QgsRectangle();
//! Set the rectangle from two QgsPoints. The rectangle is
//normalised after construction.
void set(const QgsPoint& p1, const QgsPoint& p2);
Expand All @@ -38,13 +38,13 @@ class QgsRect
// and max corner is at min. It is NOT normalized.
void setMinimal();
//! Get the x maximum value (right side of rectangle)
double xMax() const;
double xMaximum() const;
//! Get the x maximum value (right side of rectangle)
double xMin() const;
double xMinimum() const;
//! Get the x minimum value (left side of rectangle)
double yMax() const;
double yMaximum() const;
//! Get the y maximum value (top side of rectangle)
double yMin() const;
double yMinimum() const;
//! Normalize the rectangle so it has non-negative width/height
void normalize();
//! Width of the rectangle
Expand All @@ -58,11 +58,11 @@ class QgsRect
//! Expand the rectangle to support zoom out scaling
void expand(double, const QgsPoint *c = 0);
//! return the intersection with the given rectangle
QgsRect intersect(QgsRect *rect);
QgsRectangle intersect(QgsRectangle *rect);
//! returns true when rectangle intersects with other rectangle
bool intersects(const QgsRect& rect) const;
bool intersects(const QgsRectangle& rect) const;
//! expand the rectangle so that covers both the original rectangle and the given rectangle
void combineExtentWith(QgsRect *rect);
void combineExtentWith(QgsRectangle *rect);
//! expand the rectangle so that covers both the original rectangle and the given point
void combineExtentWith(double x, double y);
//! test if rectangle is empty
Expand All @@ -78,14 +78,14 @@ class QgsRect
/*! Comparison operator
@return True if rectangles are equal
*/
bool operator==(const QgsRect &r1) const;
bool operator==(const QgsRectangle &r1) const;
/*! Comparison operator
@return False if rectangles are equal
*/
bool operator!=(const QgsRect &r1) const;
bool operator!=(const QgsRectangle &r1) const;

/** updates rectangle to include passed argument */
void unionRect(const QgsRect& rect);
void unionRect(const QgsRectangle& rect);


};
Expand Down
4 changes: 2 additions & 2 deletions python/core/qgsrendercontext.sip
Expand Up @@ -16,7 +16,7 @@ class QgsRenderContext

const QgsCoordinateTransform* coordinateTransform() const;

const QgsRect& extent() const;
const QgsRectangle& extent() const;

const QgsMapToPixel& mapToPixel() const;

Expand All @@ -35,7 +35,7 @@ class QgsRenderContext
/**Sets coordinate transformation. QgsRenderContext takes ownership and deletes if necessary*/
void setCoordinateTransform(QgsCoordinateTransform* t);
void setMapToPixel(const QgsMapToPixel& mtp);
void setExtent(const QgsRect& extent);
void setExtent(const QgsRectangle& extent);
void setDrawEditingInformation(bool b);
void setRenderingStopped(bool stopped);
void setScaleFactor(double factor);
Expand Down
8 changes: 4 additions & 4 deletions python/core/qgsscalecalculator.sip
Expand Up @@ -47,19 +47,19 @@ class QgsScaleCalculator

/**
* Calculate the scale
* @param mapExtent QgsRect containing the current map extent
* @param mapExtent QgsRectangle containing the current map extent
* @param canvasWidth Width of the map canvas in pixel (physical) units
* @return scale of current map view
*/
double calculate(QgsRect &mapExtent, int canvasWidth);
double calculate(QgsRectangle &mapExtent, int canvasWidth);

/**
* Calculate the distance between to points in geographic coordinates.
* Used to calculate scale for map views with geographic (decimal degree)
* data.
* @param mapExtent QgsRect containing the current map extent
* @param mapExtent QgsRectangle containing the current map extent
*/
double calculateGeographicDistance(QgsRect &mapExtent);
double calculateGeographicDistance(QgsRectangle &mapExtent);

};

2 changes: 1 addition & 1 deletion python/core/qgsspatialindex.sip
Expand Up @@ -34,7 +34,7 @@ public:
/* queries */

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

/** returns nearest neighbors (their count is specified by second parameter) */
QList<int> nearestNeighbor(QgsPoint point, int neighbors);
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsvectordataprovider.sip
Expand Up @@ -52,7 +52,7 @@ class QgsVectorDataProvider : QgsDataProvider
* false if a test based on bounding box is sufficient
*/
virtual void select(QList<int> fetchAttributes = QList<int>(),
QgsRect rect = QgsRect(),
QgsRectangle rect = QgsRectangle(),
bool fetchGeometry = true,
bool useIntersect = false) = 0;

Expand Down
8 changes: 4 additions & 4 deletions python/core/qgsvectorlayer.sip
Expand Up @@ -65,7 +65,7 @@ public:
int selectedFeatureCount();

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

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

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

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

void select(QList<int> fetchAttributes = QList<int>(),
QgsRect rect = QgsRect(),
QgsRectangle rect = QgsRectangle(),
bool fetchGeometry = true,
bool useIntersect = false);

Expand Down
6 changes: 3 additions & 3 deletions python/gui/qgsmapcanvas.sip
Expand Up @@ -77,12 +77,12 @@ class QgsMapCanvas : QGraphicsView
double mapUnitsPerPixel() const;

//! Returns the current zoom exent of the map canvas
QgsRect extent() const;
QgsRectangle extent() const;
//! Returns the combined exent for all layers on the map canvas
QgsRect fullExtent() const;
QgsRectangle fullExtent() const;

//! Set the extent of the map canvas
void setExtent(const QgsRect & r);
void setExtent(const QgsRectangle & r);

//! Zoom to the full extent of all layers
void zoomToFullExtent();
Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsmapcanvasitem.sip
Expand Up @@ -36,10 +36,10 @@ class QgsMapCanvasItem : QGraphicsItem
void setPanningOffset(const QPoint& point);

//! returns canvas item rectangle
QgsRect rect() const;
QgsRectangle rect() const;

//! sets canvas item rectangle
void setRect(const QgsRect& r);
void setRect(const QgsRectangle& r);

//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoordinates(const QPoint& point);
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsmapoverviewcanvas.sip
Expand Up @@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget

void enableAntiAliasing(bool flag);

void updateFullExtent(const QgsRect& rect);
void updateFullExtent(const QgsRectangle& rect);

public slots:

Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsmaptool.sip
Expand Up @@ -85,7 +85,7 @@ class QgsMapTool : QObject
QgsPoint toLayerCoordinates(QgsMapLayer* layer, const QgsPoint& point);

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

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

0 comments on commit 3c391cf

Please sign in to comment.