Use of IlvFixedSizeGraphic or IlvHalfZoomingGraphic to control an object's size when zooming

Article ID: 2212
Last updated: 29 May, 2018
Article ID: 2212
Last updated: 29 May, 2018
Revision: 3
Views: 716
Posted: 02 Mar, 2009
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How to prevent a graphic object from getting bigger or smaller when the view is zoomed in or zoomed out?

Answer

Overriding the zoomable() method so that it returns false is not sufficient, as this method has no influence on the way the graphic object is drawn. It is only a flag that indicates to the IlvManager or IlvGrapher whether the object can be managed in an optimized mode when using a quadtree. If the method returns true, the object can be efficiently retrieved from the internally managed quadtree data structure.

To obtain a graphic object that does not grow or shrink when zooming in or zooming out, you have two options:

  1. Encapsulate it in an ilog.views.graphic.IlvFixedSizeGraphic or ilog.views.graphic.IlvHalfZoomingGraphic. The IlvFixedSizeGraphic is a wrapper class that will keep your IlvGraphic with a constant size, whatever the zoom factor, whereas the IlvHalfZoomingGraphic is a wrapper class used to prevent a graphic object from zooming above or below a given maximum or minimum zoom level.
  2. If you can modify the code of the object's class, override the draw() method in such a way that the desired behavior is obtained.

Note:

The boundingBox(IlvTransformer) method must be coded in a way that is consistent with the draw() method. The graphic object should never be drawn outside the rectangle returned by the boundingBox(IlvTransformer) method, and this for any value of the transformer. If the rectangle returned by boundingBox(t) is outside the rectangle obtained by applying the transformer to the boundingBox in manager coordinates (boundingBox(null)), you should be sure that the zoomable() method of your object returns false.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2212
Last updated: 29 May, 2018
Revision: 3
Views: 716
Posted: 02 Mar, 2009 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category