public class IlvArc extends IlvGraphic implements IlvDefinitionRectInterface
IlvArc defines an arc shape.
The default arc created when you call IlvArc() has the fill
disabled and the stroke enabled. The default color for both is
Color.black. You control the arc's fill and stroke by calling
setFillOn(boolean), setStrokeOn(boolean) and
setForeground(Color), setBackground(Color).
Call setAnnulusThickness(double) to draw the annulus of the arc,
that is, to draw the arc as a donut shape.
The following code example shows how to use an IlvArc in a
simple Java application:
IlvManager manager = new IlvManager(); IlvArc arc, arcAnnulus; //Create new filled arc, change its fill and stroke color, then add it to //the manager. //This constructor sets the bounding box, start angle, arc angle, //fill and stroke for the new IlvArc instance. arc = new IlvArc(new IlvRect(30,10,50,50), 40, 150, true, true); arc.setBackground(Color.green); arc.setForeground(Color.red); manager.addObject(arc,true); //Create new arc, rotate it and set the annulus. arcAnnulus = new IlvArc(new IlvRect(70,40,50,50), 40, 150, true, true); IlvPoint arcCenter = arcAnnulus.getCenter(new IlvTransformer()); arcAnnulus.rotate(arcCenter,65); arcAnnulus.setAnnulusThickness(6); manager.addObject(arcAnnulus,true);
The following image shows the graphic objects created in the code example:
IlvArc is a custom graphic object, that is, a subclass of
IlvGraphic. Graphic objects are controlled using an
IlvManager instance and displayed using one or more
IlvManagerView instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvManager,
IlvManagerView,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected IlvRect |
bbox
The rectangle that contains the ellipse defining the arc.
|
| Constructor and Description |
|---|
IlvArc()
Creates an arc with a default definition rect of
(0,0,100,100)
a 0 degree start angle and a 90 degrees range angle. |
IlvArc(IlvArc source)
Creates an arc by copying an existing arc.
|
IlvArc(IlvInputStream stream)
Reads the object from an
IlvInputStream. |
IlvArc(IlvRect rect,
double startAngle,
double angle)
Creates an arc.
|
IlvArc(IlvRect rect,
double startAngle,
double angle,
boolean outlined,
boolean filled)
Creates a new
IlvArc. |
| Modifier and Type | Method and Description |
|---|---|
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the arc.
|
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the arc.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
double |
getAnnulusThickness()
Returns the thickness of the annulus.
|
Color |
getBackground()
Returns the background color of the
IlvArc. |
IlvPoint |
getCenter(IlvTransformer t)
Returns the center point of the graphic object.
|
IlvRect |
getDefinitionRect()
Returns the rectangle that contains the ellipse defining the arc.
|
IlvTransformer |
getDefinitionTransformer()
This function calls
getTransformer(). |
double |
getDeltaAngle()
Returns the angle range of the arc, in degrees.
|
Color |
getForeground()
Returns the foreground color of the arc.
|
IlvPoint |
getIntersectionWithOutline(IlvPoint innerPoint,
IlvPoint outerPoint,
IlvTransformer t)
Returns the intersection of the line segment from inner point to outer
point with the shape of the graphic object.
|
double |
getStartAngle()
Returns the start angle of the arc, in degrees.
|
IlvTransformer |
getTransformer()
Gets a copy of the internal transformer of the arc.
|
boolean |
isFillOn()
Returns
true if the inside of the
arc will be filled. |
boolean |
isStrokeOn()
Returns
true if the shape of the
arc is stroked. |
boolean |
isTransformerMode()
Returns if the arc is in transformer mode.
|
void |
rotate(IlvPoint center,
double angle)
Rotates the arc object.
|
void |
setAnnulusThickness(double annulus)
Specifies the thickness of the annulus.
|
void |
setBackground(Color color)
Changes the background color of the
IlvArc. |
void |
setDefinitionRect(IlvRect rect)
Sets the definition rectangle.
|
void |
setDeltaAngle(double delta_angle)
Changes the angle range of the arc.
|
void |
setFillOn(boolean set)
If
true, specifies that the inside of the
arc will be filled. |
void |
setForeground(Color color)
Changes the foreground color of the arc.
|
void |
setStartAngle(double start_angle)
Changes the start angle of the arc.
|
void |
setStrokeOn(boolean set)
When set to
true, specifies that the shape of the
arc is stroked. |
void |
setTransformer(IlvTransformer t)
Specifies a new transformer to the arc object.
|
void |
setTransformerMode(boolean enabled)
Enables and disables the transformer mode.
|
void |
symmetry(int axis)
Modifies the arc, by applying a symmetry around the
specified axis.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream. |
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, makeSelection, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, scale, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomableprotected final IlvRect bbox
public IlvArc()
(0,0,100,100)
a 0 degree start angle and a 90 degrees range angle.IlvArc(IlvRect, double, double)public IlvArc(IlvRect rect, double startAngle, double angle)
rect - The rectangle that contains the ellipse defining the arc.startAngle - The start angle of the arc in degrees.angle - The range angle of the arc in degrees.public IlvArc(IlvRect rect, double startAngle, double angle, boolean outlined, boolean filled)
IlvArc.rect - The definition rectangle of the arc.startAngle - The start angle of the arc in degrees.angle - The range angle of the arc in degrees.outlined - true if the arc has to be stroked.filled - true if the arc has to be filled.setStrokeOn(boolean),
setFillOn(boolean)public IlvArc(IlvArc source)
source - The source arc.public IlvArc(IlvInputStream stream) throws IlvReadFileException
IlvInputStream.stream - The input stream.IlvReadFileException - if the format is not correct.IlvReadFileExceptionpublic IlvGraphic copy()
copy in class IlvGraphicIlvGraphicpublic final IlvRect getDefinitionRect()
getDefinitionRect in interface IlvDefinitionRectInterfacepublic void setDefinitionRect(IlvRect rect)
setDefinitionRect in interface IlvDefinitionRectInterfacerect - The new definition rectangle.public IlvTransformer getDefinitionTransformer()
getTransformer().getDefinitionTransformer in interface IlvDefinitionRectInterfacenullIlvDefinitionRectInterfacepublic final double getStartAngle()
setStartAngle(double)public final void setStartAngle(double start_angle)
start_angle - The new angle in degrees.getStartAngle()public final double getDeltaAngle()
setDeltaAngle(double)public final void setDeltaAngle(double delta_angle)
delta_angle - The new angle in degrees.getDeltaAngle()public double getAnnulusThickness()
setAnnulusThickness(double)public void setAnnulusThickness(double annulus)
annulus - The thickness of the annulus.getDefinitionRect()public final boolean isTransformerMode()
true, if the arc is in transformer mode.setTransformerMode(boolean)public final void setTransformerMode(boolean enabled)
enabled - Enables the transformer mode or not.isTransformerMode()public final void setTransformer(IlvTransformer t)
null. If you
specify a null parameter, the internal transformer will be set to
null too. This resets the transformation of this arc.
If the arc object has an internal transformer, that is, the transformer you specify
here is not null, when you call the applyTransform(IlvTransformer)
method, the specified transformation will apply to the internal transformer.
t - The new transformer.getTransformer(),
applyTransform(IlvTransformer)public final IlvTransformer getTransformer()
null if there is no internal transformer.setTransformer(IlvTransformer)public void draw(Graphics dst, IlvTransformer t)
draw in class IlvGraphicdst - The destination Graphics.t - The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer),
IlvGraphic.boundingBox(IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains in class IlvGraphicp - The point to be tested.tp - The point p transformed by the transformer t.t - The transformation that was applied to the object when it
was drawn.true if the point lies inside this graphic object.IlvGraphicpublic IlvPoint getIntersectionWithOutline(IlvPoint innerPoint, IlvPoint outerPoint, IlvTransformer t)
innerPoint is not inside the graphic object,
or if outerPoint is not outside the graphic object, it
must return a valid point. For instance, if there is no intersection,
it can return the start point.getIntersectionWithOutline in class IlvGraphicinnerPoint - A point usually inside the graphic object, given in
manager view coordinates.outerPoint - A point usually outside of the graphic object, given in
manager view coordinates.t - The transformation used to draw the object.IlvClippingLinkConnectorpublic IlvRect boundingBox(IlvTransformer t)
boundingBox in class IlvGraphict - The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic IlvPoint getCenter(IlvTransformer t)
getCenter in class IlvGraphict - The transformer used to draw the object. The value
null can be used for the identity transformer.IlvGraphicpublic void applyTransform(IlvTransformer t)
applyTransform in class IlvGraphict - The transformer to be applied.setTransformer(IlvTransformer),
getTransformer(),
setTransformerMode(boolean),
isTransformerMode()public void rotate(IlvPoint center, double angle)
center, by an angle in degrees specified by
angle.
If the arc is in transformer mode, this method calls the
applyTransform(IlvTransformer) method to perform the rotation.
rotate in class IlvGraphiccenter - The center of the rotation.angle - The rotation angle in degrees.IlvGraphic,
IlvGraphic.applyTransform(IlvTransformer)public void symmetry(int axis)
axis - The axis for the symmetry can be one of
IlvConstants.HORIZONTAL_CENTER,
IlvConstants.CENTER,
or IlvConstants.VERTICAL_CENTER.public void setForeground(Color color)
IlvBlinkingColor.setForeground in class IlvGraphiccolor - The new foreground color.getForeground()public Color getForeground()
setForeground(java.awt.Color)public void setBackground(Color color)
IlvArc. It is the color
used to fill the arc.
This property supports
IlvBlinkingColor.setBackground in class IlvGraphiccolor - The new background color.getBackground()public Color getBackground()
IlvArc. It is the color
used to fill the arc.public boolean isFillOn()
true if the inside of the
arc will be filled.setFillOn(boolean),
setFillOn(boolean)public void setFillOn(boolean set)
true, specifies that the inside of the
arc will be filled.setFillOn in class IlvGraphicset - Set to true to enable the fill style for this
graphic object.isFillOn(),
setFillOn(boolean)public boolean isStrokeOn()
true if the shape of the
arc is stroked.setStrokeOn(boolean),
setFillOn(boolean)public void setStrokeOn(boolean set)
true, specifies that the shape of the
arc is stroked.setStrokeOn in class IlvGraphicset - Set to true to enable the stroke in your
customized graphic object.isStrokeOn(),
setFillOn(boolean)public void write(IlvOutputStream stream) throws IOException
IlvOutputStream.
Note that even if this is a public method, you should not
call it directly. You should use the write
methods of the manager.write in interface IlvPersistentObjectwrite in class IlvGraphicstream - The output stream.IOException - thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.