WanaPlan

API Docs for: 2.7.0
Show:

MeasureStructure

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

Summary

The measure structure. Allows to merge and split measures.

Constructor

MeasureStructure

Syntax

MeasureStructure

(
  • points
  • parent
  • offsetVector
)

Summary

Parameters:

  • points BABYLON.Vector2

    The points where to split the measure, ordered by increasing distance to points[0].

  • parent WallStructure

    Parent wall inducing the measure.

  • offsetVector BABYLON.Vector2

    Normalized vector indicating in which direction to offset the display of the measure in relation to the wall.

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.

center

Syntax

center

() BABYLON.Vector2

Summary

Returns the center of the measure.

Returns:

BABYLON.Vector2:

The center.

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

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.

initialize

Inherited from BaseStructure:

Syntax

initialize

() private

Summary

Method called after the loading of the component

mergeMeasures

Syntax

mergeMeasures

(
  • measures
)

Summary

Tries to merge this measure with a set of measures.

Parameters:

needToDelete

Syntax

needToDelete

(
  • measure
)
Boolean

Summary

Determine if 2 measures are very close together If it is the case, we delete one of the two measures.

Parameters:

Returns:

Boolean:

True if measures are close.

normal

Syntax

normal

() BABYLON.Vector2

Summary

Returns a normal vector to the measure. NB : The direction of this vector is away from the wall carrying the measure.

Returns:

BABYLON.Vector2:

The normal vector.

serialize

Inherited from BaseStructure:

Syntax

serialize

() Object

Summary

Serializes the object (to JSON)

Returns:

Object:
The serialization result, null if nothing is serialized

tryMerge

Syntax

tryMerge

(
  • measure
)
Boolean

Summary

Tries to merge this measure with another measure. Only merges if the measures are aligned and touch each other.

Parameters:

Returns:

Boolean:

True if the measure has been merged, false otherwise.

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

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

offsetVector

Syntax

offsetVector

BABYLON.Vector2

Summary

Normalized vector indicating in which direction to offset the display of the measure in relation to the wall.

parent

Syntax

parent

WallStructure

Summary

Parent wall inducing the measure.

points

Syntax

points

BABYLON.Vector2

Summary

Contains all the points where to split the measure, ordered by increasing distance to points[0].