Examples of Bound


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

  public void testBoundsWithOrigin() {
    parseString(OSM_PREFIX
        + "<bounds minlat=\"-1\" minlon=\"-1\" maxlat=\"1\" maxlon=\"1\" "
        + " origin=\"someorigin\"/>"
        + OSM_SUFFIX);
    Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertEquals("someorigin", b.getOrigin());
  }
View Full Code Here

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

    if (unsupportedFeatures.size() > 0) {
      throw new OsmosisRuntimeException("PBF file contains unsupported features " + unsupportedFeatures);
    }

    // Build a new bound object which corresponds to the header.
    Bound bound;
    if (header.hasBbox()) {
      HeaderBBox bbox = header.getBbox();
      bound = new Bound(bbox.getRight() * COORDINATE_SCALING_FACTOR, bbox.getLeft() * COORDINATE_SCALING_FACTOR,
          bbox.getTop() * COORDINATE_SCALING_FACTOR, bbox.getBottom() * COORDINATE_SCALING_FACTOR,
          header.getSource());
    } else {
      bound = new Bound(header.getSource());
    }

    // Add the bound object to the results.
    decodedEntities.add(new BoundContainer(bound));
  }
View Full Code Here

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

  public void testBoundsOriginInheritance() {
    parseString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
          + "<osm version=\"0.6\" generator=\"somegenerator\">"
          + "<bounds minlat=\"-1.234\" minlon=\"-1.234\" maxlat=\"1.234\" maxlon=\"1.234\"/>"
          + "</osm>");
    Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertEquals("somegenerator", b.getOrigin());
  }
View Full Code Here

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

          boolean completeWays,
          boolean completeRelations,
          boolean cascadingRelations) {
    super(idTrackerType, clipIncompleteEntities, completeWays, completeRelations, cascadingRelations);
   
    this.bound = new Bound(right, left, top, bottom, "");
  }
View Full Code Here

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

  /**
   * {@inheritDoc}
   */
  @Override
  public void process(BoundContainer boundContainer) {
    Bound newBound;
    /*
     * The order of calling intersect is important because the first non-empty origin string
     * will be used for the resulting Bound, and we want the origin string from the pipeline
     * Bound to be used.
     */
 
View Full Code Here

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

  /**
   * {@inheritDoc}
   */
  @Override
  public void process(BoundContainer boundContainer) {
    Bound newBound = null;

    // Configure the area if it hasn't been created yet. (Should this be in an "initialize" method?)
    if (area == null) {
      area = new PolygonFileReader(polygonFile).loadPolygon();
    }
   
    for (Bound b : boundContainer.getEntity().toSimpleBound()) {
      if (newBound == null) {
        newBound = simpleBoundIntersect(b);
      } else {
        newBound = newBound.union(simpleBoundIntersect(b));
      }
    }

    if (newBound != null) {
      super.process(new BoundContainer(newBound));
View Full Code Here

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

   */
  private Bound simpleBoundIntersect(Bound bound) {
    Rectangle2D r;
    double width, height;

    Bound newBound = null;
    Area a2 = (Area) area.clone(); // make a copy so we don't disturb the original

    /*
     * Note that AWT uses the computer graphics convention with the origin at the top left, so
     * top and bottom are reversed for a Rectangle2D vs. a Bound.
     */

    if (bound.getLeft() > bound.getRight()) {
      return null;
    }
    width = bound.getRight() - bound.getLeft();
    height = bound.getTop() - bound.getBottom();
    /*
     * Perform the intersect against the Area itself instead of its bounding box for maximum
     * precision.
     */
    a2.intersect(new Area(new Rectangle2D.Double(
            bound.getLeft(),
            bound.getBottom(),
            width,
            height)));
    if (!a2.isEmpty()) {
      r = a2.getBounds2D();
      newBound = new Bound(
              r.getMaxX(),
              r.getMinX(),
              r.getMaxY(),
              r.getMinY(),
              bound.getOrigin());
View Full Code Here

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

    double left;
    double right;
    double top;
    double bottom;
    int zoom;
    Bound newBound = null;
    String origin = null;
    boolean remove;

    remove = getBooleanArgument(taskConfig, ARG_REMOVE, DEFAULT_REMOVE);

    if (!remove) {
      origin = getStringArgument(taskConfig, ARG_ORIGIN, DEFAULT_ORIGIN);
      left = getDoubleArgument(taskConfig, ARG_LEFT, DEFAULT_LEFT);
      right = getDoubleArgument(taskConfig, ARG_RIGHT, DEFAULT_RIGHT);
      top = getDoubleArgument(taskConfig, ARG_TOP, DEFAULT_TOP);
      bottom = getDoubleArgument(taskConfig, ARG_BOTTOM, DEFAULT_BOTTOM);

      zoom = getIntegerArgument(taskConfig, ARG_ZOOM, DEFAULT_ZOOM);
      if (doesArgumentExist(taskConfig, ARG_X1)) {
        int x1 = getIntegerArgument(taskConfig, ARG_X1);
        left = xToLon(zoom, x1);
        right = xToLon(zoom, getIntegerArgument(taskConfig, ARG_X2, x1) + 1);
      }
      if (doesArgumentExist(taskConfig, ARG_Y1)) {
        int y1 = getIntegerArgument(taskConfig, ARG_Y1);
        top = yToLat(zoom, y1);
        bottom = yToLat(zoom, getIntegerArgument(taskConfig, ARG_Y2, y1) + 1);
      }

      newBound = new Bound(right, left, top, bottom, origin);
    }

    return new SinkSourceManager(taskConfig.getId(),
        new BoundSetter(newBound), taskConfig.getPipeArgs());
  }
View Full Code Here

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

  @Override
  public void complete() {
    objects.complete();

    if (nodesSeen) {
      sink.process(new BoundContainer(new Bound(right, left, top, bottom, this.origin)));
    }

    ReleasableIterator<EntityContainer> iter = null;

    try {
View Full Code Here

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

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testNeitherHasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), false);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), false);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.