Class Polyline
Extends
HomeObject.
Defined in: SweetHome3D.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Polyline(id, points, thickness, capStyle, joinStyle, dashStyle, dashOffset, startArrowStyle, endArrowStyle, closedPath, color)
Creates a polyline from the given coordinates.
|
Method Attributes | Method Name and Description |
---|---|
addPoint(x, y, index)
Adds a point at the given
index . |
|
clone()
Returns a clone of this polyline.
|
|
containsPoint(x, y, margin)
Returns
true if this polyline contains
the point at (x , y ) with a given margin . |
|
Returns the cap style of this polyline.
|
|
getColor()
Returns the color of this polyline.
|
|
Returns the offset from which the dash of this polyline should start.
|
|
Returns the dash pattern of this polyline in percentage of its thickness.
|
|
Returns the dash style of this polyline.
|
|
Returns the elevation of this polyline in 3D.
|
|
Returns the arrow style at the end of this polyline.
|
|
Returns the elevation of this polyline
from the ground according to the elevation of its level.
|
|
Returns the join style of this polyline.
|
|
Returns an approximate length of this polyline.
|
|
getLevel()
Returns the level which this polyline belongs to.
|
|
Returns the number of points of the polygon matching this polyline.
|
|
getPointIndexAt(x, y, margin)
Returns the index of the point of this polyline equal to
the point at (
x , y ) with a given margin . |
|
Returns the points of the polygon matching this polyline.
|
|
Returns the arrow style at the start of this polyline.
|
|
Returns the thickness of this polyline.
|
|
intersectsRectangle(x0, y0, x1, y1)
Returns
true if this polyline intersects
with the horizontal rectangle which opposite corners are at points
(x0 , y0 ) and (x1 , y1 ). |
|
isAtLevel(level)
Returns
true if this polyline is at the given level
or at a level with the same elevation and a smaller elevation index. |
|
Returns
true if the first and last points of this polyline should be joined to form a polygon. |
|
Returns
true if this polyline should be displayed in 3D. |
|
move(dx, dy)
Moves this polyline of (
dx , dy ) units. |
|
removePoint(index)
Removes the point at the given
index . |
|
setCapStyle(capStyle)
Sets the cap style of this polyline.
|
|
setClosedPath(closedPath)
Sets whether the first and last points of this polyline should be joined.
|
|
setColor(color)
Sets the color of this polyline.
|
|
setDashOffset(dashOffset)
Sets the offset from which the dash of this polyline should start.
|
|
setDashPattern(dashPattern)
Sets the dash pattern of this polyline in percentage of its thickness.
|
|
setDashStyle(dashStyle)
Sets the dash style of this polyline.
|
|
setElevation(elevation)
Sets the elevation of this polyline in 3D.
|
|
setEndArrowStyle(endArrowStyle)
Sets the arrow style at the end of this polyline.
|
|
setJoinStyle(joinStyle)
Sets the join style of this polyline.
|
|
setLevel(level)
Sets the level of this polyline.
|
|
setPoint(x, y, index)
Sets the point at the given
index . |
|
setPoints(points)
Sets the points of the polygon matching this polyline.
|
|
setStartArrowStyle(startArrowStyle)
Sets the arrow style at the start of this polyline.
|
|
setThickness(thickness)
Sets the thickness of this polyline.
|
|
setVisibleIn3D(visibleIn3D)
Sets whether this polyline should be displayed in 3D and fires a
PropertyChangeEvent . |
- Methods borrowed from class HomeObject:
- duplicate, firePropertyChange, getContentProperty, getId, getProperty, getPropertyNames, isContentProperty, setProperty
Class Detail
Polyline(id, points, thickness, capStyle, joinStyle, dashStyle, dashOffset, startArrowStyle, endArrowStyle, closedPath, color)
Creates a polyline from the given coordinates.
Author: Emmanuel Puybaret.
Author: Emmanuel Puybaret.
- Parameters:
- {string} id
- {float[][]} points
- {number} thickness
- {Polyline.CapStyle} capStyle
- {Polyline.JoinStyle} joinStyle
- {Polyline.DashStyle} dashStyle
- {number} dashOffset
- {Polyline.ArrowStyle} startArrowStyle
- {Polyline.ArrowStyle} endArrowStyle
- {boolean} closedPath
- {number} color
Method Detail
addPoint(x, y, index)
Adds a point at the given
index
.
- Parameters:
- {number} x
- {number} y
- {number} index
- Throws:
- IndexOutOfBoundsException if
index
is negative or >getPointCount()
{Polyline}
clone()
Returns a clone of this polyline.
- Returns:
- {Polyline}
{boolean}
containsPoint(x, y, margin)
Returns
true
if this polyline contains
the point at (x
, y
) with a given margin
.
- Parameters:
- {number} x
- {number} y
- {number} margin
- Returns:
- {boolean}
{Polyline.CapStyle}
getCapStyle()
Returns the cap style of this polyline.
- Returns:
- {Polyline.CapStyle}
{number}
getColor()
Returns the color of this polyline.
- Returns:
- {number}
{number}
getDashOffset()
Returns the offset from which the dash of this polyline should start.
- Returns:
- {number} the offset in percentage of the dash pattern
{float[]}
getDashPattern()
Returns the dash pattern of this polyline in percentage of its thickness.
- Returns:
- {float[]}
{Polyline.DashStyle}
getDashStyle()
Returns the dash style of this polyline. If
DashStyle.CUSTOMIZED
is returned,
the actual dash pattern will be returned by #getDashPattern().
- Returns:
- {Polyline.DashStyle}
{number}
getElevation()
Returns the elevation of this polyline in 3D.
- Returns:
- {number}
{Polyline.ArrowStyle}
getEndArrowStyle()
Returns the arrow style at the end of this polyline.
- Returns:
- {Polyline.ArrowStyle}
{number}
getGroundElevation()
Returns the elevation of this polyline
from the ground according to the elevation of its level.
- Returns:
- {number}
{Polyline.JoinStyle}
getJoinStyle()
Returns the join style of this polyline.
- Returns:
- {Polyline.JoinStyle}
{number}
getLength()
Returns an approximate length of this polyline.
- Returns:
- {number}
{Level}
getLevel()
Returns the level which this polyline belongs to.
- Returns:
- {Level}
{number}
getPointCount()
Returns the number of points of the polygon matching this polyline.
- Returns:
- {number}
{number}
getPointIndexAt(x, y, margin)
Returns the index of the point of this polyline equal to
the point at (
x
, y
) with a given margin
.
- Parameters:
- {number} x
- {number} y
- {number} margin
- Returns:
- {number} the index of the first found point or -1.
{float[][]}
getPoints()
Returns the points of the polygon matching this polyline.
- Returns:
- {float[][]} an array of the (x,y) coordinates of the polyline points.
{Polyline.ArrowStyle}
getStartArrowStyle()
Returns the arrow style at the start of this polyline.
- Returns:
- {Polyline.ArrowStyle}
{number}
getThickness()
Returns the thickness of this polyline.
- Returns:
- {number}
{boolean}
intersectsRectangle(x0, y0, x1, y1)
Returns
true
if this polyline intersects
with the horizontal rectangle which opposite corners are at points
(x0
, y0
) and (x1
, y1
).
- Parameters:
- {number} x0
- {number} y0
- {number} x1
- {number} y1
- Returns:
- {boolean}
{boolean}
isAtLevel(level)
Returns
true
if this polyline is at the given level
or at a level with the same elevation and a smaller elevation index.
- Parameters:
- {Level} level
- Returns:
- {boolean}
{boolean}
isClosedPath()
Returns
true
if the first and last points of this polyline should be joined to form a polygon.
- Returns:
- {boolean}
{boolean}
isVisibleIn3D()
Returns
true
if this polyline should be displayed in 3D.
- Returns:
- {boolean}
move(dx, dy)
Moves this polyline of (
dx
, dy
) units.
- Parameters:
- {number} dx
- {number} dy
removePoint(index)
Removes the point at the given
index
.
- Parameters:
- {number} index
- Throws:
- IndexOutOfBoundsException if
index
is negative or >=getPointCount()
setCapStyle(capStyle)
Sets the cap style of this polyline.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {Polyline.CapStyle} capStyle
setClosedPath(closedPath)
Sets whether the first and last points of this polyline should be joined.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {boolean} closedPath
setColor(color)
Sets the color of this polyline. Once this polyline is updated,
listeners added to this polyline will receive a change notification.
- Parameters:
- {number} color
setDashOffset(dashOffset)
Sets the offset from which the dash of this polyline should start.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {number} dashOffset
- the offset in percentage of the dash pattern
setDashPattern(dashPattern)
Sets the dash pattern of this polyline in percentage of its thickness.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {float[]} dashPattern
setDashStyle(dashStyle)
Sets the dash style of this polyline.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {Polyline.DashStyle} dashStyle
setElevation(elevation)
Sets the elevation of this polyline in 3D. Once this polyline is updated,
listeners added to this polyline will receive a change notification.
- Parameters:
- {number} elevation
setEndArrowStyle(endArrowStyle)
Sets the arrow style at the end of this polyline.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {Polyline.ArrowStyle} endArrowStyle
setJoinStyle(joinStyle)
Sets the join style of this polyline.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {Polyline.JoinStyle} joinStyle
setLevel(level)
Sets the level of this polyline. Once this polyline is updated,
listeners added to this polyline will receive a change notification.
- Parameters:
- {Level} level
setPoint(x, y, index)
Sets the point at the given
index
.
- Parameters:
- {number} x
- {number} y
- {number} index
- Throws:
- IndexOutOfBoundsException if
index
is negative or >=getPointCount()
setPoints(points)
Sets the points of the polygon matching this polyline. Once this polyline
is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {float[][]} points
setStartArrowStyle(startArrowStyle)
Sets the arrow style at the start of this polyline.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {Polyline.ArrowStyle} startArrowStyle
setThickness(thickness)
Sets the thickness of this polyline.
Once this polyline is updated, listeners added to this polyline will receive a change notification.
- Parameters:
- {number} thickness
setVisibleIn3D(visibleIn3D)
Sets whether this polyline should be displayed in 3D and fires a
PropertyChangeEvent
.
- Parameters:
- {boolean} visibleIn3D