Skip to content
Permalink
Browse files

[processing] maintain options order

  • Loading branch information
alexbruy committed Dec 13, 2016
1 parent 85e692e commit e63ee670a423cafdd0da648fa25650f16b331931
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
from collections import OrderedDict

from qgis.PyQt.QtCore import QVariant
from qgis.PyQt.QtGui import QIcon
@@ -76,10 +77,10 @@ def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'networkanalysis.svg'))

def defineCharacteristics(self):
self.DIRECTIONS = {self.tr('Forward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Backward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Both directions'): QgsVectorLayerDirector.DirectionForward
}
self.DIRECTIONS = OrderedDict([
(self.tr('Forward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Backward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Both directions'), QgsVectorLayerDirector.DirectionForward)])

self.STRATEGIES = [self.tr('Shortest'),
self.tr('Fastest')
@@ -122,7 +123,7 @@ def defineCharacteristics(self):
params.append(ParameterSelection(self.DEFAULT_DIRECTION,
self.tr('Default direction'),
list(self.DIRECTIONS.keys()),
default=0))
default=2))
params.append(ParameterTableField(self.SPEED_FIELD,
self.tr('Speed field'),
self.INPUT_VECTOR,
@@ -174,7 +175,7 @@ def processAlgorithm(self, progress):
writerPoints = self.getOutputFromName(
self.OUTPUT_POINTS).getVectorWriter(
fields,
QgsWkbTypes.Point,
QgsWkbTypes.MultiPoint,
layer.crs())

writerPolygons = self.getOutputFromName(
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
from collections import OrderedDict

from qgis.PyQt.QtCore import QVariant
from qgis.PyQt.QtGui import QIcon
@@ -77,10 +78,10 @@ def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'networkanalysis.svg'))

def defineCharacteristics(self):
self.DIRECTIONS = {self.tr('Forward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Backward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Both directions'): QgsVectorLayerDirector.DirectionForward
}
self.DIRECTIONS = OrderedDict([
(self.tr('Forward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Backward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Both directions'), QgsVectorLayerDirector.DirectionForward)])

self.STRATEGIES = [self.tr('Shortest'),
self.tr('Fastest')
@@ -122,7 +123,7 @@ def defineCharacteristics(self):
params.append(ParameterSelection(self.DEFAULT_DIRECTION,
self.tr('Default direction'),
list(self.DIRECTIONS.keys()),
default=0))
default=2))
params.append(ParameterTableField(self.SPEED_FIELD,
self.tr('Speed field'),
self.INPUT_VECTOR,
@@ -229,7 +230,7 @@ def processAlgorithm(self, progress):
writer = self.getOutputFromName(
self.OUTPUT_POINTS).getVectorWriter(
fields,
QgsWkbTypes.Point,
QgsWkbTypes.MultiPoint,
layer.crs())

feat.setGeometry(geomUpper)
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
from collections import OrderedDict

from qgis.PyQt.QtCore import QVariant
from qgis.PyQt.QtGui import QIcon
@@ -75,10 +76,10 @@ def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'networkanalysis.svg'))

def defineCharacteristics(self):
self.DIRECTIONS = {self.tr('Forward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Backward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Both directions'): QgsVectorLayerDirector.DirectionForward
}
self.DIRECTIONS = OrderedDict([
(self.tr('Forward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Backward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Both directions'), QgsVectorLayerDirector.DirectionForward)])

self.STRATEGIES = [self.tr('Shortest'),
self.tr('Fastest')
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
from collections import OrderedDict

from qgis.PyQt.QtCore import QVariant
from qgis.PyQt.QtGui import QIcon
@@ -75,10 +76,10 @@ def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'networkanalysis.svg'))

def defineCharacteristics(self):
self.DIRECTIONS = {self.tr('Forward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Backward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Both directions'): QgsVectorLayerDirector.DirectionForward
}
self.DIRECTIONS = OrderedDict([
(self.tr('Forward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Backward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Both directions'), QgsVectorLayerDirector.DirectionForward)])

self.STRATEGIES = [self.tr('Shortest'),
self.tr('Fastest')
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

import os
from collections import OrderedDict

from qgis.PyQt.QtCore import QVariant
from qgis.PyQt.QtGui import QIcon
@@ -77,10 +78,10 @@ def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'networkanalysis.svg'))

def defineCharacteristics(self):
self.DIRECTIONS = {self.tr('Forward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Backward direction'): QgsVectorLayerDirector.DirectionForward,
self.tr('Both directions'): QgsVectorLayerDirector.DirectionForward
}
self.DIRECTIONS = OrderedDict([
(self.tr('Forward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Backward direction'), QgsVectorLayerDirector.DirectionForward),
(self.tr('Both directions'), QgsVectorLayerDirector.DirectionForward)])

self.STRATEGIES = [self.tr('Shortest'),
self.tr('Fastest')
@@ -14,6 +14,9 @@
<gml:featureMember>
<ogr:fastest fid="fastest.0">
<ogr:geometryProperty><gml:LineString srsName="EPSG:32733"><gml:coordinates>1000953.57974071,6220312.94386716 1001107.24684923,6220391.87436156 1001202.14148585,6220278.54570253 1001223.5527025,6220254.162188 1001246.61300986,6220217.55052604 1001256.7885771,6220198.09709699 1001288.75671853,6220134.59225221 1001316.12250986,6220076.61143154 1001343.39016642,6220022.54512089 1001398.88208812,6219947.57470368 1001446.00944971,6219890.54669478 1001690.15771473,6220308.37238282 1001859.8438323,6220539.82106708 1002257.84768038,6220937.82878925 1002518.75791724,6221133.53444839 1002622.66996036,6221162.46807726 1002667.16458207,6221195.87188063 1002845.50542017,6221400.90692838 1003028.1814962,6221611.96830289 1003474.59453034,6222127.67457486 1003406.90500878,6222189.64158806 1003472.3070191,6222272.11630568 1003483.81137232,6222286.60579404 1003540.98718021,6222358.69755776</gml:coordinates></gml:LineString></ogr:geometryProperty>
<ogr:start>1000943.66149, 6220332.25337</ogr:start>
<ogr:end>1003534.81686, 6222363.59122</ogr:end>
<ogr:cost>0.0478445</ogr:cost>
</ogr:fastest>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -1,7 +1,7 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>servicearea</Name>
<ElementPath>servicearea</ElementPath>
<Name>servicearea_bounds</Name>
<ElementPath>servicearea_bounds</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:32733</SRSName>
@@ -18,5 +18,11 @@
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>start</Name>
<ElementPath>start</ElementPath>
<Type>String</Type>
<Width>28</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -12,15 +12,17 @@
</gml:boundedBy>

<gml:featureMember>
<ogr:servicearea fid="servicearea.0">
<ogr:servicearea_bounds fid="servicearea_bounds.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:32733"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1002845.50542017,6221400.90692838 1001968.37489204,6221502.13083684 1002180.65496167,6222555.77455478 1002527.19655281,6222727.93691723 1003198.63616199,6222463.1404267 1003285.47179071,6222319.99149044 1002845.50542017,6221400.90692838</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:type>upper</ogr:type>
</ogr:servicearea>
<ogr:start>1002660.34169, 6222015.78077</ogr:start>
</ogr:servicearea_bounds>
</gml:featureMember>
<gml:featureMember>
<ogr:servicearea fid="servicearea.1">
<ogr:servicearea_bounds fid="servicearea_bounds.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:32733"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1002302.22841804,6221576.64258306 1002137.81278244,6221630.62018051 1002286.87770297,6222431.05239093 1002657.05576802,6222472.25802353 1002852.09477137,6222467.55382686 1003172.94058079,6222436.28679202 1003028.1814962,6221611.96830289 1002302.22841804,6221576.64258306</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:type>lower</ogr:type>
</ogr:servicearea>
<ogr:start>1002660.34169, 6222015.78077</ogr:start>
</ogr:servicearea_bounds>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,28 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>servicearea_nodes</Name>
<ElementPath>servicearea_nodes</ElementPath>
<!--MULTIPOINT-->
<GeometryType>4</GeometryType>
<SRSName>EPSG:32733</SRSName>
<DatasetSpecificInfo>
<FeatureCount>2</FeatureCount>
<ExtentXMin>1001968.37489</ExtentXMin>
<ExtentXMax>1003285.47179</ExtentXMax>
<ExtentYMin>6221400.90693</ExtentYMin>
<ExtentYMax>6222727.93692</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>type</Name>
<ElementPath>type</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>start</Name>
<ElementPath>start</ElementPath>
<Type>String</Type>
<Width>28</Width>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>1001968.37489204</gml:X><gml:Y>6221400.90692838</gml:Y></gml:coord>
<gml:coord><gml:X>1003285.47179071</gml:X><gml:Y>6222727.93691723</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:servicearea_nodes fid="servicearea_nodes.0">
<ogr:geometryProperty><gml:MultiPoint srsName="EPSG:32733"><gml:pointMember><gml:Point><gml:coordinates>1001968.37489204,6221502.13083684</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002141.64083448,6221887.81776555</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002161.08326842,6222058.23120113</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002180.65496167,6222555.77455478</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002226.82368085,6221517.62843522</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002527.19655281,6222727.93691723</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002755.78126323,6222555.17746296</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002813.21865203,6221847.09999962</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002829.37711292,6222541.77590985</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002845.50542017,6221400.90692838</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002893.44547534,6221999.89357485</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002896.08523225,6222491.56157257</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003006.76410522,6222480.99306342</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003095.48438837,6222495.19645599</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003198.63616199,6222463.1404267</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003206.81541818,6222239.38127823</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003285.47179071,6222319.99149044</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint></ogr:geometryProperty>
<ogr:type>upper</ogr:type>
<ogr:start>1002660.34169, 6222015.78077</ogr:start>
</ogr:servicearea_nodes>
</gml:featureMember>
<gml:featureMember>
<ogr:servicearea_nodes fid="servicearea_nodes.1">
<ogr:geometryProperty><gml:MultiPoint srsName="EPSG:32733"><gml:pointMember><gml:Point><gml:coordinates>1002137.81278244,6221630.62018051</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002200.84267254,6221919.96191528</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002207.17904492,6221977.8210857</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002286.87770297,6222431.05239093</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002302.22841804,6221576.64258306</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002657.05576802,6222472.25802353</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002657.05576802,6222472.25802353</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002623.85396603,6221672.14481097</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002852.09477137,6222467.55382686</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003028.1814962,6221611.96830289</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003022.39979238,6222107.94090369</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002852.54413666,6222449.88692926</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1002933.41223807,6222423.64415742</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003153.88971381,6222419.41498029</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003172.94058079,6222436.28679202</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003037.55521283,6222118.73863535</gml:coordinates></gml:Point></gml:pointMember><gml:pointMember><gml:Point><gml:coordinates>1003172.94058079,6222436.28679202</gml:coordinates></gml:Point></gml:pointMember></gml:MultiPoint></ogr:geometryProperty>
<ogr:type>lower</ogr:type>
<ogr:start>1002660.34169, 6222015.78077</ogr:start>
</ogr:servicearea_nodes>
</gml:featureMember>
</ogr:FeatureCollection>

0 comments on commit e63ee67

Please sign in to comment.
You can’t perform that action at this time.