From 4a39b757e83de94a1e699357092067d5e0b010e2 Mon Sep 17 00:00:00 2001 From: Vincent Privat Date: Sun, 25 Mar 2018 03:05:38 +0200 Subject: [PATCH] code simplification --- .../BuildingGeneralizationAction.java | 7 ++----- .../josm/plugins/buildinggeneralization/ShapeMath.java | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/org/openstreetmap/josm/plugins/buildinggeneralization/BuildingGeneralizationAction.java b/src/org/openstreetmap/josm/plugins/buildinggeneralization/BuildingGeneralizationAction.java index 2cc2d3f..0201af7 100644 --- a/src/org/openstreetmap/josm/plugins/buildinggeneralization/BuildingGeneralizationAction.java +++ b/src/org/openstreetmap/josm/plugins/buildinggeneralization/BuildingGeneralizationAction.java @@ -13,7 +13,6 @@ import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.data.coor.EastNorth; -import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.WaySegment; @@ -44,8 +43,7 @@ public BuildingGeneralizationAction() { @Override public void actionPerformed(ActionEvent e) { if (MainApplication.getMap() != null) { - DataSet data = getLayerManager().getEditLayer().data; - Collection ways = data.getWays(); + Collection ways = getLayerManager().getEditLayer().data.getWays(); generalization(ways); for (Way way : ways) { if (way.isClosed()) { @@ -142,10 +140,9 @@ public void proceedGeneralization(Way way) { public WaySegment findSegment(Way closedWay) { - DataSet data = getLayerManager().getEditLayer().data; int nodeIndex = Integer.MAX_VALUE; double min = Double.MAX_VALUE; - Collection ways = data.getWays(); + Collection ways = getLayerManager().getEditLayer().data.getWays(); Collection roads = new ArrayList<>(); Way minWay = new Way(); for (Way w : ways) diff --git a/src/org/openstreetmap/josm/plugins/buildinggeneralization/ShapeMath.java b/src/org/openstreetmap/josm/plugins/buildinggeneralization/ShapeMath.java index 9747c41..8ec1aed 100644 --- a/src/org/openstreetmap/josm/plugins/buildinggeneralization/ShapeMath.java +++ b/src/org/openstreetmap/josm/plugins/buildinggeneralization/ShapeMath.java @@ -8,7 +8,6 @@ import java.util.Set; import org.openstreetmap.josm.data.coor.EastNorth; -import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.WaySegment; @@ -241,9 +240,7 @@ public static double normalise(double a){ public static void drawCenter() { OsmDataLayer currentLayer = MainApplication.getLayerManager().getEditLayer(); - DataSet data = currentLayer.data; - - Collection selectedWays = data.getSelectedWays(); + Collection selectedWays = currentLayer.data.getSelectedWays(); for (Way way : selectedWays) { EastNorth center = ShapeMath.getCentroid(way);