Skip to content

Commit 08d6c37

Browse files
authored
Fix bugs from 100.8 regressions testing (#578)
* Remove empty cell from listview * Add css colours to labels * Set viewshed colours * Update screenshot * Set the frustum visibility * Update style.css * Add checkbox css * Rename boolean
1 parent 2bd443c commit 08d6c37

File tree

6 files changed

+28
-52
lines changed

6 files changed

+28
-52
lines changed
-8.05 KB
Loading

analysis/viewshed-location/src/main/java/com/esri/samples/viewshed_location/ViewshedLocationController.java

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
import javafx.event.EventHandler;
2323
import javafx.fxml.FXML;
2424
import javafx.geometry.Point2D;
25-
import javafx.scene.control.ColorPicker;
2625
import javafx.scene.control.Slider;
2726
import javafx.scene.control.ToggleButton;
2827
import javafx.scene.input.MouseButton;
2928
import javafx.scene.input.MouseEvent;
30-
import javafx.scene.paint.Color;
3129

3230
import com.esri.arcgisruntime.geoanalysis.LocationViewshed;
3331
import com.esri.arcgisruntime.geoanalysis.Viewshed;
@@ -54,9 +52,6 @@ public class ViewshedLocationController {
5452
@FXML private Slider verticalAngleSlider;
5553
@FXML private Slider minDistanceSlider;
5654
@FXML private Slider maxDistanceSlider;
57-
@FXML private ColorPicker visibleColorPicker;
58-
@FXML private ColorPicker obstructedColorPicker;
59-
@FXML private ColorPicker frustumColorPicker;
6055

6156
public void initialize() {
6257
// create a scene and add a basemap to it
@@ -81,6 +76,12 @@ public void initialize() {
8176
LocationViewshed viewshed = new LocationViewshed(location, headingSlider.getValue(), pitchSlider.getValue(),
8277
horizontalAngleSlider.getValue(), verticalAngleSlider.getValue(), minDistanceSlider.getValue(),
8378
maxDistanceSlider.getValue());
79+
// set the colors of the visible and obstructed areas
80+
Viewshed.setVisibleColor(0xCC00FF00);
81+
Viewshed.setObstructedColor(0xCCFF0000);
82+
// set the color and show the frustum outline
83+
Viewshed.setFrustumOutlineColor(0xCC0000FF);
84+
viewshed.setFrustumOutlineVisible(true);
8485

8586
// set the camera
8687
Camera camera = new Camera(location, 200.0, 20.0, 70.0, 0.0);
@@ -146,32 +147,6 @@ public void handle(MouseEvent event) {
146147
// distance sliders
147148
minDistanceSlider.valueProperty().addListener(e -> viewshed.setMinDistance(minDistanceSlider.getValue()));
148149
maxDistanceSlider.valueProperty().addListener(e -> viewshed.setMaxDistance(maxDistanceSlider.getValue()));
149-
// colors
150-
visibleColorPicker.setValue(Color.rgb(0, 255, 0, 0.8));
151-
visibleColorPicker.valueProperty().addListener(e -> Viewshed.setVisibleColor(colorToInt(visibleColorPicker
152-
.getValue())));
153-
obstructedColorPicker.setValue(Color.rgb(255, 0, 0, 0.8));
154-
obstructedColorPicker.valueProperty().addListener(e -> Viewshed.setObstructedColor(colorToInt(obstructedColorPicker
155-
.getValue())));
156-
frustumColorPicker.setValue(Color.rgb(0, 0, 255, 0.8));
157-
frustumColorPicker.valueProperty().addListener(e -> Viewshed.setFrustumOutlineColor(colorToInt(frustumColorPicker
158-
.getValue())));
159-
}
160-
161-
/**
162-
* Parses a Color into an ARGB integer.
163-
*
164-
* @param c color
165-
* @return integer representation of the color
166-
*/
167-
private int colorToInt(Color c) {
168-
String hex = String.format("0x%02X%02X%02X%02X",
169-
(int)(c.getOpacity() * 255),
170-
(int)(c.getRed() * 255),
171-
(int)(c.getGreen() * 255),
172-
(int)(c.getBlue() * 255)
173-
);
174-
return Long.decode(hex).intValue();
175150
}
176151

177152
/**
@@ -183,5 +158,4 @@ void terminate() {
183158
sceneView.dispose();
184159
}
185160
}
186-
187161
}

analysis/viewshed-location/src/main/resources/viewshed_location/main.fxml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
~ the License.
1616
-->
1717

18-
<?import javafx.scene.control.ColorPicker?>
1918
<?import javafx.scene.control.Label?>
2019
<?import javafx.scene.control.Slider?>
2120
<?import javafx.scene.control.ToggleButton?>
@@ -29,7 +28,7 @@
2928
prefHeight="450.0" prefWidth="600.0" stylesheets="/viewshed_location/style.css">
3029
<SceneView fx:id="sceneView"/>
3130
<GridPane StackPane.alignment="TOP_LEFT" pickOnBounds="false" styleClass="panel-region" maxWidth="300"
32-
maxHeight="460" hgap="10" vgap="10">
31+
maxHeight="300" hgap="10" vgap="10">
3332
<padding>
3433
<Insets topRightBottomLeft="10"/>
3534
</padding>
@@ -48,7 +47,7 @@
4847
<ToggleButton fx:id="visibilityToggle" selected="true" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
4948

5049
<Label text="Frustum" GridPane.rowIndex="1" GridPane.columnIndex="0"/>
51-
<ToggleButton fx:id="frustumToggle" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
50+
<ToggleButton fx:id="frustumToggle" selected="true" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
5251

5352
<Label text="Heading" GridPane.rowIndex="2" GridPane.columnIndex="0"/>
5453
<Slider fx:id="headingSlider" value="10" max="360" GridPane.rowIndex="2" GridPane.columnIndex="1"
@@ -73,14 +72,5 @@
7372
<Label text="Max Distance" GridPane.rowIndex="7" GridPane.columnIndex="0"/>
7473
<Slider fx:id="maxDistanceSlider" min="1" max="2000" value="500" GridPane.rowIndex="7"
7574
GridPane.columnIndex="1" showTickLabels="true" majorTickUnit="Infinity"/>
76-
77-
<Label text="Visible Color" GridPane.rowIndex="8" GridPane.columnIndex="0"/>
78-
<ColorPicker fx:id="visibleColorPicker" GridPane.rowIndex="8" GridPane.columnIndex="1"/>
79-
80-
<Label text="Obstructed Color" GridPane.rowIndex="9" GridPane.columnIndex="0"/>
81-
<ColorPicker fx:id="obstructedColorPicker" GridPane.rowIndex="9" GridPane.columnIndex="1"/>
82-
83-
<Label text="Frustum Outline Color" GridPane.rowIndex="10" GridPane.columnIndex="0"/>
84-
<ColorPicker fx:id="frustumColorPicker" GridPane.rowIndex="10" GridPane.columnIndex="1"/>
8575
</GridPane>
8676
</StackPane>

display_information/control-annotation-sublayer-visibility/src/main/java/com/esri/samples/control_annotation_sublayer_visibility/ControlAnnotationSublayerVisibilitySample.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public void start(Stage stage) {
5353
// create stack pane and application scene
5454
StackPane stackPane = new StackPane();
5555
Scene scene = new Scene(stackPane);
56+
scene.getStylesheets().add(getClass().getResource("/control_annotation_sublayer_visibility/style.css").toExternalForm());
5657

5758
// set title, size, and add scene to stage
5859
stage.setTitle("Control Annotation Sublayer Visibility");
@@ -67,10 +68,8 @@ public void start(Stage stage) {
6768
// create checkboxes for toggling the sublayer visibility manually
6869
CheckBox closedSublayerCheckbox = new CheckBox();
6970
closedSublayerCheckbox.setSelected(true);
70-
closedSublayerCheckbox.setTextFill(Color.WHITE);
7171
CheckBox openSublayerCheckbox = new CheckBox();
7272
openSublayerCheckbox.setSelected(true);
73-
openSublayerCheckbox.setTextFill(Color.DARKGRAY);
7473

7574
// create a control panel and label for the checkboxes
7675
VBox controlsVBox = new VBox(6);
@@ -82,7 +81,6 @@ public void start(Stage stage) {
8281

8382
// show current map scale in a label within the control panel
8483
Label currentMapScaleLabel = new Label();
85-
currentMapScaleLabel.setTextFill(Color.WHITE);
8684
mapView.addMapScaleChangedListener(mapScaleChangedEvent ->
8785
currentMapScaleLabel.setText("Scale: 1:" + Math.round(mapView.getMapScale()))
8886
);
@@ -120,9 +118,9 @@ public void start(Stage stage) {
120118
// gray out the open sublayer when the layer is out of scale
121119
mapView.addMapScaleChangedListener(mapScaleChangedEvent -> {
122120
if (openSublayer.isVisibleAtScale(mapView.getMapScale())) {
123-
openSublayerCheckbox.setTextFill(Color.WHITE);
121+
openSublayerCheckbox.setStyle("-fx-text-fill: white");
124122
} else {
125-
openSublayerCheckbox.setTextFill(Color.DARKGRAY);
123+
openSublayerCheckbox.setStyle("-fx-text-fill: darkgrey");
126124
}
127125
});
128126

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.panel-region .label {
2+
-fx-text-fill: white;
3+
}
4+
5+
#openSublayerCheckbox {
6+
-fx-text-fill: darkgrey;
7+
}
8+
9+
#closedSublayerCheckbox {
10+
-fx-text-fill: white;
11+
}

geometry/list-transformations-by-suitability/src/main/java/com/esri/samples/list_transformations_by_suitability/ListTransformationsBySuitabilitySample.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ public void start(Stage stage) {
100100
transformationsListView.setCellFactory(list -> new ListCell<DatumTransformation>() {
101101

102102
@Override
103-
protected void updateItem(DatumTransformation transformation, boolean bln) {
103+
protected void updateItem(DatumTransformation transformation, boolean isEmpty) {
104104

105-
super.updateItem(transformation, bln);
106-
if (transformation != null) {
105+
super.updateItem(transformation, isEmpty);
106+
if (isEmpty) {
107+
setText(null);
108+
}
109+
else if (transformation != null) {
107110
setText(transformation.getName());
108111
}
109112
}

0 commit comments

Comments
 (0)