Skip to content
Permalink
Browse files

API cleanups for QgsRect that got overlooked...

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9605 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Nov 9, 2008
1 parent 06200b4 commit 3c391cf1ddcf149873ea7ad125afae830425ba5a
Showing with 670 additions and 670 deletions.
  1. +9 −9 python/core/qgscoordinatetransform.sip
  2. +2 −2 python/core/qgsdataprovider.sip
  3. +3 −3 python/core/qgsgeometry.sip
  4. +1 −1 python/core/qgslabel.sip
  5. +1 −1 python/core/qgsmaplayer.sip
  6. +6 −6 python/core/qgsmaprenderer.sip
  7. +1 −1 python/core/qgsrasterdataprovider.sip
  8. +18 −18 python/core/qgsrect.sip
  9. +2 −2 python/core/qgsrendercontext.sip
  10. +4 −4 python/core/qgsscalecalculator.sip
  11. +1 −1 python/core/qgsspatialindex.sip
  12. +1 −1 python/core/qgsvectordataprovider.sip
  13. +4 −4 python/core/qgsvectorlayer.sip
  14. +3 −3 python/gui/qgsmapcanvas.sip
  15. +2 −2 python/gui/qgsmapcanvasitem.sip
  16. +1 −1 python/gui/qgsmapoverviewcanvas.sip
  17. +1 −1 python/gui/qgsmaptool.sip
  18. +11 −11 src/app/composer/qgscomposermapwidget.cpp
  19. +2 −2 src/app/legend/qgslegend.cpp
  20. +2 −2 src/app/main.cpp
  21. +3 −3 src/app/qgisapp.cpp
  22. +2 −2 src/app/qgisapp.h
  23. +1 −1 src/app/qgsattributetable.cpp
  24. +1 −1 src/app/qgsattributetabledisplay.cpp
  25. +6 −6 src/app/qgsbookmarkitem.cpp
  26. +3 −3 src/app/qgsbookmarkitem.h
  27. +1 −1 src/app/qgsbookmarks.cpp
  28. +1 −1 src/app/qgsgraduatedsymboldialog.cpp
  29. +4 −4 src/app/qgsmapserverexport.cpp
  30. +7 −7 src/app/qgsmaptoolidentify.cpp
  31. +1 −1 src/app/qgsmaptoolmovefeature.cpp
  32. +1 −1 src/app/qgsmaptoolselect.cpp
  33. +2 −2 src/app/qgssearchquerybuilder.cpp
  34. +10 −10 src/app/qgsvectorlayerproperties.cpp
  35. +2 −2 src/core/CMakeLists.txt
  36. +1 −1 src/core/composer/qgscomposeritem.cpp
  37. +24 −24 src/core/composer/qgscomposermap.cpp
  38. +6 −6 src/core/composer/qgscomposermap.h
  39. +3 −3 src/core/composer/qgscomposerscalebar.cpp
  40. +15 −15 src/core/qgscoordinatetransform.cpp
  41. +10 −10 src/core/qgscoordinatetransform.h
  42. +3 −3 src/core/qgsdataprovider.h
  43. +1 −1 src/core/qgsfeature.cpp
  44. +1 −1 src/core/qgsfeature.h
  45. +12 −12 src/core/qgsgeometry.cpp
  46. +4 −4 src/core/qgsgeometry.h
  47. +2 −2 src/core/qgslabel.cpp
  48. +2 −2 src/core/qgslabel.h
  49. +2 −2 src/core/qgsmaplayer.cpp
  50. +3 −3 src/core/qgsmaplayer.h
  51. +39 −39 src/core/qgsmaprenderer.cpp
  52. +9 −9 src/core/qgsmaprenderer.h
  53. +1 −1 src/core/qgsproject.cpp
  54. +2 −2 src/core/qgsproviderextentcalcevent.cpp
  55. +4 −4 src/core/qgsproviderextentcalcevent.h
  56. +1 −1 src/core/qgsrasterdataprovider.h
  57. +53 −53 src/core/{qgsrect.cpp → qgsrectangle.cpp}
  58. +32 −32 src/core/{qgsrect.h → qgsrectangle.h}
  59. +4 −4 src/core/qgsrendercontext.h
  60. +8 −8 src/core/qgsscalecalculator.cpp
  61. +5 −5 src/core/qgsscalecalculator.h
  62. +3 −3 src/core/qgsvectordataprovider.cpp
  63. +1 −1 src/core/qgsvectordataprovider.h
  64. +1 −1 src/core/qgsvectorfilewriter.cpp
  65. +35 −35 src/core/qgsvectorlayer.cpp
  66. +7 −7 src/core/qgsvectorlayer.h
  67. +25 −25 src/core/raster/qgsrasterlayer.cpp
  68. +1 −1 src/core/raster/qgsrasterlayer.h
  69. +7 −7 src/core/spatialindex/qgsspatialindex.cpp
  70. +3 −3 src/core/spatialindex/qgsspatialindex.h
  71. +32 −32 src/gui/qgsmapcanvas.cpp
  72. +5 −5 src/gui/qgsmapcanvas.h
  73. +4 −4 src/gui/qgsmapcanvasitem.cpp
  74. +4 −4 src/gui/qgsmapcanvasitem.h
  75. +6 −6 src/gui/qgsmapoverviewcanvas.cpp
  76. +2 −2 src/gui/qgsmapoverviewcanvas.h
  77. +1 −1 src/gui/qgsmaptip.cpp
  78. +1 −1 src/gui/qgsmaptool.cpp
  79. +2 −2 src/gui/qgsmaptool.h
  80. +2 −2 src/gui/qgsmaptoolzoom.cpp
  81. +2 −2 src/gui/qgsrubberband.cpp
  82. +1 −1 src/plugins/grass/qgsgrassmodule.cpp
  83. +11 −11 src/plugins/grass/qgsgrassnewmapset.cpp
  84. +7 −7 src/plugins/interpolation/qgsgridfilewriter.cpp
  85. +3 −3 src/plugins/interpolation/qgsgridfilewriter.h
  86. +1 −1 src/plugins/north_arrow/plugin.cpp
  87. +7 −7 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  88. +4 −4 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  89. +2 −2 src/providers/gpx/gpsdata.cpp
  90. +3 −3 src/providers/gpx/gpsdata.h
  91. +15 −15 src/providers/gpx/qgsgpxprovider.cpp
  92. +3 −3 src/providers/gpx/qgsgpxprovider.h
  93. +1 −1 src/providers/grass/provider.cpp
  94. +10 −10 src/providers/grass/qgsgrassprovider.cpp
  95. +2 −2 src/providers/grass/qgsgrassprovider.h
  96. +3 −3 src/providers/memory/qgsmemoryprovider.cpp
  97. +4 −4 src/providers/memory/qgsmemoryprovider.h
  98. +4 −4 src/providers/ogr/qgsogrprovider.cpp
  99. +4 −4 src/providers/ogr/qgsogrprovider.h
  100. +1 −1 src/providers/postgres/qgspostgisbox2d.cpp
  101. +2 −2 src/providers/postgres/qgspostgisbox2d.h
  102. +1 −1 src/providers/postgres/qgspostgisbox3d.cpp
  103. +2 −2 src/providers/postgres/qgspostgisbox3d.h
  104. +1 −1 src/providers/postgres/qgspostgrescountthread.cpp
  105. +3 −3 src/providers/postgres/qgspostgresextentthread.cpp
  106. +3 −3 src/providers/postgres/qgspostgresextentthread.h
  107. +13 −13 src/providers/postgres/qgspostgresprovider.cpp
  108. +5 −5 src/providers/postgres/qgspostgresprovider.h
  109. +3 −3 src/providers/wfs/qgswfsdata.cpp
  110. +4 −4 src/providers/wfs/qgswfsdata.h
  111. +3 −3 src/providers/wfs/qgswfsprovider.cpp
  112. +7 −7 src/providers/wfs/qgswfsprovider.h
  113. +15 −15 src/providers/wms/qgswmsprovider.cpp
  114. +8 −8 src/providers/wms/qgswmsprovider.h
  115. +3 −3 tools/mapserver_export/qgsmapserverexport.cpp
@@ -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
@@ -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);

@@ -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;


/**
@@ -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;

@@ -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);

@@ -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);
@@ -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
@@ -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();

@@ -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);
@@ -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);
@@ -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();
@@ -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);

};

@@ -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
@@ -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);
@@ -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
@@ -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
@@ -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);


};
@@ -16,7 +16,7 @@ class QgsRenderContext

const QgsCoordinateTransform* coordinateTransform() const;

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

const QgsMapToPixel& mapToPixel() const;

@@ -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);
@@ -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);

};

@@ -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);
@@ -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;

@@ -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();
@@ -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);
@@ -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);

@@ -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();
@@ -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);
@@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget

void enableAntiAliasing(bool flag);

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

public slots:

@@ -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);

0 comments on commit 3c391cf

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