ilog.views.graphic
Class IlvFullZoomingGraphic

java.lang.Object
  extended by ilog.views.IlvGraphic
      extended by ilog.views.graphic.IlvGraphicHandle
          extended by ilog.views.graphic.IlvGraphicHandleBag
              extended by ilog.views.graphic.IlvFullZoomingGraphic
All Implemented Interfaces:
GraphicBagHierarchyEventReceiver, ManagerViewsHierarchyEventReceiver, IlvGraphicBag, IlvPersistentObject, Transferable, Serializable

public class IlvFullZoomingGraphic
extends IlvGraphicHandleBag

The class IlvFullZoomingGraphic is a wrapper class that is used to make a nonzoomable graphic object fully zoomable. This can be considered as the inverse effect of IlvFixedSizeGraphic.

The IlvFixedSizeGraphic wraps an object so that the size of the object does not follow the zoom level but remains constant. The IlvFullZoomingGraphic wraps an object whose size does not follow the zoom level so that now the size follows the zoom level. Of course, it makes sense to wrap only nonzooming objects such as IlvMarker, IlvLabel, IlvCircularScale, or IlvRectangularScale into IlvFullZoomingGraphic.

Note that you should not wrap a graphic object into several instances of IlvGraphicHandle or its subclasses (IlvFullZoomingGraphic, IlvHalfZoomingGraphic, IlvFixedSizeGraphic).

An additional feature is the alpha transparency support. If the alpha value is set below 1, the wrapped object is drawn in a transparent way even if the colors of the wrapped object are not set to transparent colors. This is useful if you want to add transparency to the entire wrapped object without changing all individual foreground, background and stroke colors of the wrapped object.

Limitations:

Since:
JViews 8.0
See Also:
Serialized Form

Field Summary
static IlvObjectInteractor DELEGATE_INTERACTOR
          The delegate interactor for IlvFullZoomingGraphic objects.
 
Constructor Summary
IlvFullZoomingGraphic(IlvFullZoomingGraphic source)
          Creates a new IlvFullZoomingGraphic by copying an existing one.
IlvFullZoomingGraphic(IlvGraphic object)
          Creates a new full-zooming object.
IlvFullZoomingGraphic(IlvGraphic object, double zoomFactor)
          Creates a new full-zooming object.
IlvFullZoomingGraphic(IlvInputStream stream)
          Reads the object from an IlvInputStream.
 
Method Summary
 void applyTransform(IlvTransformer t)
          Applies a transformation to 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.
 float getAlpha()
          Returns the alpha value of this object.
 IlvPoint getCenter(IlvTransformer t)
          Returns the center point of the graphic object.
 double getInitialZoom()
          Returns the initial zoom level.
 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.
 JPopupMenu getPopupMenu(IlvPoint p, IlvTransformer t, IlvManagerView view, IlvPopupMenuManager popupManager)
          Returns the Swing popup menu to display when the popup is triggered while the mouse pointer is at a specified location inside the graphic object.
 String getToolTipText(IlvPoint p, IlvTransformer t)
          Returns the tooltip text to display when the mouse pointer is at a specified location inside the graphic object.
 IlvTransformer getTransformer()
          Returns the internal transformer that allows you to make the wrapped object fully zoomable.
 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.
 boolean isAlphaBufferEnabled()
          Returns true if an additional buffer is used to draw the object when the alpha composition value is not 1.0.
 boolean isDelegateObjectInteractor(IlvObjectInteractor inter)
          Tests whether the input object interactor is the delegate interactor suitable for this class.
 IlvSelection makeSelection()
          Creates the selection object for this class.
protected  void notifyObjectInteractorToManager(IlvObjectInteractor interactor)
          Notifies the manager that the object interactor has changed.
 void setAlpha(float alpha)
          Changes the alpha value of this object.
 void setAlphaBufferEnabled(boolean enable)
          Sets whether an additional buffer is used to draw the object when the alpha composition value is not 1.0.
 void setGraphicBag(IlvGraphicBag bag)
          Changes the bag that contains the object.
 void setInitialZoom(double initialZoom)
          Sets the initial zoom level.
 void setTransformer(IlvTransformer t)
          Sets the internal transformer that allows you to make the wrapped object fully zoomable.
 void write(IlvOutputStream stream)
          Writes the object to an IlvOutputStream.
 boolean zoomable()
          Returns true if the object is zoomable.
 
Methods inherited from class ilog.views.graphic.IlvGraphicHandleBag
addGraphicBagHierarchyListener, addManagerViewsHierarchyListener, addObject, applyToObject, enableGraphicBagHierarchyEventForwarding, enableManagerViewsHierarchyEventForwarding, fireGraphicBagHierarchyEvent, fireManagerViewsHierarchyEvent, getObject, getObjects, isOwner, moveObject, needsGraphicBagHierarchyEvent, needsManagerViewsHierarchyEvent, reDrawObj, reDrawRegion, removeGraphicBagHierarchyListener, removeManagerViewsHierarchyListener, removeObject, reshapeObject, setDelegateMoveResize, setObject, setObjectName
 
Methods inherited from class ilog.views.graphic.IlvGraphicHandle
getObject, getOriginalPopupMenu, isPersistent, move, move, moveResize, resize, rotate, scale, setBackground, setForeground, setOwner, translate
 
Methods inherited from class ilog.views.IlvGraphic
addActionListener, addNamedPropertyListener, boundingBox, getAndAssociateObjectInteractor, getDefaultInteractor, getGraphicBag, GetGraphicObject, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenuName, getProperty, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, hasProperty, isDataFlavorSupported, isEditable, isInApplyToObject, isMovable, isSelectable, isVisible, processActionEvent, reDraw, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, setEditable, setFillOn, 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
 
Methods inherited from interface ilog.views.IlvGraphicBag
getGraphicBag
 

Field Detail

DELEGATE_INTERACTOR

public static final IlvObjectInteractor DELEGATE_INTERACTOR
The delegate interactor for IlvFullZoomingGraphic objects. Use this interactor as object interactor of the full-zooming object if the wrapped object has an object interactor. The delegate interactor forwards all events to the object interactor of the wrapped object.

The delegate interactor is always installed by default when an instance of IlvFullZoomingGraphic is allocated. You can call IlvGraphic.setObjectInteractor(ilog.views.IlvObjectInteractor) to install a different object interactor (use a null argument to avoid the delegation to the object interactor of the child).

Since:
JViews 8.1
See Also:
IlvGraphic.setObjectInteractor(ilog.views.IlvObjectInteractor)
Constructor Detail

IlvFullZoomingGraphic

public IlvFullZoomingGraphic(IlvGraphic object)
Creates a new full-zooming object.

Parameters:
object - The referenced object.

IlvFullZoomingGraphic

public IlvFullZoomingGraphic(IlvGraphic object,
                             double zoomFactor)
Creates a new full-zooming object. At zoom factor 1, the full zooming object displays the wrapped object as if the wrapped object is at the specified zoom factor.

Parameters:
object - The referenced object.
zoomFactor - The initial zoom factor applied to the wrapped object.

IlvFullZoomingGraphic

public IlvFullZoomingGraphic(IlvFullZoomingGraphic source)
Creates a new IlvFullZoomingGraphic by copying an existing one.

Parameters:
source - The source object to copy.

IlvFullZoomingGraphic

public IlvFullZoomingGraphic(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. This method copies the object by calling the copy constructor.

Overrides:
copy in class IlvGraphicHandleBag
Returns:
A copy of the object.
See Also:
IlvGraphicHandleBag.isOwner()

zoomable

public boolean zoomable()
Returns true if the object is zoomable. In this case (full-zooming graphic) it returns true.

Overrides:
zoomable in class IlvGraphicHandle
See Also:
IlvGraphic, IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer), IlvGraphic.boundingBox(IlvTransformer), IlvManager

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.

setGraphicBag

public void setGraphicBag(IlvGraphicBag bag)
Changes the bag that contains the object. For example, this method is used when the object is added to, or removed from, an IlvGraphicBag such as an IlvManager. You should not call this method directly unless you are creating a new type of bag.

Overrides:
setGraphicBag in class IlvGraphicHandleBag
Parameters:
bag - The graphic bag.
Since:
JViews 8.1
See Also:
IlvGraphic

getInitialZoom

public double getInitialZoom()
Returns the initial zoom level.

See Also:
setInitialZoom(double)

setInitialZoom

public void setInitialZoom(double initialZoom)
Sets the initial zoom level. This is the zoom level applied to the wrapped object if the full-zooming graphic is drawn at zoom factor 1. The zoom factor of the view's transformer will be multiplied by this initial zoom level for all transformer calculations.

Parameters:
initialZoom - Specifies the initial zoom level. It cannot be 0.
See Also:
getInitialZoom()

setAlpha

public void setAlpha(float alpha)
Changes the alpha value of this object. The alpha composition value is used to render the wrapped object in a transparent way. The value must be in the range of [0.0, 1.0], the value of 1 means that the object is not transparent.

Parameters:
alpha - The new transparency level in the range [0.0, 1.0].
See Also:
getAlpha()

getAlpha

public float getAlpha()
Returns the alpha value of this object. The alpha composition value is used to render the wrapped object in a transparent way. The value is in the range of [0.0, 1.0], the value of 1 means that the object is not transparent.

See Also:
setAlpha(float)

setAlphaBufferEnabled

public void setAlphaBufferEnabled(boolean enable)
Sets whether an additional buffer is used to draw the object when the alpha composition value is not 1.0. This option has no effect if the alpha value is 1.0. If the alpha buffer is enabled, the drawing routine first draws into the alpha buffer and then copies the result into the drawing. This results into a transparent display of this object that is visually closer to its nontransparent display. If the alpha buffer is disabled, drawing is slightly faster, but the transparent display may differ from the nontransparent display. The alpha buffer is enabled by default.

Parameters:
enable - Whether the alpha buffer is enabled.
See Also:
getAlpha(), isAlphaBufferEnabled()

isAlphaBufferEnabled

public boolean isAlphaBufferEnabled()
Returns true if an additional buffer is used to draw the object when the alpha composition value is not 1.0.

See Also:
getAlpha(), setAlphaBufferEnabled(boolean)

getTransformer

public IlvTransformer getTransformer()
Returns the internal transformer that allows you to make the wrapped object fully zoomable.


setTransformer

public void setTransformer(IlvTransformer t)
Sets the internal transformer that allows you to make the wrapped object fully zoomable. The effect of setting the transformer to null is like changing the position and size of the object to its original position and size.


isDelegateObjectInteractor

public boolean isDelegateObjectInteractor(IlvObjectInteractor inter)
Tests whether the input object interactor is the delegate interactor suitable for this class.

Overrides:
isDelegateObjectInteractor in class IlvGraphicHandleBag
Since:
JViews 8.1

notifyObjectInteractorToManager

protected void notifyObjectInteractorToManager(IlvObjectInteractor interactor)
Notifies the manager that the object interactor has changed.

Overrides:
notifyObjectInteractorToManager in class IlvGraphicHandleBag
Since:
JViews 8.1
Internal method or field: do not use!

draw

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

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.

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

getCenter

public IlvPoint getCenter(IlvTransformer t)
Returns the center point of the graphic object.

Overrides:
getCenter in class IlvGraphic
Parameters:
t - The transformer used to draw the object. The value null can be used for the identity transformer.
Returns:
The center point of this graphic object. This point can be used as the center point to rotate the object.
Since:
JViews 8.0
See Also:
IlvGraphic

applyTransform

public void applyTransform(IlvTransformer t)
Applies a transformation to the 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. Calls contains on the referenced 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 that was 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. Calls intersects on the referenced 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 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

getToolTipText

public String getToolTipText(IlvPoint p,
                             IlvTransformer t)
Returns the tooltip text to display when the mouse pointer is at a specified location inside the graphic object. It tries to retrieve the tooltip text on the referenced object. If this fails, it tries to retrieve the tooltip text on this object.

Note that you must enable the tooltip mechanism for the manager view by calling the static method IlvToolTipManager.registerView(ilog.views.IlvManagerView).

Overrides:
getToolTipText in class IlvGraphicHandle
Parameters:
p - The location of the mouse (in view coordinates).
t - The transformer that converts the coordinate system of this object (the manager coordinates) into the coordinate system of the manager view in which the tooltip is about to be displayed (the view coordinates).
Returns:
The tool tip at point p for transformation t, or null if no tool tip should be displayed.
See Also:
IlvGraphic, IlvGraphic.getToolTipText(), IlvGraphic.setToolTipText(String)

getPopupMenu

public JPopupMenu getPopupMenu(IlvPoint p,
                               IlvTransformer t,
                               IlvManagerView view,
                               IlvPopupMenuManager popupManager)
Returns the Swing popup menu to display when the popup is triggered while the mouse pointer is at a specified location inside the graphic object. It tries to retrieve the popup menu on the referenced object. If this fails, it tries to retrieve the popup menu on this object.

Note that you must enable the popup menu mechanism for the manager view by calling the static method IlvPopupMenuManager.registerView(ilog.views.IlvManagerView).

Overrides:
getPopupMenu in class IlvGraphicHandle
Parameters:
p - The location of the mouse (in view coordinates).
t - The transformer that converts the coordinate system of this object (the manager coordinates) into the coordinate system of the manager view in which the tooltip is about to be displayed (the view coordinates).
view - The manager view that triggered the popup menu.
popupManager - The popup menu manager.
Returns:
The Swing popup menu, which can be null.
See Also:
IlvGraphic, IlvPopupMenuManager.registerView(ilog.views.IlvManagerView), IlvGraphic.getPopupMenu()

makeSelection

public IlvSelection makeSelection()
Creates the selection object for this class. The default implementation creates an instance of IlvSplineSelection.

Overrides:
makeSelection in class IlvGraphic
See Also:
IlvSplineSelection


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