From de3821f5763697132b4bfbc1f425fc8f05c652f8 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 4 Mar 2013 10:18:04 +0200 Subject: [PATCH] documentation to the PruneFloatingIslands process has been added --- .../samples/graph-config.xml | 4 +- .../impl/PruneFloatingIslands.java | 38 ++++++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/opentripplanner-graph-builder/samples/graph-config.xml b/opentripplanner-graph-builder/samples/graph-config.xml index c0f20870100..a39df302803 100644 --- a/opentripplanner-graph-builder/samples/graph-config.xml +++ b/opentripplanner-graph-builder/samples/graph-config.xml @@ -34,9 +34,9 @@ - + - + diff --git a/opentripplanner-graph-builder/src/main/java/org/opentripplanner/graph_builder/impl/PruneFloatingIslands.java b/opentripplanner-graph-builder/src/main/java/org/opentripplanner/graph_builder/impl/PruneFloatingIslands.java index 6f548d34f53..02d1e3a3904 100644 --- a/opentripplanner-graph-builder/src/main/java/org/opentripplanner/graph_builder/impl/PruneFloatingIslands.java +++ b/opentripplanner-graph-builder/src/main/java/org/opentripplanner/graph_builder/impl/PruneFloatingIslands.java @@ -13,32 +13,48 @@ the License, or (at your option) any later version. package org.opentripplanner.graph_builder.impl; -import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; -import lombok.Getter; import lombok.Setter; -import org.apache.log4j.*; -import org.apache.log4j.Logger; import org.opentripplanner.common.StreetUtils; import org.opentripplanner.graph_builder.services.GraphBuilder; import org.opentripplanner.routing.graph.Graph; -import org.opentripplanner.routing.services.StreetVertexIndexService; import org.slf4j.*; +/** + * this module is part of the {@link GraphBuilder} process. it design to remove small isolated islands form the graph. + * Island created when there is no connectivity in the map, island acts like trap since there + * is no connectivity there is no way in or out the island. + * the module distinguish between two island types one with transit stops and without stops. + * + * + * + */ public class PruneFloatingIslands implements GraphBuilder { private static org.slf4j.Logger _log = LoggerFactory.getLogger(PruneFloatingIslands.class); + /** + * this field indicate the maximum size for island without stops + * island under this size will be pruned. + */ @Setter - private int maxIslandSize = 40; + private int islandWithoutStopsMaxSize = 40; + /** + * this field indicate the maximum size for island with stops + * island under this size will be pruned. + */ @Setter - private int islandWithStopMaxSize = 5; + private int islandWithStopsMaxSize = 5; + /** + * The name for output file for this process, the file will store information about the islands were found and if they were pruned. + * If the value is an empty string there will be no output file. + */ @Setter private String islandLogFile = ""; @@ -50,14 +66,18 @@ public List provides() { } public List getPrerequisites() { -// return Arrays.asList("streets","linking"); + /**this module can run after the street module only but if + * the street linker did not run then it couldn't identifies island with stops. + * so if the need is to distinguish between island with stops or without stops + * as explained before this module should run after the streets and the linker modules. + */ return Arrays.asList("streets"); } @Override public void buildGraph(Graph graph, HashMap, Object> extra) { _log.warn("Pruning isolated islands ..."); - StreetUtils.pruneFloatingIslands(graph, maxIslandSize, islandWithStopMaxSize, + StreetUtils.pruneFloatingIslands(graph, islandWithoutStopsMaxSize, islandWithStopsMaxSize, LoggerAppenderProvider.createCsvFile4LoggerCat(islandLogFile, "islands")); if(transitToStreetNetwork == null){ _log.warn("Could not reconnect stop, TransitToStreetNetworkGraphBuilder was not provided");