ilog.views
Interface IlvManagerView.FitAreaCalculator

Enclosing class:
IlvManagerView

public static interface IlvManagerView.FitAreaCalculator

This interface can be used to fit the transformer of the manager view so that a certain area of the manager is visible in the view. It is passed to the method IlvManagerView.fitTransformerToArea(Insets, FitAreaCalculator, int).

The following example shows how to make all selected objects visible in the view by using this interface:

 IlvManagerView.FitAreaCalculator fcalc =
   new IlvManagerView.FitAreaCalculator() {
      public IlvRect getAreaToFit(IlvManagerView view) {
        IlvGraphicEnumeration e = view.getManager().getSelectedObjects(true);
        IlvRect rect = null;
        while (e.hasMoreElements()) {
          IlvGraphic g = e.nextElement();
          IlvManager m = (IlvManager)g.getGraphicBag();
          IlvRect bbox = g.boundingBox(m.getDrawingTransformer(view));
          if (rect == null)
            rect = bbox;
          else
            rect.add(bbox);
        }

        if (rect == null)
          // nothing selected, fallback: fit to all
          return view.computeBBox();
        else
          return rect;
      }
   };
 managerView.fitTransformerToArea(null, fcalc, 10);
 

Since:
JViews 8.0

Method Summary
 IlvRect getAreaToFit(IlvManagerView view)
          Returns the rectangle in view coordinates that should be made visible in the view when calling IlvManagerView.fitTransformerToArea(Insets, FitAreaCalculator, int).
 

Method Detail

getAreaToFit

IlvRect getAreaToFit(IlvManagerView view)
Returns the rectangle in view coordinates that should be made visible in the view when calling IlvManagerView.fitTransformerToArea(Insets, FitAreaCalculator, int).



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