public class OSMNetwork extends Object implements Serializable
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 2015) $, @version $Revision: 1155 $, by $Author: averbraeck $,
initial version 31 dec. 2014
Constructor and Description |
---|
OSMNetwork(String name)
Construct a new OSMNetwork.
|
Modifier and Type | Method and Description |
---|---|
void |
addNode(OSMNode node)
Add one OSMNode to this OSMNetwork.
|
void |
addRelation(OSMRelation osmRelation)
Add one OSMRelation to this Network.
|
void |
addWay(OSMWay way)
Add one OSMWay to this OSMNetwork.
|
OSMLink |
findFollowingLink(OSMLink link)
Finds the link that follows a given OSMLink.
|
OSMLink |
findPrecedingLink(OSMLink link)
Finds an OSMLink that precedes the given OSMLink.
|
List<OSMLink> |
getLinks()
Retrieve the list of OSMLinks of this OSMNetwork.
|
String |
getName()
Retrieve the name of this OSMNetwork.
|
OSMNode |
getNode(long nodeId)
Retrieve a Node from this Network.
|
Map<Long,OSMNode> |
getNodes()
Retrieve the map of OSMNode ids to OSMNodes of this OSMNetwork.
|
List<Long> |
getNodesFromWay(Long wayId)
Retrieve a list of Nodes that form a Way from this Network.
|
OSMRelation |
getRelation(long relid)
Retrieve a Relation from this Network.
|
Map<Long,OSMRelation> |
getRelations()
Retrieve the map of OSMRelations of this OSMNetwork.
|
OSMWay |
getWay(long wayid)
Retrieve a Way from this Network.
|
Map<Long,OSMWay> |
getWays()
Retrieve the map of OSMWays of this OSMNetwork.
|
boolean |
hasFollowingLink(OSMLink link)
Returns true if the given OSMLink has a following OSMLink.
|
boolean |
hasPrecedingLink(OSMLink link)
Returns true if the given link has a preceding link.
|
void |
makeLinks(WarningListener warningListener,
ProgressListener progressListener)
Creates links out of the ways in this network.
|
void |
removeRedundancy()
FIXME Network looks 'crooked' after using this.
|
void |
setNodes(HashMap<Long,OSMNode> newnodes)
Set/replace the Nodes of this Network.
The provided list is not copied; the caller should not modify the list after setting it. |
String |
toString() |
public OSMNetwork(String name)
name
- String; the name of the new Networkpublic final List<Long> getNodesFromWay(Long wayId) throws IOException
wayId
- Long; the id of the WayIOException
- when no Way with the specified id exists in this Networkpublic final OSMNode getNode(long nodeId) throws IOException
nodeId
- long; the id of the NodeIOException
- when no OSMNode with the specified id exist in this Networkpublic final Map<Long,OSMNode> getNodes()
public final OSMRelation getRelation(long relid) throws IOException
relid
- long; the id of the RelationIOException
- when no Relation with the specified id exists in this Networkpublic final Map<Long,OSMRelation> getRelations()
public final OSMWay getWay(long wayid) throws IOException
wayid
- long; the id of a WayIOException
- when no Way with the specified id exist in this networkpublic final String getName()
public final void setNodes(HashMap<Long,OSMNode> newnodes)
newnodes
- HashMap<Long, OSMNode>; the (new) Nodes for this Networkpublic final void addNode(OSMNode node)
node
- OSMNode; the node to add to this OSMNetworkpublic final void addWay(OSMWay way)
way
- OSMWay; the OSMWay to addpublic final void addRelation(OSMRelation osmRelation)
osmRelation
- OSMRelation; the OSMRelation to addpublic final Map<Long,OSMWay> getWays()
public final List<OSMLink> getLinks()
public final void makeLinks(WarningListener warningListener, ProgressListener progressListener) throws IOException
warningListener
- WarningListener; the warning listener that will receive warning eventsprogressListener
- ProgressListener; the progress listener that will receive progress eventsIOException
- on read errorspublic final void removeRedundancy()
public final OSMLink findFollowingLink(OSMLink link)
link
- OSMLink; OSMLink for which a successor OSMLink is soughtpublic final OSMLink findPrecedingLink(OSMLink link)
link
- OSMLink; the OSMLink for which a predecessor OSMLink is soughtpublic final boolean hasPrecedingLink(OSMLink link)
link
- OSMLink; the link for which the caller wants to know whether there is a preceding linkpublic final boolean hasFollowingLink(OSMLink link)
link
- OSMLink; the OSMLink for which the caller wants to know if it has a follower OSMLinkCopyright © 2014–2019 Delft University of Technology. All rights reserved.