Global Positioning System Reference
In-Depth Information
Logically, all links are embedded in the <way> s. Thus, the compiler
can traverse through all ways to extract links. The original OSM <way> s
will not be written back to the output. The input stream is then closed,
while the output stream is left open and waiting for the new <way> s, now
becoming <link> s:
parseOSM()
loadWay( element )
identifyWay( element, keyValPattern )
ways[feature].add( way )
Each network has its own distribution of nodes:
nodeDistribution[0]:
<nodeID,times>
---------+-----
: :
-95=2
21293824=1
77=3
255076555=2
-147=2
: :
After parseOSM() , the input file has served its purpose, while the output
file was only filled with the original nodes and is waiting for the new links.
The method compileLinks() is the major method to transfer ways into
links. Technically, links have the same structure as ways and can be stored
in
List<List<Integer>>[] links
= new ArrayList[ wayFeatures.length ]
The method findNetworkConnectors() makes use of the Collection alge-
bra to determine the common nodes connecting the dierent networks|in
this case, the destination points.
The method isolateSharedNodes() eliminates all keys from the node
DistributionMap with only a single occurrence ( times==1 ). A shared node
is a node with more than one occurrence.
The method splitWaysInLinks() is the core of the link compiler and
loops through all ways and all wayFeatures. Each way is transferred into
links from the first node to the first shared node, from this shared node to
the next, and finally from the last shared node to the last node.
The method isSharedNode(intfeat,intid) checks the node distri-
bution, returns true if it is shared, and does the bookkeeping by removing
one occurrence of the id or by removing the key completely from the Map ,
if it occurs only once.
Finally, writeLinks() writes the created links to the output file, statistics
are collected, the closing </osm> tag is added, and the file stream is closed.
 
Search WWH ::




Custom Search