public static ActivityFacilities createActivityFacilities() { return createActivityFacilities(null) ; }
Gbl.assertNotNull(toFacility); Link accessActLink = FacilitiesUtils.decideOnLink(fromFacility, network ); Link egressActLink = FacilitiesUtils.decideOnLink(toFacility, network );
@Override public void write(String filename) { openFile(filename); this.writeInit(); for (ActivityFacility f : FacilitiesUtils.getSortedFacilities(this.facilities).values()) { this.writeFacility((ActivityFacilityImpl) f); } this.writeFinish(); }
@Override public List<? extends PlanElement> calcRoute(Facility fromFacility, Facility toFacility, double departureTime, Person person) { Link accessActLink = FacilitiesUtils.decideOnLink(Objects.requireNonNull(fromFacility), network); Link egressActLink = FacilitiesUtils.decideOnLink(Objects.requireNonNull(toFacility), network);
public void write(OutputStream stream) { openOutputStream(stream); this.writeInit(); for (ActivityFacility f : FacilitiesUtils.getSortedFacilities(this.facilities).values()) { this.writeFacility((ActivityFacilityImpl) f); } this.writeFinish(); }
public OsmPoiSink(CoordinateTransformation ct, Map<String, String> osmToMatsimType, String osmKey, boolean useGeneralTypeIsSpecificTypeUnknown) { this.ct = ct; this.typeMap = osmToMatsimType; this.osmKey = osmKey; this.nodeMap = new HashMap<Long, NodeContainer>(); this.wayMap = new HashMap<Long, WayContainer>(); this.relationMap = new HashMap<Long, RelationContainer>(); facilities = FacilitiesUtils.createActivityFacilities(osmKey + "_facilities"); }
public OsmPoiReader(String osmInputFile, CoordinateTransformation ct) throws FileNotFoundException { LOG.info("Creating OSM POI reader"); File file = new File(osmInputFile); if(!file.exists()) { throw new FileNotFoundException("Could not find " + osmInputFile); } this.inputFile = file; this.ct = ct; this.facilities = FacilitiesUtils.createActivityFacilities("OpenStreetMap facilities"); }
/** * Constructing a LandUseBuildingReader to parse the OpenStreetMap landuse and Buildings. * * @param file the path to the *.osm OpenStreetMap file; * @param ct the (projected) coordinate reference system to which the * WGS84 coordinates of OpenStreetMap will be converted to; and * @param osmToMatsimTypeMap a mapping of OpenStreetMap * <a href="http://wiki.openstreetmap.org/wiki/Key:landuse">Land Use</a> * to MATSim activity types. */ public LandUseBuildingReader(CoordinateTransformation ct, Map<String, String> osmLandUseToMatsimTypeMap, Map<String, String> osmBuildingToMatsimTypeMap, double buildingTypeFromVicinityRange, String[] tagsToIgnoreBuildings) { log.info("Creating LandUseAndBuildingReader"); this.ct = ct; this.osmLandUseToMatsimTypeMap = osmLandUseToMatsimTypeMap; this.osmBuildingToMatsimTypeMap = osmBuildingToMatsimTypeMap; this.landuse = FacilitiesUtils.createActivityFacilities("OpenStreetMap landuse ???"); this.buildingTypeFromVicinityRange = buildingTypeFromVicinityRange; this.tagsToIgnoreBuildings = tagsToIgnoreBuildings; }
this.unmannedEntitiesList = unmannedEntitiesList; this.facilities = FacilitiesUtils.createActivityFacilities("OpenStreetMap landuse ???");
public LandUseBuildingSink(CoordinateTransformation ct, Map<String, String> osmLandUseToMatsimType, Map<String, String> osmBuildingToMatsimType, double buildingTypeFromVicinityRange, String[] tagsToIgnoreBuildings) { this.ct = ct; this.landUseTypeMap = osmLandUseToMatsimType; this.buildingTypeMap = osmBuildingToMatsimType; this.nodeMap = new HashMap<Long, NodeContainer>(); this.wayMap = new HashMap<Long, WayContainer>(); this.relationMap = new HashMap<Long, RelationContainer>(); this.buildingTypeFromVicinityRange = buildingTypeFromVicinityRange; this.tagsToIgnoreBuildings = tagsToIgnoreBuildings; facilities = FacilitiesUtils.createActivityFacilities("Land Use"); facilityAttributes = new ObjectAttributes(); }
public AmenitySink(CoordinateTransformation ct, Map<String, String> osmToMatsimType) { this.ct = ct; this.typeMap = osmToMatsimType; this.nodeMap = new HashMap<Long, NodeContainer>(); this.wayMap = new HashMap<Long, WayContainer>(); this.relationMap = new HashMap<Long, RelationContainer>(); facilities = FacilitiesUtils.createActivityFacilities("Amenities"); facilityAttributes = new ObjectAttributes(); /* Keep track of the different education level facilities. */ educationLevelMap = new HashMap<>(); educationLevelMap.put("primary", 0); educationLevelMap.put("secondary", 0); educationLevelMap.put("tertiary", 0); educationLevelMap.put("unknown", 0); }
/** * Constructing an amenity reader to parse the OpenStreetMap amenities. * * @param file the path to the *.osm OpenStreetMap file; * @param ct the (projected) coordinate reference system to which the * WGS84 coordinates of OpenStreetMap will be converted to; and * @param osmToMatsimTypeMap a mapping of OpenStreetMap * <a href="http://wiki.openstreetmap.org/wiki/Key:amenity">Amenity values</a> * to MATSim activity types. */ public AmenityReader(String file, CoordinateTransformation ct, Map<String, String> osmToMatsimTypeMap) { log.info("Creating amenity reader"); this.ct = ct; this.osmToMatsimTypeMap = osmToMatsimTypeMap; this.amenities = FacilitiesUtils.createActivityFacilities("OpenStreetMap amenities"); this.amenityAttributes = new ObjectAttributes(); }
public CombinedOsmSink(String outputCRS, Map<String, String> osmLandUseToMatsimType, Map<String, String> osmBuildingToMatsimType, Map<String, String> osmAmenityToMatsimType, Map<String, String> osmLeisureToMatsimType, Map<String, String> osmTourismToMatsimType, List<String> unmannedEntitiesList, double buildingTypeFromVicinityRange) { this.outputCRS = outputCRS; this.landUseTypeMap = osmLandUseToMatsimType; this.buildingTypeMap = osmBuildingToMatsimType; this.amenityTypeMap = osmAmenityToMatsimType; this.leisureTypeMap = osmLeisureToMatsimType; this.tourismTypeMap = osmTourismToMatsimType; this.unmannedEntitiesList = unmannedEntitiesList; this.buildingTypeFromVicinityRange = buildingTypeFromVicinityRange; this.nodeMap = new HashMap<Long, NodeContainer>(); this.wayMap = new HashMap<Long, WayContainer>(); this.relationMap = new HashMap<Long, RelationContainer>(); facilities = FacilitiesUtils.createActivityFacilities("Land Use"); facilityAttributes = new ObjectAttributes(); }
public static ActivityFacilities createHexagonLayer(double minX, double minY, double maxX, double maxY, int maxDiameter_m) { LOG.info("Start creating measure points on a hexagon pattern."); double inRadius_m = Math.sqrt(3) / 4 * maxDiameter_m; int skippedPoints = 0; int setPoints = 0; ActivityFacilitiesImpl measuringPoints = (ActivityFacilitiesImpl) FacilitiesUtils.createActivityFacilities("accessibility measuring points"); int columnNumber = 1; for (double x = minX; x < (maxX - 1./2 * maxDiameter_m); x += (3./4 * maxDiameter_m)) { for (double y = minY; y <= maxY; y += (2 * inRadius_m)) { double centerX = x; double centerY; if (columnNumber % 2 != 0) { centerY = y; } else { centerY = y + inRadius_m; } if (centerX <= maxX && centerX >= minX && centerY <= maxY && centerY >= minY) { Coord center = new Coord(centerX, centerY); measuringPoints.createAndAddFacility(Id.create(setPoints, ActivityFacility.class), center); setPoints++; } else skippedPoints++; } columnNumber++; } LOG.info("Created " + setPoints + " inside the boundary. " + skippedPoints + " lie outside."); LOG.info("Finished creating measure points on a hexagon pattern."); return measuringPoints; }
int skippedPoints = 0; int setPoints = 0; ActivityFacilitiesImpl measuringPoints = (ActivityFacilitiesImpl) FacilitiesUtils.createActivityFacilities("accessibility measuring points");
/** * Collects all facilities of a given type that have been loaded to the sceanrio. */ public static ActivityFacilities collectActivityFacilitiesWithOptionOfType(Scenario scenario, String activityOptionType) { ActivityFacilities activityFacilities = FacilitiesUtils.createActivityFacilities(activityOptionType) ; for (ActivityFacility facility : scenario.getActivityFacilities().getFacilities().values()) { if (activityOptionType == null) { // no activity option type for facility given, use all of them activityFacilities.addActivityFacility(facility); } else { for (ActivityOption option : facility.getActivityOptions().values()) { if (option.getType().equals(activityOptionType)) { activityFacilities.addActivityFacility(facility); } } } } return activityFacilities; }
public static void combineDifferentActivityOptionTypes(final Scenario scenario, String combinedType, final List<String> activityOptionsToBeIncluded) { ActivityOption markerOption = new ActivityOptionImpl(combinedType); // Memorize all facilities that have certain activity options in a activity facilities container final ActivityFacilities consideredFacilities = FacilitiesUtils.createActivityFacilities(); for (ActivityFacility facility : scenario.getActivityFacilities().getFacilities().values()) { for (ActivityOption option : facility.getActivityOptions().values()) { if (activityOptionsToBeIncluded.contains(option.getType())) { // if (!option.getType().equals(FacilityTypes.HOME) && !option.getType().equals(FacilityTypes.WORK) && !option.getType().equals("minor")) { if (!consideredFacilities.getFacilities().containsKey(facility.getId())) { consideredFacilities.addActivityFacility(facility); } } } } // Add marker option to facilities to be considered for (ActivityFacility facility : consideredFacilities.getFacilities().values()) { facility.addActivityOption(markerOption); } }
ActivityFacilitiesImpl measuringPoints = (ActivityFacilitiesImpl) FacilitiesUtils.createActivityFacilities("Accessibility measuring points"); Envelope env = boundary.getEnvelopeInternal();
public static final ActivityFacilities createFacilityForEachLink(String facilityContainerName, Network network) { ActivityFacilities facilities = FacilitiesUtils.createActivityFacilities(facilityContainerName); ActivityFacilitiesFactory aff = facilities.getFactory(); for (Link link : network.getLinks().values()) { ActivityFacility facility = aff.createActivityFacility(Id.create(link.getId(),ActivityFacility.class), link.getCoord(), link.getId()); facilities.addActivityFacility(facility); } return facilities ; }
ActivityFacilities facilities = FacilitiesUtils.createActivityFacilities();