mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
indentation update
This commit is contained in:
parent
5e7c043f9f
commit
12d7cfca03
@ -34,7 +34,7 @@ class QgsBlurEffect : QgsPaintEffect
|
||||
virtual QgsStringMap properties() const;
|
||||
virtual void readProperties( const QgsStringMap& props );
|
||||
virtual QgsPaintEffect* clone() const /Factory/;
|
||||
|
||||
|
||||
/** Sets blur level (strength)
|
||||
* @param level blur level. Depending on the current @link blurMethod @endlink, this parameter
|
||||
* has different effects
|
||||
|
@ -11,7 +11,7 @@ class QgsColorEffect : QgsPaintEffect
|
||||
%TypeHeaderCode
|
||||
#include <qgscoloreffect.h>
|
||||
%End
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Creates a new QgsColorEffect effect from a properties string map.
|
||||
|
@ -83,13 +83,13 @@ class QgsEffectStack : QgsPaintEffect
|
||||
* @param index position of effect to take
|
||||
*/
|
||||
QgsPaintEffect* takeEffect( const int index );
|
||||
|
||||
|
||||
/** Returns a pointer to the list of effects currently contained by
|
||||
* the stack
|
||||
* @returns list of QgsPaintEffects within the stack
|
||||
*/
|
||||
QList< QgsPaintEffect* >* effectList();
|
||||
|
||||
|
||||
/** Returns count of effects contained by the stack
|
||||
* @returns count of effects
|
||||
*/
|
||||
|
@ -293,7 +293,7 @@ class QgsDrawSourceEffect : QgsPaintEffect
|
||||
* @see setBlendMode
|
||||
*/
|
||||
QPainter::CompositionMode blendMode() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual void draw( QgsRenderContext& context );
|
||||
|
@ -11,7 +11,7 @@ class QgsTransformEffect : QgsPaintEffect
|
||||
%TypeHeaderCode
|
||||
#include <qgstransformeffect.h>
|
||||
%End
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Creates a new QgsTransformEffect effect from a properties string map.
|
||||
|
@ -67,7 +67,7 @@ class QgsSymbolLayerV2
|
||||
public:
|
||||
|
||||
virtual ~QgsSymbolLayerV2();
|
||||
|
||||
|
||||
// not necessarily supported by all symbol layers...
|
||||
virtual QColor color() const;
|
||||
virtual void setColor( const QColor& color );
|
||||
|
@ -133,7 +133,7 @@ class QgsEffectStackPropertiesDialog : QgsDialog
|
||||
* @param picture preview picture
|
||||
*/
|
||||
void setPreviewPicture( const QPicture& picture );
|
||||
|
||||
|
||||
};
|
||||
|
||||
/** \ingroup gui
|
||||
|
@ -206,8 +206,8 @@ class TableInfo:
|
||||
|
||||
# define the table header
|
||||
header = (
|
||||
"#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"),
|
||||
QApplication.translate("DBManagerPlugin", "Null"), QApplication.translate("DBManagerPlugin", "Default") )
|
||||
"#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"),
|
||||
QApplication.translate("DBManagerPlugin", "Null"), QApplication.translate("DBManagerPlugin", "Default") )
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
@ -251,7 +251,7 @@ class TableInfo:
|
||||
|
||||
# define the table header
|
||||
header = (
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Column(s)") )
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Column(s)") )
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
@ -271,7 +271,7 @@ class TableInfo:
|
||||
|
||||
# define the table header
|
||||
header = (
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function") )
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function") )
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
|
@ -835,7 +835,7 @@ class Table(DbItemObject):
|
||||
trigger_action = parts[2]
|
||||
|
||||
msg = QApplication.translate("DBManagerPlugin", "Do you want to %s trigger %s?") % (
|
||||
trigger_action, trigger_name)
|
||||
trigger_action, trigger_name)
|
||||
QApplication.restoreOverrideCursor()
|
||||
try:
|
||||
if QMessageBox.question(None, QApplication.translate("DBManagerPlugin", "Table trigger"), msg,
|
||||
@ -932,7 +932,7 @@ class VectorTable(Table):
|
||||
spatialIndex_action = parts[1]
|
||||
|
||||
msg = QApplication.translate("DBManagerPlugin", "Do you want to %s spatial index for field %s?") % (
|
||||
spatialIndex_action, self.geomColumn )
|
||||
spatialIndex_action, self.geomColumn )
|
||||
QApplication.restoreOverrideCursor()
|
||||
try:
|
||||
if QMessageBox.question(None, QApplication.translate("DBManagerPlugin", "Spatial Index"), msg,
|
||||
|
@ -215,7 +215,7 @@ class PostGisDBConnector(DBConnector):
|
||||
t = self.quoteId(table)
|
||||
sql = u"""SELECT has_table_privilege(%(t)s, 'SELECT'), has_table_privilege(%(t)s, 'INSERT'),
|
||||
has_table_privilege(%(t)s, 'UPDATE'), has_table_privilege(%(t)s, 'DELETE')""" % {
|
||||
't': self.quoteString(t)}
|
||||
't': self.quoteString(t)}
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchone(c)
|
||||
self._close_cursor(c)
|
||||
@ -477,7 +477,7 @@ class PostGisDBConnector(DBConnector):
|
||||
JOIN pg_namespace nsp ON pg_class.relnamespace = nsp.oid
|
||||
WHERE pg_class.relname=%s %s
|
||||
AND indisprimary != 't' """ % (
|
||||
self.quoteString(tablename), schema_where)
|
||||
self.quoteString(tablename), schema_where)
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchall(c)
|
||||
self._close_cursor(c)
|
||||
@ -512,7 +512,7 @@ class PostGisDBConnector(DBConnector):
|
||||
LEFT JOIN pg_proc p ON trig.tgfoid = p.oid
|
||||
JOIN pg_namespace nsp ON t.relnamespace = nsp.oid
|
||||
WHERE t.relname = %s %s """ % (
|
||||
self.quoteString(tablename), schema_where)
|
||||
self.quoteString(tablename), schema_where)
|
||||
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchall(c)
|
||||
@ -573,7 +573,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema_part = u"%s," % self.quoteString(schema) if schema is not None else ""
|
||||
|
||||
subquery = u"SELECT st_estimated_extent(%s%s,%s) AS extent" % (
|
||||
schema_part, self.quoteString(tablename), self.quoteString(geom))
|
||||
schema_part, self.quoteString(tablename), self.quoteString(geom))
|
||||
sql = u"""SELECT st_xmin(extent), st_ymin(extent), st_xmax(extent), st_ymax(extent) FROM (%s) AS subquery """ % subquery
|
||||
|
||||
try:
|
||||
@ -594,7 +594,7 @@ class PostGisDBConnector(DBConnector):
|
||||
sql = u"""SELECT pg_get_viewdef(c.oid) FROM pg_class c
|
||||
JOIN pg_namespace nsp ON c.relnamespace = nsp.oid
|
||||
WHERE relname=%s %s AND (relkind='v' OR relkind='m') """ % (
|
||||
self.quoteString(tablename), schema_where)
|
||||
self.quoteString(tablename), schema_where)
|
||||
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchone(c)
|
||||
@ -626,7 +626,7 @@ class PostGisDBConnector(DBConnector):
|
||||
if self.has_geometry_columns and self.has_geometry_columns_access:
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
sql = u"SELECT count(*) FROM geometry_columns WHERE f_table_schema = %s AND f_table_name = %s" % (
|
||||
self.quoteString(schema), self.quoteString(tablename))
|
||||
self.quoteString(schema), self.quoteString(tablename))
|
||||
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchone(c)
|
||||
@ -639,7 +639,7 @@ class PostGisDBConnector(DBConnector):
|
||||
if self.has_raster_columns and self.has_raster_columns_access:
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
sql = u"SELECT count(*) FROM raster_columns WHERE r_table_schema = %s AND r_table_name = %s" % (
|
||||
self.quoteString(schema), self.quoteString(tablename))
|
||||
self.quoteString(schema), self.quoteString(tablename))
|
||||
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchone(c)
|
||||
@ -700,7 +700,7 @@ class PostGisDBConnector(DBConnector):
|
||||
if self.has_geometry_columns and not self.is_geometry_columns_view:
|
||||
schema_where = u" AND f_table_schema=%s " % self.quoteString(schema) if schema is not None else ""
|
||||
sql = u"UPDATE geometry_columns SET f_table_name=%s WHERE f_table_name=%s %s" % (
|
||||
self.quoteString(new_table), self.quoteString(tablename), schema_where)
|
||||
self.quoteString(new_table), self.quoteString(tablename), schema_where)
|
||||
self._execute(c, sql)
|
||||
|
||||
self._commit()
|
||||
@ -720,7 +720,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
schema_where = u" AND f_table_schema=%s " % self.quoteString(schema) if schema is not None else ""
|
||||
sql = u"UPDATE geometry_columns SET f_table_schema=%s WHERE f_table_name=%s %s" % (
|
||||
self.quoteString(new_schema), self.quoteString(tablename), schema_where)
|
||||
self.quoteString(new_schema), self.quoteString(tablename), schema_where)
|
||||
self._execute(c, sql)
|
||||
|
||||
self._commit()
|
||||
@ -752,7 +752,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema_where = u" f_table_schema=%s AND " % self.quoteString(schema) if schema is not None else ""
|
||||
schema_part = u" f_table_schema=%s, " % self.quoteString(new_schema) if schema is not None else ""
|
||||
sql = u"UPDATE geometry_columns SET %s f_table_name=%s WHERE %s f_table_name=%s" % (
|
||||
schema_part, self.quoteString(new_table), schema_where, self.quoteString(tablename))
|
||||
schema_part, self.quoteString(new_table), schema_where, self.quoteString(tablename))
|
||||
self._execute(c, sql)
|
||||
|
||||
self._commit()
|
||||
@ -807,7 +807,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
schema_part = u"%s, " % self._quote_str(schema) if schema else ""
|
||||
sql = u"SELECT DropGeometryColumn(%s%s, %s)" % (
|
||||
schema_part, self.quoteString(tablename), self.quoteString(column))
|
||||
schema_part, self.quoteString(tablename), self.quoteString(column))
|
||||
else:
|
||||
sql = u"ALTER TABLE %s DROP %s" % (self.quoteId(table), self.quoteId(column))
|
||||
self._execute_and_commit(sql)
|
||||
@ -839,7 +839,7 @@ class PostGisDBConnector(DBConnector):
|
||||
# rename the column
|
||||
if new_name is not None and new_name != column:
|
||||
sql = u"ALTER TABLE %s RENAME %s TO %s" % (
|
||||
self.quoteId(table), self.quoteId(column), self.quoteId(new_name))
|
||||
self.quoteId(table), self.quoteId(column), self.quoteId(new_name))
|
||||
self._execute(c, sql)
|
||||
|
||||
# update geometry_columns if postgis is enabled
|
||||
@ -847,7 +847,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
schema_where = u" f_table_schema=%s AND " % self.quoteString(schema) if schema is not None else ""
|
||||
sql = u"UPDATE geometry_columns SET f_geometry_column=%s WHERE %s f_table_name=%s AND f_geometry_column=%s" % (
|
||||
self.quoteString(new_name), schema_where, self.quoteString(tablename), self.quoteString(column))
|
||||
self.quoteString(new_name), schema_where, self.quoteString(tablename), self.quoteString(column))
|
||||
self._execute(c, sql)
|
||||
|
||||
self._commit()
|
||||
@ -876,7 +876,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema_where = u" f_table_schema=%s AND " % self.quoteString(schema) if schema is not None else ""
|
||||
|
||||
sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE %s f_table_name=%s AND f_geometry_column=%s" % (
|
||||
schema_where, self.quoteString(tablename), self.quoteString(column))
|
||||
schema_where, self.quoteString(tablename), self.quoteString(column))
|
||||
|
||||
c = self._execute(None, sql)
|
||||
res = self._fetchone(c)[0] == 't'
|
||||
@ -888,7 +888,7 @@ class PostGisDBConnector(DBConnector):
|
||||
schema_part = u"%s, " % self.quoteString(schema) if schema else ""
|
||||
|
||||
sql = u"SELECT AddGeometryColumn(%s%s, %s, %d, %s, %d)" % (
|
||||
schema_part, self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim)
|
||||
schema_part, self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim)
|
||||
self._execute_and_commit(sql)
|
||||
|
||||
def deleteGeometryColumn(self, table, geom_column):
|
||||
|
@ -50,10 +50,10 @@ class PGTableDataModel(TableDataModel):
|
||||
# get fields, ignore geometry columns
|
||||
if field.dataType.lower() == "geometry":
|
||||
return u"CASE WHEN %(fld)s IS NULL THEN NULL ELSE GeometryType(%(fld)s) END AS %(fld)s" % {
|
||||
'fld': self.db.quoteId(field.name)}
|
||||
'fld': self.db.quoteId(field.name)}
|
||||
elif field.dataType.lower() == "raster":
|
||||
return u"CASE WHEN %(fld)s IS NULL THEN NULL ELSE 'RASTER' END AS %(fld)s" % {
|
||||
'fld': self.db.quoteId(field.name)}
|
||||
'fld': self.db.quoteId(field.name)}
|
||||
return u"%s::text" % self.db.quoteId(field.name)
|
||||
|
||||
def _deleteCursor(self):
|
||||
|
@ -95,7 +95,7 @@ class PGTableInfo(TableInfo):
|
||||
if self.table.rowCount is not None:
|
||||
if abs(self.table.estimatedRowCount - self.table.rowCount) > 1 and \
|
||||
(self.table.estimatedRowCount > 2 * self.table.rowCount or
|
||||
self.table.rowCount > 2 * self.table.estimatedRowCount):
|
||||
self.table.rowCount > 2 * self.table.estimatedRowCount):
|
||||
ret.append(HtmlParagraph(QApplication.translate("DBManagerPlugin",
|
||||
"<warning> There's a significant difference between estimated and real row count. "
|
||||
'Consider running <a href="action:vacuumanalyze/run">VACUUM ANALYZE</a>.')))
|
||||
@ -145,9 +145,9 @@ class PGTableInfo(TableInfo):
|
||||
|
||||
# define the table header
|
||||
header = (
|
||||
"#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"),
|
||||
QApplication.translate("DBManagerPlugin", "Length"), QApplication.translate("DBManagerPlugin", "Null"),
|
||||
QApplication.translate("DBManagerPlugin", "Default") )
|
||||
"#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"),
|
||||
QApplication.translate("DBManagerPlugin", "Length"), QApplication.translate("DBManagerPlugin", "Null"),
|
||||
QApplication.translate("DBManagerPlugin", "Default") )
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
@ -173,8 +173,8 @@ class PGTableInfo(TableInfo):
|
||||
tbl = []
|
||||
# define the table header
|
||||
header = (
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function"),
|
||||
QApplication.translate("DBManagerPlugin", "Type"), QApplication.translate("DBManagerPlugin", "Enabled") )
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function"),
|
||||
QApplication.translate("DBManagerPlugin", "Type"), QApplication.translate("DBManagerPlugin", "Enabled") )
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
@ -183,9 +183,9 @@ class PGTableInfo(TableInfo):
|
||||
"action": "delete"}
|
||||
|
||||
(enabled, action) = (QApplication.translate("DBManagerPlugin", "Yes"), "disable") if trig.enabled else (
|
||||
QApplication.translate("DBManagerPlugin", "No"), "enable")
|
||||
QApplication.translate("DBManagerPlugin", "No"), "enable")
|
||||
txt_enabled = u'%(enabled)s (<a href="action:trigger/%(name)s/%(action)s">%(action)s</a>)' % {
|
||||
"name": trig.name, "action": action, "enabled": enabled}
|
||||
"name": trig.name, "action": action, "enabled": enabled}
|
||||
|
||||
tbl.append((name, trig.function, trig.type2String(), txt_enabled))
|
||||
|
||||
@ -203,7 +203,7 @@ class PGTableInfo(TableInfo):
|
||||
tbl = []
|
||||
# define the table header
|
||||
header = (
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Definition") )
|
||||
QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Definition") )
|
||||
tbl.append(HtmlTableHeader(header))
|
||||
|
||||
# add table contents
|
||||
|
@ -176,11 +176,11 @@ class DlgVersioning(QDialog, Ui_DlgVersioning):
|
||||
|
||||
def sql_alterTable(self):
|
||||
return u"ALTER TABLE %s ADD %s serial, ADD %s timestamp, ADD %s timestamp;" % (
|
||||
self.schematable, self.colPkey, self.colStart, self.colEnd)
|
||||
self.schematable, self.colPkey, self.colStart, self.colEnd)
|
||||
|
||||
def sql_setPkey(self):
|
||||
return u"ALTER TABLE %s DROP CONSTRAINT %s, ADD PRIMARY KEY (%s);" % (
|
||||
self.schematable, self.origPkeyName, self.colPkey)
|
||||
self.schematable, self.origPkeyName, self.colPkey)
|
||||
|
||||
def sql_currentView(self):
|
||||
cols = ",".join(self.columns)
|
||||
|
@ -324,7 +324,7 @@ class SpatiaLiteDBConnector(DBConnector):
|
||||
c = self._get_cursor()
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
sql = u"SELECT name, sql FROM sqlite_master WHERE tbl_name = %s AND type = 'trigger'" % (
|
||||
self.quoteString(tablename))
|
||||
self.quoteString(tablename))
|
||||
self._execute(c, sql)
|
||||
return c.fetchall()
|
||||
|
||||
@ -447,7 +447,7 @@ class SpatiaLiteDBConnector(DBConnector):
|
||||
# update geometry_columns
|
||||
if self.has_geometry_columns:
|
||||
sql = u"UPDATE geometry_columns SET f_table_name = %s WHERE upper(f_table_name) = upper(%s)" % (
|
||||
self.quoteString(new_table), self.quoteString(tablename))
|
||||
self.quoteString(new_table), self.quoteString(tablename))
|
||||
self._execute(c, sql)
|
||||
|
||||
self._commit()
|
||||
@ -511,14 +511,14 @@ class SpatiaLiteDBConnector(DBConnector):
|
||||
c = self._get_cursor()
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % (
|
||||
self.quoteString(tablename), self.quoteString(column))
|
||||
self.quoteString(tablename), self.quoteString(column))
|
||||
self._execute(c, sql)
|
||||
return c.fetchone()[0] == 't'
|
||||
|
||||
def addGeometryColumn(self, table, geom_column='geometry', geom_type='POINT', srid=-1, dim=2):
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
sql = u"SELECT AddGeometryColumn(%s, %s, %d, %s, %s)" % (
|
||||
self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim)
|
||||
self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim)
|
||||
self._execute_and_commit(sql)
|
||||
|
||||
def deleteGeometryColumn(self, table, geom_column):
|
||||
@ -544,7 +544,7 @@ class SpatiaLiteDBConnector(DBConnector):
|
||||
""" create index on one column using default options """
|
||||
unique_str = u"UNIQUE" if unique else ""
|
||||
sql = u"CREATE %s INDEX %s ON %s (%s)" % (
|
||||
unique_str, self.quoteId(name), self.quoteId(table), self.quoteId(column))
|
||||
unique_str, self.quoteId(name), self.quoteId(table), self.quoteId(column))
|
||||
self._execute_and_commit(sql)
|
||||
|
||||
def deleteTableIndex(self, table, name):
|
||||
@ -581,7 +581,7 @@ class SpatiaLiteDBConnector(DBConnector):
|
||||
c = self._get_cursor()
|
||||
schema, tablename = self.getSchemaTableName(table)
|
||||
sql = u"SELECT spatial_index_enabled FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % (
|
||||
self.quoteString(tablename), self.quoteString(geom_column))
|
||||
self.quoteString(tablename), self.quoteString(geom_column))
|
||||
self._execute(c, sql)
|
||||
row = c.fetchone()
|
||||
return row is not None and row[0] == 1
|
||||
|
@ -80,11 +80,11 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
if field.type() == QVariant.Int or field.type() ==QVariant.Double:
|
||||
if field.type() == QVariant.Int:
|
||||
global typeInt
|
||||
item = QListWidgetItem(str(field.name()), None, typeInt)
|
||||
item = QListWidgetItem(str(field.name()), None, typeInt)
|
||||
else:
|
||||
global typeDouble
|
||||
item = QListWidgetItem(str(field.name()), None, typeDouble)
|
||||
item.setToolTip("Attribute <%s> of type %s"%(field.name(), field.typeName()))
|
||||
item = QListWidgetItem(str(field.name()), None, typeDouble)
|
||||
item.setToolTip("Attribute <%s> of type %s" % (field.name(), field.typeName()))
|
||||
self.attributeList.addItem(item)
|
||||
|
||||
def outFile(self):
|
||||
@ -272,7 +272,7 @@ class PointsInPolygonThread(QThread):
|
||||
# Check if the input contains non-numeric values
|
||||
non_numeric_values = False
|
||||
for value in values:
|
||||
if (isinstance(value, type(float())) != True) and (isinstance(value, type(int())) != True):
|
||||
if not isinstance(value, type(float())) and not isinstance(value, type(int())):
|
||||
non_numeric_values = True
|
||||
break
|
||||
# Jump over invalid values
|
||||
|
@ -46,7 +46,7 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
QObject.connect(self.btnUpdate, SIGNAL("clicked()"), self.updateLayer)
|
||||
QObject.connect(self.btnCanvas, SIGNAL("clicked()"), self.updateCanvas)
|
||||
QObject.connect(self.chkAlign, SIGNAL("toggled(bool)"), self.chkAlignToggled)
|
||||
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||
self.buttonOk = self.buttonBox_2.button(QDialogButtonBox.Ok)
|
||||
self.setWindowTitle(self.tr("Vector grid"))
|
||||
self.xMin.setValidator(QDoubleValidator(self.xMin))
|
||||
self.xMax.setValidator(QDoubleValidator(self.xMax))
|
||||
@ -156,7 +156,7 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
def compute( self, bound, xOffset, yOffset, polygon ):
|
||||
crs = None
|
||||
layer = ftools_utils.getMapLayerByName(unicode(self.inShape.currentText()))
|
||||
|
||||
|
||||
if self.angle.value() != 0.0:
|
||||
bound = self.initRotation(bound)
|
||||
|
||||
@ -204,7 +204,7 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
while y >= bound.yMinimum():
|
||||
pt1 = QgsPoint(bound.xMinimum(), y)
|
||||
pt2 = QgsPoint(bound.xMaximum(), y)
|
||||
|
||||
|
||||
if self.angle.value() != 0.0:
|
||||
self.rotatePoint(pt1)
|
||||
self.rotatePoint(pt2)
|
||||
@ -254,20 +254,20 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
while y >= bound.yMinimum():
|
||||
x = bound.xMinimum()
|
||||
while x <= bound.xMaximum():
|
||||
|
||||
|
||||
pt1 = QgsPoint(x, y)
|
||||
pt2 = QgsPoint(x + xOffset, y)
|
||||
pt3 = QgsPoint(x + xOffset, y - yOffset)
|
||||
pt4 = QgsPoint(x, y - yOffset)
|
||||
pt5 = QgsPoint(x, y)
|
||||
|
||||
|
||||
if self.angle.value() != 0.0:
|
||||
self.rotatePoint(pt1)
|
||||
self.rotatePoint(pt2)
|
||||
self.rotatePoint(pt3)
|
||||
self.rotatePoint(pt4)
|
||||
self.rotatePoint(pt5)
|
||||
|
||||
|
||||
polygon = [[pt1, pt2, pt3, pt4, pt5]]
|
||||
outFeat.setGeometry(outGeom.fromPolygon(polygon))
|
||||
outFeat.setAttribute(0, idVar)
|
||||
@ -293,30 +293,30 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
# We convert the angle from degree to radiant
|
||||
rad = self.angle.value() * math.pi / 180.0
|
||||
|
||||
a = math.cos( rad );
|
||||
b = -1 * math.sin( rad );
|
||||
c = anchorPoint.x() - math.cos( rad ) * anchorPoint.x() + math.sin( rad ) * anchorPoint.y();
|
||||
d = math.sin( rad );
|
||||
e = math.cos( rad );
|
||||
f = anchorPoint.y() - math.sin( rad ) * anchorPoint.x() - math.cos( rad ) * anchorPoint.y();
|
||||
a = math.cos(rad)
|
||||
b = -1 * math.sin( rad )
|
||||
c = anchorPoint.x() - math.cos( rad ) * anchorPoint.x() + math.sin( rad ) * anchorPoint.y()
|
||||
d = math.sin( rad )
|
||||
e = math.cos( rad )
|
||||
f = anchorPoint.y() - math.sin( rad ) * anchorPoint.x() - math.cos( rad ) * anchorPoint.y()
|
||||
|
||||
self.rotationParams = (a,b,c,d,e,f)
|
||||
|
||||
|
||||
# Rotate the bounding box to set a new extent
|
||||
ptMin = QgsPoint(boundBox.xMinimum(), boundBox.yMinimum())
|
||||
ptMax = QgsPoint(boundBox.xMaximum(), boundBox.yMaximum())
|
||||
|
||||
|
||||
self.rotatePoint(ptMin)
|
||||
self.rotatePoint(ptMax)
|
||||
|
||||
|
||||
newBoundBox = QgsRectangle(ptMin, ptMax)
|
||||
newBoundBox.combineExtentWith(boundBox)
|
||||
|
||||
|
||||
return newBoundBox
|
||||
|
||||
def rotatePoint(self, point):
|
||||
x = self.rotationParams[0] * point.x() + self.rotationParams[1] * point.y() + self.rotationParams[2];
|
||||
y = self.rotationParams[3] * point.x() + self.rotationParams[4] * point.y() + self.rotationParams[5];
|
||||
x = self.rotationParams[0] * point.x() + self.rotationParams[1] * point.y() + self.rotationParams[2]
|
||||
y = self.rotationParams[3] * point.x() + self.rotationParams[4] * point.y() + self.rotationParams[5]
|
||||
point.setX(x)
|
||||
point.setY(y)
|
||||
|
||||
|
@ -33,7 +33,7 @@ find python src tests -type f -print | while read f; do
|
||||
fi
|
||||
|
||||
echo -ne "Reformatting $f $elcr"
|
||||
astyle.sh "$f"
|
||||
astyle.sh "$f" || true
|
||||
done
|
||||
|
||||
echo
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Generates (or updates) a unit test image mask, which is used to specify whether
|
||||
# a pixel in the control image should be checked (black pixel in mask) or not (white
|
||||
# pixel in mask). For non black or white pixels, the pixels lightness is used to
|
||||
# specify a maximum delta for each color component
|
||||
# specify a maximum delta for each color component
|
||||
|
||||
import os
|
||||
import sys
|
||||
@ -15,7 +15,7 @@ import struct
|
||||
def error ( msg ):
|
||||
print msg
|
||||
sys.exit( 1 )
|
||||
|
||||
|
||||
def colorDiff( c1, c2 ):
|
||||
redDiff = abs( qRed( c1 ) - qRed( c2 ) )
|
||||
greenDiff = abs( qGreen( c1 ) - qGreen( c2 ) )
|
||||
@ -36,7 +36,7 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path):
|
||||
control_image.height(),
|
||||
rendered_image.width(),
|
||||
rendered_image.height()))
|
||||
|
||||
|
||||
#read current mask, if it exist
|
||||
mask_image = QImage( mask_image_path )
|
||||
if mask_image.isNull():
|
||||
@ -69,18 +69,16 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path):
|
||||
#update mask image
|
||||
mask_image.setPixel( x, y, qRgb( difference, difference, difference ) )
|
||||
mismatch_count += 1
|
||||
|
||||
|
||||
if mismatch_count:
|
||||
#update mask
|
||||
mask_image.save( mask_image_path, "png" );
|
||||
mask_image.save( mask_image_path, "png" )
|
||||
print 'Updated {} pixels'.format( mismatch_count )
|
||||
|
||||
parser = argparse.ArgumentParser() #OptionParser("usage: %prog control_image rendered_image mask_image")
|
||||
parser = argparse.ArgumentParser() # OptionParser("usage: %prog control_image rendered_image mask_image")
|
||||
parser.add_argument('control_image')
|
||||
parser.add_argument('rendered_image')
|
||||
parser.add_argument('mask_image')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
updateMask(args.control_image, args.rendered_image, args.mask_image)
|
||||
|
||||
|
@ -250,7 +250,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField& field )
|
||||
expressionWidget->setLayout( new QHBoxLayout );
|
||||
QToolButton* editExpressionButton = new QToolButton;
|
||||
editExpressionButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpression.svg" ) );
|
||||
connect( editExpressionButton, SIGNAL(clicked()), this, SLOT(updateExpression()) );
|
||||
connect( editExpressionButton, SIGNAL( clicked() ), this, SLOT( updateExpression() ) );
|
||||
expressionWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
|
||||
expressionWidget->layout()->addWidget( editExpressionButton );
|
||||
expressionWidget->layout()->addWidget( new QLabel( mLayer->expressionField( idx ) ) );
|
||||
|
@ -521,10 +521,10 @@ class CORE_EXPORT QgsExpression
|
||||
|
||||
virtual QStringList referencedColumns() const override { QStringList lst( mNode->referencedColumns() ); foreach ( Node* n, mList->list() ) lst.append( n->referencedColumns() ); return lst; }
|
||||
virtual bool needsGeometry() const override { bool needs = false; foreach ( Node* n, mList->list() ) needs |= n->needsGeometry(); return needs; }
|
||||
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
|
||||
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
|
||||
|
||||
protected:
|
||||
Node* mNode;
|
||||
protected:
|
||||
Node* mNode;
|
||||
NodeList* mList;
|
||||
bool mNotIn;
|
||||
};
|
||||
|
@ -2866,7 +2866,7 @@ const QString QgsVectorLayer::expressionField( int index )
|
||||
return mExpressionFieldBuffer->expressions().value( oi ).expression;
|
||||
}
|
||||
|
||||
void QgsVectorLayer::updateExpressionField( int index, const QString& exp )
|
||||
void QgsVectorLayer::updateExpressionField( int index, const QString& exp )
|
||||
{
|
||||
int oi = mUpdatedFields.fieldOriginIndex( index );
|
||||
mExpressionFieldBuffer->updateExpression( oi, exp );
|
||||
|
@ -87,7 +87,7 @@ QVariant QgsValueRelationWidgetWrapper::value()
|
||||
|
||||
if ( mLineEdit )
|
||||
{
|
||||
Q_FOREACH( const ValueRelationItem& i , mCache )
|
||||
Q_FOREACH ( const ValueRelationItem& i , mCache )
|
||||
{
|
||||
if ( i.second == mLineEdit->text() )
|
||||
{
|
||||
@ -121,7 +121,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor )
|
||||
|
||||
mComboBox = qobject_cast<QComboBox*>( editor );
|
||||
mListWidget = qobject_cast<QListWidget*>( editor );
|
||||
mLineEdit= qobject_cast<QLineEdit*>( editor );
|
||||
mLineEdit = qobject_cast<QLineEdit*>( editor );
|
||||
|
||||
if ( mComboBox )
|
||||
{
|
||||
@ -152,7 +152,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor )
|
||||
else if ( mLineEdit )
|
||||
{
|
||||
QStringList values;
|
||||
Q_FOREACH( const ValueRelationItem& i, mCache )
|
||||
Q_FOREACH ( const ValueRelationItem& i, mCache )
|
||||
{
|
||||
values << i.second;
|
||||
}
|
||||
@ -189,7 +189,7 @@ void QgsValueRelationWidgetWrapper::setValue( const QVariant& value )
|
||||
}
|
||||
else if ( mLineEdit )
|
||||
{
|
||||
Q_FOREACH( ValueRelationItem i, mCache )
|
||||
Q_FOREACH ( ValueRelationItem i, mCache )
|
||||
{
|
||||
if ( i.first == value )
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ void QgsQueryBuilder::populateFields()
|
||||
const QgsFields& fields = mLayer->pendingFields();
|
||||
for ( int idx = 0; idx < fields.count(); ++idx )
|
||||
{
|
||||
if ( fields.fieldOrigin(idx) != QgsFields::OriginProvider )
|
||||
if ( fields.fieldOrigin( idx ) != QgsFields::OriginProvider )
|
||||
{
|
||||
// only consider native fields
|
||||
continue;
|
||||
|
@ -538,7 +538,7 @@ void QgsRubberBand::updateRect()
|
||||
const QgsMapToPixel& m2p = *( mMapCanvas->getCoordinateTransform() );
|
||||
|
||||
qreal res = m2p.mapUnitsPerPixel();
|
||||
qreal w = ( ( mIconSize - 1 ) / 2 + mPen.width() ) / res;
|
||||
qreal w = (( mIconSize - 1 ) / 2 + mPen.width() ) / res;
|
||||
|
||||
QgsRectangle r;
|
||||
for ( int i = 0; i < mPoints.size(); ++i )
|
||||
|
@ -120,7 +120,7 @@ void QgsUnitSelectionWidget::setUnits( const QgsSymbolV2::OutputUnitList &units
|
||||
QgsSymbolV2::OutputUnit QgsUnitSelectionWidget::unit() const
|
||||
{
|
||||
if ( mUnitCombo->count() == 0 )
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsSymbolV2::Mixed;
|
||||
|
||||
QVariant currentData = mUnitCombo->itemData( mUnitCombo->currentIndex() );
|
||||
if ( currentData.isValid() )
|
||||
|
@ -447,7 +447,7 @@ void QgsDelimitedTextFeatureIterator::fetchAttribute( QgsFeature& feature, int f
|
||||
|
||||
QgsDelimitedTextFeatureSource::QgsDelimitedTextFeatureSource( const QgsDelimitedTextProvider* p )
|
||||
: mGeomRep( p->mGeomRep )
|
||||
, mSubsetExpression( p->mSubsetExpression ? new QgsExpression(p->mSubsetExpression->expression()) : 0 )
|
||||
, mSubsetExpression( p->mSubsetExpression ? new QgsExpression( p->mSubsetExpression->expression() ) : 0 )
|
||||
, mExtent( p->mExtent )
|
||||
, mUseSpatialIndex( p->mUseSpatialIndex )
|
||||
, mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : 0 )
|
||||
|
@ -88,7 +88,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri )
|
||||
// Add supported types to enable creating expression fields in field calculator
|
||||
mNativeTypes
|
||||
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 0, 10 )
|
||||
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64 bit)"), "int8", QVariant::LongLong )
|
||||
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64 bit)" ), "int8", QVariant::LongLong )
|
||||
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )
|
||||
<< QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String, -1, -1, -1, -1 )
|
||||
;
|
||||
@ -563,7 +563,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes )
|
||||
{
|
||||
|
||||
QString &value = parts[i];
|
||||
// Ignore empty fields - spreadsheet generated CSV files often
|
||||
// Ignore empty fields - spreadsheet generated CSV files often
|
||||
// have random empty fields at the end of a row
|
||||
if ( value.isEmpty() )
|
||||
continue;
|
||||
@ -640,7 +640,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes )
|
||||
fieldType = QVariant::Int;
|
||||
typeName = "integer";
|
||||
}
|
||||
else if ( csvtTypes[i] == "long" || csvtTypes[i]== "longlong" || csvtTypes[i] == "int8" )
|
||||
else if ( csvtTypes[i] == "long" || csvtTypes[i] == "longlong" || csvtTypes[i] == "int8" )
|
||||
{
|
||||
fieldType = QVariant::LongLong; //QVariant doesn't support long
|
||||
typeName = "longlong";
|
||||
|
@ -117,40 +117,40 @@ void TestQgsRubberband::testBoundingRect()
|
||||
// Set extent to match canvas size.
|
||||
// This is to ensure a 1:1 scale
|
||||
mCanvas->setExtent( QgsRectangle( QRectF(
|
||||
QPointF(0,0), mapSize
|
||||
) ) );
|
||||
QCOMPARE( mCanvas->mapUnitsPerPixel (), 1.0 );
|
||||
QPointF( 0, 0 ), mapSize
|
||||
) ) );
|
||||
QCOMPARE( mCanvas->mapUnitsPerPixel(), 1.0 );
|
||||
|
||||
// Polygon extent is 10,10 to 30,30
|
||||
QSharedPointer<QgsGeometry> geom( QgsGeometry::fromWkt(
|
||||
"POLYGON((10 10,10 30,30 30,30 10,10 10))"
|
||||
) );
|
||||
"POLYGON((10 10,10 30,30 30,30 10,10 10))"
|
||||
) );
|
||||
mRubberband = new QgsRubberBand( mCanvas, mPolygonLayer->geometryType() );
|
||||
mRubberband->setIconSize( 5 ); // default, but better be explicit
|
||||
mRubberband->setWidth( 1 ); // default, but better be explicit
|
||||
mRubberband->addGeometry( geom.data(), mPolygonLayer );
|
||||
|
||||
// 20 pixels for the extent + 3 for pen & icon per side + 2 of padding
|
||||
QCOMPARE( mRubberband->boundingRect(), QRectF(QPointF(-1,-1),QSizeF(28,28)) );
|
||||
QCOMPARE( mRubberband->boundingRect(), QRectF( QPointF( -1, -1 ), QSizeF( 28, 28 ) ) );
|
||||
QCOMPARE( mRubberband->pos(), QPointF(
|
||||
// 10 for extent minx - 3 for pen & icon
|
||||
7,
|
||||
// 30 for extent maxy - 3 for pen & icon
|
||||
mapSize.height() - 30 - 3
|
||||
) );
|
||||
// 10 for extent minx - 3 for pen & icon
|
||||
7,
|
||||
// 30 for extent maxy - 3 for pen & icon
|
||||
mapSize.height() - 30 - 3
|
||||
) );
|
||||
|
||||
mCanvas->setExtent( QgsRectangle( QRectF(
|
||||
QPointF(0,0), mapSize/2
|
||||
) ) );
|
||||
QPointF( 0, 0 ), mapSize / 2
|
||||
) ) );
|
||||
|
||||
// 40 pixels for the extent + 6 for pen & icon per side + 2 of padding
|
||||
QCOMPARE( mRubberband->boundingRect(), QRectF(QPointF(-1,-1),QSizeF(54,54)) );
|
||||
QCOMPARE( mRubberband->boundingRect(), QRectF( QPointF( -1, -1 ), QSizeF( 54, 54 ) ) );
|
||||
QCOMPARE( mRubberband->pos(), QPointF(
|
||||
// 10 for extent minx - 3 for pen & icon
|
||||
7 * 2,
|
||||
// 30 for extent maxy - 3 for pen & icon
|
||||
mapSize.height() - ( 30 + 3 ) * 2
|
||||
) );
|
||||
// 10 for extent minx - 3 for pen & icon
|
||||
7 * 2,
|
||||
// 30 for extent maxy - 3 for pen & icon
|
||||
mapSize.height() - ( 30 + 3 ) * 2
|
||||
) );
|
||||
|
||||
}
|
||||
|
||||
@ -173,8 +173,8 @@ void TestQgsRubberband::testVisibility()
|
||||
|
||||
// Check visibility after setting to valid geometry
|
||||
QSharedPointer<QgsGeometry> geom( QgsGeometry::fromWkt(
|
||||
"POLYGON((10 10,10 30,30 30,30 10,10 10))"
|
||||
) );
|
||||
"POLYGON((10 10,10 30,30 30,30 10,10 10))"
|
||||
) );
|
||||
mRubberband->setToGeometry( geom.data(), mPolygonLayer );
|
||||
QCOMPARE( mRubberband->isVisible(), true );
|
||||
|
||||
@ -191,7 +191,7 @@ void TestQgsRubberband::testVisibility()
|
||||
mRubberband->setVisible( false );
|
||||
mCanvas->zoomIn();
|
||||
QCOMPARE( mRubberband->isVisible(), false );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2055,7 +2055,7 @@ def test_034_csvt_file():
|
||||
'field_12': u'NULL',
|
||||
'#fid': 2L,
|
||||
'#geometry': 'None',
|
||||
},
|
||||
},
|
||||
3L: {
|
||||
'id': u'2',
|
||||
'description': u'Test csvt 2',
|
||||
@ -2071,10 +2071,9 @@ def test_034_csvt_file():
|
||||
'field_12': u'-3123724580211819352',
|
||||
'#fid': 3L,
|
||||
'#geometry': 'None',
|
||||
},
|
||||
}
|
||||
wanted['log']=[
|
||||
]
|
||||
},
|
||||
}
|
||||
wanted['log']=[]
|
||||
return wanted
|
||||
|
||||
|
||||
@ -2194,7 +2193,7 @@ def test_038_type_inference():
|
||||
'text2': u'1',
|
||||
'#fid': 2L,
|
||||
'#geometry': 'POINT(1 1)',
|
||||
},
|
||||
},
|
||||
3L: {
|
||||
'id': u'line2',
|
||||
'description': u'1.0',
|
||||
@ -2208,7 +2207,7 @@ def test_038_type_inference():
|
||||
'text2': u'-4',
|
||||
'#fid': 3L,
|
||||
'#geometry': 'POINT(1 5)',
|
||||
},
|
||||
},
|
||||
4L: {
|
||||
'id': u'line3',
|
||||
'description': u'5.0',
|
||||
@ -2222,7 +2221,7 @@ def test_038_type_inference():
|
||||
'text2': u'1x',
|
||||
'#fid': 4L,
|
||||
'#geometry': 'POINT(5 5)',
|
||||
},
|
||||
},
|
||||
5L: {
|
||||
'id': u'line4',
|
||||
'description': u'5.0',
|
||||
@ -2236,7 +2235,7 @@ def test_038_type_inference():
|
||||
'text2': u'NULL',
|
||||
'#fid': 5L,
|
||||
'#geometry': 'POINT(5 1)',
|
||||
},
|
||||
},
|
||||
6L: {
|
||||
'id': u'line5',
|
||||
'description': u'3.0',
|
||||
@ -2250,7 +2249,7 @@ def test_038_type_inference():
|
||||
'text2': u'23',
|
||||
'#fid': 6L,
|
||||
'#geometry': 'POINT(3 1)',
|
||||
},
|
||||
},
|
||||
7L: {
|
||||
'id': u'line6',
|
||||
'description': u'1.0',
|
||||
@ -2264,8 +2263,7 @@ def test_038_type_inference():
|
||||
'text2': u'0',
|
||||
'#fid': 7L,
|
||||
'#geometry': 'POINT(1 3)',
|
||||
},
|
||||
}
|
||||
wanted['log']=[
|
||||
]
|
||||
},
|
||||
}
|
||||
wanted['log']=[]
|
||||
return wanted
|
||||
|
Loading…
x
Reference in New Issue
Block a user