Skip to content

Commit

Permalink
Added retrieval and updated all pciker elements to WaterWayForm
Browse files Browse the repository at this point in the history
  • Loading branch information
jparrell committed Apr 7, 2021
1 parent 2616290 commit e30ecc1
Showing 1 changed file with 83 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,64 @@ private void setupForm() {
array_subSize.add("14: Large(4\" or larger)");
array_subSize.add("10: Medium(1\" to 4\")");
array_subSize.add("6: Small(.25\" to 1\")");

array_subSize.add("0: Fine(granular)");


FormElementPickerSingle subSize = FormElementPickerSingle.createInstance().setTitle("Substrate Size").setOptions(array_subSize).setPickerTitle("Pick one option");
FormElementTextNumber smothering = FormElementTextNumber.createInstance().setTitle("Smothering").setValue("0");
FormElementTextNumber silting = FormElementTextNumber.createInstance().setTitle("Silting").setValue("0");
FormElementTextNumber rootwads = FormElementTextNumber.createInstance().setTitle("Rootwads").setValue("0");
FormElementTextNumber overhangingVeg = FormElementTextNumber.createInstance().setTitle("Overhanging Veg.").setValue("0");
FormElementTextNumber oxbows = FormElementTextNumber.createInstance().setTitle("Oxbows/Black Waters").setValue("0");
FormElementTextNumber downed = FormElementTextNumber.createInstance().setTitle("Downed Trees/Logs").setValue("0");
FormElementTextNumber shallows = FormElementTextNumber.createInstance().setTitle("Shallows (slow water)").setValue("0");
FormElementTextNumber waterPlants = FormElementTextNumber.createInstance().setTitle("Water Plants").setValue("0");
FormElementTextNumber deepPools = FormElementTextNumber.createInstance().setTitle("Deep Pools").setValue("0");
FormElementTextNumber logs = FormElementTextNumber.createInstance().setTitle("Logs/Woody Debris").setValue("0");
FormElementTextNumber boulders = FormElementTextNumber.createInstance().setTitle("Boulders").setValue("0");
FormElementTextNumber undercutBanks = FormElementTextNumber.createInstance().setTitle("Undercut Banks").setValue("0");
FormElementTextNumber sinuosity = FormElementTextNumber.createInstance().setTitle("Sinuosity").setValue("0");
FormElementTextNumber natural = FormElementTextNumber.createInstance().setTitle("Natural").setValue("0");
FormElementTextNumber riparianWidth = FormElementTextNumber.createInstance().setTitle("Riparian Width").setValue("0");
FormElementTextNumber landUse = FormElementTextNumber.createInstance().setTitle("Land Use").setValue("0");
FormElementTextNumber bankErosion = FormElementTextNumber.createInstance().setTitle("Bank Erosion").setValue("0");
List<String> array_yesNo5 = new ArrayList<>();
array_yesNo5.add("0: Yes");
array_yesNo5.add("5: No");

List<String> array_yesNo2 = new ArrayList<>();
array_yesNo2.add("2: Yes");
array_yesNo2.add("0: No");

List<String> array_sinuosity = new ArrayList<>();
array_sinuosity.add("8: Two or more bends");
array_sinuosity.add("3: Less than two bends");

List<String> array_natural = new ArrayList<>();
array_natural.add("12: Mostly Natural");
array_natural.add("9: Minor Man-made impacts");
array_natural.add("6: Many Man-made changes");
array_natural.add("0: Completely Manipulated");

List<String> array_riparian = new ArrayList<>();
array_riparian.add("8: Wide (20' or more)");
array_riparian.add("5: Narrow (Less than 20')");
array_riparian.add("0: None");

List<String> array_landUse = new ArrayList<>();
array_landUse.add("5: Forest/Wetland");
array_landUse.add("4: Shrub");
array_landUse.add("3: Overgrown Fields");
array_landUse.add("2: Fenced Pasture");
array_landUse.add("2: Parkland/Grass");
array_landUse.add("2: Conservation Tillage");
array_landUse.add("1: Row Crop");
array_landUse.add("0: Open Pasture");
array_landUse.add("0: Urban/Industrial");

List<String> array_bankErosion = new ArrayList<>();
array_bankErosion.add("4: None/Little");
array_bankErosion.add("2: Moderate");
array_bankErosion.add("0: Heavy/Severe");
FormElementPickerSingle smothering = FormElementPickerSingle.createInstance().setTitle("Smothering").setOptions(array_yesNo5).setPickerTitle("Pick one option");
FormElementPickerSingle silting = FormElementPickerSingle.createInstance().setTitle("Silting").setOptions(array_yesNo5).setPickerTitle("Pick one option");
FormElementPickerSingle rootwads = FormElementPickerSingle.createInstance().setTitle("Rootwads").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle overhangingVeg = FormElementPickerSingle.createInstance().setTitle("Overhanging Veg.").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle oxbows = FormElementPickerSingle.createInstance().setTitle("Oxbows/Black Waters").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle downed = FormElementPickerSingle.createInstance().setTitle("Downed Trees/Logs").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle shallows = FormElementPickerSingle.createInstance().setTitle("Shallows (slow water)").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle waterPlants = FormElementPickerSingle.createInstance().setTitle("Water Plants").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle deepPools = FormElementPickerSingle.createInstance().setTitle("Deep Pools").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle logs = FormElementPickerSingle.createInstance().setTitle("Logs/Woody Debris").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle boulders = FormElementPickerSingle.createInstance().setTitle("Boulders").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle undercutBanks = FormElementPickerSingle.createInstance().setTitle("Undercut Banks").setOptions(array_yesNo2).setPickerTitle("Pick one option");
FormElementPickerSingle sinuosity = FormElementPickerSingle.createInstance().setTitle("Sinuosity").setOptions(array_sinuosity).setPickerTitle("Pick one option");
FormElementPickerSingle natural = FormElementPickerSingle.createInstance().setTitle("Natural").setOptions(array_natural).setPickerTitle("Pick one option");
FormElementPickerSingle riparianWidth = FormElementPickerSingle.createInstance().setTitle("Riparian Width").setOptions(array_riparian).setPickerTitle("Pick one option");
FormElementPickerSingle landUse = FormElementPickerSingle.createInstance().setTitle("Land Use").setOptions(array_landUse).setPickerTitle("Pick one option");
FormElementPickerSingle bankErosion = FormElementPickerSingle.createInstance().setTitle("Bank Erosion").setOptions(array_bankErosion).setPickerTitle("Pick one option");


List<BaseFormElement> formItems = new ArrayList<>();
Expand All @@ -116,35 +152,40 @@ private void setupForm() {
formItems.add(bankErosion);

formBuilder.addFormElements(formItems);
int index = subSize.getValue().indexOf(":");
subVal = pickerValue(subSize);

smothVal = pickerValue(smothering);
siltVal = pickerValue(silting);
rootVal = pickerValue(rootwads);
overVegVal = pickerValue(overhangingVeg);
oxVal = pickerValue(oxbows);
downVal = pickerValue(downed);
shallowVal = pickerValue(shallows);
watVal = pickerValue(waterPlants);
deepVal = pickerValue(deepPools);
logVal = pickerValue(logs);
bouldVal = pickerValue(boulders);
underVal = pickerValue(undercutBanks);
sinVal = pickerValue(sinuosity);
natVal = pickerValue(natural);
ripVal = pickerValue(riparianWidth);
landVal = pickerValue(landUse);
bankVal = pickerValue(bankErosion);


}
private double pickerValue(FormElementPickerSingle var){
int index = var.getValue().indexOf(":");
double pickerOption;
if (index > 0)
{
subVal = Double.parseDouble(subSize.getValue().substring(0,index));
pickerOption = Double.parseDouble(var.getValue().substring(0,index));
}
else
{
subVal = 0;
pickerOption = 0;
}

smothVal = Double.parseDouble(smothering.getValue());
siltVal = Double.parseDouble(silting.getValue());
rootVal = Double.parseDouble(rootwads.getValue());
overVegVal = Double.parseDouble(overhangingVeg.getValue());
oxVal = Double.parseDouble(oxbows.getValue());
downVal = Double.parseDouble(downed.getValue());
shallowVal = Double.parseDouble(shallows.getValue());
watVal = Double.parseDouble(waterPlants.getValue());
deepVal = Double.parseDouble(deepPools.getValue());
logVal = Double.parseDouble(logs.getValue());
bouldVal = Double.parseDouble(boulders.getValue());
underVal = Double.parseDouble(undercutBanks.getValue());
sinVal = Double.parseDouble(sinuosity.getValue());
natVal = Double.parseDouble(natural.getValue());
ripVal = Double.parseDouble(riparianWidth.getValue());
landVal = Double.parseDouble(landUse.getValue());
bankVal = Double.parseDouble(bankErosion.getValue());


return(pickerOption);
}
private void setupTolerantForm(){
formBuilder = new FormBuilder(this, recyclerView);
Expand Down

0 comments on commit e30ecc1

Please sign in to comment.