public class HomePieceOfFurniture extends java.lang.Object implements PieceOfFurniture, java.io.Serializable, Selectable, Elevatable
Modifier and Type | Class and Description |
---|---|
static class |
HomePieceOfFurniture.Property
The properties of a piece of furniture that may change.
|
static class |
HomePieceOfFurniture.SortableProperty
The properties on which home furniture may be sorted.
|
Constructor and Description |
---|
HomePieceOfFurniture(PieceOfFurniture piece)
Creates a home piece of furniture from an existing piece.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the property change
listener in parameter to this piece. |
HomePieceOfFurniture |
clone()
Returns a clone of this piece.
|
boolean |
containsPoint(float x,
float y,
float margin)
Returns
true if this piece contains
the point at (x , y )
with a given margin . |
float |
getAngle()
Returns the angle in radians of this piece of furniture.
|
java.lang.String |
getCatalogId()
Returns the catalog ID of this piece of furniture or
null if it doesn't exist. |
java.lang.Integer |
getColor()
Returns the color of this piece of furniture.
|
java.lang.String |
getCreator()
Returns the creator of this piece.
|
java.lang.String |
getCurrency()
Returns the price currency, noted with ISO 4217 code, or
null
if it has no price or default currency should be used. |
float |
getDepth()
Returns the depth of this piece of furniture.
|
java.lang.String |
getDescription()
Returns the description of this piece of furniture.
|
float |
getElevation()
Returns the elevation of the bottom of this piece of furniture on its level.
|
static java.util.Comparator<HomePieceOfFurniture> |
getFurnitureComparator(HomePieceOfFurniture.SortableProperty property)
Returns a comparator that compares furniture on a given
property in ascending order. |
float |
getGroundElevation()
Returns the elevation of the bottom of this piece of furniture
from the ground according to the elevation of its level.
|
float |
getHeight()
Returns the height of this piece of furniture.
|
Content |
getIcon()
Returns the icon of this piece of furniture.
|
java.lang.String |
getInformation()
Returns the additional information associated to this piece, or
null . |
Level |
getLevel()
Returns the level which this piece belongs to.
|
Content |
getModel()
Returns the 3D model of this piece of furniture.
|
HomeMaterial[] |
getModelMaterials()
Returns the materials applied to the 3D model of this piece of furniture.
|
float[][] |
getModelRotation()
Returns the rotation 3 by 3 matrix of this piece of furniture that ensures
its model is correctly oriented.
|
java.lang.String |
getName()
Returns the name of this piece of furniture.
|
float |
getNameAngle()
Returns the angle in radians used to display the piece name.
|
TextStyle |
getNameStyle()
Returns the text style used to display piece name.
|
float |
getNameXOffset()
Returns the distance along x axis applied to piece abscissa to display piece name.
|
float |
getNameYOffset()
Returns the distance along y axis applied to piece ordinate
to display piece name.
|
Content |
getPlanIcon()
Returns the icon of this piece of furniture displayed in plan or
null . |
float[][] |
getPoints()
Returns the points of each corner of a piece.
|
java.math.BigDecimal |
getPrice()
Returns the price of this piece of furniture or
null . |
java.math.BigDecimal |
getPriceValueAddedTaxIncluded()
Returns the price of this piece of furniture, Value Added Tax included.
|
java.lang.Float |
getShininess()
Returns the shininess of this piece of furniture.
|
java.lang.String |
getStaircaseCutOutShape()
Returns the shape used to cut out upper levels when they intersect with the piece
like a staircase.
|
HomeTexture |
getTexture()
Returns the texture of this piece of furniture.
|
java.math.BigDecimal |
getValueAddedTax()
Returns the Value Added Tax applied to the price of this piece of furniture.
|
java.math.BigDecimal |
getValueAddedTaxPercentage()
Returns the Value Added Tax percentage applied to the price of this piece of furniture.
|
float |
getWidth()
Returns the width of this piece of furniture.
|
float |
getX()
Returns the abscissa of the center of this piece of furniture.
|
float |
getY()
Returns the ordinate of the center of this piece of furniture.
|
boolean |
intersectsRectangle(float x0,
float y0,
float x1,
float y1)
Returns
true if this piece intersects
with the horizontal rectangle which opposite corners are at points
(x0 , y0 ) and (x1 , y1 ). |
boolean |
isAtLevel(Level level)
Returns
true if this piece is visible at the given level. |
boolean |
isBackFaceShown()
Returns
true if the back face of the piece of furniture
model should be displayed. |
boolean |
isBottomLeftPointAt(float x,
float y,
float margin)
Returns
true if the bottom left point of this piece is
the point at (x , y ) with a given margin ,
and if that point is closer to bottom left point than to top left and bottom right points. |
boolean |
isBottomRightPointAt(float x,
float y,
float margin)
Returns
true if the bottom right point of this piece is
the point at (x , y ) with a given margin ,
and if that point is closer to top left point than to top right and bottom left points. |
boolean |
isDeformable()
Returns
true if this piece is deformable. |
boolean |
isDoorOrWindow()
Returns
true if this piece of furniture is a door or a window. |
boolean |
isModelMirrored()
Returns
true if the model of this piece should be mirrored. |
boolean |
isMovable()
Returns
true if this piece of furniture is movable. |
boolean |
isNameCenterPointAt(float x,
float y,
float margin)
Returns
true if the center point at which is displayed the name
of this piece is equal to the point at (x , y )
with a given margin . |
boolean |
isNameVisible()
Returns whether the name of this piece should be drawn or not.
|
boolean |
isPointAt(float x,
float y,
float margin)
Returns
true if one of the corner of this piece is
the point at (x , y ) with a given margin . |
boolean |
isResizable()
Returns
true if this piece is resizable. |
boolean |
isTexturable()
Returns
false if this piece should always keep the same color or texture. |
boolean |
isTopLeftPointAt(float x,
float y,
float margin)
Returns
true if the top left point of this piece is
the point at (x , y ) with a given margin ,
and if that point is closer to top left point than to top right and bottom left points. |
boolean |
isTopRightPointAt(float x,
float y,
float margin)
Returns
true if the top right point of this piece is
the point at (x , y ) with a given margin ,
and if that point is closer to top right point than to top left and bottom right points. |
boolean |
isVisible()
Returns
true if this piece of furniture is visible. |
void |
move(float dx,
float dy)
Moves this piece of (
dx , dy ) units. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the property change
listener in parameter from this piece. |
void |
setAngle(float angle)
Sets the angle of this piece.
|
void |
setColor(java.lang.Integer color)
Sets the color of this piece of furniture.
|
void |
setDepth(float depth)
Sets the depth of this piece of furniture.
|
void |
setDescription(java.lang.String description)
Sets the description of this piece of furniture.
|
void |
setElevation(float elevation)
Sets the elevation of this piece of furniture on its level.
|
void |
setHeight(float height)
Sets the height of this piece of furniture.
|
void |
setLevel(Level level)
Sets the level of this piece of furniture.
|
void |
setModelMaterials(HomeMaterial[] modelMaterials)
Sets the materials of the 3D model of this piece of furniture.
|
void |
setModelMirrored(boolean modelMirrored)
Sets whether the model of this piece of furniture is mirrored or not.
|
void |
setMovable(boolean movable)
Sets whether this piece is movable or not.
|
void |
setName(java.lang.String name)
Sets the name of this piece of furniture.
|
void |
setNameAngle(float nameAngle)
Sets the angle in radians used to display the piece name.
|
void |
setNameStyle(TextStyle nameStyle)
Sets the text style used to display piece name.
|
void |
setNameVisible(boolean nameVisible)
Sets whether the name of this piece is visible or not.
|
void |
setNameXOffset(float nameXOffset)
Sets the distance along x axis applied to piece abscissa to display piece name.
|
void |
setNameYOffset(float nameYOffset)
Sets the distance along y axis applied to piece ordinate to display piece name.
|
void |
setPrice(java.math.BigDecimal price)
Sets the price of this piece of furniture.
|
void |
setShininess(java.lang.Float shininess)
Sets the shininess of this piece of furniture or
null if piece shininess is unchanged. |
void |
setTexture(HomeTexture texture)
Sets the texture of this piece of furniture.
|
void |
setVisible(boolean visible)
Sets whether this piece of furniture is visible or not.
|
void |
setWidth(float width)
Sets the width of this piece of furniture.
|
void |
setX(float x)
Sets the abscissa of the center of this piece.
|
void |
setY(float y)
Sets the ordinate of the center of this piece.
|
public HomePieceOfFurniture(PieceOfFurniture piece)
piece
- the piece from which data are copiedpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
in parameter to this piece.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
in parameter from this piece.public java.lang.String getCatalogId()
null
if it doesn't exist.public java.lang.String getName()
getName
in interface PieceOfFurniture
public void setName(java.lang.String name)
public boolean isNameVisible()
public void setNameVisible(boolean nameVisible)
public float getNameXOffset()
public void setNameXOffset(float nameXOffset)
public float getNameYOffset()
public void setNameYOffset(float nameYOffset)
public TextStyle getNameStyle()
public void setNameStyle(TextStyle nameStyle)
public float getNameAngle()
public void setNameAngle(float nameAngle)
public java.lang.String getDescription()
null
.getDescription
in interface PieceOfFurniture
public void setDescription(java.lang.String description)
public java.lang.String getInformation()
null
.getInformation
in interface PieceOfFurniture
public float getDepth()
getDepth
in interface PieceOfFurniture
public void setDepth(float depth)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float getHeight()
getHeight
in interface PieceOfFurniture
public void setHeight(float height)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float getWidth()
getWidth
in interface PieceOfFurniture
public void setWidth(float width)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float getElevation()
getElevation
in interface PieceOfFurniture
public float getGroundElevation()
public void setElevation(float elevation)
public boolean isMovable()
true
if this piece of furniture is movable.isMovable
in interface PieceOfFurniture
public void setMovable(boolean movable)
public boolean isDoorOrWindow()
true
if this piece of furniture is a door or a window.
As this method existed before HomeDoorOrWindow class,
you shouldn't rely on the value returned by this method to guess if a piece
is an instance of DoorOrWindow
class.isDoorOrWindow
in interface PieceOfFurniture
public Content getIcon()
getIcon
in interface PieceOfFurniture
public Content getPlanIcon()
null
.getPlanIcon
in interface PieceOfFurniture
public Content getModel()
getModel
in interface PieceOfFurniture
public void setModelMaterials(HomeMaterial[] modelMaterials)
modelMaterials
- the materials of the 3D model or null
if they shouldn't be changedjava.lang.IllegalStateException
- if this piece of furniture isn't texturablepublic HomeMaterial[] getModelMaterials()
null
if the individual materials of the 3D model are not modified.public java.lang.Integer getColor()
getColor
in interface PieceOfFurniture
null
if piece color is unchanged.public void setColor(java.lang.Integer color)
color
- the color of this piece of furniture or null
if piece color is the default onejava.lang.IllegalStateException
- if this piece of furniture isn't texturablepublic HomeTexture getTexture()
null
if piece texture is unchanged.public void setTexture(HomeTexture texture)
texture
- the texture of this piece of furniture or null
if piece texture is the default onejava.lang.IllegalStateException
- if this piece of furniture isn't texturablepublic java.lang.Float getShininess()
null
if piece shininess is unchanged.public void setShininess(java.lang.Float shininess)
null
if piece shininess is unchanged.
Once this piece is updated, listeners added to this piece will receive a change notification.java.lang.IllegalStateException
- if this piece of furniture isn't texturablepublic boolean isResizable()
true
if this piece is resizable.isResizable
in interface PieceOfFurniture
public boolean isDeformable()
true
if this piece is deformable.isDeformable
in interface PieceOfFurniture
public boolean isTexturable()
false
if this piece should always keep the same color or texture.isTexturable
in interface PieceOfFurniture
public java.math.BigDecimal getPrice()
null
.getPrice
in interface PieceOfFurniture
public void setPrice(java.math.BigDecimal price)
public java.math.BigDecimal getValueAddedTaxPercentage()
getValueAddedTaxPercentage
in interface PieceOfFurniture
public java.math.BigDecimal getValueAddedTax()
public java.math.BigDecimal getPriceValueAddedTaxIncluded()
public java.lang.String getCurrency()
null
if it has no price or default currency should be used.getCurrency
in interface PieceOfFurniture
public boolean isVisible()
true
if this piece of furniture is visible.public void setVisible(boolean visible)
public float getX()
public void setX(float x)
public float getY()
public void setY(float y)
public float getAngle()
public void setAngle(float angle)
public boolean isModelMirrored()
true
if the model of this piece should be mirrored.public void setModelMirrored(boolean modelMirrored)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float[][] getModelRotation()
getModelRotation
in interface PieceOfFurniture
public java.lang.String getStaircaseCutOutShape()
getStaircaseCutOutShape
in interface PieceOfFurniture
public java.lang.String getCreator()
getCreator
in interface PieceOfFurniture
public boolean isBackFaceShown()
true
if the back face of the piece of furniture
model should be displayed.isBackFaceShown
in interface PieceOfFurniture
public Level getLevel()
getLevel
in interface Elevatable
public void setLevel(Level level)
public boolean isAtLevel(Level level)
true
if this piece is visible at the given level.isAtLevel
in interface Elevatable
public float[][] getPoints()
getPoints
in interface Selectable
public boolean intersectsRectangle(float x0, float y0, float x1, float y1)
true
if this piece intersects
with the horizontal rectangle which opposite corners are at points
(x0
, y0
) and (x1
, y1
).intersectsRectangle
in interface Selectable
public boolean containsPoint(float x, float y, float margin)
true
if this piece contains
the point at (x
, y
)
with a given margin
.containsPoint
in interface Selectable
public boolean isPointAt(float x, float y, float margin)
true
if one of the corner of this piece is
the point at (x
, y
) with a given margin
.public boolean isTopLeftPointAt(float x, float y, float margin)
true
if the top left point of this piece is
the point at (x
, y
) with a given margin
,
and if that point is closer to top left point than to top right and bottom left points.public boolean isTopRightPointAt(float x, float y, float margin)
true
if the top right point of this piece is
the point at (x
, y
) with a given margin
,
and if that point is closer to top right point than to top left and bottom right points.public boolean isBottomLeftPointAt(float x, float y, float margin)
true
if the bottom left point of this piece is
the point at (x
, y
) with a given margin
,
and if that point is closer to bottom left point than to top left and bottom right points.public boolean isBottomRightPointAt(float x, float y, float margin)
true
if the bottom right point of this piece is
the point at (x
, y
) with a given margin
,
and if that point is closer to top left point than to top right and bottom left points.public boolean isNameCenterPointAt(float x, float y, float margin)
true
if the center point at which is displayed the name
of this piece is equal to the point at (x
, y
)
with a given margin
.public void move(float dx, float dy)
dx
, dy
) units.move
in interface Selectable
public HomePieceOfFurniture clone()
clone
in interface Selectable
clone
in class java.lang.Object
public static java.util.Comparator<HomePieceOfFurniture> getFurnitureComparator(HomePieceOfFurniture.SortableProperty property)
property
in ascending order.
© Copyrights 2006-2014 eTeks - All rights reserved
Distributed under GNU General Public License