WanaPlan

API Docs for: 2.7.0
Show:

PointStructure

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

Summary

Class representing wall points.

Constructor

PointStructure

Syntax

PointStructure

()

Summary

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.

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

forceMerge

Syntax

forceMerge

(
  • point
  • fs
)

Summary

Forces merging with another point.

Parameters:

  • point PointStructure

    Other point to merge with. It will be deleted from the floor structure.

  • fs FloorStructure

    The floor structure containing this point.

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

isAttached

Syntax

isAttached

() Boolean

Summary

Returns the current attached status.

Returns:

Boolean:

True if the point is attached.

remove

Syntax

remove

(
  • fs
)

Summary

Removes the point from the floor structure.

Parameters:

replaceParent

Syntax

replaceParent

(
  • oldWall
  • newWall
)

Summary

Replaces a parent wall with another parent wall.

NB: The order of the parents list can change.

Parameters:

  • oldWall WallStructure

    The old parent.

  • newWall WallStructure

    The new parent, can be undefined if you just want to delete a parent.

serialize

Inherited from BaseStructure:

Syntax

serialize

() Object

Summary

Serializes the object (to JSON)

Returns:

Object:
The serialization result, null if nothing is serialized

translate

Syntax

translate

(
  • vector
)

Summary

Moves the point by a given offset vector.

Parameters:

  • vector BABYLON.Vector2

    Offset vector.

tryAttach

Syntax

tryAttach

(
  • fs
  • [blacklist]
)
Boolean

Summary

Tries to attach the point to the surrounding walls, if possible.

Parameters:

  • fs FloorStructure

    The floor structure containing this point.

  • [blacklist] WallStructure optional

    Wall to ignore while searching for candidates.

Returns:

Boolean:

False if nothing has been attached, true otherwise.

tryMerge

Syntax

tryMerge

(
  • fs
)
PointStructure

Summary

Tries to merge the point with the other surrounding points, if possible.

Parameters:

Returns:

PointStructure:

The merged point. Returns this point if nothing has been merged.

unAttach

Syntax

unAttach

() Boolean

Summary

Unattaches a point from a wall.

Returns:

Boolean:

False if the point wasn't previously attached, true 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

wallAttached

Syntax

wallAttached

() WallStructure

Summary

Returns the wall to which the point is attached.

Returns:

WallStructure:

A wall, or undefined/null if the point is not attached.

Properties

_parentIds

Syntax

_parentIds

Number[] private

Summary

Internal, for deserialization.

attachedTo

Syntax

attachedTo

WallStructure

Summary

Wall to which the point is attached. Can be null.

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

needsUpdate

Syntax

needsUpdate

Boolean

Summary

Flag that indicates if the points needs to be updated (attached or merged).

parents

Syntax

parents

WallStructure[]

Summary

The parent walls of the point. The length can be 1 or 2.

position

Syntax

position

BABYLON.Vector2

Summary

2D position of the point.