API Docs for: 2.7.3
Show:

MeasureStructure Class

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

The measure structure. Allows to merge and split measures.

Constructor

MeasureStructure

(
  • points
  • parent
  • offsetVector
)

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

(
  • propertyName
  • value
)
private

Inherited from BaseStructure:

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

() BABYLON.Vector2

Returns the center of the measure.

Returns:

BABYLON.Vector2:

The center.

deserialize

(
  • hybrid
)
Object

Inherited from BaseStructure:

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

(
  • name
  • collection
)
Object private

Inherited from BaseStructure:

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

(
  • collection
)
FloorStructure

Inherited from BaseStructure:

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

() private

Inherited from BaseStructure:

Method called after the loading of the component

mergeMeasures

(
  • measures
)

Tries to merge this measure with a set of measures.

Parameters:

needToDelete

(
  • measure
)
Boolean

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

() BABYLON.Vector2

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

() Object

Inherited from BaseStructure:

Serializes the object (to JSON)

Returns:

Object: The serialization result, null if nothing is serialized

tryMerge

(
  • measure
)
Boolean

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:

Generic update method, must be overridden.

updateReferences

(
  • structure
)

Inherited from BaseStructure:

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

Number

Inherited from BaseStructure:

Unique ID for the structure set up automatically

name

String

Inherited from BaseStructure:

Structure name

offsetVector

BABYLON.Vector2

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

parent

WallStructure

Parent wall inducing the measure.

points

BABYLON.Vector2

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