1
/***************************************************************************
2
qgsdataprovider.h - DataProvider Interface class
3
--------------------------------------
5
Copyright : (C) 2003 by Gary E.Sherman
6
email : sherman at mrcc.com
7
***************************************************************************
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
14
***************************************************************************/
15
/* $Id: qgsdataprovider.h,v 1.14.2.3 2004/12/10 03:54:23 gsherman Exp $ */
17
#ifndef QQGSDATAPROVIDER_H
18
#define QQGSDATAPROVIDER_H
25
class QgsDataSourceURI;
26
/** \class QgsDataProvider
27
* \brief Abstract base class for spatial data provider implementations
28
*@author Gary E.Sherman
31
class QgsDataProvider {
35
* We need this so the subclass destructors get called
37
virtual ~QgsDataProvider() {};
40
* Select features based on a bounding rectangle. Features can be retrieved
41
* with calls to getFirstFeature and getNextFeature. Request for features
42
* for use in drawing the map canvas should set useIntersect to false.
43
* @param mbr QgsRect containing the extent to use in selecting features
44
* @param useIntersect If true, use the intersects function to select features
45
* rather than the PostGIS && operator that selects based on bounding box
49
virtual void select(QgsRect *mbr, bool useIntersect=false)=0;
51
* Set the data source specification. This may be a path or database
53
* @param data source specification
55
virtual void setDataSourceUri(QString uri) = 0;
58
* Get the data source specification. This may be a path or database
60
* @return data source specification
62
virtual QString getDataSourceUri() = 0;
64
virtual QgsDataSourceURI * getURI()=0;
66
* Get the extent of the layer
67
* @return QgsRect containing the extent of the layer
69
virtual QgsRect * extent() = 0;
72
* Identify features within the search radius specified by rect
73
* @param rect Bounding rectangle of search radius
74
* @return std::vector containing QgsFeature objects that intersect rect
76
//virtual std::vector<QgsFeature>& QgsDataProvider::identify(QgsRect *rect)=0;
79
* Return the endian of this layer.
80
* @return 0 for NDR (little endian), 1 for XDR (big endian
82
virtual int endian()=0;
85
* Returns true if this is a valid layer. It is up to individual providers
86
* to determine what constitutes a valid layer
88
virtual bool isValid()=0;
90
/* Reset the layer - for an OGRLayer, this means clearing the
91
* spatial filter and calling ResetReading
98
* Update the feature count based on current spatial filter. If not
99
* overridden in the data provider this function returns -1
101
virtual long updateFeatureCount()
106
* Update the extents of the layer. Not implemented by default
108
virtual void updateExtents()
113
* Set the subset string used to create a subset of features in
114
* the layer. This may be a sql where clause or any other string
115
* that can be used by the data provider to create a subset.
116
* Must be implemented in the dataprovider.
118
virtual void setSubsetString(QString subset)
123
* Returns the subset definition string (typically sql) currently in
124
* use by the layer and used by the provider to limit the feature set.
125
* Must be overridden in the dataprovider, otherwise returns a null
128
virtual QString subsetString()
130
return QString::null;