API Docs for: 2.7.3
Show:

RoomComponent2D Class

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Rooms in 2D.

Constructor

RoomComponent2D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

computeRooms

(
  • [structure=CurrentStructure]
  • [cycles]
)
private

Computes the rooms from the 2D geometry of the house. Based on the polygonMerger method.

Parameters:

  • [structure=CurrentStructure] FloorStructure optional

    The related floor. If not specified, the current active floor will be used.

  • [cycles] Cycles optional

    Optional parameter to specify pre-computed cycles (usually from the cache), in order to speed up the process.

destroy

()

Inherited from BaseComponent2D:

Method called when the component is destroyed

disable

()

Inherited from BaseComponent2D:

Disables the component

dispatchRooms

(
  • collection
  • structure
)
private

Copies the properties of another room collection to the current room collection.

Parameters:

  • collection String

    Can be either "internalRooms", or "externalRooms".

  • structure FloorStructure

    The related floor.

drawRoom

(
  • room
  • ctx
  • translation
  • zoom
)

Draws a room.

Parameters:

drawRooms

(
  • ctx
  • translation
  • zoom
)

Draws all rooms for the current active floor.

Parameters:

enable

()

Inherited from BaseComponent2D:

Enables the component

getAllSubSlopes

(
  • structure
)
private

Returns a subslope list based on the rooms. Warning : the subslopes returned are not usable as is, they must be processed by "getSubSlope" from subSlopeComponent2D !

Parameters:

  • structure FloorStructure

    The related floor. If not specified, the current active floor will be used.

getElevationOfPoint

(
  • vector
)
Number

Returns the height of the floor (=thickness+elevation) of the room in which the point is (0 if outside all rooms).

Parameters:

  • vector BABYLON.Vector2

    The point to test.

Returns:

Number:

The elevation of the floor in this point.

getInternalRooms

() RoomStructure[] private

Returns the current computed internal rooms.

Returns:

RoomStructure[]:

The current internal rooms.

getInternalRooms

() RoomStructure[] private

Returns the current computed external rooms.

Returns:

RoomStructure[]:

The current external rooms.

getTargeted

(
  • vector
)
Object

Inherited from BaseComponent2D:

Finds out if the given position is over an element handled by the component

Parameters:

  • vector Vector

    A position, usually the cursor's one.

Returns:

Object:

The targeted element, or null if nothing is found.

identifyRooms

(
  • rooms0
  • rooms1
)
RoomStructure[]

Matches two sets of RoomStructure to pair those which look alike the most. This uses a custom (yet perfectible) matching algorithm based on overlapping areas.

Parameters:

Returns:

RoomStructure[]:

An array T such as T[i] = roomj implies : The room i in the smaller set is the most alike to the roomj in the bigger set. Length of T is : min(rooms0.length, rooms1.length) Example case : rooms0.length is smaller than rooms1.length : if T[i] = roomj, then the image of rooms0[i] is roomj, and roomj is taken from rooms1.

initialize

()

Inherited from BaseComponent2D:

Method called when Wanaplan is initialized. You don't need to call this method manually.

isPointInRooms

(
  • vector
)
RoomStructure

Determines if a point is inside the polygon of one of the currently displayed rooms.

Parameters:

  • vector BABYLON.Vector2

    The point to test.

Returns:

RoomStructure:

The room in which the point is located, or null if it is outside every room.

onContextChanged

(
  • context
)

Inherited from BaseComponent2D:

Method called when the context is switched (2D -> 3D or 3D -> 2D)

Parameters:

  • context String
    The new context

startListening

()

Inherited from BaseComponent2D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent2D:

Removes all the event listeners.

update

()

Inherited from BaseComponent2D:

Generic update method, called on every frame

Properties

displayRoomMesure

Boolean

Flag to display/hide room measures.

Default: true

displayRoomName

Boolean

Flag to display/hide room names.

Default: true

externalRooms

RoomStructure[] private

Temporary storage of the 2D external rooms.

internalRooms

RoomStructure[] private

Temporary storage of the 2D internal rooms.

name

String

Inherited from BaseComponent2D:

Component name

priority

Number private

Inherited from BaseComponent2D

Priority of the component for update callbacks.

Default: 9

rooms

RoomStructure[] private

Temporary storage of the 2D computed rooms.

structure

wnp.Structure

Inherited from BaseComponent2D:

Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is saved

useCache

Boolean private

Flag signaling if we can use the previously computed rooms stored in the cache. For speed up purposes.