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:
timlinux 2004-12-30 17:32:28 +00:00
parent b78357ada3
commit 957de75c40
5 changed files with 38 additions and 23 deletions

View File

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

View File

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

View File

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

View File

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

View File

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