Skip to content

Commit

Permalink
Layer visible state (#544)
Browse files Browse the repository at this point in the history
-  event handling of (global) layer(s) visible state corrected
- version number increased v20250105
  • Loading branch information
loesler authored Jan 5, 2025
1 parent 4efed88 commit c8902bb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ public LayersVisibleChangeListener(CheckBox checkBox, Set<Layer> layerSet) {

@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (!ignoreVisibleEvent)
updateLayerVisibleState(newValue);
}

private void updateLayerVisibleState(boolean select) {
try {
ignoreVisibleEvent = true;
for (Layer layer : layerSet)
layer.setVisible(newValue);
this.checkBox.setSelected(newValue);
layer.setVisible(select);
this.checkBox.setSelected(select);
}
finally {
ignoreVisibleEvent = false;
Expand Down Expand Up @@ -458,36 +463,42 @@ private void save() {
}

private void updateGlobalLayerVisibleState(LayerType type) {
int numberOfVisibleLayers = 0;
switch (type) {
case NEW_POINT_APRIORI:
case DATUM_POINT_APRIORI:
case STOCHASTIC_POINT_APRIORI:
case REFERENCE_POINT_APRIORI:
case OBSERVATION_APRIORI:
for (Layer layer : this.aPrioriLayerSet) {
if (layer.isVisible())
numberOfVisibleLayers++;
}
this.allAprioriLayersVisibleCheckBox.setSelected(this.aPrioriLayerSet.size() == numberOfVisibleLayers);
this.allAprioriLayersVisibleCheckBox.setIndeterminate(numberOfVisibleLayers > 0 && numberOfVisibleLayers < this.aPrioriLayerSet.size());

break;
case NEW_POINT_APOSTERIORI:
case DATUM_POINT_APOSTERIORI:
case STOCHASTIC_POINT_APOSTERIORI:
case REFERENCE_POINT_APOSTERIORI:
case OBSERVATION_APOSTERIORI:
for (Layer layer : this.aPosterioriLayerSet) {
if (layer.isVisible())
numberOfVisibleLayers++;
}
this.allAPosterioriLayersVisibleCheckBox.setSelected(this.aPosterioriLayerSet.size() == numberOfVisibleLayers);
this.allAPosterioriLayersVisibleCheckBox.setIndeterminate(numberOfVisibleLayers > 0 && numberOfVisibleLayers < this.aPosterioriLayerSet.size());
try {
this.ignoreVisibleEvent = true;
int numberOfVisibleLayers = 0;
switch (type) {
case NEW_POINT_APRIORI:
case DATUM_POINT_APRIORI:
case STOCHASTIC_POINT_APRIORI:
case REFERENCE_POINT_APRIORI:
case OBSERVATION_APRIORI:
for (Layer layer : this.aPrioriLayerSet) {
if (layer.isVisible())
numberOfVisibleLayers++;
}
this.allAprioriLayersVisibleCheckBox.setSelected(this.aPrioriLayerSet.size() == numberOfVisibleLayers);
this.allAprioriLayersVisibleCheckBox.setIndeterminate(numberOfVisibleLayers > 0 && numberOfVisibleLayers < this.aPrioriLayerSet.size());

break;
default:
break;
break;
case NEW_POINT_APOSTERIORI:
case DATUM_POINT_APOSTERIORI:
case STOCHASTIC_POINT_APOSTERIORI:
case REFERENCE_POINT_APOSTERIORI:
case OBSERVATION_APOSTERIORI:
for (Layer layer : this.aPosterioriLayerSet) {
if (layer.isVisible())
numberOfVisibleLayers++;
}
this.allAPosterioriLayersVisibleCheckBox.setSelected(this.aPosterioriLayerSet.size() == numberOfVisibleLayers);
this.allAPosterioriLayersVisibleCheckBox.setIndeterminate(numberOfVisibleLayers > 0 && numberOfVisibleLayers < this.aPosterioriLayerSet.size());

break;
default:
break;
}
}
finally {
this.ignoreVisibleEvent = false;
}
}

Expand Down
2 changes: 1 addition & 1 deletion JAG3D/src/org/applied_geodesy/version/jag3d/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Version {
private final static Map<VersionType, Integer> versions = Map.of(
VersionType.ADJUSTMENT_CORE, 20231208,
VersionType.DATABASE, 20240417,
VersionType.USER_INTERFACE, 20250102
VersionType.USER_INTERFACE, 20250105
);

private Version() {}
Expand Down

0 comments on commit c8902bb

Please sign in to comment.