Sweet Home 3D 2.5

com.eteks.sweethome3d.model
Class Wall

java.lang.Object
  extended by com.eteks.sweethome3d.model.Wall
All Implemented Interfaces:
Selectable, Serializable, Cloneable

public class Wall
extends Object
implements Serializable, Selectable

A wall of a home plan.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
static class Wall.Property
          The properties of a wall that may change.
 
Constructor Summary
Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness)
          Creates a wall from (xStart,yStart) to (xEnd, yEnd), with given thickness.
Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness, float height)
          Creates a wall from (xStart,yStart) to (xEnd, yEnd), with given thickness and height.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds the property change listener in parameter to this wall.
 Wall clone()
          Returns a clone of this wall expected its wall at start and wall at end aren't copied.
static List<Wall> clone(List<Wall> walls)
          Returns a clone of the walls list.
 boolean containsPoint(float x, float y, float margin)
          Returns true if this wall contains the point at (x, y) with a given margin.
 boolean containsWallEndAt(float x, float y, float margin)
          Returns true if this wall end line contains the point at (x, y) with a given margin around the wall end line.
 boolean containsWallStartAt(float x, float y, float margin)
          Returns true if this wall start line contains the point at (x, y) with a given margin around the wall start line.
 Float getHeight()
          Returns the height of this wall.
 Float getHeightAtEnd()
          Returns the height of this wall at its end point.
 Integer getLeftSideColor()
          Returns left side color of this wall.
 HomeTexture getLeftSideTexture()
          Returns the left side texture of this wall.
 float getLength()
          Returns the length from the start point of this wall to its end point.
 float[][] getPoints()
          Returns the points of each corner of a wall.
 Integer getRightSideColor()
          Returns right side color of this wall.
 HomeTexture getRightSideTexture()
          Returns the right side texture of this wall.
 float getThickness()
          Returns the thickness of this wall.
 Wall getWallAtEnd()
          Returns the wall joined to this wall at end point.
 Wall getWallAtStart()
          Returns the wall joined to this wall at start point.
 float getXEnd()
          Returns the end point abscissa of this wall.
 float getXStart()
          Returns the start point abscissa of this wall.
 float getYEnd()
          Returns the end point ordinate of this wall.
 float getYStart()
          Returns the start point ordinate of this wall.
 boolean intersectsRectangle(float x0, float y0, float x1, float y1)
          Returns true if this wall intersects with the horizontal rectangle which opposite corners are at points (x0, y0) and (x1, y1).
 boolean isTrapezoidal()
          Returns true if the height of this wall is different at its start and end points.
 void move(float dx, float dy)
          Moves this wall of (dx, dy) units.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the property change listener in parameter from this wall.
 void setHeight(Float height)
          Sets the height of this wall.
 void setHeightAtEnd(Float heightAtEnd)
          Sets the height of this wall at its end point.
 void setLeftSideColor(Integer leftSideColor)
          Sets left side color of this wall.
 void setLeftSideTexture(HomeTexture leftSideTexture)
          Sets the left side texture of this wall.
 void setRightSideColor(Integer rightSideColor)
          Sets right side color of this wall.
 void setRightSideTexture(HomeTexture rightSideTexture)
          Sets the right side texture of this wall.
 void setThickness(float thickness)
          Sets wall thickness.
 void setWallAtEnd(Wall wallAtEnd)
          Sets the wall joined to this wall at end point.
 void setWallAtStart(Wall wallAtStart)
          Sets the wall joined to this wall at start point.
 void setXEnd(float xEnd)
          Sets the end point abscissa of this wall.
 void setXStart(float xStart)
          Sets the start point abscissa of this wall.
 void setYEnd(float yEnd)
          Sets the end point ordinate of this wall.
 void setYStart(float yStart)
          Sets the start point ordinate of this wall.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Wall

public Wall(float xStart,
            float yStart,
            float xEnd,
            float yEnd,
            float thickness)
Creates a wall from (xStart,yStart) to (xEnd, yEnd), with given thickness. Height, left and right colors are null.


Wall

public Wall(float xStart,
            float yStart,
            float xEnd,
            float yEnd,
            float thickness,
            float height)
Creates a wall from (xStart,yStart) to (xEnd, yEnd), with given thickness and height. Left and right colors are null.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds the property change listener in parameter to this wall.


removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the property change listener in parameter from this wall.


getXStart

public float getXStart()
Returns the start point abscissa of this wall.


setXStart

public void setXStart(float xStart)
Sets the start point abscissa of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getYStart

public float getYStart()
Returns the start point ordinate of this wall.


setYStart

public void setYStart(float yStart)
Sets the start point ordinate of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getXEnd

public float getXEnd()
Returns the end point abscissa of this wall.


setXEnd

public void setXEnd(float xEnd)
Sets the end point abscissa of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getYEnd

public float getYEnd()
Returns the end point ordinate of this wall.


setYEnd

public void setYEnd(float yEnd)
Sets the end point ordinate of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getLength

public float getLength()
Returns the length from the start point of this wall to its end point.

Since:
2.0

getWallAtStart

public Wall getWallAtStart()
Returns the wall joined to this wall at start point.


setWallAtStart

public void setWallAtStart(Wall wallAtStart)
Sets the wall joined to this wall at start point. Once this wall is updated, listeners added to this wall will receive a change notification. If the start point of this wall is attached to an other wall, it will be detached from this wall, and wall listeners will receive a change notification.

Parameters:
wallAtStart - a wall or null to detach this wall from any wall it was attached to before.

getWallAtEnd

public Wall getWallAtEnd()
Returns the wall joined to this wall at end point.


setWallAtEnd

public void setWallAtEnd(Wall wallAtEnd)
Sets the wall joined to this wall at end point. Once this wall is updated, listeners added to this wall will receive a change notification. If the end point of this wall is attached to an other wall, it will be detached from this wall, and wall listeners will receive a change notification.

Parameters:
wallAtEnd - a wall or null to detach this wall from any wall it was attached to before.

getThickness

public float getThickness()
Returns the thickness of this wall.


setThickness

public void setThickness(float thickness)
Sets wall thickness. Once this wall is updated, listeners added to this wall will receive a change notification.


getHeight

public Float getHeight()
Returns the height of this wall. If getHeightAtEnd returns a value not null, the returned height should be considered as the height of this wall at its start point.


setHeight

public void setHeight(Float height)
Sets the height of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getHeightAtEnd

public Float getHeightAtEnd()
Returns the height of this wall at its end point.


setHeightAtEnd

public void setHeightAtEnd(Float heightAtEnd)
Sets the height of this wall at its end point. Once this wall is updated, listeners added to this wall will receive a change notification.


isTrapezoidal

public boolean isTrapezoidal()
Returns true if the height of this wall is different at its start and end points.


getLeftSideColor

public Integer getLeftSideColor()
Returns left side color of this wall. This is the color of the left side of this wall when you go through wall from start point to end point.


setLeftSideColor

public void setLeftSideColor(Integer leftSideColor)
Sets left side color of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getRightSideColor

public Integer getRightSideColor()
Returns right side color of this wall. This is the color of the right side of this wall when you go through wall from start point to end point.


setRightSideColor

public void setRightSideColor(Integer rightSideColor)
Sets right side color of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getLeftSideTexture

public HomeTexture getLeftSideTexture()
Returns the left side texture of this wall.


setLeftSideTexture

public void setLeftSideTexture(HomeTexture leftSideTexture)
Sets the left side texture of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getRightSideTexture

public HomeTexture getRightSideTexture()
Returns the right side texture of this wall.


setRightSideTexture

public void setRightSideTexture(HomeTexture rightSideTexture)
Sets the right side texture of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.


getPoints

public float[][] getPoints()
Returns the points of each corner of a wall.

Specified by:
getPoints in interface Selectable
Returns:
an array of the 4 (x,y) coordinates of the wall corners. The points at index 0 and 3 indicates the start of the wall, while the points at index 1 and 2 indicates the end of the wall.

intersectsRectangle

public boolean intersectsRectangle(float x0,
                                   float y0,
                                   float x1,
                                   float y1)
Returns true if this wall intersects with the horizontal rectangle which opposite corners are at points (x0, y0) and (x1, y1).

Specified by:
intersectsRectangle in interface Selectable

containsPoint

public boolean containsPoint(float x,
                             float y,
                             float margin)
Returns true if this wall contains the point at (x, y) with a given margin.

Specified by:
containsPoint in interface Selectable

containsWallStartAt

public boolean containsWallStartAt(float x,
                                   float y,
                                   float margin)
Returns true if this wall start line contains the point at (x, y) with a given margin around the wall start line.


containsWallEndAt

public boolean containsWallEndAt(float x,
                                 float y,
                                 float margin)
Returns true if this wall end line contains the point at (x, y) with a given margin around the wall end line.


clone

public static List<Wall> clone(List<Wall> walls)
Returns a clone of the walls list. All existing walls are copied and their wall at start and end point are set with copied walls only if they belong to the returned list.


move

public void move(float dx,
                 float dy)
Moves this wall of (dx, dy) units.

Specified by:
move in interface Selectable

clone

public Wall clone()
Returns a clone of this wall expected its wall at start and wall at end aren't copied.

Specified by:
clone in interface Selectable
Overrides:
clone in class Object

Sweet Home 3D 2.5

© Copyrights 2006-2010 eTeks - All rights reserved
Distributed under GNU General Public License