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 class
Builder class for simple generation for a newDatabase
.static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Value for key "importOrigin" which states, that the import origin of the database was a OpenStreetMap file.static final String
Value for key "importOrigin" which states, that the import origin of the database was a SUMO network file.static final String
Key for the import origin property.static final String
Key for the import origin property.static final String
Default 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 theBuilding
with the given id.Returns all buildings from the database.getConnection
(String id) Returns theConnection
with the given id.Returns an unmodifiable view of the knownConnection
s.Returns the import origin of the given Database.Returns theNode
with the given id.getNodes()
Returns an unmodifiable view of the knownNode
s.getProperty
(String key) Returns the value of the requested property with the given key.Returns all property keys.getRestriction
(String id) Returns theRestriction
with the given id.Returns an unmodifiable view of the knownRestriction
s.Returns all roundabouts from the database.Returns theRoute
with the given id.Returns an unmodifiable view of the knownRoute
s.Returns a list of all nodes, which are tagged as traffic lights.Returns the version of the given Database.Returns theWay
with the given id.getWays()
Returns an unmodifiable view of the knownWay
s.static Database
loadFromFile
(File file) This method loads tries to load a database object from the givenFile
, which should refer to a database-file.static Database
loadFromFile
(String filename) This method loads tries to load a database object from the given filename, which should refer to a database-file.void
saveToFile
(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. ASQLiteReader
is 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
- aString
representation 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 theNode
with the given id.- Parameters:
id
- Id of the Node.- Returns:
- Requested node.
-
getWay
Returns theWay
with the given id.- Parameters:
id
- Id of the way.- Returns:
- Way with the given Id.
-
getConnection
Returns theConnection
with the given id.- Parameters:
id
- Id of the connection.- Returns:
- Connection with the given Id.
-
getBuilding
Returns theBuilding
with the given id.- Parameters:
id
- id of the building.- Returns:
- The building identified by the given id.
-
getRoute
Returns theRoute
with the given id.- Parameters:
id
- Id of the route.- Returns:
- Route with the given Id.
-
getRestriction
Returns theRestriction
with 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 knownNode
s.- 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 knownWay
s.- Returns:
- All ways as
Collection
.
-
getConnections
Returns an unmodifiable view of the knownConnection
s.- 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 knownRoute
s.- Returns:
- All routes as
Collection
.
-
getRestrictions
Returns an unmodifiable view of the knownRestriction
s.- Returns:
- All restrictions as
Collection
.
-