RoomComponent2D
Summary
Rooms in 2D.
Constructor
RoomComponent2D
Syntax
RoomComponent2D
-
core
Summary
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Methods
computeRooms
Syntax
computeRooms
-
[structure=CurrentStructure]
-
[cycles]
Summary
Computes the rooms from the 2D geometry of the house.
Based on the polygonMerger
method.
Parameters:
-
[structure=CurrentStructure]
FloorStructure optionalThe related floor. If not specified, the current active floor will be used.
-
[cycles]
Cycles optionalOptional parameter to specify pre-computed cycles (usually from the cache), in order to speed up the process.
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentdispatchRooms
Syntax
dispatchRooms
-
collection
-
structure
Summary
Copies the properties of another room collection to the current room collection.
Parameters:
-
collection
StringCan be either "internalRooms", or "externalRooms".
-
structure
FloorStructureThe related floor.
drawRoom
Syntax
drawRoom
-
room
-
ctx
-
translation
-
zoom
Summary
Draws a room.
Parameters:
-
room
RoomStructureThe room to draw.
-
ctx
CanvasRenderingContext2DCanvas 2D context.
-
translation
BABYLON.Vector2Canvas 2D translation.
-
zoom
NumberCanvas 2D zoom.
drawRooms
Syntax
drawRooms
-
ctx
-
translation
-
zoom
Summary
Draws all rooms for the current active floor.
Parameters:
-
ctx
CanvasRenderingContext2DCanvas 2D context.
-
translation
BABYLON.Vector2Canvas 2D translation.
-
zoom
NumberCanvas 2D zoom.
enable
Syntax
enable
()
Summary
Enables the componentgetAllSubSlopes
Syntax
getAllSubSlopes
-
structure
Summary
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
FloorStructureThe related floor. If not specified, the current active floor will be used.
getElevationOfPoint
Syntax
Summary
Returns the height of the floor (=thickness+elevation) of the room in which the point is (0 if outside all rooms).
Parameters:
-
vector
BABYLON.Vector2The point to test.
Returns:
The elevation of the floor in this point.
getInternalRooms
Syntax
Summary
Returns the current computed internal rooms.
Returns:
The current internal rooms.
getInternalRooms
Syntax
Summary
Returns the current computed external rooms.
Returns:
The current external rooms.
getTargeted
Syntax
Summary
Finds out if the given position is over an element handled by the componentParameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
identifyRooms
Syntax
Summary
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:
-
rooms0
RoomStructure[]Set 0.
-
rooms1
RoomStructure[]Set 1.
Returns:
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
Syntax
initialize
()
Summary
Method called when Wanaplan is initialized. You don't need to call this method manually.isPointInRooms
Syntax
Summary
Determines if a point is inside the polygon of one of the currently displayed rooms.
Parameters:
-
vector
BABYLON.Vector2The point to test.
Returns:
The room in which the point is located, or null if it is outside every room.
onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
startListening
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
()
Summary
Generic update method, called on every frameProperties
displayRoomMesure
Syntax
displayRoomMesure
Boolean
Summary
Flag to display/hide room measures.
Default: true
displayRoomName
Syntax
displayRoomName
Boolean
Summary
Flag to display/hide room names.
Default: true
externalRooms
Syntax
Summary
Temporary storage of the 2D external rooms.
internalRooms
Syntax
Summary
Temporary storage of the 2D internal rooms.
priority
Syntax
Summary
Priority of the component for update callbacks.
Default: 9
structure
Syntax
structure
wnp.Structure
Summary
Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is saveduseCache
Syntax
Summary
Flag signaling if we can use the previously computed rooms stored in the cache. For speed up purposes.