-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Represent cell size units as a Quantity
This fixes a bug where the UI indicated that the cell size units were always in meters but in actuality the cell size units would correspond to the target CRS specified in the resampling parameters/GDAL warp. Add a combo box selection for cell size units in the importer UI to reduce confusion about which cell size units are being applied.
- Loading branch information
Tom Brauer
committed
Jun 27, 2024
1 parent
27770dc
commit 44657ed
Showing
12 changed files
with
177 additions
and
72 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
vortex-api/src/main/java/mil/army/usace/hec/vortex/geo/CellSizeUnits.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package mil.army.usace.hec.vortex.geo; | ||
|
||
import javax.measure.Unit; | ||
import javax.measure.quantity.Length; | ||
|
||
import static systems.uom.common.USCustomary.FOOT; | ||
import static tech.units.indriya.unit.Units.METRE; | ||
|
||
public enum CellSizeUnits { | ||
METERS("Meters", METRE), | ||
FEET("Feet", FOOT); | ||
|
||
private final String displayString; | ||
private final Unit<Length> units; | ||
|
||
CellSizeUnits(String displayString, Unit<Length> units) { | ||
this.displayString = displayString; | ||
this.units = units; | ||
} | ||
|
||
public static CellSizeUnits of(String displayString) { | ||
for (CellSizeUnits value : values()) { | ||
if (value.displayString.equals(displayString)) { | ||
return value; | ||
} | ||
} | ||
throw new IllegalArgumentException("display string not recognized"); | ||
} | ||
|
||
public static String[] getDisplayStrings() { | ||
CellSizeUnits[] values = values(); | ||
String[] displayStrings = new String[values.length]; | ||
for (int i = 0; i < values.length; i++) { | ||
displayStrings[i] = values[i].displayString; | ||
} | ||
return displayStrings; | ||
} | ||
|
||
public Unit<Length> getUnits() { | ||
return units; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
vortex-ui/src/main/java/mil/army/usace/hec/vortex/ui/CellSizeUnitsComboBox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package mil.army.usace.hec.vortex.ui; | ||
|
||
import mil.army.usace.hec.vortex.geo.CellSizeUnits; | ||
|
||
import javax.swing.*; | ||
|
||
public class CellSizeUnitsComboBox extends JComboBox<String> { | ||
|
||
public CellSizeUnitsComboBox() { | ||
setModel(new DefaultComboBoxModel<>(CellSizeUnits.getDisplayStrings())); | ||
} | ||
} |
Oops, something went wrong.