Package org.openstreetmap.osmosis.core.domain.v0_6

Examples of org.openstreetmap.osmosis.core.domain.v0_6.Way


   * Test writing out a Way element with no tags.
   */
  @Test
  public final void testProcessWayNoTags() {
    Way way =
      new Way(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    way.getWayNodes().add(new WayNode(1235));
    way.getWayNodes().add(new WayNode(1236));
   
    testWayWriter.process(way);
    try {
View Full Code Here


   */
  @Override
  public Relation parseRecord(ResultSet resultSet) {
    try {
      return new Relation(
        new CommonEntityData(
          resultSet.getLong("id"),
          resultSet.getInt("version"),
          new Date(resultSet.getTimestamp("tstamp").getTime()),
          buildUser(resultSet),
          resultSet.getLong("changeset_id")
View Full Code Here

        public void process(EntityContainer entityContainer) {
            if (progressListener.isCanceled()) {
                target.cancel();
                throw new OsmosisRuntimeException("Cancelled by user");
            }
            Entity entity = entityContainer.getEntity();
            if (++count % 10 == 0) {
                progressListener.setProgress(count);
            }
            latestChangeset = Math.max(latestChangeset, entity.getChangesetId());
            latestTimestamp = Math.max(latestTimestamp, entity.getTimestamp().getTime());
            Geometry geom = null;
            switch (entity.getType()) {
            case Node:
                nodeCount++;
                geom = parsePoint((Node) entity);
                break;
            case Way:
View Full Code Here

            if (progressListener.isCanceled()) {
                target.cancel();
                throw new OsmosisRuntimeException("Cancelled by user");
            }
            final EntityContainer entityContainer = container.getEntityContainer();
            final Entity entity = entityContainer.getEntity();
            final ChangeAction changeAction = container.getAction();
            if (changeAction.equals(ChangeAction.Delete)) {
                SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils
                        .wayType();
                String id = Long.toString(entity.getId());
                target.put(new FeatureToDelete(ft, id));
                return;
            }
            if (changeAction.equals(ChangeAction.Modify)) {
                // Check that the feature to modify exist. If so, we will just treat it as an
                // addition, overwriting the previous feature
                SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils
                        .wayType();
                String path = ft.getName().getLocalPart();
                Optional<org.locationtech.geogig.api.Node> opt = workTree.findUnstaged(path);
                if (!opt.isPresent()) {
                    return;
                }
            }

            if (++count % 10 == 0) {
                progressListener.setProgress(count);
            }
            latestChangeset = Math.max(latestChangeset, entity.getChangesetId());
            latestTimestamp = Math.max(latestTimestamp, entity.getTimestamp().getTime());
            Geometry geom = null;
            switch (entity.getType()) {
            case Node:
                nodeCount++;
                geom = parsePoint((Node) entity);
                break;
            case Way:
View Full Code Here

     * @param replaceId. The changesetId to use in case the feature has a negative one indicating a
     *        temporary value
     * @return
     */
    public Entity toEntity(SimpleFeature feature, Long changesetId) {
        Entity entity;
        SimpleFeatureType type = feature.getFeatureType();
        long id = Long.parseLong(feature.getID());
        int version = ((Integer) feature.getAttribute("version")).intValue();
        Long changeset = (Long) feature.getAttribute("changeset");
        if (changesetId != null && changeset < 0) {
View Full Code Here

                    PropertyDescriptor descriptor = descriptors.get(i);
                    Optional<Object> value = values.get(i);
                    featureBuilder.set(descriptor.getName(), value.orNull());
                }
                SimpleFeature feature = featureBuilder.buildFeature(ref.name());
                Entity entity = converter.toEntity(feature, id);
                EntityContainer container;
                if (entity instanceof Node) {
                    container = new NodeContainer((Node) entity);
                } else {
                    container = new WayContainer((Way) entity);
View Full Code Here

                    PropertyDescriptor descriptor = descriptors.get(i);
                    Optional<Object> value = values.get(i);
                    featureBuilder.set(descriptor.getName(), value.orNull());
                }
                SimpleFeature feature = featureBuilder.buildFeature(ref.name());
                Entity entity = converter.toEntity(feature, null);
                EntityContainer container;
                if (entity instanceof Node) {
                    container = new NodeContainer((Node) entity);
                } else {
                    container = new WayContainer((Way) entity);
View Full Code Here

  }

  @Test
  public void process() {
    // Setup
    Entity entityMocked = mock(Entity.class);
    when(entityMocked.getType()).thenReturn(EntityType.Node);

    EntityContainer entityContainerMocked = mock(EntityContainer.class);
    when(entityContainerMocked.getEntity()).thenReturn(entityMocked);

    // Action
View Full Code Here

    LOG.fine("initialize() with metadata: " + metadata.toString());
  }

  @Override
  public void process(EntityContainer entityContainer) {
    Entity entity = entityContainer.getEntity();
    EntityType type = entity.getType();
    workerPool.submit(entity);
    entityCounter.increment(type);
  }
View Full Code Here

    this.newTypeNotification = new AtomicReference<Worker.NewTypeNotification>();
  }

  @Override
  public void run() {
    Entity entity = null;
    EntityBuffer entityBuffer = null;
    NewTypeNotification notification = null;
    while (running || !taskQueue.isEmpty()) {
      try {
        // Check if a NewTypeNotification was triggered
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.domain.v0_6.Way

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.