Skip to content

Commit 0da67d2

Browse files
committed
[processing] snap points to network by default (fix #19904)
Kudos to Pedro Venâncio for finding solution for this bug (cherry picked from commit 3abea36)
1 parent 20cd215 commit 0da67d2

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

python/plugins/processing/algs/grass7/ext/v_net.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ def incorporatePoints(alg, parameters, context, feedback, pointLayerName='points
5858
threshold = alg.parameterAsDouble(parameters, 'threshold', context)
5959

6060
# Create the v.net connect command for point layer integration
61-
command = u"v.net input={} points={} output={} operation=connect threshold={}".format(
61+
command = 'v.net -s input={} points={} output={} operation=connect threshold={}'.format(
6262
lineLayer, pointLayer, intLayer, threshold)
6363
alg.commands.append(command)
6464

6565
# Connect the point layer database to the layer 2 of the network
66-
command = u"v.db.connect -o map={} table={} layer=2".format(intLayer, pointLayer)
66+
command = 'v.db.connect -o map={} table={} layer=2'.format(intLayer, pointLayer)
6767
alg.commands.append(command)
6868

6969
# remove undesired parameters

python/plugins/processing/algs/grass7/ext/v_net_connectivity.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@
3030

3131
def checkParameterValuesBeforeExecuting(alg, parameters, context):
3232
""" Verify if we have the right parameters """
33-
params = [u'where', u'cats']
33+
params = ['where', 'cats']
3434
values = []
3535
for param in params:
3636
for i in range(1, 3):
3737
values.append(
3838
alg.parameterAsString(
3939
parameters,
40-
u'set{}_{}'.format(i, param),
40+
'set{}_{}'.format(i, param),
4141
context
4242
)
4343
)
4444

4545
if (values[0] or values[2]) and (values[1] or values[3]):
4646
return True, None
4747

48-
return False, alg.tr("You need to set at least setX_where or setX_cats parameters for each set!")
48+
return False, alg.tr('You need to set at least setX_where or setX_cats parameters for each set!')
4949

5050

5151
def processCommand(alg, parameters, context, feedback):

python/plugins/processing/algs/grass7/ext/v_net_distance.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ def processCommand(alg, parameters, context, feedback):
4848
threshold = alg.parameterAsDouble(parameters, 'threshold', context)
4949

5050
# Create the v.net connect command for from_layer integration
51-
command = u"v.net input={} points={} output={} operation=connect threshold={} arc_layer=1 node_layer=2".format(
51+
command = 'v.net -s input={} points={} output={} operation=connect threshold={} arc_layer=1 node_layer=2'.format(
5252
lineLayer, fromLayer, intLayer, threshold)
5353
alg.commands.append(command)
5454

5555
# Do it again with to_layer
56-
command = u"v.net input={} points={} output={} operation=connect threshold={} arc_layer=1 node_layer=3".format(
56+
command = 'v.net -s input={} points={} output={} operation=connect threshold={} arc_layer=1 node_layer=3'.format(
5757
intLayer, toLayer, netLayer, threshold)
5858
alg.commands.append(command)
5959

6060
# Connect the point layer database to the layer 2 of the network
61-
command = u"v.db.connect -o map={} table={} layer=2".format(netLayer, fromLayer)
61+
command = 'v.db.connect -o map={} table={} layer=2'.format(netLayer, fromLayer)
6262
alg.commands.append(command)
6363

64-
command = u"v.db.connect -o map={} table={} layer=3".format(netLayer, toLayer)
64+
command = 'v.db.connect -o map={} table={} layer=3'.format(netLayer, toLayer)
6565
alg.commands.append(command)
6666

6767
# remove undesired parameters

python/plugins/processing/algs/grass7/ext/v_net_flow.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131

3232
def checkParameterValuesBeforeExecuting(alg, parameters, context):
3333
""" Verify if we have the right parameters """
34-
params = [u'where', u'cats']
34+
params = ['where', 'cats']
3535
values = []
3636
for param in params:
37-
for i in [u'source', u'sink']:
37+
for i in ['source', 'sink']:
3838
values.append(
3939
alg.parameterAsString(
4040
parameters,
@@ -46,7 +46,7 @@ def checkParameterValuesBeforeExecuting(alg, parameters, context):
4646
if (values[0] or values[2]) and (values[1] or values[3]):
4747
return True, None
4848

49-
return False, alg.tr("You need to set at least source/sink_where or source/sink_cats parameters for each set!")
49+
return False, alg.tr('You need to set at least source/sink_where or source/sink_cats parameters for each set!')
5050

5151

5252
def processCommand(alg, parameters, context, feedback):

0 commit comments

Comments
 (0)