Sweet Home 3D 4.0

com.eteks.sweethome3d.model
Class Wall

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

public class Wall
extends Object
implements Serializable, Selectable, Elevatable

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)
          Deprecated. specify a height with the other constructor.
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.
Wall(float xStart, float yStart, float xEnd, float yEnd, float thickness, float height, TextureImage pattern)
          Creates a wall from (xStart,yStart) to (xEnd, yEnd), with given thickness, height and pattern.
 
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 getArcExtent()
          Returns the arc extent of a round wall or null if this wall isn't round.
 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.
 float getLeftSideShininess()
          Returns the left side shininess of this wall.
 HomeTexture getLeftSideTexture()
          Returns the left side texture of this wall.
 float getLength()
          Returns the length of this wall.
 Level getLevel()
          Returns the level which this wall belongs to.
 TextureImage getPattern()
          Returns the pattern of this wall in the plan.
 float[][] getPoints()
          Returns the points of each corner of a wall.
 Integer getRightSideColor()
          Returns right side color of this wall.
 float getRightSideShininess()
          Returns the right side shininess of this wall.
 HomeTexture getRightSideTexture()
          Returns the right side texture of this wall.
 float getStartPointToEndPointDistance()
          Returns the distance from the start point of this wall to its end point.
 float getThickness()
          Returns the thickness of this wall.
 Integer getTopColor()
          Returns the color of the top of this wall in the 3D view.
 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 getXArcCircleCenter()
          Returns the abscissa of the arc circle center of this wall.
 float getXEnd()
          Returns the end point abscissa of this wall.
 float getXStart()
          Returns the start point abscissa of this wall.
 float getYArcCircleCenter()
          Returns the ordinate of the arc circle center 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 isAtLevel(Level level)
          Returns true if this wall is visible at the given level.
 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 setArcExtent(Float arcExtent)
          Sets the arc extent of a round 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 setLeftSideShininess(float leftSideShininess)
          Sets the left side shininess of this wall.
 void setLeftSideTexture(HomeTexture leftSideTexture)
          Sets the left side texture of this wall.
 void setLevel(Level level)
          Sets the level of this wall.
 void setPattern(TextureImage pattern)
          Sets the pattern of this wall in the plan, and notifies listeners of this change.
 void setRightSideColor(Integer rightSideColor)
          Sets right side color of this wall.
 void setRightSideShininess(float rightSideShininess)
          Sets the right side shininess of this wall.
 void setRightSideTexture(HomeTexture rightSideTexture)
          Sets the right side texture of this wall.
 void setThickness(float thickness)
          Sets wall thickness.
 void setTopColor(Integer topColor)
          Sets the color of the top of this wall in the 3D view, and notifies listeners of this change.
 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)
Deprecated. specify a height with the other constructor.

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. Pattern, left and right colors are null.


Wall

public Wall(float xStart,
            float yStart,
            float xEnd,
            float yEnd,
            float thickness,
            float height,
            TextureImage pattern)
Creates a wall from (xStart,yStart) to (xEnd, yEnd), with given thickness, height and pattern. Colors are null.

Since:
4.0
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 of this wall.

Since:
2.0

getStartPointToEndPointDistance

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

Since:
3.0

setArcExtent

public void setArcExtent(Float arcExtent)
Sets the arc extent of a round wall.

Since:
3.0

getArcExtent

public Float getArcExtent()
Returns the arc extent of a round wall or null if this wall isn't round.

Since:
3.0

getXArcCircleCenter

public float getXArcCircleCenter()
Returns the abscissa of the arc circle center of this wall. If the wall isn't round, the return abscissa is at the middle of the wall.

Since:
3.0

getYArcCircleCenter

public float getYArcCircleCenter()
Returns the ordinate of the arc circle center of this wall. If the wall isn't round, the return ordinate is at the middle of the wall.

Since:
3.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.


getLeftSideShininess

public float getLeftSideShininess()
Returns the left side shininess of this wall.

Returns:
a value between 0 (matt) and 1 (very shiny)
Since:
3.0

setLeftSideShininess

public void setLeftSideShininess(float leftSideShininess)
Sets the left side shininess of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.

Since:
3.0

getRightSideShininess

public float getRightSideShininess()
Returns the right side shininess of this wall.

Returns:
a value between 0 (matt) and 1 (very shiny)
Since:
3.0

setRightSideShininess

public void setRightSideShininess(float rightSideShininess)
Sets the right side shininess of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.

Since:
3.0

getPattern

public TextureImage getPattern()
Returns the pattern of this wall in the plan.

Since:
3.3

setPattern

public void setPattern(TextureImage pattern)
Sets the pattern of this wall in the plan, and notifies listeners of this change.

Since:
3.3

getTopColor

public Integer getTopColor()
Returns the color of the top of this wall in the 3D view.

Since:
4.0

setTopColor

public void setTopColor(Integer topColor)
Sets the color of the top of this wall in the 3D view, and notifies listeners of this change.

Since:
4.0

getLevel

public Level getLevel()
Returns the level which this wall belongs to.

Specified by:
getLevel in interface Elevatable
Since:
3.4

setLevel

public void setLevel(Level level)
Sets the level of this wall. Once this wall is updated, listeners added to this wall will receive a change notification.

Since:
3.4

isAtLevel

public boolean isAtLevel(Level level)
Returns true if this wall is visible at the given level.

Specified by:
isAtLevel in interface Elevatable
Since:
3.4

getPoints

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

Specified by:
getPoints in interface Selectable
Returns:
an array of the (x,y) coordinates of the wall corners. For a straight wall, 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 4.0

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