mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
Refactored DataProvider to push some vector specific methods down to qgsvectordataprovider. Doing this will allow me to use the dataprovider ABC for the soon to be implemented raster providers - which will in turn provide a cleaner based for projection support. Also added getProjectionWKT virtual method to maplayer and did (concrete) implementation for raster and (placeholder) implementation for vector. Next step will be to implement a getProjectionWKT method in the dataprovider interface with maplayer will delegate to, allowing the retrival of projection info to be handled on a case by case basis in each provider...
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@2544 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
b78357ada3
commit
957de75c40
@ -36,17 +36,8 @@ public:
|
||||
*/
|
||||
virtual ~QgsDataProvider() {};
|
||||
|
||||
/**
|
||||
* Select features based on a bounding rectangle. Features can be retrieved
|
||||
* with calls to getFirstFeature and getNextFeature. Request for features
|
||||
* for use in drawing the map canvas should set useIntersect to false.
|
||||
* @param mbr QgsRect containing the extent to use in selecting features
|
||||
* @param useIntersect If true, use the intersects function to select features
|
||||
* rather than the PostGIS && operator that selects based on bounding box
|
||||
* overlap.
|
||||
*
|
||||
*/
|
||||
virtual void select(QgsRect *mbr, bool useIntersect=false)=0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the data source specification. This may be a path or database
|
||||
* connection string
|
||||
@ -94,14 +85,7 @@ public:
|
||||
{
|
||||
// NOP by default
|
||||
}
|
||||
/**
|
||||
* Update the feature count based on current spatial filter. If not
|
||||
* overridden in the data provider this function returns -1
|
||||
*/
|
||||
virtual long updateFeatureCount()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the extents of the layer. Not implemented by default
|
||||
*/
|
||||
|
@ -38,6 +38,7 @@ class QgsLegendItem;
|
||||
class QDomNode;
|
||||
class QDomDocument;
|
||||
class QEvent;
|
||||
class QgsCoordinateTransform;
|
||||
|
||||
/** \class QgsMapLayer
|
||||
* \brief Base class for all map layer types.
|
||||
@ -347,12 +348,14 @@ signals:
|
||||
|
||||
protected:
|
||||
|
||||
/** Used to ask the layer for its projection as a WKT string. Must be reimplemented by each provider. */
|
||||
virtual QString getProjectionWKT() = 0 ;
|
||||
|
||||
/** called by readXML(), used by children to read state specific to them from
|
||||
project files.
|
||||
*/
|
||||
virtual bool readXML_( QDomNode & layer_node );
|
||||
|
||||
|
||||
/** called by writeXML(), used by children to write state specific to them to
|
||||
project files.
|
||||
*/
|
||||
@ -428,6 +431,9 @@ private: // Private attributes
|
||||
//! Tag for embedding additional information
|
||||
QString tag;
|
||||
|
||||
//! A QgsCoordinateTransform is used for on the fly reprojection of map layers
|
||||
QgsCoordinateTransform * gCoordinateTransfrom;
|
||||
|
||||
/** true if visible ? */
|
||||
bool m_visible;
|
||||
|
||||
|
@ -353,6 +353,8 @@ public:
|
||||
/** \brief The destuctor. */
|
||||
~QgsRasterLayer();
|
||||
|
||||
/** \brief Query gdal to find out the WKT projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
|
||||
QString getProjectionWKT() { return QString (gdalDataset->GetProjectionRef());};
|
||||
|
||||
/** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
|
||||
void drawThumbnail(QPixmap * theQPixmap);
|
||||
|
@ -26,7 +26,25 @@ class QgsVectorDataProvider: public QgsDataProvider
|
||||
QgsVectorDataProvider();
|
||||
|
||||
virtual ~QgsVectorDataProvider() {};
|
||||
|
||||
/**
|
||||
* Select features based on a bounding rectangle. Features can be retrieved
|
||||
* with calls to getFirstFeature and getNextFeature. Request for features
|
||||
* for use in drawing the map canvas should set useIntersect to false.
|
||||
* @param mbr QgsRect containing the extent to use in selecting features
|
||||
* @param useIntersect If true, use the intersects function to select features
|
||||
* rather than the PostGIS && operator that selects based on bounding box
|
||||
* overlap.
|
||||
*
|
||||
*/
|
||||
virtual void select(QgsRect *mbr, bool useIntersect=false)=0;
|
||||
/**
|
||||
* Update the feature count based on current spatial filter. If not
|
||||
* overridden in the data provider this function returns -1
|
||||
*/
|
||||
virtual long updateFeatureCount()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* Get the first feature resulting from a select operation
|
||||
* @return QgsFeature
|
||||
|
@ -25,7 +25,7 @@ class QLibrary;
|
||||
class QgsMapToPixel;
|
||||
class OGRLayer;
|
||||
class OGRDataSource;
|
||||
class QgsDataProvider;
|
||||
class QgsData;
|
||||
class QgsRenderer;
|
||||
class QgsLegendItem;
|
||||
class QgsDlgVectorLayerProperties;
|
||||
@ -93,7 +93,12 @@ class QgsVectorLayer : public QgsMapLayer
|
||||
|
||||
QgsVectorDataProvider * getDataProvider();
|
||||
|
||||
|
||||
/** \brief Query gdal to find out the WKT projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
|
||||
QString getProjectionWKT()
|
||||
{
|
||||
//delegate to data provider...
|
||||
};
|
||||
|
||||
QgsLabel *label();
|
||||
|
||||
QgsAttributeAction* actions() { return &mActions; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user