ilog.views.graphic
Class IlvTransformedGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvGraphicHandle
          extended by ilog.views.graphic.IlvTransformedGraphic
All Implemented Interfaces:
IlvPersistentObject, Transferable, Serializable

public class IlvTransformedGraphic
extends IlvGraphicHandle

The class IlvTransformedGraphic derives from the base class IlvGraphicHandle. Objects of this class are handles that reference an object of the class IlvGraphic. An IlvTransformedGraphic is drawn by applying a graphic transformation to the object it references. This object can be used to have the same object represented in different places or with different sizes without copying or transforming the original object.

See Also:
Serialized Form

Constructor Summary
IlvTransformedGraphic(IlvGraphic object, IlvTransformer t, boolean owner)
          Creates a new IlvTransformedGraphic.
IlvTransformedGraphic(IlvInputStream stream)
          Reads the object from an IlvInputStream.
IlvTransformedGraphic(IlvTransformedGraphic source)
          Creates a new IlvTransformedGraphic by copying an existing one.
 
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 object.
 boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
          Tests whether a point lies within the outline of the object.
 IlvGraphic copy()
          Copies the object.
 void draw(Graphics dst, IlvTransformer t)
          Draws the object.
 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.
 IlvTransformer getTransformer()
          Returns the transformation used to draw the referenced the object.
 boolean inside(IlvRect rect, IlvRect trect, IlvTransformer t)
          Tests whether a rectangle contains the object.
 boolean intersects(IlvRect rect, IlvRect trect, IlvTransformer t)
          Tests whether a rectangle overlaps the object.
 void move(float x, float y)
          Moves the object.
 void move(IlvPoint p)
          Moves the object.
 void moveResize(IlvRect size)
          Resizes the object.
 void resize(float neww, float newh)
          Resizes the object.
 void rotate(IlvPoint center, double angle)
          Rotates the object.
 void scale(double scalex, double scaley)
          Resizes the object.
 void setTransformer(IlvTransformer t)
          Changes the transformation used to draw the referenced object.
 void translate(float dx, float dy)
          Translates the object.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 
Methods inherited from class ilog.views.graphic.IlvGraphicHandle
getObject, getOriginalPopupMenu, getPopupMenu, getToolTipText, isOwner, isPersistent, setBackground, setDelegateMoveResize, setForeground, setObject, setOwner, zoomable
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, makeSelection, notifyObjectInteractorToManager, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipText, setVisible, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvTransformedGraphic

public IlvTransformedGraphic(IlvGraphic object,
                             IlvTransformer t,
                             boolean owner)
Creates a new IlvTransformedGraphic.

Parameters:
object - the referenced object.
t - the transformation used to draw the referenced object.
owner - if true, the referenced object will be copied when the instance is copied, otherwise the copy of this instance will reference the same object.

IlvTransformedGraphic

public IlvTransformedGraphic(IlvTransformedGraphic source)
Creates a new IlvTransformedGraphic by copying an existing one. Note that the referenced object will be copied only if the object is owner of the reference.

Parameters:
source - the copied object.

IlvTransformedGraphic

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

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

copy

public IlvGraphic copy()
Copies the object. Note that the referenced object will be copied only if the object is owner of the reference.

Overrides:
copy in class IlvGraphicHandle
Returns:
a copy of the object.
See Also:
IlvGraphicHandle.isOwner()

getTransformer

public IlvTransformer getTransformer()
Returns the transformation used to draw the referenced the object.


setTransformer

public void setTransformer(IlvTransformer t)
Changes the transformation used to draw the referenced object. Note that changing the transformation will change the bounding rectangle of the object.


draw

public void draw(Graphics dst,
                 IlvTransformer t)
Draws the object. Calls draw on the referenced object after composing the transformation of the object with the transformation passed as a parameter.

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

boundingBox

public IlvRect boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object. Calls boundingBox on the referenced object with the composition of the transformation of the object with the transformation passed as a parameter.

Overrides:
boundingBox in class IlvGraphicHandle
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. Simply compose the transformation of the object with the transformation passed as a parameter. Thus applyTransform is NOT called on the referenced object.

Overrides:
applyTransform in class IlvGraphicHandle
Parameters:
t - the transformer to be applied.
See Also:
IlvGraphic

contains

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

Overrides:
contains in class IlvGraphicHandle
Parameters:
p - the point to be tested.
tp - the point p transformed by the transformer t.
t - the transformation applied to the object when it was drawn.
Returns:
true if the point lies inside this graphic object.
See Also:
IlvGraphic

intersects

public boolean intersects(IlvRect rect,
                          IlvRect trect,
                          IlvTransformer t)
Tests whether a rectangle overlaps the object.

Overrides:
intersects in class IlvGraphicHandle
Parameters:
rect - the rectangle to be tested.
trect - the rectangle rect transformed by the transformer t.
t - the transformation that was applied to the object when it was drawn.
Returns:
true if the rectangle overlaps this graphic object.
See Also:
IlvGraphic

inside

public boolean inside(IlvRect rect,
                      IlvRect trect,
                      IlvTransformer t)
Tests whether a rectangle contains the object. Calls inside on the referenced object.

Overrides:
inside in class IlvGraphicHandle
Parameters:
rect - the rectangle to be tested.
trect - the rectangle rect transformed by the transformer t.
t - the transformation that was applied to the object when it was drawn.
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 IlvGraphicHandle
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

move

public void move(float x,
                 float y)
Moves the object. This method calls the applyTransform method.

Overrides:
move in class IlvGraphicHandle
Parameters:
x - The new horizontal position.
y - The new vertical position.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

move

public void move(IlvPoint p)
Moves the object. This method calls the applyTransform method.

Overrides:
move in class IlvGraphicHandle
Parameters:
p - The new position of the top-left corner.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

moveResize

public void moveResize(IlvRect size)
Resizes the object. This method calls the applyTransform method.

Overrides:
moveResize in class IlvGraphicHandle
Parameters:
size - The new bounding rectangle for this object.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

translate

public void translate(float dx,
                      float dy)
Translates the object. This method calls the applyTransform method.

Overrides:
translate in class IlvGraphicHandle
Parameters:
dx - The horizontal translation factor.
dy - The vertical translation factor.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

rotate

public void rotate(IlvPoint center,
                   double angle)
Rotates the object. This method calls the applyTransform method.

Overrides:
rotate in class IlvGraphicHandle
Parameters:
center - The center of the rotation.
angle - The rotation angle in degrees.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

scale

public void scale(double scalex,
                  double scaley)
Resizes the object. This method calls the applyTransform method.

Overrides:
scale in class IlvGraphicHandle
Parameters:
scalex - The horizontal scaling factor.
scaley - The vertical scaling factor.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

resize

public void resize(float neww,
                   float newh)
Resizes the object. This method calls the applyTransform method.

Overrides:
resize in class IlvGraphicHandle
Parameters:
neww - The new horizontal width.
newh - The new horizontal height.
See Also:
IlvGraphic, IlvGraphic.applyTransform(IlvTransformer)

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvGraphicHandle
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.