public class HomePieceOfFurniture extends HomeObject implements PieceOfFurniture, 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.
|
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String[] |
EMPTY_PROPERTY_ARRAY |
DEFAULT_CUT_OUT_SHAPE, HIDE_EDGE_COLOR_MATERIAL, IDENTITY_ROTATION, SHOW_BACK_FACE
Constructor and Description |
---|
HomePieceOfFurniture(PieceOfFurniture piece)
Creates a home piece of furniture from an existing piece.
|
HomePieceOfFurniture(PieceOfFurniture piece,
java.lang.String[] copiedProperties)
Creates a home piece of furniture from an existing piece.
|
HomePieceOfFurniture(java.lang.String id,
PieceOfFurniture piece)
Creates a home piece of furniture from an existing piece.
|
HomePieceOfFurniture(java.lang.String id,
PieceOfFurniture piece,
java.lang.String[] copiedProperties)
Creates a home piece of furniture from an existing piece.
|
Modifier and Type | Method and Description |
---|---|
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 around vertical axis.
|
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.
|
float |
getDepthInPlan()
Returns the depth of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
|
java.lang.String |
getDescription()
Returns the description of this piece of furniture.
|
float |
getDropOnTopElevation()
Returns the elevation at which should be placed an object dropped on this piece.
|
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 which 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.
|
float |
getHeightInPlan()
Returns the height of this piece of furniture from the horizontal plan (after pitch or roll is applied to it).
|
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.
|
java.lang.String |
getLicense()
Returns the license of this piece, or
null . |
Content |
getModel()
Returns the 3D model of this piece of furniture.
|
int |
getModelFlags()
Returns the flags applied to the piece of furniture model.
|
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.Long |
getModelSize()
Returns the size of the 3D model of this piece of furniture.
|
Transformation[] |
getModelTransformations()
Returns the transformations applied to the 3D model of this piece of furniture.
|
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.
|
float |
getPitch()
Returns the pitch angle in radians of this piece of furniture.
|
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.
|
float |
getRoll()
Returns the roll angle in radians of this piece of furniture.
|
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 |
getWidthInPlan()
Returns the width of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
|
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 at the given level
or at a level with the same elevation and a smaller elevation index
or if the elevation of its highest point is higher than level elevation. |
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 |
isHorizontallyRotatable()
Returns
false if this piece should not rotate around an horizontal axis. |
boolean |
isHorizontallyRotated()
Returns
true if the pitch or roll angle of this piece is different from 0. |
boolean |
isModelCenteredAtOrigin()
Returns
true if model center should be always centered at the origin
when model rotation isn't null . |
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 |
isParallelToWall(Wall wall)
Returns
true if the front side of this piece is parallel to the given wall
with a margin. |
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. |
boolean |
isWidthDepthDeformable()
Returns
true if this piece is deformable. |
void |
move(float dx,
float dy)
Moves this piece of (
dx , dy ) units. |
void |
scale(float scale)
Scales this piece of furniture with the given
scale . |
void |
setAngle(float angle)
Sets the angle of this piece around vertical axis.
|
void |
setBackFaceShown(boolean backFaceShown)
Deprecated.
Prefer use
setModelFlags(int) with PieceOfFurniture.SHOW_BACK_FACE flag. |
void |
setCatalogId(java.lang.String catalogId)
Sets the catalog ID of this piece of furniture.
|
void |
setColor(java.lang.Integer color)
Sets the color of this piece of furniture.
|
void |
setCreator(java.lang.String creator)
Sets the creator of this piece.
|
void |
setCurrency(java.lang.String currency)
Sets the price currency, noted with ISO 4217 code.
|
void |
setDepth(float depth)
Sets the depth of this piece of furniture.
|
void |
setDepthInPlan(float depthInPlan)
Sets the depth of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
|
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 |
setHeightInPlan(float heightInPlan)
Sets the height of this piece of furniture from the horizontal plan (after pitch or roll is applied to it).
|
void |
setIcon(Content icon)
Sets the icon of this piece of furniture.
|
void |
setInformation(java.lang.String information)
Sets the additional information associated to this piece .
|
void |
setLevel(Level level)
Sets the level of this piece of furniture.
|
void |
setLicense(java.lang.String license)
Sets the the license of this piece .
|
void |
setModel(Content model)
Sets the 3D model of this piece of furniture.
|
void |
setModelCenteredAtOrigin(boolean modelCenteredAtOrigin)
Sets whether model center should be always centered at the origin
when model rotation isn't
null . |
void |
setModelFlags(int modelFlags)
Sets the flags applied to the piece of furniture model.
|
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 |
setModelRotation(float[][] modelRotation)
Sets the rotation 3 by 3 matrix of this piece of furniture and notifies listeners of this change.
|
void |
setModelSize(java.lang.Long modelSize)
Sets the size of the 3D model of this piece of furniture.
|
void |
setModelTransformations(Transformation[] modelTransformations)
Sets the transformations applied to some parts of the 3D model of this piece of furniture.
|
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 |
setPitch(float pitch)
Sets the pitch angle in radians of this piece and notifies listeners of this change.
|
void |
setPlanIcon(Content planIcon)
Sets the plan icon of this piece of furniture.
|
void |
setPrice(java.math.BigDecimal price)
Sets the price of this piece of furniture.
|
void |
setRoll(float roll)
Sets the roll angle in radians of this piece and notifies listeners of this change.
|
void |
setShininess(java.lang.Float shininess)
Sets the shininess of this piece of furniture or
null if piece shininess is unchanged. |
void |
setStaircaseCutOutShape(java.lang.String staircaseCutOutShape)
Sets the shape used to cut out upper levels when they intersect with the piece
like a staircase.
|
void |
setTexture(HomeTexture texture)
Sets the texture of this piece of furniture.
|
void |
setValueAddedTaxPercentage(java.math.BigDecimal valueAddedTaxPercentage)
Sets the Value Added Tax percentage applied to prices.
|
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 |
setWidthInPlan(float widthInPlan)
Sets the width of this piece of furniture in the horizontal plan (after pitch or roll is applied to it).
|
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.
|
addPropertyChangeListener, addPropertyChangeListener, createId, duplicate, firePropertyChange, getContentProperty, getId, getProperty, getPropertyNames, isContentProperty, removePropertyChangeListener, removePropertyChangeListener, setProperty, setProperty
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContentProperty, getProperty, getPropertyNames, isContentProperty
public HomePieceOfFurniture(PieceOfFurniture piece)
piece
- the piece from which data are copiedpublic HomePieceOfFurniture(PieceOfFurniture piece, java.lang.String[] copiedProperties)
piece
- the piece from which data are copiedcopiedProperties
- the names of the additional properties which should be copied from the existing piece
or null
if all properties should be copied.public HomePieceOfFurniture(java.lang.String id, PieceOfFurniture piece)
id
- the ID of the piecepiece
- the piece from which data are copiedpublic HomePieceOfFurniture(java.lang.String id, PieceOfFurniture piece, java.lang.String[] copiedProperties)
id
- the ID of the piecepiece
- the piece from which data are copiedcopiedProperties
- the names of the additional properties which should be copied from the existing piece
or null
if all properties should be copied.public java.lang.String getCatalogId()
null
if it doesn't exist.public void setCatalogId(java.lang.String catalogId)
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 void setInformation(java.lang.String information)
public java.lang.String getCreator()
getCreator
in interface PieceOfFurniture
public void setCreator(java.lang.String creator)
public java.lang.String getLicense()
null
.getLicense
in interface PieceOfFurniture
public void setLicense(java.lang.String license)
public float getDepth()
getDepth
in interface PieceOfFurniture
public void setDepth(float depth)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float getDepthInPlan()
public void setDepthInPlan(float depthInPlan)
public float getHeight()
getHeight
in interface PieceOfFurniture
public void setHeight(float height)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float getHeightInPlan()
public void setHeightInPlan(float heightInPlan)
public float getWidth()
getWidth
in interface PieceOfFurniture
public void setWidth(float width)
java.lang.IllegalStateException
- if this piece of furniture isn't resizablepublic float getWidthInPlan()
public void setWidthInPlan(float widthInPlan)
public void scale(float scale)
scale
.
Once this piece is updated, listeners added to this piece will receive a change notification.public float getElevation()
getElevation
in interface PieceOfFurniture
public float getDropOnTopElevation()
getDropOnTopElevation
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 void setIcon(Content icon)
public Content getPlanIcon()
null
.getPlanIcon
in interface PieceOfFurniture
public void setPlanIcon(Content planIcon)
public Content getModel()
getModel
in interface PieceOfFurniture
public void setModel(Content model)
public java.lang.Long getModelSize()
getModelSize
in interface PieceOfFurniture
public void setModelSize(java.lang.Long modelSize)
public HomeMaterial[] getModelMaterials()
null
if the individual materials of the 3D model are not modified.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 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 isWidthDepthDeformable()
true
if this piece is deformable.isWidthDepthDeformable
in interface PieceOfFurniture
public boolean isTexturable()
false
if this piece should always keep the same color or texture.isTexturable
in interface PieceOfFurniture
public boolean isHorizontallyRotatable()
false
if this piece should not rotate around an horizontal axis.isHorizontallyRotatable
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 void setValueAddedTaxPercentage(java.math.BigDecimal valueAddedTaxPercentage)
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 void setCurrency(java.lang.String currency)
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 float getPitch()
public void setPitch(float pitch)
public float getRoll()
public void setRoll(float roll)
public boolean isHorizontallyRotated()
true
if the pitch or roll angle of this piece is different from 0.public float[][] getModelRotation()
getModelRotation
in interface PieceOfFurniture
public void setModelRotation(float[][] modelRotation)
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 boolean isModelCenteredAtOrigin()
true
if model center should be always centered at the origin
when model rotation isn't null
.false
by default if version < 5.5public void setModelCenteredAtOrigin(boolean modelCenteredAtOrigin)
null
.
This method should be called only to keep unchanged the (wrong) location
of a rotated model created with version < 5.5.public boolean isBackFaceShown()
true
if the back face of the piece of furniture
model should be displayed.isBackFaceShown
in interface PieceOfFurniture
public void setBackFaceShown(boolean backFaceShown)
setModelFlags(int)
with PieceOfFurniture.SHOW_BACK_FACE
flag.public int getModelFlags()
getModelFlags
in interface PieceOfFurniture
public void setModelFlags(int modelFlags)
public Transformation[] getModelTransformations()
null
if the 3D model is not transformed.public void setModelTransformations(Transformation[] modelTransformations)
modelTransformations
- the transformations of the 3D model or null
if no transformation shouldn't be appliedpublic java.lang.String getStaircaseCutOutShape()
getStaircaseCutOutShape
in interface PieceOfFurniture
public void setStaircaseCutOutShape(java.lang.String staircaseCutOutShape)
public Level getLevel()
getLevel
in interface Elevatable
public void setLevel(Level level)
public boolean isAtLevel(Level level)
true
if this piece is at the given level
or at a level with the same elevation and a smaller elevation index
or if the elevation of its highest point is higher than level
elevation.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 boolean isParallelToWall(Wall wall)
true
if the front side of this piece is parallel to the given wall
with a 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 HomeObject
public static java.util.Comparator<HomePieceOfFurniture> getFurnitureComparator(HomePieceOfFurniture.SortableProperty property)
property
in ascending order.
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License