com.xj.anylogic.engine.presentation
Class ShapeCurve

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Shape
      extended by com.xj.anylogic.engine.presentation.ShapeLineFill
          extended by com.xj.anylogic.engine.presentation.ShapeMultiplePoints
              extended by com.xj.anylogic.engine.presentation.ShapePolyLine
                  extended by com.xj.anylogic.engine.presentation.ShapeCurve
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, Locatable2D, Path2D, java.io.Serializable, java.lang.Cloneable

public class ShapeCurve
extends ShapePolyLine

Persistent curve shape.

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.xj.anylogic.engine.presentation.Shape
UNKNOWN_NAME
 
Constructor Summary
ShapeCurve()
          Constructs a curve with default attributes.
ShapeCurve(boolean ispublic, double x, double y, java.awt.Color lineColor, java.awt.Color fillColor, int npoints, boolean manualControlPoints, double[] dx, double[] dy, boolean closed, double lineWidth, int lineStyle)
          Constructs a curve with specific attributes.
ShapeCurve(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)
          Deprecated. use ShapeCurve(boolean, double, double, Object, Object, int, boolean, double[], double[], boolean, double, int)
ShapeCurve(boolean ispublic, double x, double y, java.lang.Object lineColor, java.lang.Object fillColor, int npoints, boolean manualControlPoints, double[] dx, double[] dy, boolean closed, double lineWidth, int lineStyle)
          Constructs a curve with specific attributes.
 
Method Summary
 ShapeCurve 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 curve in a given context
 double getPointDx(int i)
          Returns the x coordinate of a particular point of the shape relative to the start point.
 double getPointDy(int i)
          Returns the y coordinate of a particular point of the shape relative to the start point.
 double getXMax()
          This method isn't currently supported by Curve, it throws UnsupportedOperationException.
 double getXMin()
          This method isn't currently supported by Curve, it throws UnsupportedOperationException.
 double getYMax()
          This method isn't currently supported by Curve, it throws UnsupportedOperationException.
 double getYMin()
          This method isn't currently supported by Curve, it throws UnsupportedOperationException.
 boolean isManualControlPoints()
          Returns true if this curve uses manually specified control points (which are specified in the dx and dy arrays)
 boolean onClickAt(double px, double py, boolean publicOnly)
          Tests if the curve contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point.
 Point randomPointInside()
          This method isn't currently supported by Curve, it throws UnsupportedOperationException.
 void setManualControlPoints(boolean manualControlPoints)
          Sets control points mode: manual or automatic.
 void setPoint(int i, double ptdx, double ptdy)
          Sets the coordinates of a particular point of the shape relative to the start point.
 void setPointDx(int i, double ptdx)
          Sets the x coordinate of a particular point of the shape relative to the start point.
 void setPointDy(int i, double ptdy)
          Sets the y coordinate of a particular point of the shape relative to the start point.
 
Methods inherited from class com.xj.anylogic.engine.presentation.ShapePolyLine
length, randomPointInside, setRotation, setScale, setScale, setScaleX, setScaleY
 
Methods inherited from class com.xj.anylogic.engine.presentation.ShapeMultiplePoints
getNPoints, isClosed, setClosed, setNPoints
 
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

ShapeCurve

public ShapeCurve()
Constructs a curve with default attributes.


ShapeCurve

@Deprecated
public ShapeCurve(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)
Deprecated. use ShapeCurve(boolean, double, double, Object, Object, int, boolean, double[], double[], boolean, double, int)


ShapeCurve

public ShapeCurve(boolean ispublic,
                  double x,
                  double y,
                  java.awt.Color lineColor,
                  java.awt.Color fillColor,
                  int npoints,
                  boolean manualControlPoints,
                  double[] dx,
                  double[] dy,
                  boolean closed,
                  double lineWidth,
                  int lineStyle)
Constructs a curve with specific attributes.

Parameters:
ispublic - if true, the curve is visible on container's presentation
x - the x coordinate of the curve start point
y - the y coordinate of the curve start point
lineColor - line color of the curve
fillColor - fill color of the curve
npoints - the number of points in the curve
dx - the array of (at least npoints) curve points x coordinates relative to the start point (if controlPointsIncluded == true, with control points, in triplets: p0x, p0c1x, p0c2x, p1x, p1c1x, p1c2x... )
dy - the array of (at least npoints) curve points y coordinates relative to the start point (if controlPointsIncluded == true, with control points, in triplets: p0y, p0c1y, p0c2y, p1y, p1c1y, p1c2y... )
manualControlPoints - if true curve is drawn using control points specified in the dx and dy arrays
closed - if true, the curve is drawn as closed
lineWidth - the curve width
lineStyle - the curve stroke style (solid, dotted, dashed)

ShapeCurve

public ShapeCurve(boolean ispublic,
                  double x,
                  double y,
                  java.lang.Object lineColor,
                  java.lang.Object fillColor,
                  int npoints,
                  boolean manualControlPoints,
                  double[] dx,
                  double[] dy,
                  boolean closed,
                  double lineWidth,
                  int lineStyle)
Constructs a curve with specific attributes.

Parameters:
ispublic - if true, the curve is visible on container's presentation
x - the x coordinate of the curve start point
y - the y coordinate of the curve start point
lineColor - line color (or Texture) of the curve
fillColor - fill color (or Texture) of the curve
npoints - the number of points in the curve
dx - the array of (at least npoints) curve points x coordinates relative to the start point (if controlPointsIncluded == true, with control points, in triplets: p0x, p0c1x, p0c2x, p1x, p1c1x, p1c2x... )
dy - the array of (at least npoints) curve points y coordinates relative to the start point (if controlPointsIncluded == true, with control points, in triplets: p0y, p0c1y, p0c2y, p1y, p1c1y, p1c2y... )
manualControlPoints - if true curve is drawn using control points specified in the dx and dy arrays
closed - if true, the curve is drawn as closed
lineWidth - the curve width
lineStyle - the curve stroke style (solid, dotted, dashed)
Method Detail

onClickAt

public boolean onClickAt(double px,
                         double py,
                         boolean publicOnly)
Tests if the curve contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point.

Overrides:
onClickAt in class ShapePolyLine
Parameters:
px - the x coordinate of the click
py - the y coordinate of the click
publicOnly - if true, not public shape returns false
Returns:
true if the click has been handled AND further click processing is not needed, false otherwise

contains

public boolean contains(double px,
                        double py)
Description copied from class: Shape
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)

Overrides:
contains in class ShapePolyLine
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

draw

public void draw(Panel panel,
                 java.awt.Graphics2D g,
                 java.awt.geom.AffineTransform xform,
                 boolean publicOnly)
Draws the curve in a given context

Overrides:
draw in class ShapePolyLine
Parameters:
panel - the panel where the drawing is done
g - the graphics where the drawing takes place
xform - the "original" transform that must be restored before drawing
publicOnly - if true, the shape is only drawn if it is public

getXMin

public double getXMin()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.

Overrides:
getXMin in class ShapePolyLine
Returns:
the minimum x coordinate of the polyline

getXMax

public double getXMax()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.

Overrides:
getXMax in class ShapePolyLine
Returns:
the maximum x coordinate of the polyline

getYMin

public double getYMin()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.

Overrides:
getYMin in class ShapePolyLine
Returns:
the minimum y coordinate of the polyline

getYMax

public double getYMax()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.

Overrides:
getYMax in class ShapePolyLine
Returns:
the maximum y coordinate of the polyline

randomPointInside

public Point randomPointInside()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.

Overrides:
randomPointInside in class ShapePolyLine
Returns:
the randomly chosen point inside the polyline

isManualControlPoints

public boolean isManualControlPoints()
Returns true if this curve uses manually specified control points (which are specified in the dx and dy arrays)

Returns:
true if this curve uses manually specified control points (which are specified in the dx and dy arrays)

setManualControlPoints

public void setManualControlPoints(boolean manualControlPoints)
Sets control points mode: manual or automatic.
In the manual mode curve uses control points specified in the dx and dy arrays

Parameters:
manualControlPoints - true for manually specified control points, false for automatically calculated

getPointDx

public double getPointDx(int i)
Returns the x coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) returns x-coordinates of control points too. Each node point of curve is followed by 2 control points

Specified by:
getPointDx in interface Path2D
Overrides:
getPointDx in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
Returns:
the x coordinate of the point relative to the start point

getPointDy

public double getPointDy(int i)
Returns the y coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) returns y-coordinates of control points too. Each node point of curve is followed by 2 control points

Specified by:
getPointDy in interface Path2D
Overrides:
getPointDy in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
Returns:
the y coordinate of the point relative to the start point

setPointDx

public void setPointDx(int i,
                       double ptdx)
Sets the x coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets x-coordinates of control points too. Each node point of curve is followed by 2 control points

Overrides:
setPointDx in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
ptdx - the new x coordinate of the point relative to the start point

setPointDy

public void setPointDy(int i,
                       double ptdy)
Sets the y coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets y-coordinates of control points too. Each node point of curve is followed by 2 control points

Overrides:
setPointDy in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
ptdy - the new y coordinate of the point relative to the start point

setPoint

public void setPoint(int i,
                     double ptdx,
                     double ptdy)
Sets the coordinates of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets coordinates of control points too. Each node point of curve is followed by 2 control points

Overrides:
setPoint in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
ptdx - the new x coordinate of the point relative to the start point
ptdy - the new y coordinate of the point relative to the start point

clone

public final ShapeCurve clone()
Description copied from class: Shape
Creates and returns a copy of this shape (i.e. new shape instance).
The returned shape is the object of the same class
The returned copy isn't automatically added to the group this shape belongs to.
The clone is created in the context of the same experiment or active object

Note that cloning of GIS shape, controls and charts is not supported

Overrides:
clone in class ShapePolyLine


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.