Skip to content
Snippets Groups Projects
Commit 1146c286 authored by Daniel Schramm's avatar Daniel Schramm
Browse files

Heatmap check-boxes replaced with dropdown menu

parent af107f3e
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,7 @@ public class DistanceAction extends ControlPanelAction {
private final Map<FeaturePointType, Double> featurePointTypes;
private String strategy = DistancePanel.STRATEGY_POINT_TO_POINT;
private boolean relativeDist = false;
private boolean weightedDist = false;
private boolean heatmapRender = false;
private String heatmapDisplayed = DistancePanel.HEATMAP_HAUSDORFF_DISTANCE;
private boolean weightedFPsShow = true;
private Map<MeshFacet, List<Double>> weightedHausdorffDistance = null;
......@@ -139,7 +138,7 @@ public class DistanceAction extends ControlPanelAction {
}
updateHausdorffDistanceInformation();
getSecondaryDrawableFace().setRenderHeatmap(heatmapRender);
getSecondaryDrawableFace().setRenderHeatmap(isHeatmapDisplayed());
} else {
weightedFeaturePoints.hide();
}
......@@ -152,12 +151,10 @@ public class DistanceAction extends ControlPanelAction {
final String action = ae.getActionCommand();
switch (action) {
case DistancePanel.ACTION_COMMAND_SHOW_HIDE_HEATMAP:
heatmapRender = ((JToggleButton) ae.getSource()).isSelected();
if (heatmapRender) {
updateHausdorffDistanceInformation();
}
getSecondaryDrawableFace().setRenderHeatmap(heatmapRender);
case DistancePanel.ACTION_COMMAND_SET_DISPLAYED_HEATMAP:
heatmapDisplayed = (String) ((JComboBox) ae.getSource()).getSelectedItem();
updateHausdorffDistanceInformation();
getSecondaryDrawableFace().setRenderHeatmap(isHeatmapDisplayed());
break;
case DistancePanel.ACTION_COMMAND_SHOW_HIDE_WEIGHTED_FPOINTS:
weightedFPsShow = ((JToggleButton) ae.getSource()).isSelected();
......@@ -189,10 +186,6 @@ public class DistanceAction extends ControlPanelAction {
case DistancePanel.ACTION_COMMAND_FEATURE_POINT_RESIZE:
resizeFeaturePoint((LoadedActionEvent) ae);
break;
case DistancePanel.ACTION_COMMAND_WEIGHTED_DISTANCE:
this.weightedDist = ((JToggleButton) ae.getSource()).isSelected();
updateHausdorffDistanceInformation();
break;
case DistancePanel.ACTION_COMMAND_DISTANCE_RECOMPUTE:
this.visitor = null; // recompute
updateHausdorffDistanceInformation();
......@@ -218,7 +211,20 @@ public class DistanceAction extends ControlPanelAction {
setHausdorffDistanceStatistics();
}
getSecondaryDrawableFace().setHeatMap(weightedDist ? weightedHausdorffDistance : visitor.getDistances());
final Map<MeshFacet, List<Double>> heatmap;
switch (heatmapDisplayed) {
case DistancePanel.HEATMAP_HAUSDORFF_DISTANCE:
heatmap = visitor.getDistances();
break;
case DistancePanel.HEATMAP_WEIGHTED_HAUSDORFF_DISTANCE:
heatmap = weightedHausdorffDistance;
break;
case DistancePanel.HEATMAP_HIDE:
return;
default:
throw new UnsupportedOperationException(heatmapDisplayed);
}
getSecondaryDrawableFace().setHeatMap(heatmap);
}
/**
......@@ -318,6 +324,15 @@ public class DistanceAction extends ControlPanelAction {
);
}
/**
* Returns {@code true} if the heatmap is displayed and {@code false} otherwise.
*
* @return {@code true} if the heatmap is displayed, {@code false} otherwise
*/
private boolean isHeatmapDisplayed() {
return !DistancePanel.HEATMAP_HIDE.equals(heatmapDisplayed);
}
/**
* Changes the color of the secondary face's feature point at the given index
* and of its weighted representation when the feature point is (de)selected
......
......@@ -41,10 +41,9 @@ public class DistancePanel extends ControlPanel {
/*
* External actions
*/
public static final String ACTION_COMMAND_SHOW_HIDE_HEATMAP = "show-hide heatmap";
public static final String ACTION_COMMAND_SET_DISPLAYED_HEATMAP = "set displayed heatmap";
public static final String ACTION_COMMAND_SET_DISTANCE_STRATEGY = "set strategy";
public static final String ACTION_COMMAND_RELATIVE_ABSOLUTE_DIST = "switch abosulte-relative distance";
public static final String ACTION_COMMAND_WEIGHTED_DISTANCE = "switch weighted distance on/off";
public static final String ACTION_COMMAND_FEATURE_POINT_HOVER_IN = "highlight hovered FP";
public static final String ACTION_COMMAND_FEATURE_POINT_HOVER_OUT = "set default color of hovered FP";
public static final String ACTION_COMMAND_FEATURE_POINT_HIGHLIGHT = "highlight feature point with color";
......@@ -57,6 +56,9 @@ public class DistancePanel extends ControlPanel {
*/
public static final String STRATEGY_POINT_TO_POINT = "Point to point";
public static final String STRATEGY_POINT_TO_TRIANGLE = "Point to triangle";
public static final String HEATMAP_HAUSDORFF_DISTANCE = "Hausdorff distance";
public static final String HEATMAP_WEIGHTED_HAUSDORFF_DISTANCE = "Weighted Hausdorff distance";
public static final String HEATMAP_HIDE = "None";
private final Map<FeaturePointType, JLabel> featurePointStats;
private final JLabel avgHD, avgHDWeight, maxHD, maxHDWeight, minHD, minHDWeight;
......@@ -163,20 +165,17 @@ public class DistancePanel extends ControlPanel {
createListener(action, ACTION_COMMAND_SHOW_HIDE_WEIGHTED_FPOINTS)
);
builder.addLine();
builder.addCheckBoxOptionLine(
null,
"Show Hausdorff distance",
false,
createListener(action, ACTION_COMMAND_SHOW_HIDE_HEATMAP)
);
builder.addLine();
builder.addCheckBoxOptionLine(
null,
"Weighted Hausdorff distance",
false,
createListener(action, ACTION_COMMAND_WEIGHTED_DISTANCE)
builder.addOptionText("Heatmap");
builder.addComboBox(
List.of(
HEATMAP_HAUSDORFF_DISTANCE,
HEATMAP_WEIGHTED_HAUSDORFF_DISTANCE,
HEATMAP_HIDE
),
createListener(action, ACTION_COMMAND_SET_DISPLAYED_HEATMAP)
);
builder.addGap();
builder.addLine();
builder.addCaptionLine("Hausdorff distance:");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment