|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.Shape
com.xj.anylogic.engine.presentation.ShapeLineFill
com.xj.anylogic.engine.presentation.ShapeMultiplePoints
com.xj.anylogic.engine.presentation.ShapePolyLine
public class ShapePolyLine
Persistent polyline shape.
| Field Summary |
|---|
| Fields inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
UNKNOWN_NAME |
| Constructor Summary | |
|---|---|
ShapePolyLine()
Constructs a polyline with default attributes. |
|
ShapePolyLine(boolean ispublic,
double x,
double y,
java.awt.Color lineColor,
java.awt.Color fillColor,
int npoints,
double[] dx,
double[] dy,
boolean closed,
double lineWidth,
int lineStyle)
Constructs a polyline with specific attributes. |
|
ShapePolyLine(boolean ispublic,
double x,
double y,
java.lang.Object lineColor,
java.lang.Object fillColor,
int npoints,
double[] dx,
double[] dy,
boolean closed,
double lineWidth,
int lineStyle)
Constructs a polyline with specific attributes. |
|
| Method Summary | |
|---|---|
ShapePolyLine |
clone()
Creates and returns a copy of this shape (i.e. new shape instance). |
boolean |
contains(double px,
double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y) |
void |
draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
Draws the polyline in a given context |
double |
getXMax()
Returns the x coordinate of the bottom-right corner of bounding rectangle for this polyline. |
double |
getXMin()
Returns the x coordinate of the top-left corner of bounding rectangle for this polyline. |
double |
getYMax()
Returns the y coordinate of the bottom-right corner of bounding rectangle for this polyline. |
double |
getYMin()
Returns the y coordinate of the top-left corner of bounding rectangle for this polyline. |
double |
length()
Calculates and returns the length of the polyline (not scaled), respecting its closeness. |
boolean |
onClickAt(double px,
double py,
boolean publicOnly)
Tests if the polyline contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point. |
Point |
randomPointInside()
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed). |
Point |
randomPointInside(java.util.Random rng)
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed). |
void |
setRotation(double r)
Sets the rotation of the shape. |
void |
setScale(double s)
Sets the same scale of the shape along both axes |
void |
setScale(double sx,
double sy)
Sets the scales of the shape along both axes |
void |
setScaleX(double sx)
Sets the scale of the shape along x axis |
void |
setScaleY(double sy)
Sets the scale of the shape along y axis |
| Methods inherited from class com.xj.anylogic.engine.presentation.ShapeMultiplePoints |
|---|
getNPoints, getPointDx, getPointDy, isClosed, setClosed, setNPoints, setPoint, setPointDx, setPointDy |
| Methods inherited from class com.xj.anylogic.engine.presentation.ShapeLineFill |
|---|
getFillColor, getFillTexture, getLineColor, getLineStyle, getLineTexture, getLineWidth, setFillColor, setFillColor, setLineColor, setLineColor, setLineStyle, setLineWidth |
| Methods inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
canHandleClick, getGroup, getName, getPresentable, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick, restoreOwner, setPos, setVisible, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.xj.anylogic.engine.Path2D |
|---|
getX, getY |
| Constructor Detail |
|---|
public ShapePolyLine()
public ShapePolyLine(boolean ispublic,
double x,
double y,
java.awt.Color lineColor,
java.awt.Color fillColor,
int npoints,
double[] dx,
double[] dy,
boolean closed,
double lineWidth,
int lineStyle)
ispublic - if true, the polyline is visible on container's presentationx - the x coordinate of the polyline start pointy - the y coordinate of the polyline start pointlineColor - line color of the polylinefillColor - fill color of the polylinenpoints - the number of points in the polylinedx - the array of (at least npoints) polyline points x coordinates relative to the start pointdy - the array of (at least npoints) polyline points y coordinates relative to the start pointclosed - if true, the polyline is drawn as closedlineWidth - the polyline widthlineStyle - the polyline stroke style (solid, dotted, dashed)
public ShapePolyLine(boolean ispublic,
double x,
double y,
java.lang.Object lineColor,
java.lang.Object fillColor,
int npoints,
double[] dx,
double[] dy,
boolean closed,
double lineWidth,
int lineStyle)
ispublic - if true, the polyline is visible on container's presentationx - the x coordinate of the polyline start pointy - the y coordinate of the polyline start pointlineColor - line color (or Texture) of the polylinefillColor - fill color (or Texture) of the polylinenpoints - the number of points in the polylinedx - the array of (at least npoints) polyline points x coordinates relative to the start pointdy - the array of (at least npoints) polyline points y coordinates relative to the start pointclosed - if true, the polyline is drawn as closedlineWidth - the polyline widthlineStyle - the polyline stroke style (solid, dotted, dashed)| Method Detail |
|---|
public boolean onClickAt(double px,
double py,
boolean publicOnly)
onClickAt in class Shapepx - the x coordinate of the clickpy - the y coordinate of the clickpublicOnly - if true, not public shape returns false
public boolean contains(double px,
double py)
Shape
contains in class Shapepx - the x coordinate relative to this shape's containerpy - the y coordinate relative to this shape's container
public Point randomPointInside()
public Point randomPointInside(java.util.Random rng)
public void setRotation(double r)
Shape
setRotation in class Shaper - the new value of rotation in radianspublic void setScaleX(double sx)
Shape
setScaleX in class Shapesx - the new value of scale along x axis, 1 = keep original sizepublic void setScaleY(double sy)
Shape
setScaleY in class Shapesy - the new value of scale along y axis, 1 = keep original sizepublic void setScale(double s)
Shape
setScale in class Shapes - the new value of scale along both axis, 1 = keep original size
public void setScale(double sx,
double sy)
Shape
setScale in class Shapesx - the new value of scale along x axis, 1 = keep original sizesy - the new value of scale along y axis, 1 = keep original sizepublic double getXMin()
Shape.getX() is included)
public double getXMax()
Shape.getX() is included)
public double getYMin()
Shape.getY() is included)
public double getYMax()
Shape.getY() is included)
public double length()
public void draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
draw in class Shapepanel - the panel where the drawing is doneg - the graphics where the drawing takes placexform - the "original" transform that must be restored before drawingpublicOnly - if true, the shape is only drawn if it is publicpublic ShapePolyLine clone()
Shape
clone in class Shape
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||