public class OSMMap
extends java.lang.Object
Constructor and Description |
---|
OSMMap()
Construct an empty map.
|
OSMMap(org.dom4j.Document doc)
Construct a map from an XML document.
|
OSMMap(java.io.File file)
Construct a map from an XML file.
|
OSMMap(OSMMap other,
double minLat,
double minLon,
double maxLat,
double maxLon)
Construct a copy of an OSMMap over a bounded area.
|
Modifier and Type | Method and Description |
---|---|
java.util.Collection<OSMBuilding> |
getBuildings()
Get all buildings.
|
double |
getCentreLatitude()
Get the centre latitude in this map.
|
double |
getCentreLongitude()
Get the centre longitude in this map.
|
double |
getMaxLatitude()
Get the maximum latitude in this map.
|
double |
getMaxLongitude()
Get the maximum longitude in this map.
|
double |
getMinLatitude()
Get the minimum latitude in this map.
|
double |
getMinLongitude()
Get the minimum longitude in this map.
|
OSMNode |
getNearestNode(double lat,
double lon)
Get the nearest node to a point.
|
OSMNode |
getNode(java.lang.Long id)
Get a node by ID.
|
java.util.Collection<OSMNode> |
getNodes()
Get all nodes in the map.
|
java.util.Collection<OSMRoad> |
getRoads()
Get all roads.
|
void |
read(org.dom4j.Document doc)
Read an XML document and populate this map.
|
void |
removeBuilding(OSMBuilding building)
Remove a building.
|
void |
removeNode(OSMNode node)
Remove a node.
|
void |
removeRoad(OSMRoad road)
Remove a road.
|
void |
replaceNode(OSMNode old,
OSMNode replacement)
Replace a node and update all references.
|
org.dom4j.Document |
toXML()
Turn this map into XML.
|
public OSMMap()
public OSMMap(org.dom4j.Document doc) throws OSMException
doc
- The document to read.OSMException
public OSMMap(java.io.File file) throws OSMException, org.dom4j.DocumentException, java.io.IOException
file
- The file to read.OSMException
org.dom4j.DocumentException
java.io.IOException
public OSMMap(OSMMap other, double minLat, double minLon, double maxLat, double maxLon)
other
- The map to copy.minLat
- The minimum latitude of the new map.minLon
- The minimum longitude of the new map.maxLat
- The maximum latitude of the new map.maxLon
- The maximum longitude of the new map.public void read(org.dom4j.Document doc) throws OSMException
doc
- The document to read.OSMException
public org.dom4j.Document toXML()
public double getMinLongitude()
public double getMaxLongitude()
public double getCentreLongitude()
public double getMinLatitude()
public double getMaxLatitude()
public double getCentreLatitude()
public java.util.Collection<OSMNode> getNodes()
public void removeNode(OSMNode node)
node
- The node to remove.public OSMNode getNode(java.lang.Long id)
id
- The ID of the node.public OSMNode getNearestNode(double lat, double lon)
lat
- The latitude of the point.lon
- The longitude of the point.public void replaceNode(OSMNode old, OSMNode replacement)
old
- The node to replace.replacement
- The replacement node.public java.util.Collection<OSMRoad> getRoads()
public void removeRoad(OSMRoad road)
road
- The road to remove.public java.util.Collection<OSMBuilding> getBuildings()
public void removeBuilding(OSMBuilding building)
building
- The building to remove.