public class Polyline extends HomeObject implements Selectable, Elevatable
Modifier and Type | Class and Description |
---|---|
static class |
Polyline.ArrowStyle |
static class |
Polyline.CapStyle |
static class |
Polyline.DashStyle |
static class |
Polyline.JoinStyle |
static class |
Polyline.Property
The properties of a polyline that may change.
|
Constructor and Description |
---|
Polyline(float[][] points)
Creates a polyline from the given coordinates.
|
Polyline(float[][] points,
float thickness,
Polyline.CapStyle capStyle,
Polyline.JoinStyle joinStyle,
Polyline.DashStyle dashStyle,
float dashOffset,
Polyline.ArrowStyle startArrowStyle,
Polyline.ArrowStyle endArrowStyle,
boolean closedPath,
int color)
Creates a polyline from the given coordinates.
|
Polyline(float[][] points,
float thickness,
Polyline.CapStyle capStyle,
Polyline.JoinStyle joinStyle,
Polyline.DashStyle dashStyle,
Polyline.ArrowStyle startArrowStyle,
Polyline.ArrowStyle endArrowStyle,
boolean closedPath,
int color)
Creates a polyline from the given coordinates.
|
Polyline(java.lang.String id,
float[][] points)
Creates a polyline from the given coordinates.
|
Polyline(java.lang.String id,
float[][] points,
float thickness,
Polyline.CapStyle capStyle,
Polyline.JoinStyle joinStyle,
Polyline.DashStyle dashStyle,
float dashOffset,
Polyline.ArrowStyle startArrowStyle,
Polyline.ArrowStyle endArrowStyle,
boolean closedPath,
int color)
Creates a polyline from the given coordinates.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(float x,
float y)
Adds a point at the end of polyline points.
|
void |
addPoint(float x,
float y,
int index)
Adds a point at the given
index . |
Polyline |
clone()
Returns a clone of this polyline.
|
boolean |
containsPoint(float x,
float y,
float margin)
Returns
true if this polyline contains
the point at (x , y ) with a given margin . |
Polyline.CapStyle |
getCapStyle()
Returns the cap style of this polyline.
|
int |
getColor()
Returns the color of this polyline.
|
float |
getDashOffset()
Returns the offset from which the dash of this polyline should start.
|
float[] |
getDashPattern()
Returns the dash pattern of this polyline in percentage of its thickness.
|
Polyline.DashStyle |
getDashStyle()
Returns the dash style of this polyline.
|
float |
getElevation()
Returns the elevation of this polyline in 3D.
|
Polyline.ArrowStyle |
getEndArrowStyle()
Returns the arrow style at the end of this polyline.
|
float |
getGroundElevation()
Returns the elevation of this polyline
from the ground according to the elevation of its level.
|
Polyline.JoinStyle |
getJoinStyle()
Returns the join style of this polyline.
|
float |
getLength()
Returns an approximate length of this polyline.
|
Level |
getLevel()
Returns the level which this polyline belongs to.
|
int |
getPointCount()
Returns the number of points of the polygon matching this polyline.
|
int |
getPointIndexAt(float x,
float y,
float margin)
Returns the index of the point of this polyline equal to
the point at (
x , y ) with a given margin . |
float[][] |
getPoints()
Returns the points of the polygon matching this polyline.
|
Polyline.ArrowStyle |
getStartArrowStyle()
Returns the arrow style at the start of this polyline.
|
float |
getThickness()
Returns the thickness of this polyline.
|
boolean |
intersectsRectangle(float x0,
float y0,
float x1,
float y1)
Returns
true if this polyline intersects
with the horizontal rectangle which opposite corners are at points
(x0 , y0 ) and (x1 , y1 ). |
boolean |
isAtLevel(Level level)
Returns
true if this polyline is at the given level
or at a level with the same elevation and a smaller elevation index. |
boolean |
isClosedPath()
Returns
true if the first and last points of this polyline should be joined to form a polygon. |
boolean |
isVisibleIn3D()
Returns
true if this polyline should be displayed in 3D. |
void |
move(float dx,
float dy)
Moves this polyline of (
dx , dy ) units. |
void |
removePoint(int index)
Removes the point at the given
index . |
void |
setCapStyle(Polyline.CapStyle capStyle)
Sets the cap style of this polyline.
|
void |
setClosedPath(boolean closedPath)
Sets whether the first and last points of this polyline should be joined.
|
void |
setColor(int color)
Sets the color of this polyline.
|
void |
setDashOffset(float dashOffset)
Sets the offset from which the dash of this polyline should start.
|
void |
setDashPattern(float[] dashPattern)
Sets the dash pattern of this polyline in percentage of its thickness.
|
void |
setDashStyle(Polyline.DashStyle dashStyle)
Sets the dash style of this polyline.
|
void |
setElevation(float elevation)
Sets the elevation of this polyline in 3D.
|
void |
setEndArrowStyle(Polyline.ArrowStyle endArrowStyle)
Sets the arrow style at the end of this polyline.
|
void |
setJoinStyle(Polyline.JoinStyle joinStyle)
Sets the join style of this polyline.
|
void |
setLevel(Level level)
Sets the level of this polyline.
|
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 polyline.
|
void |
setStartArrowStyle(Polyline.ArrowStyle startArrowStyle)
Sets the arrow style at the start of this polyline.
|
void |
setThickness(float thickness)
Sets the thickness of this polyline.
|
void |
setVisibleIn3D(boolean visibleIn3D)
Sets whether this polyline should be displayed in 3D and fires a
PropertyChangeEvent . |
addPropertyChangeListener, addPropertyChangeListener, createId, duplicate, firePropertyChange, getContentProperty, getId, getProperty, getPropertyNames, isContentProperty, removePropertyChangeListener, removePropertyChangeListener, setProperty, setProperty
public Polyline(float[][] points)
public Polyline(java.lang.String id, float[][] points)
public Polyline(float[][] points, float thickness, Polyline.CapStyle capStyle, Polyline.JoinStyle joinStyle, Polyline.DashStyle dashStyle, Polyline.ArrowStyle startArrowStyle, Polyline.ArrowStyle endArrowStyle, boolean closedPath, int color)
public Polyline(float[][] points, float thickness, Polyline.CapStyle capStyle, Polyline.JoinStyle joinStyle, Polyline.DashStyle dashStyle, float dashOffset, Polyline.ArrowStyle startArrowStyle, Polyline.ArrowStyle endArrowStyle, boolean closedPath, int color)
public Polyline(java.lang.String id, float[][] points, float thickness, Polyline.CapStyle capStyle, Polyline.JoinStyle joinStyle, Polyline.DashStyle dashStyle, float dashOffset, Polyline.ArrowStyle startArrowStyle, Polyline.ArrowStyle endArrowStyle, boolean closedPath, int color)
public float[][] getPoints()
getPoints
in interface Selectable
public int getPointCount()
public void setPoints(float[][] points)
public void addPoint(float x, float y)
public void addPoint(float x, float y, int index)
index
.java.lang.IndexOutOfBoundsException
- if index
is negative or > getPointCount()
public void setPoint(float x, float y, int index)
index
.java.lang.IndexOutOfBoundsException
- if index
is negative or >= getPointCount()
public void removePoint(int index)
index
.java.lang.IndexOutOfBoundsException
- if index
is negative or >= getPointCount()
public float getThickness()
public void setThickness(float thickness)
public Polyline.CapStyle getCapStyle()
public void setCapStyle(Polyline.CapStyle capStyle)
public Polyline.JoinStyle getJoinStyle()
public void setJoinStyle(Polyline.JoinStyle joinStyle)
public Polyline.DashStyle getDashStyle()
DashStyle.CUSTOMIZED
is returned,
the actual dash pattern will be returned by getDashPattern()
.public void setDashStyle(Polyline.DashStyle dashStyle)
public float[] getDashPattern()
public void setDashPattern(float[] dashPattern)
public float getDashOffset()
public void setDashOffset(float dashOffset)
dashOffset
- the offset in percentage of the dash patternpublic Polyline.ArrowStyle getStartArrowStyle()
public void setStartArrowStyle(Polyline.ArrowStyle startArrowStyle)
public Polyline.ArrowStyle getEndArrowStyle()
public void setEndArrowStyle(Polyline.ArrowStyle endArrowStyle)
public boolean isClosedPath()
true
if the first and last points of this polyline should be joined to form a polygon.public void setClosedPath(boolean closedPath)
public int getColor()
public void setColor(int color)
public float getGroundElevation()
public float getElevation()
public void setElevation(float elevation)
public boolean isVisibleIn3D()
true
if this polyline should be displayed in 3D.public void setVisibleIn3D(boolean visibleIn3D)
PropertyChangeEvent
.public Level getLevel()
getLevel
in interface Elevatable
public void setLevel(Level level)
public boolean isAtLevel(Level level)
true
if this polyline is at the given level
or at a level with the same elevation and a smaller elevation index.isAtLevel
in interface Elevatable
public float getLength()
public boolean intersectsRectangle(float x0, float y0, float x1, float y1)
true
if this polyline 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 polyline contains
the point at (x
, y
) with a given margin
.containsPoint
in interface Selectable
public int getPointIndexAt(float x, float y, float margin)
x
, y
) with a given margin
.public void move(float dx, float dy)
dx
, dy
) units.move
in interface Selectable
public Polyline clone()
clone
in interface Selectable
clone
in class HomeObject
© Copyright 2024 Space Mushrooms
Distributed under GNU General Public License