Skip to content
Permalink
Browse files
indentation update
  • Loading branch information
jef-n committed Jul 13, 2014
1 parent 9ce0ea3 commit 647504306cd85a0883bceaf01d841eedd38d9c3b
@@ -76,10 +76,10 @@ def processAlgorithm(self, progress):

layerUri = self.getParameterValue(self.INPUT)
layer = dataobjects.getObjectFromUri(layerUri)

table = self.getParameterValue(self.TABLENAME).strip()
if table == '':
table = layer.name().lower()
table = layer.name().lower()
table.replace(' ', '')
providerName = 'postgres'

@@ -117,7 +117,7 @@
class QGISAlgorithmProvider(AlgorithmProvider):

_icon = QIcon(':/processing/images/qgis.png')

def __init__(self):
AlgorithmProvider.__init__(self)
self.alglist = [SumLines(), PointsInPolygon(),
@@ -170,10 +170,10 @@ def __init__(self):
# RasterLayerHistogram(), MeanAndStdDevPlot(),
# BarPlot(), PolarPlot()
]

folder = os.path.join(os.path.dirname(__file__), 'scripts')
scripts = ScriptUtils.loadFromFolder(folder)
for script in scripts:
for script in scripts:
script.allowEdit = False
self.alglist.extend(scripts)
for alg in self.alglist:
@@ -18,29 +18,29 @@

writer = VectorWriter(Results, None, polyPrder.fields(),
QGis.WKBMultiPolygon, polyPrder.crs())


resgeom = QgsGeometry()
resfeat = QgsFeature()

for feat in processing.features(polyLayer):
progress.setPercentage(int(100*l/n))
l+=1

g = loads(feat.geometry().asWkb())
if g.geom_type == 'MultiPolygon':

if g.geom_type == 'MultiPolygon':
resg = [Polygon(p.exterior,
[r for r in p.interiors if Polygon(r).area > Max_area]) for p in g]

else:
resg = [Polygon(g.exterior,
[r for r in g.interiors if Polygon(r).area > Max_area])]

resgeom = QgsGeometry().fromWkt(dumps(MultiPolygon(resg)))

resfeat.setAttributes(feat.attributes())
resfeat.setGeometry(resgeom)
writer.addFeature(resfeat)
resfeat.setGeometry(resgeom)
writer.addFeature(resfeat)

del writer
@@ -12,8 +12,8 @@
inputFields = layer.pendingFields()
fieldIdxs = []
fields = Fields.split(',')
for f in fields:
idx = inputFields.indexFromName(f)
for f in fields:
idx = inputFields.indexFromName(f)
if idx == -1:
raise GeoAlgorithmExecutionException('Field not found:' + f)
fieldIdxs.append(idx)
@@ -24,11 +24,11 @@
nFeats = len(feats)
counts = defaultdict(int)
for i, feat in enumerate(feats):
progress.setPercentage(int(100 * i / nFeats))
progress.setPercentage(int(100 * i / nFeats))
attrs = feat.attributes()
clazz = tuple([attrs[idx] for idx in fieldIdxs])
clazz = tuple([attrs[idx] for idx in fieldIdxs])
counts[clazz] += 1

for c in counts:
for c in counts:
writer.addRecord(list(c) + [counts[c]])

@@ -12,7 +12,7 @@
if To_keep < 1:
progress.setInfo("'To keep' value has been modified to be at least 1.")
To_keep = 1


polyLayer = processing.getObject(Polygons)
polyPrder = polyLayer.dataProvider()
@@ -27,17 +27,17 @@
if geom.isMultipart():
featres = feat
geoms = geom.asGeometryCollection()
geomarea = [(i, geoms[i].area()) for i in range(len(geoms))]
geomarea.sort(key=itemgetter(1))
geomarea = [(i, geoms[i].area()) for i in range(len(geoms))]
geomarea.sort(key=itemgetter(1))
if To_keep == 1:
featres.setGeometry(geoms[geomrea[-1][0]])
elif To_keep > len(geoms):
featres.setGeometry(geom)
else:
featres.setGeometry(geom)
featres.setGeometry(geom)
geomres = [geoms[i].asPolygon() for i,a in geomarea[-1 * To_keep]]
featres.setGeometry(QgsGeometry.fromMultiPolygon(geomres))
writer.addFeature(featres)
featres.setGeometry(QgsGeometry.fromMultiPolygon(geomres))
writer.addFeature(featres)
else:
writer.addFeature(feat)

@@ -34,7 +34,7 @@

feats = processing.features(layer)
for n, inFeat in enumerate(feats):
progress.setPercentage(int(100 * n / nFeat))
progress.setPercentage(int(100 * n / nFeat))
inGeom = inFeat.geometry()
outFeat.setGeometry(inGeom)
attrs = inFeat.attributes()
@@ -53,7 +53,7 @@


class GeoAlgorithm:

_icon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/alg.png')

def __init__(self):
@@ -201,10 +201,10 @@ def okPressed(self):
f.write(code)
self.progressBar.setValue(i + 1)
except HTTPError:
QMessageBox.critical(iface.mainWindow(), "Connection problem",
QMessageBox.critical(iface.mainWindow(), "Connection problem",
"Could not download file :" + filename)
return


toDelete = []
for i in xrange(self.uptodateItem.childCount()):
@@ -34,7 +34,7 @@ class MultilineTextPanel(QtGui.QWidget):

def __init__(self, options, parent=None):
super(MultilineTextPanel, self).__init__(parent)
self.options = options
self.options = options
self.verticalLayout = QtGui.QVBoxLayout(self)
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
@@ -56,7 +56,7 @@
class ScriptAlgorithm(GeoAlgorithm):

_icon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/script.png')

def __init__(self, descriptionFile, script=None):
"""The script parameter can be used to directly pass the code
of the script without a file.
@@ -39,7 +39,7 @@


class ScriptAlgorithmProvider(AlgorithmProvider):

def __init__(self):
AlgorithmProvider.__init__(self)
self.actions.extend([CreateNewScriptAction('Create new script',
@@ -45,9 +45,9 @@ def scriptsFolder():
mkdir(folder)

return os.path.abspath(folder)

@staticmethod
def loadFromFolder(folder):
def loadFromFolder(folder):
if not os.path.exists(folder):
return []
algs = []
@@ -61,7 +61,7 @@ $ARTISTIC_STYLE_OPTIONS \
for f in "$@"; do
case "$f" in
src/app/gps/qwtpolar-*|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/ext-libs/*|src/providers/spatialite/qspatialite/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*)
echo $f skipped
echo -ne "$f skipped $elcr"
continue
;;

@@ -220,7 +220,7 @@ namespace pal
* \param bbox[3] problem y max
* return A set of feature which are in the bbox or null if the feature is in the bbox
*/
LinkedList<Feature*> *splitFeature( double bbox[4]);
LinkedList<Feature*> *splitFeature( double bbox[4] );


/**
@@ -1235,7 +1235,7 @@ bool QgsGraduatedSymbolRendererV2::legendSymbolItemsCheckable() const

bool QgsGraduatedSymbolRendererV2::legendSymbolItemChecked( int index )
{
if( index >= 0 && index < mRanges.size() )
if ( index >= 0 && index < mRanges.size() )
return mRanges[ index ].renderState();
else
return true;
@@ -524,7 +524,7 @@ bool QgsFeatureRendererV2::legendSymbolItemChecked( int index )
return false;
}

void QgsFeatureRendererV2::checkLegendSymbolItem(int index, bool state )
void QgsFeatureRendererV2::checkLegendSymbolItem( int index, bool state )
{
Q_UNUSED( index );
Q_UNUSED( state );
@@ -167,7 +167,7 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const
if ( !nodeL || !nodeL->childrenCheckable() )
return QVariant();

if( !nodeL->isVisible() )
if ( !nodeL->isVisible() )
return Qt::PartiallyChecked;

QgsVectorLayer* vlayer = static_cast<QgsVectorLayer*>( nodeL->layer() );
@@ -104,17 +104,17 @@ void TestQgsComposerDD::initTestCase()

void TestQgsComposerDD::cleanupTestCase()
{
delete mComposition;
delete mVectorLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
}
delete mComposition;
delete mVectorLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
}
}

void TestQgsComposerDD::init()
@@ -128,11 +128,11 @@ void TestQgsComposerDD::cleanup()
void TestQgsComposerDD::ddEvaluate()
{
//set a data defined property
mAtlasMap->setDataDefinedProperty( QgsComposerItem::PositionY, true, true, QString("20+30"),QString() );
mAtlasMap->setDataDefinedProperty( QgsComposerItem::PositionY, true, true, QString( "20+30" ), QString() );
//evaluate property
mAtlasMap->refreshDataDefinedProperty( QgsComposerItem::PositionY );
QCOMPARE( mAtlasMap->pos().y(), 50.0 );
mAtlasMap->setDataDefinedProperty( QgsComposerItem::PositionY, false, false, QString(),QString() );
mAtlasMap->setDataDefinedProperty( QgsComposerItem::PositionY, false, false, QString(), QString() );
}

QTEST_MAIN( TestQgsComposerDD )

0 comments on commit 6475043

Please sign in to comment.