Skip to content

Commit dc8ac45

Browse files
committedAug 2, 2012
[FEATURE] allow adding of sql queries with SelectAtId=false
- sync sip bindings of QGis, QgsApplication, QgsDataSourceURI and QgsPoint with C++
1 parent 5988a9c commit dc8ac45

File tree

11 files changed

+418
-320
lines changed

11 files changed

+418
-320
lines changed
 

‎python/core/qgis.sip

Lines changed: 125 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -24,120 +24,132 @@ class QGis
2424
#include <qgis.h>
2525
%End
2626

27-
public:
28-
// Version constants
29-
//
30-
// Version string
31-
static const char* QGIS_VERSION;
32-
// Version number used for comparing versions using the "Check QGIS Version" function
33-
static const int QGIS_VERSION_INT;
34-
// Release name
35-
static const char* QGIS_RELEASE_NAME;
36-
// The subversion version
37-
static const char* QGIS_DEV_VERSION;
38-
39-
// Enumerations
40-
//
41-
42-
//! Used for symbology operations
43-
// Feature types
44-
enum WkbType
45-
{
46-
WKBPoint = 1,
47-
WKBLineString,
48-
WKBPolygon,
49-
WKBMultiPoint,
50-
WKBMultiLineString,
51-
WKBMultiPolygon,
52-
WKBUnknown,
53-
WKBPoint25D = 0x80000001,
54-
WKBLineString25D,
55-
WKBPolygon25D,
56-
WKBMultiPoint25D,
57-
WKBMultiLineString25D,
58-
WKBMultiPolygon25D
59-
};
60-
enum GeometryType
61-
{
62-
Point,
63-
Line,
64-
Polygon,
65-
UnknownGeometry
66-
};
67-
68-
// TODO:
69-
//static const char *qgisVectorGeometryType[];
70-
//! description strings for feature types
71-
//static const char *qgisFeatureTypes[];
72-
73-
/** Map units that qgis supports
74-
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and UnknownUnit
75-
* @note that QGIS > 1.8 api returns to that
76-
*/
77-
enum UnitType
78-
{
79-
Meters = 0,
80-
Feet = 1,
81-
Degrees = 2,
82-
UnknownUnit = 3,
83-
84-
// for [1.4;1.8] api backwards compatibility
85-
DecimalDegrees = 2,
86-
DegreesMinutesSeconds = 2,
87-
DegreesDecimalMinutes = 2,
88-
};
89-
90-
//! User defined event types
91-
enum UserEvent
92-
{
93-
// These first two are useful for threads to alert their parent data providers
94-
95-
//! The extents have been calculated by a provider of a layer
96-
ProviderExtentCalcEvent = QgisEvent,
97-
98-
//! The row count has been calculated by a provider of a layer
99-
ProviderCountCalcEvent
100-
};
101-
102-
static const int DEFAULT_IDENTIFY_RADIUS;
27+
public:
28+
// Version constants
29+
//
30+
// Version string
31+
static const char* QGIS_VERSION;
32+
// Version number used for comparing versions using the "Check QGIS Version" function
33+
static const int QGIS_VERSION_INT;
34+
// Release name
35+
static const char* QGIS_RELEASE_NAME;
36+
// The development version
37+
static const char* QGIS_DEV_VERSION;
38+
39+
// Enumerations
40+
//
41+
42+
//! Used for symbology operations
43+
// Feature types
44+
enum WkbType
45+
{
46+
WKBUnknown = 0,
47+
WKBPoint = 1,
48+
WKBLineString,
49+
WKBPolygon,
50+
WKBMultiPoint,
51+
WKBMultiLineString,
52+
WKBMultiPolygon,
53+
WKBNoGeometry = 100, //attributes only
54+
WKBPoint25D = 0x80000001,
55+
WKBLineString25D,
56+
WKBPolygon25D,
57+
WKBMultiPoint25D,
58+
WKBMultiLineString25D,
59+
WKBMultiPolygon25D,
60+
};
61+
62+
enum GeometryType
63+
{
64+
Point,
65+
Line,
66+
Polygon,
67+
UnknownGeometry,
68+
NoGeometry
69+
};
70+
71+
// TODO: String representation of geometry types (set in qgis.cpp)
72+
// static const char *qgisVectorGeometryType[];
73+
74+
//! description strings for feature types
75+
// static const char *qgisFeatureTypes[];
76+
77+
/** Map units that qgis supports
78+
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and UnknownUnit
79+
* @note and QGIS >1.8 returns to that
80+
*/
81+
enum UnitType
82+
{
83+
Meters = 0,
84+
Feet = 1,
85+
Degrees = 2, //for 1.0 api backwards compatibility
86+
UnknownUnit = 3,
87+
88+
// for [1.4;1.8] api compatibility
89+
DecimalDegrees = 2, // was 2
90+
DegreesMinutesSeconds = 2, // was 4
91+
DegreesDecimalMinutes = 2, // was 5
92+
};
93+
94+
//! User defined event types
95+
enum UserEvent
96+
{
97+
// These first two are useful for threads to alert their parent data providers
98+
99+
//! The extents have been calculated by a provider of a layer
100+
ProviderExtentCalcEvent = QgisEvent,
101+
102+
//! The row count has been calculated by a provider of a layer
103+
ProviderCountCalcEvent
104+
};
105+
106+
static const double DEFAULT_IDENTIFY_RADIUS;
103107
};
104108

105109

106-
/** Wkt string that represents a geographic coord sys
107-
* @note added in 1.8 to replace GEOWkt
108-
*/
109-
const QString GEOWKT;
110-
/** Wkt string that represents a geographic coord sys
111-
* @note deprecated in 1.8 due to violation of coding conventions (globals
112-
* should be in all caps).
113-
*/
114-
const QString GEOWkt /Deprecated/;
115-
116-
/** PROJ4 string that represents a geographic coord sys */
117-
const QString GEOPROJ4;
118-
/** Magic number for a geographic coord sys in POSTGIS SRID */
119-
const long GEOSRID;
120-
/** Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id */
121-
const long GEOCRS_ID;
122-
/** Magic number for a geographic coord sys in EpsgCrsId ID format */
123-
const long GEO_EPSG_CRS_ID;
124-
/** The length of teh string "+proj=" */
125-
const int PROJ_PREFIX_LEN;
126-
/** The length of teh string "+ellps=" */
127-
const int ELLPS_PREFIX_LEN;
128-
/** The length of the string "+lat_1=" */
129-
const int LAT_PREFIX_LEN;
130-
/** Magick number that determins whether a projection srsid is a system (srs.db)
131-
* or user (~/.qgis.qgis.db) defined projection. */
132-
const int USER_CRS_START_ID;
133-
134-
//
135-
// Constants for point symbols
136-
//
137-
138-
/** Magic number that determines the minimum allowable point size for point symbols */
139-
const float MINIMUM_POINT_SIZE;
140-
/** Magic number that determines the minimum allowable point size for point symbols */
141-
const float DEFAULT_POINT_SIZE;
142-
const double DEFAULT_LINE_WIDTH;
110+
/** Wkt string that represents a geographic coord sys
111+
* @note added in 1.8 to replace GEOWkt
112+
*/
113+
const QString GEOWKT;
114+
115+
/** Wkt string that represents a geographic coord sys
116+
* @note deprecated in 1.8 due to violation of coding conventions (globals
117+
* should be in all caps).
118+
*/
119+
const QString GEOWkt /Deprecated/;
120+
121+
const QString PROJECT_SCALES;
122+
123+
/** PROJ4 string that represents a geographic coord sys */
124+
const QString GEOPROJ4;
125+
/** Magic number for a geographic coord sys in POSTGIS SRID */
126+
const long GEOSRID;
127+
/** Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id */
128+
const long GEOCRS_ID;
129+
/** Magic number for a geographic coord sys in EpsgCrsId ID format */
130+
const long GEO_EPSG_CRS_ID;
131+
/** Geographic coord sys from EPSG authority */
132+
const QString GEO_EPSG_CRS_AUTHID;
133+
/** The length of the string "+proj=" */
134+
const int PROJ_PREFIX_LEN;
135+
/** The length of the string "+ellps=" */
136+
const int ELLPS_PREFIX_LEN;
137+
/** The length of the string "+lat_1=" */
138+
const int LAT_PREFIX_LEN;
139+
/** Magick number that determines whether a projection crsid is a system (srs.db)
140+
* or user (~/.qgis.qgis.db) defined projection. */
141+
const int USER_CRS_START_ID;
142+
143+
//
144+
// Constants for point symbols
145+
//
146+
147+
/** Magic number that determines the minimum allowable point size for point symbols */
148+
const double MINIMUM_POINT_SIZE;
149+
/** Magic number that determines the default point size for point symbols */
150+
const double DEFAULT_POINT_SIZE;
151+
const double DEFAULT_LINE_WIDTH;
152+
153+
/** default snapping tolerance for segments (@note added in 1.8) */
154+
const double DEFAULT_SEGMENT_EPSILON;
143155

‎python/core/qgsapplication.sip

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
8787
* The theme search path usually will be pkgDataPath + "/themes/" + themName + "/"
8888
* but plugin writers etc can use themeName() as a basis for searching
8989
* for resources in their own datastores e.g. a Qt4 resource bundle.
90-
* @Note A basic test will be carried out to ensure the theme search path
91-
* based on the supplied theme name exists. If it does not the theme name will
90+
* @note A basic test will be carried out to ensure the theme search path
91+
* based on the supplied theme name exists. If it does not the theme name will
9292
* be reverted to 'default'.
9393
*/
94-
static void setThemeName(const QString theThemeName);
94+
static void setThemeName( const QString theThemeName );
9595

9696
/** Set the active theme to the specified theme.
9797
* The theme name should be a single word e.g. 'default','classic'.
@@ -125,7 +125,8 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
125125
static const QString translatorsFilePath();
126126

127127
//! Returns the path to the developer image directory.
128-
static const QString developerPath();
128+
//! @deprecated images are not provided anymore :-P
129+
static const QString developerPath() /Deprecated/;
129130

130131
//! Returns the path to the help application.
131132
static const QString helpAppPath();
@@ -138,7 +139,7 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
138139

139140
//! Returns the path to the settings directory in user's home dir
140141
static const QString qgisSettingsDirPath();
141-
142+
142143
//! Returns the path to the user qgis.db file.
143144
static const QString qgisUserDbFilePath();
144145

@@ -151,12 +152,12 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
151152
//! Returns the path to the srs.db file.
152153
static const QString srsDbFilePath();
153154

154-
//! Returns the paths to the svg directories.
155+
//! Returns the pathes to svg directories.
155156
//! @note added in 1.4
156157
static const QStringList svgPaths();
157158

158-
//! Returns the path to the applications svg paths
159-
//! @deprecated use svgPaths()
159+
//! Returns the paths to svg applications svg directory.
160+
//! @deprecated since 1.4 - use svgPaths()
160161
static const QString svgPath() /Deprecated/;
161162

162163
//! Returns the path to the application prefix directory.
@@ -169,16 +170,26 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
169170
static const QString pkgDataPath();
170171

171172
//! Returns the path to the currently active theme directory.
172-
static const QString activeThemePath();
173+
static const QString activeThemePath();
173174

174175
//! Returns the path to the default theme directory.
175-
static const QString defaultThemePath();
176-
176+
static const QString defaultThemePath();
177+
177178
//! Returns path to the desired icon file.
178179
//! First it tries to use the active theme path, then default theme path
179180
//! @note Added in 1.5
180181
static QString iconPath( QString iconFile );
181182

183+
//! Helper to get a theme icon. It will fall back to the
184+
//! default theme if the active theme does not have the required icon.
185+
//! @note Added in 2.0
186+
static QIcon getThemeIcon( const QString theName );
187+
188+
//! Helper to get a theme icon as a pixmap. It will fall back to the
189+
//! default theme if the active theme does not have the required icon.
190+
//! @note Added in 2.0
191+
static QPixmap getThemePixmap( const QString theName );
192+
182193
//! Returns the path to user's style. Added in QGIS 1.4
183194
static const QString userStyleV2Path();
184195

@@ -194,23 +205,23 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
194205
static const QString libexecPath();
195206

196207
//! Alters prefix path - used by 3rd party apps
197-
static void setPrefixPath(const QString thePrefixPath, bool useDefaultPaths = FALSE);
198-
208+
static void setPrefixPath( const QString thePrefixPath, bool useDefaultPaths = false );
209+
199210
//! Alters plugin path - used by 3rd party apps
200-
static void setPluginPath(const QString thePluginPath);
211+
static void setPluginPath( const QString thePluginPath );
201212

202213
//! Alters pkg data path - used by 3rd party apps
203-
static void setPkgDataPath(const QString thePkgDataPath);
214+
static void setPkgDataPath( const QString thePkgDataPath );
204215

205216
//! Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5
206217
static void setDefaultSvgPaths( const QStringList& pathList );
207-
218+
208219
//! loads providers
209220
static void initQgis();
210221

211222
//! deletes provider registry and map layer registry
212223
static void exitQgis();
213-
224+
214225
/** constants for endian-ness */
215226
enum endian_t
216227
{
@@ -231,14 +242,14 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
231242
*/
232243
static QString reportStyleSheet();
233244

234-
/** Convenience function to get a summary of the paths used in this
245+
/** Convenience function to get a summary of the paths used in this
235246
* application instance useful for debugging mainly.*/
236247
static QString showSettings();
237248

238249
/** Register OGR drivers ensuring this only happens once.
239250
* This is a workaround for an issue with older gdal versions that
240-
* caused duplicate driver name entries to appear in the list
241-
* of registered drivers when QgsApplication::registerOgrDrivers was called multiple
251+
* caused duplicate driver name entries to appear in the list
252+
* of registered drivers when QgsApplication::registerOgrDrivers was called multiple
242253
* times.
243254
*/
244255
static void registerOgrDrivers();
@@ -260,26 +271,25 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
260271
@note added in 2.0 */
261272
static QString buildOutputPath();
262273

263-
/** Sets the GDAL_SKIP environment variable to include the specified driver
274+
/** Sets the GDAL_SKIP environment variable to include the specified driver
264275
* and then calls GDALDriverManager::AutoSkipDrivers() to unregister it. The
265-
* driver name should be the short format of the Gdal driver name e.g. GTiff.
276+
* driver name should be the short format of the Gdal driver name e.g. GTIFF.
266277
* @note added in 2.0
267278
*/
268279
static void skipGdalDriver( QString theDriver );
269280

270-
/** Sets the GDAL_SKIP environment variable to exclude the specified driver
281+
/** Sets the GDAL_SKIP environment variable to exclude the specified driver
271282
* and then calls GDALDriverManager::AutoSkipDrivers() to unregister it. The
272-
* driver name should be the short format of the Gdal driver name e.g. GTiff.
283+
* driver name should be the short format of the Gdal driver name e.g. GTIFF.
273284
* @note added in 2.0
274285
*/
275286
static void restoreGdalDriver( QString theDriver );
276287

277-
278288
/** Returns the list of gdal drivers that should be skipped (based on
279-
* GDAL_SKIP environment variable)
289+
* GDAL_SKIP environment variable)
280290
* @note added in 2.0
281291
*/
282-
static QStringList skippedGdalDrivers( ) const ;
292+
static QStringList skippedGdalDrivers( );
283293

284294
/** Apply the skipped drivers list to gdal
285295
* @see skipGdalDriver

‎python/core/qgsdatasourceuri.sip

Lines changed: 124 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -11,82 +11,128 @@ class QgsDataSourceURI
1111
#include <qgsdatasourceuri.h>
1212
%End
1313

14-
public:
15-
//! \note enumeration added in version 1.1
16-
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire };
17-
18-
//! default constructor
19-
QgsDataSourceURI();
20-
21-
//! constructor which parses input URI
22-
QgsDataSourceURI(QString uri);
23-
24-
//! connection info
25-
QString connectionInfo() const;
26-
27-
//! complete uri
28-
QString uri() const;
29-
30-
//! quoted table name
31-
QString quotedTablename() const;
32-
33-
//! Set all connection related members at once
34-
//! \note This optional sslmode parameter has been added in version 1.1
35-
void setConnection(const QString& aHost,
36-
const QString& aPort,
37-
const QString& aDatabase,
38-
const QString& aUsername,
39-
const QString& aPassword,
40-
SSLmode sslmode = SSLprefer );
41-
42-
//! Set all connection related members at once
43-
//! \note added in 1.7
44-
void setConnection(const QString& service,
45-
const QString& aDatabase,
46-
const QString& aUsername,
47-
const QString& aPassword,
48-
SSLmode sslmode = SSLprefer );
49-
50-
//! Set database
51-
//! \note added in 1.4
52-
void setDatabase( const QString &database );
53-
54-
//! Set all data source related members at once
55-
void setDataSource(const QString& aSchema,
56-
const QString& aTable,
57-
const QString& aGeometryColumn,
58-
const QString& aSql = QString(),
59-
const QString& aKeyColumn = QString());
60-
61-
/** Removes password from uris
62-
* @note this method was added in QGIS 1.1
63-
*/
64-
static QString removePassword( const QString& aUri);
65-
66-
QString username() const;
67-
QString schema() const;
68-
QString table() const;
69-
QString sql() const;
70-
QString geometryColumn() const;
71-
72-
//! set use Estimated Metadata
73-
// added in 1.5
74-
void setUseEstimatedMetadata( bool theFlag );
75-
bool useEstimatedMetadata() const;
76-
77-
// added in 1.1
78-
QString host() const;
79-
QString database() const;
80-
QString password() const;
81-
QString port() const;
82-
SSLmode sslMode() const;
83-
84-
// added in 1.7
85-
QString service() const;
86-
87-
void setSql(QString sql);
88-
89-
// added in 1.2
90-
QString keyColumn() const;
91-
void setKeyColumn(QString column);
14+
public:
15+
//! \note enumeration added in version 1.1
16+
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire };
17+
18+
//! default constructor
19+
QgsDataSourceURI();
20+
21+
//! constructor which parses input URI
22+
QgsDataSourceURI( QString uri );
23+
24+
//! return connection part of URI
25+
QString connectionInfo() const;
26+
27+
//! return complete uri
28+
QString uri() const;
29+
30+
//! return complete encoded uri (generic mode)
31+
// \note added in 1.9
32+
QByteArray encodedUri() const;
33+
34+
//! set complete encoded uri (generic mode)
35+
// \note added in 1.9
36+
void setEncodedUri( const QString & uri );
37+
38+
//! quoted table name
39+
QString quotedTablename() const;
40+
41+
//! Set generic param (generic mode)
42+
// \note if key exists, another is inserted
43+
// \note added in 1.9
44+
void setParam( const QString &key, const QString &value );
45+
void setParamList( const QString &key, const QStringList &value );
46+
%MethodCode
47+
sipCpp->setParam( *a0, *a1 );
48+
%End
49+
50+
//! Get generic param (generic mode)
51+
// \note added in 1.9
52+
QString param( const QString &key ) const;
53+
54+
//! Get multiple generic param (generic mode)
55+
// \note added in 1.9
56+
QStringList params( const QString &key ) const;
57+
58+
//! Test if param exists (generic mode)
59+
// \note added in 1.9
60+
bool hasParam( const QString &key ) const;
61+
62+
//! Set all connection related members at once
63+
//! \note This optional sslmode parameter has been added in version 1.1
64+
void setConnection( const QString& aHost,
65+
const QString& aPort,
66+
const QString& aDatabase,
67+
const QString& aUsername,
68+
const QString& aPassword,
69+
SSLmode sslmode = SSLprefer );
70+
71+
//! Set all connection related members at once (for the service case)
72+
//! \note This optional sslmode parameter has been added in version 1.7
73+
void setConnection( const QString& aService,
74+
const QString& aDatabase,
75+
const QString& aUsername,
76+
const QString& aPassword,
77+
SSLmode sslmode = SSLprefer );
78+
79+
//! Set database
80+
// \note added in 1.4
81+
void setDatabase( const QString &database );
82+
83+
//! Set all data source related members at once
84+
void setDataSource( const QString& aSchema,
85+
const QString& aTable,
86+
const QString& aGeometryColumn,
87+
const QString& aSql = QString(),
88+
const QString& aKeyColumn = QString() );
89+
90+
//! set username
91+
// added in 1.5
92+
void setUsername( QString username );
93+
94+
//! set password
95+
// added in 1.5
96+
void setPassword( QString password );
97+
98+
//! Removes password element from uris
99+
static QString removePassword( const QString& aUri );
100+
101+
QString username() const;
102+
QString schema() const;
103+
QString table() const;
104+
QString sql() const;
105+
QString geometryColumn() const;
106+
107+
//! set use Estimated Metadata
108+
// added in 1.5
109+
void setUseEstimatedMetadata( bool theFlag );
110+
bool useEstimatedMetadata() const;
111+
112+
void disableSelectAtId( bool theFlag );
113+
bool selectAtIdDisabled() const;
114+
115+
void clearSchema();
116+
void setSql( QString sql );
117+
118+
// added in version 1.1
119+
QString host() const;
120+
QString database() const;
121+
QString port() const;
122+
QString password() const;
123+
SSLmode sslMode() const;
124+
125+
// added in 1.7
126+
QString service() const;
127+
128+
// added in version 1.2
129+
QString keyColumn() const;
130+
void setKeyColumn( QString column );
131+
132+
// added in 1.9
133+
QGis::WkbType wkbType() const;
134+
void setWkbType( QGis::WkbType type );
135+
136+
QString srid() const;
137+
void setSrid( QString srid );
92138
};

‎python/core/qgspoint.sip

Lines changed: 76 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,89 +8,94 @@ class QgsPoint
88
#include <QString>
99
%End
1010

11-
12-
public:
11+
public:
1312
/// Default constructor
14-
QgsPoint();
15-
16-
/*! Create a point from another point */
17-
QgsPoint(const QgsPoint& p);
18-
19-
/*! Create a point from x,y coordinates
20-
* @param x x coordinate
21-
* @param y y coordinate
22-
*/
23-
QgsPoint(double x, double y);
24-
25-
~QgsPoint();
26-
27-
/*! Sets the x value of the point
28-
* @param x x coordinate
29-
*/
30-
void setX(double x);
31-
32-
/*! Sets the y value of the point
33-
* @param y y coordinate
34-
*/
35-
void setY(double y);
13+
QgsPoint();
3614

37-
/*! Sets the x and y value of the point */
38-
void set(double x, double y);
15+
/*! Create a point from another point */
16+
QgsPoint(const QgsPoint& p);
17+
18+
/*! Create a point from x,y coordinates
19+
* @param x x coordinate
20+
* @param y y coordinate
21+
*/
22+
QgsPoint( double x, double y );
23+
24+
~QgsPoint();
25+
26+
/*! Sets the x value of the point
27+
* @param x x coordinate
28+
*/
29+
void setX( double x );
30+
31+
/*! Sets the y value of the point
32+
* @param y y coordinate
33+
*/
34+
void setY( double y );
3935

40-
/*! Get the x value of the point
41-
* @return x coordinate
42-
*/
43-
double x() const;
36+
/*! Sets the x and y value of the point */
37+
void set( double x, double y );
4438

45-
/*! Get the y value of the point
46-
* @return y coordinate
47-
*/
48-
double y() const;
39+
/*! Get the x value of the point
40+
* @return x coordinate
41+
*/
42+
double x() const;
4943

50-
//! String representation of the point (x,y)
51-
QString toString() const;
44+
/*! Get the y value of the point
45+
* @return y coordinate
46+
*/
47+
double y() const;
5248

53-
//! As above but with precision for string representaiton of a point
54-
QString toString(int thePrecision) const;
55-
56-
/** Return a string representation as degrees minutes seconds.
57-
* Its up to the calling function to ensure that this point can
58-
* be meaningfully represented in this form.
59-
* @note added in QGIS 1.4
60-
*/
61-
QString toDegreesMinutesSeconds( int thePrecision ) const;
49+
//! String representation of the point (x,y)
50+
QString toString() const;
6251

63-
64-
/*! Return the well known text representation for the point.
65-
* The wkt is created without an SRID.
66-
* @return Well known text in the form POINT(x y)
67-
*/
68-
QString wellKnownText();
52+
//! As above but with precision for string representation of a point
53+
QString toString( int thePrecision ) const;
54+
55+
/** Return a string representation as degrees minutes seconds.
56+
* Its up to the calling function to ensure that this point can
57+
* be meaningfully represented in this form.
58+
* @note added in QGIS 1.4
59+
*/
60+
QString toDegreesMinutesSeconds( int thePrecision ) const;
61+
62+
/** Return a string representation as degrees minutes.
63+
* Its up to the calling function to ensure that this point can
64+
* be meaningfully represented in this form.
65+
* @note added in QGIS 1.9
66+
*/
67+
QString toDegreesMinutes( int thePrecision ) const;
68+
69+
70+
/*! Return the well known text representation for the point.
71+
* The wkt is created without an SRID.
72+
* @return Well known text in the form POINT(x y)
73+
*/
74+
QString wellKnownText() const;
6975

70-
/**Returns the squared distance between this point and x,y*/
71-
double sqrDist(double x, double y) const;
76+
/**Returns the squared distance between this point and x,y*/
77+
double sqrDist( double x, double y ) const;
7278

73-
/**Returns the squared distance between this and other point*/
74-
double sqrDist(const QgsPoint& other);
79+
/**Returns the squared distance between this and other point*/
80+
double sqrDist( const QgsPoint& other ) const;
7581

76-
/**Returns the minimum distance between this point and a segment
82+
/**Returns the minimum distance between this point and a segment
7783
@note added in QGIS 1.5*/
78-
double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint& minDistPoint /Out/) const;
84+
double sqrDistToSegment( double x1, double y1, double x2, double y2, QgsPoint& minDistPoint /Out/, double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
7985

80-
/**Calculates azimut between this point and other one (clockwise in degree, starting from north)
81-
@note: this function has been added in version 1.7*/
82-
double azimuth( const QgsPoint& other );
86+
/**Calculates azimut between this point and other one (clockwise in degree, starting from north)
87+
@note: this function has been added in version 1.7*/
88+
double azimuth( const QgsPoint& other );
89+
90+
//! equality operator
91+
bool operator==( const QgsPoint &other );
92+
93+
//! Inequality operator
94+
bool operator!=( const QgsPoint &other ) const;
95+
96+
//! Multiply x and y by the given value
97+
void multiply( const double& scalar );
8398

84-
//! equality operator
85-
bool operator==(const QgsPoint &other);
86-
87-
//! Inequality operator
88-
bool operator!=(const QgsPoint &other);
89-
90-
//! Multiply x and y by the given value
91-
void multiply(const double& scalar);
92-
93-
9499
SIP_PYOBJECT __repr__();
95100
%MethodCode
96101
QString str = "(" + QString::number(sipCpp->x()) + "," + QString::number(sipCpp->y()) + ")";
@@ -118,5 +123,5 @@ public:
118123

119124

120125

121-
}; // class QgsPOint
126+
}; // class QgsPoint
122127

‎python/plugins/db_manager/db_plugins/plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,21 @@ def info(self):
192192
from .info_model import DatabaseInfo
193193
return DatabaseInfo(self)
194194

195-
196195
def sqlResultModel(self, sql, parent):
197196
from .data_model import SqlResultModel
198197
return SqlResultModel(self, sql, parent)
199198

200-
201-
def toSqlLayer(self, sql, geomCol, uniqueCol, layerName="QueryLayer", layerType=None):
199+
def toSqlLayer(self, sql, geomCol, uniqueCol, layerName="QueryLayer", layerType=None, avoidSelectById=False):
202200
from qgis.core import QgsMapLayer, QgsVectorLayer, QgsRasterLayer
203201
uri = self.uri()
204202
uri.setDataSource("", u"(%s\n)" % sql, geomCol, QString(), uniqueCol)
203+
if avoidSelectById:
204+
uri.disableSelectAtId( True )
205205
provider = self.dbplugin().providerName()
206206
if layerType == QgsMapLayer.RasterLayer:
207207
return QgsRasterLayer(uri.uri(), layerName, provider)
208208
return QgsVectorLayer(uri.uri(), layerName, provider)
209209

210-
211210
def registerAllActions(self, mainWindow):
212211
self.registerDatabaseActions(mainWindow)
213212
self.registerSubPluginActions(mainWindow)

‎python/plugins/db_manager/db_plugins/postgis/plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ def tableTriggersFactory(self, row, table):
244244
def tableRulesFactory(self, row, table):
245245
return PGTableRule(row, table)
246246

247-
248247
def info(self):
249248
from .info_model import PGTableInfo
250249
return PGTableInfo(self)

‎python/plugins/db_manager/dlg_sql_window.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def loadAsLayerToggled(self, checked):
8383
self.loadAsLayerGroup.setChecked( checked )
8484
self.loadAsLayerWidget.setVisible( checked )
8585

86-
8786
def getSql(self):
8887
# If the selection obtained from an editor spans a line break,
8988
# the text will contain a Unicode U+2029 paragraph separator
@@ -132,7 +131,6 @@ def executeSql(self):
132131
self.update()
133132
QApplication.restoreOverrideCursor()
134133

135-
136134
def loadSqlLayer(self):
137135
uniqueFieldName = self.uniqueCombo.currentText()
138136
geomFieldName = self.geomCombo.currentText()
@@ -165,7 +163,7 @@ def loadSqlLayer(self):
165163
newLayerName = u"%s_%d" % (layerName, index)
166164

167165
# create the layer
168-
layer = self.db.toSqlLayer(query, geomFieldName, uniqueFieldName, newLayerName, layerType)
166+
layer = self.db.toSqlLayer(query, geomFieldName, uniqueFieldName, newLayerName, layerType, self.avoidSelectById.isChecked())
169167
if layer.isValid():
170168
QgsMapLayerRegistry.instance().addMapLayer(layer, True)
171169

‎python/plugins/db_manager/ui/DlgSqlWindow.ui

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>738</width>
9+
<width>747</width>
1010
<height>525</height>
1111
</rect>
1212
</property>
@@ -19,7 +19,7 @@
1919
<property name="orientation">
2020
<enum>Qt::Vertical</enum>
2121
</property>
22-
<widget class="QWidget" name="">
22+
<widget class="QWidget" name="layoutWidget">
2323
<layout class="QVBoxLayout" name="verticalLayout_2">
2424
<item>
2525
<widget class="QLabel" name="label">
@@ -81,7 +81,7 @@
8181
</item>
8282
</layout>
8383
</widget>
84-
<widget class="QWidget" name="">
84+
<widget class="QWidget" name="layoutWidget">
8585
<layout class="QVBoxLayout" name="verticalLayout">
8686
<item>
8787
<widget class="QLabel" name="label_2">
@@ -107,6 +107,16 @@
107107
</widget>
108108
</widget>
109109
</item>
110+
<item row="2" column="0">
111+
<widget class="QDialogButtonBox" name="buttonBox">
112+
<property name="orientation">
113+
<enum>Qt::Horizontal</enum>
114+
</property>
115+
<property name="standardButtons">
116+
<set>QDialogButtonBox::Close</set>
117+
</property>
118+
</widget>
119+
</item>
110120
<item row="1" column="0">
111121
<widget class="QGroupBox" name="loadAsLayerGroup">
112122
<property name="sizePolicy">
@@ -286,19 +296,19 @@ columns</string>
286296
</layout>
287297
</widget>
288298
</item>
299+
<item row="1" column="0">
300+
<widget class="QCheckBox" name="avoidSelectById">
301+
<property name="toolTip">
302+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Avoid selecting feature by id. Sometimes - especially when running expensive queries/views - fetching the data sequentially instead of fetching features by id can be much quicker.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
303+
</property>
304+
<property name="text">
305+
<string>Avoid selecting by feature id</string>
306+
</property>
307+
</widget>
308+
</item>
289309
</layout>
290310
</widget>
291311
</item>
292-
<item row="2" column="0">
293-
<widget class="QDialogButtonBox" name="buttonBox">
294-
<property name="orientation">
295-
<enum>Qt::Horizontal</enum>
296-
</property>
297-
<property name="standardButtons">
298-
<set>QDialogButtonBox::Close</set>
299-
</property>
300-
</widget>
301-
</item>
302312
</layout>
303313
</widget>
304314
<customwidgets>
@@ -315,5 +325,22 @@ columns</string>
315325
<tabstop>viewResult</tabstop>
316326
</tabstops>
317327
<resources/>
318-
<connections/>
328+
<connections>
329+
<connection>
330+
<sender>loadAsLayerGroup</sender>
331+
<signal>toggled(bool)</signal>
332+
<receiver>avoidSelectById</receiver>
333+
<slot>setVisible(bool)</slot>
334+
<hints>
335+
<hint type="sourcelabel">
336+
<x>88</x>
337+
<y>351</y>
338+
</hint>
339+
<hint type="destinationlabel">
340+
<x>142</x>
341+
<y>451</y>
342+
</hint>
343+
</hints>
344+
</connection>
345+
</connections>
319346
</ui>

‎src/core/qgis.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ const QString GEOWKT =
154154
/** Wkt string that represents a geographic coord sys
155155
* @note deprecated in 1.8 due to violation of coding conventions (globals
156156
* should be in all caps).
157-
*/
157+
*/
158+
#ifndef _MSC_VER
159+
Q_DECL_DEPRECATED
160+
#endif
161+
const QString GEOWkt = GEOWKT;
158162

159163
const QString PROJECT_SCALES =
160164
"1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000,"
161165
"1:10000,1:5000,1:2500,1:1000,1:500";
162166

163-
#ifndef _MSC_VER
164-
Q_DECL_DEPRECATED
165-
#endif
166-
const QString GEOWkt = GEOWKT;
167167
/** PROJ4 string that represents a geographic coord sys */
168168
extern CORE_EXPORT const QString GEOPROJ4;
169169
/** Magic number for a geographic coord sys in POSTGIS SRID */

‎src/core/qgsapplication.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class CORE_EXPORT QgsApplication: public QApplication
6767
* but plugin writers etc can use this method as a basis for searching
6868
* for resources in their own datastores e.g. a Qt4 resource bundle.
6969
*/
70-
static const QString themeName() ;
70+
static const QString themeName();
7171

7272
//! Returns the path to the authors file.
7373
static const QString authorsFilePath();
@@ -210,9 +210,11 @@ class CORE_EXPORT QgsApplication: public QApplication
210210
* the gradient fills for backgrounds.
211211
*/
212212
static QString reportStyleSheet();
213+
213214
/** Convenience function to get a summary of the paths used in this
214215
* application instance useful for debugging mainly.*/
215216
static QString showSettings();
217+
216218
/** Register OGR drivers ensuring this only happens once.
217219
* This is a workaround for an issue with older gdal versions that
218220
* caused duplicate driver name entries to appear in the list

‎src/core/qgsrasterdataprovider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
117117
* Add the list of WMS layer names to be rendered by this server
118118
*/
119119
virtual void addLayers( QStringList const & layers,
120-
QStringList const & styles = QStringList() ) = 0;
120+
QStringList const & styles = QStringList() ) = 0;
121121

122122
//! get raster image encodings supported by (e.g.) the WMS Server, expressed as MIME types
123123
virtual QStringList supportedImageEncodings() = 0;
@@ -130,7 +130,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
130130
/**
131131
* Set the image encoding (as a MIME type) used in the transfer from (e.g.) the WMS server
132132
*/
133-
virtual void setImageEncoding( QString const & mimeType ) = 0;
133+
virtual void setImageEncoding( QString const & mimeType ) = 0;
134134

135135
/**
136136
* Set the image projection (in WMS CRS format) used in the transfer from (e.g.) the WMS server
@@ -141,7 +141,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
141141
// TODO: Document this better.
142142
/** \brief Renders the layer as an image
143143
*/
144-
virtual QImage* draw( QgsRectangle const & viewExtent, int pixelWidth, int pixelHeight ) = 0;
144+
virtual QImage* draw( QgsRectangle const & viewExtent, int pixelWidth, int pixelHeight ) = 0;
145145

146146
/** Returns a bitmask containing the supported capabilities
147147
Note, some capabilities may change depending on whether

0 commit comments

Comments
 (0)
Please sign in to comment.