toremove.add(l);
}
for (Layer l : toremove)
this.mapView.removeLayer(l);
LatLon latlon_origin = null;
int id_layer = 0;
for (TSPPlan plan : res) {
latlon_origin = new LatLon(plan.getOrigin()[1],
plan.getOrigin()[0]);
log.info(latlon_origin);
LineElemStyle ls = new LineElemStyle();
float f = random.nextFloat();
ls.color = Color
.getHSBColor(f * random.nextFloat(), 0.9f, 0.9f);
ls.width = LogicConstants.getInt("PLAN_WAY_WIDTH", 2);
MarkerLayer stops = new MarkerLayer(new GpxData(), "Stops "
+ id_layer, File.createTempFile("stops", "tmp"),
new GpxLayer(new GpxData()), this.mapView);
stops.data.add(new StopMarker(latlon_origin, "origin",
"tsp_stop", stops, 0, 0, ls.color));
for (String stop : plan.getStops()) {
String[] array = stop.split(",");
double[] point = new double[2];
point[1] = new Double(array[0]);
point[0] = new Double(array[1]);
LatLon ll = new LatLon(point[0], point[1]);
log.info(ll);
stops.data.add(new StopMarker(ll, array[2], "tsp_stop",
stops, 0, 0, ls.color));
}
this.mapView.addLayer(stops, true);
OsmDataLayer layer = new OsmDataLayer(new DataSet(),
"Route Plan " + id_layer++, File.createTempFile(
"planning", "route"));
String way2 = plan.getWay();
if (way2 != null) {
Way way = new Way();
LatLon info = null;
MultiLineString multilinestring = (MultiLineString) wktReader
.read(way2);
multilinestring.getLength();
int numGeometries = multilinestring.getNumGeometries();
for (int i = 0; i < numGeometries; i++) {
for (Coordinate coordenada : multilinestring
.getGeometryN(i).getCoordinates()) {
LatLon ll = new LatLon(coordenada.y, coordenada.x);
way.addNode(new Node(ll));
if (info == null)
info = ll;
}
way.mappaintStyle = ls;