com.xj.anylogic.engine.presentation
Class ShapeOval

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.ShapeOval
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, Locatable2D, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Shape3DOval, ShapeArc

public class ShapeOval
extends ShapeLineFill

Persistent oval 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
ShapeOval()
          Constructs an oval with default attributes.
ShapeOval(boolean ispublic, double x, double y, double rotation, java.awt.Color lineColor, java.awt.Color fillColor, double radiusX, double radiusY, double lineWidth, int lineStyle)
          Constructs an oval with specific attributes.
ShapeOval(boolean ispublic, double x, double y, double rotation, java.lang.Object lineColor, java.lang.Object fillColor, double radiusX, double radiusY, double lineWidth, int lineStyle)
          Constructs an oval with specific attributes.
 
Method Summary
 ShapeOval 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 oval in a given context
 double getRadiusX()
          Returns the "horizontal" radius of the oval.
 double getRadiusY()
          Returns the "vertical" radius of the oval.
 boolean onClickAt(double px, double py, boolean publicOnly)
          Tests if the oval contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point.
 void setRadius(double radius)
          Sets both radiuses of the oval to the same given value, i.e. makes it a circle.
 void setRadiusX(double radiusX)
          Sets the "horizontal" radius of the oval.
 void setRadiusY(double radiusY)
          Sets the "vertical" radius of the oval.
 
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, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeOval

public ShapeOval()
Constructs an oval with default attributes.


ShapeOval

public ShapeOval(boolean ispublic,
                 double x,
                 double y,
                 double rotation,
                 java.awt.Color lineColor,
                 java.awt.Color fillColor,
                 double radiusX,
                 double radiusY,
                 double lineWidth,
                 int lineStyle)
Constructs an oval with specific attributes.

Parameters:
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the oval center
y - the y coordinate of the oval center
rotation - the rotation of the oval in radians
lineColor - line color of the oval
fillColor - fill color of the oval
radiusX - "horizontal" radius of the oval
radiusY - "vertical" radius of the oval
lineWidth - the line width of the oval
lineStyle - the line stroke style of the oval (solid, dotted, dashed)

ShapeOval

public ShapeOval(boolean ispublic,
                 double x,
                 double y,
                 double rotation,
                 java.lang.Object lineColor,
                 java.lang.Object fillColor,
                 double radiusX,
                 double radiusY,
                 double lineWidth,
                 int lineStyle)
Constructs an oval with specific attributes.

Parameters:
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the oval center
y - the y coordinate of the oval center
rotation - the rotation of the oval in radians
lineColor - line color (or Texture) of the oval
fillColor - fill color (or Texture) of the oval
radiusX - "horizontal" radius of the oval
radiusY - "vertical" radius of the oval
lineWidth - the line width of the oval
lineStyle - the line stroke style of the oval (solid, dotted, dashed)
Method Detail

setRadiusX

public void setRadiusX(double radiusX)
Sets the "horizontal" radius of the oval.

Parameters:
radiusX - the "horizontal" radius of the oval

getRadiusX

public double getRadiusX()
Returns the "horizontal" radius of the oval.

Returns:
the "horizontal" radius of the oval

setRadius

public void setRadius(double radius)
Sets both radiuses of the oval to the same given value, i.e. makes it a circle.

Parameters:
radius - the circle radius

setRadiusY

public void setRadiusY(double radiusY)
Sets the "vertical" radius of the oval.

Parameters:
radiusY - the "vertical" radius of the oval

getRadiusY

public double getRadiusY()
Returns the "vertical" radius of the oval.

Returns:
the "vertical" radius of the oval

onClickAt

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

Overrides:
onClickAt in class Shape
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)

Specified by:
contains in class Shape
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 oval in a given context

Specified by:
draw in class Shape
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

clone

public ShapeOval 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 Shape


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