From d00cafbe7c06fed1a122d32a411aadd29ea1a09e Mon Sep 17 00:00:00 2001 From: semu <semu@mi.fu-berlin.de> Date: Mon, 23 Mar 2015 10:57:30 +0100 Subject: [PATCH] removed unused cleaning options --- .../src/de/fub/agg2graph/agg/AggCleaner.java | 1 - .../agg/strategy/GpxFrechetPriorityMerge.java | 73 +++++++++++-------- .../strategy/GpxmergeAggregationStrategy.java | 2 +- .../gpsk/algorithms/CleaningOptions.java | 3 - .../gpsk/logic/CleaningOptionsIO.java | 10 --- .../fub/agg2graph/input/CleaningOptions.java | 4 +- .../de/fub/agg2graph/input/GPSCleaner.java | 1 - .../de/fub/agg2graph/traclus/Benchmark.java | 4 +- .../fub/agg2graph/ui/gui/UIStepStorage.java | 3 +- .../de/fub/agg2graph/input/GPSCleanTest.java | 1 - 10 files changed, 51 insertions(+), 51 deletions(-) diff --git a/agg2graph/src/de/fub/agg2graph/agg/AggCleaner.java b/agg2graph/src/de/fub/agg2graph/agg/AggCleaner.java index 9541293c..e7dec290 100644 --- a/agg2graph/src/de/fub/agg2graph/agg/AggCleaner.java +++ b/agg2graph/src/de/fub/agg2graph/agg/AggCleaner.java @@ -41,7 +41,6 @@ public class AggCleaner { co.filterByEdgeLength = true; co.filterZigzag = true; co.filterFakeCircle = true; - co.filterOutliers = true; return this; } diff --git a/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxFrechetPriorityMerge.java b/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxFrechetPriorityMerge.java index 5d659da3..e41e0073 100644 --- a/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxFrechetPriorityMerge.java +++ b/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxFrechetPriorityMerge.java @@ -57,6 +57,10 @@ public class GpxFrechetPriorityMerge implements ISubTrajectoryMergeHandler { public double connectThreshold = 50.0; public double angleThreshold = 75.0; + + public boolean mergeConnections = true; + + public boolean avoidLongPerpendiculars = true; private static final Logger logger = Logger .getLogger("agg2graph.agg.default.merge"); @@ -248,32 +252,33 @@ public class GpxFrechetPriorityMerge implements ISubTrajectoryMergeHandler { GPSEdge conClone = new GPSEdge(new GPSPoint(con.getFrom().getLat(), con.getFrom().getLon()), new GPSPoint(con.getTo().getLat(), con.getTo().getLon())); GPSPoint crossingFrom = conClone.getPerpCrossingFrom(edge); - if (Math.abs(edge.getAngle()-conClone.getAngle()) < angleThreshold){ - if ((edge.pointWithinBounds(crossingFrom) || !onlyMoveToActualCrossings) && !toBeMoved.containsKey(con.getFrom()) && GPSCalc.getDistance(con.getFrom(), crossingFrom) < connectThreshold){ - GPSPoint newPoint = new GPSPoint(); - newPoint.setLat((crossingFrom.getLat() + con.getWeight() * con.getFrom().getLat()) / (con.getWeight()+1)); - newPoint.setLon((crossingFrom.getLon() + con.getWeight() * con.getFrom().getLon()) / (con.getWeight()+1)); - if (!toBeMoved.containsKey(con.getTo())) oldCons.add(conClone); - usedEdges.add(edge); - toBeMoved.put(con.getFrom(), newPoint); - List<ILocation> line = new ArrayList<ILocation>(2); - line.add(conClone.getFrom()); - line.add(crossingFrom); - lines.add(line); - } - GPSPoint crossingTo = conClone.getPerpCrossingTo(edge); - if ((edge.pointWithinBounds(crossingTo) || !onlyMoveToActualCrossings) && !toBeMoved.containsKey(con.getTo()) && GPSCalc.getDistance(con.getTo(), crossingTo) < connectThreshold){ - GPSPoint newPoint = new GPSPoint(); - newPoint.setLat((crossingTo.getLat() + con.getWeight() * con.getTo().getLat()) / (con.getWeight()+1)); - newPoint.setLon((crossingTo.getLon() + con.getWeight() * con.getTo().getLon()) / (con.getWeight()+1)); - if (!toBeMoved.containsKey(con.getFrom())) oldCons.add(conClone); - usedEdges.add(edge); - toBeMoved.put(con.getTo(), newPoint); - List<ILocation> line = new ArrayList<ILocation>(2); - line.add(conClone.getTo()); - line.add(crossingTo); - lines.add(line); - } + if (Math.abs(edge.getAngle()-conClone.getAngle()) < angleThreshold || !avoidLongPerpendiculars){ + if ((edge.pointWithinBounds(crossingFrom) || !onlyMoveToActualCrossings) && !toBeMoved.containsKey(con.getFrom()) && (GPSCalc.getDistance(con.getFrom(), crossingFrom) < connectThreshold || !avoidLongPerpendiculars)){ + GPSPoint newPoint = new GPSPoint(); + newPoint.setLat((crossingFrom.getLat() + con.getWeight() * con.getFrom().getLat()) / (con.getWeight()+1)); + newPoint.setLon((crossingFrom.getLon() + con.getWeight() * con.getFrom().getLon()) / (con.getWeight()+1)); + if (!toBeMoved.containsKey(con.getTo())) oldCons.add(conClone); + usedEdges.add(edge); + toBeMoved.put(con.getFrom(), newPoint); + List<ILocation> line = new ArrayList<ILocation>(2); + line.add(conClone.getFrom()); + line.add(crossingFrom); + lines.add(line); + } + + GPSPoint crossingTo = conClone.getPerpCrossingTo(edge); + if ((edge.pointWithinBounds(crossingTo) || !onlyMoveToActualCrossings) && !toBeMoved.containsKey(con.getTo()) && (GPSCalc.getDistance(con.getTo(), crossingTo) < connectThreshold || !avoidLongPerpendiculars)){ + GPSPoint newPoint = new GPSPoint(); + newPoint.setLat((crossingTo.getLat() + con.getWeight() * con.getTo().getLat()) / (con.getWeight()+1)); + newPoint.setLon((crossingTo.getLon() + con.getWeight() * con.getTo().getLon()) / (con.getWeight()+1)); + if (!toBeMoved.containsKey(con.getFrom())) oldCons.add(conClone); + usedEdges.add(edge); + toBeMoved.put(con.getTo(), newPoint); + List<ILocation> line = new ArrayList<ILocation>(2); + line.add(conClone.getTo()); + line.add(crossingTo); + lines.add(line); + } } } @@ -309,7 +314,7 @@ public class GpxFrechetPriorityMerge implements ISubTrajectoryMergeHandler { } } - // TODO: order alreadyMoved by connection order / connect first with beforeNode and last with afterNode + //order alreadyMoved by connection order / connect first with beforeNode and last with afterNode LinkedList<AggNode> movedOrdered = new LinkedList<AggNode>(); @@ -438,7 +443,7 @@ public class GpxFrechetPriorityMerge implements ISubTrajectoryMergeHandler { if (before != null){ if (before.getPathTo(current, pathDepth) == null && current.getPathTo(before, pathDepth) == null /*&& current.getPathFromTo(before, pathDepth) == null */){ List<AggConnection> cons = current.getPathFromTo(before, pathDepth); - if (cons.size()>0){ + if (cons.size()>0 && mergeConnections){ // merge connections boolean found = true; while (found){ @@ -607,11 +612,21 @@ public class GpxFrechetPriorityMerge implements ISubTrajectoryMergeHandler { tra.add(edge.getTo()); addGPSPoints(tra); } - + @Override public IMergeHandler getCopy() { GpxFrechetPriorityMerge object = new GpxFrechetPriorityMerge(); object.matchMap = this.matchMap; + object.onlyMoveToActualCrossings = this.onlyMoveToActualCrossings; + object.pathDepth = this.pathDepth; + object.maxConnectEdge = this.maxConnectEdge; + object.connectThreshold = this.connectThreshold; + object.angleThreshold = this.angleThreshold; + object.mergeConnections = this.mergeConnections; + object.avoidLongPerpendiculars = this.avoidLongPerpendiculars; + object.matchMaps = this.matchMaps; + object.inNode = this.inNode; + object.outNode = this.outNode; return object; } diff --git a/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxmergeAggregationStrategy.java b/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxmergeAggregationStrategy.java index cf5ad200..1efe3039 100644 --- a/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxmergeAggregationStrategy.java +++ b/agg2graph/src/de/fub/agg2graph/agg/strategy/GpxmergeAggregationStrategy.java @@ -102,7 +102,7 @@ public class GpxmergeAggregationStrategy extends AbstractEdgeAggregationStrategy Iterator<AggConnection> itNear = nearEdges.iterator(); while (itNear.hasNext()) { AggConnection near = itNear.next(); - // nodes were set irrelevant to avoid matching one segment with itself - matchingis excluded here + // nodes were set irrelevant to avoid matching one segment with itself - matchings excluded here if (near.getFrom().isRelevant()){ Object[] distReturn = traceDistance.getPathDifference( near.toPointList(), currentEdge.toPointList(), 0, diff --git a/agg2graph/src/de/fub/agg2graph/gpsk/algorithms/CleaningOptions.java b/agg2graph/src/de/fub/agg2graph/gpsk/algorithms/CleaningOptions.java index 446cff63..5c01e00a 100644 --- a/agg2graph/src/de/fub/agg2graph/gpsk/algorithms/CleaningOptions.java +++ b/agg2graph/src/de/fub/agg2graph/gpsk/algorithms/CleaningOptions.java @@ -100,9 +100,6 @@ public class CleaningOptions { co.filterFakeCircle = filterFakeCircle; co.maxFakeCircleAngle = maxFakeCircleAngle; - co.filterOutliers = filterOutliers; - co.maxNumOutliers = maxNumOutliers; - return co; diff --git a/agg2graph/src/de/fub/agg2graph/gpsk/logic/CleaningOptionsIO.java b/agg2graph/src/de/fub/agg2graph/gpsk/logic/CleaningOptionsIO.java index 89d0c428..8a2a9dc1 100644 --- a/agg2graph/src/de/fub/agg2graph/gpsk/logic/CleaningOptionsIO.java +++ b/agg2graph/src/de/fub/agg2graph/gpsk/logic/CleaningOptionsIO.java @@ -126,13 +126,6 @@ public class CleaningOptionsIO { log.warn("The key value store has an illegal entry for " + MAX_FAKE_CIRLCE_ANGLE_KEY); } - return_options.filterOutliers = getBoolean(FILTER_OUTLIERS_KEY, default_options.filterOutliers); - try{ - return_options.maxNumOutliers = getInt(MAX_NUM_OUTLIERS_KEY, default_options.maxNumOutliers); - - } catch(NumberFormatException ex){ - log.warn("The key value store has an illegal entry for " + MAX_NUM_OUTLIERS_KEY); - } return return_options; } @@ -151,8 +144,5 @@ public class CleaningOptionsIO { putValue(FILTER_ZIGZAG_KEY, co.filterZigzag); putValue(MAX_ZIGZAG_ANGLE_KEY, co.maxZigzagAngle); - - putValue(FILTER_OUTLIERS_KEY, co.filterOutliers); - putValue(MAX_NUM_OUTLIERS_KEY, co.maxNumOutliers); } } diff --git a/agg2graph/src/de/fub/agg2graph/input/CleaningOptions.java b/agg2graph/src/de/fub/agg2graph/input/CleaningOptions.java index d3102a83..22536c06 100644 --- a/agg2graph/src/de/fub/agg2graph/input/CleaningOptions.java +++ b/agg2graph/src/de/fub/agg2graph/input/CleaningOptions.java @@ -44,11 +44,11 @@ public class CleaningOptions { public boolean filterFakeCircle = true; public double maxFakeCircleAngle = 50; // outliers - public boolean filterOutliers = true; +/* public boolean filterOutliers = true; public int maxNumOutliers = 2; // TODO k-Anonymity: At most one value must be true public boolean useMin = true; public boolean useMean = false; public boolean onlySame = false; - +*/ } diff --git a/agg2graph/src/de/fub/agg2graph/input/GPSCleaner.java b/agg2graph/src/de/fub/agg2graph/input/GPSCleaner.java index 0facd4f6..a1f9c597 100644 --- a/agg2graph/src/de/fub/agg2graph/input/GPSCleaner.java +++ b/agg2graph/src/de/fub/agg2graph/input/GPSCleaner.java @@ -54,7 +54,6 @@ public class GPSCleaner { co.filterByEdgeLengthIncrease = true; co.filterZigzag = true; co.filterFakeCircle = true; - co.filterOutliers = true; return this; } diff --git a/agg2graph/src/de/fub/agg2graph/traclus/Benchmark.java b/agg2graph/src/de/fub/agg2graph/traclus/Benchmark.java index 484b2033..e17706d2 100644 --- a/agg2graph/src/de/fub/agg2graph/traclus/Benchmark.java +++ b/agg2graph/src/de/fub/agg2graph/traclus/Benchmark.java @@ -95,7 +95,7 @@ public class Benchmark { // fake circle cleaningOptions.filterFakeCircle = Boolean.parseBoolean(properties.getProperty("cleaning.filterFakeCircle")); cleaningOptions.maxFakeCircleAngle = Double.parseDouble(properties.getProperty("cleaning.maxFakeCircleAngle")); - +/* // outliers cleaningOptions.filterOutliers = Boolean.parseBoolean(properties.getProperty("cleaning.filterOutliers")); cleaningOptions.maxNumOutliers = Integer.parseInt(properties.getProperty("cleaning.maxNumOutliers")); @@ -104,7 +104,7 @@ public class Benchmark { cleaningOptions.useMin = Boolean.parseBoolean(properties.getProperty("cleaning.useMin")); cleaningOptions.useMean = Boolean.parseBoolean(properties.getProperty("cleaning.useMean")); cleaningOptions.onlySame = Boolean.parseBoolean(properties.getProperty("cleaning.onlySame")); - + */ // ramer dougles peucker filter epsilon double rpdfEpsilon = Double.parseDouble(properties.getProperty("cleaning.rpdfEpsilon")); diff --git a/agg2graph/src/de/fub/agg2graph/ui/gui/UIStepStorage.java b/agg2graph/src/de/fub/agg2graph/ui/gui/UIStepStorage.java index 30fcc576..60e39388 100644 --- a/agg2graph/src/de/fub/agg2graph/ui/gui/UIStepStorage.java +++ b/agg2graph/src/de/fub/agg2graph/ui/gui/UIStepStorage.java @@ -136,11 +136,12 @@ public class UIStepStorage extends StepStorage { o.maxZigzagAngle = 30; o.filterFakeCircle = true; o.maxFakeCircleAngle = 50; - o.filterOutliers = false; +/* o.filterOutliers = false; o.maxNumOutliers = 2; o.useMin = true; o.useMean = false; o.onlySame = false; + */ } @Override diff --git a/agg2graph/unit-test/de/fub/agg2graph/input/GPSCleanTest.java b/agg2graph/unit-test/de/fub/agg2graph/input/GPSCleanTest.java index c37074df..edac8cd4 100644 --- a/agg2graph/unit-test/de/fub/agg2graph/input/GPSCleanTest.java +++ b/agg2graph/unit-test/de/fub/agg2graph/input/GPSCleanTest.java @@ -34,7 +34,6 @@ public class GPSCleanTest extends TestCase { o.filterBySegmentLength = false; o.filterZigzag = false; o.filterFakeCircle = false; - o.filterOutliers = false; File inputFile = FileHandler .getFile("test/input/unit-test/clean/clean_01_example.gpx"); -- GitLab