Home Reference Source
public class | source

Floorplan

Extends:

three~EventDispatcher → Floorplan

A Floorplan represents a number of Walls, Corners and Rooms. This is an abstract that keeps the 2d and 3d in sync

Constructor Summary

Public Constructor
public

Constructs a floorplan.

Member Summary

Public Members
public get
public set
public

List of elements of Corner instance

public
public

An Object that stores the metadata of rooms like name

public
this member was deprecated.
public
this member was deprecated.
public
this member was deprecated.
public
this member was deprecated.
public

rooms: Room[]

List of elements of Room instance

public
this member was deprecated.
public

walls: Wall[]

List of elements of Wall instance

Private Members
private

The CarbonSheet that handles the background image to show in the 2D view

Method Summary

Public Methods
public

An internal cleanup method

public

findRooms(corners: Corners[]): Corners[][]

Find the "rooms" in our planar straight-line graph.

public

fireOnNewCorner(callback: *)

public

fireOnNewWall(callback: *)

public

fireOnRedraw(callback: *)

public

fireOnUpdatedRooms(callback: *)

public

floorPlanes(): Mesh[]

Returns all the planes for intersection of the floors in all room

public

getCenter(): Vector2

Returns the center of the floorplan in the y plane

public

Gets the corners.

public

getDimensions(center: boolean): Vector3

Returns the bounding size or the center location of the full floorplan

public

getFloorTexture(uuid: *): *

this method was deprecated.
public

The metadata object with information about the rooms.

public

getRooms(): Room[]

Gets the rooms.

public

getSize(): Vector3

Returns the bounding volume of the full floorplan

public

getWalls(): Wall[]

Gets the walls.

public

loadFloorplan(floorplan: JSON): void

public

Creates a new corner.

public

newWall(start: Corner, end: Corner): Wall

Creates a new wall.

public

Checks existing walls for any intersections they would make.

public

overlappedCorner(x: Number, y: Number, tolerance: Number): Corner

Gets the Corner overlapping the location x, y at a tolerance.

public

Gets the room overlapping the location x, y.

public

overlappedWall(x: Number, y: Number, tolerance: Number): Wall

Gets the Wall overlapping the location x, y at a tolerance.

public

removeCorner(corner: Corner)

Removes a corner.

public

removeWall(wall: Wall)

Removes a wall.

public

reset(): void

Resets the floorplan data to empty

public

roofPlanes(): Mesh[]

Returns the roof planes in the floorplan for intersection testing

public
public

saveFloorplan(): void

public

setFloorTexture(uuid: *, url: *, scale: *)

this method was deprecated.
public

update()

Update the floorplan with new rooms, remove old rooms etc.

public
this method was deprecated.
public

wallEdgePlanes(): Mesh[]

Returns all the planes for intersection for the walls

public

Public Constructors

public constructor() source

Constructs a floorplan.

Public Members

public get carbonSheet: CarbonSheet: * source

Return:

CarbonSheet

_carbonSheet reference to the instance of CarbonSheet

public set carbonSheet(val: CarbonSheet) source

public corners: Corner[] source

List of elements of Corner instance

Properties:

NameTypeAttributeDescription
corners Corner[]

array of corners

public floorTextures: {} source

public metaroomsdata: Object source

An Object that stores the metadata of rooms like name

Properties:

NameTypeAttributeDescription
metaroomsdata Object

stores the metadata of rooms like name

public new_corner_callbacks: *[] source

this member was deprecated.

public new_wall_callbacks: *[] source

this member was deprecated.

public redraw_callbacks: *[] source

this member was deprecated.

public roomLoadedCallbacks: *[] source

this member was deprecated.

public rooms: Room[] source

List of elements of Room instance

Properties:

NameTypeAttributeDescription
walls Room[]

Array of walls

public updated_rooms: *[] source

this member was deprecated.

public walls: Wall[] source

List of elements of Wall instance

Properties:

NameTypeAttributeDescription
walls Wall[]

Array of walls

Private Members

private _carbonSheet: Object source

The CarbonSheet that handles the background image to show in the 2D view

Properties:

NameTypeAttributeDescription
_carbonSheet CarbonSheet

The carbonsheet instance

Public Methods

public assignOrphanEdges() source

An internal cleanup method

public findRooms(corners: Corners[]): Corners[][] source

Find the "rooms" in our planar straight-line graph. Rooms are set of the smallest (by area) possible cycles in this graph. @param corners The corners of the floorplan. @returns The rooms, each room as an array of corners.

Params:

NameTypeAttributeDescription
corners Corners[]

Return:

Corners[][]

loops

public fireOnNewCorner(callback: *) source

Params:

NameTypeAttributeDescription
callback *

public fireOnNewWall(callback: *) source

Params:

NameTypeAttributeDescription
callback *

public fireOnRedraw(callback: *) source

Params:

NameTypeAttributeDescription
callback *

public fireOnUpdatedRooms(callback: *) source

Params:

NameTypeAttributeDescription
callback *

public floorPlanes(): Mesh[] source

Returns all the planes for intersection of the floors in all room

public getCenter(): Vector2 source

Returns the center of the floorplan in the y plane

Return:

Vector2

center

See:

public getCorners(): Corner[] source

Gets the corners.

Return:

Corner[]

public getDimensions(center: boolean): Vector3 source

Returns the bounding size or the center location of the full floorplan

Params:

NameTypeAttributeDescription
center boolean

If true return the center else the size

Return:

Vector3

size

See:

public getFloorTexture(uuid: *): * source

this method was deprecated.

Params:

NameTypeAttributeDescription
uuid *

Return:

*

public getMetaRoomData(): Object source

The metadata object with information about the rooms.

Return:

Object

metaroomdata an object with room corner ids as key and names as values

public getRooms(): Room[] source

Gets the rooms.

Return:

Room[]

public getSize(): Vector3 source

Returns the bounding volume of the full floorplan

Return:

Vector3

size

See:

public getWalls(): Wall[] source

Gets the walls.

Return:

Wall[]

public loadFloorplan(floorplan: JSON): void source

Params:

NameTypeAttributeDescription
floorplan JSON

Return:

void

Emit:

EVENT_LOADED

public newCorner(x: Number, y: Number, id: String): Corner source

Creates a new corner.

Params:

NameTypeAttributeDescription
x Number

The x coordinate.

y Number

The y coordinate.

id String

An optional id. If unspecified, the id will be created internally.

Return:

Corner

The new corner.

public newWall(start: Corner, end: Corner): Wall source

Creates a new wall.

Params:

NameTypeAttributeDescription
start Corner

The start corner.

end Corner

The end corner.

Return:

Wall

The new wall.

public newWallsForIntersections(start: Corner, end: Corner): boolean source

Checks existing walls for any intersections they would make. If there are intersections then introduce new corners and new walls as required at places

Params:

NameTypeAttributeDescription
start Corner
end Corner

Return:

boolean

intersects

public overlappedCorner(x: Number, y: Number, tolerance: Number): Corner source

Gets the Corner overlapping the location x, y at a tolerance.

Params:

NameTypeAttributeDescription
x Number
y Number
tolerance Number

Return:

Corner

public overlappedRoom(mx: Number, my: Number): Room source

Gets the room overlapping the location x, y.

Params:

NameTypeAttributeDescription
mx Number
my Number

Return:

Room

public overlappedWall(x: Number, y: Number, tolerance: Number): Wall source

Gets the Wall overlapping the location x, y at a tolerance.

Params:

NameTypeAttributeDescription
x Number
y Number
tolerance Number

Return:

Wall

public removeCorner(corner: Corner) source

Removes a corner.

Params:

NameTypeAttributeDescription
corner Corner

The corner to be removed.

public removeWall(wall: Wall) source

Removes a wall.

Params:

NameTypeAttributeDescription
wall Wall

The wall to be removed.

public reset(): void source

Resets the floorplan data to empty

Return:

void

public roofPlanes(): Mesh[] source

Returns the roof planes in the floorplan for intersection testing

public roomNameChanged(event: Object) source

Params:

NameTypeAttributeDescription
event Object

Listen:

EVENT_ROOM_NAME_CHANGED

When a room name is changed and updates to metaroomdata

public saveFloorplan(): void source

Return:

void

public setFloorTexture(uuid: *, url: *, scale: *) source

this method was deprecated.

Params:

NameTypeAttributeDescription
uuid *
url *
scale *

public update() source

Update the floorplan with new rooms, remove old rooms etc.

public updateFloorTextures() source

this method was deprecated.

public wallEdgePlanes(): Mesh[] source

Returns all the planes for intersection for the walls

public wallEdges(): HalfEdge[] source

Return:

HalfEdge[]

edges The array of HalfEdge