Constructor and Description |
---|
GMLMap()
Construct an empty GML map.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection<? extends GMLObject> objects)
Add a set of objects.
|
void |
add(GMLObject... objects)
Add a set of objects.
|
void |
add(GMLObject object)
Add an object.
|
void |
addBuilding(GMLBuilding b)
Add a building.
|
void |
addEdge(GMLEdge e)
Add an edge.
|
void |
addNode(GMLNode n)
Add a node.
|
void |
addRoad(GMLRoad r)
Add a road.
|
void |
addSpace(GMLSpace s)
Add a space.
|
java.util.List<GMLDirectedEdge> |
apexesToEdges(GMLNode... apexes)
Turn a list of apexes into a list of directed edges.
|
java.util.List<GMLDirectedEdge> |
apexesToEdges(java.util.List<GMLNode> apexes)
Turn a list of apexes into a list of directed edges.
|
void |
convertCoordinates(CoordinateConversion conversion)
Rescale the map coordinates.
|
GMLBuilding |
createBuilding(java.util.List<GMLDirectedEdge> bEdges)
Create new GMLBuilding.
|
GMLBuilding |
createBuildingFromNodes(java.util.List<GMLNode> apexes)
Create new GMLBuilding.
|
GMLEdge |
createEdge(GMLNode first,
GMLNode second)
Create a new GMLEdge between two nodes.
|
GMLNode |
createNode(double x,
double y)
Create a new GMLNode.
|
GMLNode |
createNode(GMLCoordinates coords)
Create a new GMLNode.
|
java.util.List<GMLNode> |
createNodes(java.util.List<GMLCoordinates> coords)
Create a set of new GMLNodes.
|
java.util.List<GMLNode> |
createNodesFromPoints(java.util.List<Point2D> coords)
Create a set of new GMLNodes.
|
GMLRoad |
createRoad(java.util.List<GMLDirectedEdge> rEdges)
Create new GMLRoad.
|
GMLRoad |
createRoadFromNodes(java.util.List<GMLNode> apexes)
Create new GMLRoad.
|
GMLSpace |
createSpace(java.util.List<GMLDirectedEdge> sEdges)
Create new GMLSpace.
|
GMLSpace |
createSpaceFromNodes(java.util.List<GMLNode> apexes)
Create new GMLSpace.
|
GMLEdge |
ensureEdge(GMLNode first,
GMLNode second)
Create or retrieve an existing edge between two nodes.
|
GMLEdge |
findNearestEdge(double x,
double y)
Find the GMLEdge nearest a point.
|
GMLEdge |
findNearestEdge(double x,
double y,
java.util.Collection<? extends GMLEdge> possible)
Find the GMLEdge nearest a point from a set of possible edges.
|
GMLNode |
findNearestNode(double x,
double y)
Find the GMLNode nearest a point.
|
GMLShape |
findShapeUnder(double x,
double y)
Find the GMLShape under a point.
|
java.util.Set<GMLObject> |
getAllObjects()
Get all objects in the map.
|
java.util.Set<GMLShape> |
getAllShapes()
Get all shapes in the map.
|
java.util.Collection<GMLEdge> |
getAttachedEdges(GMLNode node)
Get all GMLEdges that are attached to a GMLNode.
|
java.util.Collection<GMLShape> |
getAttachedShapes(GMLEdge edge)
Get all GMLShapes that are attached to a GMLEdge.
|
GMLBuilding |
getBuilding(int id)
Get a building by ID.
|
java.util.Set<GMLBuilding> |
getBuildings()
Get all buildings in the map.
|
GMLEdge |
getEdge(int id)
Get an edge by ID.
|
java.util.Set<GMLEdge> |
getEdges()
Get all edges in the map.
|
double |
getMaxX()
Get the maximum x coordinate.
|
double |
getMaxY()
Get the maximum y coordinate.
|
double |
getMinX()
Get the minimum x coordinate.
|
double |
getMinY()
Get the minimum y coordinate.
|
GMLNode |
getNode(int id)
Get a node by ID.
|
java.util.Set<GMLNode> |
getNodes()
Get all nodes in the map.
|
java.util.Collection<GMLNode> |
getNodesInRegion(double xMin,
double yMin,
double xMax,
double yMax)
Get all GMLNodes inside a region.
|
GMLObject |
getObject(int id)
Get an object by ID.
|
GMLRoad |
getRoad(int id)
Get a road by ID.
|
java.util.Set<GMLRoad> |
getRoads()
Get all roads in the map.
|
GMLShape |
getShape(int id)
Get a shape by ID.
|
GMLSpace |
getSpace(int id)
Get a space by ID.
|
java.util.Set<GMLSpace> |
getSpaces()
Get all spaces in the map.
|
boolean |
hasSize()
Find out if this map has a real size or not.
|
GMLEdge |
mergeEdges(GMLEdge edge1,
GMLEdge edge2)
Merge a pair of edges and form a new edge.
|
void |
remove(java.util.Collection<? extends GMLObject> objects)
Remove a set of objects.
|
void |
remove(GMLObject... objects)
Remove a set of objects.
|
void |
remove(GMLObject object)
Remove an object.
|
void |
removeAllBuildings()
Remove all buildings.
|
void |
removeAllEdges()
Remove all edges and shapes.
|
void |
removeAllNodes()
Remove all nodes, edges and shapes.
|
void |
removeAllRoads()
Remove all roads.
|
void |
removeAllSpaces()
Remove all spaces.
|
void |
removeBuilding(GMLBuilding b)
Remove a building.
|
java.util.Collection<GMLObject> |
removeEdge(GMLEdge e)
Remove an edge and any attached shapes.
|
java.util.Collection<GMLObject> |
removeNode(GMLNode n)
Remove a node, any edges attached to the node and any shapes attached to those edges.
|
void |
removeRoad(GMLRoad r)
Remove a road.
|
void |
removeSpace(GMLSpace s)
Remove a space.
|
void |
replaceEdge(GMLEdge oldEdge,
GMLEdge newEdge)
Replace all references to an edge with another edge.
|
void |
replaceNode(GMLNode oldNode,
GMLNode newNode)
Replace all references to a node with another node.
|
java.util.Collection<GMLEdge> |
splitEdge(GMLEdge edge,
GMLNode node)
Insert a node into an edge.
|
public GMLNode createNode(double x, double y)
x
- The X coordinate of the node in m.y
- The Y coordinate of the node in m.public GMLNode createNode(GMLCoordinates coords)
coords
- The coordinates of the node.public java.util.List<GMLNode> createNodes(java.util.List<GMLCoordinates> coords)
coords
- The coordinates of the new nodes.public java.util.List<GMLNode> createNodesFromPoints(java.util.List<Point2D> coords)
coords
- The coordinates of the new nodes.public GMLEdge createEdge(GMLNode first, GMLNode second)
first
- The 'start' node.second
- The 'end' node.public GMLBuilding createBuildingFromNodes(java.util.List<GMLNode> apexes)
apexes
- The apexes of the building.public GMLBuilding createBuilding(java.util.List<GMLDirectedEdge> bEdges)
bEdges
- The edges of the building.public GMLRoad createRoadFromNodes(java.util.List<GMLNode> apexes)
apexes
- The apexes of the road.public GMLRoad createRoad(java.util.List<GMLDirectedEdge> rEdges)
rEdges
- The edges of the road.public GMLSpace createSpaceFromNodes(java.util.List<GMLNode> apexes)
apexes
- The apexes of the space.public GMLSpace createSpace(java.util.List<GMLDirectedEdge> sEdges)
sEdges
- The edges of the space.public void addNode(GMLNode n)
n
- The node to add.public void addEdge(GMLEdge e)
e
- The edge to add.public void addBuilding(GMLBuilding b)
b
- The building to add.public void addRoad(GMLRoad r)
r
- The road to add.public void addSpace(GMLSpace s)
s
- The space to add.public void add(GMLObject object)
object
- The object to add.public void add(java.util.Collection<? extends GMLObject> objects)
objects
- The objects to add.public void add(GMLObject... objects)
objects
- The objects to add.public java.util.Collection<GMLObject> removeNode(GMLNode n)
n
- The node to remove.public java.util.Collection<GMLObject> removeEdge(GMLEdge e)
e
- The edge to remove.public void removeBuilding(GMLBuilding b)
b
- The building to remove.public void removeRoad(GMLRoad r)
r
- The road to remove.public void removeSpace(GMLSpace s)
s
- The space to remove.public void remove(GMLObject object)
object
- The object to remove.public void remove(java.util.Collection<? extends GMLObject> objects)
objects
- The objects to remove.public void remove(GMLObject... objects)
objects
- The objects to remove.public void removeAllNodes()
public void removeAllEdges()
public void removeAllBuildings()
public void removeAllRoads()
public void removeAllSpaces()
public GMLNode getNode(int id)
id
- The ID to look up.public GMLEdge getEdge(int id)
id
- The ID to look up.public GMLBuilding getBuilding(int id)
id
- The ID to look up.public GMLRoad getRoad(int id)
id
- The ID to look up.public GMLSpace getSpace(int id)
id
- The ID to look up.public GMLShape getShape(int id)
id
- The ID to look up.public GMLObject getObject(int id)
id
- The ID to look up.public java.util.Set<GMLNode> getNodes()
public java.util.Set<GMLEdge> getEdges()
public java.util.Set<GMLBuilding> getBuildings()
public java.util.Set<GMLRoad> getRoads()
public java.util.Set<GMLSpace> getSpaces()
public java.util.Set<GMLShape> getAllShapes()
public java.util.Set<GMLObject> getAllObjects()
public double getMinX()
public double getMaxX()
public double getMinY()
public double getMaxY()
public boolean hasSize()
public void convertCoordinates(CoordinateConversion conversion)
conversion
- The coordinate conversion to apply.public GMLEdge ensureEdge(GMLNode first, GMLNode second)
first
- The 'start' node.second
- The 'end' node.public java.util.List<GMLDirectedEdge> apexesToEdges(GMLNode... apexes)
apexes
- The apexes to convert.public java.util.List<GMLDirectedEdge> apexesToEdges(java.util.List<GMLNode> apexes)
apexes
- The apexes to convert.public java.util.Collection<GMLNode> getNodesInRegion(double xMin, double yMin, double xMax, double yMax)
xMin
- The lower X bound of the region.yMin
- The lower Y bound of the region.xMax
- The upper X bound of the region.yMax
- The upper Y bound of the region.public GMLNode findNearestNode(double x, double y)
x
- The X coordinate.y
- The Y coordinate.public GMLEdge findNearestEdge(double x, double y)
x
- The X coordinate.y
- The Y coordinate.public GMLEdge findNearestEdge(double x, double y, java.util.Collection<? extends GMLEdge> possible)
x
- The X coordinate.y
- The Y coordinate.possible
- The set of possible edges.public GMLShape findShapeUnder(double x, double y)
x
- The X coordinate.y
- The Y coordinate.public java.util.Collection<GMLEdge> getAttachedEdges(GMLNode node)
node
- The GMLNode to look up.public java.util.Collection<GMLShape> getAttachedShapes(GMLEdge edge)
edge
- The GMLEdge to look up.public GMLEdge mergeEdges(GMLEdge edge1, GMLEdge edge2)
edge1
- The first edge.edge2
- The second edge.public void replaceNode(GMLNode oldNode, GMLNode newNode)
oldNode
- The node to replace.newNode
- The new node.public void replaceEdge(GMLEdge oldEdge, GMLEdge newEdge)
oldEdge
- The edge to replace.newEdge
- The new edge.