org.opentripplanner.graph_builder.module.shapefile.DirectSafetyReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.graph_builder.module.shapefile;
import org.opengis.feature.simple.SimpleFeature;
import org.opentripplanner.common.model.P2;
import org.opentripplanner.graph_builder.services.shapefile.SimpleFeatureConverter;
/*
* Read safety factors directly from shapefiles (contributed by Guillaume Barreau)
*/
public class DirectSafetyReader implements SimpleFeatureConverter> {
private String safetyAttributeName;
public static final P2 oneone = new P2(1.0, 1.0);
@Override
public P2 convert(SimpleFeature feature) {
Double d = (Double) feature.getAttribute(safetyAttributeName);
if (d == null) {
return oneone;
}
return new P2(d, d);
}
public void setSafetyAttributeName(String safetyAttributeName) {
this.safetyAttributeName = safetyAttributeName;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy