WanaPlan

API Docs for: 2.7.0
Show:

ObjectStructure

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

Summary

Structure of an object.

Constructor

ObjectStructure

Syntax

ObjectStructure

(
  • fileName
  • baseUrl
  • transforms
  • builderId
)

Summary

Parameters:

  • fileName String

    name of the programmable file

  • baseUrl String

    path to the programmable file

  • transforms Object

    object containing the transform properties of the object with fields : position, rotation, scaling, modelRotation, preferredYAngle

  • builderId String

    name of the builder

Methods

add

Inherited from BaseStructure:

Syntax

add

(
  • propertyName
  • value
)
private

Summary

Adds an element to the collection in parameter.

Parameters:

  • propertyName String
    Name of the dictionnary.
  • value Object
    Value to distribute.

Returns:

Returns true if the value is added else returns false.

animate

Syntax

animate

(
  • object
  • target
)

Summary

Animates an animatable object. Since objects can have multiple animations for their multiple meshes, pass the targeted mesh in parameter.

NB : This is a shortcut to Programmable.animate.

Parameters:

  • object BABYLON.Mesh

    The mesh of the object.

  • target BABYLON.Mesh

    The specific mesh which should be animated.

checkCoherence

Syntax

checkCoherence

(
  • structure
)

Summary

Checks if the object structure contains errors, and if so removes it

Parameters:

  • structure FloorStructure

    The floorStructure to which the object belongs

clone

Syntax

clone

() ObjectStructure

Summary

Clones the object, making a deep copy.

Returns:

ObjectStructure:

A new instance of the object, with the same attributes.

deserialize

Inherited from BaseStructure:

Syntax

deserialize

(
  • hybrid
)
Object

Summary

Deserializes the object (from JSON).

Parameters:

  • hybrid Object
    JSON describing the object, built with the method serialize.

Returns:

Object:
The Structure object built from the deserialization

getAvailableProperties

Syntax

getAvailableProperties

() Object

Summary

Get the available properties of the programmable instance.

NB : This is a shortcut to Programmable.getAvailableProperties.

Returns:

Object:

An object containing the programmable properties.

getElementByName

Inherited from BaseStructure:

Syntax

getElementByName

(
  • name
  • collection
)
Object private

Summary

Gets an element of the collection by its name.

Parameters:

  • name String
    The name of the element to search.
  • collection String
    The name of the collection in which we want to search. If this parameter is not defined, the search is done in all the collection of type array.

Returns:

Object:
Returns the needed element if it exists, else returns null.

getFloor

Inherited from BaseStructure:

Syntax

getFloor

(
  • collection
)
FloorStructure

Summary

Gets the floor referencing this object

Parameters:

  • collection String
    Collection to search within.

Returns:

FloorStructure:
The floor containing this structure, -1 if the object has not been added to any floor collection.

getMaterial

Syntax

getMaterial

(
  • name
)
BABYLON.Material

Summary

Gets the material of a given mesh or child mesh.

Parameters:

  • name String

    The mesh name, this mesh must be objectStructure.objectInstance or one of its children.

Returns:

BABYLON.Material:

The material.

initialize

Inherited from BaseStructure:

Syntax

initialize

() private

Summary

Method called after the loading of the component

isPropertyLocked

Syntax

isPropertyLocked

(
  • key
)
Boolean

Summary

Check if a property is locked or not, based on backoffice directives

Parameters:

Returns:

serialize

Inherited from BaseStructure:

Syntax

serialize

() Object

Summary

Serializes the object (to JSON)

Returns:

Object:
The serialization result, null if nothing is serialized

setMaterial

Syntax

setMaterial

(
  • material
  • name
)

Summary

Sets the material of a named mesh.

Parameters:

  • material BABYLON.Material

    The new Material.

  • name String

    The mesh name, this mesh must be objectStructure.objectInstance or one of its children.

update

Inherited from BaseStructure:

Syntax

update

()

Summary

Generic update method, must be overridden.

updateReferences

Inherited from BaseStructure:

Syntax

updateReferences

(
  • structure
)

Summary

Generic method for rebuilding references after the deserialization. For example : restoring the link between a PointStructure and its parent WallStructure

Parameters:

  • structure wnp.Structure

    Floor Structure to work with

Properties

baseUrl

Syntax

baseUrl

String

Summary

The path to the programmable file, such as /js/Programmables/ . This supports http requests such as : http://github.com/wanadev/Programmables/

filename

Syntax

filename

String

Summary

The name of the programmable file, such as MyProgrammable.js

id

Inherited from BaseStructure:

Syntax

id

Number

Summary

Unique ID for the structure set up automatically

name

Inherited from BaseStructure:

Syntax

name

String

Summary

Structure name

objectInstance

Syntax

objectInstance

BABYLON.Mesh

Summary

A reference to the mesh.

position

Syntax

position

BABYLON.Vector3

Summary

A reference to the mesh position.

/!\ This is a reference to this.objectInstance.position and not a copy, breaking the reference will result in hard failure in serialization.

preferredYAngle

Syntax

preferredYAngle

Number

Summary

Defines an optimal angle for the object. The object is well positioned when the angle between its x axis and a wall is equals to this value. This value is used by the magnetism algorithm to make the objects face the right direction. Angle must be k * Pi/2, else it will probably give unwanted result.

programmableInstance

Syntax

programmableInstance

Programmable

Summary

A reference to the programmable.

ready

Syntax

ready

Boolean

Summary

Flag to indicate if the object is fully loaded.

Default: false

rotation

Syntax

rotation

BABYLON.Vector3

Summary

A reference to the mesh rotation.

/!\ This is a reference to this.objectInstance.rotation and not a copy, breaking the reference will result in hard failure in serialization.

scaling

Syntax

scaling

BABYLON.Vector3

Summary

A reference to the mesh scaling

/!\ This is a reference to this.objectInstance.scaling and not a copy, breaking the reference will result in hard failure in serialization.