|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmodelling.RectangularArea
Zone rectangulaire orientée.
La méthode getIntersectedBoxes a été implantée de façon exacte (pas de cases en trop renvoyées) mais elle ne
possède pas de complexité satisfaisante pour des simulations très gourmandes en temps.
Pour optimiser le temps, il faut utiliser une version affaiblie d'AreaRectangular qui calcule plus grossièrement la couverture en terme de cases.
| Constructor Summary | |
RectangularArea(Map map,
float x,
float y,
float x_length,
float y_length)
Instancie un rectangle à partir de son point de référence et de ses dimensions. |
|
RectangularArea(Map map,
float x,
float y,
float x_length,
float y_length,
float angle)
Instancie un rectangle à partir de son point de référence et de ses dimensions. |
|
RectangularArea(Map map,
float x,
float y,
float x_length,
float y_length,
float angle,
float x0_t,
float y0_t)
Instancie un rectangle à partir de son point de référence et de ses dimensions. |
|
| 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()
Vérifie que le rectangle n'est pas sorti de la 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 p1)
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 px,
float py)
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 a)
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 s1,
java.lang.String s2)
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 xS,
float yS)
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. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RectangularArea(Map map,
float x,
float y,
float x_length,
float y_length)
public RectangularArea(Map map,
float x,
float y,
float x_length,
float y_length,
float angle)
public RectangularArea(Map map,
float x,
float y,
float x_length,
float y_length,
float angle,
float x0_t,
float y0_t)
| Method Detail |
public void setElement(Element el)
Area
setElement in interface Areael - the corresponding element ( if one is used ).public float getX()
Area
getX in interface Areapublic float getY()
Area
getY in interface Areapublic float getAngle()
Area
getAngle in interface Areapublic java.util.Vector getIntersectedBoxes()
Area
getIntersectedBoxes in interface AreaArea.setElement(Element),
Box.register(Element),
Box.unregister(Element)
public boolean isIn(float px,
float py)
Area
isIn in interface Areapx - the x-coordinate of the point.py - the y-coordinate of the point.
public boolean isCrashingElements()
AreaArea.exactIsCrashingElements() computes an exact result.
isCrashingElements in interface Areapublic boolean isCrashingElements(java.util.Vector v)
isCrashingElements in interface Areapublic java.util.Vector getPolygon()
Area
getPolygon in interface Areapublic boolean isPolygon()
Area
isPolygon in interface Area
public boolean intersect(float ax,
float ay,
float bx,
float by)
Area
intersect in interface Areaax - 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(java.util.Vector p1)
Area
intersect in interface Areap1 - the polygon to test.Area.getPolygon()
public boolean intersect(Area a)
Area
intersect in interface Areaa - the area to test.
public boolean exactIsCrashingElements()
AreaArea.isCrashingElements() is a fast approximation of this method.
exactIsCrashingElements in interface Areapublic boolean exactIsCrashingElements(java.util.Vector v)
exactIsCrashingElements in interface Area
public boolean translate(float x,
float y)
Area
translate in interface Areax - x-coordinate of the translation vector.y - x-coordinate of the translation vector.
public boolean setX(float x)
Area .
Returns true if the modification is done, false otherwise.Renvoie true si la modification a eu lieu, false sinon.
setX in interface Areax - the x-coordinate of the reference point.
Area.getX()public boolean setY(float y)
Area .
Returns true if the modification is done, false otherwise.Renvoie true si la modification a eu lieu, false sinon.
setY in interface Areay - the y-coordinate of the reference point.
Area.getY()
public java.util.Vector simuleTranslate(float x,
float y)
Area
simuleTranslate in interface Areax - the x-coordinate of the translation.y - the y-coordinate of the translation.
public void confirmSimuled()
Area
confirmSimuled in interface Areapublic boolean rotate(float angle)
AreaArea.getX() without going out of the Map.
Returns true if the transformation has been done, false otherwise.
rotate in interface Areaangle - the angle of the rotation ( in radian )
public boolean setAngle(float a)
Area
setAngle in interface Areaa - Sets the orientation ( in radian )
public java.util.Vector simuleRotate(float angle)
Area
simuleRotate in interface Areaangle - the angle of the simulated rotation.
public boolean rescale(float x,
float y)
AreaMap.
Returns true if the transformation has been done, false otherwise.
rescale in interface Areax - the x-factor.y - the y-factor.
public java.util.Vector simuleRescale(float xS,
float yS)
Area
simuleRescale in interface AreaxS - the x-factor of the simulated rescale.yS - the y-factor of the simulated rescale.
public boolean inMap()
Map.
inMap in interface Areapublic void draw(Drawing g)
AreaArea and eventually the image of the associated element.
It gives a default method to draw elements.
draw in interface Areag - the Drawing object containing the graphics context.
public void fill(Drawing g,
java.awt.Color c)
Area
fill in interface Area
public void drawBorder(Drawing g,
java.awt.Color c)
Area
drawBorder in interface Area
public void highlight(Drawing g,
java.awt.Color c)
AreaArea. is used when it's selected in the interface.
It's better to give a transparent color in order to have something nice.
highlight in interface Areag - the Drawing object.c - the Color used to highlight.public java.lang.String[][] getProperties()
Area
getProperties in interface AreaEngine.getProperties()
public void setProperties(java.lang.String s1,
java.lang.String s2)
Area
setProperties in interface Areas1 - the property to change.s2 - the new value for the property.Engine.setProperties(java.lang.String, java.lang.String)public java.lang.Object clone()
Area
clone in interface Area
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||