Definition at line 12 of file NetTranslater.java.
Static Public Member Functions | |
| static void | translate (List< Edge > edges, Map< String, Junction > junctions) |
| static void ns2::NetTranslater::translate | ( | List< Edge > | edges, | |
| Map< String, Junction > | junctions | |||
| ) | [inline, static] |
method fro translating sumo net needed for avoiding negative coordinates in ns2
| edges | contains sumo net |
Definition at line 18 of file NetTranslater.java.
00018 { 00019 // scan coordinates 00020 float xmin = 0; 00021 float ymin = 0; 00022 boolean first = true; 00023 for (Junction junction: junctions.values()) 00024 { 00025 if (first) 00026 { 00027 first = false; 00028 xmin = junction.x; 00029 ymin = junction.y; 00030 } 00031 else 00032 { 00033 xmin = Math.min(xmin, junction.x); 00034 ymin = Math.min(ymin, junction.y); 00035 } 00036 } 00037 // translate if needed 00038 if (xmin < 0 || ymin < 0) { 00039 for (Junction junction: junctions.values()) 00040 { 00041 junction.x -= xmin; 00042 junction.y -= ymin; 00043 } 00044 for (Edge edge: edges) { 00045 for (Lane lane: edge.lanes.values()) 00046 { 00047 lane.xfrom -= xmin; 00048 lane.xto -= xmin; 00049 lane.yfrom -= ymin; 00050 lane.yto -= ymin; 00051 } 00052 } 00053 } 00054 }
1.5.6