Package com4j

Examples of com4j.SafeArray$Bound


  @Test
  public void removeExistingBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundSetter setter = new BoundSetter(null);
    setter.setSink(inspector);
    setter.process(new BoundContainer(new Bound("Test")));
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
View Full Code Here


   * Tests the bound setting.
   */
  @Test
  public void overwriteBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    Bound newBound = new Bound(2, 1, 4, 3, "NewBound");
    BoundSetter setter = new BoundSetter(newBound);
    setter.setSink(inspector);
    setter.process(new BoundContainer(new Bound("Test")));
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
    Iterator<EntityContainer> iterator = inspector.getProcessedEntities().iterator();
    EntityContainer ec = iterator.next();
    Assert.assertEquals(EntityType.Bound, ec.getEntity().getType());
    Bound bound = (Bound) ec.getEntity();
    Assert.assertEquals(bound, newBound);
   
    // Ensure there is no second bound
    ec = iterator.next();
    Assert.assertEquals(EntityType.Node, ec.getEntity().getType());
View Full Code Here

   * Tests the bound setting when there is no bound upstream.
   */
  @Test
  public void setNewBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    Bound newBound = new Bound(2, 1, 4, 3, "NewBound");
    BoundSetter setter = new BoundSetter(newBound);
    setter.setSink(inspector);
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
    EntityContainer ec = inspector.getProcessedEntities().iterator().next();
    Assert.assertEquals(EntityType.Bound, ec.getEntity().getType());
    Bound bound = (Bound) ec.getEntity();
    Assert.assertEquals(bound, newBound);
  }
View Full Code Here

      initialize();
    }
   
    // Build the bounds list.
    bounds = new ArrayList<Bound>();
    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()))));
View Full Code Here

      initialize();
    }
   
    // Build the bounds list.
    bounds = new ArrayList<Bound>();
    bounds.add(new Bound(right, left, top, bottom, "Osmosis " + OsmosisConstants.VERSION));
   
    try {
      // PostgreSQL sometimes incorrectly chooses to perform full table scans, these options
      // prevent this. Note that this is not recommended practice according to documentation
      // but fixing this would require modifying the table statistics gathering
View Full Code Here

    String origin = attributes.getValue(XmlConstants.ATTRIBUTE_NAME_ORIGIN);
    if (origin == null) {
      origin = defaultOrigin;
    }
    bound = new Bound(right, left, top, bottom, origin);
  }
View Full Code Here

      entityContainer1 = nextOrNull(postbox1);
         
      // There's only need for special processing if there actually is some data
      // on both streams - no data implies no bound
      if (entityContainer0 != null && entityContainer1 != null) {
        Bound bound0 = null;
        Bound bound1 = null;
       
        // If there are any bounds upstream, eat them up
        if (entityContainer0.getEntity().getType() == EntityType.Bound) {
          bound0 = (Bound) entityContainer0.getEntity();
          entityContainer0 = nextOrNull(postbox0);
View Full Code Here

            false,
            false,
            false,
            false);
    simpleAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 10, 30, 10, "intersecting");
    nonIntersectingBound = new Bound(-30, -50, 10, -10, "nonintersecting");
    inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 10, 10);
    outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 30, 30);
    edgeNodeEast = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 10, 20);
    edgeNodeWest = new Node(new CommonEntityData(1237, 0, new Date(), user, 0, tags), 10, -20);
    edgeNodeNorth = new Node(new CommonEntityData(1238, 0, new Date(), user, 0, tags), 20, 10);
View Full Code Here

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

    polygonFile = new File(getClass().getResource("testPolygon.txt").getFile());
    entityInspector = new SinkEntityInspector();
    // polyAreaFilter has a notch out of the Northeast corner.
    polyAreaFilter = new PolygonFilter(IdTrackerType.Dynamic, polygonFile, false, false, false, false);
    polyAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 0, 30, 0, "intersecting");
    crossingIntersectingBound = new Bound(-10, 10, 30, -30, "crossing intersecting");
    nonIntersectingBound = new Bound(30, 15, 30, 15, "nonintersecting");
    inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 5, 10);
    outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 15, 15);
    edgeNode = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 15, 10);
  }
View Full Code Here

TOP

Related Classes of com4j.SafeArray$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.