@@ -176,40 +176,42 @@ def openModel(self, filename):
176
176
# parsing this
177
177
pass
178
178
for param in alg .parameters :
179
- line = lines .readline ().strip ('\n ' ).strip ('\r ' )
180
- if line == str (None ):
181
- algParams [param .name ] = None
182
- else :
183
- tokens = line .split ('|' )
184
- algParams [param .name ] = \
185
- AlgorithmAndParameter (int (tokens [0 ]),
186
- tokens [1 ])
179
+ if not param .hidden :
180
+ line = lines .readline ().strip ('\n ' ).strip ('\r ' )
181
+ if line == str (None ):
182
+ algParams [param .name ] = None
183
+ else :
184
+ tokens = line .split ('|' )
185
+ algParams [param .name ] = \
186
+ AlgorithmAndParameter (int (tokens [0 ]),
187
+ tokens [1 ])
187
188
outputPos = {}
188
189
for out in alg .outputs :
189
- line = lines .readline ().strip ('\n ' ).strip ('\r ' )
190
- if str (None ) != line :
191
- if '|' in line :
192
- tokens = line .split ('|' )
193
- name = tokens [0 ]
194
- tokens = tokens [1 ].split (',' )
195
- outputPos [out .name ] = QtCore .QPointF (
196
- float (tokens [0 ]), float (tokens [1 ]))
190
+ if not out .hidden :
191
+ line = lines .readline ().strip ('\n ' ).strip ('\r ' )
192
+ if str (None ) != line :
193
+ if '|' in line :
194
+ tokens = line .split ('|' )
195
+ name = tokens [0 ]
196
+ tokens = tokens [1 ].split (',' )
197
+ outputPos [out .name ] = QtCore .QPointF (
198
+ float (tokens [0 ]), float (tokens [1 ]))
199
+ else :
200
+ name = line
201
+ outputPos [out .name ] = None
202
+ algOutputs [out .name ] = name
203
+
204
+ # We add the output to the algorithm,
205
+ # with a name indicating where it comes
206
+ # from that guarantees that the name is
207
+ # unique
208
+ output = copy .deepcopy (out )
209
+ output .description = name
210
+ output .name = self .getSafeNameForOutput (iAlg ,
211
+ output )
212
+ self .addOutput (output )
197
213
else :
198
- name = line
199
- outputPos [out .name ] = None
200
- algOutputs [out .name ] = name
201
-
202
- # We add the output to the algorithm,
203
- # with a name indicating where it comes
204
- # from that guarantees that the name is
205
- # unique
206
- output = copy .deepcopy (out )
207
- output .description = name
208
- output .name = self .getSafeNameForOutput (iAlg ,
209
- output )
210
- self .addOutput (output )
211
- else :
212
- algOutputs [out .name ] = None
214
+ algOutputs [out .name ] = None
213
215
self .outputPos .append (outputPos )
214
216
self .algOutputs .append (algOutputs )
215
217
self .algParameters .append (algParams )
@@ -467,18 +469,20 @@ def serialize(self):
467
469
else :
468
470
s += str (None ) + '\n '
469
471
for param in alg .parameters :
470
- value = self .algParameters [i ][param .name ]
471
- if value :
472
- s += value .serialize () + '\n '
473
- else :
474
- s += str (None ) + '\n '
472
+ if not param .hidden :
473
+ value = self .algParameters [i ][param .name ]
474
+ if value :
475
+ s += value .serialize () + '\n '
476
+ else :
477
+ s += str (None ) + '\n '
475
478
for out in alg .outputs :
476
- value = self .algOutputs [i ][out .name ]
477
- s += unicode (value )
478
- if value is not None :
479
- pt = self .outputPos [i ][out .name ]
480
- s += '|' + str (pt .x ()) + ',' + str (pt .y ())
481
- s += '\n '
479
+ if not out .hidden :
480
+ value = self .algOutputs [i ][out .name ]
481
+ s += unicode (value )
482
+ if value is not None :
483
+ pt = self .outputPos [i ][out .name ]
484
+ s += '|' + str (pt .x ()) + ',' + str (pt .y ())
485
+ s += '\n '
482
486
483
487
return s
484
488
@@ -489,42 +493,44 @@ def setPositions(self, paramPos, algPos, outputPos):
489
493
490
494
def prepareAlgorithm (self , alg , iAlg ):
491
495
for param in alg .parameters :
492
- aap = self .algParameters [iAlg ][param .name ]
493
- if aap is None :
494
- if isinstance (param , ParameterExtent ):
495
- value = self .getMinCoveringExtent ()
496
- if not param .setValue (value ):
497
- raise GeoAlgorithmExecutionException ('Wrong value: '
498
- + str (value ))
496
+ if not param .hidden :
497
+ aap = self .algParameters [iAlg ][param .name ]
498
+ if aap is None :
499
+ if isinstance (param , ParameterExtent ):
500
+ value = self .getMinCoveringExtent ()
501
+ if not param .setValue (value ):
502
+ raise GeoAlgorithmExecutionException ('Wrong value: '
503
+ + str (value ))
504
+ else :
505
+ param .setValue (None )
506
+ continue
507
+ if isinstance (param , ParameterMultipleInput ):
508
+ value = self .getValueFromAlgorithmAndParameter (aap )
509
+ tokens = value .split (';' )
510
+ layerslist = []
511
+ for token in tokens :
512
+ (i , paramname ) = token .split ('|' )
513
+ aap = AlgorithmAndParameter (int (i ), paramname )
514
+ value = self .getValueFromAlgorithmAndParameter (aap )
515
+ layerslist .append (str (value ))
516
+ value = ';' .join (layerslist )
499
517
else :
500
- param .setValue (None )
501
- continue
502
- if isinstance (param , ParameterMultipleInput ):
503
- value = self .getValueFromAlgorithmAndParameter (aap )
504
- tokens = value .split (';' )
505
- layerslist = []
506
- for token in tokens :
507
- (i , paramname ) = token .split ('|' )
508
- aap = AlgorithmAndParameter (int (i ), paramname )
509
518
value = self .getValueFromAlgorithmAndParameter (aap )
510
- layerslist .append (str (value ))
511
- value = ';' .join (layerslist )
512
- else :
513
- value = self .getValueFromAlgorithmAndParameter (aap )
514
-
515
- # We allow unexistent filepaths, since that allows
516
- # algorithms to skip some conversion routines
517
- if not param .setValue (value ) and not isinstance (param ,
518
- ParameterDataObject ):
519
- raise GeoAlgorithmExecutionException ('Wrong value: '
520
- + str (value ))
519
+
520
+ # We allow unexistent filepaths, since that allows
521
+ # algorithms to skip some conversion routines
522
+ if not param .setValue (value ) and not isinstance (param ,
523
+ ParameterDataObject ):
524
+ raise GeoAlgorithmExecutionException ('Wrong value: '
525
+ + str (value ))
521
526
for out in alg .outputs :
522
- val = self .algOutputs [iAlg ][out .name ]
523
- if val :
524
- name = self .getSafeNameForOutput (iAlg , out )
525
- out .value = self .getOutputFromName (name ).value
526
- else :
527
- out .value = None
527
+ if not out .hidden :
528
+ val = self .algOutputs [iAlg ][out .name ]
529
+ if val :
530
+ name = self .getSafeNameForOutput (iAlg , out )
531
+ out .value = self .getOutputFromName (name ).value
532
+ else :
533
+ out .value = None
528
534
529
535
def getMinCoveringExtent (self ):
530
536
first = True
0 commit comments