package net.sf.arianne.marboard.server.entity.shape;
import marauroa.common.game.RPClass;
import marauroa.common.game.RPObject;
import marauroa.common.game.Definition.Type;
/**
* represents a straight line connecting to points
*
* @author madmetzger
*/
public class StraightLine extends Shape {
/**
* creates a straight line from a RPObject
* @param object
*/
public StraightLine(RPObject object) {
super(object);
}
/**
* creates a new StraightLine
*
* @param color color
* @param thickness thickness
* @param startX start x
* @param startY start y
* @param directionX target x
* @param directionY target y
*/
public StraightLine(int color, int thickness, int startX, int startY, int directionX, int directionY) {
setRPClass("straight_line");
put("color", color);
put("thickness", thickness);
put("x", startX);
put("y", startY);
put("x2", directionX);
put("y2", directionY);
}
/**
* creates a new StraightLine
*
* @param color color
* @param thickness thickness
* @param startX start x
* @param startY start y
* @param startZ z layer
* @param endX target x
* @param endY target y
*/
public StraightLine(int color, int thickness, int startX, int startY, int startZ, int endX, int endY) {
this(color, thickness, startX, startY, endX, endY);
put("z", startZ);
}
/**
* generates the class definition for marauroa.
*/
public static void generateRPClass() {
final RPClass shape = new RPClass("straight_line");
shape.isA("shape");
shape.addAttribute("x2", Type.INT);
shape.addAttribute("y2", Type.INT);
}
}