Public Member Functions | |
void | initNewMap (int width, int height, int regionWidth, int regionHeight) |
void | signalMapLoaded () |
void | load (File file, boolean zip) |
void | save (File file, boolean zip) |
Node | addNode (Node node) |
void | delNode (Node node) |
void | addRSU (RSU rsu) |
void | delRSU (int x, int y) |
void | addVehicle (Vehicle vehicle) |
void | delVehicle (Vehicle vehicle) |
void | addStreet (Street street) |
void | delStreet (Street street) |
void | addMixZone (Node node, int radius) |
void | deleteMixZone (Node node) |
void | clearMixZones () |
void | clearRSUs () |
void | clearVehicles () |
void | autoTrimMap (int minX, int minY, int maxX, int maxY) |
int | trimStreet (int streetXInside, int streetYInside, int streetXOutside, int streetYOutside, int border) |
void | saveReloadMap () |
void | clearTrafficLights () |
int | getMapWidth () |
int | getMapHeight () |
Region | getRegionOfPoint (int x, int y) |
void | writeSilentPeriodHeader () |
Region[][] | getRegions () |
int | getRegionCountX () |
int | getRegionCountY () |
boolean | getReadyState () |
Static Public Member Functions | |
static Map | getInstance () |
Static Public Attributes | |
static final int | LANE_WIDTH = 300 |
The map. The coordinate system is 2-dimensional with each axis allowing values from 0 to Integer.MAXVALUE (2147483647). Negative values are not allowed. The scale is 1:1cm which means that about 21474km x 21474km is the maximum size of a map (should be more than enough for all cases). The map is divided into several rectangular Regions in order to improve performance. All vehicles, nodes and streets are stored in these regions. Because of the regions, for example rendering and distance calculations only need to be done on a limited amount of vehicles/streets/nodes which helps handling large maps a lot.
|
inline |
Add a new mix zone to the correct region. A mix zone can only be in one region.
node | the mix zone node to add |
radius | the mix zone radius |
Add a new node to the correct region. A node can only be in one region.
node | the node to add |
|
inline |
Add a new Road-Side-Unit to the correct region. A RSU can only be in one region.
rsu | the RSU to add |
|
inline |
Add a new street to the correct region(s). Note that a street can be in multiple regions and so we must determine all here! This makes rendering and calculations a lot easier later!
street | the street to add |
|
inline |
Add a new vehicle to the correct start region. A vehicle can only be in one region and may move to other regions during the simulation. Although a vehicle is part of a scenario, it's added here as the map knows everything about how to correctly put it into a region.
vehicle | the vehicle to add |
|
inline |
Function to trim a map. If no coordinates are chosen the map will be trimmed to its borders (Only empty space will be removed). Otherwise the map will be trimmed according to the coordinates.
minX | the minimum x coordinate |
maxX | the maximum x coordinate |
minY | the minimum y coordinate |
maxY | the maximum y coordinate |
|
inline |
Delete every Mix Zone on this map
|
inline |
Delete every RSU on this map
|
inline |
Delete every turn-off lane on this map
|
inline |
Delete every Vehicle on this map
|
inline |
Delete a mix zone in the correct region.
|
inline |
Delete a node from it's region.
node | the node to remove |
|
inline |
Delete a Road-Side-Unit from it's region.
x | the x coordinate of the rsu |
y | the y coordinate of the rsu |
|
inline |
Delete a street from all region(s) it's in.
street | the street to delete |
|
inline |
Deletes a vehicle from it's region.
vehicle | the vehicle to delete |
|
inlinestatic |
Gets the single instance of this map.
|
inline |
Gets the map height.
|
inline |
Gets the map width.
|
inline |
Returns if a map is currently in the process of being loaded. While loading, simulation and rendering should not be done because not all map elements are already existing!
true
if loading has finished, else false
|
inline |
Gets the amount of regions in x direction.
|
inline |
Gets the amount of regions in y direction.
|
inline |
Calculates the Region of a point.
x | the x coordinate of the point |
y | the y coordinate of the point |
null
if there was a problem
|
inline |
Gets all regions.
|
inline |
Initializes a new map.
width | the width |
height | the height |
regionWidth | the width of a region |
regionHeight | the height of a region |
|
inline |
Load a map.
file | the file to load |
zip | true if the file given is zipped, else false |
|
inline |
Save the map.
file | the file in which to save |
zip | if true , file is saved in a compressed zip file (extension .zip is added to file !). If false , no compression is made. |
|
inline |
Helper function to save and reload a map after editing
|
inline |
This function needs to be called to signal that the loading process of the map has finished.
|
inline |
write silent period header to log file
|
static |
The width of a single lane (3m). Used in various other places in this program!