mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
fix some warnings and indentation update
This commit is contained in:
parent
d61c5361ce
commit
0dd02bad04
@ -75,10 +75,10 @@ class OTBAlgorithmProvider(AlgorithmProvider):
|
||||
def initializeSettings(self):
|
||||
AlgorithmProvider.initializeSettings(self)
|
||||
if OTBUtils.findOtbPath() is None:
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_FOLDER,
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_FOLDER,
|
||||
"OTB command line tools folder", OTBUtils.otbPath()))
|
||||
if OTBUtils.findOtbLibPath() is None:
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_LIB_FOLDER,
|
||||
if OTBUtils.findOtbLibPath() is None:
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_LIB_FOLDER,
|
||||
"OTB applications folder", OTBUtils.otbLibPath()))
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_SRTM_FOLDER, "SRTM tiles folder", OTBUtils.otbSRTMPath()))
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_GEOID_FILE, "Geoid file", OTBUtils.otbGeoidPath()))
|
||||
|
@ -60,7 +60,7 @@ class OTBUtils:
|
||||
if os.path.exists(os.path.join(testfolder, "otbcli")):
|
||||
folder = testfolder
|
||||
elif isWindows():
|
||||
testfolder = os.path.join(os.path.dirname(QgsApplication.prefixPath()),
|
||||
testfolder = os.path.join(os.path.dirname(QgsApplication.prefixPath()),
|
||||
os.pardir, "bin")
|
||||
if os.path.exists(os.path.join(testfolder, "otbcli.bat")):
|
||||
folder = testfolder
|
||||
@ -71,12 +71,12 @@ class OTBUtils:
|
||||
return folder
|
||||
|
||||
@staticmethod
|
||||
def otbPath():
|
||||
def otbPath():
|
||||
folder = OTBUtils.findOtbPath()
|
||||
if folder is None:
|
||||
folder = ProcessingConfig.getSetting(OTBUtils.OTB_FOLDER)
|
||||
return folder
|
||||
|
||||
|
||||
@staticmethod
|
||||
def findOtbLibPath():
|
||||
folder = None
|
||||
@ -105,8 +105,8 @@ class OTBUtils:
|
||||
if folder is None:
|
||||
folder = ProcessingConfig.getSetting(OTBUtils.OTB_LIB_FOLDER)
|
||||
return folder
|
||||
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def otbSRTMPath():
|
||||
folder = ProcessingConfig.getSetting(OTBUtils.OTB_SRTM_FOLDER)
|
||||
|
@ -38,7 +38,7 @@ from qgis.utils import iface
|
||||
class SetRasterStyle(GeoAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
STYLE = 'STYLE'
|
||||
STYLE = 'STYLE'
|
||||
OUTPUT = 'OUTPUT'
|
||||
|
||||
|
||||
@ -46,22 +46,22 @@ class SetRasterStyle(GeoAlgorithm):
|
||||
self.allowOnlyOpenedLayers = True
|
||||
self.name = 'Set style for raster layer'
|
||||
self.group = 'Raster general tools'
|
||||
self.addParameter(ParameterRaster(self.INPUT, 'Vector layer'))
|
||||
self.addParameter(ParameterRaster(self.INPUT, 'Vector layer'))
|
||||
self.addParameter(ParameterFile(self.STYLE,
|
||||
'Style file', False, False, 'qml'))
|
||||
self.addOutput(OutputRaster(self.OUTPUT, 'Styled layer', True))
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
filename = self.getParameterValue(self.INPUT)
|
||||
layer = dataobjects.getObjectFromUri(filename)
|
||||
|
||||
layer = dataobjects.getObjectFromUri(filename)
|
||||
|
||||
style = self.getParameterValue(self.STYLE)
|
||||
with open(style) as f:
|
||||
xml = "".join(f.readlines())
|
||||
xml = "".join(f.readlines())
|
||||
d = QDomDocument();
|
||||
d.setContent(xml);
|
||||
n = d.firstChild();
|
||||
layer.readSymbology(n, '')
|
||||
n = d.firstChild();
|
||||
layer.readSymbology(n, '')
|
||||
self.setOutputValue(self.OUTPUT, filename)
|
||||
iface.mapCanvas().refresh()
|
||||
iface.legendInterface().refreshLayerSymbology(layer)
|
||||
|
@ -37,7 +37,7 @@ from qgis.utils import iface
|
||||
class SetVectorStyle(GeoAlgorithm):
|
||||
|
||||
INPUT = 'INPUT'
|
||||
STYLE = 'STYLE'
|
||||
STYLE = 'STYLE'
|
||||
OUTPUT = 'OUTPUT'
|
||||
|
||||
|
||||
@ -46,18 +46,18 @@ class SetVectorStyle(GeoAlgorithm):
|
||||
self.name = 'Set style for vector layer'
|
||||
self.group = 'Vector general tools'
|
||||
self.addParameter(ParameterVector(self.INPUT, 'Vector layer',
|
||||
[ParameterVector.VECTOR_TYPE_ANY]))
|
||||
[ParameterVector.VECTOR_TYPE_ANY]))
|
||||
self.addParameter(ParameterFile(self.STYLE,
|
||||
'Style file', False, False, 'qml'))
|
||||
self.addOutput(OutputVector(self.OUTPUT, 'Styled layer', True))
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
filename = self.getParameterValue(self.INPUT)
|
||||
layer = dataobjects.getObjectFromUri(filename)
|
||||
|
||||
layer = dataobjects.getObjectFromUri(filename)
|
||||
|
||||
style = self.getParameterValue(self.STYLE)
|
||||
layer.loadNamedStyle(style)
|
||||
|
||||
layer.loadNamedStyle(style)
|
||||
|
||||
self.setOutputValue(self.OUTPUT, filename)
|
||||
iface.mapCanvas().refresh()
|
||||
iface.legendInterface().refreshLayerSymbology(layer)
|
||||
|
@ -52,7 +52,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
'Use SAGA 2.0.8 syntax', not isMac()))
|
||||
if isWindows() or isMac():
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(),
|
||||
SagaUtils.SAGA_FOLDER, 'SAGA folder', ''))
|
||||
SagaUtils.SAGA_FOLDER, 'SAGA folder', ''))
|
||||
ProcessingConfig.addSetting(Setting(self.getDescription(),
|
||||
SagaUtils.SAGA_IMPORT_EXPORT_OPTIMIZATION,
|
||||
'Enable SAGA Import/Export optimizations',
|
||||
@ -74,7 +74,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
|
||||
|
||||
def _loadAlgorithms(self):
|
||||
self.algs = []
|
||||
self.algs = []
|
||||
folder = SagaUtils.sagaDescriptionPath()
|
||||
for descriptionFile in os.listdir(folder):
|
||||
if descriptionFile.endswith('txt'):
|
||||
|
@ -60,7 +60,7 @@ class SagaUtils:
|
||||
|
||||
@staticmethod
|
||||
def findSagaFolder():
|
||||
folder = None
|
||||
folder = None
|
||||
if isMac():
|
||||
testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
|
||||
if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
|
||||
@ -70,16 +70,16 @@ class SagaUtils:
|
||||
if os.path.exists(os.path.join(testfolder, 'saga_cmd')):
|
||||
folder = testfolder
|
||||
elif isWindows():
|
||||
testfolder = os.path.join(os.path.dirname(QgsApplication.prefixPath()), 'saga')
|
||||
testfolder = os.path.join(os.path.dirname(QgsApplication.prefixPath()), 'saga')
|
||||
if os.path.exists(os.path.join(testfolder, 'saga_cmd.exe')):
|
||||
folder = testfolder
|
||||
return folder
|
||||
|
||||
|
||||
@staticmethod
|
||||
def sagaPath():
|
||||
def sagaPath():
|
||||
folder = SagaUtils.findSagaFolder()
|
||||
if folder is None:
|
||||
folder = ProcessingConfig.getSetting(SagaUtils.SAGA_FOLDER)
|
||||
folder = ProcessingConfig.getSetting(SagaUtils.SAGA_FOLDER)
|
||||
return folder or ''
|
||||
|
||||
@staticmethod
|
||||
@ -87,8 +87,8 @@ class SagaUtils:
|
||||
if SagaUtils.findSagaFolder() is not None:
|
||||
return not isMac();
|
||||
else:
|
||||
return ProcessingConfig.getSetting(SagaUtils.SAGA_208)
|
||||
|
||||
return ProcessingConfig.getSetting(SagaUtils.SAGA_208)
|
||||
|
||||
@staticmethod
|
||||
def sagaDescriptionPath():
|
||||
return os.path.join(os.path.dirname(__file__), 'description')
|
||||
|
@ -53,7 +53,7 @@ class ParameterFile(Parameter):
|
||||
else:
|
||||
self.value = ''
|
||||
if self.ext is not None and self.value != '':
|
||||
return self.value.endswith(self.ext)
|
||||
return self.value.endswith(self.ext)
|
||||
return True
|
||||
|
||||
def deserialize(self, s):
|
||||
|
@ -433,7 +433,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
|
||||
featItem->addChild( attrItem );
|
||||
}
|
||||
|
||||
if( !featureLabeled )
|
||||
if ( !featureLabeled )
|
||||
{
|
||||
featItem->setText( 0, tr( "feature id" ) );
|
||||
featItem->setText( 1, QString::number( f.id() ) );
|
||||
|
@ -6440,9 +6440,9 @@ QgsGeometry* QgsGeometry::convertToPolygon( bool destMultipart )
|
||||
QgsGeometry *QgsGeometry::unaryUnion( const QList<QgsGeometry*> &geometryList )
|
||||
{
|
||||
QList<GEOSGeometry*> geoms;
|
||||
foreach( QgsGeometry* g, geometryList )
|
||||
foreach ( QgsGeometry* g, geometryList )
|
||||
{
|
||||
geoms.append( GEOSGeom_clone(g->asGeos()) );
|
||||
geoms.append( GEOSGeom_clone( g->asGeos() ) );
|
||||
}
|
||||
GEOSGeometry *geomUnion = _makeUnion( geoms );
|
||||
QgsGeometry *ret = new QgsGeometry();
|
||||
|
@ -356,6 +356,7 @@ class CORE_EXPORT QgsGeometry
|
||||
QgsGeometry* buffer( double distance, int segments );
|
||||
|
||||
/** Returns a buffer region around the geometry, with additional style options.
|
||||
* @param distance buffer distance
|
||||
* @param segments For round joins, number of segments to approximate quarter-circle
|
||||
* @param endCapStyle Round (1) / Flat (2) / Square (3) end cap style
|
||||
* @param joinStyle Round (1) / Mitre (2) / Bevel (3) join style
|
||||
|
@ -562,6 +562,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin
|
||||
{
|
||||
bool cacheValid = mCache->init( mSettings.visibleExtent(), mSettings.scale() );
|
||||
QgsDebugMsg( QString( "CACHE VALID: %1" ).arg( cacheValid ) );
|
||||
Q_UNUSED( cacheValid );
|
||||
}
|
||||
|
||||
mGeometryCaches.clear();
|
||||
@ -915,6 +916,7 @@ void QgsMapRendererParallelJob::renderLayerStatic( LayerRenderJob& job )
|
||||
job.renderer->render();
|
||||
int tt = t.elapsed();
|
||||
QgsDebugMsg( QString( "job %1 end [%2 ms]" ).arg(( ulong ) &job, 0, 16 ).arg( tt ) );
|
||||
Q_UNUSED( tt );
|
||||
}
|
||||
|
||||
|
||||
|
@ -462,7 +462,7 @@ void QgsSimpleLineSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderCon
|
||||
{
|
||||
dashWidthDiv = 1.0;
|
||||
}
|
||||
|
||||
|
||||
QVector<qreal> dashVector;
|
||||
QStringList dashList = dashPatternExpression->evaluate( const_cast<QgsFeature*>( context.feature() ) ).toString().split( ";" );
|
||||
QStringList::const_iterator dashIt = dashList.constBegin();
|
||||
|
@ -479,7 +479,9 @@ void QgsLayerTreeModel::setLayerTreeNodeFont( int nodeType, const QFont& font )
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsDebugMsg( "invalid node type" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,9 @@ void QgsMapCanvasMap::paint( QPainter* painter )
|
||||
{
|
||||
int w = qRound( boundingRect().width() ) - 2, h = qRound( boundingRect().height() ) - 2; // setRect() makes the size +2 :-(
|
||||
if ( mImage.size() != QSize( w, h ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg( mImage.width() ).arg( mImage.height() ).arg( w ).arg( h ) );
|
||||
}
|
||||
painter->drawImage( QRect( 0, 0, w, h ), mImage );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user