API Docs for: 2.7.3
Show:

RoomStructure Class

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

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

Constructor

RoomStructure

()

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.

addFloorOnOvertures

() private

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

copy

(
  • room
)

Copies a room.

WARNING: Beware of shared materials !

Parameters:

createFromCycle

(
  • cycle
)
RoomStructure private

Creates a room from a closed cycle of points.

Parameters:

Returns:

RoomStructure:

The resulting room.

createWallPanes

() WallPane3D[] private

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

Returns:

WallPane3D[]:

The wall panes.

deserialize

(
  • hybrid
)
private

Inherited from BaseStructure

Deserializes the object.

Parameters:

  • hybrid String

    An object issued from a serialization.

dispatchMaterials

() private

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

(
  • room
)
Boolean

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

() BABYLON.BoundingBox

Returns the 2D not oriented Bounding Box.

Returns:

BABYLON.BoundingBox:

The Bounding Box.

getCenter

() BABYLON.Vector2

Returns the center of the room.

Returns:

BABYLON.Vector2:

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

getDefaultLabel

()

Get the default label for a room based on type

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

() FloorStructure

Inherited from BaseStructure

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

(
  • room
)
Number

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

(
  • room
)
Number

Determines the overlapping area of 2 rooms' bounding boxes.

Parameters:

Returns:

Number:

The overlapping area of bounding boxes.

getRoomArea

(
  • force
)
Number

Returns the area of the room.

Parameters:

  • force Boolean

    Forces a recomputing of the room area.

Returns:

Number:

The room area.

getWallPanes

() WallPane3D[]

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

Returns:

WallPane3D[]:

The Wall Panes of the room.

initialize

() private

Inherited from BaseStructure:

Method called after the loading of the component

isPointIn

(
  • vector
)
Boolean

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

() Number

Returns the oriented area of the room.

Returns:

Number:

The room area, negative if the room is counterclockwise.

processRoomArea

() Number private

Computes the area of the room.

Returns:

Number:

The room area.

reversePath

()

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

serialize

() Object

Inherited from BaseStructure:

Serializes the object (to JSON)

Returns:

Object: The serialization result, null if nothing is serialized

setColor

(
  • The
)

Sets the color of a room.

Parameters:

  • The String

    hexadecimal representation of the color.

setColorFromType

()

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

setType

(
  • The
)

Sets the type of a room.

Parameters:

  • The Number

    type of the room.

toVec2Array

() BABYLON.Vector2

Returns a BABYLON.Vector2 array of the room points.

Returns:

BABYLON.Vector2:

The array of points.

update

()

Inherited from BaseStructure:

Generic update method, must be overridden.

updatePaneMaterial

(
  • pane
  • material
)
private

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

(
  • 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

area

Number

Room's area (2D).

areaPosition

BABYLON.Vector2

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

ceiling

Number

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

color

String

Room's hexadecimal color.

cycle

PointStructure[] private

Cycle used to build the room, private property.

elevation

Number

Room elevation.

habitable

Number

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

height

Number

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

holes

BABYLON.Vector2[]

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

id

Number

Inherited from BaseStructure:

Unique ID for the structure set up automatically

isExternal

Boolean

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

label

String

Room label, can be modified by the user.

materials

Object

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

name

String private

Inherited from BaseStructure

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

panes

WallPanes3D

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

panesMaterials

BABYLON.Material private

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

parentWallSides

BABYLON.Vector2

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

BABYLON.Vector2

2D vectors building the room's flat polygon.

textHeight

Number private

Text style: the height of the text.

textWidth

Number private

Text style: The width of the text.

thickness

Number

Thickness of the floor (3D).

type

Number

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

walls

WallStructure[]

Walls that surround the room.