Package net.alteiar.beans.map.elements

Examples of net.alteiar.beans.map.elements.CircleElement


    return panelSize.getMapElementSize(0);
  }

  @Override
  public CircleElement buildMapElement(Point position) {
    return new CircleElement(position, getSelectedColor(), getElementSize());
  }
View Full Code Here


        waitingTime);

    MapElementSize circleRadius = new MapElementSizePixel(20.0);
    Point position = new Point(5, 5);

    CircleElement circleClient = new CircleElement(position, Color.RED,
        circleRadius);
    MapElementFactory.buildMapElement(circleClient, battle);

    circleClient = CampaignClient.getInstance().getBean(
        circleClient.getId(), 300L);

    assertEquals("The position should be equals", position,
        circleClient.getPosition());
    assertEquals("The color should be equals", Color.RED,
        circleClient.getColor());
    assertEquals("The angle should be equals", Double.valueOf(0),
        circleClient.getAngle());
    assertEquals("The radius should be equals",
        circleRadius.getPixels(battle.getScale()), circleClient
            .getRadius().getPixels(battle.getScale()));

    assertEquals("The width and the height should be equals",
        circleClient.getWidthPixels(), circleClient.getHeightPixels());

    BufferedImage imgGenerated = new BufferedImage(1000, 1000,
        BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = (Graphics2D) imgGenerated.getGraphics();
    circleClient.draw(g2, 1.0, true);
    g2.dispose();

    BufferedImage imgExpected = new BufferedImage(1000, 1000,
        BufferedImage.TYPE_INT_ARGB);
    g2 = (Graphics2D) imgExpected.getGraphics();
    circleClient.draw(g2, 1.0, true);
    g2.dispose();

    try {
      assertTrue("images should be same",
          compareImage(imgExpected, imgGenerated));
    } catch (IOException e) {
      fail("fail to compare images");
    }

    Double angle = 25.0;
    Boolean isHidden = !circleClient.isHiddenForPlayer();
    Point newPosition = new Point(12, 12);
    circleClient.setHiddenForPlayer(isHidden);
    circleClient.setPosition(newPosition);
    circleClient.setAngle(angle);

    waitForChange(circleClient, "getPosition", newPosition);
    waitForChange(circleClient, "getAngle", angle);
    waitForChange(circleClient, "isHiddenForPlayer", isHidden);
    waitForChange(circleClient, "getPosition", newPosition);
    waitForChange(circleClient, "getPosition", newPosition);

    assertEquals("The position should be equals", newPosition,
        circleClient.getPosition());
    assertEquals("The color should be equals", angle,
        circleClient.getAngle());
    assertEquals("The angle should be equals", isHidden,
        circleClient.isHiddenForPlayer());

    assertTrue("the circle not contain point (5,5)",
        !circleClient.contain(new Point(5, 5)));

    assertTrue("the circle contain point (32,32)",
        circleClient.contain(new Point(32, 32)));

    MapElementSize newCircleRadius = new MapElementSizeMeter(1.5);
    circleClient.setRadius(newCircleRadius);
    sleep();
    assertEquals("radius should be equals",
        newCircleRadius.getPixels(battle.getScale()), circleClient
            .getRadius().getPixels(battle.getScale()));

    Color color = Color.BLUE;
    circleClient.setColor(color);
    sleep();
    assertEquals("radius should be equals", color, circleClient.getColor());
  }
View Full Code Here

    return panelSize.getMapElementSize(0);
  }

  @Override
  public CircleElement buildMapElement(Point position) {
    return new CircleElement(position, getSelectedColor(), getElementSize());
  }
View Full Code Here

  }

  @Override
  protected void mapElementChanged() {
    CircleElement circle = getMapElement();
    panelRadius.setElementSizeAt(0, circle.getRadius());
  }
View Full Code Here

    return "le rayon est invalide";
  }

  @Override
  public void applyModification() {
    CircleElement circleElement = getMapElement();
    circleElement.setRadius(panelRadius.getMapElementSize(0));
  }
View Full Code Here

  }

  @Override
  protected void mapElementChanged() {
    CircleElement circle = getMapElement();
    panelRadius.setElementSizeAt(0, circle.getRadius());
  }
View Full Code Here

    return "le rayon est invalide";
  }

  @Override
  public void applyModification() {
    CircleElement circleElement = getMapElement();
    circleElement.setRadius(panelRadius.getMapElementSize(0));
  }
View Full Code Here

TOP

Related Classes of net.alteiar.beans.map.elements.CircleElement

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.