mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
indentation update
This commit is contained in:
parent
67376d14d9
commit
ed286eb198
@ -50,7 +50,7 @@ class PointsLayerFromTable(GeoAlgorithm):
|
||||
writer = output.getVectorWriter(fields, QGis.WKBPoint, self.crs)
|
||||
xfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.XFIELD))
|
||||
yfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.YFIELD))
|
||||
|
||||
|
||||
crsId = self.getParameterValue(self.TARGET_CRS)
|
||||
targetCrs = QgsCoordinateReferenceSystem(crsId)
|
||||
self.crs = targetCrs
|
||||
|
@ -83,7 +83,7 @@ class AlgorithmProvider():
|
||||
|
||||
def getDescription(self):
|
||||
'''Returns the full name of the provider'''
|
||||
return "Generic algorithm provider"
|
||||
return "Generic algorithm provider"
|
||||
|
||||
def getIcon(self):
|
||||
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")
|
||||
|
@ -408,7 +408,7 @@ class GeoAlgorithm:
|
||||
s+=out.getValueAsCommandLineParameter() + ","
|
||||
s= s[:-1] + ")"
|
||||
return s
|
||||
|
||||
|
||||
def getPostProcessingErrorMessage(self, wrongLayers):
|
||||
'''Returns the message to be shown to the user when, after running this algorithm,
|
||||
there is a problem loading the resulting layer.
|
||||
|
@ -220,8 +220,8 @@ class SextanteToolbox(QDockWidget, Ui_SextanteToolbox):
|
||||
for alg in algs:
|
||||
if not alg.showInToolbox:
|
||||
continue
|
||||
altgroup, altsubgroup, altname = AlgorithmDecorator.getGroupsAndName(alg)
|
||||
if altgroup is None:
|
||||
altgroup, altsubgroup, altname = AlgorithmDecorator.getGroupsAndName(alg)
|
||||
if altgroup is None:
|
||||
continue
|
||||
if text =="" or text.lower() in altname.lower():
|
||||
if altgroup not in groups:
|
||||
|
@ -270,17 +270,17 @@ class RAlgorithm(GeoAlgorithm):
|
||||
|
||||
def getImportCommands(self):
|
||||
commands = []
|
||||
|
||||
|
||||
# just use main mirror
|
||||
commands.append('options("repos"="http://cran.at.r-project.org/")')
|
||||
|
||||
|
||||
# try to install packages if needed
|
||||
packages = RUtils.getRequiredPackages(self.script)
|
||||
packages.extend(['rgdal', 'raster'])
|
||||
for p in packages:
|
||||
for p in packages:
|
||||
commands.append(
|
||||
'tryCatch(find.package("' + p +
|
||||
'"), error=function(e) install.packages("' + p +'", dependencies=TRUE))')
|
||||
'tryCatch(find.package("' + p +
|
||||
'"), error=function(e) install.packages("' + p +'", dependencies=TRUE))')
|
||||
commands.append('library("raster")')
|
||||
commands.append('library("rgdal")')
|
||||
|
||||
@ -401,7 +401,7 @@ class RAlgorithm(GeoAlgorithm):
|
||||
html += "<p>The script you have executed needs the following packages:</p><ul>"
|
||||
packages = RUtils.getRequiredPackages(self.script)
|
||||
for p in packages:
|
||||
html += '<li>' + p + '</li>'
|
||||
html += '<li>' + p + '</li>'
|
||||
html += "</ul><p>Make sure they are installed in your R environment before trying to execute this script.</p>"
|
||||
else:
|
||||
html += msg + "</i></li></ul>"
|
||||
|
@ -125,7 +125,7 @@ class RUtils:
|
||||
s+="</font>\n"
|
||||
|
||||
return s
|
||||
|
||||
|
||||
@staticmethod
|
||||
def checkRIsInstalled(ignoreRegistrySettings=False):
|
||||
if SextanteUtils.isWindows():
|
||||
@ -157,9 +157,8 @@ class RUtils:
|
||||
'<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/sextante/3rdParty.html">Click here</a>'
|
||||
'to know more about how to install and configure R to be used with SEXTANTE</p>')
|
||||
return html
|
||||
|
||||
|
||||
@staticmethod
|
||||
def getRequiredPackages(code):
|
||||
regex = re.compile('library\("?(.*?)"?\)')
|
||||
return regex.findall(code)
|
||||
|
@ -374,7 +374,7 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
layer = QGisLayers.getObjectFromUri(value)
|
||||
if layer is not None and layer.bandCount() > 1:
|
||||
return ("Input layer " + str(layer.name()) + " has more than one band.\n"
|
||||
+ "Multiband layers are not supported by SAGA")
|
||||
+ "Multiband layers are not supported by SAGA")
|
||||
|
||||
def helpFile(self):
|
||||
return os.path.join(os.path.dirname(__file__), "help", self.name.replace(" ", "") + ".html")
|
||||
|
@ -83,7 +83,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
alg = SagaAlgorithm(os.path.join(folder, descriptionFile))
|
||||
if alg.name.strip() != "":
|
||||
self.preloadedAlgs.append(alg)
|
||||
else:
|
||||
else:
|
||||
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile)
|
||||
except Exception,e:
|
||||
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile +"\n" + str(e))
|
||||
|
@ -570,8 +570,8 @@ void QgsAttributeTableDialog::filterQueryAccepted()
|
||||
{
|
||||
if ( mFilterQuery->text().isEmpty() )
|
||||
{
|
||||
filterShowAll();
|
||||
return;
|
||||
filterShowAll();
|
||||
return;
|
||||
}
|
||||
filterQueryChanged( mFilterQuery->text() );
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
QgsComposerItemGroup::QgsComposerItemGroup( QgsComposition* c )
|
||||
: QgsComposerItem( c )
|
||||
: QgsComposerItem( c )
|
||||
{
|
||||
setZValue( 90 );
|
||||
show();
|
||||
|
@ -46,26 +46,26 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )
|
||||
QChar escape = '\\';
|
||||
QString part;
|
||||
bool inEscape = false;
|
||||
for (int i = 0; i < encData.length(); ++i)
|
||||
{
|
||||
if (encData.at(i) == escape && !inEscape)
|
||||
{
|
||||
inEscape = true;
|
||||
}
|
||||
else if (encData.at(i) == split && !inEscape)
|
||||
{
|
||||
parts << part;
|
||||
part = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
part += encData.at(i);
|
||||
inEscape = false;
|
||||
}
|
||||
}
|
||||
if (!part.isEmpty())
|
||||
for ( int i = 0; i < encData.length(); ++i )
|
||||
{
|
||||
if ( encData.at( i ) == escape && !inEscape )
|
||||
{
|
||||
inEscape = true;
|
||||
}
|
||||
else if ( encData.at( i ) == split && !inEscape )
|
||||
{
|
||||
parts << part;
|
||||
part = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
part += encData.at( i );
|
||||
inEscape = false;
|
||||
}
|
||||
}
|
||||
if ( !part.isEmpty() )
|
||||
{
|
||||
parts << part;
|
||||
}
|
||||
|
||||
if ( parts.size() == 4 )
|
||||
@ -80,11 +80,11 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )
|
||||
|
||||
QString QgsMimeDataUtils::Uri::data() const
|
||||
{
|
||||
QString escapedName = name;
|
||||
QString escapeUri = uri;
|
||||
escapedName.replace(":", "\\:");
|
||||
escapeUri.replace(":", "\\:");
|
||||
return layerType + ":" + providerKey + ":" + escapedName + ":" + escapeUri;
|
||||
QString escapedName = name;
|
||||
QString escapeUri = uri;
|
||||
escapedName.replace( ":", "\\:" );
|
||||
escapeUri.replace( ":", "\\:" );
|
||||
return layerType + ":" + providerKey + ":" + escapedName + ":" + escapeUri;
|
||||
}
|
||||
|
||||
// -----
|
||||
|
@ -820,7 +820,7 @@ int QgsProjectFileTransform::rasterBandNumber( const QDomElement& rasterProperti
|
||||
|
||||
if ( re.indexIn( rasterBandElem.text() ) >= 0 )
|
||||
{
|
||||
return re.cap(1).toInt();
|
||||
return re.cap( 1 ).toInt();
|
||||
}
|
||||
}
|
||||
return band;
|
||||
|
@ -267,7 +267,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
|
||||
commitErrors << tr( "ERROR: %n attribute(s) not deleted.", "not deleted attributes count", mDeletedAttributeIds.size() );
|
||||
#if 0
|
||||
QString list = "ERROR: Pending attribute deletes:";
|
||||
foreach( int idx, mDeletedAttributeIds )
|
||||
foreach ( int idx, mDeletedAttributeIds )
|
||||
{
|
||||
list.append( " " + L->pendingFields()[idx].name() );
|
||||
}
|
||||
@ -296,7 +296,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
|
||||
commitErrors << tr( "ERROR: %n new attribute(s) not added", "not added attributes count", mAddedAttributes.size() );
|
||||
#if 0
|
||||
QString list = "ERROR: Pending adds:";
|
||||
foreach( QgsField f, mAddedAttributes )
|
||||
foreach ( QgsField f, mAddedAttributes )
|
||||
{
|
||||
list.append( " " + f.name() );
|
||||
}
|
||||
@ -353,14 +353,14 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
|
||||
commitErrors << tr( "ERROR: %n attribute value change(s) not applied.", "not changed attribute values count", mChangedAttributeValues.size() );
|
||||
#if 0
|
||||
QString list = "ERROR: pending changes:";
|
||||
foreach( QgsFeatureId id, mChangedAttributeValues.keys() )
|
||||
foreach ( QgsFeatureId id, mChangedAttributeValues.keys() )
|
||||
{
|
||||
list.append( "\n " + FID_TO_STRING( id ) + "[" );
|
||||
foreach( int idx, mChangedAttributeValues[ id ].keys() )
|
||||
list.append( "\n " + FID_TO_STRING( id ) + "[" );
|
||||
foreach ( int idx, mChangedAttributeValues[ id ].keys() )
|
||||
{
|
||||
list.append( QString( " %1:%2" ).arg( L->pendingFields()[idx].name() ).arg( mChangedAttributeValues[id][idx].toString() ) );
|
||||
}
|
||||
list.append( " ]" );
|
||||
list.append( " ]" );
|
||||
}
|
||||
commitErrors << list;
|
||||
#endif
|
||||
@ -392,9 +392,9 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
|
||||
commitErrors << tr( "ERROR: %n feature(s) not deleted.", "not deleted features count", mDeletedFeatureIds.size() );
|
||||
#if 0
|
||||
QString list = "ERROR: pending deletes:";
|
||||
foreach( QgsFeatureId id, mDeletedFeatureIds )
|
||||
foreach ( QgsFeatureId id, mDeletedFeatureIds )
|
||||
{
|
||||
list.append( " " + FID_TO_STRING( id ) );
|
||||
list.append( " " + FID_TO_STRING( id ) );
|
||||
}
|
||||
commitErrors << list;
|
||||
#endif
|
||||
@ -440,17 +440,17 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
|
||||
{
|
||||
commitErrors << tr( "ERROR: %n feature(s) not added.", "not added features count", mAddedFeatures.size() );
|
||||
#if 0
|
||||
QString list = "ERROR: pending adds:";
|
||||
foreach( QgsFeature f, mAddedFeatures )
|
||||
{
|
||||
list.append( " " + FID_TO_STRING( f.id() ) + "[" );
|
||||
for( int i = 0; i < L->pendingFields().size(); i++ )
|
||||
{
|
||||
list.append( QString( " %1:%2" ).arg( L->pendingFields()[i].name() ).arg( f.attributes()[i].toString() ) );
|
||||
}
|
||||
list.append( " ]" );
|
||||
}
|
||||
commitErrors << list;
|
||||
QString list = "ERROR: pending adds:";
|
||||
foreach ( QgsFeature f, mAddedFeatures )
|
||||
{
|
||||
list.append( " " + FID_TO_STRING( f.id() ) + "[" );
|
||||
for ( int i = 0; i < L->pendingFields().size(); i++ )
|
||||
{
|
||||
list.append( QString( " %1:%2" ).arg( L->pendingFields()[i].name() ).arg( f.attributes()[i].toString() ) );
|
||||
}
|
||||
list.append( " ]" );
|
||||
}
|
||||
commitErrors << list;
|
||||
#endif
|
||||
success = false;
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ int main( int argc, char * argv[] )
|
||||
}
|
||||
else if ( request.compare( "GetLegendGraphic", Qt::CaseInsensitive ) == 0 ||
|
||||
request.compare( "GetLegendGraphics", Qt::CaseInsensitive ) == 0 )
|
||||
// GetLegendGraphics for compatibility with earlier QGIS versions
|
||||
// GetLegendGraphics for compatibility with earlier QGIS versions
|
||||
{
|
||||
QImage* result = 0;
|
||||
try
|
||||
|
@ -649,9 +649,9 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
|
||||
QString name = QString::fromUtf8( results[( i * columns ) + 1] );
|
||||
QString pk = results[( i * columns ) + 5];
|
||||
if ( pk.toInt() == 0 )
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if( mPrimaryKey.isEmpty() )
|
||||
if ( mPrimaryKey.isEmpty() )
|
||||
mPrimaryKey = name;
|
||||
mPrimaryKeyAttrs << i - 1;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ void TestQgsRubberband::testAddSingleMultiGeometries()
|
||||
QgsGeometry* geomSinglePart = QgsGeometry::fromWkt( "POLYGON((-0.00022418 -0.00000279,-0.0001039 0.00002395,-0.00008677 -0.00005313,-0.00020705 -0.00007987,-0.00022418 -0.00000279))" );
|
||||
QgsGeometry* geomMultiPart = QgsGeometry::fromWkt( "MULTIPOLYGON(((-0.00018203 0.00012178,-0.00009444 0.00014125,-0.00007861 0.00007001,-0.00016619 0.00005054,-0.00018203 0.00012178)),((-0.00030957 0.00009464,-0.00021849 0.00011489,-0.00020447 0.00005184,-0.00029555 0.00003158,-0.00030957 0.00009464)))" );
|
||||
|
||||
mCanvas->setExtent(QgsRectangle(-1e-3,-1e-3,1e-3,1e-3)); // otherwise point cannot be converted to canvas coord
|
||||
mCanvas->setExtent( QgsRectangle( -1e-3, -1e-3, 1e-3, 1e-3 ) ); // otherwise point cannot be converted to canvas coord
|
||||
|
||||
mRubberband->addGeometry( geomSinglePart, mPolygonLayer );
|
||||
mRubberband->addGeometry( geomMultiPart, mPolygonLayer );
|
||||
|
Loading…
x
Reference in New Issue
Block a user