API Docs for: 2.7.3
Show:

EditionComponent3D Class

Extends Controls
Module: Component
Parent Module: Wanaplan

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

(
  • core
)

Parameters:

  • core wnp.Core

    Wanaplan Core.

Item Index

Methods

addDraggable

(
  • object
)

Inherited from Controls:

Adds an object to the list of handled objects.

Parameters:

  • object BABYLON.Mesh
    The object.

addHistory

(
  • target
  • params
  • type
)

Adds a history action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

  • type String

    Type of the action.

addUnremovableDraggable

(
  • object
)
deprecated private

Inherited from Controls:

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

(
  • widget
)

Adds a widget in the object edition component.

Parameters:

  • widget Widget

    The widget to add.

clickSelection

(
  • event
)

Inherited from Controls:

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

Parameters:

constrains

(
  • [U]
  • [V]
)

Inherited from Controls:

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:

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

disableWidget

()

Disables the widgets for an object.

dragLock

()

Inherited from Controls

Locks the dragging capabilities.

dragSelection

(
  • event
)

Inherited from Controls:

Implements the behaviour "dragging of top-level object"

Parameters:

EnableWidget

()

Enables the widgets for an object.

getDragged

() BABYLON.PickingInfo

Inherited from Controls:

Returns the dragged object as a picking information.

Returns:

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

getLastPosition

()

Inherited from Controls:

Returns the last position of the dragged object.

getPointerCoordinates

(
  • event
)

Inherited from Controls:

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

Parameters:

  • event Event
    The JS event

getReferentParent

() BABYLON.Mesh

Inherited from Controls:

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

() BABYLON.Plane

Inherited from Controls:

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

Returns:

BABYLON.Plane: The current referent plane.

getRoot

() BABYLON.Mesh

Inherited from Controls:

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

() BABYLON.PickingInfo

Inherited from Controls:

Returns the selected object, as picking information.

Returns:

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

getSelectedObject

() BABYLON.Mesh

Inherited from Controls

Gets the currently selected object.

Returns:

BABYLON.Mesh:

The currently selected object.

historyDelete

(
  • target
  • params
  • valueField
)
private

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

(
  • target
  • params
  • valueField
)
private

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

(
  • object
)
Boolean

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

(
  • object
)
Boolean

Checks if a mesh is selectable.

Parameters:

  • object BABYLON.Mesh

    The mesh to check.

Returns:

Boolean:

Is a selectable mesh or not.

isSelectableOverture

(
  • object
)
Boolean

Checks if an overture is selectable.

Parameters:

  • object BABYLON.Mesh

    The mesh to check.

Returns:

Boolean:

Is a selectable mesh or not.

isSelectableStairway

(
  • object
)
Boolean

Checks if a stairway is selectable.

Parameters:

  • object BABYLON.Mesh

    The mesh to check.

Returns:

Boolean:

Is a selectable mesh or not.

lock

(
  • key
  • [flags]
)

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

(
  • event
  • data
)

Inherited from Controls:

Calls every callback registered for a specific event.

Parameters:

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

off

(
  • event
  • handler
)
Controls

Inherited from Controls:

Removes a callback from a specific event.

Parameters:

Returns:

Controls: this.

on

(
  • event
  • handler
  • insertFirst
)
Controls

Inherited from Controls:

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

(
  • event
)
private

TODO

Parameters:

  • event Event

    The JS Event.

onBeforeDragStart

()

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

onClick

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.click.

Parameters:

  • event Event
    The JS event.

onClickDerived

(
  • pickingInfo
)

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

()

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

onCloneObject

(
  • object3D
  • doNotAddHistory
)

Removes an object or a group.

Parameters:

  • object3D BABYLON.Mesh

    The object.

  • doNotAddHistory Boolean

    Add or not to the history.

onCreateObject

(
  • event
)

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

Parameters:

  • event Event

    The JS event.

onDispose

(
  • event
)

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

Parameters:

  • event Event

    The JS event.

onDispose

(
  • event
)

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

Parameters:

  • event Event

    The JS event.

onDoubleClick

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.dblclick.collided.

Parameters:

  • event Event
    The JS event.

onDoubleClickDerived

(
  • pickingInfo
)

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

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.drag-end.

Parameters:

  • event Event
    The JS event.

onDragging

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.dragging.

Parameters:

  • event Event
    The JS event.

onDragStart

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.drag-start.

Parameters:

  • event Event
    The JS event.

onIAction

() private

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

onKeyDown

(
  • event
)

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

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.mousedown.

Parameters:

  • event Event
    The JS event.

onMouseDownDerived

(
  • event
)

Triggered on Controls event mousedown.

Parameters:

  • event Event

    The Controls event.

onMouseMove

(
  • event
)

Inherited from Controls:

Triggered on event wnp.engine3D.mouse-move.

Parameters:

  • event Event
    The JS event.

onMouseMoveDerived

(
  • event
)

Triggered on Controls event mousemove.

Parameters:

  • event Event

    The Controls event.

onMouseUpDerived

(
  • event
)

Triggered on Controls event mouseup.

Parameters:

  • event Event

    The Controls event.

onNewPlan

(
  • event
)

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

(
  • event
)
private

TODO

Parameters:

  • event Event

    The JS Event.

onRefreshObject

(
  • event
)

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

Parameters:

  • event Event

    The JS event.

onRemoveObject

(
  • event
)

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

Parameters:

  • event Event

    The JS event.

onSelectObject

(
  • object
)

Triggered on Controls event deselect.

Parameters:

  • object BABYLON.Mesh

    The selected object.

onSelectObject

(
  • object
)

Triggered on Controls event select.

Parameters:

  • object BABYLON.Mesh

    The selected object.

pickMeshUnderCursor

(
  • event
  • [ref]
)

Inherited from Controls:

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

(
  • target
  • params
)
private

The redo function for the add action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

redoDelete

(
  • target
  • params
)
private

The redo function for the delete action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

redoRefresh

(
  • target
  • params
)
private

The redo function for the refresh action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

refreshObject

(
  • object3D
  • options
)

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:

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

removeDraggable

(
  • object
)

Inherited from Controls:

Removes an object to the list of handled objects.

Parameters:

  • object BABYLON.Mesh
    The object.

resetDraggable

()

Inherited from Controls:

Empties the list of handled objects.

select

(
  • topLevelObjectPI
)

Inherited from Controls:

Selects an object, as a picking information.

Parameters:

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

selectObject

(
  • object
)

Inherited from Controls:

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

(
  • object
)

Inherited from Controls:

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

(
  • dragged
)

Inherited from Controls:

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

(
  • parent
)

Inherited from Controls:

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

(
  • root
)

Inherited from Controls:

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

(
  • width
  • height
)

Inherited from Controls:

Sets the canvas size.

Parameters:

setSelectedObject

(
  • object
)

Inherited from Controls:

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

()

Setupps the history for the edition actions.

startListening

()

Inherited from Controls:

Starts the listening of Engine3D events.

stopListening

()

Inherited from Controls:

Stops the listening of Engine3D events.

undoAdd

(
  • target
  • params
)
private

The undo function for the add action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters.

undoDelete

(
  • target
  • params
)
private

The undo function for the delete action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

undoRefresh

(
  • target
  • params
)
private

The undo function for the refresh action.

Parameters:

  • target Object

    The target of the history action.

  • params Object

    Parameters

unlock

(
  • key
  • [flags]
)

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

Object

Inherited from Controls:

Screen Sizes (width and height)

cloneWidget

Widget.Clone

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

domElement

HTMLCanvasElement

Inherited from Controls:

The canvas.

elevationWidget

Widget.Info

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

GroupManager

Group Manager

groupWidget

Widget.Group

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

infoWidget

Widget.Info

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

listens

Boolean

Inherited from Controls:

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

lockWidget

Widget.Lock

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

move

Function

Inherited from Controls:

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

objects

BABYLON.Mesh

Inherited from Controls:

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

params

Object

Inherited from Controls:

Controls parameters.

removeWidget

Widget.Remove

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

rotatorWidget

Widget.Rotator

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

scene

BABYLON.Scene

Inherited from Controls:

The 3D scene.

widget

Widget

The table of all widgets.

Events

wnp.editionComponent.removeObject

wnp.engine3D.object.clone

Fired to clone an object

wnp.request.configurator.start

Fired when the configurator is needed for an object.

wnp.request.disable-orbit-camera

Inherited from Controls:

Fired to disable the orbit camera.

wnp.request.enable-orbit-camera

Inherited from Controls:

Fired to enable the orbit camera.

wnp.request.groupConfigurator.start

Fired when the configurator is needed for a group.

wnp.request.historyAction

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

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

Fired to request a save of the history.