WanaPlan

API Docs for: 2.7.0
Show:

EditionComponent3D

Extends Controls
Module: Component
Parent Module: Wanaplan

Summary

Component managing the user-guided edition of the 3D scene. Manages all interactions involving modifications of the scene's geometry. Necessary when the scene can be edited by the user.

For instance, in viewer mode, this component is inactive.

This component sends internal events when an object is manipulated, which can be listened to by the widgets for example. To set/remove a callback for one of these events, use the functions on and off of this component (see Controls for the declaration). Here is the list of all events you can set callbacks to, and the type of the argument provided to the callback :

  • deselectObject (no argument)
  • dispose (BABYLON.Mesh)
  • refresh (BABYLON.Mesh)
  • selectObject (BABYLON.Mesh)
  • special (MouseEvent)

Constructor

EditionComponent3D

Syntax

EditionComponent3D

(
  • core
)

Summary

Parameters:

  • core wnp.Core

    Wanaplan Core.

Item Index

Methods

addDraggable

Inherited from Controls:

Syntax

addDraggable

(
  • object
)

Summary

Adds an object to the list of handled objects.

Parameters:

  • object BABYLON.Mesh
    The object.

addHistory

Syntax

addHistory

(
  • target
  • params
  • type
)

Summary

Adds a history action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

  • type String

    Type of the action.

addUnremovableDraggable

Inherited from Controls:

Syntax

addUnremovableDraggable

(
  • object
)
deprecated private

Summary

Adds an object to the list of handled objects, that can't be removed. Do not use this

Parameters:

  • object BABYLON.Mesh
    The object.

addWidget

Syntax

addWidget

(
  • widget
)

Summary

Adds a widget in the object edition component.

Parameters:

  • widget Widget

    The widget to add.

clickSelection

Inherited from Controls:

Syntax

clickSelection

(
  • event
)

Summary

Implements the behaviour "click = selection of top-level object"

Parameters:

  • event MouseEvent
    The JS event

constrains

Inherited from Controls:

Syntax

constrains

(
  • [U]
  • [V]
)

Summary

Sets the constrains for the dragging. 3 cases : * No param is specified, no constraint on the dragging, the object is dragged on a sphere around the camera. * Only the param U is specified, the object is dragged along an axis, carried by the vector U. * Both params are specified, the object is dragged along a plane, directed by U and V.

Parameters:

  • [U] BABYLON.Vector3 optional
    First Vector.
  • [V] BABYLON.Vector3 optional
    Second Vector.

deselect

Inherited from Controls:

Syntax

deselect

()

Summary

Deselects the object, even if no object has been selected.

disableWidget

Syntax

disableWidget

()

Summary

Disables the widgets for an object.

dragLock

Inherited from Controls

Syntax

dragLock

()

Summary

Locks the dragging capabilities.

dragSelection

Inherited from Controls:

Syntax

dragSelection

(
  • event
)

Summary

Implements the behaviour "dragging of top-level object"

Parameters:

  • event MouseEvent
    The JS event

EnableWidget

Syntax

EnableWidget

()

Summary

Enables the widgets for an object.

getDragged

Inherited from Controls:

Syntax

getDragged

() BABYLON.PickingInfo

Summary

Returns the dragged object as a picking information.

Returns:

BABYLON.PickingInfo:
The dragged object, as a picking information.

getLastPosition

Inherited from Controls:

Syntax

getLastPosition

()

Summary

Returns the last position of the dragged object.

getPointerCoordinates

Inherited from Controls:

Syntax

getPointerCoordinates

(
  • event
)

Summary

Gets the correct values for the current pointer. Cross device.

Parameters:

  • event Event
    The JS event

getReferentParent

Inherited from Controls:

Syntax

getReferentParent

() BABYLON.Mesh

Summary

Returns the current referent parent, used to select or drag objects. See Controls wiki for more info.

Returns:

BABYLON.Mesh:
The current referent parent.

getReferentPlane

Inherited from Controls:

Syntax

getReferentPlane

() BABYLON.Plane

Summary

Returns the current referent plane, on which the mouse is projected when dragging.

Returns:

BABYLON.Plane:
The current referent plane.

getRoot

Inherited from Controls:

Syntax

getRoot

() BABYLON.Mesh

Summary

Returns the current root, that is the top-level parent of all handled objects. NB : All objects that are not descendants of the root can't be handled by Controls.

Returns:

BABYLON.Mesh:
The current root.

getSelected

Inherited from Controls:

Syntax

getSelected

() BABYLON.PickingInfo

Summary

Returns the selected object, as picking information.

Returns:

BABYLON.PickingInfo:
The selected object, as picking information.

getSelectedObject

Inherited from Controls

Syntax

getSelectedObject

() BABYLON.Mesh

Summary

Gets the currently selected object.

Returns:

BABYLON.Mesh:

The currently selected object.

historyDelete

Syntax

historyDelete

(
  • target
  • params
  • valueField
)
private

Summary

The function called when undoing/redoing a deletion.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

  • valueField Number

    The value.

historyRefresh

Syntax

historyRefresh

(
  • target
  • params
  • valueField
)
private

Summary

The function called when undoing/redoing a refresh.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

  • valueField Number

    The new refresh value.

isLocked

Syntax

isLocked

(
  • object
)
Boolean

Summary

Returns true if an object or group is locked. A group is locked if one of its children is locked.

Parameters:

  • object BABYLON.Mesh

    The mesh to check

Returns:

Boolean:

true if the object is locked

isSelectableObject

Syntax

isSelectableObject

(
  • object
)
Boolean

Summary

Checks if a mesh is selectable.

Parameters:

  • object BABYLON.Mesh

    The mesh to check.

Returns:

Boolean:

Is a selectable mesh or not.

isSelectableOverture

Syntax

isSelectableOverture

(
  • object
)
Boolean

Summary

Checks if an overture is selectable.

Parameters:

  • object BABYLON.Mesh

    The mesh to check.

Returns:

Boolean:

Is a selectable mesh or not.

isSelectableStairway

Syntax

isSelectableStairway

(
  • object
)
Boolean

Summary

Checks if a stairway is selectable.

Parameters:

  • object BABYLON.Mesh

    The mesh to check.

Returns:

Boolean:

Is a selectable mesh or not.

lock

Syntax

lock

(
  • key
  • [flags]
)

Summary

Disables some behaviors. Registers a key so that the action can only be re-enabled with the same key. Actions to lock must be passed in parameter as their corresponding flag. Supports multi-lock :

A lock the action ------------------------------------------------------------------- A unlock the action. --------------------- B lock the same action ----------------- B unlock the action -----------------------.

<-------------------------------action is locked -------------------------------------------------------->.

--------time--------->.

Parameters:

  • key Object

    Can be anything, is registered as key for the lock, the action will be unlocked only with the same key

  • [flags] Number optional

    Actions to lock among : CAMERALOCK = 1; DRAGLOCK = 2; KEYBOARDLOCK = 4; CAMERATRANSLATIONLOCK = 8; Default is all flags on.

notify

Inherited from Controls:

Syntax

notify

(
  • event
  • data
)

Summary

Calls every callback registered for a specific event.

Parameters:

  • event Event
    The event.
  • data Object
    The data associated to this event.

off

Inherited from Controls:

Syntax

off

(
  • event
  • handler
)
Controls

Summary

Removes a callback from a specific event.

Parameters:

  • event Event
    The event.
  • handler Function
    The callback function.

Returns:

Controls:
this.

on

Inherited from Controls:

Syntax

on

(
  • event
  • handler
  • insertFirst
)
Controls

Summary

Adds a callback to a specific event.

Parameters:

  • event Event
    The event.
  • handler Function
    The callback function.
  • insertFirst Boolean
    If true then insert function in first position of listeners.

Returns:

Controls:
this.

onAddToProducts

Syntax

onAddToProducts

(
  • event
)
private

Summary

TODO

Parameters:

  • event Event

    The JS Event.

onBeforeDragStart

Syntax

onBeforeDragStart

()

Summary

Triggered on Controls event before-dragstart. Tests if the object is locked before starting to drag.

onClick

Inherited from Controls:

Syntax

onClick

(
  • event
)

Summary

Triggered on event wnp.engine3D.click.

Parameters:

  • event Event
    The JS event.

onClickDerived

Syntax

onClickDerived

(
  • pickingInfo
)

Summary

Triggered on event wnp.engine3D.click.collided. Behavior : if ctrl is pressed, the object is added to the current group, if the right button is pressed, the special event is sent to the widgets.

Parameters:

  • pickingInfo BABYLON.PickingInfo

    The picking information on what is under the mouse.

onCloneObject

Syntax

onCloneObject

()

Summary

Triggered on event wnp.request.object.clone. Called when the user clones an object or a group.

onCloneObject

Syntax

onCloneObject

(
  • object3D
  • doNotAddHistory
)

Summary

Removes an object or a group.

Parameters:

  • object3D BABYLON.Mesh

    The object.

  • doNotAddHistory Boolean

    Add or not to the history.

onCreateObject

Syntax

onCreateObject

(
  • event
)

Summary

Triggered on event wnp.engine3D.object.create. Called when a mesh is added to the scene.

Parameters:

  • event Event

    The JS event.

onDispose

Syntax

onDispose

(
  • event
)

Summary

Triggered on event wnp.engine3D.object.dispose. Called when an object is removed from the scene.

Parameters:

  • event Event

    The JS event.

onDispose

Syntax

onDispose

(
  • event
)

Summary

Triggered on event wnp.engine3D.allFloorsReady. Called when the floor id changes.

Parameters:

  • event Event

    The JS event.

onDoubleClick

Inherited from Controls:

Syntax

onDoubleClick

(
  • event
)

Summary

Triggered on event wnp.engine3D.dblclick.collided.

Parameters:

  • event Event
    The JS event.

onDoubleClickDerived

Syntax

onDoubleClickDerived

(
  • pickingInfo
)

Summary

Triggered on event wnp.engine3D.dblclick.collided. Behavior : triggers the function animate on the underlying mesh.

Parameters:

  • pickingInfo BABYLON.PickingInfo

    The picking information on what is under the mouse.

onDragEnd

Inherited from Controls:

Syntax

onDragEnd

(
  • event
)

Summary

Triggered on event wnp.engine3D.drag-end.

Parameters:

  • event Event
    The JS event.

onDragging

Inherited from Controls:

Syntax

onDragging

(
  • event
)

Summary

Triggered on event wnp.engine3D.dragging.

Parameters:

  • event Event
    The JS event.

onDragStart

Inherited from Controls:

Syntax

onDragStart

(
  • event
)

Summary

Triggered on event wnp.engine3D.drag-start.

Parameters:

  • event Event
    The JS event.

onIAction

Syntax

onIAction

() private

Summary

Sends a different action for the configurator depending on the object's nature (Group or not).

onKeyDown

Syntax

onKeyDown

(
  • event
)

Summary

Triggered on event wnp.keyboardManager.keyDown. Behavior : When the user uses ctrl-d (duplicates the object) and the delete key (removes the object).

Parameters:

  • event Event

    The JS event.

onMouseDown

Inherited from Controls:

Syntax

onMouseDown

(
  • event
)

Summary

Triggered on event wnp.engine3D.mousedown.

Parameters:

  • event Event
    The JS event.

onMouseDownDerived

Syntax

onMouseDownDerived

(
  • event
)

Summary

Triggered on Controls event mousedown.

Parameters:

  • event Event

    The Controls event.

onMouseMove

Inherited from Controls:

Syntax

onMouseMove

(
  • event
)

Summary

Triggered on event wnp.engine3D.mouse-move.

Parameters:

  • event Event
    The JS event.

onMouseMoveDerived

Syntax

onMouseMoveDerived

(
  • event
)

Summary

Triggered on Controls event mousemove.

Parameters:

  • event Event

    The Controls event.

onMouseUpDerived

Syntax

onMouseUpDerived

(
  • event
)

Summary

Triggered on Controls event mouseup.

Parameters:

  • event Event

    The Controls event.

onNewPlan

Syntax

onNewPlan

(
  • event
)

Summary

Triggered on event wnp.request.newPlanReady. Called when the user clicks on the new plan button.

Parameters:

  • event Object

    L'objet associé à l'événement.

onOverrideProduct

Syntax

onOverrideProduct

(
  • event
)
private

Summary

TODO

Parameters:

  • event Event

    The JS Event.

onRefreshObject

Syntax

onRefreshObject

(
  • event
)

Summary

Triggered on event wnp.engine3D.object.refresh. Called when an object is refreshed

Parameters:

  • event Event

    The JS event.

onRemoveObject

Syntax

onRemoveObject

(
  • event
)

Summary

Triggered on event wnp.request.object.remove. Removes an object.

Parameters:

  • event Event

    The JS event.

onSelectObject

Syntax

onSelectObject

(
  • object
)

Summary

Triggered on Controls event deselect.

Parameters:

  • object BABYLON.Mesh

    The selected object.

onSelectObject

Syntax

onSelectObject

(
  • object
)

Summary

Triggered on Controls event select.

Parameters:

  • object BABYLON.Mesh

    The selected object.

pickMeshUnderCursor

Inherited from Controls:

Syntax

pickMeshUnderCursor

(
  • event
  • [ref]
)

Summary

Picks the mesh under the mouse pointer, and returns the top-level object as a pickingInfo

Parameters:

  • event MouseEvent
    The JS event
  • [ref] BABYLON.Mesh optional
    Optional parameter to override the referent parent.

redoAdd

Syntax

redoAdd

(
  • target
  • params
)
private

Summary

The redo function for the add action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

redoDelete

Syntax

redoDelete

(
  • target
  • params
)
private

Summary

The redo function for the delete action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

redoRefresh

Syntax

redoRefresh

(
  • target
  • params
)
private

Summary

The redo function for the refresh action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

refreshObject

Syntax

refreshObject

(
  • object3D
  • options
)

Summary

Refreshes an object. Rebuilds the entire 3D object, given the programmable instance it is linked to.

Parameters:

  • object3D BABYLON.Mesh

    the mesh to refresh.

  • options Object

    The options : noHistory and modifiedProperties

refreshReferentPlane

Inherited from Controls:

Syntax

refreshReferentPlane

()

Summary

Refresh the referent dragging plane, taking the constraints into account.

removeDraggable

Inherited from Controls:

Syntax

removeDraggable

(
  • object
)

Summary

Removes an object to the list of handled objects.

Parameters:

  • object BABYLON.Mesh
    The object.

resetDraggable

Inherited from Controls:

Syntax

resetDraggable

()

Summary

Empties the list of handled objects.

select

Inherited from Controls:

Syntax

select

(
  • topLevelObjectPI
)

Summary

Selects an object, as a picking information.

Parameters:

  • topLevelObjectPI BABYLON.PickingInfo
    The new selected object, as a picking information.

selectObject

Inherited from Controls:

Syntax

selectObject

(
  • object
)

Summary

Selects an object. NB : A picking info is created, with a null distance and a null pickedPoint. NB 2 : The difference with setSelectedObject is that a select event is fired.

Parameters:

  • object BABYLON.Mesh
    The new selected object.

selectTopLevelObject

Inherited from Controls:

Syntax

selectTopLevelObject

(
  • object
)

Summary

Selects the top-level object, relative to the referent parent, for the given object. NB : A picking info is created, with a null distance and a null pickedPoint.

Parameters:

  • object BABYLON.Mesh
    The object from which we have to find the top-level object.

setDragged

Inherited from Controls:

Syntax

setDragged

(
  • dragged
)

Summary

Forces the dragged object without having to click on it. NB : Warning, the parameter is a picking info !

Parameters:

  • dragged BABYLON.PickingInfo
    The new dragged object.

setReferentParent

Inherited from Controls:

Syntax

setReferentParent

(
  • parent
)

Summary

Sets the current referent parent, used to select or drag objects. See Controls wiki for more info.

Parameters:

  • parent BABYLON.Mesh
    The new referent parent.

setRoot

Inherited from Controls:

Syntax

setRoot

(
  • root
)

Summary

Sets the current root, that is the top-level parent of all handled objects. NB : All objects that are not descendants of the root can't be handled by Controls. NB 2 : The referent parent is also set to the new root, for consistency.

Parameters:

  • root BABYLON.Mesh
    The new root.

setScreenSize

Inherited from Controls:

Syntax

setScreenSize

(
  • width
  • height
)

Summary

Sets the canvas size.

Parameters:

setSelectedObject

Inherited from Controls:

Syntax

setSelectedObject

(
  • object
)

Summary

Forces the selected object without having to click on it. NB : A picking info is created, with a null distance and a null pickedPoint. NB 2 : The difference with selectObject is that no select event is fired.

Parameters:

  • object BABYLON.Mesh
    The new selected object.

setupHistory

Syntax

setupHistory

()

Summary

Setupps the history for the edition actions.

startListening

Inherited from Controls:

Syntax

startListening

()

Summary

Starts the listening of Engine3D events.

stopListening

Inherited from Controls:

Syntax

stopListening

()

Summary

Stops the listening of Engine3D events.

undoAdd

Syntax

undoAdd

(
  • target
  • params
)
private

Summary

The undo function for the add action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

undoDelete

Syntax

undoDelete

(
  • target
  • params
)
private

Summary

The undo function for the delete action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

undoRefresh

Syntax

undoRefresh

(
  • target
  • params
)
private

Summary

The undo function for the refresh action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

unlock

Syntax

unlock

(
  • key
  • [flags]
)

Summary

Re-enables locked behaviors.

Parameters:

  • key Object

    Key that was used to lock actions

  • [flags] Number optional

    Actions to unlock among: CAMERALOCK = 1; DRAGLOCK = 2; KEYBOARDLOCK = 4; CAMERATRANSLATIONLOCK = 8; Default is all flags on.

Properties

_screenSizes

Inherited from Controls:

Syntax

_screenSizes

Object

Summary

Screen Sizes (width and height)

cloneWidget

Syntax

cloneWidget

Widget.Clone

Summary

The clone widget: Allows the user to duplicate an object by clicking on the copy icon.

domElement

Inherited from Controls:

Syntax

domElement

HTMLCanvasElement

Summary

The canvas.

elevationWidget

Syntax

elevationWidget

Widget.Info

Summary

The elevation widget: Creates a widget panel on the right side of the screen and allows to change the elevation of an object by dragging the cursor of the elevation bar.

groupMgr

Syntax

groupMgr

GroupManager

Summary

Group Manager

groupWidget

Syntax

groupWidget

Widget.Group

Summary

The group widget: Allows the user to group/ungroup objects if several objects/a group are selected.

infoWidget

Syntax

infoWidget

Widget.Info

Summary

The info widget: Allows the user to have all the properties of an object by clicking on the info sprite.

listens

Inherited from Controls:

Syntax

listens

Boolean

Summary

Flag that indicates if the Controls are listening to the Engine3D events

lockWidget

Syntax

lockWidget

Widget.Lock

Summary

The lock widget: Allows the user to lock/unlock an object by clicking on the lock icon.

move

Inherited from Controls:

Syntax

move

Function

Summary

Move callback, called by Controls to move an object in the scene.

objects

Inherited from Controls:

Syntax

objects

BABYLON.Mesh

Summary

3D objects handled by the controls (selectable and draggable).

params

Inherited from Controls:

Syntax

params

Object

Summary

Controls parameters.

removeWidget

Syntax

removeWidget

Widget.Remove

Summary

The remove widget: Allows the user to remove an object by clicking on the trash icon.

rotatorWidget

Syntax

rotatorWidget

Widget.Rotator

Summary

The rotator widget: Allows the user to turn an object with the green circle.

scene

Inherited from Controls:

Syntax

scene

BABYLON.Scene

Summary

The 3D scene.

widget

Syntax

widget

Widget

Summary

The table of all widgets.

Events

wnp.editionComponent.removeObject

Syntax

wnp.editionComponent.removeObject

Summary

wnp.engine3D.object.clone

Syntax

wnp.engine3D.object.clone

Summary

Fired to clone an object

wnp.request.configurator.start

Syntax

wnp.request.configurator.start

Summary

Fired when the configurator is needed for an object.

wnp.request.disable-orbit-camera

Inherited from Controls:

Syntax

wnp.request.disable-orbit-camera

Summary

Fired to disable the orbit camera.

wnp.request.enable-orbit-camera

Inherited from Controls:

Syntax

wnp.request.enable-orbit-camera

Summary

Fired to enable the orbit camera.

wnp.request.groupConfigurator.start

Syntax

wnp.request.groupConfigurator.start

Summary

Fired when the configurator is needed for a group.

wnp.request.historyAction

Syntax

wnp.request.historyAction

Summary

Fired when the history is needed on an action.

Event Payload:

  • component BaseComponent3D

    The component of the action (here it is EditionComponent3D).

  • object BABYLON.Mesh

    The target object.

  • params Object

    Parameters of the history.

  • action String

    The type of action done.

wnp.request.object.remove

Syntax

wnp.request.object.remove

Summary

Fired when the delete button is pushed while a mesh is selected.

Event Payload:

  • object BABYLON.Mesh

    The currently selected object.

  • structure FloorStructure

    The current structure.

wnp.request.saveHistory

Syntax

wnp.request.saveHistory

Summary

Fired to request a save of the history.