コード例 #1
0
ファイル: LoadingDataSet.java プロジェクト: tfreese/misc
 /**
  * ${@inheritDoc}.
  *
  * @see org.openstreetmap.osm.data.IDataSet#getWaysForNode(long)
  */
 public Iterator<Way> getWaysForNode(final long aNodeID) {
   Iterator<Way> n = myCachingDataSet.getWaysForNode(aNodeID);
   if (n == null || !n.hasNext()) {
     n = myDataSource.getWaysForNode(aNodeID);
     if (n != null && n.hasNext()) {
       LinkedList<Way> nodes = new LinkedList<Way>();
       while (n.hasNext()) {
         Way node = n.next();
         nodes.add(node);
         myCachingDataSet.addWay(node);
       }
       return nodes.iterator();
     }
   }
   return n;
 }
コード例 #2
0
ファイル: LoadingDataSet.java プロジェクト: tfreese/misc
  /**
   * We have to get all ways for each node cached to get no inconsistencies when {@link
   * #getWaysForNode(long)} is called.
   *
   * @param n the node to add to {@link #myCachingDataSet}.
   */
  private void cacheNode(final Node n) {
    myCachingDataSet.addNode(n);

    Iterator<Way> ways = myDataSource.getWaysForNode(n.getId());
    if (ways != null && ways.hasNext()) {
      while (ways.hasNext()) {
        Way way = ways.next();
        myCachingDataSet.addWay(way);
      }
    }
  }