Loading GUI/src/main/java/cz/fidentis/analyst/distance/DistanceAction.java +22 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ import java.util.DoubleSummaryStatistics; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; import javax.swing.JComboBox; import javax.swing.JTabbedPane; import javax.swing.JTextField; Loading Loading @@ -163,11 +165,28 @@ public class DistanceAction extends ControlPanelAction { } private Map<MeshFacet, List<Double>> calculateHausdorffDistance() { if (weightedDist) { // TODO Merge the map of distances with the map of priorities if (!weightedDist) { return visitor.getDistances(); } return visitor.getDistances(); // Merge the map of distances with the map of priorities final Map<MeshFacet, List<Double>> weightedDistances = new HashMap<>(visitor.getDistances()); final Map<MeshFacet, List<Double>> mergedPriorities = visitor.getMergedPriorities() .get(getSecondaryDrawableFace().getHumanFace()); 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; } private void highlightFeaturePoint(LoadedActionEvent actionEvent) { Loading Loading
GUI/src/main/java/cz/fidentis/analyst/distance/DistanceAction.java +22 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ import java.util.DoubleSummaryStatistics; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.IntStream; import javax.swing.JComboBox; import javax.swing.JTabbedPane; import javax.swing.JTextField; Loading Loading @@ -163,11 +165,28 @@ public class DistanceAction extends ControlPanelAction { } private Map<MeshFacet, List<Double>> calculateHausdorffDistance() { if (weightedDist) { // TODO Merge the map of distances with the map of priorities if (!weightedDist) { return visitor.getDistances(); } return visitor.getDistances(); // Merge the map of distances with the map of priorities final Map<MeshFacet, List<Double>> weightedDistances = new HashMap<>(visitor.getDistances()); final Map<MeshFacet, List<Double>> mergedPriorities = visitor.getMergedPriorities() .get(getSecondaryDrawableFace().getHumanFace()); 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; } private void highlightFeaturePoint(LoadedActionEvent actionEvent) { Loading