Commit 682bcfd1 authored by Daniel Schramm's avatar Daniel Schramm
Browse files

Useless class attribute eliminated

parent f1ddef1d
Loading
Loading
Loading
Loading
+26 −29
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ public class DistanceAction extends ControlPanelAction {
    private String heatmapDisplayed = DistancePanel.HEATMAP_HAUSDORFF_DISTANCE;
    private boolean weightedFPsShow = true;
    
    private Map<MeshFacet, List<Double>> weightedHausdorffDistance = null;
    private FeaturePointType hoveredFeaturePoint = null;
    
    private final DistancePanel controlPanel;
@@ -221,8 +220,6 @@ public class DistanceAction extends ControlPanelAction {
        if (visitor == null) {
            calculateHausdorffDistance(featurePointTypes);
            
            weightedHausdorffDistance = getWeightedDistance();
            
            // Update GUI elements that display the calculated Hausdorff distance metrics
            setFeaturePointWeigths();
            setHausdorffDistanceStatistics();
@@ -276,31 +273,6 @@ public class DistanceAction extends ControlPanelAction {
        getSecondaryDrawableFace().getHumanFace().accept(visitor);
    }
    
    /**
     * Calculates weighted Hausdorff distance of the face.
     * 
     * @return weighted Hausdorff distance
     */
    private Map<MeshFacet, List<Double>> getWeightedDistance() {
        final Map<MeshFacet, List<Double>> weightedDistances = new HashMap<>(visitor.getDistances());
        final Map<MeshFacet, List<Double>> mergedPriorities = visitor.getMergedPriorities()
                .get(getSecondaryDrawableFace().getHumanFace());

        // Merge the map of distances with the map of priorities
        for (final Map.Entry<MeshFacet, List<Double>> facetPriorities: mergedPriorities.entrySet()) {
            weightedDistances.merge(
                    facetPriorities.getKey(),
                    facetPriorities.getValue(),
                    (distancesList, prioritiesList) ->
                            IntStream.range(0, distancesList.size())
                                    .mapToDouble(i -> distancesList.get(i) * prioritiesList.get(i))
                                    .boxed()
                                    .collect(Collectors.toList()));
        }

        return weightedDistances;
    }
    
    /**
     * Updates the GUI elements of {@link DistancePanel} that display
     * the weights of feature points used to calculate the weighted Hausdorff distance.
@@ -334,7 +306,7 @@ public class DistanceAction extends ControlPanelAction {
                        .flatMap(List::stream)
                        .mapToDouble(Double::doubleValue)
                        .summaryStatistics(),
                weightedHausdorffDistance
                getWeightedDistance()
                        .values()
                        .stream()
                        .flatMap(List::stream)
@@ -343,6 +315,31 @@ public class DistanceAction extends ControlPanelAction {
        );
    }
    
    /**
     * Calculates weighted Hausdorff distance of the face.
     * 
     * @return weighted Hausdorff distance
     */
    private Map<MeshFacet, List<Double>> getWeightedDistance() {
        final Map<MeshFacet, List<Double>> weightedDistances = new HashMap<>(visitor.getDistances());
        final Map<MeshFacet, List<Double>> mergedPriorities = visitor.getMergedPriorities()
                .get(getSecondaryDrawableFace().getHumanFace());

        // Merge the map of distances with the map of priorities
        for (final Map.Entry<MeshFacet, List<Double>> facetPriorities: mergedPriorities.entrySet()) {
            weightedDistances.merge(
                    facetPriorities.getKey(),
                    facetPriorities.getValue(),
                    (distancesList, prioritiesList) ->
                            IntStream.range(0, distancesList.size())
                                    .mapToDouble(i -> distancesList.get(i) * prioritiesList.get(i))
                                    .boxed()
                                    .collect(Collectors.toList()));
        }

        return weightedDistances;
    }
    
    /**
     * Returns {@code true} if the heatmap is displayed and {@code false} otherwise.
     *