use of com.graphhopper.GraphHopperConfig in project OTN by L-Belluomini.
the class OTNMapComponent method getGraphFromDir.
protected OTNGraph getGraphFromDir(String dir) {
GraphHopperConfig tmpConfig = null;
try {
Gson ason = new Gson();
FileReader fReader = new FileReader(FileSystemUtils.getItem(FileSystemUtils.TOOL_DATA_DIRECTORY + "/OTN/graphs/" + dir + "/config.json"));
JsonReader reader = new JsonReader(fReader);
tmpConfig = ason.fromJson(reader, GraphHopperConfig.class);
if (tmpConfig == null) {
Log.w(TAG, "reading j config failed");
return null;
}
} catch (Exception e) {
Log.e(TAG, "An error occurred, reading ");
Log.e(TAG, e.toString());
}
return new OTNGraph("/OTN/graphs/" + dir, tmpConfig);
}
use of com.graphhopper.GraphHopperConfig in project graphhopper by graphhopper.
the class MiniGraphUI method main.
public static void main(String[] strs) {
PMap args = PMap.read(strs);
args.putObject("datareader.file", args.getString("datareader.file", "core/files/monaco.osm.gz"));
args.putObject("graph.location", args.getString("graph.location", "tools/target/mini-graph-ui-gh"));
args.putObject("graph.flag_encoders", args.getString("graph.flag_encoders", "car"));
GraphHopperConfig ghConfig = new GraphHopperConfig(args);
ghConfig.setProfiles(Arrays.asList(new Profile("profile").setVehicle("car").setWeighting("fastest")));
ghConfig.setCHProfiles(Arrays.asList(new CHProfile("profile")));
ghConfig.setLMProfiles(Arrays.asList(new LMProfile("profile")));
GraphHopper hopper = new GraphHopper().init(ghConfig).importOrLoad();
boolean debug = args.getBool("minigraphui.debug", false);
boolean useCH = args.getBool("minigraphui.useCH", false);
new MiniGraphUI(hopper, debug, useCH).visualize();
}
Aggregations