Search in sources :

Example 1 with NamedArea

use of org.opentripplanner.routing.edgetype.NamedArea in project OpenTripPlanner by opentripplanner.

the class WalkableAreaBuilder method createNamedAreas.

private void createNamedAreas(AreaEdgeList edgeList, Ring ring, Collection<Area> areas) {
    Polygon containingArea = ring.toJtsPolygon();
    for (Area area : areas) {
        Geometry intersection = containingArea.intersection(area.toJTSMultiPolygon());
        if (intersection.getArea() == 0) {
            continue;
        }
        NamedArea namedArea = new NamedArea();
        OSMWithTags areaEntity = area.parent;
        int cls = StreetEdge.CLASS_OTHERPATH;
        cls |= OSMFilter.getStreetClasses(areaEntity);
        namedArea.setStreetClass(cls);
        String id = "way (area) " + areaEntity.getId() + " (splitter linking)";
        I18NString name = __handler.getNameForWay(areaEntity, id);
        namedArea.setName(name);
        WayProperties wayData = wayPropertySet.getDataForWay(areaEntity);
        Double safety = wayData.getSafetyFeatures().first;
        namedArea.setBicycleSafetyMultiplier(safety);
        namedArea.setOriginalEdges(intersection);
        StreetTraversalPermission permission = OSMFilter.getPermissionsForEntity(areaEntity, StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);
        namedArea.setPermission(permission);
        edgeList.addArea(namedArea);
    }
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) NamedArea(org.opentripplanner.routing.edgetype.NamedArea) I18NString(org.opentripplanner.util.I18NString) OSMWithTags(org.opentripplanner.openstreetmap.model.OSMWithTags) NamedArea(org.opentripplanner.routing.edgetype.NamedArea) StreetTraversalPermission(org.opentripplanner.routing.edgetype.StreetTraversalPermission) LineString(com.vividsolutions.jts.geom.LineString) I18NString(org.opentripplanner.util.I18NString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) VLPolygon(org.opentripplanner.visibility.VLPolygon) MultiPolygon(com.vividsolutions.jts.geom.MultiPolygon) VisibilityPolygon(org.opentripplanner.visibility.VisibilityPolygon) Polygon(com.vividsolutions.jts.geom.Polygon) Point(com.vividsolutions.jts.geom.Point) VLPoint(org.opentripplanner.visibility.VLPoint)

Aggregations

Geometry (com.vividsolutions.jts.geom.Geometry)1 LineString (com.vividsolutions.jts.geom.LineString)1 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)1 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)1 Point (com.vividsolutions.jts.geom.Point)1 Polygon (com.vividsolutions.jts.geom.Polygon)1 OSMWithTags (org.opentripplanner.openstreetmap.model.OSMWithTags)1 NamedArea (org.opentripplanner.routing.edgetype.NamedArea)1 StreetTraversalPermission (org.opentripplanner.routing.edgetype.StreetTraversalPermission)1 I18NString (org.opentripplanner.util.I18NString)1 VLPoint (org.opentripplanner.visibility.VLPoint)1 VLPolygon (org.opentripplanner.visibility.VLPolygon)1 VisibilityPolygon (org.opentripplanner.visibility.VisibilityPolygon)1