Package org.openstreetmap.osmosis.core.container.v0_6

Examples of org.openstreetmap.osmosis.core.container.v0_6.WayContainer


    @Override
    public void run() {
      try {
        sink.initialize(Collections.<String, Object>emptyMap());
        if (publishBound) {
          sink.process(new BoundContainer(bound));
        }
        sink.process(new NodeContainer(createNode()));
        sink.complete();
      } finally {
        sink.release();
View Full Code Here


    bounds.add(new Bound("Osmosis " + OsmosisConstants.VERSION));
   
    sources = new ArrayList<ReleasableIterator<EntityContainer>>();
   
    sources.add(new UpcastIterator<EntityContainer, BoundContainer>(
        new BoundContainerIterator(new ReleasableAdaptorForIterator<Bound>(bounds.iterator()))));
    sources.add(new UpcastIterator<EntityContainer, NodeContainer>(
        new NodeContainerIterator(nodeDao.iterate())));
    sources.add(new UpcastIterator<EntityContainer, WayContainer>(
        new WayContainerIterator(wayDao.iterate())));
    sources.add(new UpcastIterator<EntityContainer, RelationContainer>(
View Full Code Here

    // Create iterators for the selected records for each of the entity types.
    LOG.finer("Iterating over results.");
    resultSets = new ArrayList<ReleasableIterator<EntityContainer>>();
    resultSets.add(
        new UpcastIterator<EntityContainer, BoundContainer>(
            new BoundContainerIterator(new ReleasableAdaptorForIterator<Bound>(bounds.iterator()))));
    resultSets.add(
        new UpcastIterator<EntityContainer, NodeContainer>(
            new NodeContainerIterator(nodeDao.iterate("bbox_"))));
    resultSets.add(
        new UpcastIterator<EntityContainer, WayContainer>(
View Full Code Here

    bounds.add(new Bound("Osmosis " + OsmosisConstants.VERSION));
   
    sources = new ArrayList<ReleasableIterator<EntityContainer>>();
   
    sources.add(new UpcastIterator<EntityContainer, BoundContainer>(
        new BoundContainerIterator(new ReleasableAdaptorForIterator<Bound>(bounds.iterator()))));
    sources.add(new UpcastIterator<EntityContainer, NodeContainer>(
        new NodeContainerIterator(nodeDao.iterate())));
    sources.add(new UpcastIterator<EntityContainer, WayContainer>(
        new WayContainerIterator(wayDao.iterate())));
    sources.add(new UpcastIterator<EntityContainer, RelationContainer>(
View Full Code Here

      // Create iterators for the selected records for each of the entity types.
      LOG.finer("Iterating over results.");
      resultSets = new ArrayList<ReleasableIterator<EntityContainer>>();
      resultSets.add(
          new UpcastIterator<EntityContainer, BoundContainer>(
              new BoundContainerIterator(new ReleasableAdaptorForIterator<Bound>(bounds.iterator()))));
      resultSets.add(
          new UpcastIterator<EntityContainer, NodeContainer>(
              new NodeContainerIterator(new NodeReader(dbCtx, "box_node_list"))));
      resultSets.add(
          new UpcastIterator<EntityContainer, WayContainer>(
View Full Code Here

                ChangeAction action = diff.changeType().equals(ChangeType.ADDED) ? ChangeAction.Create
                        : diff.changeType().equals(ChangeType.MODIFIED) ? ChangeAction.Modify
                                : ChangeAction.Delete;

                return new ChangeContainer(container, action);

            }

        };
        return Iterators.transform(iterator, function);
View Full Code Here

            return;
        }
        BufferedWriter bufWriter = new BufferedWriter(new FileWriter(new File(file)));
        XmlChangeWriter writer = new XmlChangeWriter(bufWriter);
        while (entries.hasNext()) {
            ChangeContainer change = entries.next();
            writer.process(change);
        }
        writer.complete();
        bufWriter.flush();
View Full Code Here

    currentEntityType = peekEntity.getType();
   
    // Loop until all history values for the current element are exhausted.
    changeList = new ArrayList<ChangeContainer>();
    while (sourceIterator.hasNext()) {
      ChangeContainer tmpChangeContainer = sourceIterator.peekNext();
     
      // Break out of the loop when we reach the next entity in the stream.
      if (currentId != tmpChangeContainer.getEntityContainer().getEntity().getId()
        || !currentEntityType.equals(tmpChangeContainer.getEntityContainer().getEntity().getType())) {
        break;
      }
     
      // We want the value that we have already peeked from the iterator, so remove it from the iterator.
      sourceIterator.next();
View Full Code Here

    // The entity has been modified if it is visible and was created previously.
    // It is a create if it is visible and was NOT created previously.
    // It is a delete if it is NOT visible and was created previously.
    // No action if it is NOT visible and was NOT created previously.
    if (entityHistory.isVisible() && createdPreviously) {
      return new ChangeContainer(entityContainer, ChangeAction.Modify);
    } else if (entityHistory.isVisible() && !createdPreviously) {
      return new ChangeContainer(entityContainer, ChangeAction.Create);
    } else if (!entityHistory.isVisible() && createdPreviously) {
      return new ChangeContainer(entityContainer, ChangeAction.Delete);
    } else {
      // This is an unusual case in that an initial version has been marked as not visible.
      // The production database contains many examples of this, presumably due to the original
      // TIGER import not being deleted properly.
      return new ChangeContainer(entityContainer, ChangeAction.Delete);
    }
  }
View Full Code Here

   * {@inheritDoc}
   */
  public boolean hasNext() {
    while (!nextValueLoaded && sourceIterator.hasNext()) {
      List<ChangeContainer> changeList;
      ChangeContainer changeContainer;
      boolean createdPreviously;
     
      // Get the next change list from the underlying stream.
      changeList = sourceIterator.next();
     
      // Check the first node, if it has a version greater than 1 the node
      // existed prior to the interval beginning and therefore cannot be a
      // create.
      createdPreviously = (changeList.get(0).getEntityContainer().getEntity().getVersion() > 1);
     
      // Get the most current change.
      changeContainer = changeList.get(changeList.size() - 1);
     
      // The entity has been modified if it is a create/modify and was created previously.
      // It is a create if it is create/modify and was NOT created previously.
      // It is a delete if it is a delete and was created previously.
      // No action if it is a delete and was NOT created previously.
      if (!ChangeAction.Delete.equals(changeContainer.getAction()) && createdPreviously) {
        nextValue = new ChangeContainer(changeContainer.getEntityContainer(), ChangeAction.Modify);
        nextValueLoaded = true;
      } else if (!ChangeAction.Delete.equals(changeContainer.getAction()) && !createdPreviously) {
        nextValue = new ChangeContainer(changeContainer.getEntityContainer(), ChangeAction.Create);
        nextValueLoaded = true;
      } else if (ChangeAction.Delete.equals(changeContainer.getAction()) && createdPreviously) {
        nextValue = new ChangeContainer(changeContainer.getEntityContainer(), ChangeAction.Delete);
        nextValueLoaded = true;
      }
    }
   
    return nextValueLoaded;
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.container.v0_6.WayContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.