Package org.eclipse.mosaic.lib.database
Class Database
java.lang.Object
org.eclipse.mosaic.lib.database.Database
This contains all information about the traffic network, as well as possible obstacles affecting
communications and predefined routing information. The information can be persisted to and read
from a file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for simple generation for a newDatabase.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringValue for key "importOrigin" which states, that the import origin of the database was a OpenStreetMap file.static final StringValue for key "importOrigin" which states, that the import origin of the database was a SUMO network file.static final StringKey for the import origin property.static final StringKey for the import origin property.static final StringDefault name if no version name was defined. -
Method Summary
Modifier and TypeMethodDescriptionReturns the bounding box containing all nodes in the database.getBuilding(String id) Returns theBuildingwith the given id.Returns all buildings from the database.getConnection(String id) Returns theConnectionwith the given id.Returns an unmodifiable view of the knownConnections.Returns the import origin of the given Database.Returns theNodewith the given id.getNodes()Returns an unmodifiable view of the knownNodes.getProperty(String key) Returns the value of the requested property with the given key.Returns all property keys.getRestriction(String id) Returns theRestrictionwith the given id.Returns an unmodifiable view of the knownRestrictions.Returns all roundabouts from the database.Returns theRoutewith the given id.Returns an unmodifiable view of the knownRoutes.Returns a list of all nodes, which are tagged as traffic lights.Returns the version of the given Database.Returns theWaywith the given id.getWays()Returns an unmodifiable view of the knownWays.static DatabaseloadFromFile(File file) This method loads tries to load a database object from the givenFile, which should refer to a database-file.static DatabaseloadFromFile(String filename) This method loads tries to load a database object from the given filename, which should refer to a database-file.voidsaveToFile(String filename) Saves the current database to a SQLite file.
-
Field Details
-
VERSION_UNKNOWN
Default name if no version name was defined. If a database has this value set it usually means, that the database was one of the following:
- just created and is not persisted yet
- not loaded yet
- could not be loaded from persistence
- See Also:
-
PROPERTY_VERSION
Key for the import origin property.- See Also:
-
PROPERTY_IMPORT_ORIGIN
Key for the import origin property.- See Also:
-
IMPORT_ORIGIN_SUMO
Value for key "importOrigin" which states, that the import origin of the database was a SUMO network file.- See Also:
-
IMPORT_ORIGIN_OSM
Value for key "importOrigin" which states, that the import origin of the database was a OpenStreetMap file.- See Also:
-
-
Method Details
-
loadFromFile
This method loads tries to load a database object from the givenFile, which should refer to a database-file. ASQLiteReaderis used for the translation of the database to the Java-Object- Parameters:
file- the database-file- Returns:
- the loaded database
-
loadFromFile
This method loads tries to load a database object from the given filename, which should refer to a database-file.- Parameters:
filename- aStringrepresentation of the file to be loaded- Returns:
- the loaded database
-
saveToFile
Saves the current database to a SQLite file.- Parameters:
filename- database filename.
-
getVersion
Returns the version of the given Database.- Returns:
- version as string or
VERSION_UNKNOWN
-
getImportOrigin
Returns the import origin of the given Database.- Returns:
- import origin as string
-
getProperty
Returns the value of the requested property with the given key.- Parameters:
key- Key of the requested property.- Returns:
- Requested property.
-
getPropertyKeys
Returns all property keys.- Returns:
- Set of the property keys.
-
getNode
Returns theNodewith the given id.- Parameters:
id- Id of the Node.- Returns:
- Requested node.
-
getWay
Returns theWaywith the given id.- Parameters:
id- Id of the way.- Returns:
- Way with the given Id.
-
getConnection
Returns theConnectionwith the given id.- Parameters:
id- Id of the connection.- Returns:
- Connection with the given Id.
-
getBuilding
Returns theBuildingwith the given id.- Parameters:
id- id of the building.- Returns:
- The building identified by the given id.
-
getRoute
Returns theRoutewith the given id.- Parameters:
id- Id of the route.- Returns:
- Route with the given Id.
-
getRestriction
Returns theRestrictionwith the given id.- Parameters:
id- Id of the restriction.- Returns:
- Restriction with the given Id.
-
getBoundingBox
Returns the bounding box containing all nodes in the database.- Returns:
- the bounding box as
GeoRectangle
-
getNodes
Returns an unmodifiable view of the knownNodes.- Returns:
- Nodes as
Collection.
-
getTrafficLightNodes
Returns a list of all nodes, which are tagged as traffic lights.- Returns:
- Traffic light nodes.
-
getWays
Returns an unmodifiable view of the knownWays.- Returns:
- All ways as
Collection.
-
getConnections
Returns an unmodifiable view of the knownConnections.- Returns:
- All connections as
Collection.
-
getRoundabouts
Returns all roundabouts from the database.- Returns:
- All roundabouts in a
Collection.
-
getBuildings
Returns all buildings from the database.- Returns:
- All buildings in a
Collection.
-
getRoutes
Returns an unmodifiable view of the knownRoutes.- Returns:
- All routes as
Collection.
-
getRestrictions
Returns an unmodifiable view of the knownRestrictions.- Returns:
- All restrictions as
Collection.
-