WanaPlan

API Docs for: 2.7.0
Show:

PolygonWall

Extends WallStructure
Module: Component
Parent Module: Wanaplan

Summary

Polygonal walls. Represents the standard wanaplan wall, which is a closed polygon of N points.

Constructor

PolygonWall

Syntax

PolygonWall

()

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.

addToStructure

Inherited from WallStructure:

Syntax

addToStructure

(
  • structure
)

Summary

Adds a wall and its points to a structure.

Parameters:

checkCoherence

Inherited from WallStructure:

Syntax

checkCoherence

(
  • structure
)

Summary

Checks if the object structure contains errors, if so, removes it from the plan.

Parameters:

computeDefault

Inherited from WallStructure:

Syntax

computeDefault

(
  • pointIndex
)

Summary

Computes a flat polygon ending, typically for unconnected walls. See Wanaplan API wiki for more info on wall connection.

Parameters:

  • pointIndex Number
    The index of the ending point, 0 or 1.

computeStrong

Inherited from WallStructure:

Syntax

computeStrong

(
  • pointIndex
)

Summary

Computes a polygon ending for two-way connected walls. See Wanaplan API wiki for more info on wall connection.

Parameters:

  • pointIndex Number
    The index of the ending point, 0 or 1.

computeWeak

Inherited from WallStructure:

Syntax

computeWeak

(
  • pointIndex
)

Summary

Computes a polygon ending for one-way connected walls. See Wanaplan API wiki for more info on wall connection.

Parameters:

  • pointIndex Number
    The index of the ending point, 0 or 1.

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

distanceFrom

Inherited from WallStructure:

Syntax

distanceFrom

(
  • vector
)
Number

Summary

Returns the distance from a wall to a point.

Parameters:

  • vector BABYLON.Vector2
    Involved point.

Returns:

Number:
Distance to this wall.

distanceFromRect

Inherited from WallStructure:

Syntax

distanceFromRect

(
  • vector
  • [margin=0]
  • structure
)
Number

Summary

Returns the distance from the given vector to the wall bounding rectangle.

Parameters:

  • vector BABYLON.Vector2
    Involved point.
  • [margin=0] Number optional
    The margin we take outside the endings of the wall.
  • structure FloorStructure
    The floor structure containing the wall.

Returns:

Number:
The distance.

draw

Inherited from WallStructure:

Syntax

draw

(
  • ctx
)

Summary

Draws the wall on a canvas.

Parameters:

  • ctx CanvasRenderingContext2D
    2D canvas context.

getAllPoints

Inherited from WallStructure:

Syntax

getAllPoints

(
  • inOrder
)
PointStructure[]

Summary

Returns all the points of the wall (endings and attached points) in a specific order.

Parameters:

  • inOrder Boolean
    Order (-1 = from ending 0 to 1, 1 = from ending 1 to 0).

Returns:

PointStructure[]:
Array of all the points.

getAxis

Syntax

getAxis

() BABYLON.Vector2[]

Summary

Returns the 2 segments connecting the sides of the polygons of the wall. These segments are parallel to the wall vector.

Returns:

BABYLON.Vector2[]:

2x2 Array containing the 2 connecting segments.

getBoundingBox

Inherited from WallStructure:

Syntax

getBoundingBox

() Object

Summary

Computes the bounding box.

Returns:

Object:
Nested object, min : BABYLON.Vector2, max : BABYLON.Vector2

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

() FloorStructure

Summary

Gets the floor referencing this object.

Returns:

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

getIntersections

Inherited from WallStructure:

Syntax

getIntersections

(
  • structure
)
PointStructure[]

Summary

Returns a list of intersections with the other walls in the same floor. The extremities of the walls are not considered as intersections. The array is returned after sorting the elements by distance from the point 0 of the wall.

Parameters:

Returns:

PointStructure[]:
The intersections as an array of PointStructure.

getLength

Inherited from WallStructure:

Syntax

getLength

() Number

Summary

Computes the length of the wall.

Returns:

Number:
The length of the wall.

getNearestPoint

Inherited from WallStructure:

Syntax

getNearestPoint

(
  • vector
  • [margin=0]
)
BABYLON.Vector2

Summary

Returns the projection of the given vector on the wall segment.

Parameters:

  • vector BABYLON.Vector2
    Involved point.
  • [margin=0] Number optional
    The margin we take outside the endings of the wall.

Returns:

BABYLON.Vector2:
Projected point.

getNearestPointOnAxe

Inherited from WallStructure:

Syntax

getNearestPointOnAxe

(
  • vector
)
BABYLON.Vector2

Summary

Returns the projection of the given vector on the wall axe.

Parameters:

  • vector BABYLON.Vector2
    Involved point.

Returns:

BABYLON.Vector2:
Projected point.

getNearestPointOnPolygon

Inherited from WallStructure:

Syntax

getNearestPointOnPolygon

(
  • vector
)
BABYLON.Vector2

Summary

Returns the projection of the given vector on the wall polygon.

Parameters:

  • vector BABYLON.Vector2
    Involved point.

Returns:

BABYLON.Vector2:
Projected point.

getNearestPointOnRect

Inherited from WallStructure:

Syntax

getNearestPointOnRect

(
  • vector
  • [margin=0]
  • structure
)
BABYLON.Vector2

Summary

Returns the projection of the given vector on the wall bounding rectangle.

Parameters:

  • vector BABYLON.Vector2
    Involved point.
  • [margin=0] Number optional
    The margin we take outside the endings of the wall.
  • structure FloorStructure
    The floor structure containing the wall.

Returns:

BABYLON.Vector2:
Projected point.

getNormalVector

Inherited from WallStructure:

Syntax

getNormalVector

(
  • [norm=1]
)
BABYLON.Vector2

Summary

Returns an orthogonal vector.

Parameters:

  • [norm=1] Number optional
    The requested norm.

Returns:

BABYLON.Vector2:
Orthogonal vector.

getPoints

Inherited from WallStructure:

Syntax

getPoints

(
  • [index]
)
BABYLON.Vector2 | BABYLON.Vector22

Summary

Gets the endings of the wall.

Parameters:

  • [index] Number optional
    Index of the point.

Returns:

BABYLON.Vector2 | BABYLON.Vector22:
If an index is provided, returns the point of that index. Else returns an array containing the 2 points.

getPolygon

Inherited from WallStructure:

Syntax

getPolygon

() BABYLON.Vector2

Summary

Returns the polygon of the wall.

Returns:

BABYLON.Vector2:
The wall as a polygon (array of vertices).

getWallVector

Inherited from WallStructure:

Syntax

getWallVector

() BABYLON.Vector2

Summary

Computes the vector representing the wall. Starts from its point 0, and ends on its point 1.

Returns:

BABYLON.Vector2:
Vector carrying the wall.

initialize

Inherited from BaseStructure:

Syntax

initialize

() private

Summary

Method called after the loading of the component

isExternal

Inherited from WallStructure:

Syntax

isExternal

(
  • [structure]
)
Boolean

Summary

Checks if the wall is part of an external room.

Parameters:

  • [structure] FloorStructure optional
    The floor structure containing the wall

Returns:

Boolean:
True if the wall is external.

isPointInPolygon

Inherited from WallStructure:

Syntax

isPointInPolygon

(
  • vector
)
Boolean

Summary

Returns true if the point is inside the polygon of the wall.

Parameters:

  • vector BABYLON.Vector2
    Involved point.

Returns:

Boolean:
True if the point is inside the polygon.

isPointOn

Inherited from WallStructure:

Syntax

isPointOn

(
  • vector
  • [delta=1e-5]
)
Boolean

Summary

Checks if a point is on a wall, within a delta incertitude.

Parameters:

  • vector BABYLON.Vector2
    Involved point.
  • [delta=1e-5] Number optional
    Incertitude.

Returns:

Boolean:
True if the point is on the wall.

isTargeted

Inherited from WallStructure:

Syntax

isTargeted

(
  • vector
)
Boolean

Summary

Checks if the wall is targeted by the cursor.

Parameters:

  • vector BABYLON.Vector2
    The cursor position.

Returns:

Boolean:
True if targeted.

parallelTo

Inherited from WallStructure:

Syntax

parallelTo

(
  • wall
)
Boolean

Summary

Checks if the wall is parallel to another wall.

Parameters:

Returns:

Boolean:
True if the walls are parallel.

remove

Inherited from WallStructure:

Syntax

remove

(
  • structure
)

Summary

Deletes a wall.

Parameters:

reorganizeOnSplit

Inherited from WallStructure:

Syntax

reorganizeOnSplit

(
  • structure
  • wallList
)

Summary

Reorganizes the attached walls and the overtures when the wall is splitted into several pieces.

Parameters:

serialize

Inherited from BaseStructure:

Syntax

serialize

() Object

Summary

Serializes the object (to JSON)

Returns:

Object:
The serialization result, null if nothing is serialized

setPoints

Inherited from WallStructure:

Syntax

setPoints

(
  • points
  • [index]
)

Summary

Changes the points composing the wall.

Parameters:

  • points PointStructure[]
    Array composed of instances of PointStructure. OR a PointStructure if the parameter index is provided.
  • [index] Number optional
    Index of the point (0 or 1).

sortAttached

Inherited from WallStructure:

Syntax

sortAttached

()

Summary

Sorts the list of the attached points (point 0 to point 1).

splitAtIntersections

Inherited from WallStructure:

Syntax

splitAtIntersections

(
  • structure
)

Summary

Splits the wall, taking other walls as splitters.

Parameters:

translate

Inherited from WallStructure:

Syntax

translate

(
  • vector
  • [structure]
)

Summary

Translates the wall.

Parameters:

  • vector BABYLON.Vector2
    Translation vector.
  • [structure] FloorStructure optional
    Floor structure containing the wall.

tryMerge

Inherited from WallStructure:

Syntax

tryMerge

(
  • structure
)
WallStructure

Summary

Tries to merge the wall with other walls in the same floor.

Parameters:

Returns:

WallStructure:
The resulting wall. Returns the unchanged wall if the method does not manage to merge with something.

update

Inherited from BaseStructure:

Syntax

update

()

Summary

Generic update method, must be overridden.

updateAttachedPoints

Inherited from WallStructure:

Syntax

updateAttachedPoints

(
  • structure
)

Summary

Updates the position of the attached points.

Parameters:

updateOvertures

Inherited from WallStructure:

Syntax

updateOvertures

(
  • structure
)

Summary

Updates the position of the overtures on the wall.

Parameters:

updateReferences

Inherited from BaseStructure

Syntax

updateReferences

(
  • structure
)

Summary

Updates the wall after deserialization.

Parameters:

  • structure FloorStructure
    The floorStructure where the object belong.

vectorTo

Inherited from WallStructure:

Syntax

vectorTo

(
  • vector
)
BABYLON.Vector2

Summary

Returns the vector from the projected point on the wall, to the given point. Direction : wall -> point.

Parameters:

  • vector BABYLON.Vector2
    Involved point.

Returns:

BABYLON.Vector2:
The vector.

weakToStrong

Inherited from WallStructure:

Syntax

weakToStrong

(
  • point
  • structure
)

Summary

Upgrades the connection from weak (attached) to strong (connected).

Parameters:

  • point PointStructure
    The weak point that becomes strong.
  • structure wnp.FloorStructure
    The floor structure containing the wall.

Properties

_edgePolygons

Inherited from WallStructure:

Syntax

_edgePolygons

BABYLON.Vector2[2]

Summary

The two polygons surrounding the ends.

attachedPoints

Inherited from WallStructure:

Syntax

attachedPoints

PointStructure[]

Summary

Attached points. See Wanaplan Wiki for more info about the connections between walls.

considerForElevation

Inherited from WallStructure:

Syntax

considerForElevation

Boolean

Summary

Consider or not when computing this floor's height (and therefore top floor elevation). Allows to have overlapping floors (useful for roofs)

Default: true

forceSubslopes

Inherited from WallStructure:

Syntax

forceSubslopes

Boolean

Summary

Flag to enable/disable subslopes on interior walls.

Default: false

height

Inherited from WallStructure:

Syntax

height

Number

Summary

Wall height.

Default: 250

id

Inherited from BaseStructure:

Syntax

id

Number

Summary

Unique ID for the structure set up automatically

instance

Inherited from WallStructure:

Syntax

instance

String

Summary

Class type of the wall. e.g. : 'polygon' for polygonal walls, which are most used in wanaplan.

measureDisplayed

Inherited from WallStructure:

Syntax

measureDisplayed

Boolean

Summary

Flag to enable/disable measure display.

Default: true

measureDist

Inherited from WallStructure:

Syntax

measureDist

Number

Summary

2D distance to display the measures related to this wall.

Default: 15

name

Inherited from BaseStructure:

Syntax

name

String

Summary

Structure name

needsUpdate

Inherited from WallStructure:

Syntax

needsUpdate

Boolean

Summary

Flag that signals if the geometry of the wall must be re-computed.

overtures

Inherited from WallStructure:

Syntax

Summary

Overtures (doors, windows, bay windows ...).

points

Inherited from WallStructure:

Syntax

Summary

Two 2D vectors building the ends of the wall.

polygonPoints

Syntax

polygonPoints

BABYLON.Vector2

Summary

The 2D polygon shape of the wall.

subSlopes

Inherited from WallStructure:

Syntax

Summary

Subslope list for this wall.

thickness

Inherited from WallStructure:

Syntax

thickness

Number

Summary

Wall thickness.

Default: 30

type

Inherited from WallStructure:

Syntax

type

Number

Summary

Type of the wall. Can be TYPE_NORMAL or TYPE_SEPARATOR. TODO : Must be deleted in future version, this has to be replaced by a class "SeparatorWall" that has its own behaviour.

Default: TYPE_NORMAL