@@ -81,6 +81,32 @@ def test_directions_lines(self):
81
81
feat_length = next (processed_layer .getFeatures ()).geometry ().length ()
82
82
self .assertTrue (feat_length > 0 )
83
83
84
+ def test_directions_lines_opti (self ):
85
+ parameters = {
86
+ "INPUT_AVOID_BORDERS" : None ,
87
+ "INPUT_AVOID_COUNTRIES" : "" ,
88
+ "INPUT_AVOID_FEATURES" : [],
89
+ "INPUT_AVOID_POLYGONS" : None ,
90
+ "INPUT_LAYER_FIELD" : None ,
91
+ "INPUT_LINE_LAYER" : self .line_layer ,
92
+ "INPUT_OPTIMIZE" : 0 ,
93
+ "INPUT_PREFERENCE" : 0 ,
94
+ "INPUT_PROFILE" : 0 ,
95
+ "INPUT_PROVIDER" : 0 ,
96
+ "INPUT_METRIC" : 0 ,
97
+ "LOCATION_TYPE" : 0 ,
98
+ "OUTPUT" : "TEMPORARY_OUTPUT" ,
99
+ }
100
+
101
+ directions = ORSDirectionsLinesAlgo ().create ()
102
+ dest_id = directions .processAlgorithm (parameters , self .context , self .feedback )
103
+ processed_layer = QgsProcessingUtils .mapLayerFromString (dest_id ["OUTPUT" ], self .context )
104
+
105
+ self .assertEqual (type (processed_layer ), QgsVectorLayer )
106
+
107
+ feat_length = next (processed_layer .getFeatures ()).geometry ().length ()
108
+ self .assertTrue (feat_length > 0 )
109
+
84
110
def test_directions_points_layer (self ):
85
111
parameters = {
86
112
"INPUT_AVOID_BORDERS" : None ,
@@ -108,6 +134,33 @@ def test_directions_points_layer(self):
108
134
109
135
return processed_layer
110
136
137
+ def test_directions_points_layer_optimization (self ):
138
+ parameters = {
139
+ "INPUT_AVOID_BORDERS" : None ,
140
+ "INPUT_AVOID_COUNTRIES" : "" ,
141
+ "INPUT_AVOID_FEATURES" : [],
142
+ "INPUT_AVOID_POLYGONS" : None ,
143
+ "INPUT_LAYER_FIELD" : None ,
144
+ "INPUT_OPTIMIZE" : 1 ,
145
+ "INPUT_POINT_LAYER" : self .point_layer_1 ,
146
+ "INPUT_PREFERENCE" : 0 ,
147
+ "INPUT_PROFILE" : 0 ,
148
+ "INPUT_PROVIDER" : 0 ,
149
+ "INPUT_SORTBY" : None ,
150
+ "OUTPUT" : "TEMPORARY_OUTPUT" ,
151
+ }
152
+
153
+ directions = ORSDirectionsPointsLayerAlgo ().create ()
154
+ dest_id = directions .processAlgorithm (parameters , self .context , self .feedback )
155
+ processed_layer = QgsProcessingUtils .mapLayerFromString (dest_id ["OUTPUT" ], self .context )
156
+
157
+ self .assertEqual (type (processed_layer ), QgsVectorLayer )
158
+
159
+ feat_length = next (processed_layer .getFeatures ()).geometry ().length ()
160
+ self .assertTrue (feat_length > 0 )
161
+
162
+ return processed_layer
163
+
111
164
def test_directions_points_layers (self ):
112
165
parameters = {
113
166
"INPUT_AVOID_BORDERS" : None ,
0 commit comments