mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
indentation update and a few fixed typos
This commit is contained in:
parent
8fb20f038d
commit
ec0f0bea28
@ -206,7 +206,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
|
|||||||
settings.setValue("pythonConsole/caretLineColor", self.caretLineColor.color())
|
settings.setValue("pythonConsole/caretLineColor", self.caretLineColor.color())
|
||||||
settings.setValue("pythonConsole/caretLineColorEditor", self.caretLineColorEditor.color())
|
settings.setValue("pythonConsole/caretLineColorEditor", self.caretLineColorEditor.color())
|
||||||
settings.setValue("pythonConsole/stderrFontColor", self.stderrFontColor.color())
|
settings.setValue("pythonConsole/stderrFontColor", self.stderrFontColor.color())
|
||||||
|
|
||||||
settings.setValue("pythonConsole/singleQuoteFontColor", self.singleQuoteFontColor.color())
|
settings.setValue("pythonConsole/singleQuoteFontColor", self.singleQuoteFontColor.color())
|
||||||
settings.setValue("pythonConsole/singleQuoteFontColorEditor", self.singleQuoteFontColorEditor.color())
|
settings.setValue("pythonConsole/singleQuoteFontColorEditor", self.singleQuoteFontColorEditor.color())
|
||||||
settings.setValue("pythonConsole/doubleQuoteFontColor", self.doubleQuoteFontColor.color())
|
settings.setValue("pythonConsole/doubleQuoteFontColor", self.doubleQuoteFontColor.color())
|
||||||
@ -215,7 +215,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
|
|||||||
settings.setValue("pythonConsole/tripleSingleQuoteFontColorEditor", self.tripleSingleQuoteFontColorEditor.color())
|
settings.setValue("pythonConsole/tripleSingleQuoteFontColorEditor", self.tripleSingleQuoteFontColorEditor.color())
|
||||||
settings.setValue("pythonConsole/tripleDoubleQuoteFontColor", self.tripleDoubleQuoteFontColor.color())
|
settings.setValue("pythonConsole/tripleDoubleQuoteFontColor", self.tripleDoubleQuoteFontColor.color())
|
||||||
settings.setValue("pythonConsole/tripleDoubleQuoteFontColorEditor", self.tripleDoubleQuoteFontColorEditor.color())
|
settings.setValue("pythonConsole/tripleDoubleQuoteFontColorEditor", self.tripleDoubleQuoteFontColorEditor.color())
|
||||||
|
|
||||||
def restoreSettings(self):
|
def restoreSettings(self):
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10, type=int))
|
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10, type=int))
|
||||||
@ -285,7 +285,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
|
|||||||
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(Qt.black))))
|
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(Qt.black))))
|
||||||
self.cursorColorEditor.setColor(QColor(settings.value("pythonConsole/cursorColorEditor", QColor(Qt.black))))
|
self.cursorColorEditor.setColor(QColor(settings.value("pythonConsole/cursorColorEditor", QColor(Qt.black))))
|
||||||
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(Qt.red))))
|
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(Qt.red))))
|
||||||
|
|
||||||
self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(Qt.blue)))
|
self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(Qt.blue)))
|
||||||
self.singleQuoteFontColorEditor.setColor(settings.value("pythonConsole/singleQuoteFontColorEditor", QColor(Qt.blue)))
|
self.singleQuoteFontColorEditor.setColor(settings.value("pythonConsole/singleQuoteFontColorEditor", QColor(Qt.blue)))
|
||||||
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(Qt.blue)))
|
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(Qt.blue)))
|
||||||
@ -311,7 +311,7 @@ class optionsDialog(QDialog, Ui_SettingsDialogPythonConsole):
|
|||||||
self.doubleQuoteFontColor.setColor(QColor(Qt.blue))
|
self.doubleQuoteFontColor.setColor(QColor(Qt.blue))
|
||||||
self.tripleSingleQuoteFontColor.setColor(QColor(Qt.blue))
|
self.tripleSingleQuoteFontColor.setColor(QColor(Qt.blue))
|
||||||
self.tripleDoubleQuoteFontColor.setColor(QColor(Qt.blue))
|
self.tripleDoubleQuoteFontColor.setColor(QColor(Qt.blue))
|
||||||
|
|
||||||
|
|
||||||
def _resetFontColorEditor(self):
|
def _resetFontColorEditor(self):
|
||||||
self.defaultFontColorEditor.setColor(QColor(Qt.black))
|
self.defaultFontColorEditor.setColor(QColor(Qt.black))
|
||||||
|
@ -121,8 +121,8 @@ class SaveSelectedFeatures(GeoAlgorithm):
|
|||||||
# toolbox. The self.crs variable has to be changed in case this
|
# toolbox. The self.crs variable has to be changed in case this
|
||||||
# is not true, or in case there are no input layer from which
|
# is not true, or in case there are no input layer from which
|
||||||
# the output crs can be infered
|
# the output crs can be infered
|
||||||
|
|
||||||
|
|
||||||
provider = vectorLayer.dataProvider()
|
provider = vectorLayer.dataProvider()
|
||||||
|
|
||||||
writer = output.getVectorWriter(provider.fields(),
|
writer = output.getVectorWriter(provider.fields(),
|
||||||
@ -131,12 +131,12 @@ class SaveSelectedFeatures(GeoAlgorithm):
|
|||||||
# Now we take the selected features and add them to the output
|
# Now we take the selected features and add them to the output
|
||||||
# layer
|
# layer
|
||||||
features = vector.features(vectorLayer)
|
features = vector.features(vectorLayer)
|
||||||
total = len(features)
|
total = len(features)
|
||||||
for (i, feat) in enumerate(features):
|
for (i, feat) in enumerate(features):
|
||||||
writer.addFeature(feat)
|
writer.addFeature(feat)
|
||||||
|
|
||||||
# We use the progress object to communicate with the user
|
# We use the progress object to communicate with the user
|
||||||
progress.setPercentage(100 * i / float(total))
|
progress.setPercentage(100 * i / float(total))
|
||||||
del writer
|
del writer
|
||||||
|
|
||||||
# There is nothing more to do here. We do not have to open the
|
# There is nothing more to do here. We do not have to open the
|
||||||
|
@ -36,10 +36,10 @@ from processing.tools import dataobjects, vector
|
|||||||
class ExtractByLocation(GeoAlgorithm):
|
class ExtractByLocation(GeoAlgorithm):
|
||||||
|
|
||||||
INPUT = 'INPUT'
|
INPUT = 'INPUT'
|
||||||
INTERSECT = 'INTERSECT'
|
INTERSECT = 'INTERSECT'
|
||||||
OUTPUT = 'OUTPUT'
|
OUTPUT = 'OUTPUT'
|
||||||
|
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.name = 'Extract by location'
|
self.name = 'Extract by location'
|
||||||
self.group = 'Vector selection tools'
|
self.group = 'Vector selection tools'
|
||||||
self.addParameter(ParameterVector(self.INPUT, 'Layer to select from',
|
self.addParameter(ParameterVector(self.INPUT, 'Layer to select from',
|
||||||
@ -55,7 +55,7 @@ class ExtractByLocation(GeoAlgorithm):
|
|||||||
filename = self.getParameterValue(self.INTERSECT)
|
filename = self.getParameterValue(self.INTERSECT)
|
||||||
selectLayer = dataobjects.getObjectFromUri(filename)
|
selectLayer = dataobjects.getObjectFromUri(filename)
|
||||||
index = vector.spatialindex(layer)
|
index = vector.spatialindex(layer)
|
||||||
|
|
||||||
geom = QgsGeometry()
|
geom = QgsGeometry()
|
||||||
selectedSet = []
|
selectedSet = []
|
||||||
current = 0
|
current = 0
|
||||||
@ -70,15 +70,15 @@ class ExtractByLocation(GeoAlgorithm):
|
|||||||
feat = layer.getFeatures(request).next()
|
feat = layer.getFeatures(request).next()
|
||||||
tmpGeom = QgsGeometry(feat.geometry())
|
tmpGeom = QgsGeometry(feat.geometry())
|
||||||
if geom.intersects(tmpGeom):
|
if geom.intersects(tmpGeom):
|
||||||
selectedSet.append(feat.id())
|
selectedSet.append(feat.id())
|
||||||
progress.setPercentage(int(current * total))
|
progress.setPercentage(int(current * total))
|
||||||
|
|
||||||
output = self.getOutputFromName(self.OUTPUT)
|
output = self.getOutputFromName(self.OUTPUT)
|
||||||
writer = output.getVectorWriter(layer.fields(),
|
writer = output.getVectorWriter(layer.fields(),
|
||||||
layer.geometryType(), layer.crs())
|
layer.geometryType(), layer.crs())
|
||||||
|
|
||||||
for (i, feat) in enumerate(features):
|
for (i, feat) in enumerate(features):
|
||||||
if feat.id() in selectedSet:
|
if feat.id() in selectedSet:
|
||||||
writer.addFeature(feat)
|
writer.addFeature(feat)
|
||||||
progress.setPercentage(100 * i / float(featureCount))
|
progress.setPercentage(100 * i / float(featureCount))
|
||||||
del writer
|
del writer
|
||||||
|
@ -49,7 +49,7 @@ class RandomExtract(GeoAlgorithm):
|
|||||||
|
|
||||||
METHODS = ['Number of selected features',
|
METHODS = ['Number of selected features',
|
||||||
'Percentage of selected features']
|
'Percentage of selected features']
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.name = 'Random extract'
|
self.name = 'Random extract'
|
||||||
self.group = 'Vector selection tools'
|
self.group = 'Vector selection tools'
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class RandomExtract(GeoAlgorithm):
|
|||||||
|
|
||||||
features = vector.features(layer)
|
features = vector.features(layer)
|
||||||
featureCount = len(features)
|
featureCount = len(features)
|
||||||
value = int(self.getParameterValue(self.NUMBER))
|
value = int(self.getParameterValue(self.NUMBER))
|
||||||
|
|
||||||
if method == 0:
|
if method == 0:
|
||||||
if value > featureCount:
|
if value > featureCount:
|
||||||
@ -85,12 +85,12 @@ class RandomExtract(GeoAlgorithm):
|
|||||||
|
|
||||||
selran = random.sample(xrange(0, featureCount), value)
|
selran = random.sample(xrange(0, featureCount), value)
|
||||||
|
|
||||||
output = self.getOutputFromName(self.OUTPUT)
|
output = self.getOutputFromName(self.OUTPUT)
|
||||||
writer = output.getVectorWriter(layer.fields(),
|
writer = output.getVectorWriter(layer.fields(),
|
||||||
layer.geometryType(), layer.crs())
|
layer.geometryType(), layer.crs())
|
||||||
|
|
||||||
for (i, feat) in enumerate(features):
|
for (i, feat) in enumerate(features):
|
||||||
if i in selran:
|
if i in selran:
|
||||||
writer.addFeature(feat)
|
writer.addFeature(feat)
|
||||||
progress.setPercentage(100 * i / float(featureCount))
|
progress.setPercentage(100 * i / float(featureCount))
|
||||||
del writer
|
del writer
|
||||||
|
@ -50,7 +50,7 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
|
|||||||
METHODS = ['Number of selected features',
|
METHODS = ['Number of selected features',
|
||||||
'Percentage of selected features']
|
'Percentage of selected features']
|
||||||
|
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.name = 'Random extract within subsets'
|
self.name = 'Random extract within subsets'
|
||||||
self.group = 'Vector selection tools'
|
self.group = 'Vector selection tools'
|
||||||
|
|
||||||
@ -72,12 +72,12 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
|
|||||||
layer = dataobjects.getObjectFromUri(filename)
|
layer = dataobjects.getObjectFromUri(filename)
|
||||||
field = self.getParameterValue(self.FIELD)
|
field = self.getParameterValue(self.FIELD)
|
||||||
method = self.getParameterValue(self.METHOD)
|
method = self.getParameterValue(self.METHOD)
|
||||||
|
|
||||||
index = layer.fieldNameIndex(field)
|
index = layer.fieldNameIndex(field)
|
||||||
|
|
||||||
features = vector.features(layer)
|
features = vector.features(layer)
|
||||||
featureCount = len(features)
|
featureCount = len(features)
|
||||||
unique = vector.getUniqueValues(layer, index)
|
unique = vector.getUniqueValues(layer, index)
|
||||||
value = int(self.getParameterValue(self.NUMBER))
|
value = int(self.getParameterValue(self.NUMBER))
|
||||||
if method == 0:
|
if method == 0:
|
||||||
if value > featureCount:
|
if value > featureCount:
|
||||||
@ -92,11 +92,11 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
|
|||||||
value = value / 100.0
|
value = value / 100.0
|
||||||
|
|
||||||
|
|
||||||
output = self.getOutputFromName(self.OUTPUT)
|
output = self.getOutputFromName(self.OUTPUT)
|
||||||
writer = output.getVectorWriter(layer.fields(),
|
writer = output.getVectorWriter(layer.fields(),
|
||||||
layer.geometryType(), layer.crs())
|
layer.geometryType(), layer.crs())
|
||||||
|
|
||||||
selran = []
|
selran = []
|
||||||
current = 0
|
current = 0
|
||||||
total = 100.0 / float(featureCount * len(unique))
|
total = 100.0 / float(featureCount * len(unique))
|
||||||
features = vector.features(layer)
|
features = vector.features(layer)
|
||||||
@ -129,6 +129,6 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
|
|||||||
features = vector.features(layer)
|
features = vector.features(layer)
|
||||||
for (i, feat) in enumerate(features):
|
for (i, feat) in enumerate(features):
|
||||||
if i in selran:
|
if i in selran:
|
||||||
writer.addFeature(feat)
|
writer.addFeature(feat)
|
||||||
progress.setPercentage(100 * i / float(featureCount))
|
progress.setPercentage(100 * i / float(featureCount))
|
||||||
del writer
|
del writer
|
||||||
|
@ -67,7 +67,7 @@ class SelectByLocation(GeoAlgorithm):
|
|||||||
|
|
||||||
oldSelection = set(inputLayer.selectedFeaturesIds())
|
oldSelection = set(inputLayer.selectedFeaturesIds())
|
||||||
index = vector.spatialindex(inputLayer)
|
index = vector.spatialindex(inputLayer)
|
||||||
|
|
||||||
geom = QgsGeometry()
|
geom = QgsGeometry()
|
||||||
selectedSet = []
|
selectedSet = []
|
||||||
current = 0
|
current = 0
|
||||||
|
@ -1098,7 +1098,7 @@ class mmqgisx_select_algorithm(GeoAlgorithm):
|
|||||||
|
|
||||||
layer.setSelectedFeatures(selected)
|
layer.setSelectedFeatures(selected)
|
||||||
self.setOutputValue(self.RESULT, filename)
|
self.setOutputValue(self.RESULT, filename)
|
||||||
|
|
||||||
class mmqgisx_extract_algorithm(GeoAlgorithm):
|
class mmqgisx_extract_algorithm(GeoAlgorithm):
|
||||||
|
|
||||||
LAYERNAME = 'LAYERNAME'
|
LAYERNAME = 'LAYERNAME'
|
||||||
@ -1107,7 +1107,7 @@ class mmqgisx_extract_algorithm(GeoAlgorithm):
|
|||||||
COMPARISON = 'COMPARISON'
|
COMPARISON = 'COMPARISON'
|
||||||
RESULT = 'RESULT'
|
RESULT = 'RESULT'
|
||||||
|
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.name = 'Extract by attribute'
|
self.name = 'Extract by attribute'
|
||||||
self.group = 'Vector selection tools'
|
self.group = 'Vector selection tools'
|
||||||
|
|
||||||
@ -1142,19 +1142,19 @@ class mmqgisx_extract_algorithm(GeoAlgorithm):
|
|||||||
comparisonvalue = self.getParameterValue(self.COMPARISONVALUE)
|
comparisonvalue = self.getParameterValue(self.COMPARISONVALUE)
|
||||||
|
|
||||||
selected = select(layer, attribute, comparison, comparisonvalue, progress)
|
selected = select(layer, attribute, comparison, comparisonvalue, progress)
|
||||||
|
|
||||||
features = vector.features(layer)
|
features = vector.features(layer)
|
||||||
featureCount = len(features)
|
featureCount = len(features)
|
||||||
output = self.getOutputFromName(self.OUTPUT)
|
output = self.getOutputFromName(self.OUTPUT)
|
||||||
writer = output.getVectorWriter(layer.fields(),
|
writer = output.getVectorWriter(layer.fields(),
|
||||||
layer.geometryType(), layer.crs())
|
layer.geometryType(), layer.crs())
|
||||||
for (i, feat) in enumerate(features):
|
for (i, feat) in enumerate(features):
|
||||||
if feat.id() in selected:
|
if feat.id() in selected:
|
||||||
writer.addFeature(feat)
|
writer.addFeature(feat)
|
||||||
progress.setPercentage(100 * i / float(featureCount))
|
progress.setPercentage(100 * i / float(featureCount))
|
||||||
del writer
|
del writer
|
||||||
|
|
||||||
def select(layer, attribute, comparison, comparisonvalue, progress):
|
def select(layer, attribute, comparison, comparisonvalue, progress):
|
||||||
selectindex = layer.dataProvider().fieldNameIndex(attribute)
|
selectindex = layer.dataProvider().fieldNameIndex(attribute)
|
||||||
selectType = layer.dataProvider().fields()[selectindex].type()
|
selectType = layer.dataProvider().fields()[selectindex].type()
|
||||||
selectionError = False
|
selectionError = False
|
||||||
@ -1263,7 +1263,7 @@ def select(layer, attribute, comparison, comparisonvalue, progress):
|
|||||||
selected.append(feature.id())
|
selected.append(feature.id())
|
||||||
|
|
||||||
progress.setPercentage(float(readcount) / totalcount * 100)
|
progress.setPercentage(float(readcount) / totalcount * 100)
|
||||||
|
|
||||||
return selected
|
return selected
|
||||||
|
|
||||||
class mmqgisx_text_to_float_algorithm(GeoAlgorithm):
|
class mmqgisx_text_to_float_algorithm(GeoAlgorithm):
|
||||||
|
@ -71,8 +71,8 @@ class GeoAlgorithm:
|
|||||||
# appear in the toolbox or modeler
|
# appear in the toolbox or modeler
|
||||||
self.showInToolbox = True
|
self.showInToolbox = True
|
||||||
self.showInModeler = True
|
self.showInModeler = True
|
||||||
#if true, will show only loaded layers in parameters dialog.
|
#if true, will show only loaded layers in parameters dialog.
|
||||||
#Also, if True, the algorithm does not run on the modeler
|
#Also, if True, the algorithm does not run on the modeler
|
||||||
#or batch ptocessing interface
|
#or batch ptocessing interface
|
||||||
self.allowOnlyOpenedLayers = False
|
self.allowOnlyOpenedLayers = False
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class SilentProgress:
|
|||||||
|
|
||||||
def error(self, msg):
|
def error(self, msg):
|
||||||
print msg
|
print msg
|
||||||
|
|
||||||
def setText(self, text):
|
def setText(self, text):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class gdaladdo(GeoAlgorithm):
|
|||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
filepath = os.path.dirname(__file__) + '/icons/raster-overview.png'
|
filepath = os.path.dirname(__file__) + '/icons/raster-overview.png'
|
||||||
return QtGui.QIcon(filepath)
|
return QtGui.QIcon(filepath)
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:overviews"
|
return "gdalogr:overviews"
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class information(GeoAlgorithm):
|
|||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
filepath = os.path.dirname(__file__) + '/icons/raster-info.png'
|
filepath = os.path.dirname(__file__) + '/icons/raster-info.png'
|
||||||
return QtGui.QIcon(filepath)
|
return QtGui.QIcon(filepath)
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalorg:rasterinfo"
|
return "gdalorg:rasterinfo"
|
||||||
|
|
||||||
|
@ -110,10 +110,10 @@ class Ogr2Ogr(OgrAlgorithm):
|
|||||||
''))
|
''))
|
||||||
|
|
||||||
self.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer'))
|
self.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer'))
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:ogr2ogr"
|
return "gdalogr:ogr2ogr"
|
||||||
|
|
||||||
|
|
||||||
def processAlgorithm(self, progress):
|
def processAlgorithm(self, progress):
|
||||||
if not gdalAvailable:
|
if not gdalAvailable:
|
||||||
|
@ -56,9 +56,9 @@ class OgrInfo(OgrAlgorithm):
|
|||||||
[ParameterVector.VECTOR_TYPE_ANY], False))
|
[ParameterVector.VECTOR_TYPE_ANY], False))
|
||||||
|
|
||||||
self.addOutput(OutputHTML(self.OUTPUT, 'Layer information'))
|
self.addOutput(OutputHTML(self.OUTPUT, 'Layer information'))
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:vectorinfo"
|
return "gdalogr:vectorinfo"
|
||||||
|
|
||||||
def processAlgorithm(self, progress):
|
def processAlgorithm(self, progress):
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class polygonize(GeoAlgorithm):
|
|||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
filepath = os.path.dirname(__file__) + '/icons/polygonize.png'
|
filepath = os.path.dirname(__file__) + '/icons/polygonize.png'
|
||||||
return QtGui.QIcon(filepath)
|
return QtGui.QIcon(filepath)
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:polygonize"
|
return "gdalogr:polygonize"
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class proximity(GeoAlgorithm):
|
|||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
filepath = os.path.dirname(__file__) + '/icons/proximity.png'
|
filepath = os.path.dirname(__file__) + '/icons/proximity.png'
|
||||||
return QtGui.QIcon(filepath)
|
return QtGui.QIcon(filepath)
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:proximity"
|
return "gdalogr:proximity"
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class rasterize(GeoAlgorithm):
|
|||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
filepath = os.path.dirname(__file__) + '/icons/rasterize.png'
|
filepath = os.path.dirname(__file__) + '/icons/rasterize.png'
|
||||||
return QtGui.QIcon(filepath)
|
return QtGui.QIcon(filepath)
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:rasterize"
|
return "gdalogr:rasterize"
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class translate(GeoAlgorithm):
|
|||||||
def getIcon(self):
|
def getIcon(self):
|
||||||
filepath = os.path.dirname(__file__) + '/icons/translate.png'
|
filepath = os.path.dirname(__file__) + '/icons/translate.png'
|
||||||
return QtGui.QIcon(filepath)
|
return QtGui.QIcon(filepath)
|
||||||
|
|
||||||
def commandLineName(self):
|
def commandLineName(self):
|
||||||
return "gdalogr:translate"
|
return "gdalogr:translate"
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ class GrassAlgorithm(GeoAlgorithm):
|
|||||||
else:
|
else:
|
||||||
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
|
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
|
||||||
command += ' input='
|
command += ' input='
|
||||||
|
|
||||||
if self.grassName == 'r.horizon':
|
if self.grassName == 'r.horizon':
|
||||||
command += out.name + uniqueSufix + '_0'
|
command += out.name + uniqueSufix + '_0'
|
||||||
else:
|
else:
|
||||||
|
@ -126,9 +126,9 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
|
|||||||
self.buttonBox.rejected.connect(self.close)
|
self.buttonBox.rejected.connect(self.close)
|
||||||
self.buttonBox.button(
|
self.buttonBox.button(
|
||||||
QtGui.QDialogButtonBox.Cancel).clicked.connect(self.cancel)
|
QtGui.QDialogButtonBox.Cancel).clicked.connect(self.cancel)
|
||||||
|
|
||||||
self.showDebug = ProcessingConfig.getSetting(
|
self.showDebug = ProcessingConfig.getSetting(
|
||||||
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
|
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
|
||||||
|
|
||||||
def setParamValues(self):
|
def setParamValues(self):
|
||||||
params = self.alg.parameters
|
params = self.alg.parameters
|
||||||
|
@ -139,7 +139,7 @@ class HelpEditionDialog(QDialog, Ui_DlgHelpEdition):
|
|||||||
|
|
||||||
def getDescription(self, name):
|
def getDescription(self, name):
|
||||||
if name in self.descriptions:
|
if name in self.descriptions:
|
||||||
return self.descriptions[name].replace('\n', '<br>')
|
return self.descriptions[name].replace('\n', '<br>')
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ class MessageBarProgress:
|
|||||||
|
|
||||||
def error(self, msg):
|
def error(self, msg):
|
||||||
interface.iface.messageBar().clearWidgets()
|
interface.iface.messageBar().clearWidgets()
|
||||||
interface.iface.messageBar().pushMessage("Error", msg,
|
interface.iface.messageBar().pushMessage("Error", msg,
|
||||||
level = QgsMessageBar.CRITICAL,
|
level = QgsMessageBar.CRITICAL,
|
||||||
duration = 3)
|
duration = 3)
|
||||||
|
|
||||||
def setText(self, text):
|
def setText(self, text):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
__author__ = 'Victor Olaya'
|
__author__ = 'Victor Olaya'
|
||||||
__date__ = 'August 2012'
|
__date__ = 'August 2012'
|
||||||
@ -120,7 +120,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
|||||||
self.algParameters = []
|
self.algParameters = []
|
||||||
self.algOutputs = []
|
self.algOutputs = []
|
||||||
self.paramValues = {}
|
self.paramValues = {}
|
||||||
self.dependencies = []
|
self.dependencies = []
|
||||||
self.descriptionFile = filename
|
self.descriptionFile = filename
|
||||||
lines = codecs.open(filename, 'r', encoding='utf-8')
|
lines = codecs.open(filename, 'r', encoding='utf-8')
|
||||||
line = lines.readline().strip('\n').strip('\r')
|
line = lines.readline().strip('\n').strip('\r')
|
||||||
|
@ -404,15 +404,15 @@ void QgsLegend::mousePressEvent( QMouseEvent * e )
|
|||||||
if ( !legend.isNull() )
|
if ( !legend.isNull() )
|
||||||
{
|
{
|
||||||
mGetLegendGraphicPopup = new QFrame();
|
mGetLegendGraphicPopup = new QFrame();
|
||||||
mGetLegendGraphicPopup->setFrameStyle(QFrame::Box | QFrame::Raised);
|
mGetLegendGraphicPopup->setFrameStyle( QFrame::Box | QFrame::Raised );
|
||||||
mGetLegendGraphicPopup->setLineWidth(2);
|
mGetLegendGraphicPopup->setLineWidth( 2 );
|
||||||
mGetLegendGraphicPopup->setAutoFillBackground(true);
|
mGetLegendGraphicPopup->setAutoFillBackground( true );
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
QLabel *label = new QLabel(mGetLegendGraphicPopup);
|
QLabel *label = new QLabel( mGetLegendGraphicPopup );
|
||||||
label->setPixmap( QPixmap::fromImage(legend) );
|
label->setPixmap( QPixmap::fromImage( legend ) );
|
||||||
layout->addWidget(label);
|
layout->addWidget( label );
|
||||||
mGetLegendGraphicPopup->setLayout(layout);
|
mGetLegendGraphicPopup->setLayout( layout );
|
||||||
mGetLegendGraphicPopup->move(e->globalX(), e->globalY());
|
mGetLegendGraphicPopup->move( e->globalX(), e->globalY() );
|
||||||
mGetLegendGraphicPopup->show();
|
mGetLegendGraphicPopup->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,11 +645,12 @@ void QgsLegend::updateGroupCheckStates( QTreeWidgetItem *item )
|
|||||||
|
|
||||||
void QgsLegend::mouseReleaseEvent( QMouseEvent * e )
|
void QgsLegend::mouseReleaseEvent( QMouseEvent * e )
|
||||||
{
|
{
|
||||||
if (mGetLegendGraphicPopup) {
|
if ( mGetLegendGraphicPopup )
|
||||||
|
{
|
||||||
delete mGetLegendGraphicPopup;
|
delete mGetLegendGraphicPopup;
|
||||||
mGetLegendGraphicPopup = 0;
|
mGetLegendGraphicPopup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList layersPriorToEvent = layerIDs();
|
QStringList layersPriorToEvent = layerIDs();
|
||||||
QTreeWidget::mouseReleaseEvent( e );
|
QTreeWidget::mouseReleaseEvent( e );
|
||||||
mMousePressedFlag = false;
|
mMousePressedFlag = false;
|
||||||
@ -3243,7 +3244,7 @@ QImage QgsLegend::getWmsLegendPixmap( QTreeWidgetItem *item )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *parent = item->parent();
|
QTreeWidgetItem *parent = item->parent();
|
||||||
if ( !parent )
|
if ( !parent )
|
||||||
{
|
{
|
||||||
return QImage();
|
return QImage();
|
||||||
}
|
}
|
||||||
@ -3270,7 +3271,7 @@ QImage QgsLegend::getWmsLegendPixmap( QTreeWidgetItem *item )
|
|||||||
{
|
{
|
||||||
return QImage();
|
return QImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return rasterLayer->dataProvider()->getLegendGraphic( canvas()->scale() );
|
return rasterLayer->dataProvider()->getLegendGraphic( canvas()->scale() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,9 +591,9 @@ class QgsLegend : public QTreeWidget
|
|||||||
bool verifyDrawingOrder();
|
bool verifyDrawingOrder();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Check if current LegendItem belogs to a WMS layer
|
* Check if current LegendItem belongs to a WMS layer
|
||||||
* @param item LegendItem to check if belongs to a WMS layer
|
* @param item LegendItem to check if belongs to a WMS layer
|
||||||
* @return QImage A valid Legend image if belogs to WMS otherwise QImage()
|
* @return QImage A valid Legend image if belongs to WMS otherwise QImage()
|
||||||
*/
|
*/
|
||||||
QImage getWmsLegendPixmap( QTreeWidgetItem *item );
|
QImage getWmsLegendPixmap( QTreeWidgetItem *item );
|
||||||
|
|
||||||
|
@ -209,8 +209,8 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
|
|||||||
itemList.reserve( rasterItemList.size() );
|
itemList.reserve( rasterItemList.size() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GetLegendGraphics in case of WMS service... pixmap can return null if GetLegendGraphics
|
// GetLegendGraphics in case of WMS service... pixmap can return null if GetLegendGraphics
|
||||||
// is not supported by server
|
// is not supported by the server
|
||||||
QgsDebugMsg( QString( "layer providertype:: %1" ).arg( layer->providerType() ) );
|
QgsDebugMsg( QString( "layer providertype:: %1" ).arg( layer->providerType() ) );
|
||||||
if ( layer->providerType() == "wms" )
|
if ( layer->providerType() == "wms" )
|
||||||
{
|
{
|
||||||
@ -219,12 +219,12 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
|
|||||||
QImage legendGraphic = layer->dataProvider()->getLegendGraphic( currentScale );
|
QImage legendGraphic = layer->dataProvider()->getLegendGraphic( currentScale );
|
||||||
if ( !legendGraphic.isNull() )
|
if ( !legendGraphic.isNull() )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( QString( "downloaded legend with dimension Width:" )+QString::number(legendGraphic.width())+QString(" and Height:")+QString::number(legendGraphic.height()) );
|
QgsDebugMsg( QString( "downloaded legend with dimension width:" ) + QString::number( legendGraphic.width() ) + QString( " and Height:" ) + QString::number( legendGraphic.height() ) );
|
||||||
|
|
||||||
#if QT_VERSION >= 0x40700
|
#if QT_VERSION >= 0x40700
|
||||||
if ( rasterItemList.size() == 0) itemList.reserve( 1 );
|
if ( rasterItemList.size() == 0 ) itemList.reserve( 1 );
|
||||||
#endif
|
#endif
|
||||||
itemList.append( qMakePair( QString(""), QPixmap::fromImage(legendGraphic) ) );
|
itemList.append( qMakePair( QString( "" ), QPixmap::fromImage( legendGraphic ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8902,7 +8902,7 @@ void QgisApp::keyReleaseEvent( QKeyEvent *event )
|
|||||||
case QMessageBox::No:
|
case QMessageBox::No:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event->setAccepted( accepted ); // dont't close my Top Level Widget !
|
event->setAccepted( accepted ); // don't close my Top Level Widget !
|
||||||
accepted = false;// close the app next time when the user press back button
|
accepted = false;// close the app next time when the user press back button
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class APP_EXPORT QgsClipboard : public QObject
|
|||||||
const QgsFields &fields() { return mFeatureFields; }
|
const QgsFields &fields() { return mFeatureFields; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/** Emited when content changed */
|
/** Emitted when content changed */
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -40,7 +40,7 @@ class QgsGuiVectorLayerTools : public QgsVectorLayerTools, public QObject
|
|||||||
bool addFeature( QgsVectorLayer *layer, QgsAttributeMap defaultValues, const QgsGeometry &defaultGeometry );
|
bool addFeature( QgsVectorLayer *layer, QgsAttributeMap defaultValues, const QgsGeometry &defaultGeometry );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be called, whenever a vector layer should be switched to edit mode. If succesful
|
* This should be called, whenever a vector layer should be switched to edit mode. If successful
|
||||||
* the layer is switched to editable and an edit sessions started.
|
* the layer is switched to editable and an edit sessions started.
|
||||||
*
|
*
|
||||||
* @param layer The layer on which to start an edit session
|
* @param layer The layer on which to start an edit session
|
||||||
|
@ -43,7 +43,7 @@ QgsLabelEngineConfigDialog::QgsLabelEngineConfigDialog( QgsPalLabeling* lbl, QWi
|
|||||||
mShadowDebugRectChkBox->setChecked( mLBL->isShowingShadowRectangles() );
|
mShadowDebugRectChkBox->setChecked( mLBL->isShowingShadowRectangles() );
|
||||||
|
|
||||||
mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );
|
mSaveWithProjectChkBox->setChecked( mLBL->isStoredWithProject() );
|
||||||
|
|
||||||
chkShowPartialsLabels->setChecked( mLBL-> isShowingPartialsLabels() );
|
chkShowPartialsLabels->setChecked( mLBL-> isShowingPartialsLabels() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
|
|||||||
cmbLegendDoubleClickAction->setCurrentIndex( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() );
|
cmbLegendDoubleClickAction->setCurrentIndex( settings.value( "/qgis/legendDoubleClickAction", 0 ).toInt() );
|
||||||
|
|
||||||
// WMS getLegendGraphic setting
|
// WMS getLegendGraphic setting
|
||||||
mLegendGraphicResolutionSpinBox->setValue( settings.value("/qgis/defaultLegendGraphicResolution", 0).toInt() );
|
mLegendGraphicResolutionSpinBox->setValue( settings.value( "/qgis/defaultLegendGraphicResolution", 0 ).toInt() );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Raster properties
|
// Raster properties
|
||||||
|
@ -363,10 +363,10 @@ QgsComposerLegend::Nucleon QgsComposerLegend::drawSymbolItem( QgsComposerLegendI
|
|||||||
if ( maxWidth < size.width() ) maxWidth = size.width();
|
if ( maxWidth < size.width() ) maxWidth = size.width();
|
||||||
if ( maxHeight < size.height() ) maxHeight = size.height();
|
if ( maxHeight < size.height() ) maxHeight = size.height();
|
||||||
}
|
}
|
||||||
QSize maxSize(maxWidth, maxHeight);
|
QSize maxSize( maxWidth, maxHeight );
|
||||||
|
|
||||||
// get and print legend
|
// get and print legend
|
||||||
QImage legend = symbolIcon.pixmap(maxWidth, maxHeight).toImage();
|
QImage legend = symbolIcon.pixmap( maxWidth, maxHeight ).toImage();
|
||||||
if ( painter )
|
if ( painter )
|
||||||
{
|
{
|
||||||
painter->drawImage( QRectF( point.x(), point.y(), mWmsLegendWidth, mWmsLegendHeight ), legend, QRectF( 0, 0, maxWidth, maxHeight ) );
|
painter->drawImage( QRectF( point.x(), point.y(), mWmsLegendWidth, mWmsLegendHeight ), legend, QRectF( 0, 0, maxWidth, maxHeight ) );
|
||||||
|
@ -233,29 +233,29 @@ int QgsLegendModel::addRasterLayerItems( QStandardItem* layerItem, QgsMapLayer*
|
|||||||
if ( rasterLayer->providerType() == "wms" )
|
if ( rasterLayer->providerType() == "wms" )
|
||||||
{
|
{
|
||||||
QgsComposerRasterSymbolItem* currentSymbolItem = new QgsComposerRasterSymbolItem( "" );
|
QgsComposerRasterSymbolItem* currentSymbolItem = new QgsComposerRasterSymbolItem( "" );
|
||||||
// GetLegendGraphics in case of WMS service... image can return null if GetLegendGraphics
|
// GetLegendGraphics in case of WMS service... image can return null if GetLegendGraphics
|
||||||
// is not supported by server
|
// is not supported by the server
|
||||||
// double currentScale = legend()->canvas()->scale();
|
// double currentScale = legend()->canvas()->scale();
|
||||||
// BEAWARE getLegendGraphic() COULD BE USED WITHOUT SCALE PARAMETER IF IT WAS ALREADY CALLED WITH
|
// BEWARE getLegendGraphic() COULD BE USED WITHOUT SCALE PARAMETER IF IT WAS ALREADY CALLED WITH
|
||||||
// THIS PARAMER FROM A COMPONENT THAT CAN RECOVER CURRENT SCALE => LEGEND IN THE DESKTOP
|
// THIS PARAMETER FROM A COMPONENT THAT CAN RECOVER CURRENT SCALE => LEGEND IN THE DESKTOP
|
||||||
// OTHERWISE IT RETURN A INVALID PIXMAP (QPixmap().isNull() == False)
|
// OTHERWISE IT RETURN A INVALID PIXMAP (QPixmap().isNull() == False)
|
||||||
QImage legendGraphic = rasterLayer->dataProvider()->getLegendGraphic();
|
QImage legendGraphic = rasterLayer->dataProvider()->getLegendGraphic();
|
||||||
if ( !legendGraphic.isNull() )
|
if ( !legendGraphic.isNull() )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( QString( "downloaded legend with dimension Width:" )+QString::number(legendGraphic.width())+QString(" and Height:")+QString::number(legendGraphic.height()) );
|
QgsDebugMsg( QString( "downloaded legend with dimension width:" ) + QString::number( legendGraphic.width() ) + QString( " and Height:" ) + QString::number( legendGraphic.height() ) );
|
||||||
if ( mHasTopLevelWindow )
|
if ( mHasTopLevelWindow )
|
||||||
{
|
{
|
||||||
currentSymbolItem->setIcon( QIcon( QPixmap::fromImage(legendGraphic) ) );
|
currentSymbolItem->setIcon( QIcon( QPixmap::fromImage( legendGraphic ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentSymbolItem->setText(tr("No Legend Available"));
|
currentSymbolItem->setText( tr( "No Legend Available" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSymbolItem->setLayerID( rasterLayer->id() );
|
currentSymbolItem->setLayerID( rasterLayer->id() );
|
||||||
currentSymbolItem->setColor( QColor() );
|
currentSymbolItem->setColor( QColor() );
|
||||||
layerItem->removeRows(0, layerItem->rowCount());
|
layerItem->removeRows( 0, layerItem->rowCount() );
|
||||||
layerItem->setChild( layerItem->rowCount(), 0, currentSymbolItem );
|
layerItem->setChild( layerItem->rowCount(), 0, currentSymbolItem );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -97,7 +97,7 @@ class CORE_EXPORT QgsLegendModel: public QStandardItemModel
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void removeLayer( const QString& layerId );
|
void removeLayer( const QString& layerId );
|
||||||
void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1, QString rule="" );
|
void addLayer( QgsMapLayer* theMapLayer, double scaleDenominator = -1, QString rule = "" );
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void layersChanged();
|
void layersChanged();
|
||||||
|
@ -184,7 +184,7 @@ namespace pal
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LabelPosition::isIntersect( double *bbox )
|
bool LabelPosition::isIntersect( double *bbox )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -201,13 +201,13 @@ namespace pal
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LabelPosition::isInside( double *bbox )
|
bool LabelPosition::isInside( double *bbox )
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++ )
|
for ( int i = 0; i < 4; i++ )
|
||||||
{
|
{
|
||||||
if ( !( x[i] >= bbox[0] && x[i] <= bbox[2] &&
|
if ( !( x[i] >= bbox[0] && x[i] <= bbox[2] &&
|
||||||
y[i] >= bbox[1] && y[i] <= bbox[3] ) )
|
y[i] >= bbox[1] && y[i] <= bbox[3] ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ namespace pal
|
|||||||
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
|
*\param bbox the bounding-box double[4] = {xmin, ymin, xmax, ymax}
|
||||||
*/
|
*/
|
||||||
bool isIntersect( double *bbox );
|
bool isIntersect( double *bbox );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Is the labelposition inside the bounding-box ?
|
* \brief Is the labelposition inside the bounding-box ?
|
||||||
*
|
*
|
||||||
|
@ -106,9 +106,9 @@ namespace pal
|
|||||||
point_p = 8;
|
point_p = 8;
|
||||||
line_p = 8;
|
line_p = 8;
|
||||||
poly_p = 8;
|
poly_p = 8;
|
||||||
|
|
||||||
showPartial = true;
|
showPartial = true;
|
||||||
|
|
||||||
this->map_unit = pal::METER;
|
this->map_unit = pal::METER;
|
||||||
|
|
||||||
std::cout.precision( 12 );
|
std::cout.precision( 12 );
|
||||||
@ -901,8 +901,8 @@ namespace pal
|
|||||||
if ( dpi > 0 )
|
if ( dpi > 0 )
|
||||||
this->dpi = dpi;
|
this->dpi = dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pal::setShowPartial(bool show)
|
void Pal::setShowPartial( bool show )
|
||||||
{
|
{
|
||||||
this->showPartial = show;
|
this->showPartial = show;
|
||||||
}
|
}
|
||||||
@ -936,7 +936,7 @@ namespace pal
|
|||||||
{
|
{
|
||||||
return dpi;
|
return dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pal::getShowPartial()
|
bool Pal::getShowPartial()
|
||||||
{
|
{
|
||||||
return showPartial;
|
return showPartial;
|
||||||
|
@ -166,7 +166,7 @@ namespace pal
|
|||||||
int ejChainDeg;
|
int ejChainDeg;
|
||||||
int tenure;
|
int tenure;
|
||||||
double candListSize;
|
double candListSize;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief show partial labels (cut-off by the map canvas) or not
|
* \brief show partial labels (cut-off by the map canvas) or not
|
||||||
*/
|
*/
|
||||||
@ -357,14 +357,14 @@ namespace pal
|
|||||||
* @return map resolution (dot per inch)
|
* @return map resolution (dot per inch)
|
||||||
*/
|
*/
|
||||||
int getDpi();
|
int getDpi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*\brief Set flag show partial label
|
*\brief Set flag show partial label
|
||||||
*
|
*
|
||||||
* @param show flag value
|
* @param show flag value
|
||||||
*/
|
*/
|
||||||
void setShowPartial(bool show);
|
void setShowPartial( bool show );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get flag show partial label
|
* \brief Get flag show partial label
|
||||||
*
|
*
|
||||||
|
@ -4816,7 +4816,7 @@ void QgsPalLabeling::loadEngineSettings()
|
|||||||
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
|
mShowingAllLabels = QgsProject::instance()->readBoolEntry(
|
||||||
"PAL", "/ShowingAllLabels", false, &saved );
|
"PAL", "/ShowingAllLabels", false, &saved );
|
||||||
mShowingPartialsLabels = QgsProject::instance()->readBoolEntry(
|
mShowingPartialsLabels = QgsProject::instance()->readBoolEntry(
|
||||||
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
|
"PAL", "/ShowingPartialsLabels", p.getShowPartial(), &saved );
|
||||||
mSavedWithProject = saved;
|
mSavedWithProject = saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4852,6 +4852,6 @@ QgsLabelingEngineInterface* QgsPalLabeling::clone()
|
|||||||
lbl->mShowingAllLabels = mShowingAllLabels;
|
lbl->mShowingAllLabels = mShowingAllLabels;
|
||||||
lbl->mShowingCandidates = mShowingCandidates;
|
lbl->mShowingCandidates = mShowingCandidates;
|
||||||
lbl->mShowingShadowRects = mShowingShadowRects;
|
lbl->mShowingShadowRects = mShowingShadowRects;
|
||||||
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
|
lbl->mShowingPartialsLabels = mShowingPartialsLabels;
|
||||||
return lbl;
|
return lbl;
|
||||||
}
|
}
|
||||||
|
@ -687,7 +687,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
|
|||||||
|
|
||||||
bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
|
bool isShowingPartialsLabels() const { return mShowingPartialsLabels; }
|
||||||
void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
|
void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels = showing; }
|
||||||
|
|
||||||
// implemented methods from labeling engine interface
|
// implemented methods from labeling engine interface
|
||||||
|
|
||||||
//! called when we're going to start with rendering
|
//! called when we're going to start with rendering
|
||||||
|
@ -189,7 +189,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
|
|||||||
|
|
||||||
/** \brief Returns the legend rendered as pixmap
|
/** \brief Returns the legend rendered as pixmap
|
||||||
* useful for that layer that need to get legend layer remotly as WMS */
|
* useful for that layer that need to get legend layer remotly as WMS */
|
||||||
virtual QImage getLegendGraphic( double scale=0, bool forceRefresh = false )
|
virtual QImage getLegendGraphic( double scale = 0, bool forceRefresh = false )
|
||||||
{
|
{
|
||||||
Q_UNUSED( scale );
|
Q_UNUSED( scale );
|
||||||
Q_UNUSED( forceRefresh );
|
Q_UNUSED( forceRefresh );
|
||||||
|
@ -184,7 +184,8 @@ QgsLegendSymbolList QgsRuleBasedRendererV2::Rule::legendSymbolItems( double scal
|
|||||||
for ( RuleList::iterator it = mChildren.begin(); it != mChildren.end(); ++it )
|
for ( RuleList::iterator it = mChildren.begin(); it != mChildren.end(); ++it )
|
||||||
{
|
{
|
||||||
Rule* rule = *it;
|
Rule* rule = *it;
|
||||||
if ( scaleDenominator == -1 || rule->isScaleOK(scaleDenominator) ) {
|
if ( scaleDenominator == -1 || rule->isScaleOK( scaleDenominator ) )
|
||||||
|
{
|
||||||
lst << rule->legendSymbolItems( scaleDenominator, ruleFilter );
|
lst << rule->legendSymbolItems( scaleDenominator, ruleFilter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ void QgsComposerView::endMarqueeSelect( QMouseEvent* e )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QRectF boundsRect = QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(),
|
QRectF boundsRect = QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(),
|
||||||
mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
|
mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
|
||||||
|
|
||||||
//determine item selection mode, default to intersection
|
//determine item selection mode, default to intersection
|
||||||
Qt::ItemSelectionMode selectionMode = Qt::IntersectsItemShape;
|
Qt::ItemSelectionMode selectionMode = Qt::IntersectsItemShape;
|
||||||
|
@ -3661,7 +3661,7 @@ void QgsProjectParser::loadLabelSettings( QgsLabelingEngineInterface* lbl )
|
|||||||
{
|
{
|
||||||
pal->setShowingAllLabels( showAllLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 );
|
pal->setShowingAllLabels( showAllLabelsElem.text().compare( "true", Qt::CaseInsensitive ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//mShowingPartialsLabels
|
//mShowingPartialsLabels
|
||||||
QDomElement showPartialsLabelsElem = palElem.firstChildElement( "ShowingPartialsLabels" );
|
QDomElement showPartialsLabelsElem = palElem.firstChildElement( "ShowingPartialsLabels" );
|
||||||
if ( !showPartialsLabelsElem.isNull() )
|
if ( !showPartialsLabelsElem.isNull() )
|
||||||
|
@ -390,7 +390,8 @@ QImage* QgsWMSServer::getLegendGraphics()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !rule.isEmpty() ) {
|
if ( !rule.isEmpty() )
|
||||||
|
{
|
||||||
//create second image with the right dimensions
|
//create second image with the right dimensions
|
||||||
QImage* paintImage = createImage( symbolWidth, symbolHeight );
|
QImage* paintImage = createImage( symbolWidth, symbolHeight );
|
||||||
|
|
||||||
@ -399,7 +400,8 @@ QImage* QgsWMSServer::getLegendGraphics()
|
|||||||
p.setRenderHint( QPainter::Antialiasing, true );
|
p.setRenderHint( QPainter::Antialiasing, true );
|
||||||
|
|
||||||
QgsComposerLegendItem* currentComposerItem = dynamic_cast<QgsComposerLegendItem*>( rootItem->child( 0 )->child( 0 ) );
|
QgsComposerLegendItem* currentComposerItem = dynamic_cast<QgsComposerLegendItem*>( rootItem->child( 0 )->child( 0 ) );
|
||||||
if ( currentComposerItem != NULL ) {
|
if ( currentComposerItem != NULL )
|
||||||
|
{
|
||||||
QgsComposerLegendItem::ItemType type = currentComposerItem->itemType();
|
QgsComposerLegendItem::ItemType type = currentComposerItem->itemType();
|
||||||
switch ( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
|
@ -4001,7 +4001,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs
|
|||||||
if ( !myExtent.isEmpty() )
|
if ( !myExtent.isEmpty() )
|
||||||
{
|
{
|
||||||
// we cannot reliably identify WMS if theExtent is specified but theWidth or theHeight
|
// we cannot reliably identify WMS if theExtent is specified but theWidth or theHeight
|
||||||
// are not, because we dont know original resolution
|
// are not, because we don't know original resolution
|
||||||
if ( theWidth == 0 || theHeight == 0 )
|
if ( theWidth == 0 || theHeight == 0 )
|
||||||
{
|
{
|
||||||
return QgsRasterIdentifyResult( ERROR( tr( "Context not fully specified (extent was defined but width and/or height was not)." ) ) );
|
return QgsRasterIdentifyResult( ERROR( tr( "Context not fully specified (extent was defined but width and/or height was not)." ) ) );
|
||||||
@ -4600,7 +4600,7 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
|
|||||||
// the layer tags inside capabilities
|
// the layer tags inside capabilities
|
||||||
QgsDebugMsg( "entering." );
|
QgsDebugMsg( "entering." );
|
||||||
|
|
||||||
if ( !scale && !mGetLegendGraphicScale)
|
if ( !scale && !mGetLegendGraphicScale )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( QString( "No scale factor set" ) );
|
QgsDebugMsg( QString( "No scale factor set" ) );
|
||||||
return QImage();
|
return QImage();
|
||||||
@ -4611,7 +4611,7 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
|
|||||||
forceRefresh = true;
|
forceRefresh = true;
|
||||||
QgsDebugMsg( QString( "Download again due to scale change from: %1 to: %2" ).arg( mGetLegendGraphicScale ).arg( scale ) );
|
QgsDebugMsg( QString( "Download again due to scale change from: %1 to: %2" ).arg( mGetLegendGraphicScale ).arg( scale ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( forceRefresh )
|
if ( forceRefresh )
|
||||||
{
|
{
|
||||||
if ( scale )
|
if ( scale )
|
||||||
@ -4620,42 +4620,45 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if style is not defined, set as "default"
|
// if style is not defined, set as "default"
|
||||||
QString currentStyle("default");
|
QString currentStyle( "default" );
|
||||||
if ( mActiveSubStyles[0] != "" )
|
if ( mActiveSubStyles[0] != "" )
|
||||||
{
|
{
|
||||||
currentStyle = mActiveSubStyles[0];
|
currentStyle = mActiveSubStyles[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// add WMS GetGraphicLegend request
|
// add WMS GetGraphicLegend request
|
||||||
// TODO set sld version using instance var something like mSldVersion
|
// TODO set sld version using instance var something like mSldVersion
|
||||||
// TODO at this moment LSD version can be get from LegendURL in getCapability,but parsing of
|
// TODO at this moment LSD version can be get from LegendURL in getCapability,but parsing of
|
||||||
// this tag is not complete. Below the code that should work if pasing whould correct
|
// this tag is not complete. Below the code that should work if parsing would correct
|
||||||
// if ( mActiveSubLayers[0] == mCapabilities.capability.layer.name )
|
|
||||||
// {
|
if ( mActiveSubLayers[0] == mCapabilities.capability.layer.name )
|
||||||
// foreach( QgsWmsStyleProperty style, mCapabilities.capability.layer.style )
|
{
|
||||||
// {
|
foreach ( QgsWmsStyleProperty style, mCapabilities.capability.layer.style )
|
||||||
// if ( currentStyle == style.name )
|
{
|
||||||
// {
|
if ( currentStyle == style.name )
|
||||||
// url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
|
{
|
||||||
// }
|
url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
|
||||||
// }
|
}
|
||||||
// } // is a sublayer
|
}
|
||||||
// else if ( mActiveSubLayers[0].contains( mCapabilities.capability.layer.name ) )
|
} // is a sublayer
|
||||||
// {
|
else if ( mActiveSubLayers[0].contains( mCapabilities.capability.layer.name ) )
|
||||||
// foreach( QgsWmsLayerProperty layerProperty, mCapabilities.capability.layer.layer )
|
{
|
||||||
// {
|
foreach ( QgsWmsLayerProperty layerProperty, mCapabilities.capability.layer.layer )
|
||||||
// if ( mActiveSubLayers[0] == layerProperty.name )
|
{
|
||||||
// {
|
if ( mActiveSubLayers[0] == layerProperty.name )
|
||||||
// foreach( QgsWmsStyleProperty style, layerProperty.style )
|
{
|
||||||
// {
|
foreach ( QgsWmsStyleProperty style, layerProperty.style )
|
||||||
// if ( currentStyle == style.name )
|
{
|
||||||
// {
|
if ( currentStyle == style.name )
|
||||||
// url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
|
{
|
||||||
// }
|
url.setUrl( style.legendUrl[0].onlineResource.xlinkHref, QUrl::StrictMode );
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
QUrl url( mIgnoreGetMapUrl ? mBaseUrl : getMapUrl(), QUrl::StrictMode );
|
QUrl url( mIgnoreGetMapUrl ? mBaseUrl : getMapUrl(), QUrl::StrictMode );
|
||||||
setQueryItem( url, "SERVICE", "WMS" );
|
setQueryItem( url, "SERVICE", "WMS" );
|
||||||
setQueryItem( url, "VERSION", mCapabilities.version );
|
setQueryItem( url, "VERSION", mCapabilities.version );
|
||||||
@ -4663,24 +4666,26 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
|
|||||||
setQueryItem( url, "REQUEST", "GetLegendGraphic" );
|
setQueryItem( url, "REQUEST", "GetLegendGraphic" );
|
||||||
setQueryItem( url, "LAYER", mActiveSubLayers[0] );
|
setQueryItem( url, "LAYER", mActiveSubLayers[0] );
|
||||||
setQueryItem( url, "STYLE", currentStyle );
|
setQueryItem( url, "STYLE", currentStyle );
|
||||||
setQueryItem( url, "SCALE", QString::number( scale, 'f') );
|
setQueryItem( url, "SCALE", QString::number( scale, 'f' ) );
|
||||||
setQueryItem( url, "FORMAT", mImageMimeType );
|
setQueryItem( url, "FORMAT", mImageMimeType );
|
||||||
|
|
||||||
// add config parameter related to resolution
|
// add config parameter related to resolution
|
||||||
QSettings s;
|
QSettings s;
|
||||||
int defaultLegendGraphicResolution = s.value( "/qgis/defaultLegendGraphicResolution", 0 ).toInt();
|
int defaultLegendGraphicResolution = s.value( "/qgis/defaultLegendGraphicResolution", 0 ).toInt();
|
||||||
QgsDebugMsg( QString( "defaultLegendGraphicResolution: %1" ).arg( defaultLegendGraphicResolution ) );
|
QgsDebugMsg( QString( "defaultLegendGraphicResolution: %1" ).arg( defaultLegendGraphicResolution ) );
|
||||||
if ( defaultLegendGraphicResolution ) {
|
if ( defaultLegendGraphicResolution )
|
||||||
if (url.queryItemValue("map_resolution") != "")
|
{
|
||||||
|
if ( url.queryItemValue( "map_resolution" ) != "" )
|
||||||
{
|
{
|
||||||
setQueryItem( url, "map_resolution", QString::number(defaultLegendGraphicResolution) );
|
setQueryItem( url, "map_resolution", QString::number( defaultLegendGraphicResolution ) );
|
||||||
}
|
}
|
||||||
else if (url.queryItemValue("dpi") != "")
|
else if ( url.queryItemValue( "dpi" ) != "" )
|
||||||
{
|
{
|
||||||
setQueryItem( url, "dpi", QString::number(defaultLegendGraphicResolution) );
|
setQueryItem( url, "dpi", QString::number( defaultLegendGraphicResolution ) );
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
QgsLogger::warning(tr("getLegendGraphic: Can not determine resolution uri parameter [map_resolution | dpi]. No resolution parameter will be used"));
|
{
|
||||||
|
QgsLogger::warning( tr( "getLegendGraphic: Can not determine resolution uri parameter [map_resolution | dpi]. No resolution parameter will be used" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4709,7 +4714,7 @@ QImage QgsWmsProvider::getLegendGraphic( double scale, bool forceRefresh )
|
|||||||
|
|
||||||
QgsDebugMsg( "exiting." );
|
QgsDebugMsg( "exiting." );
|
||||||
|
|
||||||
return mGetLegendGraphicImage;
|
return mGetLegendGraphicImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsWmsProvider::getLegendGraphicReplyFinished()
|
void QgsWmsProvider::getLegendGraphicReplyFinished()
|
||||||
@ -4761,7 +4766,7 @@ void QgsWmsProvider::getLegendGraphicReplyFinished()
|
|||||||
if ( myLocalImage.isNull() )
|
if ( myLocalImage.isNull() )
|
||||||
{
|
{
|
||||||
QgsMessageLog::logMessage( tr( "Returned legend image is flawed [URL: %2]" )
|
QgsMessageLog::logMessage( tr( "Returned legend image is flawed [URL: %2]" )
|
||||||
.arg( mGetLegendGraphicReply->url().toString() ), tr( "WMS" ) );
|
.arg( mGetLegendGraphicReply->url().toString() ), tr( "WMS" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4769,8 +4774,8 @@ void QgsWmsProvider::getLegendGraphicReplyFinished()
|
|||||||
|
|
||||||
#ifdef QGISDEBUG
|
#ifdef QGISDEBUG
|
||||||
QString filename = QDir::tempPath() + "/GetLegendGraphic.png";
|
QString filename = QDir::tempPath() + "/GetLegendGraphic.png";
|
||||||
mGetLegendGraphicImage.save(filename);
|
mGetLegendGraphicImage.save( filename );
|
||||||
QgsDebugMsg( "saved GetLegendGraphic result in debug ile: "+filename );
|
QgsDebugMsg( "saved GetLegendGraphic result in debug ile: " + filename );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,15 +650,15 @@ class QgsWmsProvider : public QgsRasterDataProvider
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get GetLegendGraphic if service available otherwise QImage()
|
* \brief Get GetLegendGraphic if service available otherwise QImage()
|
||||||
* BEAWARE call it the first time specifying scale parameter otherwise it always return QImage()
|
* BEWARE call it the first time specifying scale parameter otherwise it always return QImage()
|
||||||
* \todo some services dowsn't expose getLegendGraphic in capabilities but adding LegendURL in
|
* \todo some services doesn't expose getLegendGraphic in capabilities but adds LegendURL in
|
||||||
* the layer tags inside capabilities, but LegendURL parsing is still not developed => getLegendGraphic is
|
* the layer tags inside capabilities, but LegendURL parsing is still not developed => getLegendGraphic is
|
||||||
* always called assuming that error means service is not available. Other drowback is that SLD_VERSION
|
* always called assuming that error means service is not available. Other drawback is that SLD_VERSION
|
||||||
* is inside LegendURL, so at this moment it is fixed to 1.1.0 waiting a correct parsing of LegendURL
|
* is inside LegendURL, so at this moment it is fixed to 1.1.0 waiting a correct parsing of LegendURL
|
||||||
* in getCapability
|
* in getCapability
|
||||||
* \param scale Optional parameter that is the Scale of the wms layer
|
* \param scale Optional parameter that is the Scale of the wms layer
|
||||||
* \param forceRefresh Optional bool parameter to force refresh getLegendGraphic call
|
* \param forceRefresh Optional bool parameter to force refresh getLegendGraphic call
|
||||||
*/
|
*/
|
||||||
QImage getLegendGraphic( double scale = 0, bool forceRefresh = false );
|
QImage getLegendGraphic( double scale = 0, bool forceRefresh = false );
|
||||||
|
|
||||||
|
@ -31,15 +31,15 @@
|
|||||||
class TestSignalReceiver : public QObject
|
class TestSignalReceiver : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TestSignalReceiver() : QObject( 0 ), blendMode( QPainter::CompositionMode_SourceOver ) {}
|
TestSignalReceiver() : QObject( 0 ), blendMode( QPainter::CompositionMode_SourceOver ) {}
|
||||||
QPainter::CompositionMode blendMode;
|
QPainter::CompositionMode blendMode;
|
||||||
public slots:
|
public slots:
|
||||||
void onBlendModeChanged( const QPainter::CompositionMode blendMode )
|
void onBlendModeChanged( const QPainter::CompositionMode blendMode )
|
||||||
{
|
{
|
||||||
this->blendMode = blendMode;
|
this->blendMode = blendMode;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \ingroup UnitTests
|
/** \ingroup UnitTests
|
||||||
@ -55,7 +55,7 @@ class TestQgsMapLayer: public QObject
|
|||||||
void cleanup() {};// will be called after every testfunction.
|
void cleanup() {};// will be called after every testfunction.
|
||||||
|
|
||||||
void isValid();
|
void isValid();
|
||||||
|
|
||||||
void setBlendMode();
|
void setBlendMode();
|
||||||
private:
|
private:
|
||||||
QgsMapLayer * mpLayer;
|
QgsMapLayer * mpLayer;
|
||||||
@ -90,7 +90,7 @@ void TestQgsMapLayer::setBlendMode()
|
|||||||
TestSignalReceiver receiver;
|
TestSignalReceiver receiver;
|
||||||
QObject::connect( mpLayer, SIGNAL( blendModeChanged( const QPainter::CompositionMode ) ),
|
QObject::connect( mpLayer, SIGNAL( blendModeChanged( const QPainter::CompositionMode ) ),
|
||||||
&receiver, SLOT( onBlendModeChanged( const QPainter::CompositionMode ) ) );
|
&receiver, SLOT( onBlendModeChanged( const QPainter::CompositionMode ) ) );
|
||||||
QCOMPARE( int(receiver.blendMode), 0 );
|
QCOMPARE( int( receiver.blendMode ), 0 );
|
||||||
mpLayer->setBlendMode( QPainter::CompositionMode_Screen );
|
mpLayer->setBlendMode( QPainter::CompositionMode_Screen );
|
||||||
// check the signal has been correctly emitted
|
// check the signal has been correctly emitted
|
||||||
QCOMPARE( receiver.blendMode, QPainter::CompositionMode_Screen );
|
QCOMPARE( receiver.blendMode, QPainter::CompositionMode_Screen );
|
||||||
|
@ -89,17 +89,17 @@ class TestQgsRasterLayer: public QObject
|
|||||||
class TestSignalReceiver : public QObject
|
class TestSignalReceiver : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TestSignalReceiver() : QObject( 0 ),
|
TestSignalReceiver() : QObject( 0 ),
|
||||||
rendererChanged( false )
|
rendererChanged( false )
|
||||||
{}
|
{}
|
||||||
bool rendererChanged;
|
bool rendererChanged;
|
||||||
public slots:
|
public slots:
|
||||||
void onRendererChanged()
|
void onRendererChanged()
|
||||||
{
|
{
|
||||||
rendererChanged = true;
|
rendererChanged = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//runs before all tests
|
//runs before all tests
|
||||||
@ -502,7 +502,7 @@ void TestQgsRasterLayer::setRenderer()
|
|||||||
TestSignalReceiver receiver;
|
TestSignalReceiver receiver;
|
||||||
QObject::connect( mpRasterLayer, SIGNAL( rendererChanged() ),
|
QObject::connect( mpRasterLayer, SIGNAL( rendererChanged() ),
|
||||||
&receiver, SLOT( onRendererChanged() ) );
|
&receiver, SLOT( onRendererChanged() ) );
|
||||||
QgsRasterRenderer* renderer = (QgsRasterRenderer*) mpRasterLayer->renderer()->clone();
|
QgsRasterRenderer* renderer = ( QgsRasterRenderer* ) mpRasterLayer->renderer()->clone();
|
||||||
QCOMPARE( receiver.rendererChanged, false );
|
QCOMPARE( receiver.rendererChanged, false );
|
||||||
mpRasterLayer->setRenderer( renderer );
|
mpRasterLayer->setRenderer( renderer );
|
||||||
QCOMPARE( receiver.rendererChanged, true );
|
QCOMPARE( receiver.rendererChanged, true );
|
||||||
|
@ -39,29 +39,29 @@
|
|||||||
class TestSignalReceiver : public QObject
|
class TestSignalReceiver : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TestSignalReceiver() : QObject( 0 ),
|
TestSignalReceiver() : QObject( 0 ),
|
||||||
rendererChanged( false ),
|
rendererChanged( false ),
|
||||||
featureBlendMode( QPainter::CompositionMode(0) ),
|
featureBlendMode( QPainter::CompositionMode( 0 ) ),
|
||||||
transparency( 0 )
|
transparency( 0 )
|
||||||
{}
|
{}
|
||||||
bool rendererChanged;
|
bool rendererChanged;
|
||||||
QPainter::CompositionMode featureBlendMode;
|
QPainter::CompositionMode featureBlendMode;
|
||||||
int transparency;
|
int transparency;
|
||||||
public slots:
|
public slots:
|
||||||
void onRendererChanged()
|
void onRendererChanged()
|
||||||
{
|
{
|
||||||
rendererChanged = true;
|
rendererChanged = true;
|
||||||
}
|
}
|
||||||
void onFeatureBlendModeChanged( const QPainter::CompositionMode blendMode )
|
void onFeatureBlendModeChanged( const QPainter::CompositionMode blendMode )
|
||||||
{
|
{
|
||||||
featureBlendMode = blendMode;
|
featureBlendMode = blendMode;
|
||||||
}
|
}
|
||||||
void onLayerTransparencyChanged( int layerTransparency )
|
void onLayerTransparencyChanged( int layerTransparency )
|
||||||
{
|
{
|
||||||
transparency = layerTransparency;
|
transparency = layerTransparency;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \ingroup UnitTests
|
/** \ingroup UnitTests
|
||||||
@ -676,21 +676,21 @@ class TestQgsVectorLayer: public QObject
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void QgsVectorLayersetFeatureBlendMode()
|
void QgsVectorLayersetFeatureBlendMode()
|
||||||
{
|
{
|
||||||
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );
|
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );
|
||||||
TestSignalReceiver receiver;
|
TestSignalReceiver receiver;
|
||||||
QObject::connect( vLayer, SIGNAL( featureBlendModeChanged( const QPainter::CompositionMode ) ),
|
QObject::connect( vLayer, SIGNAL( featureBlendModeChanged( const QPainter::CompositionMode ) ),
|
||||||
&receiver, SLOT( onFeatureBlendModeChanged( const QPainter::CompositionMode ) ) );
|
&receiver, SLOT( onFeatureBlendModeChanged( const QPainter::CompositionMode ) ) );
|
||||||
|
|
||||||
QCOMPARE( int(receiver.featureBlendMode), 0 );
|
QCOMPARE( int( receiver.featureBlendMode ), 0 );
|
||||||
vLayer->setFeatureBlendMode( QPainter::CompositionMode_Screen );
|
vLayer->setFeatureBlendMode( QPainter::CompositionMode_Screen );
|
||||||
QCOMPARE( receiver.featureBlendMode, QPainter::CompositionMode_Screen );
|
QCOMPARE( receiver.featureBlendMode, QPainter::CompositionMode_Screen );
|
||||||
QCOMPARE( vLayer->featureBlendMode(), QPainter::CompositionMode_Screen );
|
QCOMPARE( vLayer->featureBlendMode(), QPainter::CompositionMode_Screen );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsVectorLayersetLayerTransparency()
|
void QgsVectorLayersetLayerTransparency()
|
||||||
{
|
{
|
||||||
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );
|
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );
|
||||||
TestSignalReceiver receiver;
|
TestSignalReceiver receiver;
|
||||||
QObject::connect( vLayer, SIGNAL( layerTransparencyChanged( int ) ),
|
QObject::connect( vLayer, SIGNAL( layerTransparencyChanged( int ) ),
|
||||||
@ -700,7 +700,7 @@ class TestQgsVectorLayer: public QObject
|
|||||||
vLayer->setLayerTransparency( 50 );
|
vLayer->setLayerTransparency( 50 );
|
||||||
QCOMPARE( receiver.transparency, 50 );
|
QCOMPARE( receiver.transparency, 50 );
|
||||||
QCOMPARE( vLayer->layerTransparency(), 50 );
|
QCOMPARE( vLayer->layerTransparency(), 50 );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
QTEST_MAIN( TestQgsVectorLayer )
|
QTEST_MAIN( TestQgsVectorLayer )
|
||||||
|
@ -206,7 +206,7 @@ class ServerConfigNotAccessibleError(Exception):
|
|||||||
port = 80 or a user-defined port above 1024
|
port = 80 or a user-defined port above 1024
|
||||||
fcgipath = path to working qgis_mapserv.fcgi as known by server
|
fcgipath = path to working qgis_mapserv.fcgi as known by server
|
||||||
sourceurl = DO NOT ADJUST
|
sourceurl = DO NOT ADJUST
|
||||||
projdir = path WRITEABLE by this user and READABLE by www server
|
projdir = path WRITABLE by this user and READABLE by www server
|
||||||
|
|
||||||
Sample configuration (default):
|
Sample configuration (default):
|
||||||
sourceurl (built) = http://localhost:80/cgi-bin/qgis_mapserv.fcgi
|
sourceurl (built) = http://localhost:80/cgi-bin/qgis_mapserv.fcgi
|
||||||
@ -340,7 +340,7 @@ def _checkItemReadable(item, path):
|
|||||||
|
|
||||||
|
|
||||||
def _checkItemWriteable(item, path):
|
def _checkItemWriteable(item, path):
|
||||||
msg = ('Server configuration {0} is not writeable from:\n'
|
msg = ('Server configuration {0} is not writable from:\n'
|
||||||
' {1}'.format(item, path))
|
' {1}'.format(item, path))
|
||||||
assert os.access(path, os.W_OK), msg
|
assert os.access(path, os.W_OK), msg
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ __all__ = ['WSGIServer']
|
|||||||
|
|
||||||
class WSGIServer(BaseAJPServer, ThreadedServer):
|
class WSGIServer(BaseAJPServer, ThreadedServer):
|
||||||
"""
|
"""
|
||||||
AJP1.3/WSGI server. Runs your WSGI application as a persistant program
|
AJP1.3/WSGI server. Runs your WSGI application as a persistent program
|
||||||
that understands AJP1.3. Opens up a TCP socket, binds it, and then
|
that understands AJP1.3. Opens up a TCP socket, binds it, and then
|
||||||
waits for forwarded requests from your webserver.
|
waits for forwarded requests from your webserver.
|
||||||
|
|
||||||
|
@ -299,24 +299,24 @@ class TestPALConfig(TestQgsPalLabeling):
|
|||||||
|
|
||||||
msg = '\nLayer settings read not same as settings written'
|
msg = '\nLayer settings read not same as settings written'
|
||||||
self.assertDictEqual(lyr1dict, lyr2dict, msg)
|
self.assertDictEqual(lyr1dict, lyr2dict, msg)
|
||||||
|
|
||||||
def test_default_partials_labels_enabled(self):
|
def test_default_partials_labels_enabled(self):
|
||||||
# Verify ShowingPartialsLabels is enabled for PAL by default
|
# Verify ShowingPartialsLabels is enabled for PAL by default
|
||||||
pal = QgsPalLabeling()
|
pal = QgsPalLabeling()
|
||||||
self.assertTrue(pal.isShowingPartialsLabels())
|
self.assertTrue(pal.isShowingPartialsLabels())
|
||||||
|
|
||||||
def test_partials_labels_activate(self):
|
def test_partials_labels_activate(self):
|
||||||
pal = QgsPalLabeling()
|
pal = QgsPalLabeling()
|
||||||
# Enable partials labels
|
# Enable partials labels
|
||||||
pal.setShowingPartialsLabels(True)
|
pal.setShowingPartialsLabels(True)
|
||||||
self.assertTrue(pal.isShowingPartialsLabels())
|
self.assertTrue(pal.isShowingPartialsLabels())
|
||||||
|
|
||||||
def test_partials_labels_deactivate(self):
|
def test_partials_labels_deactivate(self):
|
||||||
pal = QgsPalLabeling()
|
pal = QgsPalLabeling()
|
||||||
# Disable partials labels
|
# Disable partials labels
|
||||||
pal.setShowingPartialsLabels(False)
|
pal.setShowingPartialsLabels(False)
|
||||||
self.assertFalse(pal.isShowingPartialsLabels())
|
self.assertFalse(pal.isShowingPartialsLabels())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def runSuite(module, tests):
|
def runSuite(module, tests):
|
||||||
|
@ -51,7 +51,7 @@ class TestPointBase(object):
|
|||||||
# Label color change
|
# Label color change
|
||||||
self.lyr.textColor = Qt.blue
|
self.lyr.textColor = Qt.blue
|
||||||
self.checkTest()
|
self.checkTest()
|
||||||
|
|
||||||
def test_partials_labels_enabled(self):
|
def test_partials_labels_enabled(self):
|
||||||
# Set Big font size
|
# Set Big font size
|
||||||
font = QFont(self._TestFont)
|
font = QFont(self._TestFont)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user