WanaPlan

API Docs for: 2.7.0
Show:

RoomStructure

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

Summary

A room object. More info can be found in the Wanaplan Wiki.

Constructor

RoomStructure

Syntax

RoomStructure

()

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.

addFloorOnOvertures

Syntax

addFloorOnOvertures

() private

Summary

Adds floor on doors, or overtures that hit the ground, so there is no hole in the connection between 2 rooms.

copy

Syntax

copy

(
  • room
)

Summary

Copies a room.

WARNING: Beware of shared materials !

Parameters:

createFromCycle

Syntax

createFromCycle

(
  • cycle
)
RoomStructure private

Summary

Creates a room from a closed cycle of points.

Parameters:

Returns:

RoomStructure:

The resulting room.

createWallPanes

Syntax

createWallPanes

() WallPane3D[] private

Summary

Creates the wall panes for the room. Basically, one side of the room polygon = 1 wall pane.

Returns:

WallPane3D[]:

The wall panes.

deserialize

Inherited from BaseStructure

Syntax

deserialize

(
  • hybrid
)
private

Summary

Deserializes the object.

Parameters:

  • hybrid String

    An object issued from a serialization.

dispatchMaterials

Syntax

dispatchMaterials

() private

Summary

Dispatches the materials to the wall panes. Takes the panesMaterials list, and finds out on which pane which material is most likely to be. The likelihood score is determined by the center and normal of the wallPane.

eql

Syntax

eql

(
  • room
)
Boolean

Summary

Equal operator for 2 rooms. Compares the points of 2 rooms.

Parameters:

Returns:

Boolean:

True if this room points are the same as the points of the room in parameter (not necessarily in the same order).

getBoundingBox

Syntax

getBoundingBox

() BABYLON.BoundingBox

Summary

Returns the 2D not oriented Bounding Box.

Returns:

BABYLON.BoundingBox:

The Bounding Box.

getCenter

Syntax

getCenter

() BABYLON.Vector2

Summary

Returns the center of the room.

Returns:

BABYLON.Vector2:

The 2D center of gravity of the room's polygon.

getDefaultLabel

Syntax

getDefaultLabel

()

Summary

Get the default label for a room based on type

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.

getLikelihood

Syntax

getLikelihood

(
  • room
)
Number

Summary

Gives a score of likelihood between 2 rooms.

Parameters:

Returns:

Number:

An arbitrary number, usually less than 10. The higher it is, the more alike the rooms look.

getOverlappingRectArea

Syntax

getOverlappingRectArea

(
  • room
)
Number

Summary

Determines the overlapping area of 2 rooms' bounding boxes.

Parameters:

Returns:

Number:

The overlapping area of bounding boxes.

getRoomArea

Syntax

getRoomArea

(
  • force
)
Number

Summary

Returns the area of the room.

Parameters:

  • force Boolean

    Forces a recomputing of the room area.

Returns:

Number:

The room area.

getWallPanes

Syntax

getWallPanes

() WallPane3D[]

Summary

Gets the Wall Panes (see Wanaplan API wiki for more info).

Returns:

WallPane3D[]:

The Wall Panes of the room.

initialize

Inherited from BaseStructure:

Syntax

initialize

() private

Summary

Method called after the loading of the component

isPointIn

Syntax

isPointIn

(
  • vector
)
Boolean

Summary

Determines if a point is in the room.

Parameters:

  • vector BABYLON.Vector2

    The point in plan coordinates.

Returns:

Boolean:

True if the point is in the room.

orientedArea

Syntax

orientedArea

() Number

Summary

Returns the oriented area of the room.

Returns:

Number:

The room area, negative if the room is counterclockwise.

processRoomArea

Syntax

processRoomArea

() Number private

Summary

Computes the area of the room.

Returns:

Number:

The room area.

reversePath

Syntax

reversePath

()

Summary

Flips a room. If it was counterclockwise, it becomes clockwise.

serialize

Inherited from BaseStructure:

Syntax

serialize

() Object

Summary

Serializes the object (to JSON)

Returns:

Object:
The serialization result, null if nothing is serialized

setColor

Syntax

setColor

(
  • The
)

Summary

Sets the color of a room.

Parameters:

  • The String

    hexadecimal representation of the color.

setColorFromType

Syntax

setColorFromType

()

Summary

Automatically maps the color of the room based on its type.

setType

Syntax

setType

(
  • The
)

Summary

Sets the type of a room.

Parameters:

  • The Number

    type of the room.

toVec2Array

Syntax

toVec2Array

() BABYLON.Vector2

Summary

Returns a BABYLON.Vector2 array of the room points.

Returns:

BABYLON.Vector2:

The array of points.

update

Inherited from BaseStructure:

Syntax

update

()

Summary

Generic update method, must be overridden.

updatePaneMaterial

Syntax

updatePaneMaterial

(
  • pane
  • material
)
private

Summary

Updates a wallPane with a new material and refreshes its center and normal. This function must be called after dispatchMaterials, if there was a 2D -> 3D switch.

Parameters:

  • pane WallPane3D

    The pane to update.

  • material BABYLON.Material

    The new material.

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

area

Syntax

area

Number

Summary

Room's area (2D).

areaPosition

Syntax

areaPosition

BABYLON.Vector2

Summary

Where to display the room's area label on the screen (2D).

ceiling

Syntax

ceiling

Number

Summary

Ceiling flag: 0 means no ceiling 1 means ceiling 2 means "let the algorithm choose".

color

Syntax

color

String

Summary

Room's hexadecimal color.

cycle

Syntax

cycle

PointStructure[] private

Summary

Cycle used to build the room, private property.

elevation

Syntax

elevation

Number

Summary

Room elevation.

habitable

Syntax

habitable

Number

Summary

Habitable flag: 0 means not habitable 1 means habitable 2 means "let the algorithm choose".

height

Syntax

height

Number

Summary

Room height (distance between the floor and the ceiling).

holes

Syntax

holes

BABYLON.Vector2[]

Summary

Potential holes in the room's polygon. Array of 2D vectors describing the holes.

id

Inherited from BaseStructure:

Syntax

id

Number

Summary

Unique ID for the structure set up automatically

isExternal

Syntax

isExternal

Boolean

Summary

Indicates if the room is external (see Wiki for more info about internal and external rooms).

label

Syntax

label

String

Summary

Room label, can be modified by the user.

materials

Syntax

materials

Object

Summary

Room's materials. Contains two fields : materials['ceiling'] and materials['floor'].

name

Inherited from BaseStructure

Syntax

name

String private

Summary

Room's inner id, can't be modified by the user.

panes

Syntax

panes

WallPanes3D

Summary

Array of wall panes. See the wanaplan wiki for more info about wall panes.

panesMaterials

Syntax

panesMaterials

BABYLON.Material private

Summary

Room panes materials. For serialization purposes, has to be modified in the future.

parentWallSides

Syntax

parentWallSides

BABYLON.Vector2

Summary

Array of normal vectors to walls referenced in the "walls" property. These vectors are normal to the walls, and point towards the inside of the room polygon. Index sync : given i an index, parentWallSides[i] is normal to walls[i].

points

Syntax

points

BABYLON.Vector2

Summary

2D vectors building the room's flat polygon.

textHeight

Syntax

textHeight

Number private

Summary

Text style: the height of the text.

textWidth

Syntax

textWidth

Number private

Summary

Text style: The width of the text.

thickness

Syntax

thickness

Number

Summary

Thickness of the floor (3D).

type

Syntax

type

Number

Summary

Type flag: 0 means normal room 1 means garden 2 means technical room. 3 means out of zone room 4 means terraces & driveways

walls

Syntax

Summary

Walls that surround the room.