ilog.views.graphic
Class IlvEllipse

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvEllipse
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable
Direct Known Subclasses:
IlvFilledEllipse

public class IlvEllipse
extends IlvGraphic

IlvEllipse represents an ellipse shape.

The default values for an IlvEllipse instance are as follows:

Example

The following code example shows how to use IlvEllipse in a simple Java application:

  IlvManager manager = new IlvManager();
  // Create a customized circle.
  float size = 30;
  IlvEllipse circle = new IlvEllipse(new IlvPoint(40,40), size);
  circle.setFillOn(true);
  circle.setBackground(Color.green);
  circle.setForeground(Color.red);
  // Create an ellipse with the default settings.
  IlvEllipse defEllipse = new IlvEllipse(new IlvRect(60,80,50,20));
  
  // Add the graphic objects to the manager.
  manager.addObject(circle,true);
  manager.addObject(defEllipse,true);
 

The following image shows the graphic objects created in the code example:

IlvEllipse

About Graphic Objects

IlvEllipse is a custom graphic object, that is, a subclass of IlvGraphic. Graphic objects are controlled using an instance of IlvManager or one of its subclasses, and displayed using one or more IlvManagerView instances in a Java Swing application. For information about generic features for graphic objects, see IlvGraphic.

See Also:
IlvManager, IlvManagerView, IlvRect, Serialized Form

Field Summary
protected  IlvRect drawrect
          The definition rectangle of the ellipse.
 
Constructor Summary
IlvEllipse()
          Creates a new ellipse with a (0, 0, 100, 100) definition rect.
IlvEllipse(IlvEllipse source)
          Creates an ellipse by copying an existing one.
IlvEllipse(IlvInputStream stream)
          Reads the object from an IlvInputStream
IlvEllipse(IlvPoint center, float radius)
          Creates a new circle.
IlvEllipse(IlvPoint center, int radius)
          Deprecated. Beginning with ILOG JViews 8.0, use the constructor IlvEllipse(IlvPoint, float) instead.
IlvEllipse(IlvRect rect)
          Creates a new ellipse.
IlvEllipse(IlvRect rect, boolean outlined, boolean filled)
          Creates a new IlvEllipse.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to the shape of the object.
 IlvRect boundingBox(IlvTransformer t)
          Returns the bounding rectangle of the ellipse.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests if a point lies within the outline of the object.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 Color getBackground()
          Returns the background color of the IlvEllipse.
 IlvRect getDefinitionRect()
          Returns the rectangle that provides the bounds of the ellipse.
 Color getForeground()
          Returns the foreground color of the ellipse.
 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.
 boolean isFillOn()
          Returns true if the inside of the ellipse will be filled.
 boolean isStrokeOn()
          Returns true if the shape of the ellipse is stroked.
 void setBackground(Color color)
          Changes the background color of the IlvEllipse.
 void setFillOn(boolean set)
          If true, specifies that the inside of the ellipse will be filled.
 void setForeground(Color color)
          Changes the foreground color of the ellipse.
 void setStrokeOn(boolean set)
          When set to true, specifies that the shape of the ellipse is stroked.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, inside, intersects, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isPersistent, isSelectable, isVisible, makeSelection, move, move, moveResize, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipText, setVisible, toString, translate, zoomable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

drawrect

protected final IlvRect drawrect
The definition rectangle of the ellipse.

Constructor Detail

IlvEllipse

public IlvEllipse()
Creates a new ellipse with a (0, 0, 100, 100) definition rect.

Since:
JViews 6.0
See Also:
IlvEllipse(IlvEllipse)

IlvEllipse

public IlvEllipse(IlvRect rect)
Creates a new ellipse.

Parameters:
rect - The bounding rectangle of the ellipse.

IlvEllipse

public IlvEllipse(IlvPoint center,
                  int radius)
Deprecated. Beginning with ILOG JViews 8.0, use the constructor IlvEllipse(IlvPoint, float) instead.

Creates a new circle.

Parameters:
center - The center of the circle.
radius - The radius of the circle.

IlvEllipse

public IlvEllipse(IlvPoint center,
                  float radius)
Creates a new circle.

Parameters:
center - The center of the circle.
radius - The radius of the circle.
Since:
JViews 8.0

IlvEllipse

public IlvEllipse(IlvRect rect,
                  boolean outlined,
                  boolean filled)
Creates a new IlvEllipse.

Parameters:
rect - The definition rectangle of the ellipse.
outlined - true if the ellipse has to be stroked.
filled - true if the ellipse has to be filled.
Since:
JViews 5.5
See Also:
setStrokeOn(boolean), setFillOn(boolean)

IlvEllipse

public IlvEllipse(IlvEllipse source)
Creates an ellipse by copying an existing one.

Parameters:
source - The source ellipse.

IlvEllipse

public IlvEllipse(IlvInputStream stream)
           throws IlvReadFileException
Reads the object from an IlvInputStream

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - if the format is not correct.
IlvReadFileException
Method Detail

copy

public IlvGraphic copy()
Copies the object. This method copies the object by calling the copy constructor.

Specified by:
copy in class IlvGraphic
Returns:
A copy of the object.
See Also:
IlvGraphic

getDefinitionRect

public final IlvRect getDefinitionRect()
Returns the rectangle that provides the bounds of the ellipse.


draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object.

Specified by:
draw in class IlvGraphic
Parameters:
dst - The destination Graphics.
t - The transformation used to draw the object.
See Also:
IlvGraphic.boundingBox(ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

contains

public boolean contains(IlvPoint p,
                        IlvPoint tp,
                        IlvTransformer t)
Tests if a point lies within the outline of the object.

Overrides:
contains in class IlvGraphic
Parameters:
p - 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.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvGraphic

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the ellipse.

Specified by:
boundingBox in class IlvGraphic
Parameters:
t - The transformer used to draw the object.
See Also:
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.zoomable(), IlvGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.

Specified by:
applyTransform in class IlvGraphic
Parameters:
t - The transformer to be applied.
See Also:
IlvGraphic

getIntersectionWithOutline

public 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. This method is used the clip links against the shape of the node. The implementation of this method must be robust with respect to the input points: Even if 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.

Overrides:
getIntersectionWithOutline in class IlvGraphic
Parameters:
innerPoint - 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.
Since:
JViews 8.1
See Also:
IlvClippingLinkConnector

setForeground

public void setForeground(Color color)
Changes the foreground color of the ellipse. It is the color used to draw the outline of the ellipse.

Overrides:
setForeground in class IlvGraphic
Parameters:
color - The new foreground color.
See Also:
IlvGraphic.draw(Graphics, IlvTransformer), IlvGraphic.setBackground(Color), IlvGraphic.setFillOn(boolean), IlvGraphic.setStrokeOn(boolean), IlvGraphic

getForeground

public Color getForeground()
Returns the foreground color of the ellipse. It is the color used to draw the outline of the ellipse.

Returns:
The foreground color of the object.

setBackground

public void setBackground(Color color)
Changes the background color of the IlvEllipse. It is the color used to fill the ellipse.

Overrides:
setBackground in class IlvGraphic
Parameters:
color - The background new color.
Since:
JViews 5.5
See Also:
IlvGraphic.draw(Graphics, IlvTransformer), IlvGraphic.setForeground(Color), IlvGraphic.setFillOn(boolean), IlvGraphic.setStrokeOn(boolean), IlvGraphic

getBackground

public Color getBackground()
Returns the background color of the IlvEllipse. It is the color used to fill the ellipse.

Returns:
The background color of the object.
Since:
JViews 5.5

isFillOn

public boolean isFillOn()
Returns true if the inside of the ellipse will be filled.

Since:
JViews 5.5
See Also:
setFillOn(boolean)

setFillOn

public void setFillOn(boolean set)
If true, specifies that the inside of the ellipse will be filled.

Overrides:
setFillOn in class IlvGraphic
Parameters:
set - Set to true to enable the fill style for this graphic object.
Since:
JViews 5.5
See Also:
isFillOn()

isStrokeOn

public boolean isStrokeOn()
Returns true if the shape of the ellipse is stroked.

Since:
JViews 5.5
See Also:
setStrokeOn(boolean)

setStrokeOn

public void setStrokeOn(boolean set)
When set to true, specifies that the shape of the ellipse is stroked.

Overrides:
setStrokeOn in class IlvGraphic
Parameters:
set - Set to true to enable the stroke in your customized graphic object.
Since:
JViews 5.5
See Also:
isStrokeOn()

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an 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.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvGraphic
Parameters:
stream - The output stream.
Throws:
IOException - thrown when an exception occurs during the write operation for this object.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.