Package net.sf.arianne.marboard.server.entity.shape

Examples of net.sf.arianne.marboard.server.entity.shape.Shape


    MarboardZone zone = new MarboardZone("initial_zone");
    super.addRPZone(zone);

    for (int i = 0; i < 20; i++) {
      Shape shape = new Dot(Color.BLACK.getRGB(), i, i * 25 + 25, i * 25 + 25, i);
      zone.add(shape);
    }

    Shape shape = new Dot(Color.RED.getRGB(), 10, 50, 25, 30);
    zone.add(shape);
  }
View Full Code Here


   * there is none.
   *
   * @param z z-index
   */
  Shape getShapeAtZIndex(int z) {
    Shape res = null;

    for (RPObject object : objects.values()) {
      if (object.has("z")) {
        int myZ = object.getInt("z");
        if (myZ == z) {
View Full Code Here

   * @param action the action to be executed
   */
  @Override
  protected void perform(User user, RPAction action) {
    MarboardZone zone = user.getZone();
    Shape shape = new Dot(action.getInt("color"), action.getInt("thickness"), action.getInt("x"), action.getInt("y"));
    zone.add(shape);
  }
View Full Code Here

public class CreateOvalAction extends CreateAction {

  @Override
  protected void perform(User user, RPAction action) {
    MarboardZone zone = user.getZone();
    Shape shape = new Oval(action.getInt("color"), action.getInt("fill_color"), action.getInt("thickness"), action.getInt("x"), action.getInt("y"), action.getInt("x2"), action.getInt("y2"));
    zone.add(shape);
  }
View Full Code Here

      // parse the RPObject and add the shapes
      RPObject object;
      try {
        object = parser.parse(shapeString);
        Shape shape = (Shape) MarboardObjectFactory.getFactory().transform(object);
        zone.add(shape);
      } catch (ParseException e) {
        // TODO: add error handling
        logger.error(e, e);
      }
View Full Code Here

  @Test
  public void testFixZIndexForShape() {
    MarboardZone zone = new MarboardZone("testFixZIndexForShape");
    MarboardWorld.get().addRPZone(zone);

    Shape shape = new Dot(0, 0, 0, 0);
    assertFalse(shape.has("z"));

    zone.add(shape);
    assertThat(shape.get("z"), equalTo("1"));

    shape = new Dot(2, 2, 2, 2, 20);
    assertTrue(shape.has("z"));

    zone.add(shape);
    assertThat(shape.get("z"), equalTo("20"));

    shape = new Dot(3, 3, 3, 3);
    assertFalse(shape.has("z"));

    zone.add(shape);
    assertThat(shape.get("z"), equalTo("21"));
   
  }
View Full Code Here

    for (RPObject object : zone) {
      assertEquals(object.get("x"), object.get("z"));
    }

    Shape shape = new Dot(7, 7, 7, 7);
    zone.add(shape);
    assertThat(shape.get("z"), equalTo("7"));
  }
View Full Code Here

  @Test
  public void testZIndexOverflow() {
    MarboardZone zone = new MarboardZone("testZIndexOverflow");
    MarboardWorld.get().addRPZone(zone);

    Shape shape = new Dot(1, 1, 1, 1, Integer.MAX_VALUE - 20);
    zone.add(shape);
   
    assertThat(shape.getInt("z"), equalTo(1));
  }
View Full Code Here

TOP

Related Classes of net.sf.arianne.marboard.server.entity.shape.Shape

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.