Examples of MapBean


Examples of com.bbn.openmap.MapBean

     *
     * @param bg The feature to be added to the Sea attribute
     * @param mh The feature to be added to the Sea attribute
     */
    protected void addSea(Group bg, MapHandler mh) {
        MapBean map = (MapBean) mh.get("com.bbn.openmap.MapBean");
        if (map != null) {
            Debug.message("3d", "LayerMapContent: putting down sea.");
            Color seaColor = map.getBackground();

            Projection proj = map.getProjection();

            // Make the background strech a screen around the current
            // map, all directions.
            int width = proj.getWidth();
            int height = proj.getHeight();
View Full Code Here

Examples of com.bbn.openmap.MapBean

    public BufferedLayer() {
        this.setLayout(new BorderLayout());

        // Adds the mapbean to the layer
        MapBean mb = new BLMapBean(this);

        // Add it the layer properly...
        setMapBean(mb);
    }
View Full Code Here

Examples of com.bbn.openmap.MapBean

        // Create the MapHandler, which allows all the components to
        // find each other if they are added to it.
        MapHandler mapHandler = new MapHandler();
        // Create the MapBean.
        MapBean map = new MapBean();
        // Set the map's center property
        map.setCenter(new LatLonPoint(43.0f, -95.0f));
        // Add the MapBean to the MapHandler.
        mapHandler.add(map);

        // Add the map to the JFrame
        getContentPane().add(map, BorderLayout.CENTER);
View Full Code Here

Examples of com.bbn.openmap.MapBean

        Projection projection = null;

        if (mapHandler != null) {

            MapBean mapBean = (MapBean) mapHandler.get("com.bbn.openmap.MapBean");

            if (mapBean != null) {
                projection = mapBean.getProjection();
            }

            TransformGroup mapTransformGroup = new TransformGroup();
            mapTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
            mapTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
View Full Code Here

Examples of ehistory.web.server.frontend.MapBean

        }

        if (request.getMapDeltaX() != null || request.getMapDeltaY() != null ||
                request.getMapZoom() != null || request.getWidthChanged() != null) {
            FlexMap map = new FlexMap();
            MapBean mapBean = clientBean.getMapBean();
            if (request.getWidthChanged() != null) {
                mapBean.setWidth(request.getWidthChanged());
            }
            if (request.getMapDeltaX() != null || request.getMapDeltaY() != null) {
                int mapDeltaX = request.getMapDeltaX() == null ? 0 : request.getMapDeltaX();
                int mapDeltaY = request.getMapDeltaY() == null ? 0 : request.getMapDeltaY();
                mapBean.move(mapDeltaX, mapDeltaY);
            }
            if (request.getMapZoom() != null) {
                mapBean.zoom(request.getMapZoom());
            }
            map.setObjectsTitles(mapBean.getObjectTitles());
            map.setObjectsAreas(mapBean.getObjectsToIntArray());
            response.setMap(map);
        }

        return response;
    }
View Full Code Here

Examples of net.alteiar.beans.map.MapBean

    return createMap(name, new ImageBean(background));
  }

  public static MapBean createMap(String name, ImageBean background)
      throws IOException {
    MapBean map = new MapBean(name);

    CampaignClient.getInstance().addBean(background);

    Image backgroundImage = background.getImage().restoreImage();
    map.setWidth(backgroundImage.getWidth(null));
    map.setHeight(backgroundImage.getHeight(null));

    // ManualMapFilter filter = new ManualMapFilter(map.getId());
    CharacterMapFilter filter = new CharacterMapFilter(map);
    CampaignClient.getInstance().addBean(filter);

    map.setFilter(filter.getId());
    map.setBackground(background.getId());

    return map;
  }
View Full Code Here

Examples of net.alteiar.beans.map.MapBean

        createTransfertImage("./test/ressources/guerrier.jpg"));
  }

  public static UniqueID createBattle(String battleName, File image)
      throws IOException {
    MapBean battleBean = MapFactory.createMap(battleName, image);
    CampaignClient.getInstance().addBean(battleBean);
    return battleBean.getId();
  }
View Full Code Here

Examples of net.alteiar.beans.map.MapBean

  }

  @Test(timeout = 10000)
  public void testBattleWithMapElement() {
    Long waitingTime = 1000L;
    MapBean emptyBattle = new MapBean("");
    assertEquals("verify emptyBattle", emptyBattle, emptyBattle);

    UniqueID battleId = null;
    try {
      battleId = createBattle("test battle 10", getDefaultImage());
    } catch (IOException e) {
      fail("fail to create battle");
    }
    assertNotNull("the battle id must'nt be null", battleId);
    MapBean battle = CampaignClient.getInstance().getBean(battleId,
        waitingTime);
    assertNotNull("the battle should not be null", battle);

    PropertyChangeListener listener = new PropertyChangeListener() {
      @Override
      public void propertyChange(PropertyChangeEvent evt) {
        innerClassCall();
      }
    };
    battle.addPropertyChangeListener(listener);

    Point position = new Point(5, 5);
    Color color = Color.GREEN;
    MapElementSize width = new MapElementSizeMeter(6.0);
    MapElementSize height = new MapElementSizePixel(42.0);

    RectangleElement rectangle = new RectangleElement(position, color,
        width, height);

    Collection<UniqueID> elementsOnMap = battle.getElements();
    assertTrue("The map shouldn't have any element",
        elementsOnMap.isEmpty());

    MapElementFactory.buildMapElement(rectangle, battle);

    // wait for the element to be in the element list
    while (elementsOnMap.isEmpty()) {
      sleep(10);
      elementsOnMap = battle.getElements();
    }

    assertEquals("The map should have 1 element", 1, elementsOnMap.size());
    assertEquals("The rectangle id should be the same", rectangle.getId(),
        elementsOnMap.iterator().next());

    assertEquals(
        "The map should have at least 1 element at the position (6,6)",
        1, battle.getElementsAt(new Point(6, 6)).size());
    assertEquals(
        "The map should'nt have any element at the position (4,4)", 0,
        battle.getElementsAt(new Point(4, 4)).size());

    battle.removeElement(elementsOnMap.iterator().next());
    while (!elementsOnMap.isEmpty()) {
      sleep(10);
      elementsOnMap = battle.getElements();
    }

    assertTrue("The map should'nt have any element",
        elementsOnMap.isEmpty());

    battle.setScale(new Scale(25, 1.5));
    battle.setFilter(new UniqueID());

    sleep();
    // Should have 4 call
    // (add element, remove element, scale change, filter change)
    verifyInnerClassCall(4);

    battle.removePropertyChangeListener(listener);
  }
View Full Code Here

Examples of net.alteiar.beans.map.MapBean

        scale.hashCode() != scale3.hashCode());
  }

  @Test(timeout = 10000)
  public void testMap() {
    MapBean emptyMap = new MapBean("");
    assertEquals("verify emptyMap", emptyMap, emptyMap);

    String targetName = "test battle";

    MapBean map = null;
    try {
      map = MapFactory.createMap(targetName, getDefaultImage());
    } catch (IOException e) {
      fail("exception should'nt occur");
    }

    assertNotNull("Map should'nt be null", map);

    BeanDocument doc = new BeanDocument(CampaignClient.getInstance()
        .getRootDirectory(), targetName, "document-type", map);

    doc = addBean(doc);
    map = doc.getBean();

    Scale newScale = new Scale(map.getScale().getPixels() + 5, map
        .getScale().getMeter());
    map.setScale(newScale);

    Integer newWidth = map.getWidth() + 5;
    map.setWidth(newWidth);

    Integer newHeight = map.getHeight() + 5;
    map.setHeight(newHeight);

    ImageBean imageBean = createBeanImage();

    CampaignClient.getInstance().addBean(imageBean);
    UniqueID newImage = imageBean.getId();

    map.setBackground(newImage);

    UniqueID newFilter = new UniqueID();
    map.setFilter(newFilter);

    HashSet<UniqueID> set = new HashSet<UniqueID>();
    set.add(new UniqueID());
    set.add(new UniqueID());
    map.setElements(set);

    waitForChange(map, "getScale", newScale);
    waitForChange(map, "getWidth", newWidth);
    waitForChange(map, "getHeight", newHeight);
    waitForChange(map, "getBackground", newImage);
View Full Code Here

Examples of net.alteiar.beans.map.MapBean

    try {
      battleId = createBattle("test battle", getDefaultImage());
    } catch (IOException e) {
      fail("fail to create battle");
    }
    MapBean created = CampaignClient.getInstance().getBean(battleId, 300);

    // Remove the battle
    CampaignClient.getInstance().removeBean(created);
  }
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.