Sweet Home 3D 3.4

com.eteks.sweethome3d.model
Class Room

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

public class Room
extends java.lang.Object
implements java.io.Serializable, Selectable, Elevatable

A room or a polygon in a home plan.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
static class Room.Property
          The properties of a room that may change.
 
Constructor Summary
Room(float[][] points)
          Creates a room from its name and the given coordinates.
 
Method Summary
 void addPoint(float x, float y)
          Adds a point at the end of room points.
 void addPoint(float x, float y, int index)
          Adds a point at the given index.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds the property change listener in parameter to this wall.
 Room clone()
          Returns a clone of this room.
 boolean containsPoint(float x, float y, float margin)
          Returns true if this room contains the point at (x, y) with a given margin.
 float getArea()
          Returns the area of this room.
 TextStyle getAreaStyle()
          Returns the text style used to display room area.
 float getAreaXOffset()
          Returns the distance along x axis applied to room center abscissa to display room area.
 float getAreaYOffset()
          Returns the distance along y axis applied to room center ordinate to display room area.
 java.lang.Integer getCeilingColor()
          Returns the ceiling color color of this room.
 float getCeilingShininess()
          Returns the ceiling shininess of this room.
 HomeTexture getCeilingTexture()
          Returns the ceiling texture of this room.
 java.lang.Integer getFloorColor()
          Returns the floor color of this room.
 float getFloorShininess()
          Returns the floor shininess of this room.
 HomeTexture getFloorTexture()
          Returns the floor texture of this room.
 Level getLevel()
          Returns the level which this room belongs to.
 java.lang.String getName()
          Returns the name of this room.
 TextStyle getNameStyle()
          Returns the text style used to display room name.
 float getNameXOffset()
          Returns the distance along x axis applied to room center abscissa to display room name.
 float getNameYOffset()
          Returns the distance along y axis applied to room center ordinate to display room name.
 int getPointCount()
          Returns the number of points of the polygon matching this room.
 int getPointIndexAt(float x, float y, float margin)
          Returns the index of the point of this room equal to the point at (x, y) with a given margin.
 float[][] getPoints()
          Returns the points of the polygon matching this room.
 float getXCenter()
          Returns the abscissa of the center point of this room.
 float getYCenter()
          Returns the ordinate of the center point of this room.
 boolean intersectsRectangle(float x0, float y0, float x1, float y1)
          Returns true if this room intersects with the horizontal rectangle which opposite corners are at points (x0, y0) and (x1, y1).
 boolean isAreaCenterPointAt(float x, float y, float margin)
          Returns true if the center point at which is displayed the area of this room is equal to the point at (x, y) with a given margin.
 boolean isAreaVisible()
          Returns whether the area of this room is visible or not.
 boolean isAtLevel(Level level)
          Returns true if this room is at the given level.
 boolean isCeilingVisible()
          Returns whether the ceiling of this room is visible or not.
 boolean isClockwise()
          Returns true if the points of this room are in clockwise order.
 boolean isFloorVisible()
          Returns whether the floor of this room is visible or not.
 boolean isNameCenterPointAt(float x, float y, float margin)
          Returns true if the center point at which is displayed the name of this room is equal to the point at (x, y) with a given margin.
 boolean isSingular()
          Returns true if this room is comprised of only one polygon.
 void move(float dx, float dy)
          Moves this room of (dx, dy) units.
 void removePoint(int index)
          Removes the point at the given index.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes the property change listener in parameter from this wall.
 void setAreaStyle(TextStyle areaStyle)
          Sets the text style used to display room area.
 void setAreaVisible(boolean areaVisible)
          Sets whether the area of this room is visible or not.
 void setAreaXOffset(float areaXOffset)
          Sets the distance along x axis applied to room center abscissa to display room area.
 void setAreaYOffset(float areaYOffset)
          Sets the distance along y axis applied to room center ordinate to display room area.
 void setCeilingColor(java.lang.Integer ceilingColor)
          Sets the ceiling color of this room.
 void setCeilingShininess(float ceilingShininess)
          Sets the ceiling shininess of this room.
 void setCeilingTexture(HomeTexture ceilingTexture)
          Sets the ceiling texture of this room.
 void setCeilingVisible(boolean ceilingVisible)
          Sets whether the ceiling of this room is visible or not.
 void setFloorColor(java.lang.Integer floorColor)
          Sets the floor color of this room.
 void setFloorShininess(float floorShininess)
          Sets the floor shininess of this room.
 void setFloorTexture(HomeTexture floorTexture)
          Sets the floor texture of this room.
 void setFloorVisible(boolean floorVisible)
          Sets whether the floor of this room is visible or not.
 void setLevel(Level level)
          Sets the level of this room.
 void setName(java.lang.String name)
          Sets the name of this room.
 void setNameStyle(TextStyle nameStyle)
          Sets the text style used to display room name.
 void setNameXOffset(float nameXOffset)
          Sets the distance along x axis applied to room center abscissa to display room name.
 void setNameYOffset(float nameYOffset)
          Sets the distance along y axis applied to room center ordinate to display room name.
 void setPoint(float x, float y, int index)
          Sets the point at the given index.
 void setPoints(float[][] points)
          Sets the points of the polygon matching this room.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Room

public Room(float[][] points)
Creates a room from its name and the given coordinates.

Method Detail

addPropertyChangeListener

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


removePropertyChangeListener

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


getName

public java.lang.String getName()
Returns the name of this room.


setName

public void setName(java.lang.String name)
Sets the name of this room. Once this room is updated, listeners added to this room will receive a change notification.


getNameXOffset

public float getNameXOffset()
Returns the distance along x axis applied to room center abscissa to display room name.


setNameXOffset

public void setNameXOffset(float nameXOffset)
Sets the distance along x axis applied to room center abscissa to display room name. Once this room is updated, listeners added to this room will receive a change notification.


getNameYOffset

public float getNameYOffset()
Returns the distance along y axis applied to room center ordinate to display room name.


setNameYOffset

public void setNameYOffset(float nameYOffset)
Sets the distance along y axis applied to room center ordinate to display room name. Once this room is updated, listeners added to this room will receive a change notification.


getNameStyle

public TextStyle getNameStyle()
Returns the text style used to display room name.


setNameStyle

public void setNameStyle(TextStyle nameStyle)
Sets the text style used to display room name. Once this room is updated, listeners added to this room will receive a change notification.


getPoints

public float[][] getPoints()
Returns the points of the polygon matching this room.

Specified by:
getPoints in interface Selectable
Returns:
an array of the (x,y) coordinates of the room points.

getPointCount

public int getPointCount()
Returns the number of points of the polygon matching this room.

Since:
2.0

setPoints

public void setPoints(float[][] points)
Sets the points of the polygon matching this room. Once this room is updated, listeners added to this room will receive a change notification.


addPoint

public void addPoint(float x,
                     float y)
Adds a point at the end of room points.

Since:
2.0

addPoint

public void addPoint(float x,
                     float y,
                     int index)
Adds a point at the given index.

Throws:
java.lang.IndexOutOfBoundsException - if index is negative or > getPointCount()
Since:
2.0

setPoint

public void setPoint(float x,
                     float y,
                     int index)
Sets the point at the given index.

Throws:
java.lang.IndexOutOfBoundsException - if index is negative or >= getPointCount()
Since:
2.0

removePoint

public void removePoint(int index)
Removes the point at the given index.

Throws:
java.lang.IndexOutOfBoundsException - if index is negative or >= getPointCount()
Since:
2.0

isAreaVisible

public boolean isAreaVisible()
Returns whether the area of this room is visible or not.


setAreaVisible

public void setAreaVisible(boolean areaVisible)
Sets whether the area of this room is visible or not. Once this room is updated, listeners added to this room will receive a change notification.


getAreaXOffset

public float getAreaXOffset()
Returns the distance along x axis applied to room center abscissa to display room area.


setAreaXOffset

public void setAreaXOffset(float areaXOffset)
Sets the distance along x axis applied to room center abscissa to display room area. Once this room is updated, listeners added to this room will receive a change notification.


getAreaYOffset

public float getAreaYOffset()
Returns the distance along y axis applied to room center ordinate to display room area.


setAreaYOffset

public void setAreaYOffset(float areaYOffset)
Sets the distance along y axis applied to room center ordinate to display room area. Once this room is updated, listeners added to this room will receive a change notification.


getAreaStyle

public TextStyle getAreaStyle()
Returns the text style used to display room area.


setAreaStyle

public void setAreaStyle(TextStyle areaStyle)
Sets the text style used to display room area. Once this room is updated, listeners added to this room will receive a change notification.


getXCenter

public float getXCenter()
Returns the abscissa of the center point of this room.


getYCenter

public float getYCenter()
Returns the ordinate of the center point of this room.


getFloorColor

public java.lang.Integer getFloorColor()
Returns the floor color of this room.


setFloorColor

public void setFloorColor(java.lang.Integer floorColor)
Sets the floor color of this room. Once this room is updated, listeners added to this room will receive a change notification.


getFloorTexture

public HomeTexture getFloorTexture()
Returns the floor texture of this room.


setFloorTexture

public void setFloorTexture(HomeTexture floorTexture)
Sets the floor texture of this room. Once this room is updated, listeners added to this room will receive a change notification.


isFloorVisible

public boolean isFloorVisible()
Returns whether the floor of this room is visible or not.


setFloorVisible

public void setFloorVisible(boolean floorVisible)
Sets whether the floor of this room is visible or not. Once this room is updated, listeners added to this room will receive a change notification.


getFloorShininess

public float getFloorShininess()
Returns the floor shininess of this room.

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

setFloorShininess

public void setFloorShininess(float floorShininess)
Sets the floor shininess of this room. Once this room is updated, listeners added to this room will receive a change notification.

Since:
3.0

getCeilingColor

public java.lang.Integer getCeilingColor()
Returns the ceiling color color of this room.


setCeilingColor

public void setCeilingColor(java.lang.Integer ceilingColor)
Sets the ceiling color of this room. Once this room is updated, listeners added to this room will receive a change notification.


getCeilingTexture

public HomeTexture getCeilingTexture()
Returns the ceiling texture of this room.


setCeilingTexture

public void setCeilingTexture(HomeTexture ceilingTexture)
Sets the ceiling texture of this room. Once this room is updated, listeners added to this room will receive a change notification.


isCeilingVisible

public boolean isCeilingVisible()
Returns whether the ceiling of this room is visible or not.


setCeilingVisible

public void setCeilingVisible(boolean ceilingVisible)
Sets whether the ceiling of this room is visible or not. Once this room is updated, listeners added to this room will receive a change notification.


getCeilingShininess

public float getCeilingShininess()
Returns the ceiling shininess of this room.

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

setCeilingShininess

public void setCeilingShininess(float ceilingShininess)
Sets the ceiling shininess of this room. Once this room is updated, listeners added to this room will receive a change notification.

Since:
3.0

getLevel

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

Specified by:
getLevel in interface Elevatable
Since:
3.4

setLevel

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

Since:
3.4

isAtLevel

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

Specified by:
isAtLevel in interface Elevatable
Since:
3.4

getArea

public float getArea()
Returns the area of this room.


isClockwise

public boolean isClockwise()
Returns true if the points of this room are in clockwise order.


isSingular

public boolean isSingular()
Returns true if this room is comprised of only one polygon.


intersectsRectangle

public boolean intersectsRectangle(float x0,
                                   float y0,
                                   float x1,
                                   float y1)
Returns true if this room 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 room contains the point at (x, y) with a given margin.

Specified by:
containsPoint in interface Selectable

getPointIndexAt

public int getPointIndexAt(float x,
                           float y,
                           float margin)
Returns the index of the point of this room equal to the point at (x, y) with a given margin.

Returns:
the index of the first found point or -1.

isNameCenterPointAt

public boolean isNameCenterPointAt(float x,
                                   float y,
                                   float margin)
Returns true if the center point at which is displayed the name of this room is equal to the point at (x, y) with a given margin.


isAreaCenterPointAt

public boolean isAreaCenterPointAt(float x,
                                   float y,
                                   float margin)
Returns true if the center point at which is displayed the area of this room is equal to the point at (x, y) with a given margin.


move

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

Specified by:
move in interface Selectable

clone

public Room clone()
Returns a clone of this room.

Specified by:
clone in interface Selectable
Overrides:
clone in class java.lang.Object

Sweet Home 3D 3.4

? Copyrights 2006-2011 eTeks - All rights reserved
Distributed under GNU General Public License