/** * Some polygons cannot be reached we find them with the help of navigation * graph Definition: 1. Any polygon with navigation point is reachable 2. * Any polygon sharing edge with a reachable polygon is also reachable. */ public ReachabilityAnalysis( PolygonAnalysis polygonAnalysis, LineSegmentAnalysis lineSegmentAnalysis, NavGraphAnalysis navGraphAnalysis, Logger log ) { if (navGraphAnalysis.navPointToInfoMap.values().isEmpty()) { log.warning("There are no navpoints present within the worldview, could not analyze reachability."); return; } // navigation graph is expected to be sane, so all off-mesh nav points are reachable reachableOffMeshNavPoints.addAll( navGraphAnalysis.offMeshNavPoints ); reachableOffMeshNavLinks.addAll( navGraphAnalysis.offMeshNavLinks ); for (NavGraphAnalysis.NavPointInfo navPointInfo : navGraphAnalysis.navPointToInfoMap.values()) { recursivelyMarkAsReachable( navPointInfo.polygonId, polygonAnalysis, lineSegmentAnalysis ); } log.info("Reachability analysis: There are " + reachablePolygons.size() + " reachable polygons containing " + reachableVertices.size() + " vertices."); // create vertex ID to containing polygon map without unreachable polygons for (int reachableVertexId : reachableVertices ) { HashSet<Integer> containingPolygonIds = Sets.newHashSet(); containingPolygonIds.addAll( polygonAnalysis.vertexIdToInfoMap.get(reachableVertexId).containingPolygonIdToVertexIndexMap.keySet() ); containingPolygonIds.retainAll(reachablePolygons); vertexIdToContainingPolygonsMap.put( reachableVertexId, containingPolygonIds ); } }
private FileSource fileInfoToFileSource(FileInfo info) { return info.toFileSource(new NullPathPrefix(), Sets.<FileInfoScheme>newHashSet()); }