Package net.sf.arianne.marboard.server.core.engine

Examples of net.sf.arianne.marboard.server.core.engine.MarboardZone


   * clears the board.
   *
   * @param user the user wanting to execute the action
   * @param action the action to be executed   */
  public void onAction(User user, RPAction action) {
    MarboardZone zone = user.getZone();

    // create a copy of the list to prevent ConcurrentModificationException
    List<Shape> shapes = new LinkedList<Shape>();
    for (RPObject object : zone) {
      if (object instanceof Shape) {
        shapes.add((Shape) object);
      }
    }

    // remove all shapes
    for (Shape shape : shapes) {
      zone.remove(shape.getID());
    }
  }
View Full Code Here


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

   * @param user the user wanting to execute the action
   * @param action the action to be executed
   */
  @Override
  protected void perform(User user, RPAction action) {
    MarboardZone zone = user.getZone();
    int color = action.getInt("color");
    int thickness = action.getInt("thickness");
    int startX = action.getInt("x");
    int startY = action.getInt("y");
    int x2 = action.getInt("x2");
    int y2 = action.getInt("y2");
    StraightLine curve = new StraightLine(color, thickness, startX, startY, x2, y2);
    zone.add(curve);
  }
View Full Code Here

   * @param user the user wanting to execute the action
   * @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

   * @param user the user wanting to execute the action
   * @param action the action to be executed
   */
  @Override
  protected void perform(User user, RPAction action) {
    MarboardZone zone = user.getZone();
    RPObjectParser parser = new RPObjectParser();

    // split the shapes on the line boundary
    String[] shapes = action.get("shapes").split("\r\n");
    for (String shapeString : shapes) {

      // 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

TOP

Related Classes of net.sf.arianne.marboard.server.core.engine.MarboardZone

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.