Interface PrimitiveManagerRubberBandInterface

The PrimitiveManagerRubberBandInterface is used to display a unique orange rectangle on top of the DMU.

It is mainly used to select a rectangular area.

The PrimitiveManagerPointInterface is accessed through the PrimitiveManagerInterface.getRubberBandManager function (the PrimitiveManagerInterface is accessed through InfiniteEngineInterface.getPrimitiveManager).

The rectangle is defined with the Rectangle class (with two 3D points).

The color of the rectangle of the PrimitiveManagerRubberBandInterface cannot be changed.

rectangle display

Displaying a Rectangle may be done with the following :

/** 
* Sample to explain how to create a 2D rectangle on top of the rendering (PrimitiveManagerRubberBandInterface).
*/
import { InfiniteEngineInterface, PrimitiveManagerRubberBandInterface, Vector2, Rectangle } from 'generated_files/documentation/appinfiniteapi';

// created previously
let lInfiniteEngine : InfiniteEngineInterface;
const lSelectionRectangle : Rectangle = new Rectangle();

// created previously, the rectangle extents
let lRectanglePosition1 : Vector2;
let lRectanglePosition2 : Vector2;

// the rubber band manager
const lRubberBandManager : PrimitiveManagerRubberBandInterface = lInfiniteEngine.getPrimitiveManager().getRubberBandManager();

// compute rectangle geometry from the 2 extent points
lSelectionRectangle.x = Math.min(lRectanglePosition1.x, lRectanglePosition2.x);
lSelectionRectangle.y = Math.min(lRectanglePosition1.y, lRectanglePosition2.y);
lSelectionRectangle.width = Math.abs(lRectanglePosition1.x - lRectanglePosition2.x);
lSelectionRectangle.height = Math.abs(lRectanglePosition1.y - lRectanglePosition2.y);

// make sure rectangle is correct
console.assert(lSelectionRectangle.isValid() && (!lSelectionRectangle.isEmpty()));

// set rectangle and display it
lRubberBandManager.setRubberBandRectangle(lSelectionRectangle);
lRubberBandManager.setRubberBandVisible(true);

You may create also boxes, lines, etc with PrimitiveManagerBoxInterface, PrimitiveManagerLineInterface, etc.
3D Primitives

interface PrimitiveManagerRubberBandInterface {
    setRubberBandRectangle(pRectangle): boolean;
    setRubberBandVisible(pVisible): void;
}

Methods

  • Sets the rubber band geometry.

    This function does not change the previous rubber band visibility. If the Rectangle intersects the bounds of the view, nothing is done, the previous Rectangle is kept.

    Parameters

    • pRectangle: Rectangle
      in
      The new rubber band rectangle geometry.

    Returns boolean

    true if the Rectangle was set.

  • Sets the rubber band visibility.

    This function does not change the previous rubber band geometry.

    WARNING : the rubber band will only be visible if pVisible is true and the Rectangle set by setRubberBandRectangle is valid and non empty.

    Parameters

    • pVisible: boolean
      in
      The new visibility of the rubber band.

    Returns void