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

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


  /**
   * Test passing a Bound which intersects the filter area.
   */
  @Test
  public final void testProcessBoundContainer1() {
    Bound compareBound;
    polyAreaFilter.process(new BoundContainer(intersectingBound));
    polyAreaFilter.complete();
    compareBound = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertTrue(Double.compare(compareBound.getRight(), 20) == 0);
    assertTrue(Double.compare(compareBound.getLeft(), 0) == 0);
    assertTrue(Double.compare(compareBound.getTop(), 20) == 0);
    assertTrue(Double.compare(compareBound.getBottom(), 0) == 0);
    assertTrue(compareBound.getOrigin().equals("intersecting"));
  }
View Full Code Here


  /**
   * Test passing a Bound which crosses the antimeredian and intersects the filter area.
   */
  @Test
  public final void testProcessBoundContainer2() {
    Bound compareBound;
    polyAreaFilter.process(new BoundContainer(crossingIntersectingBound));
    polyAreaFilter.complete();
    compareBound = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertTrue(Double.compare(compareBound.getRight(), 20) == 0);
    assertTrue(Double.compare(compareBound.getLeft(), -20) == 0);
    assertTrue(Double.compare(compareBound.getTop(), 20) == 0);
    assertTrue(Double.compare(compareBound.getBottom(), -20) == 0);
    assertTrue(compareBound.getOrigin().equals("crossing intersecting"));
  }
View Full Code Here

  public final void testBoundElement1() {
    parseString(OSM_PREFIX
            + "<bound box=\"-12.34567,-23.45678,34.56789,45.67891\""
            + " origin=\"someorigin\"/>"
            + OSM_SUFFIX);
    Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertTrue(Double.compare(b.getRight(), 45.67891) == 0
            && Double.compare(b.getLeft(), -23.45678) == 0
            && Double.compare(b.getTop(), 34.56789) == 0
            && Double.compare(b.getBottom(), -12.34567) == 0);
    assertTrue(b.getOrigin().equals("someorigin"));
  }
View Full Code Here

  @Test
  public void testBoundsNoOrigin() {
    parseString(OSM_PREFIX
        + "<bounds minlat=\"-1.234\" minlon=\"-1.234\" maxlat=\"1.234\" maxlon=\"1.234\"/>"
        + OSM_SUFFIX);
    Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
    assertEquals(-1.234, b.getLeft(), 1E-6);
    assertEquals(-1.234, b.getBottom(), 1E-6);
    assertEquals(1.234, b.getRight(), 1E-6);
    assertEquals(1.234, b.getTop(), 1E-6);
    assertNull(b.getOrigin());
  }
View Full Code Here

  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

    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

  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

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

  /**
   * {@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

  /**
   * {@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

TOP

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

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.