Sweet Home 3D 4.0

com.eteks.sweethome3d.model
Class DimensionLine

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

public class DimensionLine
extends Object
implements Serializable, Selectable, Elevatable

A dimension line in plan.

Author:
Emmanuel Puybaret
See Also:
Serialized Form

Nested Class Summary
static class DimensionLine.Property
          The properties of a dimension line that may change.
 
Constructor Summary
DimensionLine(float xStart, float yStart, float xEnd, float yEnd, float offset)
          Creates a dimension line from (xStart,yStart) to (xEnd, yEnd), with a given offset.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds the property change listener in parameter to this dimension line.
 DimensionLine clone()
          Returns a clone of this dimension line.
 boolean containsEndExtensionLineAt(float x, float y, float margin)
          Returns true if the extension line at the end of this dimension line contains the point at (x, y) with a given margin around the extension line.
 boolean containsPoint(float x, float y, float margin)
          Returns true if this dimension line contains the point at (x, y) with a given margin.
 boolean containsStartExtensionLinetAt(float x, float y, float margin)
          Returns true if the extension line at the start of this dimension line contains the point at (x, y) with a given margin around the extension line.
 float getLength()
          Returns the length of this dimension line.
 TextStyle getLengthStyle()
          Returns the text style used to display dimension line length.
 Level getLevel()
          Returns the level which this dimension line belongs to.
 float getOffset()
          Returns the offset of this dimension line.
 float[][] getPoints()
          Returns the points of the rectangle surrounding this dimension line and its extension lines.
 float getXEnd()
          Returns the end point abscissa of this dimension line.
 float getXStart()
          Returns the start point abscissa of this dimension line.
 float getYEnd()
          Returns the end point ordinate of this dimension line.
 float getYStart()
          Returns the start point ordinate of this dimension line.
 boolean intersectsRectangle(float x0, float y0, float x1, float y1)
          Returns true if this dimension line intersects with the horizontal rectangle which opposite corners are at points (x0, y0) and (x1, y1).
 boolean isAtLevel(Level level)
          Returns true if this dimension line is at the given level.
 boolean isMiddlePointAt(float x, float y, float margin)
          Returns true if the middle point of this dimension line is the point at (x, y) with a given margin.
 void move(float dx, float dy)
          Moves this dimension line of (dx, dy) units.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the property change listener in parameter from this dimension line.
 void setLengthStyle(TextStyle lengthStyle)
          Sets the text style used to display dimension line length.
 void setLevel(Level level)
          Sets the level of this dimension line.
 void setOffset(float offset)
          Sets the offset of this dimension line.
 void setXEnd(float xEnd)
          Sets the end point abscissa of this dimension line.
 void setXStart(float xStart)
          Sets the start point abscissa of this dimension line.
 void setYEnd(float yEnd)
          Sets the end point ordinate of this dimension line.
 void setYStart(float yStart)
          Sets the start point ordinate of this dimension line.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimensionLine

public DimensionLine(float xStart,
                     float yStart,
                     float xEnd,
                     float yEnd,
                     float offset)
Creates a dimension line from (xStart,yStart) to (xEnd, yEnd), with a given offset.

Method Detail

addPropertyChangeListener

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


removePropertyChangeListener

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


getXStart

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


setXStart

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


getYStart

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


setYStart

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


getXEnd

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


setXEnd

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


getYEnd

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


setYEnd

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


getOffset

public float getOffset()
Returns the offset of this dimension line.


setOffset

public void setOffset(float offset)
Sets the offset of this dimension line. Once this dimension line is updated, listeners added to this dimension line will receive a change notification.


getLength

public float getLength()
Returns the length of this dimension line.


getLengthStyle

public TextStyle getLengthStyle()
Returns the text style used to display dimension line length.


setLengthStyle

public void setLengthStyle(TextStyle lengthStyle)
Sets the text style used to display dimension line length. Once this dimension line is updated, listeners added to it will receive a change notification.


getLevel

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

Specified by:
getLevel in interface Elevatable
Since:
3.4

setLevel

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

Since:
3.4

isAtLevel

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

Specified by:
isAtLevel in interface Elevatable
Since:
3.4

getPoints

public float[][] getPoints()
Returns the points of the rectangle surrounding this dimension line and its extension lines.

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

intersectsRectangle

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

Specified by:
containsPoint in interface Selectable

isMiddlePointAt

public boolean isMiddlePointAt(float x,
                               float y,
                               float margin)
Returns true if the middle point of this dimension line is the point at (x, y) with a given margin.


containsStartExtensionLinetAt

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


containsEndExtensionLineAt

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


move

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

Specified by:
move in interface Selectable

clone

public DimensionLine clone()
Returns a clone of this dimension line.

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