Interface CutPlaneManipulatorInterface

The CutPlaneManipulatorInterface interface is used to manipulate cut planes.

This is a GUI element that allows an end-user to modify the orientation/position of a cut plane.

The usage is very simple :

  • Instantiate/recycle a CutPlaneManipulatorInterface.
  • Bind the CutPlaneManipulatorInterface to cut plane(s).
  • Show the CutPlaneManipulatorInterface.
  • The user changes the cut plane through the interactions with the GUI element.
Cut planes with and without a group

Depending on the number of cut planes set by setCutPlaneId, the rendering of the cut plane manipulator may be :
  • A plane (1).
  • Two parallel planes (2 with colinear normals).
  • Two intersecting planes (2 with non colinear normals).
  • A cube (6 planes).

The CutPlaneManipulatorInterface may also be set to snap rotation values to a multiple of a given value (in radian) with setSnapRotationValue.

/** 
* Sample to illustrate the creation of a cut plane, manipulated with a CutPlaneManipulatorInterface.
*/
import { InfiniteEngineInterface, CutPlaneManagerInterface, Vector3, CutPlaneManipulatorInterface } from 'generated_files/documentation/appinfiniteapi';

// lEngine has been created previously
let lEngine : InfiniteEngineInterface;

// we want to hide items that are above (and not under), thus the normal is in the positive side.
const lNormal : Vector3 = new Vector3(0, 0, 1);
// any point with z = 10 is ok
const lPoint : Vector3 = new Vector3(Math.random(), Math.random(), 10);
// get the cut plane manager
const lCutPlaneManager : CutPlaneManagerInterface = lEngine.getCutPlaneManager();
const lCutPlaneId = lCutPlaneManager.createCutPlane(lPoint, lNormal);
console.assert(lCutPlaneId !== 0);
// do what you want, the cut plane is working as it is enabled upon creation
// and create a cut plane manipulator to allow the end user to change the cut plane geometry.
const lCutPlaneManipulator : CutPlaneManipulatorInterface = lCutPlaneManager.createCutPlaneManipulator();
// bind the manipulator to the newly created cut plane
lCutPlaneManipulator.setCutPlaneId(lCutPlaneId);
// hide it for the moment, we may need it later
lCutPlaneManipulator.setVisible(false);

The user may know when the bound cut plane is modified through the CutPlaneManagerInterfaceSignal from the CutPlaneManagerInterface. She is also notified when a user interaction is started / finished with CutPlaneManipulatorInterfaceSignal signals.
3D Rendering

interface CutPlaneManipulatorInterface {
    addEventListener(pType, pListener, pObject): string;
    addEventListener(pType, pListener): string;
    areSignalsBlocked(): boolean;
    blockSignals(pBlock): void;
    dispose(): void;
    getCutPlaneHandler(): HTMLElement;
    getCutPlaneIds(pCutPlaneIds): boolean;
    getInfiniteObjectType(): InfiniteObjectType;
    getSelectedCutPlane(): number;
    getSnapRotationValue(): number;
    hasEventListener(pType, pListener): boolean;
    hasEventListenerById(pId): boolean;
    isDisposed(): boolean;
    isVisible(): boolean;
    removeAllEventListeners(): boolean;
    removeEventListener(pType, pListener, pObject): boolean;
    removeEventListener(pType, pListener): boolean;
    removeEventListenerById(pId): boolean;
    setCutPlaneId(pCutPlaneId): boolean;
    setSnapRotationValue(pSnapValue): boolean;
    setVisible(pVisible): boolean;
}

Hierarchy (view full)

Methods

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal. It is possible to add an object that will be included in the callback to avoid creating too many closures. Calling twice addEventListener with the same parameters results in the second call to be ignored, only unique pairs callback / object are allowed, in order to avoid calling multiple times the same thing.

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.
    • pObject: Object
      in
      The optional object the callback will be called with when the given event fires.

    Returns string

    The id of the inserted callback (actually an UUID).

  • Adds a listener to an event type.

    When an event of the type pType fires, the callback pListener will be called. This function returns a unique string id that may be used in removeEventListenerById to allow simple listener removal.

    Parameters

    • pType: string
      in
      The type of the event pListener will be called upon.
    • pListener: tListenerCallback
      in
      The listener function that fires when the given event type occurs.

    Returns string

    The id of the inserted callback (actually an UUID).

  • Tells if signals sent by the object are blocked or not.

    If signals are blocked, no signal will be emitted nor buffered, such signal will be lost.

    Returns boolean

    true if signals are blocked.

  • Blocks / Unblocks all signals sent by the object.

    If signals are blocked, no signal will be emitted nor buffered, such signal will be lost.

    Parameters

    • pBlock: boolean
      in
      If set to true, all further signals will be silently discarded.

    Returns void

  • Gets the Cut plane manipulator handler.

    Returns HTMLElement

    The HTMLelement representing the cut plane manipulator.

  • Gets the manipulated cut plane ids.

    Parameters

    • pCutPlaneIds: number[]
      out
      The resulting cut plane ids.

    Returns boolean

    true if the call succeeded.

  • Gets the current cut plane id that is manipulated or hovered on.

    Selected cut plane

    The current selected cut plane is drawn with thicker lines. A cut plane is considered selected if the mouse is over the given plane, or if the given plane is being manipulated.

    Returns number

    0 if no cut plane is currently selected, or the selected cut plane id.

  • Gets the CutPlaneManipulatorInterface snapped rotation angle.

    This calls returns a number if the rotation is constrained to be a multiple of the given value or undefined if no constraint is set.

    Returns number

    The current snapped value in radian if the constraint is set, or undefined if no constraint.

  • Tells if the EventDispatcher has such a callback registered for the given event type.

    Parameters

    • pType: string
      in
      The type of the event to test.
    • pListener: tListenerCallback
      in
      The listener function that gets tested.

    Returns boolean

    true if such a listener is installed for the given type of event.

  • Tells if the EventDispatcher has such a callback registered for the given callback id.

    Parameters

    • pId: string
      in
      The id of the callback to test.

    Returns boolean

    true if such a listener is installed for the given callback id.

  • Gets the visibility state of the manipulator.

    Returns boolean

    true if the manipulator is visible.

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    • pObject: Object

      The listener object that was used when addEventListener was called.

    Returns boolean

    true if the callback was removed else false.

  • Removes a listener from an event type.

    If no such listener is found, then the function returns false and does nothing. You must use the exact parameters that were used in addEventListener to actually remove the listener.

    Parameters

    • pType: string
      in
      The type of the listener that gets removed.
    • pListener: tListenerCallback

      The listener function that gets removed.

    Returns boolean

    true if the callback was removed else false.

  • Removes a listener by its id.

    If no such listener is found, then the function returns false and does nothing. You must use the return value of addEventListener to actually remove the listener.

    Parameters

    • pId: string
      in
      The id returned by the call to addEventListener that you want to remove.

    Returns boolean

    true if the callback was removed else false.

  • Sets the cut plane id to manipulate.

    Setting the id 0 is valid, it effectively unbinds the cut plane manipulator from a cut plane.

    Setting an invalid id to the cut plane manipulator does nothing.

    Setting the same id has no effect.

    Returns true if the cut plane id exists or if 0 is set.

    Parameters

    • pCutPlaneId: number | number[]
      in
      The id of the cut plane to manipulate.

    Returns boolean

    true if the cut plane corresponding to the id is valid or 0.

  • Sets the CutPlaneManipulatorInterface to set a rotation angle to be a multiple of a given value.

    Setting a number will set the actual multiple value, setting undefined removes the constraint. Setting a negative or zero value is not allowed.

    Returns true if the call succeeded.

    Parameters

    • pSnapValue: number

      The snap value to set in radian, or undefined if no value should be set.

    Returns boolean

    trueif the call succeeded.

  • Sets the manipulator visibility.

    Parameters

    • pVisible: boolean
      in
      Shows the manipulator if true else hide it.

    Returns boolean

    true if the the cut plane manipulator has changed his visibility.