mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
indentation update
This commit is contained in:
parent
4d0be59c96
commit
250cc4ecb1
@ -1,4 +1,4 @@
|
||||
class QgsGml: QObject
|
||||
class QgsGml: QObject
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
@ -6,7 +6,7 @@ class QgsGml: QObject
|
||||
%End
|
||||
|
||||
public:
|
||||
|
||||
|
||||
QgsGml(
|
||||
const QString& typeName,
|
||||
const QString& geometryAttribute,
|
||||
|
@ -83,7 +83,7 @@ class FieldsCalculator(GeoAlgorithm):
|
||||
nElement += 1
|
||||
inGeom = inFeat.geometry()
|
||||
outFeat.setGeometry(inGeom)
|
||||
attrs = inFeat.attributes()
|
||||
attrs = inFeat.attributes()
|
||||
attrs.append(QVariant(result))
|
||||
outFeat.setAttributes(attrs)
|
||||
writer.addFeature(outFeat)
|
||||
|
@ -66,7 +66,7 @@ class Intersection(GeoAlgorithm):
|
||||
intersects = index.intersects( geom.boundingBox() )
|
||||
for i in intersects:
|
||||
request = QgsFeatureRequest().setFilterFid(i)
|
||||
inFeatB = vlayerB.getFeatures(request).next()
|
||||
inFeatB = vlayerB.getFeatures(request).next()
|
||||
tmpGeom = QgsGeometry(inFeatB.geometry())
|
||||
try:
|
||||
if geom.intersects( tmpGeom ):
|
||||
|
@ -61,7 +61,7 @@ class MeanCoords(GeoAlgorithm):
|
||||
uniqueField = self.getParameterValue(self.UID)
|
||||
|
||||
weightIndex = layer.fieldNameIndex(weightField)
|
||||
uniqueIndex = layer.fieldNameIndex(uniqueField)
|
||||
uniqueIndex = layer.fieldNameIndex(uniqueField)
|
||||
|
||||
fieldList = [QgsField("MEAN_X", QVariant.Double, "", 24, 15),
|
||||
QgsField("MEAN_Y", QVariant.Double, "", 24, 15),
|
||||
@ -74,7 +74,7 @@ class MeanCoords(GeoAlgorithm):
|
||||
current = 0
|
||||
features = QGisLayers.features(layer)
|
||||
total = 100.0 / float(len(features))
|
||||
|
||||
|
||||
means = {}
|
||||
for feat in features:
|
||||
current += 1
|
||||
@ -89,7 +89,7 @@ class MeanCoords(GeoAlgorithm):
|
||||
weight = 1.00
|
||||
if clazz not in means:
|
||||
means[clazz] = (0,0,0)
|
||||
|
||||
|
||||
cx,cy, totalweight = means[clazz]
|
||||
geom = QgsGeometry(feat.geometry())
|
||||
geom = utils.extractPoints(geom)
|
||||
@ -98,13 +98,13 @@ class MeanCoords(GeoAlgorithm):
|
||||
cy += i.y() * weight
|
||||
totalweight += weight
|
||||
means[clazz] = (cx, cy, totalweight)
|
||||
|
||||
|
||||
for clazz, values in means.iteritems():
|
||||
outFeat = QgsFeature()
|
||||
outFeat = QgsFeature()
|
||||
cx = values[0] / values[2]
|
||||
cy = values[1] / values[2]
|
||||
cy = values[1] / values[2]
|
||||
meanPoint = QgsPoint(cx, cy)
|
||||
|
||||
|
||||
outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint))
|
||||
outFeat.setAttributes([QVariant(cx), QVariant(cy), clazz])
|
||||
writer.addFeature(outFeat)
|
||||
|
@ -70,7 +70,7 @@ class SumLines(GeoAlgorithm):
|
||||
lengthFieldName = self.getParameterValue(self.LEN_FIELD)
|
||||
countFieldName = self.getParameterValue(self.COUNT_FIELD)
|
||||
|
||||
polyProvider = polyLayer.dataProvider()
|
||||
polyProvider = polyLayer.dataProvider()
|
||||
|
||||
idxLength, fieldList = utils.findOrCreateField(polyLayer, polyLayer.pendingFields(), lengthFieldName)
|
||||
idxCount, fieldList = utils.findOrCreateField(polyLayer, fieldList, countFieldName)
|
||||
@ -104,7 +104,7 @@ class SumLines(GeoAlgorithm):
|
||||
if hasIntersections:
|
||||
for i in lines:
|
||||
request = QgsFeatureRequest().setFilterFid(i)
|
||||
ftLine = lineLayer.getFeatures(request).next()
|
||||
ftLine = lineLayer.getFeatures(request).next()
|
||||
tmpGeom = QgsGeometry(ftLine.geometry())
|
||||
if inGeom.intersects(tmpGeom):
|
||||
outGeom = inGeom.intersection(tmpGeom)
|
||||
|
@ -87,7 +87,7 @@ class Union(GeoAlgorithm):
|
||||
for id in intersects:
|
||||
count += 1
|
||||
request = QgsFeatureRequest().setFilterFid(id)
|
||||
inFeatB = vlayerB.getFeatures(request).next()
|
||||
inFeatB = vlayerB.getFeatures(request).next()
|
||||
atMapB = inFeatB.attributes()
|
||||
tmpGeom = QgsGeometry( inFeatB.geometry() )
|
||||
|
||||
@ -173,7 +173,7 @@ class Union(GeoAlgorithm):
|
||||
else:
|
||||
for id in intersects:
|
||||
request = QgsFeatureRequest().setFilterFid(id)
|
||||
inFeatB = vlayerA.getFeatures(request).next()
|
||||
inFeatB = vlayerA.getFeatures(request).next()
|
||||
atMapB = inFeatB.attributes()
|
||||
tmpGeom = QgsGeometry( inFeatB.geometry() )
|
||||
try:
|
||||
|
@ -64,7 +64,7 @@ class GeoAlgorithm:
|
||||
self.provider = None
|
||||
|
||||
self.defineCharacteristics()
|
||||
|
||||
|
||||
def getCopy(self):
|
||||
'''returns a new instance of this algorithm, ready to be used for being executed'''
|
||||
newone = copy.copy(self)
|
||||
@ -320,7 +320,7 @@ class GeoAlgorithm:
|
||||
if not out.hidden:
|
||||
i+=1
|
||||
return i;
|
||||
|
||||
|
||||
def getVisibleParametersCount(self):
|
||||
'''returns the number of non-hidden parameters'''
|
||||
i = 0;
|
||||
|
@ -78,12 +78,12 @@ class SextanteUtils:
|
||||
|
||||
@staticmethod
|
||||
def getTempFilenameInTempFolder(basename):
|
||||
'''returns a temporary filename for a given file, putting it into a temp folder but not changing its basename'''
|
||||
path = SextanteUtils.tempFolder()
|
||||
'''returns a temporary filename for a given file, putting it into a temp folder but not changing its basename'''
|
||||
path = SextanteUtils.tempFolder()
|
||||
tempFolder = os.path.join(path, str(uuid.uuid4()).replace("-",""))
|
||||
mkdir(tempFolder)
|
||||
mkdir(tempFolder)
|
||||
filename = os.path.join(tempFolder, basename)
|
||||
return filename
|
||||
return filename
|
||||
|
||||
@staticmethod
|
||||
def getNumExportedLayers():
|
||||
|
@ -49,7 +49,7 @@ class BatchInputSelectionPanel(QtGui.QWidget):
|
||||
self.horizontalLayout.addWidget(self.pushButton)
|
||||
self.setLayout(self.horizontalLayout)
|
||||
|
||||
def showSelectionDialog(self):
|
||||
def showSelectionDialog(self):
|
||||
settings = QtCore.QSettings()
|
||||
text = str(self.text.text())
|
||||
if os.path.isdir(text):
|
||||
@ -60,10 +60,10 @@ class BatchInputSelectionPanel(QtGui.QWidget):
|
||||
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant("")).toString())
|
||||
else:
|
||||
path = ""
|
||||
|
||||
|
||||
ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, self.param.getFileFilter())
|
||||
if ret:
|
||||
files = list(ret)
|
||||
if ret:
|
||||
files = list(ret)
|
||||
if len(files) == 1:
|
||||
settings.setValue("/SextanteQGIS/LastInputPath", os.path.dirname(str(files[0])))
|
||||
self.text.setText(str(files[0]))
|
||||
|
@ -109,16 +109,16 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
|
||||
elif isinstance(widget, FileSelectionPanel):
|
||||
widgetValue = widget.getValue()
|
||||
for row in range(1, self.table.rowCount()):
|
||||
self.table.cellWidget(row, col).setText(widgetValue)
|
||||
self.table.cellWidget(row, col).setText(widgetValue)
|
||||
elif isinstance(widget, QtGui.QLineEdit):
|
||||
widgetValue = widget.text()
|
||||
for row in range(1, self.table.rowCount()):
|
||||
self.table.cellWidget(row, col).setText(widgetValue)
|
||||
self.table.cellWidget(row, col).setText(widgetValue)
|
||||
elif isinstance(widget, BatchInputSelectionPanel):
|
||||
widgetValue = widget.getText()
|
||||
for row in range(1, self.table.rowCount()):
|
||||
self.table.cellWidget(row, col).setText(widgetValue)
|
||||
|
||||
|
||||
else:
|
||||
pass
|
||||
|
||||
@ -207,13 +207,13 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
|
||||
def cancel(self):
|
||||
self.algs = None
|
||||
if self.algEx:
|
||||
self.algEx.terminate()
|
||||
self.table.setEnabled(True)
|
||||
self.algEx.terminate()
|
||||
self.table.setEnabled(True)
|
||||
#self.close()
|
||||
|
||||
@pyqtSlot()
|
||||
def finish(self, i):
|
||||
if not self.stop:
|
||||
if not self.stop:
|
||||
if self.load[i]:
|
||||
SextantePostprocessing.handleAlgorithmResults(self.algs[i], self, False)
|
||||
i += 1
|
||||
@ -230,8 +230,8 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
|
||||
QMessageBox.critical(self, "Error", msg)
|
||||
SextanteLog.addToLog(SextanteLog.LOG_ERROR, msg)
|
||||
if self.algEx:
|
||||
self.algEx.terminate()
|
||||
self.table.setEnabled(True)
|
||||
self.algEx.terminate()
|
||||
self.table.setEnabled(True)
|
||||
#self.close()
|
||||
|
||||
|
||||
|
@ -146,9 +146,9 @@ class SextanteToolbox(QDockWidget, Ui_SextanteToolbox):
|
||||
self.fillTreeUsingCategories()
|
||||
else:
|
||||
self.fillTreeUsingProviders()
|
||||
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
|
||||
self.algorithmTree.sortItems(0, Qt.AscendingOrder)
|
||||
self.addRecentAlgorithms(False)
|
||||
|
||||
|
||||
def addRecentAlgorithms(self, updating):
|
||||
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
|
||||
if showRecent:
|
||||
|
@ -42,9 +42,9 @@ def createTest(text):
|
||||
execcommand = "sextante.runalg("
|
||||
i = 0
|
||||
for token in tokens:
|
||||
if i < alg.getVisibleParametersCount() + 1:
|
||||
if i < alg.getVisibleParametersCount() + 1:
|
||||
if os.path.exists(token[1:-1]):
|
||||
token = os.path.basename(token[1:-1])[:-4] + "()"
|
||||
token = os.path.basename(token[1:-1])[:-4] + "()"
|
||||
execcommand += token + ","
|
||||
else:
|
||||
execcommand += "None,"
|
||||
@ -52,16 +52,16 @@ def createTest(text):
|
||||
s += "\toutputs=" + execcommand[:-1] + ")\n"
|
||||
|
||||
i = -1 * len(alg.outputs)
|
||||
for out in alg.outputs:
|
||||
for out in alg.outputs:
|
||||
filename = tokens[i][1:-1]
|
||||
if (filename == str(None)):
|
||||
raise Exception("Cannot create unit test for that algorithm execution.\nThe output cannot be a temporary file")
|
||||
raise Exception("Cannot create unit test for that algorithm execution.\nThe output cannot be a temporary file")
|
||||
s+="\toutput=outputs['" + out.name + "']\n"
|
||||
if isinstance(out, (OutputNumber, OutputString)):
|
||||
s+="self.assertTrue(" + str(out) + ", output)\n"
|
||||
if isinstance(out, OutputRaster):
|
||||
dataset = gdal.Open(filename, GA_ReadOnly)
|
||||
strhash = hash(str(dataset.ReadAsArray(0).tolist()))
|
||||
strhash = hash(str(dataset.ReadAsArray(0).tolist()))
|
||||
s+="\tself.assertTrue(os.path.isfile(output))\n"
|
||||
s+="\tdataset=gdal.Open(output, GA_ReadOnly)\n"
|
||||
s+="\tstrhash=hash(str(dataset.ReadAsArray(0).tolist()))\n"
|
||||
|
@ -204,9 +204,9 @@ class ModelerParameterDefinitionDialog(QtGui.QDialog):
|
||||
self.fileFolderCombo = QtGui.QComboBox()
|
||||
self.fileFolderCombo.addItem("File")
|
||||
self.fileFolderCombo.addItem("Folder")
|
||||
self.horizontalLayout2.addWidget(self.fileFolderCombo)
|
||||
self.horizontalLayout2.addWidget(self.fileFolderCombo)
|
||||
if self.param is not None:
|
||||
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)
|
||||
self.fileFolderCombo.setCurrentIndex(1 if self.param.isFolder else 0)
|
||||
|
||||
self.buttonBox = QtGui.QDialogButtonBox(self)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
@ -267,7 +267,7 @@ class ModelerParameterDefinitionDialog(QtGui.QDialog):
|
||||
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_EXTENT or isinstance(self.param, ParameterExtent):
|
||||
self.param = ParameterExtent(name, description)
|
||||
elif self.paramType == ModelerParameterDefinitionDialog.PARAMETER_FILE or isinstance(self.param, ParameterFile):
|
||||
self.param = ParameterFile(name, description)
|
||||
self.param = ParameterFile(name, description)
|
||||
self.close()
|
||||
|
||||
def cancelPressed(self):
|
||||
|
@ -75,12 +75,12 @@ class ParameterRaster(ParameterDataObject):
|
||||
self.value = unicode(layer.dataProvider().dataSourceUri())
|
||||
return True
|
||||
return os.path.exists(self.value)
|
||||
|
||||
|
||||
def getFileFilter(self):
|
||||
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
|
||||
for i in range(len(exts)):
|
||||
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
|
||||
return ";;".join(exts)
|
||||
return ";;".join(exts)
|
||||
|
||||
def serialize(self):
|
||||
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
|
||||
|
@ -78,7 +78,7 @@ class ParameterTable(ParameterDataObject):
|
||||
else:
|
||||
self.exported = self.value
|
||||
return self.exported
|
||||
|
||||
|
||||
def getFileFilter(self,alg):
|
||||
exts = ['csv', 'dbf']
|
||||
for i in range(len(exts)):
|
||||
|
@ -83,7 +83,7 @@ class ParameterVector(ParameterDataObject):
|
||||
else:
|
||||
self.exported = self.value
|
||||
return self.exported
|
||||
|
||||
|
||||
def getFileFilter(self):
|
||||
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
|
||||
for i in range(len(exts)):
|
||||
|
@ -46,7 +46,7 @@ class EditRScriptDialog(QtGui.QDialog):
|
||||
self.setupUi()
|
||||
self.update = False
|
||||
self.help = None
|
||||
|
||||
|
||||
def setupUi(self):
|
||||
self.resize(600,400)
|
||||
self.setWindowTitle("Edit script")
|
||||
@ -82,7 +82,7 @@ class EditRScriptDialog(QtGui.QDialog):
|
||||
|
||||
def editHelp(self):
|
||||
if self.alg is None:
|
||||
alg = RAlgorithm(None, unicode(self.text.toPlainText()))
|
||||
alg = RAlgorithm(None, unicode(self.text.toPlainText()))
|
||||
else:
|
||||
alg = self.alg
|
||||
dlg = HelpEditionDialog(alg)
|
||||
|
@ -75,21 +75,21 @@ class RAlgorithm(GeoAlgorithm):
|
||||
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/r.png")
|
||||
|
||||
def defineCharacteristicsFromScript(self):
|
||||
lines = self.script.split("\n")
|
||||
lines = self.script.split("\n")
|
||||
self.name = "[Unnamed algorithm]"
|
||||
self.group = "User R scripts"
|
||||
self.parseDescription(iter(lines))
|
||||
|
||||
|
||||
def defineCharacteristicsFromFile(self):
|
||||
|
||||
|
||||
def defineCharacteristicsFromFile(self):
|
||||
filename = os.path.basename(self.descriptionFile)
|
||||
self.name = filename[:filename.rfind(".")].replace("_", " ")
|
||||
self.group = "User R scripts"
|
||||
self.group = "User R scripts"
|
||||
with open(self.descriptionFile, 'r') as f:
|
||||
lines = [line.strip() for line in f]
|
||||
self.parseDescription(iter(lines))
|
||||
|
||||
def parseDescription(self, lines):
|
||||
|
||||
def parseDescription(self, lines):
|
||||
self.script = ""
|
||||
self.commands=[]
|
||||
self.showPlots = False
|
||||
@ -97,7 +97,7 @@ class RAlgorithm(GeoAlgorithm):
|
||||
self.useRasterPackage = True
|
||||
self.passFileNames = False
|
||||
self.verboseCommands = []
|
||||
ender = 0
|
||||
ender = 0
|
||||
line = lines.next().strip("\n").strip("\r")
|
||||
while ender < 10:
|
||||
if line.startswith("##"):
|
||||
@ -285,7 +285,7 @@ class RAlgorithm(GeoAlgorithm):
|
||||
commands.append(
|
||||
'tryCatch(find.package("raster"), error=function(e) install.packages("raster", dependencies=TRUE, lib="%s"))' % rLibDir)
|
||||
commands.append("library(\"raster\")");
|
||||
|
||||
|
||||
for param in self.parameters:
|
||||
if isinstance(param, ParameterRaster):
|
||||
value = param.value
|
||||
|
@ -351,12 +351,12 @@ class SagaAlgorithm(GeoAlgorithm):
|
||||
def checkBeforeOpeningParametersDialog(self):
|
||||
pass
|
||||
#return SagaUtils.checkSagaIsInstalled()
|
||||
|
||||
|
||||
|
||||
def checkParameterValuesBeforeExecuting(self):
|
||||
'''We check that there are no multiband layers, which are not supported by SAGA'''
|
||||
for param in self.parameters:
|
||||
if isinstance(param, ParameterRaster):
|
||||
if isinstance(param, ParameterRaster):
|
||||
value = param.value
|
||||
layer = QGisLayers.getObjectFromUri(value)
|
||||
if layer is not None and layer.bandCount() > 1:
|
||||
|
@ -58,7 +58,7 @@ class SplitRGBBands(GeoAlgorithm):
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
safeBasename = ''.join(c for c in basename if c in validChars)
|
||||
temp = os.path.join(os.path.dirname(temp), safeBasename)
|
||||
|
||||
|
||||
r = self.getOutputValue(SplitRGBBands.R)
|
||||
g = self.getOutputValue(SplitRGBBands.G)
|
||||
b = self.getOutputValue(SplitRGBBands.B)
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,20 +2,20 @@ from sextante.core.Sextante import Sextante
|
||||
from sextante.modeler.ModelerAlgorithm import ModelerAlgorithm
|
||||
|
||||
def testAlg(algname, *args):
|
||||
|
||||
|
||||
#test simple execution
|
||||
alg = Sextante.runAlgorithm(algname, None, *args)
|
||||
assert alg is not None
|
||||
|
||||
|
||||
out = alg.getOutputValuesAsDictionary()
|
||||
|
||||
|
||||
return out
|
||||
|
||||
|
||||
#test execution in a model
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# model = ModelerAlgorithm()
|
||||
# model.addAlgorithm(alg, parametersMap, valuesMap, outputsMap, dependencies)
|
||||
#===========================================================================
|
||||
|
||||
#test
|
||||
|
||||
#test
|
@ -8,17 +8,17 @@ from osgeo import gdal
|
||||
from osgeo.gdalconst import GA_ReadOnly
|
||||
|
||||
class ModelerAlgorithmTest(unittest.TestCase):
|
||||
|
||||
|
||||
def testCreateModel(self):
|
||||
pass
|
||||
|
||||
|
||||
def testRemoveParameter(self):
|
||||
pass
|
||||
|
||||
|
||||
def testRemoveAlgorithm(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
def test_modelersagagrass(self):
|
||||
outputs=sextante.runalg("modeler:sagagrass",points(),None)
|
||||
output=outputs['CENTROIDS_ALG1']
|
||||
@ -39,7 +39,7 @@ class ModelerAlgorithmTest(unittest.TestCase):
|
||||
self.assertEqual(expectedvalues, values)
|
||||
wkt='POINT(270839.65586926 4458983.16267036)'
|
||||
self.assertEqual(wkt, str(feature.geometry().exportToWkt()))
|
||||
|
||||
|
||||
def test_modelersimplemodel(self):
|
||||
outputs=sextante.runalg("modeler:simplemodel",raster(),None)
|
||||
output=outputs['SLOPE_ALG0']
|
||||
@ -47,7 +47,7 @@ class ModelerAlgorithmTest(unittest.TestCase):
|
||||
dataset=gdal.Open(output, GA_ReadOnly)
|
||||
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
|
||||
self.assertEqual(strhash,1891122097)
|
||||
|
||||
|
||||
def test_modelerfieldautoextent(self):
|
||||
outputs=sextante.runalg("modeler:fieldautoextent",polygons(),"POLY_NUM_A",None)
|
||||
output=outputs['USER_GRID_ALG0']
|
||||
@ -55,16 +55,16 @@ class ModelerAlgorithmTest(unittest.TestCase):
|
||||
dataset=gdal.Open(output, GA_ReadOnly)
|
||||
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
|
||||
self.assertEqual(strhash,2026100494)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def suite():
|
||||
suite = unittest.makeSuite(ModelerAlgorithmTest, 'test')
|
||||
suite = unittest.makeSuite(ModelerAlgorithmTest, 'test')
|
||||
return suite
|
||||
|
||||
def runtests():
|
||||
result = unittest.TestResult()
|
||||
result = unittest.TestResult()
|
||||
testsuite = suite()
|
||||
testsuite.run(result)
|
||||
return result
|
||||
|
||||
|
||||
|
@ -14,45 +14,45 @@ class ParametersTest(unittest.TestCase):
|
||||
assert param.setValue(5)
|
||||
assert param.value == 5
|
||||
assert param.setValue(None)
|
||||
assert param.value == param.default
|
||||
assert param.value == param.default
|
||||
s = param.serialize()
|
||||
param2 = ParameterNumber()
|
||||
param2.deserialize(s)
|
||||
param2.deserialize(s)
|
||||
assert param.default == param2.default
|
||||
assert param.max == param2.max
|
||||
assert param.min == param2.min
|
||||
assert param.description == param2.description
|
||||
assert param.name == param2.name
|
||||
|
||||
assert param.name == param2.name
|
||||
|
||||
def testParameterCRS(self):
|
||||
param = ParameterCrs("name", "desc")
|
||||
assert param.setValue("EPSG:12003")
|
||||
param = ParameterCrs("name", "desc")
|
||||
assert param.setValue("EPSG:12003")
|
||||
assert param.value == "EPSG:12003"
|
||||
assert param.setValue(None)
|
||||
assert param.value == param.default
|
||||
assert param.value == param.default
|
||||
s = param.serialize()
|
||||
param2 = ParameterCrs()
|
||||
param2.deserialize(s)
|
||||
assert param.default == param2.default
|
||||
param2.deserialize(s)
|
||||
assert param.default == param2.default
|
||||
assert param.description == param2.description
|
||||
assert param.name == param2.name
|
||||
|
||||
assert param.name == param2.name
|
||||
|
||||
def testParameterExtent(self):
|
||||
param = ParameterExtent("name", "desc")
|
||||
param = ParameterExtent("name", "desc")
|
||||
assert not param.setValue("0,2,0")
|
||||
assert not param.setValue("0,2,0,a")
|
||||
assert not param.setValue("0,2,2,4")
|
||||
assert not param.setValue("0,2,2,4")
|
||||
assert param.value == "0,2,2,4"
|
||||
assert param.setValue(None)
|
||||
assert param.value == param.default
|
||||
assert param.value == param.default
|
||||
s = param.serialize()
|
||||
param2 = ParameterExtent()
|
||||
param2.deserialize(s)
|
||||
assert param.default == param2.default
|
||||
param2.deserialize(s)
|
||||
assert param.default == param2.default
|
||||
assert param.description == param2.description
|
||||
assert param.name == param2.name
|
||||
|
||||
|
||||
|
||||
assert param.name == param2.name
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -3,12 +3,12 @@ import os
|
||||
from sextante.core.SextanteUtils import mkdir
|
||||
from sextante.parameters.ParameterSelection import ParameterSelection
|
||||
|
||||
def createBaseHelpFile(alg, folder):
|
||||
def createBaseHelpFile(alg, folder):
|
||||
folder = os.path.join(folder, alg.provider.getName().lower())
|
||||
mkdir(folder)
|
||||
cmdLineName = alg.commandLineName()[alg.commandLineName().find(":") + 1:].lower()
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
safeFilename = ''.join(c for c in cmdLineName if c in validChars)
|
||||
safeFilename = ''.join(c for c in cmdLineName if c in validChars)
|
||||
filepath = os.path.join(folder, safeFilename + ".rst")
|
||||
file = open(filepath, "w")
|
||||
file.write(alg.name.upper())
|
||||
@ -24,9 +24,9 @@ def createBaseHelpFile(alg, folder):
|
||||
file.write("\nOutputs\n")
|
||||
file.write("-------\n\n")
|
||||
for out in alg.outputs:
|
||||
file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] + "]``:\n")
|
||||
file.write("- ``" + out.description + "[" + out.outputTypeName()[6:] + "]``:\n")
|
||||
file.write("\nSee also\n")
|
||||
file.write("---------\n\n")
|
||||
file.write("---------\n\n")
|
||||
file.write("\nConsole usage\n")
|
||||
file.write("-------------\n\n")
|
||||
file.write("\n::\n\n")
|
||||
@ -38,7 +38,7 @@ def createBaseHelpFile(alg, folder):
|
||||
s+=str(out.name.lower().strip()) + ", "
|
||||
s = s[:-2] +")\n"
|
||||
file.write(s)
|
||||
|
||||
|
||||
s =""
|
||||
hasSelection = False
|
||||
for param in alg.parameters:
|
||||
@ -59,4 +59,3 @@ def createBaseHelpFiles(folder):
|
||||
for provider in Sextante.providers:
|
||||
for alg in provider.algs:
|
||||
createBaseHelpFile(alg, folder)
|
||||
|
@ -774,12 +774,12 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
}
|
||||
if ( !atlasOnASingleFile )
|
||||
{
|
||||
// bugs #7263 and #6856
|
||||
// QPrinter does not seem to be reset correctly and may cause generated PDFs (all except the first) corrupted
|
||||
// when transparent objects are rendered. We thus use a new QPrinter object here
|
||||
QPrinter multiFilePrinter;
|
||||
// bugs #7263 and #6856
|
||||
// QPrinter does not seem to be reset correctly and may cause generated PDFs (all except the first) corrupted
|
||||
// when transparent objects are rendered. We thus use a new QPrinter object here
|
||||
QPrinter multiFilePrinter;
|
||||
outputFileName = QDir( outputDir ).filePath( atlasMap->currentFilename() ) + ".pdf";
|
||||
mComposition->beginPrintAsPDF( multiFilePrinter, outputFileName );
|
||||
mComposition->beginPrintAsPDF( multiFilePrinter, outputFileName );
|
||||
// set the correct resolution
|
||||
mComposition->beginPrint( multiFilePrinter );
|
||||
painter.begin( &multiFilePrinter );
|
||||
|
@ -551,7 +551,7 @@ int main( int argc, char *argv[] )
|
||||
if ( !customizationfile.isEmpty() )
|
||||
{
|
||||
customizationsettings = new QSettings( customizationfile, QSettings::IniFormat );
|
||||
QgsCustomization::instance()->setEnabled(true);
|
||||
QgsCustomization::instance()->setEnabled( true );
|
||||
}
|
||||
|
||||
// Load and set possible default customization, must be done afterQgsApplication init and QSettings ( QCoreApplication ) init
|
||||
|
@ -535,8 +535,8 @@ bool QgisAppInterface::openFeatureForm( QgsVectorLayer *vlayer, QgsFeature &f, b
|
||||
|
||||
QDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeature &f )
|
||||
{
|
||||
QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &f, false );
|
||||
return dialog->dialog();
|
||||
QgsAttributeDialog *dialog = new QgsAttributeDialog( l, &f, false );
|
||||
return dialog->dialog();
|
||||
}
|
||||
|
||||
QList<QgsMapLayer *> QgisAppInterface::editableLayers( bool modified ) const
|
||||
|
@ -380,7 +380,7 @@ class QgisAppInterface : public QgisInterface
|
||||
// @added in 1.6
|
||||
virtual bool openFeatureForm( QgsVectorLayer *l, QgsFeature &f, bool updateFeatureOnly = false );
|
||||
|
||||
virtual QDialog* getFeatureForm(QgsVectorLayer *l, QgsFeature &f);
|
||||
virtual QDialog* getFeatureForm( QgsVectorLayer *l, QgsFeature &f );
|
||||
|
||||
/** Return vector layers in edit mode
|
||||
* @param modified whether to return only layers that have been modified
|
||||
|
@ -909,15 +909,15 @@ void QgsCustomization::preNotify( QObject * receiver, QEvent * event, bool * don
|
||||
|
||||
QString QgsCustomization::splashPath()
|
||||
{
|
||||
if ( isEnabled() )
|
||||
{
|
||||
QString path = mSettings->value( "/Customization/splashpath", QgsApplication::splashPath() ).toString();
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QgsApplication::splashPath();
|
||||
}
|
||||
if ( isEnabled() )
|
||||
{
|
||||
QString path = mSettings->value( "/Customization/splashpath", QgsApplication::splashPath() ).toString();
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QgsApplication::splashPath();
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCustomization::loadDefault()
|
||||
|
@ -45,7 +45,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
|
||||
setupUi( this );
|
||||
|
||||
|
||||
mBackgroundColorButton->setColorDialogTitle( tr( "Background color" ) );
|
||||
mBackgroundColorButton->setColorDialogTitle( tr( "Background color" ) );
|
||||
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
|
||||
mDiagramPenColorButton->setColorDialogTitle( tr( "Pen color" ) );
|
||||
mDiagramPenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
|
||||
|
@ -250,7 +250,7 @@ void QgsPluginRegistry::loadPythonPlugin( QString packageName )
|
||||
// if plugin is not compatible, disable it
|
||||
if ( ! isPythonPluginCompatible( packageName ) )
|
||||
{
|
||||
QgsMessageLog::logMessage( QObject::tr("Plugin \"%1\" is not compatible with this version of Quantum GIS.\nIt will be disabled.").arg( packageName ),
|
||||
QgsMessageLog::logMessage( QObject::tr( "Plugin \"%1\" is not compatible with this version of Quantum GIS.\nIt will be disabled." ).arg( packageName ),
|
||||
QObject::tr( "Plugins" ) );
|
||||
settings.setValue( "/PythonPlugins/" + packageName, false );
|
||||
return;
|
||||
|
@ -43,128 +43,132 @@ static QSemaphore m_quitAppSemaphore;
|
||||
static QList<QByteArray> m_applicationParams;
|
||||
static const char * const QtNativeClassPathName = "org/kde/necessitas/industrius/QtNative";
|
||||
|
||||
extern "C" int main(int, char **); //use the standard main method to start the application
|
||||
static void * startMainMethod(void * /*data*/)
|
||||
extern "C" int main( int, char ** ); //use the standard main method to start the application
|
||||
static void * startMainMethod( void * /*data*/ )
|
||||
{
|
||||
|
||||
char ** params;
|
||||
params=(char**)malloc(sizeof(char*)*m_applicationParams.length());
|
||||
for (int i=0;i<m_applicationParams.size();i++)
|
||||
params[i]= (char*)m_applicationParams[i].constData();
|
||||
char ** params;
|
||||
params = ( char** )malloc( sizeof( char* ) * m_applicationParams.length() );
|
||||
for ( int i = 0;i < m_applicationParams.size();i++ )
|
||||
params[i] = ( char* )m_applicationParams[i].constData();
|
||||
|
||||
int ret = main(m_applicationParams.length(), params);
|
||||
int ret = main( m_applicationParams.length(), params );
|
||||
|
||||
qDebug()<<"MainMethod finished, it's time to cleanup";
|
||||
free(params);
|
||||
Q_UNUSED(ret);
|
||||
qDebug() << "MainMethod finished, it's time to cleanup";
|
||||
free( params );
|
||||
Q_UNUSED( ret );
|
||||
|
||||
JNIEnv* env;
|
||||
if (m_javaVM->AttachCurrentThread(&env, NULL)<0)
|
||||
{
|
||||
qCritical()<<"AttachCurrentThread failed";
|
||||
return false;
|
||||
}
|
||||
jclass applicationClass = env->GetObjectClass(objptr);
|
||||
if (applicationClass){
|
||||
jmethodID quitApp = env->GetStaticMethodID(applicationClass, "quitApp", "()V");
|
||||
env->CallStaticVoidMethod(applicationClass, quitApp);
|
||||
}
|
||||
m_javaVM->DetachCurrentThread();
|
||||
return NULL;
|
||||
JNIEnv* env;
|
||||
if ( m_javaVM->AttachCurrentThread( &env, NULL ) < 0 )
|
||||
{
|
||||
qCritical() << "AttachCurrentThread failed";
|
||||
return false;
|
||||
}
|
||||
jclass applicationClass = env->GetObjectClass( objptr );
|
||||
if ( applicationClass )
|
||||
{
|
||||
jmethodID quitApp = env->GetStaticMethodID( applicationClass, "quitApp", "()V" );
|
||||
env->CallStaticVoidMethod( applicationClass, quitApp );
|
||||
}
|
||||
m_javaVM->DetachCurrentThread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static jboolean startQtApp(JNIEnv* env, jobject /*object*/, jstring paramsString, jstring environmentString)
|
||||
static jboolean startQtApp( JNIEnv* env, jobject /*object*/, jstring paramsString, jstring environmentString )
|
||||
{
|
||||
qDebug()<<"startQtApp";
|
||||
const char * nativeString = env->GetStringUTFChars(environmentString, 0);
|
||||
QByteArray string=nativeString;
|
||||
env->ReleaseStringUTFChars(environmentString, nativeString);
|
||||
m_applicationParams=string.split('\t');
|
||||
qDebug()<<"environmentString"<<string<<m_applicationParams;
|
||||
foreach (string, m_applicationParams)
|
||||
if (putenv(string.constData()))
|
||||
qWarning()<<"Can't set environment"<<string;
|
||||
qDebug() << "startQtApp";
|
||||
const char * nativeString = env->GetStringUTFChars( environmentString, 0 );
|
||||
QByteArray string = nativeString;
|
||||
env->ReleaseStringUTFChars( environmentString, nativeString );
|
||||
m_applicationParams = string.split( '\t' );
|
||||
qDebug() << "environmentString" << string << m_applicationParams;
|
||||
foreach ( string, m_applicationParams )
|
||||
if ( putenv( string.constData() ) )
|
||||
qWarning() << "Can't set environment" << string;
|
||||
|
||||
nativeString = env->GetStringUTFChars(paramsString, 0);
|
||||
string=nativeString;
|
||||
env->ReleaseStringUTFChars(paramsString, nativeString);
|
||||
nativeString = env->GetStringUTFChars( paramsString, 0 );
|
||||
string = nativeString;
|
||||
env->ReleaseStringUTFChars( paramsString, nativeString );
|
||||
|
||||
qDebug()<<"paramsString"<<string;
|
||||
m_applicationParams=string.split('\t');
|
||||
qDebug() << "paramsString" << string;
|
||||
m_applicationParams = string.split( '\t' );
|
||||
|
||||
// Go home
|
||||
QDir::setCurrent(QDir::homePath());
|
||||
// Go home
|
||||
QDir::setCurrent( QDir::homePath() );
|
||||
|
||||
pthread_t appThread;
|
||||
return pthread_create(&appThread, NULL, startMainMethod, NULL)==0;
|
||||
pthread_t appThread;
|
||||
return pthread_create( &appThread, NULL, startMainMethod, NULL ) == 0;
|
||||
}
|
||||
|
||||
|
||||
static JNINativeMethod methods[] = {
|
||||
{"startQtApp", "(Ljava/lang/String;Ljava/lang/String;)V", (void *)startQtApp}
|
||||
static JNINativeMethod methods[] =
|
||||
{
|
||||
{"startQtApp", "(Ljava/lang/String;Ljava/lang/String;)V", ( void * )startQtApp}
|
||||
};
|
||||
|
||||
/*
|
||||
* Register several native methods for one class.
|
||||
*/
|
||||
static int registerNativeMethods(JNIEnv* env, const char* className,
|
||||
JNINativeMethod* gMethods, int numMethods)
|
||||
static int registerNativeMethods( JNIEnv* env, const char* className,
|
||||
JNINativeMethod* gMethods, int numMethods )
|
||||
{
|
||||
jclass clazz=env->FindClass(className);
|
||||
if (clazz == NULL)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find class '%s'", className);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
jmethodID constr = env->GetMethodID(clazz, "<init>", "()V");
|
||||
if(!constr) {
|
||||
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Native registration unable to find constructor for class '%s'", className);
|
||||
return JNI_FALSE;;
|
||||
}
|
||||
jobject obj = env->NewObject(clazz, constr);
|
||||
objptr = env->NewGlobalRef(obj);
|
||||
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed for '%s'", className);
|
||||
return JNI_FALSE;
|
||||
}
|
||||
return JNI_TRUE;
|
||||
jclass clazz = env->FindClass( className );
|
||||
if ( clazz == NULL )
|
||||
{
|
||||
__android_log_print( ANDROID_LOG_FATAL, "Qt", "Native registration unable to find class '%s'", className );
|
||||
return JNI_FALSE;
|
||||
}
|
||||
jmethodID constr = env->GetMethodID( clazz, "<init>", "()V" );
|
||||
if ( !constr )
|
||||
{
|
||||
__android_log_print( ANDROID_LOG_FATAL, "Qt", "Native registration unable to find constructor for class '%s'", className );
|
||||
return JNI_FALSE;;
|
||||
}
|
||||
jobject obj = env->NewObject( clazz, constr );
|
||||
objptr = env->NewGlobalRef( obj );
|
||||
if ( env->RegisterNatives( clazz, gMethods, numMethods ) < 0 )
|
||||
{
|
||||
__android_log_print( ANDROID_LOG_FATAL, "Qt", "RegisterNatives failed for '%s'", className );
|
||||
return JNI_FALSE;
|
||||
}
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register native methods for all classes we know about.
|
||||
*/
|
||||
static int registerNatives(JNIEnv* env)
|
||||
static int registerNatives( JNIEnv* env )
|
||||
{
|
||||
if (!registerNativeMethods(env, QtNativeClassPathName, methods, sizeof(methods) / sizeof(methods[0])))
|
||||
return JNI_FALSE;
|
||||
if ( !registerNativeMethods( env, QtNativeClassPathName, methods, sizeof( methods ) / sizeof( methods[0] ) ) )
|
||||
return JNI_FALSE;
|
||||
|
||||
return JNI_TRUE;
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
||||
typedef union {
|
||||
JNIEnv* nativeEnvironment;
|
||||
void* venv;
|
||||
typedef union
|
||||
{
|
||||
JNIEnv* nativeEnvironment;
|
||||
void* venv;
|
||||
} UnionJNIEnvToVoid;
|
||||
|
||||
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
|
||||
Q_DECL_EXPORT jint JNICALL JNI_OnLoad( JavaVM* vm, void* /*reserved*/ )
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO,"Qt", "qt start");
|
||||
UnionJNIEnvToVoid uenv;
|
||||
uenv.venv = NULL;
|
||||
m_javaVM = 0;
|
||||
__android_log_print( ANDROID_LOG_INFO, "Qt", "qt start" );
|
||||
UnionJNIEnvToVoid uenv;
|
||||
uenv.venv = NULL;
|
||||
m_javaVM = 0;
|
||||
|
||||
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL,"Qt","GetEnv failed");
|
||||
return -1;
|
||||
}
|
||||
m_env = uenv.nativeEnvironment;
|
||||
if (!registerNatives(m_env))
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed");
|
||||
return -1;
|
||||
}
|
||||
m_javaVM = vm;
|
||||
return JNI_VERSION_1_4;
|
||||
if ( vm->GetEnv( &uenv.venv, JNI_VERSION_1_4 ) != JNI_OK )
|
||||
{
|
||||
__android_log_print( ANDROID_LOG_FATAL, "Qt", "GetEnv failed" );
|
||||
return -1;
|
||||
}
|
||||
m_env = uenv.nativeEnvironment;
|
||||
if ( !registerNatives( m_env ) )
|
||||
{
|
||||
__android_log_print( ANDROID_LOG_FATAL, "Qt", "registerNatives failed" );
|
||||
return -1;
|
||||
}
|
||||
m_javaVM = vm;
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
|
||||
|
||||
//id
|
||||
QString id = itemElem.attribute( "id", "" );
|
||||
setId(id);
|
||||
setId( id );
|
||||
|
||||
//frame
|
||||
QString frame = itemElem.attribute( "frame" );
|
||||
@ -1268,7 +1268,7 @@ void QgsComposerItem::repaint()
|
||||
}
|
||||
|
||||
void QgsComposerItem::setId( const QString& id )
|
||||
{
|
||||
{
|
||||
setToolTip( id );
|
||||
mId = id;
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ QgsFeatureRequest::QgsFeatureRequest()
|
||||
}
|
||||
|
||||
QgsFeatureRequest::QgsFeatureRequest( QgsFeatureId fid )
|
||||
: mFilter( FilterFid )
|
||||
, mFilterFid( fid )
|
||||
, mFlags( 0 )
|
||||
: mFilter( FilterFid )
|
||||
, mFilterFid( fid )
|
||||
, mFlags( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
RasterLayer,
|
||||
PluginLayer // added in 1.5
|
||||
};
|
||||
|
||||
|
||||
/** Blending modes enum defining the available composition modes that can
|
||||
* be used when rendering a layer
|
||||
*/
|
||||
@ -492,7 +492,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
|
||||
/** Type of the layer (eg. vector, raster) */
|
||||
QgsMapLayer::LayerType mLayerType;
|
||||
|
||||
|
||||
/** Blend mode for the layer */
|
||||
QgsMapLayer::BlendMode mBlendMode;
|
||||
|
||||
|
@ -96,7 +96,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPoint( const QDomElement& geometryEleme
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "pos" );
|
||||
if ( posList.size() < 1 )
|
||||
{
|
||||
@ -150,7 +152,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLLineString( const QDomElement& geometry
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "posList" );
|
||||
if ( posList.size() < 1 )
|
||||
{
|
||||
@ -235,7 +239,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLPolygon( const QDomElement& geometryEle
|
||||
}
|
||||
ringCoordinates.push_back( interiorPointList );
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
//read coordinates for exterior
|
||||
QDomNodeList exteriorList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, "exterior" );
|
||||
if ( exteriorList.size() < 1 ) //outer ring is necessary
|
||||
@ -359,7 +365,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPoint( const QDomElement& geometry
|
||||
}
|
||||
pointList.push_back(( *currentPoint.begin() ) );
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
//<pos> element
|
||||
posList = pointNodeList.at( 0 ).toElement().elementsByTagNameNS( GML_NAMESPACE, "pos" );
|
||||
if ( posList.size() < 1 )
|
||||
@ -455,7 +463,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo
|
||||
return 0;
|
||||
}
|
||||
lineCoordinates.push_back( currentPointList );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "posList" );
|
||||
if ( currentPosList.size() < 1 )
|
||||
{
|
||||
@ -488,7 +498,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement& geo
|
||||
}
|
||||
lineCoordinates.push_back( currentPointList );
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, "posList" );
|
||||
if ( currentPosList.size() < 1 )
|
||||
{
|
||||
@ -646,7 +658,9 @@ QgsGeometry* QgsOgcUtils::geometryFromGMLMultiPolygon( const QDomElement& geomet
|
||||
}
|
||||
currentPolygonList.push_back( ringCoordinates );
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
//find exterior ring
|
||||
exteriorList = currentPolygonElement.elementsByTagNameNS( GML_NAMESPACE, "exterior" );
|
||||
if ( exteriorList.size() < 1 )
|
||||
@ -880,13 +894,14 @@ bool QgsOgcUtils::readGMLPositions( std::list<QgsPoint>& coords, const QDomEleme
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<posSize/srsDimension; i++) {
|
||||
x = pos.at( i*srsDimension ).toDouble( &conversionSuccess );
|
||||
for ( int i = 0; i < posSize / srsDimension; i++ )
|
||||
{
|
||||
x = pos.at( i * srsDimension ).toDouble( &conversionSuccess );
|
||||
if ( !conversionSuccess )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
y = pos.at( i*srsDimension+1 ).toDouble( &conversionSuccess );
|
||||
y = pos.at( i * srsDimension + 1 ).toDouble( &conversionSuccess );
|
||||
if ( !conversionSuccess )
|
||||
{
|
||||
return 1;
|
||||
@ -1054,10 +1069,10 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc
|
||||
case QGis::WKBPoint:
|
||||
case QGis::WKBMultiPoint25D:
|
||||
case QGis::WKBMultiPoint:
|
||||
baseCoordElem = doc.createElement( "gml:pos");;
|
||||
baseCoordElem = doc.createElement( "gml:pos" );;
|
||||
break;
|
||||
default:
|
||||
baseCoordElem = doc.createElement( "gml:posList");;
|
||||
baseCoordElem = doc.createElement( "gml:posList" );;
|
||||
break;
|
||||
}
|
||||
baseCoordElem.setAttribute( "srsDimension", "2" );
|
||||
@ -1065,7 +1080,7 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc
|
||||
}
|
||||
else
|
||||
{
|
||||
baseCoordElem = doc.createElement( "gml:coordinates");;
|
||||
baseCoordElem = doc.createElement( "gml:coordinates" );;
|
||||
baseCoordElem.setAttribute( "cs", cs );
|
||||
baseCoordElem.setAttribute( "ts", ts );
|
||||
}
|
||||
@ -1341,11 +1356,11 @@ QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc
|
||||
|
||||
QDomElement QgsOgcUtils::geometryToGML( QgsGeometry* geometry, QDomDocument& doc )
|
||||
{
|
||||
return geometryToGML( geometry, doc, "GML2");
|
||||
return geometryToGML( geometry, doc, "GML2" );
|
||||
}
|
||||
|
||||
QDomElement QgsOgcUtils::createGMLCoordinates( const QVector<QgsPoint> points, QDomDocument& doc )
|
||||
{
|
||||
{
|
||||
QDomElement coordElem = doc.createElement( "gml:coordinates" );
|
||||
coordElem.setAttribute( "cs", "," );
|
||||
coordElem.setAttribute( "ts", " " );
|
||||
@ -1369,7 +1384,7 @@ QDomElement QgsOgcUtils::createGMLCoordinates( const QVector<QgsPoint> points, Q
|
||||
}
|
||||
|
||||
QDomElement QgsOgcUtils::createGMLPositions( const QVector<QgsPoint> points, QDomDocument& doc )
|
||||
{
|
||||
{
|
||||
QDomElement posElem = doc.createElement( "gml:pos" );
|
||||
if ( points.size() > 1 )
|
||||
posElem = doc.createElement( "gml:posList" );
|
||||
@ -2076,7 +2091,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
|
||||
Q_ASSERT( argNodes.count() == 2 ); // binary spatial ops must have two args
|
||||
|
||||
QgsExpression::Node* otherNode = 0;
|
||||
if ( isGeometryColumn( argNodes[0]) )
|
||||
if ( isGeometryColumn( argNodes[0] ) )
|
||||
otherNode = argNodes[1];
|
||||
else if ( isGeometryColumn( argNodes[1] ) )
|
||||
otherNode = argNodes[0];
|
||||
|
@ -29,88 +29,88 @@ class CORE_EXPORT QgsOgcUtils
|
||||
{
|
||||
public:
|
||||
|
||||
/** static method that creates geometry from GML
|
||||
@param XML representation of the geometry. GML elements are expected to be
|
||||
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
|
||||
*/
|
||||
static QgsGeometry* geometryFromGML( const QString& xmlString );
|
||||
/** static method that creates geometry from GML
|
||||
@param XML representation of the geometry. GML elements are expected to be
|
||||
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
|
||||
*/
|
||||
static QgsGeometry* geometryFromGML( const QString& xmlString );
|
||||
|
||||
/** static method that creates geometry from GML
|
||||
*/
|
||||
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode );
|
||||
/** static method that creates geometry from GML
|
||||
*/
|
||||
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode );
|
||||
|
||||
/** read rectangle from GML2 Box */
|
||||
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );
|
||||
/** read rectangle from GML2 Box */
|
||||
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );
|
||||
|
||||
/** read rectangle from GML3 Envelope */
|
||||
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );
|
||||
/** read rectangle from GML3 Envelope */
|
||||
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );
|
||||
|
||||
/** Exports the geometry to GML2 or GML3
|
||||
@return QDomELement
|
||||
*/
|
||||
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc, QString format );
|
||||
/** Exports the geometry to GML2 or GML3
|
||||
@return QDomELement
|
||||
*/
|
||||
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc, QString format );
|
||||
|
||||
/** Exports the geometry to GML2
|
||||
@return QDomElement
|
||||
*/
|
||||
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc );
|
||||
/** Exports the geometry to GML2
|
||||
@return QDomElement
|
||||
*/
|
||||
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc );
|
||||
|
||||
/** Exports the rectangle to GML2 Box
|
||||
@return QDomElement
|
||||
*/
|
||||
static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc );
|
||||
/** Exports the rectangle to GML2 Box
|
||||
@return QDomElement
|
||||
*/
|
||||
static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc );
|
||||
|
||||
/** Exports the rectangle to GML2 Envelope
|
||||
@return QDomElement
|
||||
*/
|
||||
static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc );
|
||||
/** Exports the rectangle to GML2 Envelope
|
||||
@return QDomElement
|
||||
*/
|
||||
static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc );
|
||||
|
||||
|
||||
/** Parse XML with OGC filter into QGIS expression */
|
||||
static QgsExpression* expressionFromOgcFilter( const QDomElement& element );
|
||||
/** Parse XML with OGC filter into QGIS expression */
|
||||
static QgsExpression* expressionFromOgcFilter( const QDomElement& element );
|
||||
|
||||
/** Creates OGC filter XML element. Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
|
||||
@return valid <Filter> QDomElement on success, otherwise null QDomElement
|
||||
*/
|
||||
static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = 0 );
|
||||
/** Creates OGC filter XML element. Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
|
||||
@return valid <Filter> QDomElement on success, otherwise null QDomElement
|
||||
*/
|
||||
static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = 0 );
|
||||
|
||||
private:
|
||||
/** static method that creates geometry from GML Point */
|
||||
static QgsGeometry* geometryFromGMLPoint( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML LineString */
|
||||
static QgsGeometry* geometryFromGMLLineString( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML Polygon */
|
||||
static QgsGeometry* geometryFromGMLPolygon( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML MultiPoint */
|
||||
static QgsGeometry* geometryFromGMLMultiPoint( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML MultiLineString */
|
||||
static QgsGeometry* geometryFromGMLMultiLineString( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML MultiPolygon */
|
||||
static QgsGeometry* geometryFromGMLMultiPolygon( const QDomElement& geometryElement );
|
||||
/** Reads the <gml:coordinates> element and extracts the coordinates as points
|
||||
@param coords list where the found coordinates are appended
|
||||
@param elem the <gml:coordinates> element
|
||||
@return boolean for success*/
|
||||
static bool readGMLCoordinates( std::list<QgsPoint>& coords, const QDomElement elem );
|
||||
/** Reads the <gml:pos> or <gml:posList> element and extracts the coordinates as points
|
||||
@param coords list where the found coordinates are appended
|
||||
@param elem the <gml:pos> or <gml:posList> element
|
||||
@return boolean for success*/
|
||||
static bool readGMLPositions( std::list<QgsPoint>& coords, const QDomElement elem );
|
||||
|
||||
private:
|
||||
/** static method that creates geometry from GML Point */
|
||||
static QgsGeometry* geometryFromGMLPoint( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML LineString */
|
||||
static QgsGeometry* geometryFromGMLLineString( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML Polygon */
|
||||
static QgsGeometry* geometryFromGMLPolygon( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML MultiPoint */
|
||||
static QgsGeometry* geometryFromGMLMultiPoint( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML MultiLineString */
|
||||
static QgsGeometry* geometryFromGMLMultiLineString( const QDomElement& geometryElement );
|
||||
/** static method that creates geometry from GML MultiPolygon */
|
||||
static QgsGeometry* geometryFromGMLMultiPolygon( const QDomElement& geometryElement );
|
||||
/** Reads the <gml:coordinates> element and extracts the coordinates as points
|
||||
@param coords list where the found coordinates are appended
|
||||
@param elem the <gml:coordinates> element
|
||||
@return boolean for success*/
|
||||
static bool readGMLCoordinates( std::list<QgsPoint>& coords, const QDomElement elem );
|
||||
/** Reads the <gml:pos> or <gml:posList> element and extracts the coordinates as points
|
||||
@param coords list where the found coordinates are appended
|
||||
@param elem the <gml:pos> or <gml:posList> element
|
||||
@return boolean for success*/
|
||||
static bool readGMLPositions( std::list<QgsPoint>& coords, const QDomElement elem );
|
||||
|
||||
|
||||
/**Create a GML coordinates element from a point list.
|
||||
@param points list of data points
|
||||
@param the GML document
|
||||
@return QDomElement */
|
||||
static QDomElement createGMLCoordinates( const QVector<QgsPoint> points, QDomDocument& doc );
|
||||
static QDomElement createGMLCoordinates( const QVector<QgsPoint> points, QDomDocument& doc );
|
||||
|
||||
/**Create a GML pos or posList element from a point list.
|
||||
@param points list of data points
|
||||
@param the GML document
|
||||
@return QDomElement */
|
||||
static QDomElement createGMLPositions( const QVector<QgsPoint> points, QDomDocument& doc );
|
||||
|
||||
static QDomElement createGMLPositions( const QVector<QgsPoint> points, QDomDocument& doc );
|
||||
|
||||
//! handle a generic sub-expression
|
||||
static QgsExpression::Node* nodeFromOgcFilter( QDomElement &element, QString &errorMessage );
|
||||
//! handle a generic binary operator
|
||||
|
@ -195,8 +195,8 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForFeature( QgsFeature& feature
|
||||
// Null values should not be categorized
|
||||
if ( attrs[mAttrNum].isNull() )
|
||||
return NULL;
|
||||
|
||||
// find the right category
|
||||
|
||||
// find the right category
|
||||
QgsSymbolV2* symbol = symbolForValue( attrs[mAttrNum].toDouble() );
|
||||
if ( symbol == NULL )
|
||||
return NULL;
|
||||
@ -806,7 +806,7 @@ QgsGraduatedSymbolRendererV2* QgsGraduatedSymbolRendererV2::createRenderer(
|
||||
lst.append( attrNum );
|
||||
|
||||
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( lst ) );
|
||||
|
||||
|
||||
// create list of non-null attribute values
|
||||
while ( fit.nextFeature( f ) )
|
||||
if ( !f.attribute( attrNum ).isNull() )
|
||||
|
@ -63,7 +63,7 @@ QgsSymbolV2::~QgsSymbolV2()
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsSymbolV2::outputUnit() const
|
||||
{
|
||||
QgsSymbolV2::OutputUnit unit;
|
||||
QgsSymbolV2::OutputUnit unit( QgsSymbolV2::Mixed );
|
||||
|
||||
QgsSymbolLayerV2List::const_iterator it = mLayers.constBegin();
|
||||
for ( ; it != mLayers.constEnd(); ++it )
|
||||
|
@ -513,13 +513,13 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
|
||||
if ( e->matches( QKeySequence::Copy ) )
|
||||
{
|
||||
// remove all uuid attributes
|
||||
QDomNodeList composerItemsNodes = doc.elementsByTagName("ComposerItem");
|
||||
for (int i=0; i<composerItemsNodes.count(); ++i)
|
||||
QDomNodeList composerItemsNodes = doc.elementsByTagName( "ComposerItem" );
|
||||
for ( int i = 0; i < composerItemsNodes.count(); ++i )
|
||||
{
|
||||
QDomNode composerItemNode = composerItemsNodes.at(i);
|
||||
if( composerItemNode.isElement() )
|
||||
QDomNode composerItemNode = composerItemsNodes.at( i );
|
||||
if ( composerItemNode.isElement() )
|
||||
{
|
||||
composerItemNode.toElement().removeAttribute("uuid");
|
||||
composerItemNode.toElement().removeAttribute( "uuid" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,8 +530,8 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
|
||||
clipboard->setMimeData( mimeData );
|
||||
}
|
||||
|
||||
//TODO : "Ctrl+Shift+V" is one way to paste, but on some platefoms you can use Shift+Ins and F18
|
||||
if ( e->matches( QKeySequence::Paste ) || (e->key() == Qt::Key_V && e->modifiers() & Qt::ControlModifier && e->modifiers() & Qt::ShiftModifier) )
|
||||
//TODO : "Ctrl+Shift+V" is one way to paste, but on some platefoms you can use Shift+Ins and F18
|
||||
if ( e->matches( QKeySequence::Paste ) || ( e->key() == Qt::Key_V && e->modifiers() & Qt::ControlModifier && e->modifiers() & Qt::ShiftModifier ) )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
@ -543,7 +543,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
|
||||
if ( composition() )
|
||||
{
|
||||
QPointF pt = mapToScene( mapFromGlobal( QCursor::pos() ) );
|
||||
bool pasteInPlace = (e->modifiers() & Qt::ShiftModifier);
|
||||
bool pasteInPlace = ( e->modifiers() & Qt::ShiftModifier );
|
||||
composition()->addItemsFromXML( docElem, doc, 0, true, &pt, pasteInPlace );
|
||||
}
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
|
||||
/**Update rulers with current scene rect*/
|
||||
void updateRulers();
|
||||
|
||||
void setHorizontalRuler( QgsComposerRuler* r ){ mHorizontalRuler = r; }
|
||||
void setVerticalRuler( QgsComposerRuler* r ){ mVerticalRuler = r; }
|
||||
void setHorizontalRuler( QgsComposerRuler* r ) { mHorizontalRuler = r; }
|
||||
void setVerticalRuler( QgsComposerRuler* r ) { mVerticalRuler = r; }
|
||||
|
||||
protected:
|
||||
void mousePressEvent( QMouseEvent* );
|
||||
|
@ -441,7 +441,7 @@ void QgsGraduatedSymbolRendererV2Widget::populateColumns()
|
||||
const QgsFields& flds = mLayer->pendingFields();
|
||||
for ( int idx = 0; idx < flds.count(); ++idx )
|
||||
{
|
||||
if ( flds[idx].type() == QVariant::Double || flds[idx].type() == QVariant::Int || flds[idx].type() == QVariant::LongLong)
|
||||
if ( flds[idx].type() == QVariant::Double || flds[idx].type() == QVariant::Int || flds[idx].type() == QVariant::LongLong )
|
||||
cboGraduatedColumn->addItem( flds[idx].name() );
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class QgsWFSServer
|
||||
|
||||
//methods to write GML2
|
||||
QDomElement createFeatureGML2( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QgsFields fields, QSet<QString> excludedAttributes ) /*const*/;
|
||||
|
||||
|
||||
//methods to write GML3
|
||||
QDomElement createFeatureGML3( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QgsFields fields, QSet<QString> excludedAttributes ) /*const*/;
|
||||
};
|
||||
|
@ -170,7 +170,7 @@ void Heatmap::run()
|
||||
// Handle different radius options
|
||||
double radius;
|
||||
double radiusToMapUnits = 1;
|
||||
int myBuffer;
|
||||
int myBuffer = 0;
|
||||
if ( d.variableRadius() )
|
||||
{
|
||||
rField = d.radiusField();
|
||||
@ -367,7 +367,7 @@ double Heatmap::calculateKernelValue( double distance, int bandwidth, int kernel
|
||||
|
||||
double Heatmap::uniformKernel( double distance, int bandwidth )
|
||||
{
|
||||
Q_UNUSED(distance);
|
||||
Q_UNUSED( distance );
|
||||
// Normalizing constant
|
||||
double k = 2. / ( M_PI * ( double )bandwidth );
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Heatmap: public QObject, public QgisPlugin
|
||||
Heatmap( QgisInterface * theInterface );
|
||||
//! Destructor
|
||||
virtual ~Heatmap();
|
||||
|
||||
|
||||
// Kernel shape type
|
||||
enum kernelShape
|
||||
{
|
||||
|
@ -107,10 +107,10 @@ ShapeType (1 byte)
|
||||
#define PointOffset(iFigure) (ReadInt32(nFigurePos + (iFigure) * 5 + 1))
|
||||
#define NextPointOffset(iFigure) (iFigure + 1 < nNumFigures? PointOffset((iFigure) +1) : nNumPoints)
|
||||
|
||||
#define ReadX(iPoint) (ReadDouble(nPointPos + 16 * (iPoint)))
|
||||
#define ReadY(iPoint) (ReadDouble(nPointPos + 16 * (iPoint) + 8))
|
||||
#define ReadZ(iPoint) (ReadDouble(nPointPos + 16 * nNumPoints + 8 * (iPoint)))
|
||||
#define ReadM(iPoint) (ReadDouble(nPointPos + 24 * nNumPoints + 8 * (iPoint)))
|
||||
#define ReadX(iPoint) (ReadDouble(nPointPos + 16 * (iPoint)))
|
||||
#define ReadY(iPoint) (ReadDouble(nPointPos + 16 * (iPoint) + 8))
|
||||
#define ReadZ(iPoint) (ReadDouble(nPointPos + 16 * nNumPoints + 8 * (iPoint)))
|
||||
#define ReadM(iPoint) (ReadDouble(nPointPos + 24 * nNumPoints + 8 * (iPoint)))
|
||||
|
||||
/************************************************************************/
|
||||
/* QgsMssqlGeometryParser() */
|
||||
@ -180,15 +180,15 @@ void QgsMssqlGeometryParser::CopyCoordinates( int iPoint )
|
||||
{
|
||||
if ( IsGeography )
|
||||
{
|
||||
CopyBytes(pszData + nPointPos + 16 * iPoint + 8, 8); // longitude
|
||||
CopyBytes(pszData + nPointPos + 16 * iPoint, 8); // latitude
|
||||
CopyBytes( pszData + nPointPos + 16 * iPoint + 8, 8 ); // longitude
|
||||
CopyBytes( pszData + nPointPos + 16 * iPoint, 8 ); // latitude
|
||||
}
|
||||
else
|
||||
// copy geometry coords
|
||||
CopyBytes(pszData + nPointPos + 16 * iPoint, 16);
|
||||
CopyBytes( pszData + nPointPos + 16 * iPoint, 16 );
|
||||
|
||||
if ( chProps & SP_HASZVALUES )
|
||||
CopyBytes(pszData + nPointPos + 16 * nNumPoints + 8 * iPoint, 8); // copy z value
|
||||
CopyBytes( pszData + nPointPos + 16 * nNumPoints + 8 * iPoint, 8 ); // copy z value
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
@ -49,7 +49,7 @@ QgsMssqlNewConnection::QgsMssqlNewConnection( QWidget *parent, const QString& co
|
||||
{
|
||||
txtUsername->setText( settings.value( key + "/username" ).toString() );
|
||||
chkStoreUsername->setChecked( true );
|
||||
cb_trustedConnection->setChecked (false);
|
||||
cb_trustedConnection->setChecked( false );
|
||||
}
|
||||
|
||||
if ( settings.value( key + "/savePassword" ).toString() == "true" )
|
||||
|
@ -945,7 +945,7 @@ bool QgsMssqlProvider::changeAttributeValues( const QgsChangedAttributesMap & at
|
||||
return true;
|
||||
|
||||
if ( mFidColName.isEmpty() )
|
||||
return false;
|
||||
return false;
|
||||
|
||||
for ( QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it )
|
||||
{
|
||||
@ -1056,7 +1056,7 @@ bool QgsMssqlProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
|
||||
return true;
|
||||
|
||||
if ( mFidColName.isEmpty() )
|
||||
return false;
|
||||
return false;
|
||||
|
||||
for ( QgsGeometryMap::iterator it = geometry_map.begin(); it != geometry_map.end(); ++it )
|
||||
{
|
||||
@ -1129,8 +1129,8 @@ bool QgsMssqlProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
|
||||
bool QgsMssqlProvider::deleteFeatures( const QgsFeatureIds & id )
|
||||
{
|
||||
if ( mFidColName.isEmpty() )
|
||||
return false;
|
||||
|
||||
return false;
|
||||
|
||||
QString featureIds;
|
||||
for ( QgsFeatureIds::const_iterator it = id.begin(); it != id.end(); ++it )
|
||||
{
|
||||
@ -1162,12 +1162,12 @@ bool QgsMssqlProvider::deleteFeatures( const QgsFeatureIds & id )
|
||||
|
||||
int QgsMssqlProvider::capabilities() const
|
||||
{
|
||||
if (mFidColName.isEmpty())
|
||||
if ( mFidColName.isEmpty() )
|
||||
return CreateSpatialIndex | CreateAttributeIndex | AddFeatures | AddAttributes;
|
||||
else
|
||||
return CreateSpatialIndex | CreateAttributeIndex | AddFeatures | DeleteFeatures |
|
||||
ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
|
||||
QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId;
|
||||
ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
|
||||
QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId;
|
||||
}
|
||||
|
||||
bool QgsMssqlProvider::createSpatialIndex()
|
||||
|
@ -580,9 +580,9 @@ class TestQgsExpression: public QObject
|
||||
QTest::newRow( "GML Box" ) << "geomFromGML('<gml:Box srsName=\"foo\"><gml:coordinates>135.2239,34.4879 135.8578,34.8471</gml:coordinates></gml:Box>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
|
||||
// Envelope is from GML3 ?
|
||||
QTest::newRow( "GML Envelope" ) << "geomFromGML('<gml:Envelope>"
|
||||
"<gml:lowerCorner>135.2239 34.4879</gml:lowerCorner>"
|
||||
"<gml:upperCorner>135.8578 34.8471</gml:upperCorner>"
|
||||
"</gml:Envelope>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
|
||||
"<gml:lowerCorner>135.2239 34.4879</gml:lowerCorner>"
|
||||
"<gml:upperCorner>135.8578 34.8471</gml:upperCorner>"
|
||||
"</gml:Envelope>')" << ( void * ) QgsGeometry::fromRect( rect ) << false;
|
||||
}
|
||||
|
||||
void eval_geometry_constructor()
|
||||
|
@ -234,8 +234,8 @@ void TestQgsOgcUtils::testExpressionToOgcFilter()
|
||||
|
||||
doc.appendChild( filterElem );
|
||||
|
||||
qDebug("EXPR: %s", exp.dump().toAscii().data() );
|
||||
qDebug("OGC : %s", doc.toString( -1 ).toAscii().data() );
|
||||
qDebug( "EXPR: %s", exp.dump().toAscii().data() );
|
||||
qDebug( "OGC : %s", doc.toString( -1 ).toAscii().data() );
|
||||
|
||||
QCOMPARE( xmlText, doc.toString( -1 ) );
|
||||
}
|
||||
@ -258,74 +258,74 @@ void TestQgsOgcUtils::testExpressionToOgcFilter_data()
|
||||
"</ogc:PropertyIsGreaterThan></ogc:Filter>" );
|
||||
|
||||
QTest::newRow( "and+or" ) << QString( "(FIELD1 = 10 OR FIELD1 = 20) AND STATUS = 'VALID'" ) << QString(
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Filter>"
|
||||
"<ogc:And>"
|
||||
"<ogc:Or>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
|
||||
"<ogc:Literal>10</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
|
||||
"<ogc:Literal>20</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"</ogc:Or>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>STATUS</ogc:PropertyName>"
|
||||
"<ogc:Literal>VALID</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:Or>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
|
||||
"<ogc:Literal>10</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>FIELD1</ogc:PropertyName>"
|
||||
"<ogc:Literal>20</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"</ogc:Or>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>STATUS</ogc:PropertyName>"
|
||||
"<ogc:Literal>VALID</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"</ogc:And>"
|
||||
"</ogc:Filter>" );
|
||||
"</ogc:Filter>" );
|
||||
|
||||
QTest::newRow( "is null" ) << QString( "X IS NULL" ) << QString(
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Filter>"
|
||||
"<ogc:PropertyIsNull>"
|
||||
"<ogc:PropertyName>X</ogc:PropertyName>"
|
||||
"<ogc:PropertyName>X</ogc:PropertyName>"
|
||||
"</ogc:PropertyIsNull>"
|
||||
"</ogc:Filter>" );
|
||||
"</ogc:Filter>" );
|
||||
|
||||
QTest::newRow( "is not null" ) << QString( "X IS NOT NULL" ) << QString(
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Not>"
|
||||
"<ogc:PropertyIsNull>"
|
||||
"<ogc:PropertyName>X</ogc:PropertyName>"
|
||||
"</ogc:PropertyIsNull>"
|
||||
"<ogc:PropertyIsNull>"
|
||||
"<ogc:PropertyName>X</ogc:PropertyName>"
|
||||
"</ogc:PropertyIsNull>"
|
||||
"</ogc:Not>"
|
||||
"</ogc:Filter>" );
|
||||
"</ogc:Filter>" );
|
||||
|
||||
QTest::newRow( "in" ) << QString( "A IN (10,20,30)" ) << QString(
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Or>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>A</ogc:PropertyName>"
|
||||
"<ogc:Literal>10</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>A</ogc:PropertyName>"
|
||||
"<ogc:Literal>20</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>A</ogc:PropertyName>"
|
||||
"<ogc:Literal>30</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>A</ogc:PropertyName>"
|
||||
"<ogc:Literal>10</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>A</ogc:PropertyName>"
|
||||
"<ogc:Literal>20</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyIsEqualTo>"
|
||||
"<ogc:PropertyName>A</ogc:PropertyName>"
|
||||
"<ogc:Literal>30</ogc:Literal>"
|
||||
"</ogc:PropertyIsEqualTo>"
|
||||
"</ogc:Or>"
|
||||
"</ogc:Filter>" );
|
||||
"</ogc:Filter>" );
|
||||
|
||||
QTest::newRow( "intersects + wkt" ) << QString( "intersects($geometry, geomFromWKT('POINT (5 6)'))" ) << QString(
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Intersects>"
|
||||
"<ogc:PropertyName>geometry</ogc:PropertyName>"
|
||||
"<gml:Point><gml:coordinates cs=\",\" ts=\" \">5.0,6.0</gml:coordinates></gml:Point>"
|
||||
"<ogc:PropertyName>geometry</ogc:PropertyName>"
|
||||
"<gml:Point><gml:coordinates cs=\",\" ts=\" \">5.0,6.0</gml:coordinates></gml:Point>"
|
||||
"</ogc:Intersects>"
|
||||
"</ogc:Filter>" );
|
||||
"</ogc:Filter>" );
|
||||
|
||||
QTest::newRow( "contains + gml" ) << QString( "contains($geometry, geomFromGML('<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>'))" ) << QString(
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Filter>"
|
||||
"<ogc:Contains>"
|
||||
"<ogc:PropertyName>geometry</ogc:PropertyName>"
|
||||
"<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>"
|
||||
"<ogc:PropertyName>geometry</ogc:PropertyName>"
|
||||
"<Point><coordinates cs=\",\" ts=\" \">5.0,6.0</coordinates></Point>"
|
||||
"</ogc:Contains>"
|
||||
"</ogc:Filter>" );
|
||||
"</ogc:Filter>" );
|
||||
|
||||
/*
|
||||
QTest::newRow( "bbox with GML3 Envelope" )
|
||||
|
Loading…
x
Reference in New Issue
Block a user