mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
indentation update
This commit is contained in:
parent
470431d6b4
commit
5b2824f788
@ -6,11 +6,11 @@ from qgis.core import QgsApplication
|
||||
@contextmanager
|
||||
def qgisapp(args=None, guienabled=True, configpath=None, sysexit=True):
|
||||
"""
|
||||
Create a new QGIS Qt application.
|
||||
|
||||
Create a new QGIS Qt application.
|
||||
|
||||
You should use this before creating any Qt widgets or QGIS objects for
|
||||
your custom QGIS based application.
|
||||
|
||||
|
||||
usage:
|
||||
from qgis.core.contextmanagers import qgisapp
|
||||
|
||||
|
@ -29,18 +29,18 @@ It is copied on installation in /pythonX/dist-packages/PyQt4/uic/widget-plugins/
|
||||
# pluginType = CW_FILTER
|
||||
# def getFilter():
|
||||
# import qgis.gui
|
||||
#
|
||||
#
|
||||
# QGIS_widgets = {}
|
||||
# for pyClass in dir(qgis.gui):
|
||||
# QGIS_widgets[pyClass] = 'qgis.gui'
|
||||
#
|
||||
#
|
||||
# def _QGISfilter(widgetname, baseclassname, module):
|
||||
# print widgetname, baseclassname, module
|
||||
# if widgetname in QGIS_widgets:
|
||||
# return (MATCH, (widgetname, baseclassname, QGIS_widgets[widgetname]))
|
||||
# else:
|
||||
# return (NO_MATCH, None)
|
||||
#
|
||||
#
|
||||
# return _QGISfilter
|
||||
|
||||
|
||||
|
@ -100,14 +100,14 @@ class ImportIntoPostGIS(GeoAlgorithm):
|
||||
geomColumn = geomColumn.lower()
|
||||
if dropStringLength:
|
||||
options['dropStringConstraints'] = True
|
||||
|
||||
|
||||
uri = QgsDataSourceURI()
|
||||
uri.setConnection(host, str(port), database, username, password)
|
||||
if primaryKeyField:
|
||||
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)
|
||||
else:
|
||||
uri.setDataSource(schema, table, geomColumn, '')
|
||||
|
||||
|
||||
layerUri = self.getParameterValue(self.INPUT)
|
||||
layer = dataobjects.getObjectFromUri(layerUri)
|
||||
(ret, errMsg) = QgsVectorLayerImport.importLayer(
|
||||
|
@ -68,7 +68,7 @@ FORMATS = [
|
||||
'GPX',
|
||||
'PGDump',
|
||||
'GPSTrackMaker',
|
||||
'ODS',
|
||||
'ODS',
|
||||
'XLSX',
|
||||
'PDF',
|
||||
]
|
||||
|
@ -69,8 +69,8 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
FILTER_RETURN_CLASS_FLAGS1 = "FILTER_RETURN_CLASS_FLAGS1"
|
||||
FILTER_RETURN_CLASS_FLAGS2 = "FILTER_RETURN_CLASS_FLAGS2"
|
||||
FILTER_RETURN_CLASS_FLAGS3 = "FILTER_RETURN_CLASS_FLAGS3"
|
||||
FILTERS_RETURN_CLASS_FLAGS = ["---", "keep_last", "keep_first", "keep_middle", "keep_single", "drop_single",
|
||||
"keep_double", "keep_class 2", "keep_class 2 8", "keep_class 8", "keep_class 6",
|
||||
FILTERS_RETURN_CLASS_FLAGS = ["---", "keep_last", "keep_first", "keep_middle", "keep_single", "drop_single",
|
||||
"keep_double", "keep_class 2", "keep_class 2 8", "keep_class 8", "keep_class 6",
|
||||
"keep_class 9", "keep_class 3 4 5", "keep_class 2 6", "drop_class 7", "drop_withheld"]
|
||||
FILTER_COORDS_INTENSITY1 = "FILTER_COORDS_INTENSITY1"
|
||||
FILTER_COORDS_INTENSITY2 = "FILTER_COORDS_INTENSITY2"
|
||||
@ -78,11 +78,11 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
FILTER_COORDS_INTENSITY1_ARG = "FILTER_COORDS_INTENSITY1_ARG"
|
||||
FILTER_COORDS_INTENSITY2_ARG = "FILTER_COORDS_INTENSITY2_ARG"
|
||||
FILTER_COORDS_INTENSITY3_ARG = "FILTER_COORDS_INTENSITY3_ARG"
|
||||
FILTERS_COORDS_INTENSITY = ["---", "clip_x_above", "clip_x_below", "clip_y_above", "clip_y_below", "clip_z_above",
|
||||
"clip_z_below", "drop_intensity_above", "drop_intensity_below", "drop_gps_time_above",
|
||||
"drop_gps_time_below", "drop_scan_angle_above", "drop_scan_angle_below", "keep_point_source",
|
||||
"drop_point_source", "drop_point_source_above", "drop_point_source_below", "keep_user_data",
|
||||
"drop_user_data", "drop_user_data_above", "drop_user_data_below", "keep_every_nth",
|
||||
FILTERS_COORDS_INTENSITY = ["---", "clip_x_above", "clip_x_below", "clip_y_above", "clip_y_below", "clip_z_above",
|
||||
"clip_z_below", "drop_intensity_above", "drop_intensity_below", "drop_gps_time_above",
|
||||
"drop_gps_time_below", "drop_scan_angle_above", "drop_scan_angle_below", "keep_point_source",
|
||||
"drop_point_source", "drop_point_source_above", "drop_point_source_below", "keep_user_data",
|
||||
"drop_user_data", "drop_user_data_above", "drop_user_data_below", "keep_every_nth",
|
||||
"keep_random_fraction", "thin_with_grid" ]
|
||||
|
||||
TRANSFORM_COORDINATE1 = "TRANSFORM_COORDINATE1"
|
||||
@ -95,8 +95,8 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
TRANSFORM_OTHER2 = "TRANSFORM_OTHER2"
|
||||
TRANSFORM_OTHER1_ARG = "TRANSFORM_OTHER1_ARG"
|
||||
TRANSFORM_OTHER2_ARG = "TRANSFORM_OTHER2_ARG"
|
||||
TRANSFORM_OTHERS = ["---", "scale_intensity", "translate_intensity", "clamp_intensity_above", "clamp_intensity_below",
|
||||
"scale_scan_angle", "translate_scan_angle", "translate_gps_time", "set_classification", "set_user_data",
|
||||
TRANSFORM_OTHERS = ["---", "scale_intensity", "translate_intensity", "clamp_intensity_above", "clamp_intensity_below",
|
||||
"scale_scan_angle", "translate_scan_angle", "translate_gps_time", "set_classification", "set_user_data",
|
||||
"set_point_source", "scale_rgb_up", "scale_rgb_down", "repair_zero_returns" ]
|
||||
|
||||
def getIcon(self):
|
||||
@ -122,7 +122,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
cores = self.getParameterValue(LAStoolsAlgorithm.CORES)
|
||||
if cores != 1:
|
||||
commands.append("-cores")
|
||||
commands.append(str(cores))
|
||||
commands.append(str(cores))
|
||||
|
||||
def addParametersPointInputGUI(self):
|
||||
self.addParameter(ParameterFile(LAStoolsAlgorithm.INPUT_LASLAZ, "input LAS/LAZ file"))
|
||||
@ -132,7 +132,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
if input != None:
|
||||
commands.append("-i")
|
||||
commands.append(input)
|
||||
|
||||
|
||||
def addParametersPointInputFolderGUI(self):
|
||||
self.addParameter(ParameterFile(LAStoolsAlgorithm.INPUT_DIRECTORY, "input directory", True))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.INPUT_WILDCARDS, "input wildcard(s)", "*.laz"))
|
||||
@ -168,7 +168,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
def addParametersHorizontalAndVerticalFeetCommands(self, commands):
|
||||
self.addParametersHorizontalFeetCommands(commands)
|
||||
self.addParametersVerticalFeetCommands(commands)
|
||||
|
||||
|
||||
def addParametersFilesAreFlightlinesGUI(self):
|
||||
self.addParameter(ParameterBoolean(LAStoolsAlgorithm.FILES_ARE_FLIGHTLINES, "files are flightlines", True))
|
||||
|
||||
@ -183,11 +183,11 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
step = self.getParameterValue(LAStoolsAlgorithm.STEP)
|
||||
if step != 0.0:
|
||||
commands.append("-step")
|
||||
commands.append(str(step))
|
||||
commands.append(str(step))
|
||||
|
||||
def getParametersStepValue(self):
|
||||
step = self.getParameterValue(LAStoolsAlgorithm.STEP)
|
||||
return step
|
||||
return step
|
||||
|
||||
def addParametersPointOutputGUI(self):
|
||||
self.addOutput(OutputFile(LAStoolsAlgorithm.OUTPUT_LASLAZ, "output LAS/LAZ file", "laz"))
|
||||
@ -275,7 +275,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append(option)
|
||||
|
||||
def addParametersFilter1ReturnClassFlagsGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_RETURN_CLASS_FLAGS1, "filter (by return, classification, flags)",
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_RETURN_CLASS_FLAGS1, "filter (by return, classification, flags)",
|
||||
LAStoolsAlgorithm.FILTERS_RETURN_CLASS_FLAGS, 0))
|
||||
|
||||
def addParametersFilter1ReturnClassFlagsCommands(self, commands):
|
||||
@ -284,7 +284,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append("-" + LAStoolsAlgorithm.FILTERS_RETURN_CLASS_FLAGS[filter1])
|
||||
|
||||
def addParametersFilter2ReturnClassFlagsGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_RETURN_CLASS_FLAGS2, "second filter (by return, classification, flags)",
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_RETURN_CLASS_FLAGS2, "second filter (by return, classification, flags)",
|
||||
LAStoolsAlgorithm.FILTERS_RETURN_CLASS_FLAGS, 0))
|
||||
|
||||
def addParametersFilter2ReturnClassFlagsCommands(self, commands):
|
||||
@ -293,7 +293,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append("-" + LAStoolsAlgorithm.FILTERS_RETURN_CLASS_FLAGS[filter2])
|
||||
|
||||
def addParametersFilter3ReturnClassFlagsGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_RETURN_CLASS_FLAGS3, "third filter (by return, classification, flags)",
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_RETURN_CLASS_FLAGS3, "third filter (by return, classification, flags)",
|
||||
LAStoolsAlgorithm.FILTERS_RETURN_CLASS_FLAGS, 0))
|
||||
|
||||
def addParametersFilter3ReturnClassFlagsCommands(self, commands):
|
||||
@ -302,9 +302,9 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append("-" + LAStoolsAlgorithm.FILTERS_RETURN_CLASS_FLAGS[filter3])
|
||||
|
||||
def addParametersFilter1CoordsIntensityGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY1, "filter (by coordinate, intensity, GPS time, ...)",
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY1, "filter (by coordinate, intensity, GPS time, ...)",
|
||||
LAStoolsAlgorithm.FILTERS_COORDS_INTENSITY, 0))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY1_ARG, "value for filter (by coordinate, intensity, GPS time, ...)"))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY1_ARG, "value for filter (by coordinate, intensity, GPS time, ...)"))
|
||||
|
||||
def addParametersFilter1CoordsIntensityCommands(self, commands):
|
||||
filter1 = self.getParameterValue(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY1)
|
||||
@ -315,7 +315,7 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
|
||||
def addParametersFilter2CoordsIntensityGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY2, "second filter (by coordinate, intensity, GPS time, ...)", LAStoolsAlgorithm.FILTERS_COORDS_INTENSITY, 0))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY2_ARG, "value for second filter (by coordinate, intensity, GPS time, ...)"))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY2_ARG, "value for second filter (by coordinate, intensity, GPS time, ...)"))
|
||||
|
||||
def addParametersFilter2CoordsIntensityCommands(self, commands):
|
||||
filter2 = self.getParameterValue(LAStoolsAlgorithm.FILTER_COORDS_INTENSITY2)
|
||||
@ -325,10 +325,10 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append(filter2_arg)
|
||||
|
||||
def addParametersTransform1CoordinateGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_COORDINATE1,
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_COORDINATE1,
|
||||
"transform (coordinates)", LAStoolsAlgorithm.TRANSFORM_COORDINATES, 0))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_COORDINATE1_ARG,
|
||||
"value for transform (coordinates)"))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_COORDINATE1_ARG,
|
||||
"value for transform (coordinates)"))
|
||||
|
||||
def addParametersTransform1CoordinateCommands(self, commands):
|
||||
transform1 = self.getParameterValue(LAStoolsAlgorithm.TRANSFORM_COORDINATE1)
|
||||
@ -338,10 +338,10 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append(transform1_arg)
|
||||
|
||||
def addParametersTransform2CoordinateGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_COORDINATE2,
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_COORDINATE2,
|
||||
"second transform (coordinates)", LAStoolsAlgorithm.TRANSFORM_COORDINATES, 0))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_COORDINATE2_ARG,
|
||||
"value for second transform (coordinates)"))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_COORDINATE2_ARG,
|
||||
"value for second transform (coordinates)"))
|
||||
|
||||
def addParametersTransform2CoordinateCommands(self, commands):
|
||||
transform2 = self.getParameterValue(LAStoolsAlgorithm.TRANSFORM_COORDINATE2)
|
||||
@ -351,10 +351,10 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append(transform2_arg)
|
||||
|
||||
def addParametersTransform1OtherGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_OTHER1,
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_OTHER1,
|
||||
"transform (intensities, scan angles, GPS times, ...)", LAStoolsAlgorithm.TRANSFORM_OTHERS, 0))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_OTHER1_ARG,
|
||||
"value for transform (intensities, scan angles, GPS times, ...)"))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_OTHER1_ARG,
|
||||
"value for transform (intensities, scan angles, GPS times, ...)"))
|
||||
|
||||
def addParametersTransform1OtherCommands(self, commands):
|
||||
transform1 = self.getParameterValue(LAStoolsAlgorithm.TRANSFORM_OTHER1)
|
||||
@ -365,10 +365,10 @@ class LAStoolsAlgorithm(GeoAlgorithm):
|
||||
commands.append(transform1_arg)
|
||||
|
||||
def addParametersTransform2OtherGUI(self):
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_OTHER2,
|
||||
self.addParameter(ParameterSelection(LAStoolsAlgorithm.TRANSFORM_OTHER2,
|
||||
"second transform (intensities, scan angles, GPS times, ...)", LAStoolsAlgorithm.TRANSFORM_OTHERS, 0))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_OTHER2_ARG,
|
||||
"value for second transform (intensities, scan angles, GPS times, ...)"))
|
||||
self.addParameter(ParameterString(LAStoolsAlgorithm.TRANSFORM_OTHER2_ARG,
|
||||
"value for second transform (intensities, scan angles, GPS times, ...)"))
|
||||
|
||||
def addParametersTransform2OtherCommands(self, commands):
|
||||
transform2 = self.getParameterValue(LAStoolsAlgorithm.TRANSFORM_OTHER2)
|
||||
|
@ -52,7 +52,7 @@ class blast2iso(LAStoolsAlgorithm):
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "blast2iso.exe")]
|
||||
self.addParametersVerboseCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
smooth = self.getParameterValue(blast2iso.SMOOTH)
|
||||
if smooth != 0:
|
||||
commands.append("-smooth")
|
||||
|
@ -114,7 +114,7 @@ class flightlinesToCHM(LAStoolsAlgorithm):
|
||||
commands.append("h")
|
||||
commands.append("-olaz")
|
||||
self.addParametersCoresCommands(commands)
|
||||
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
||||
# then we thin and splat the tiles
|
||||
|
@ -96,7 +96,7 @@ class flightlinesToSingleCHMpitFree(LAStoolsAlgorithm):
|
||||
commands.append("_g")
|
||||
commands.append("-olaz")
|
||||
self.addParametersCoresCommands(commands)
|
||||
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
||||
# then we height-normalize the tiles
|
||||
@ -110,7 +110,7 @@ class flightlinesToSingleCHMpitFree(LAStoolsAlgorithm):
|
||||
commands.append("h")
|
||||
commands.append("-olaz")
|
||||
self.addParametersCoresCommands(commands)
|
||||
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
||||
# then we thin and splat the tiles
|
||||
|
@ -56,7 +56,7 @@ class las2iso(LAStoolsAlgorithm):
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2iso.exe")]
|
||||
self.addParametersVerboseCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
smooth = self.getParameterValue(las2iso.SMOOTH)
|
||||
if smooth != 0:
|
||||
commands.append("-smooth")
|
||||
|
@ -35,8 +35,8 @@ class las2las(LAStoolsAlgorithm):
|
||||
STEP = "STEP"
|
||||
OPERATION = "OPERATION"
|
||||
OPERATIONS = ["---", "set_point_type", "set_point_size", "set_version_minor", "set_version_major",
|
||||
"start_at_point", "stop_at_point", "remove_vlr", "auto_reoffset", "week_to_adjusted",
|
||||
"adjusted_to_week", "scale_rgb_up", "scale_rgb_down", "remove_all_vlrs", "remove_extra",
|
||||
"start_at_point", "stop_at_point", "remove_vlr", "auto_reoffset", "week_to_adjusted",
|
||||
"adjusted_to_week", "scale_rgb_up", "scale_rgb_down", "remove_all_vlrs", "remove_extra",
|
||||
"clip_to_bounding_box"]
|
||||
OPERATIONARG = "OPERATIONARG"
|
||||
|
||||
@ -63,7 +63,7 @@ class las2las(LAStoolsAlgorithm):
|
||||
commands.append("-" + OPERATIONS[operation])
|
||||
if operation > 7:
|
||||
commands.append(self.getParameterValue(las2las.OPERATIONARG))
|
||||
|
||||
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -50,7 +50,7 @@ class las2las_filter(LAStoolsAlgorithm):
|
||||
self.addParametersFilter2ReturnClassFlagsCommands(commands)
|
||||
self.addParametersFilter1CoordsIntensityCommands(commands)
|
||||
self.addParametersFilter2CoordsIntensityCommands(commands)
|
||||
|
||||
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -63,7 +63,7 @@ class las2las_transform(LAStoolsAlgorithm):
|
||||
commands.append("-" + las2las_transform.OPERATIONS[operation])
|
||||
if operation > 7:
|
||||
commands.append(self.getParameterValue(las2las_transform.OPERATIONARG))
|
||||
|
||||
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -46,7 +46,7 @@ class las2tin(LAStoolsAlgorithm):
|
||||
def processAlgorithm(self, progress):
|
||||
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "las2tin.exe")]
|
||||
self.addParametersVerboseCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
self.addParametersFilter1ReturnClassFlagsCommands(commands)
|
||||
self.addParametersVectorOutputCommands(commands)
|
||||
|
||||
|
@ -45,7 +45,7 @@ class lascanopy(LAStoolsAlgorithm):
|
||||
PRODUCT7 = "PRODUCT7"
|
||||
PRODUCT8 = "PRODUCT8"
|
||||
PRODUCT9 = "PRODUCT9"
|
||||
PRODUCTS = ["---", "min", "max", "avg", "std", "ske", "kur", "cov", "dns",
|
||||
PRODUCTS = ["---", "min", "max", "avg", "std", "ske", "kur", "cov", "dns",
|
||||
"p01", "p05", "p10", "p25", "p50", "p75", "p90", "p99"]
|
||||
COUNTS = "COUNTS"
|
||||
DENSITIES = "DENSITIES"
|
||||
|
@ -45,7 +45,7 @@ class lasclassify(LAStoolsAlgorithm):
|
||||
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasclassify.exe")]
|
||||
self.addParametersVerboseCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
self.addParametersHorizontalAndVerticalFeetCommands(commands)
|
||||
self.addParametersHorizontalAndVerticalFeetCommands(commands)
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -57,7 +57,7 @@ class lasground(LAStoolsAlgorithm):
|
||||
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasground.exe")]
|
||||
self.addParametersVerboseCommands(commands)
|
||||
self.addParametersPointInputCommands(commands)
|
||||
self.addParametersHorizontalAndVerticalFeetCommands(commands)
|
||||
self.addParametersHorizontalAndVerticalFeetCommands(commands)
|
||||
method = self.getParameterValue(lasground.TERRAIN)
|
||||
if method != 1:
|
||||
commands.append("-" + lasground.TERRAINS[method])
|
||||
|
@ -83,5 +83,5 @@ class lasmerge(LAStoolsAlgorithm):
|
||||
commands.append("-i")
|
||||
commands.append(file7)
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -44,23 +44,23 @@ class lasquery(LAStoolsAlgorithm):
|
||||
self.addParameter(ParameterExtent(self.AOI, 'area of interest'))
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
|
||||
|
||||
commands = [os.path.join(LAStoolsUtils.LAStoolsPath(), "bin", "lasview.exe")]
|
||||
self.addParametersVerboseCommands(commands)
|
||||
|
||||
# get area-of-interest
|
||||
aoi = str(self.getParameterValue(self.AOI))
|
||||
aoiCoords = aoi.split(',')
|
||||
|
||||
|
||||
# get layers
|
||||
layers = QgsMapLayerRegistry.instance().mapLayers()
|
||||
|
||||
# loop over layers
|
||||
for name,layer in layers.iteritems():
|
||||
layerType = layer.type()
|
||||
if layerType == QgsMapLayer.VectorLayer:
|
||||
layerType = layer.type()
|
||||
if layerType == QgsMapLayer.VectorLayer:
|
||||
shp_file_name = layer.source()
|
||||
file_name = shp_file_name[:-4] + ".laz"
|
||||
file_name = shp_file_name[:-4] + ".laz"
|
||||
commands.append('-i')
|
||||
commands.append(file_name)
|
||||
|
||||
|
@ -54,7 +54,7 @@ class shp2las(LAStoolsAlgorithm):
|
||||
scale_factor_z = self.getParameterValue(shp2las.SCALE_FACTOR_Z)
|
||||
if scale_factor_xy != 0.01 or scale_factor_z != 0.01:
|
||||
commands.append("-set_scale_factor")
|
||||
commands.append(str(scale_factor_xy) + " " + str(scale_factor_xy) + " " + str(scale_factor_z))
|
||||
commands.append(str(scale_factor_xy) + " " + str(scale_factor_xy) + " " + str(scale_factor_z))
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -67,7 +67,7 @@ class txt2las(LAStoolsAlgorithm):
|
||||
scale_factor_z = self.getParameterValue(txt2las.SCALE_FACTOR_Z)
|
||||
if scale_factor_xy != 0.01 or scale_factor_z != 0.01:
|
||||
commands.append("-set_scale_factor")
|
||||
commands.append(str(scale_factor_xy) + " " + str(scale_factor_xy) + " " + str(scale_factor_z))
|
||||
commands.append(str(scale_factor_xy) + " " + str(scale_factor_xy) + " " + str(scale_factor_z))
|
||||
self.addParametersPointOutputCommands(commands)
|
||||
|
||||
LAStoolsUtils.runLAStools(commands, progress)
|
||||
|
@ -43,12 +43,12 @@ class RasterCalculator(SagaAlgorithm):
|
||||
GRIDS = 'GRIDS'
|
||||
XGRIDS = 'XGRIDS'
|
||||
RESULT = "RESULT"
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.allowUnmatchingGridExtents = True
|
||||
self.hardcodedStrings = []
|
||||
GeoAlgorithm.__init__(self)
|
||||
|
||||
GeoAlgorithm.__init__(self)
|
||||
|
||||
def getCopy(self):
|
||||
newone = RasterCalculator()
|
||||
newone.provider = self.provider
|
||||
@ -64,16 +64,16 @@ class RasterCalculator(SagaAlgorithm):
|
||||
self.addParameter(grids)
|
||||
self.addParameter(ParameterMultipleInput(self.XGRIDS, 'Input layers',
|
||||
ParameterMultipleInput.TYPE_RASTER, False))
|
||||
self.addParameter(ParameterString(self.FORMULA, "Formula"))
|
||||
self.addParameter(ParameterString(self.FORMULA, "Formula"))
|
||||
self.addOutput(OutputRaster(self.RESULT, "Result"))
|
||||
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
xgrids = self.getParameterValue(self.XGRIDS)
|
||||
|
||||
def processAlgorithm(self, progress):
|
||||
xgrids = self.getParameterValue(self.XGRIDS)
|
||||
layers = xgrids.split(';')
|
||||
grid = layers[0]
|
||||
self.setParameterValue(self.GRIDS, grid)
|
||||
xgrids = ";".join(layers[1:])
|
||||
grid = layers[0]
|
||||
self.setParameterValue(self.GRIDS, grid)
|
||||
xgrids = ";".join(layers[1:])
|
||||
if xgrids == "": xgrids = None
|
||||
self.setParameterValue(self.XGRIDS, xgrids)
|
||||
SagaAlgorithm.processAlgorithm(self, progress)
|
||||
|
@ -62,7 +62,7 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
|
||||
OUTPUT_EXTENT = 'OUTPUT_EXTENT'
|
||||
|
||||
def __init__(self, descriptionfile):
|
||||
def __init__(self, descriptionfile):
|
||||
GeoAlgorithm.__init__(self)
|
||||
self.hardcodedStrings = []
|
||||
self.allowUnmatchingGridExtents = False
|
||||
@ -77,7 +77,7 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
def getIcon(self):
|
||||
return QIcon(os.path.dirname(__file__) + '/../../images/saga.png')
|
||||
|
||||
def defineCharacteristicsFromFile(self):
|
||||
def defineCharacteristicsFromFile(self):
|
||||
lines = open(self.descriptionFile)
|
||||
line = lines.readline().strip('\n').strip()
|
||||
self.name = line
|
||||
@ -331,7 +331,7 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
cellsize = float(param.value)
|
||||
break
|
||||
return cellsize
|
||||
|
||||
|
||||
|
||||
def exportRasterLayer(self, source):
|
||||
global sessionExportedLayers
|
||||
@ -377,10 +377,10 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
"""
|
||||
We check that there are no multiband layers, which are not
|
||||
supported by SAGA, and that raster layers have the same grid extent
|
||||
"""
|
||||
"""
|
||||
extent = None
|
||||
for param in self.parameters:
|
||||
if isinstance(param, ParameterRaster):
|
||||
if isinstance(param, ParameterRaster):
|
||||
layer = dataobjects.getObjectFromUri(param.value)
|
||||
if layer is None:
|
||||
continue
|
||||
@ -394,8 +394,8 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
extent2 = (layer.extent(), layer.height(), layer.width())
|
||||
if extent != extent2:
|
||||
return "Input layers do not have the same grid extent."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def help(self):
|
||||
name = self.cmdname.lower()
|
||||
|
@ -68,7 +68,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
AlgorithmProvider.unload(self)
|
||||
if isWindows():
|
||||
ProcessingConfig.removeSetting(SagaUtils.SAGA_FOLDER)
|
||||
|
||||
|
||||
ProcessingConfig.removeSetting(SagaUtils.SAGA_LOG_CONSOLE)
|
||||
ProcessingConfig.removeSetting(SagaUtils.SAGA_LOG_COMMANDS)
|
||||
|
||||
|
@ -363,7 +363,7 @@ class GeoAlgorithm:
|
||||
self.crs = iface.mapCanvas().mapRenderer().destinationCrs()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def checkInputCRS(self):
|
||||
"""It checks that all input layers use the same CRS. If so,
|
||||
|
@ -58,9 +58,9 @@ class MultipleInputDialog(QDialog, Ui_DlgMultipleSelection):
|
||||
self.populateList()
|
||||
|
||||
def populateList(self):
|
||||
model = QStandardItemModel()
|
||||
model = QStandardItemModel()
|
||||
for i, option in enumerate(self.options):
|
||||
item = QStandardItem(option)
|
||||
item = QStandardItem(option)
|
||||
item.setCheckState(Qt.Checked if i in self.selectedoptions else Qt.Unchecked)
|
||||
item.setCheckable(True)
|
||||
model.appendRow(item)
|
||||
@ -80,13 +80,13 @@ class MultipleInputDialog(QDialog, Ui_DlgMultipleSelection):
|
||||
self.selectedoptions = None
|
||||
QDialog.reject(self)
|
||||
|
||||
def selectAll(self, value):
|
||||
def selectAll(self, value):
|
||||
model = self.lstLayers.model()
|
||||
for i in xrange(model.rowCount()):
|
||||
item = model.item(i)
|
||||
item.setCheckState(Qt.Checked if value else Qt.Unchecked)
|
||||
|
||||
def toggleSelection(self):
|
||||
|
||||
def toggleSelection(self):
|
||||
model = self.lstLayers.model()
|
||||
for i in xrange(model.rowCount()):
|
||||
item = model.item(i)
|
||||
|
@ -200,7 +200,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
name = line
|
||||
outputPos[out.name] = None
|
||||
algOutputs[out.name] = name
|
||||
|
||||
|
||||
# We add the output to the algorithm,
|
||||
# with a name indicating where it comes
|
||||
# from that guarantees that the name is
|
||||
@ -515,7 +515,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
value = ';'.join(layerslist)
|
||||
else:
|
||||
value = self.getValueFromAlgorithmAndParameter(aap)
|
||||
|
||||
|
||||
# We allow unexistent filepaths, since that allows
|
||||
# algorithms to skip some conversion routines
|
||||
if not param.setValue(value) and not isinstance(param,
|
||||
@ -578,7 +578,7 @@ class ModelerAlgorithm(GeoAlgorithm):
|
||||
return None
|
||||
if float(aap.alg) \
|
||||
== float(AlgorithmAndParameter.PARENT_MODEL_ALGORITHM):
|
||||
if aap.param in self.paramValues.keys():
|
||||
if aap.param in self.paramValues.keys():
|
||||
return self.paramValues[aap.param]
|
||||
for param in self.parameters:
|
||||
if aap.param == param.name:
|
||||
|
@ -161,9 +161,9 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
||||
self.textGroup.setText(alg.group)
|
||||
self.textName.setText(alg.name)
|
||||
self.repaintModel()
|
||||
|
||||
|
||||
else:
|
||||
self.alg = ModelerAlgorithm()
|
||||
self.alg = ModelerAlgorithm()
|
||||
|
||||
self.view.centerOn(0, 0)
|
||||
self.alg.setModelerView(self)
|
||||
@ -171,8 +171,8 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
||||
# Indicates whether to update or not the toolbox after
|
||||
# closing this dialog
|
||||
self.update = False
|
||||
|
||||
self.hasChanged = False
|
||||
|
||||
self.hasChanged = False
|
||||
|
||||
def changeModel(self):
|
||||
self.hasChanged = True
|
||||
|
@ -23,7 +23,7 @@ export elcr="$(tput el)$(tput cr)"
|
||||
|
||||
find python src tests -type f -print | while read f; do
|
||||
case "$f" in
|
||||
src/app/gps/qwtpolar-*|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*|src/providers/spatialite/qspatialite/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*)
|
||||
src/app/gps/qwtpolar-*|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/ext-libs/*|src/providers/sqlanywhere/sqlanyconnection/*|src/providers/spatialite/qspatialite/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*)
|
||||
echo $f skipped
|
||||
continue
|
||||
;;
|
||||
|
@ -25,8 +25,8 @@
|
||||
QgsAppLegendInterface::QgsAppLegendInterface( QgsLayerTreeView * layerTreeView )
|
||||
: mLayerTreeView( layerTreeView )
|
||||
{
|
||||
connect( layerTreeView->layerTreeModel()->rootGroup(), SIGNAL(addedChildren(QgsLayerTreeNode*,int,int)), this, SLOT(onAddedChildren(QgsLayerTreeNode*,int,int)));
|
||||
connect( layerTreeView->layerTreeModel()->rootGroup(), SIGNAL(removedChildren(QgsLayerTreeNode*,int,int)), this, SLOT(onRemovedChildren()));
|
||||
connect( layerTreeView->layerTreeModel()->rootGroup(), SIGNAL( addedChildren( QgsLayerTreeNode*, int, int ) ), this, SLOT( onAddedChildren( QgsLayerTreeNode*, int, int ) ) );
|
||||
connect( layerTreeView->layerTreeModel()->rootGroup(), SIGNAL( removedChildren( QgsLayerTreeNode*, int, int ) ), this, SLOT( onRemovedChildren() ) );
|
||||
connect( layerTreeView, SIGNAL( currentLayerChanged( QgsMapLayer * ) ), this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
|
||||
}
|
||||
|
||||
@ -36,73 +36,73 @@ QgsAppLegendInterface::~QgsAppLegendInterface()
|
||||
|
||||
int QgsAppLegendInterface::addGroup( QString name, bool expand, QTreeWidgetItem* parent )
|
||||
{
|
||||
if (parent)
|
||||
if ( parent )
|
||||
return -1;
|
||||
|
||||
return addGroup(name, expand, -1);
|
||||
return addGroup( name, expand, -1 );
|
||||
}
|
||||
|
||||
int QgsAppLegendInterface::addGroup( QString name, bool expand, int parentIndex )
|
||||
{
|
||||
QgsLayerTreeGroup* parentGroup = parentIndex == -1 ? mLayerTreeView->layerTreeModel()->rootGroup() : groupIndexToNode(parentIndex);
|
||||
if (!parentGroup)
|
||||
QgsLayerTreeGroup* parentGroup = parentIndex == -1 ? mLayerTreeView->layerTreeModel()->rootGroup() : groupIndexToNode( parentIndex );
|
||||
if ( !parentGroup )
|
||||
return -1;
|
||||
|
||||
QgsLayerTreeGroup* group = parentGroup->addGroup(name);
|
||||
group->setExpanded(expand);
|
||||
return groupNodeToIndex(group);
|
||||
QgsLayerTreeGroup* group = parentGroup->addGroup( name );
|
||||
group->setExpanded( expand );
|
||||
return groupNodeToIndex( group );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::removeGroup( int groupIndex )
|
||||
{
|
||||
QgsLayerTreeGroup* group = groupIndexToNode(groupIndex);
|
||||
if (!group || !QgsLayerTree::isGroup(group->parent()))
|
||||
QgsLayerTreeGroup* group = groupIndexToNode( groupIndex );
|
||||
if ( !group || !QgsLayerTree::isGroup( group->parent() ) )
|
||||
return;
|
||||
|
||||
QgsLayerTreeGroup* parentGroup = QgsLayerTree::toGroup(group->parent());
|
||||
parentGroup->removeChildNode(group);
|
||||
QgsLayerTreeGroup* parentGroup = QgsLayerTree::toGroup( group->parent() );
|
||||
parentGroup->removeChildNode( group );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::moveLayer( QgsMapLayer * ml, int groupIndex )
|
||||
{
|
||||
QgsLayerTreeGroup* group = groupIndexToNode(groupIndex);
|
||||
if (!group)
|
||||
QgsLayerTreeGroup* group = groupIndexToNode( groupIndex );
|
||||
if ( !group )
|
||||
return;
|
||||
|
||||
QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer(ml->id());
|
||||
if (!nodeLayer || !QgsLayerTree::isGroup(nodeLayer->parent()))
|
||||
QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer( ml->id() );
|
||||
if ( !nodeLayer || !QgsLayerTree::isGroup( nodeLayer->parent() ) )
|
||||
return;
|
||||
|
||||
group->addLayer(ml);
|
||||
group->addLayer( ml );
|
||||
|
||||
QgsLayerTreeGroup* nodeLayerParentGroup = QgsLayerTree::toGroup(nodeLayer->parent());
|
||||
nodeLayerParentGroup->removeChildNode(nodeLayer);
|
||||
QgsLayerTreeGroup* nodeLayerParentGroup = QgsLayerTree::toGroup( nodeLayer->parent() );
|
||||
nodeLayerParentGroup->removeChildNode( nodeLayer );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::setGroupExpanded( int groupIndex, bool expand )
|
||||
{
|
||||
if (QgsLayerTreeGroup* group = groupIndexToNode(groupIndex))
|
||||
group->setExpanded(expand);
|
||||
if ( QgsLayerTreeGroup* group = groupIndexToNode( groupIndex ) )
|
||||
group->setExpanded( expand );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::setGroupVisible( int groupIndex, bool visible )
|
||||
{
|
||||
if (QgsLayerTreeGroup* group = groupIndexToNode(groupIndex))
|
||||
group->setVisible(visible ? Qt::Checked : Qt::Unchecked);
|
||||
if ( QgsLayerTreeGroup* group = groupIndexToNode( groupIndex ) )
|
||||
group->setVisible( visible ? Qt::Checked : Qt::Unchecked );
|
||||
}
|
||||
|
||||
|
||||
static QgsLayerTreeGroup* _groupIndexToNode(int groupIndex, QgsLayerTreeGroup* parentGroup, int& currentIndex)
|
||||
static QgsLayerTreeGroup* _groupIndexToNode( int groupIndex, QgsLayerTreeGroup* parentGroup, int& currentIndex )
|
||||
{
|
||||
++currentIndex;
|
||||
foreach (QgsLayerTreeNode* child, parentGroup->children())
|
||||
foreach ( QgsLayerTreeNode* child, parentGroup->children() )
|
||||
{
|
||||
if (QgsLayerTree::isGroup(child))
|
||||
if ( QgsLayerTree::isGroup( child ) )
|
||||
{
|
||||
if (currentIndex == groupIndex)
|
||||
return QgsLayerTree::toGroup(child);
|
||||
if ( currentIndex == groupIndex )
|
||||
return QgsLayerTree::toGroup( child );
|
||||
|
||||
if (QgsLayerTreeGroup* res = _groupIndexToNode(groupIndex, QgsLayerTree::toGroup(child), currentIndex))
|
||||
if ( QgsLayerTreeGroup* res = _groupIndexToNode( groupIndex, QgsLayerTree::toGroup( child ), currentIndex ) )
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -113,23 +113,23 @@ static QgsLayerTreeGroup* _groupIndexToNode(int groupIndex, QgsLayerTreeGroup* p
|
||||
QgsLayerTreeGroup* QgsAppLegendInterface::groupIndexToNode( int itemIndex )
|
||||
{
|
||||
int currentIndex = -1;
|
||||
return _groupIndexToNode(itemIndex, mLayerTreeView->layerTreeModel()->rootGroup(), currentIndex);
|
||||
return _groupIndexToNode( itemIndex, mLayerTreeView->layerTreeModel()->rootGroup(), currentIndex );
|
||||
}
|
||||
|
||||
|
||||
static int _groupNodeToIndex(QgsLayerTreeGroup* group, QgsLayerTreeGroup* parentGroup, int& currentIndex)
|
||||
static int _groupNodeToIndex( QgsLayerTreeGroup* group, QgsLayerTreeGroup* parentGroup, int& currentIndex )
|
||||
{
|
||||
++currentIndex;
|
||||
foreach (QgsLayerTreeNode* child, parentGroup->children())
|
||||
foreach ( QgsLayerTreeNode* child, parentGroup->children() )
|
||||
{
|
||||
if (QgsLayerTree::isGroup(child))
|
||||
if ( QgsLayerTree::isGroup( child ) )
|
||||
{
|
||||
QgsLayerTreeGroup* childGroup = QgsLayerTree::toGroup(child);
|
||||
if (childGroup == group)
|
||||
QgsLayerTreeGroup* childGroup = QgsLayerTree::toGroup( child );
|
||||
if ( childGroup == group )
|
||||
return currentIndex;
|
||||
|
||||
int res = _groupNodeToIndex(group, childGroup, currentIndex);
|
||||
if (res != -1)
|
||||
int res = _groupNodeToIndex( group, childGroup, currentIndex );
|
||||
if ( res != -1 )
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@ -137,34 +137,34 @@ static int _groupNodeToIndex(QgsLayerTreeGroup* group, QgsLayerTreeGroup* parent
|
||||
return -1;
|
||||
}
|
||||
|
||||
int QgsAppLegendInterface::groupNodeToIndex(QgsLayerTreeGroup* group)
|
||||
int QgsAppLegendInterface::groupNodeToIndex( QgsLayerTreeGroup* group )
|
||||
{
|
||||
int currentIndex = -1;
|
||||
return _groupNodeToIndex(group, mLayerTreeView->layerTreeModel()->rootGroup(), currentIndex);
|
||||
return _groupNodeToIndex( group, mLayerTreeView->layerTreeModel()->rootGroup(), currentIndex );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::setLayerVisible( QgsMapLayer * ml, bool visible )
|
||||
{
|
||||
if (QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer(ml->id()))
|
||||
nodeLayer->setVisible(visible ? Qt::Checked : Qt::Unchecked );
|
||||
if ( QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer( ml->id() ) )
|
||||
nodeLayer->setVisible( visible ? Qt::Checked : Qt::Unchecked );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::setLayerExpanded( QgsMapLayer * ml, bool expand )
|
||||
{
|
||||
if (QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer(ml->id()))
|
||||
nodeLayer->setExpanded(expand);
|
||||
if ( QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer( ml->id() ) )
|
||||
nodeLayer->setExpanded( expand );
|
||||
}
|
||||
|
||||
static void _collectGroups(QgsLayerTreeGroup* parentGroup, QStringList& list)
|
||||
static void _collectGroups( QgsLayerTreeGroup* parentGroup, QStringList& list )
|
||||
{
|
||||
foreach (QgsLayerTreeNode* child, parentGroup->children())
|
||||
foreach ( QgsLayerTreeNode* child, parentGroup->children() )
|
||||
{
|
||||
if (QgsLayerTree::isGroup(child))
|
||||
if ( QgsLayerTree::isGroup( child ) )
|
||||
{
|
||||
QgsLayerTreeGroup* childGroup = QgsLayerTree::toGroup(child);
|
||||
QgsLayerTreeGroup* childGroup = QgsLayerTree::toGroup( child );
|
||||
list << childGroup->name();
|
||||
|
||||
_collectGroups(childGroup, list);
|
||||
_collectGroups( childGroup, list );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,7 +172,7 @@ static void _collectGroups(QgsLayerTreeGroup* parentGroup, QStringList& list)
|
||||
QStringList QgsAppLegendInterface::groups()
|
||||
{
|
||||
QStringList list;
|
||||
_collectGroups(mLayerTreeView->layerTreeModel()->rootGroup(), list);
|
||||
_collectGroups( mLayerTreeView->layerTreeModel()->rootGroup(), list );
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -185,29 +185,29 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
|
||||
{
|
||||
QgsLayerTreeNode* currentNode = nodes.takeFirst();
|
||||
|
||||
if ( QgsLayerTree::isLayer(currentNode) )
|
||||
if ( QgsLayerTree::isLayer( currentNode ) )
|
||||
{
|
||||
QList<QString> layerList;
|
||||
layerList.push_back( QgsLayerTree::toLayer(currentNode)->layerId() );
|
||||
layerList.push_back( QgsLayerTree::toLayer( currentNode )->layerId() );
|
||||
groupLayerList.push_back( qMakePair( QString(), layerList ) );
|
||||
}
|
||||
else if ( QgsLayerTree::isGroup(currentNode) )
|
||||
else if ( QgsLayerTree::isGroup( currentNode ) )
|
||||
{
|
||||
QList<QString> layerList;
|
||||
foreach (QgsLayerTreeNode* gNode, QgsLayerTree::toGroup(currentNode)->children())
|
||||
foreach ( QgsLayerTreeNode* gNode, QgsLayerTree::toGroup( currentNode )->children() )
|
||||
{
|
||||
if ( QgsLayerTree::isLayer(gNode) )
|
||||
if ( QgsLayerTree::isLayer( gNode ) )
|
||||
{
|
||||
layerList.push_back( QgsLayerTree::toLayer(gNode)->layerId() );
|
||||
layerList.push_back( QgsLayerTree::toLayer( gNode )->layerId() );
|
||||
}
|
||||
else if ( QgsLayerTree::isGroup(gNode) )
|
||||
else if ( QgsLayerTree::isGroup( gNode ) )
|
||||
{
|
||||
layerList << QgsLayerTree::toGroup(gNode)->name();
|
||||
layerList << QgsLayerTree::toGroup( gNode )->name();
|
||||
nodes << gNode;
|
||||
}
|
||||
}
|
||||
|
||||
groupLayerList.push_back( qMakePair( QgsLayerTree::toGroup(currentNode)->name(), layerList ) );
|
||||
groupLayerList.push_back( qMakePair( QgsLayerTree::toGroup( currentNode )->name(), layerList ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,12 +216,12 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
|
||||
|
||||
bool QgsAppLegendInterface::groupExists( int groupIndex )
|
||||
{
|
||||
return groupIndexToNode(groupIndex) != 0;
|
||||
return groupIndexToNode( groupIndex ) != 0;
|
||||
}
|
||||
|
||||
bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
|
||||
{
|
||||
if (QgsLayerTreeGroup* group = groupIndexToNode(groupIndex))
|
||||
if ( QgsLayerTreeGroup* group = groupIndexToNode( groupIndex ) )
|
||||
return group->isExpanded();
|
||||
|
||||
return false;
|
||||
@ -229,7 +229,7 @@ bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
|
||||
|
||||
bool QgsAppLegendInterface::isGroupVisible( int groupIndex )
|
||||
{
|
||||
if (QgsLayerTreeGroup* group = groupIndexToNode(groupIndex))
|
||||
if ( QgsLayerTreeGroup* group = groupIndexToNode( groupIndex ) )
|
||||
return group->isVisible() == Qt::Checked;
|
||||
|
||||
return false;
|
||||
@ -237,7 +237,7 @@ bool QgsAppLegendInterface::isGroupVisible( int groupIndex )
|
||||
|
||||
bool QgsAppLegendInterface::isLayerExpanded( QgsMapLayer * ml )
|
||||
{
|
||||
if (QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer(ml->id()))
|
||||
if ( QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer( ml->id() ) )
|
||||
return nodeLayer->isExpanded();
|
||||
|
||||
return false;
|
||||
@ -246,7 +246,7 @@ bool QgsAppLegendInterface::isLayerExpanded( QgsMapLayer * ml )
|
||||
|
||||
bool QgsAppLegendInterface::isLayerVisible( QgsMapLayer * ml )
|
||||
{
|
||||
if (QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer(ml->id()))
|
||||
if ( QgsLayerTreeLayer* nodeLayer = mLayerTreeView->layerTreeModel()->rootGroup()->findLayer( ml->id() ) )
|
||||
return nodeLayer->isVisible() == Qt::Checked;
|
||||
|
||||
return false;
|
||||
@ -261,9 +261,9 @@ QList<QgsMapLayer *> QgsAppLegendInterface::selectedLayers( bool inDrawOrder ) c
|
||||
QList< QgsMapLayer * > QgsAppLegendInterface::layers() const
|
||||
{
|
||||
QList<QgsMapLayer*> lst;
|
||||
foreach (QgsLayerTreeLayer* node, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers())
|
||||
foreach ( QgsLayerTreeLayer* node, mLayerTreeView->layerTreeModel()->rootGroup()->findLayers() )
|
||||
{
|
||||
if (node->layer())
|
||||
if ( node->layer() )
|
||||
lst << node->layer();
|
||||
}
|
||||
return lst;
|
||||
@ -274,18 +274,18 @@ void QgsAppLegendInterface::refreshLayerSymbology( QgsMapLayer *ml )
|
||||
mLayerTreeView->refreshLayerSymbology( ml->id() );
|
||||
}
|
||||
|
||||
void QgsAppLegendInterface::onAddedChildren(QgsLayerTreeNode* node, int indexFrom, int indexTo)
|
||||
void QgsAppLegendInterface::onAddedChildren( QgsLayerTreeNode* node, int indexFrom, int indexTo )
|
||||
{
|
||||
emit groupRelationsChanged();
|
||||
|
||||
for (int i = indexFrom; i <= indexTo; ++i)
|
||||
for ( int i = indexFrom; i <= indexTo; ++i )
|
||||
{
|
||||
QgsLayerTreeNode* child = node->children().at(i);
|
||||
emit itemAdded( mLayerTreeView->layerTreeModel()->node2index(child) );
|
||||
QgsLayerTreeNode* child = node->children().at( i );
|
||||
emit itemAdded( mLayerTreeView->layerTreeModel()->node2index( child ) );
|
||||
|
||||
// also notify about all children
|
||||
if (QgsLayerTree::isGroup(child) && child->children().count())
|
||||
onAddedChildren(child, 0, child->children().count()-1);
|
||||
if ( QgsLayerTree::isGroup( child ) && child->children().count() )
|
||||
onAddedChildren( child, 0, child->children().count() - 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ QgsMapLayer* QgsAppLegendInterface::currentLayer()
|
||||
|
||||
bool QgsAppLegendInterface::setCurrentLayer( QgsMapLayer *layer )
|
||||
{
|
||||
if (!mLayerTreeView->layerTreeModel()->rootGroup()->findLayer(layer->id()))
|
||||
if ( !mLayerTreeView->layerTreeModel()->rootGroup()->findLayer( layer->id() ) )
|
||||
return false;
|
||||
|
||||
mLayerTreeView->setCurrentLayer( layer );
|
||||
|
@ -107,7 +107,7 @@ class QgsAppLegendInterface : public QgsLegendInterface
|
||||
void refreshLayerSymbology( QgsMapLayer *ml );
|
||||
|
||||
protected slots:
|
||||
void onAddedChildren(QgsLayerTreeNode* node, int indexFrom, int indexTo);
|
||||
void onAddedChildren( QgsLayerTreeNode* node, int indexFrom, int indexTo );
|
||||
void onRemovedChildren();
|
||||
|
||||
private:
|
||||
|
@ -10,14 +10,14 @@ class QgsMapCanvas;
|
||||
|
||||
class QgsAppLayerTreeViewMenuProvider : public QObject, public QgsLayerTreeViewMenuProvider
|
||||
{
|
||||
public:
|
||||
QgsAppLayerTreeViewMenuProvider(QgsLayerTreeView* view, QgsMapCanvas* canvas);
|
||||
public:
|
||||
QgsAppLayerTreeViewMenuProvider( QgsLayerTreeView* view, QgsMapCanvas* canvas );
|
||||
|
||||
QMenu* createContextMenu();
|
||||
QMenu* createContextMenu();
|
||||
|
||||
protected:
|
||||
QgsLayerTreeView* mView;
|
||||
QgsMapCanvas* mCanvas;
|
||||
protected:
|
||||
QgsLayerTreeView* mView;
|
||||
QgsMapCanvas* mCanvas;
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
QgsProjectLayerGroupDialog::QgsProjectLayerGroupDialog( QWidget * parent, const QString& projectFile, Qt::WindowFlags f ): QDialog( parent, f ),
|
||||
mShowEmbeddedContent( false )
|
||||
, mRootGroup( new QgsLayerTreeGroup )
|
||||
, mRootGroup( new QgsLayerTreeGroup )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
@ -61,10 +61,10 @@ QStringList QgsProjectLayerGroupDialog::selectedGroups() const
|
||||
{
|
||||
QStringList groups;
|
||||
QgsLayerTreeModel* model = mTreeView->layerTreeModel();
|
||||
foreach( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
foreach ( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
{
|
||||
QgsLayerTreeNode* node = model->index2node( index );
|
||||
if ( QgsLayerTree::isGroup(node) )
|
||||
if ( QgsLayerTree::isGroup( node ) )
|
||||
groups << QgsLayerTree::toGroup( node )->name();
|
||||
}
|
||||
return groups;
|
||||
@ -74,10 +74,10 @@ QStringList QgsProjectLayerGroupDialog::selectedLayerIds() const
|
||||
{
|
||||
QStringList layerIds;
|
||||
QgsLayerTreeModel* model = mTreeView->layerTreeModel();
|
||||
foreach( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
foreach ( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
{
|
||||
QgsLayerTreeNode* node = model->index2node( index );
|
||||
if ( QgsLayerTree::isLayer(node) )
|
||||
if ( QgsLayerTree::isLayer( node ) )
|
||||
layerIds << QgsLayerTree::toLayer( node )->layerId();
|
||||
}
|
||||
return layerIds;
|
||||
@ -87,10 +87,10 @@ QStringList QgsProjectLayerGroupDialog::selectedLayerNames() const
|
||||
{
|
||||
QStringList layerNames;
|
||||
QgsLayerTreeModel* model = mTreeView->layerTreeModel();
|
||||
foreach( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
foreach ( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
{
|
||||
QgsLayerTreeNode* node = model->index2node( index );
|
||||
if ( QgsLayerTree::isLayer(node) )
|
||||
if ( QgsLayerTree::isLayer( node ) )
|
||||
layerNames << QgsLayerTree::toLayer( node )->layerName();
|
||||
}
|
||||
return layerNames;
|
||||
@ -175,7 +175,7 @@ void QgsProjectLayerGroupDialog::changeProjectFile()
|
||||
QgsLayerTreeModel* model = new QgsLayerTreeModel( mRootGroup, this );
|
||||
mTreeView->setModel( model );
|
||||
|
||||
QObject::connect( mTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(onTreeViewSelectionChanged()));
|
||||
QObject::connect( mTreeView->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SLOT( onTreeViewSelectionChanged() ) );
|
||||
|
||||
mProjectPath = mProjectFileLineEdit->text();
|
||||
}
|
||||
@ -186,9 +186,9 @@ void QgsProjectLayerGroupDialog::removeEmbeddedNodes( QgsLayerTreeGroup* node )
|
||||
QList<QgsLayerTreeNode*> childrenToRemove;
|
||||
foreach ( QgsLayerTreeNode* child, node->children() )
|
||||
{
|
||||
if ( child->customProperty("embedded").toInt() )
|
||||
if ( child->customProperty( "embedded" ).toInt() )
|
||||
childrenToRemove << child;
|
||||
else if ( QgsLayerTree::isGroup(child) )
|
||||
else if ( QgsLayerTree::isGroup( child ) )
|
||||
removeEmbeddedNodes( QgsLayerTree::toGroup( child ) );
|
||||
}
|
||||
foreach ( QgsLayerTreeNode* childToRemove, childrenToRemove )
|
||||
@ -198,7 +198,7 @@ void QgsProjectLayerGroupDialog::removeEmbeddedNodes( QgsLayerTreeGroup* node )
|
||||
|
||||
void QgsProjectLayerGroupDialog::onTreeViewSelectionChanged()
|
||||
{
|
||||
foreach( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
foreach ( QModelIndex index, mTreeView->selectionModel()->selectedIndexes() )
|
||||
{
|
||||
unselectChildren( index );
|
||||
}
|
||||
|
@ -586,9 +586,9 @@ bool QgsComposerTableSortColumnsProxyModel::setData( const QModelIndex& index, c
|
||||
|
||||
if ( index.column() == 1 )
|
||||
{
|
||||
column->setSortOrder(( Qt::SortOrder )value.toInt() );
|
||||
emit dataChanged( index, index );
|
||||
return true;
|
||||
column->setSortOrder(( Qt::SortOrder )value.toInt() );
|
||||
emit dataChanged( index, index );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -600,7 +600,7 @@ QDomDocument QgsMapLayer::asLayerDefinition( QList<QgsMapLayer *> layers )
|
||||
{
|
||||
QDomDocument doc( "qgis-layer-definition" );
|
||||
QDomElement layerselm = doc.createElement( "maplayers" );
|
||||
foreach( QgsMapLayer* layer, layers)
|
||||
foreach ( QgsMapLayer* layer, layers )
|
||||
{
|
||||
QDomElement layerelm = doc.createElement( "maplayer" );
|
||||
layer->writeLayerXML( layerelm, doc );
|
||||
@ -617,7 +617,7 @@ QList<QgsMapLayer*> QgsMapLayer::fromLayerDefinition( QDomDocument& document )
|
||||
QDomNodeList layernodes = document.elementsByTagName( "maplayer" );
|
||||
for ( int i = 0; i < layernodes.size(); ++i )
|
||||
{
|
||||
QDomNode layernode = layernodes.at(i);
|
||||
QDomNode layernode = layernodes.at( i );
|
||||
QDomElement layerElem = layernode.toElement();
|
||||
|
||||
QString type = layerElem.attribute( "type" );
|
||||
|
@ -737,9 +737,9 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
|
||||
|
||||
//! called when we're going to start with rendering
|
||||
//! @deprecated since 2.4 - use override with QgsMapSettings
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mr );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
//! called when we're going to start with rendering
|
||||
virtual void init( const QgsMapSettings& mapSettings );
|
||||
//! called to find out whether the layer is used for labeling
|
||||
@ -768,14 +768,14 @@ Q_NOWARN_DEPRECATED_POP
|
||||
//! called when we're done with rendering
|
||||
virtual void exit();
|
||||
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
//! return infos about labels at a given (map) position
|
||||
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
|
||||
Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p );
|
||||
//! return infos about labels within a given (map) rectangle
|
||||
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
|
||||
Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
|
||||
//! Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to the caller
|
||||
//! @note added in 2.4
|
||||
|
@ -342,7 +342,7 @@ QgsProject::QgsProject()
|
||||
// bind the layer tree to the map layer registry.
|
||||
// whenever layers are added to or removed from the registry,
|
||||
// layer tree will be updated
|
||||
mLayerTreeRegistryBridge = new QgsLayerTreeRegistryBridge(mRootGroup, this);
|
||||
mLayerTreeRegistryBridge = new QgsLayerTreeRegistryBridge( mRootGroup, this );
|
||||
|
||||
} // QgsProject ctor
|
||||
|
||||
@ -398,7 +398,7 @@ void QgsProject::dirty( bool b )
|
||||
imp_->dirty = b;
|
||||
} // bool QgsProject::isDirty()
|
||||
|
||||
void QgsProject::setDirty(bool b)
|
||||
void QgsProject::setDirty( bool b )
|
||||
{
|
||||
dirty( b );
|
||||
}
|
||||
@ -889,7 +889,7 @@ bool QgsProject::read()
|
||||
|
||||
QString fileName = imp_->file.fileName();
|
||||
clear();
|
||||
imp_->file.setFileName(fileName);
|
||||
imp_->file.setFileName( fileName );
|
||||
|
||||
// now get any properties
|
||||
_getProperties( *doc, imp_->properties_ );
|
||||
@ -940,7 +940,7 @@ bool QgsProject::read()
|
||||
mLayerTreeRegistryBridge->setEnabled( true );
|
||||
|
||||
// load embedded groups and layers
|
||||
loadEmbeddedNodes(mRootGroup);
|
||||
loadEmbeddedNodes( mRootGroup );
|
||||
|
||||
// read the project: used by map canvas and legend
|
||||
emit readProject( *doc );
|
||||
@ -954,54 +954,54 @@ bool QgsProject::read()
|
||||
} // QgsProject::read
|
||||
|
||||
|
||||
void QgsProject::loadEmbeddedNodes(QgsLayerTreeGroup* group)
|
||||
void QgsProject::loadEmbeddedNodes( QgsLayerTreeGroup* group )
|
||||
{
|
||||
foreach (QgsLayerTreeNode* child, group->children())
|
||||
foreach ( QgsLayerTreeNode* child, group->children() )
|
||||
{
|
||||
if (QgsLayerTree::isGroup(child))
|
||||
if ( QgsLayerTree::isGroup( child ) )
|
||||
{
|
||||
QgsLayerTreeGroup* childGroup = QgsLayerTree::toGroup(child);
|
||||
if (childGroup->customProperty("embedded").toInt())
|
||||
QgsLayerTreeGroup* childGroup = QgsLayerTree::toGroup( child );
|
||||
if ( childGroup->customProperty( "embedded" ).toInt() )
|
||||
{
|
||||
QgsLayerTreeGroup* newGroup = createEmbeddedGroup(childGroup->name(), childGroup->customProperty("embedded_project").toString());
|
||||
if (newGroup)
|
||||
QgsLayerTreeGroup* newGroup = createEmbeddedGroup( childGroup->name(), childGroup->customProperty( "embedded_project" ).toString() );
|
||||
if ( newGroup )
|
||||
{
|
||||
QList<QgsLayerTreeNode*> clonedChildren;
|
||||
foreach (QgsLayerTreeNode* newGroupChild, newGroup->children())
|
||||
foreach ( QgsLayerTreeNode* newGroupChild, newGroup->children() )
|
||||
clonedChildren << newGroupChild->clone();
|
||||
delete newGroup;
|
||||
|
||||
childGroup->insertChildNodes(0, clonedChildren);
|
||||
childGroup->insertChildNodes( 0, clonedChildren );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loadEmbeddedNodes(childGroup);
|
||||
loadEmbeddedNodes( childGroup );
|
||||
}
|
||||
}
|
||||
else if (QgsLayerTree::isLayer(child))
|
||||
else if ( QgsLayerTree::isLayer( child ) )
|
||||
{
|
||||
if (child->customProperty("embedded").toInt())
|
||||
if ( child->customProperty( "embedded" ).toInt() )
|
||||
{
|
||||
QList<QDomNode> brokenNodes;
|
||||
QList< QPair< QgsVectorLayer*, QDomElement > > vectorLayerList;
|
||||
createEmbeddedLayer(QgsLayerTree::toLayer(child)->layerId(), child->customProperty("embedded_project").toString(), brokenNodes, vectorLayerList);
|
||||
createEmbeddedLayer( QgsLayerTree::toLayer( child )->layerId(), child->customProperty( "embedded_project" ).toString(), brokenNodes, vectorLayerList );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProject::removeChildrenOfEmbeddedGroups(QgsLayerTreeGroup* group)
|
||||
void QgsProject::removeChildrenOfEmbeddedGroups( QgsLayerTreeGroup* group )
|
||||
{
|
||||
foreach (QgsLayerTreeNode* child, group->children())
|
||||
foreach ( QgsLayerTreeNode* child, group->children() )
|
||||
{
|
||||
if (QgsLayerTree::isGroup(child))
|
||||
if ( QgsLayerTree::isGroup( child ) )
|
||||
{
|
||||
if (child->customProperty("embedded").toInt())
|
||||
QgsLayerTree::toGroup(child)->removeAllChildren();
|
||||
if ( child->customProperty( "embedded" ).toInt() )
|
||||
QgsLayerTree::toGroup( child )->removeAllChildren();
|
||||
else
|
||||
removeChildrenOfEmbeddedGroups(QgsLayerTree::toGroup(child));
|
||||
removeChildrenOfEmbeddedGroups( QgsLayerTree::toGroup( child ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1087,7 +1087,7 @@ bool QgsProject::write()
|
||||
|
||||
// write layer tree - make sure it is without embedded subgroups
|
||||
QgsLayerTreeNode* clonedRoot = mRootGroup->clone();
|
||||
removeChildrenOfEmbeddedGroups(QgsLayerTree::toGroup(clonedRoot));
|
||||
removeChildrenOfEmbeddedGroups( QgsLayerTree::toGroup( clonedRoot ) );
|
||||
clonedRoot->writeXML( qgisNode );
|
||||
delete clonedRoot;
|
||||
|
||||
|
@ -355,9 +355,9 @@ class CORE_EXPORT QgsProject : public QObject
|
||||
|
||||
void initializeEmbeddedSubtree( const QString& projectFilePath, QgsLayerTreeGroup* group );
|
||||
|
||||
void loadEmbeddedNodes(QgsLayerTreeGroup* group);
|
||||
void loadEmbeddedNodes( QgsLayerTreeGroup* group );
|
||||
|
||||
void removeChildrenOfEmbeddedGroups(QgsLayerTreeGroup* group);
|
||||
void removeChildrenOfEmbeddedGroups( QgsLayerTreeGroup* group );
|
||||
|
||||
signals:
|
||||
//! emitted when project is being read
|
||||
|
@ -49,7 +49,7 @@ QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,
|
||||
|
||||
mUseUnfilteredLayer->setDisabled( mLayer->subsetString().isEmpty() );
|
||||
|
||||
lblDataUri->setText( tr("Set provider filter on %1").arg( layer->name() ) );
|
||||
lblDataUri->setText( tr( "Set provider filter on %1" ).arg( layer->name() ) );
|
||||
txtSQL->setText( mOrigSubsetString );
|
||||
|
||||
populateFields();
|
||||
|
@ -1973,20 +1973,22 @@ void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p,
|
||||
}
|
||||
|
||||
QFontMetricsF layerFontMetrics( layerFont );
|
||||
if (mDrawLegendLayerLabel == true) {
|
||||
if ( mDrawLegendLayerLabel )
|
||||
{
|
||||
currentY += layerFontMetrics.ascent() / fontOversamplingFactor;
|
||||
}
|
||||
|
||||
//draw layer title first
|
||||
if ( p )
|
||||
{
|
||||
if (mDrawLegendLayerLabel == true) {
|
||||
p->save();
|
||||
p->scale( 1.0 / fontOversamplingFactor, 1.0 / fontOversamplingFactor );
|
||||
p->setPen( layerFontColor );
|
||||
p->setFont( layerFont );
|
||||
p->drawText( boxSpace * fontOversamplingFactor, currentY * fontOversamplingFactor, item->text() );
|
||||
p->restore();
|
||||
if ( mDrawLegendLayerLabel )
|
||||
{
|
||||
p->save();
|
||||
p->scale( 1.0 / fontOversamplingFactor, 1.0 / fontOversamplingFactor );
|
||||
p->setPen( layerFontColor );
|
||||
p->setFont( layerFont );
|
||||
p->drawText( boxSpace * fontOversamplingFactor, currentY * fontOversamplingFactor, item->text() );
|
||||
p->restore();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1994,13 +1996,15 @@ void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p,
|
||||
double layerItemWidth = layerFontMetrics.width( item->text() ) / fontOversamplingFactor + boxSpace;
|
||||
if ( layerItemWidth > maxTextWidth )
|
||||
{
|
||||
if ( mDrawLegendLayerLabel == true) {
|
||||
if ( mDrawLegendLayerLabel )
|
||||
{
|
||||
maxTextWidth = layerItemWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mDrawLegendLayerLabel == true) {
|
||||
if ( mDrawLegendLayerLabel )
|
||||
{
|
||||
currentY += layerTitleSpace;
|
||||
}
|
||||
|
||||
@ -2049,23 +2053,27 @@ void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p,
|
||||
break;
|
||||
}
|
||||
|
||||
if ( mDrawLegendItemLabel == true ) {
|
||||
//finally draw text
|
||||
currentTextWidth = itemFontMetrics.width( currentComposerItem->text() ) / fontOversamplingFactor;
|
||||
} else {
|
||||
if ( mDrawLegendItemLabel )
|
||||
{
|
||||
//finally draw text
|
||||
currentTextWidth = itemFontMetrics.width( currentComposerItem->text() ) / fontOversamplingFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentTextWidth = 0;
|
||||
}
|
||||
double symbolItemHeight = qMax( itemFontMetrics.ascent() / fontOversamplingFactor, currentSymbolHeight );
|
||||
|
||||
if ( p )
|
||||
{
|
||||
if ( mDrawLegendItemLabel == true ) {
|
||||
if ( mDrawLegendItemLabel )
|
||||
{
|
||||
p->save();
|
||||
p->scale( 1.0 / fontOversamplingFactor, 1.0 / fontOversamplingFactor );
|
||||
p->setPen( itemFontColor );
|
||||
p->setFont( itemFont );
|
||||
p->drawText( maxSymbolWidth * fontOversamplingFactor,
|
||||
( currentY + symbolItemHeight / 2.0 ) * fontOversamplingFactor + itemFontMetrics.ascent() / 2.0, currentComposerItem->text() );
|
||||
( currentY + symbolItemHeight / 2.0 ) * fontOversamplingFactor + itemFontMetrics.ascent() / 2.0, currentComposerItem->text() );
|
||||
p->restore();
|
||||
}
|
||||
}
|
||||
@ -2073,7 +2081,8 @@ void QgsWMSServer::drawLegendLayerItem( QgsComposerLayerItem* item, QPainter* p,
|
||||
{
|
||||
if ( currentTextWidth > maxTextWidth )
|
||||
{
|
||||
if ( mDrawLegendItemLabel == true ) {
|
||||
if ( mDrawLegendItemLabel )
|
||||
{
|
||||
maxTextWidth = currentTextWidth;
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ QList<QAction*> QgsMssqlConnectionItem::actions()
|
||||
QAction* actionShowNoGeom = new QAction( tr( "Show non-spatial tables" ), this );
|
||||
actionShowNoGeom->setCheckable( true );
|
||||
actionShowNoGeom->setChecked( mAllowGeometrylessTables );
|
||||
connect( actionShowNoGeom, SIGNAL( toggled(bool) ), this, SLOT( setAllowGeometrylessTables(bool) ) );
|
||||
connect( actionShowNoGeom, SIGNAL( toggled( bool ) ), this, SLOT( setAllowGeometrylessTables( bool ) ) );
|
||||
lst.append( actionShowNoGeom );
|
||||
|
||||
QAction* actionEdit = new QAction( tr( "Edit..." ), this );
|
||||
@ -328,7 +328,7 @@ void QgsMssqlConnectionItem::setAllowGeometrylessTables( bool allow )
|
||||
mAllowGeometrylessTables = allow;
|
||||
QString key = "/MSSQL/connections/" + mName;
|
||||
QSettings settings;
|
||||
settings.setValue(key + "/allowGeometrylessTables", allow );
|
||||
settings.setValue( key + "/allowGeometrylessTables", allow );
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ QVariant QgsMssqlProvider::minimumValue( int index )
|
||||
QString sql = QString( "select min([%1]) from " )
|
||||
.arg( fld.name() );
|
||||
|
||||
sql += QString("[%1].[%2]").arg( mSchemaName, mTableName );
|
||||
sql += QString( "[%1].[%2]" ).arg( mSchemaName, mTableName );
|
||||
|
||||
if ( !mSqlWhereClause.isEmpty() )
|
||||
{
|
||||
@ -503,7 +503,7 @@ QVariant QgsMssqlProvider::maximumValue( int index )
|
||||
QString sql = QString( "select max([%1]) from " )
|
||||
.arg( fld.name() );
|
||||
|
||||
sql += QString("[%1].[%2]").arg( mSchemaName, mTableName );
|
||||
sql += QString( "[%1].[%2]" ).arg( mSchemaName, mTableName );
|
||||
|
||||
if ( !mSqlWhereClause.isEmpty() )
|
||||
{
|
||||
@ -544,7 +544,7 @@ void QgsMssqlProvider::uniqueValues( int index, QList<QVariant> &uniqueValues, i
|
||||
sql += QString( "[%1] from " )
|
||||
.arg( fld.name() );
|
||||
|
||||
sql += QString("[%1].[%2]").arg( mSchemaName, mTableName );
|
||||
sql += QString( "[%1].[%2]" ).arg( mSchemaName, mTableName );
|
||||
|
||||
if ( !mSqlWhereClause.isEmpty() )
|
||||
{
|
||||
@ -1303,7 +1303,7 @@ bool QgsMssqlProvider::setSubsetString( QString theSQL, bool )
|
||||
|
||||
QString sql = QString( "select count(*) from " );
|
||||
|
||||
sql += QString("[%1].[%2]").arg( mSchemaName, mTableName );
|
||||
sql += QString( "[%1].[%2]" ).arg( mSchemaName, mTableName );
|
||||
|
||||
if ( !mSqlWhereClause.isEmpty() )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user