Skip to content

Commit d9eb35e

Browse files
committed
Far-reaching change to how Boolean parameters are handled
This is a far-reaching change to how Boolean parameters are handled. Boolean type tool parameters previously worked simply by the presence of the parameter flag. This was causing problems with some WBT front-ends, particularly QGIS, where the parameters were being provided to WBT as --flag=False. In this case, because the flag was present, it was assumed to be True. All tools that have boolean parameters have been updated to handle the case of --flag=False. This is a widespread modification that should fix the unexpected behaviour of many tools in certain front-ends.
1 parent 62d99f0 commit d9eb35e

97 files changed

Lines changed: 530 additions & 266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

0 Bytes
Binary file not shown.

readme.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ for more details.
5858

5959
Version 1.0.1 (XX-XX-2019)
6060
- Fixed a minor bug with the VectorPolygonToRaster tool.
61+
- Fixed a bug in the DownstreamDistanceToStream tool.
62+
- Boolean type tool parameters previously worked simply by the presence of the parameter flag.
63+
This was causing problems with some WBT front-ends, particularly QGIS, where the parameters
64+
were being provided to WBT as --flag=False. In this case, because the flag was present, it
65+
was assumed to be True. All tools that have boolean parameters have been updated to handle
66+
the case of --flag=False. This is a widespread modification that should fix the unexpected
67+
behaviour of many tools in certain front-ends.
6168

6269
Version 1.0.0 (29-09-2019)
6370
- Added support for reading and writing the BigTIFF format. This has resulted in numerous changes

src/tools/data_tools/export_table_to_csv.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 24/04/2018
5-
Last Modified: 12/10/2018
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -163,7 +163,9 @@ impl WhiteboxTool for ExportTableToCsv {
163163
args[i + 1].to_string()
164164
};
165165
} else if flag_val == "-headers" {
166-
headers = true;
166+
if !vec[1].to_string().to_lowercase().contains("false") {
167+
headers = true;
168+
}
167169
}
168170
}
169171

src/tools/data_tools/multipart_to_singlepart.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 27/09/2018
5-
Last Modified: 12/10/2018
5+
Last Modified: 17/10/2019
66
License: MIT
77
*/
88

@@ -172,7 +172,9 @@ impl WhiteboxTool for MultiPartToSinglePart {
172172
args[i + 1].to_string()
173173
};
174174
} else if flag_val.contains("-exc") || flag_val.contains("hole") {
175-
exclude_holes = true;
175+
if !vec[1].to_string().to_lowercase().contains("false") {
176+
exclude_holes = true;
177+
}
176178
}
177179
}
178180

src/tools/data_tools/vector_lines_to_raster.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 18/04/2018
5-
Last Modified: 12/10/2018
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -229,7 +229,9 @@ impl WhiteboxTool for VectorLinesToRaster {
229229
args[i + 1].to_string()
230230
};
231231
} else if flag_val == "-nodata" {
232-
background_val = nodata;
232+
if !vec[1].to_string().to_lowercase().contains("false") {
233+
background_val = nodata;
234+
}
233235
}
234236
}
235237

src/tools/data_tools/vector_points_to_raster.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 19/04/2018
5-
Last Modified: 12/10/2018
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -234,7 +234,9 @@ impl WhiteboxTool for VectorPointsToRaster {
234234
args[i + 1].to_string()
235235
};
236236
} else if flag_val == "-nodata" {
237-
background_val = nodata;
237+
if !vec[1].to_string().to_lowercase().contains("false") {
238+
background_val = nodata;
239+
}
238240
} else if flag_val == "-assign" {
239241
assign_op = if keyval {
240242
vec[1].to_lowercase()

src/tools/data_tools/vector_polygons_to_raster.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 17/04/2018
5-
Last Modified: 17/07/2019
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -207,7 +207,9 @@ impl WhiteboxTool for VectorPolygonsToRaster {
207207
args[i + 1].to_string()
208208
};
209209
} else if flag_val == "-nodata" {
210-
background_val = nodata;
210+
if !vec[1].to_string().to_lowercase().contains("false") {
211+
background_val = nodata;
212+
}
211213
}
212214
}
213215

src/tools/gis_analysis/block_maximum.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 09/10/2018
5-
Last Modified: 13/10/2018
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -184,7 +184,9 @@ impl WhiteboxTool for BlockMaximumGridding {
184184
args[i + 1].to_string()
185185
};
186186
} else if flag_val == "-use_z" {
187-
use_z = true;
187+
if !vec[1].to_string().to_lowercase().contains("false") {
188+
use_z = true;
189+
}
188190
} else if flag_val == "-o" || flag_val == "-output" {
189191
output_file = if keyval {
190192
vec[1].to_string()

src/tools/gis_analysis/block_minimum.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 09/10/2018
5-
Last Modified: 13/10/2018
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -184,7 +184,9 @@ impl WhiteboxTool for BlockMinimumGridding {
184184
args[i + 1].to_string()
185185
};
186186
} else if flag_val == "-use_z" {
187-
use_z = true;
187+
if !vec[1].to_string().to_lowercase().contains("false") {
188+
use_z = true;
189+
}
188190
} else if flag_val == "-o" || flag_val == "-output" {
189191
output_file = if keyval {
190192
vec[1].to_string()

src/tools/gis_analysis/buffer_raster.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This tool is part of the WhiteboxTools geospatial analysis library.
33
Authors: Dr. John Lindsay
44
Created: 22/06/2017
5-
Last Modified: 13/10/2018
5+
Last Modified: 18/10/2019
66
License: MIT
77
*/
88

@@ -193,7 +193,9 @@ impl WhiteboxTool for BufferRaster {
193193
} else if vec[0].to_lowercase() == "-gridcells"
194194
|| vec[0].to_lowercase() == "--gridcells"
195195
{
196-
grid_cell_units = true;
196+
if !vec[1].to_string().to_lowercase().contains("false") {
197+
grid_cell_units = true;
198+
}
197199
}
198200
}
199201

0 commit comments

Comments
 (0)