|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Some area of a Map.
Often used to give a shape to an Element.
All the methods verify that the Area does not go out of the Map.
In the instanciation, the Area is however authorized to be created out of the world.
It allows, for example, to create an Element which is not physically present on the Map.
Box.register(Element),
Box.unregister(Element)| Method Summary | |
java.lang.Object |
clone()
Clone the area. |
void |
confirmSimuled()
Confirms the last move simulated with a simule method of the area. |
void |
draw(Drawing g)
Draws the Area and eventually the image of the associated element.
|
void |
drawBorder(Drawing g,
java.awt.Color c)
Draws the borders of the area with the given color. |
boolean |
exactIsCrashingElements()
Takes in argument a vector v returned by a simule method. |
boolean |
exactIsCrashingElements(java.util.Vector v)
|
void |
fill(Drawing g,
java.awt.Color c)
Fills the area with the given color. |
float |
getAngle()
Returns the orientation ( in Radian ) |
java.util.Vector |
getIntersectedBoxes()
Returns at least the boxes intersected by the area. |
java.util.Vector |
getPolygon()
Returns a polygon aproximating the area. |
java.lang.String[][] |
getProperties()
Returns the Area's properties. |
float |
getX()
Returns the x-coordinate of the area's reference point. |
float |
getY()
Returns the y-coordinate of the area's reference point. |
void |
highlight(Drawing g,
java.awt.Color c)
Highlights the Area. is used when it's selected in the interface.
|
boolean |
inMap()
Checks whether the area is included in te map. |
boolean |
intersect(Area a)
Returns whether the area intersect these one. |
boolean |
intersect(float ax,
float ay,
float bx,
float by)
Returns whether the area intersect the segment (ax,ay),(bx,by) |
boolean |
intersect(java.util.Vector polygon)
Returns whether the polygon intersects this area. |
boolean |
isCrashingElements()
Returns true if there are other elements registered on the boxes where this area is registered, or if the area is not included in the map. |
boolean |
isCrashingElements(java.util.Vector v)
|
boolean |
isIn(float x,
float y)
Returns whether the point is in the area. |
boolean |
isPolygon()
Returns whether the area is a polygon. |
boolean |
rescale(float x,
float y)
Rescale by a 'x' and a 'y' factor without going out of the Map.
|
boolean |
rotate(float angle)
Rotates the area by the angle around the reference point getX() without going out of the Map.
|
boolean |
setAngle(float angle)
Sets the orientation ( in radian ) Returns true if the modification is done, else false. |
void |
setElement(Element el)
Sets the element to which we want to link the area. |
void |
setProperties(java.lang.String property,
java.lang.String value)
Sets the value of a property of the area. |
boolean |
setX(float x)
Modify the x-coordinate of the reference point, without going out of the .
|
boolean |
setY(float y)
Modify the y-coordinate of the reference point, without going out of the .
|
java.util.Vector |
simuleRescale(float x,
float y)
Returns the covering boxes which would result of the rescale. |
java.util.Vector |
simuleRotate(float angle)
Returns the covering boxes which would result of the rotation. |
java.util.Vector |
simuleTranslate(float x,
float y)
Returns the covering boxes which would result of the (x,y) translation of the area. |
boolean |
translate(float x,
float y)
Translates the area by the (x,y) vector without going out of the map. |
| Method Detail |
public void setElement(Element el)
el - the corresponding element ( if one is used ).public float getX()
public float getY()
public boolean setX(float x)
.
Returns true if the modification is done, false otherwise.Renvoie true si la modification a eu lieu, false sinon.
x - the x-coordinate of the reference point.
getX()public boolean setY(float y)
.
Returns true if the modification is done, false otherwise.Renvoie true si la modification a eu lieu, false sinon.
y - the y-coordinate of the reference point.
getY()public float getAngle()
public boolean setAngle(float angle)
angle - Sets the orientation ( in radian )
public java.util.Vector getIntersectedBoxes()
setElement(Element),
Box.register(Element),
Box.unregister(Element)
public boolean isIn(float x,
float y)
x - the x-coordinate of the point.y - the y-coordinate of the point.
public boolean inMap()
public boolean isCrashingElements()
exactIsCrashingElements() computes an exact result.
public boolean isCrashingElements(java.util.Vector v)
public boolean exactIsCrashingElements()
isCrashingElements() is a fast approximation of this method.
public boolean exactIsCrashingElements(java.util.Vector v)
public java.util.Vector getPolygon()
public boolean isPolygon()
public boolean intersect(float ax,
float ay,
float bx,
float by)
ax - x-coordinate of the 'a' point.ay - y-coordinate of the 'a' point.bx - x-coordinate of the 'b' point.by - y-coordinate of the 'b' point.
public boolean intersect(Area a)
a - the area to test.
public boolean intersect(java.util.Vector polygon)
polygon - the polygon to test.getPolygon()
public boolean translate(float x,
float y)
x - x-coordinate of the translation vector.y - x-coordinate of the translation vector.
public boolean rotate(float angle)
getX() without going out of the Map.
Returns true if the transformation has been done, false otherwise.
angle - the angle of the rotation ( in radian )
public boolean rescale(float x,
float y)
Map.
Returns true if the transformation has been done, false otherwise.
x - the x-factor.y - the y-factor.
public java.util.Vector simuleTranslate(float x,
float y)
x - the x-coordinate of the translation.y - the y-coordinate of the translation.
public java.util.Vector simuleRotate(float angle)
angle - the angle of the simulated rotation.
public java.util.Vector simuleRescale(float x,
float y)
x - the x-factor of the simulated rescale.y - the y-factor of the simulated rescale.
public void confirmSimuled()
public void draw(Drawing g)
Area and eventually the image of the associated element.
It gives a default method to draw elements.
g - the Drawing object containing the graphics context.
public void fill(Drawing g,
java.awt.Color c)
public void drawBorder(Drawing g,
java.awt.Color c)
public void highlight(Drawing g,
java.awt.Color c)
Area. is used when it's selected in the interface.
It's better to give a transparent color in order to have something nice.
g - the Drawing object.c - the Color used to highlight.public java.lang.String[][] getProperties()
Engine.getProperties()
public void setProperties(java.lang.String property,
java.lang.String value)
property - the property to change.value - the new value for the property.Engine.setProperties(java.lang.String, java.lang.String)public java.lang.Object clone()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||