Home Reference Source
public class | source

Corner

Extends:

three~EventDispatcher → Corner

Corners are used to define Walls.

Constructor Summary

Public Constructor
public

constructor(floorplan: Floorplan, x: Number, y: Number, id: String)

Constructs a corner.

Member Summary

Public Members
public
this member was deprecated. Not in use. The EventDispatcher from threejs is used for emit and listen events
public
public
this member was deprecated. Not in use. The EventDispatcher from threejs is used for emit and listen events
public get
public set
public
public
public
this member was deprecated. Not in use. The EventDispatcher from threejs is used for emit and listen events
public
public
public
public
Private Members
private

Method Summary

Public Methods
public

Gets the adjacent corners that are connected to this corner by walls (Wall).

public

attachEnd(wall: Wall)

Attaches an end wall.

public

attachRoom(room: Room): void

public

attachStart(wall: Wall)

Attaches a start wall.

public
public

Get wall from corner.

public

detachWall(wall: Wall)

Detaches a wall.

public

distanceFrom(point: Vector2): Number

Returns the distance between this corner and a point in 2d space

public

Gets the distance from a corner.

public

Gets the distance from a wall.

public

fireAction(action: *)

public

fireOnAction(func: *)

Add function to action callbacks.

public

fireOnDelete(func: *)

Add function to deleted callbacks.

public

fireOnMove(func: *)

Add function to moved callbacks.

public
public

getX(): *

this method was deprecated.
public

getY(): *

this method was deprecated.
public

Checks if a wall is connected.

public
public

move(newX: Number, newY: Number)

Moves corner to new position.

public

Moves corner relatively to new position.

public

remove()

Dispatches an event when removed from the floorplan(Floorplan) instance.

public

Removes all the connected corners and itself.

public

Ensure we do not have duplicate walls (i.e.

public

snapToAxis(tolerance: Number): Object

public

When a corner is moved from its location it will impact the connected rooms (Room) shape, thus their areas.

public

wallFrom(corner: Corner): Wall

Get wall from corner.

public

wallTo(corner: Corner): Wall

Get wall to corner.

public

Get wall to or from corner.

Public Constructors

public constructor(floorplan: Floorplan, x: Number, y: Number, id: String) source

Constructs a corner.

Params:

NameTypeAttributeDescription
floorplan Floorplan

The associated model floorplan.

x Number

X coordinate.

y Number

Y coordinate.

id String

An optional unique id. If not set, created internally.

Public Members

public action_callbacks: * source

this member was deprecated. Not in use. The EventDispatcher from threejs is used for emit and listen events

public attachedRooms: Array source

Properties:

NameTypeAttributeDescription
attachedRooms Array

Array of rooms that have walls using this corner

public deleted_callbacks: * source

this member was deprecated. Not in use. The EventDispatcher from threejs is used for emit and listen events

public get elevation: Number source

public set elevation: Number source

public floorplan: Floorplan source

Properties:

NameTypeAttributeDescription
floorplan Floorplan

Reference to the model floorplan

public id: String source

Properties:

NameTypeAttributeDescription
id String

The id of this corner. Autogenerated the first time

public moved_callbacks: * source

this member was deprecated. Not in use. The EventDispatcher from threejs is used for emit and listen events

public wallEnds: Array source

Properties:

NameTypeAttributeDescription
wallEnds Array

Array of walls that are end walls

public wallStarts: Array source

Properties:

NameTypeAttributeDescription
wallStarts Array

Array of walls that are start walls

public x: Number source

Properties:

NameTypeAttributeDescription
x Number

The position in x dimension

public y: Number source

Properties:

NameTypeAttributeDescription
y Number

The position in y dimension

Private Members

private _elevation: Number source

Properties:

NameTypeAttributeDescription
_elevation Number

The elevation at this corner

Public Methods

public adjacentCorners(): Corner[] source

Gets the adjacent corners that are connected to this corner by walls (Wall).

Return:

Corner[]

Array of corners.

public attachEnd(wall: Wall) source

Attaches an end wall.

Params:

NameTypeAttributeDescription
wall Wall

A wall.

public attachRoom(room: Room): void source

Params:

NameTypeAttributeDescription
room Room

The room that should be attached to this corner

Return:

void

public attachStart(wall: Wall) source

Attaches a start wall.

Params:

NameTypeAttributeDescription
wall Wall

A wall.

public clearAttachedRooms(): void source

Return:

void

Clear all the rooms attached to this corner

public combineWithCorner(corner: Corner) source

Get wall from corner.

Params:

NameTypeAttributeDescription
corner Corner

A corner.

public detachWall(wall: Wall) source

Detaches a wall.

Params:

NameTypeAttributeDescription
wall Wall

A wall.

public distanceFrom(point: Vector2): Number source

Returns the distance between this corner and a point in 2d space

Params:

NameTypeAttributeDescription
point Vector2

Return:

Number

distance The distance

See:

public distanceFromCorner(corner: Corner): Number source

Gets the distance from a corner.

Params:

NameTypeAttributeDescription
corner Corner

A corner.

Return:

Number

The distance.

public distanceFromWall(wall: Wall): Number source

Gets the distance from a wall.

Params:

NameTypeAttributeDescription
wall Wall

A wall.

Return:

Number

distance The distance.

public fireAction(action: *) source

Params:

NameTypeAttributeDescription
action *

public fireOnAction(func: *) source

Add function to action callbacks.

Params:

NameTypeAttributeDescription
func *

The function to be added.

public fireOnDelete(func: *) source

Add function to deleted callbacks.

Params:

NameTypeAttributeDescription
func *

The function to be added.

public fireOnMove(func: *) source

Add function to moved callbacks.

Params:

NameTypeAttributeDescription
func *

The function to be added.

public getAttachedRooms(): Room[] source

Return:

Room[]

Array of rooms attached to this corner

public getX(): * source

this method was deprecated.

Return:

*

public getY(): * source

this method was deprecated.

Return:

*

public isWallConnected(wall: Wall): boolean source

Checks if a wall is connected.

Params:

NameTypeAttributeDescription
wall Wall

A wall.

Return:

boolean

in case of connection.

public mergeWithIntersected(): boolean source

Return:

boolean

public move(newX: Number, newY: Number) source

Moves corner to new position.

Params:

NameTypeAttributeDescription
newX Number

The new x position.

newY Number

The new y position.

public relativeMove(dx: Number, dy: Number) source

Moves corner relatively to new position.

Params:

NameTypeAttributeDescription
dx Number

The delta x.

dy Number

The delta y.

public remove() source

Dispatches an event when removed from the floorplan(Floorplan) instance. The event object contains reference to this Corner instance as item.

Emit:

EVENT_DELETED

Example:

let corner = new Corner(floorplan, 0, 0);
function cornerRemoved(e) { console.log('I WAS REMOVED FROM LOCATION ', e.item.x, e.item.y) };
corner.remove();

public removeAll() source

Removes all the connected corners and itself. This in essence removes all the walls(Wall) this corner is connected to.

Example:

let corner1 = new Corner(floorplan, 0, 0);
let corner2 = new Corner(floorplan, 10, 0);
function cornerRemoved(e) { console.log('I WAS REMOVED FROM LOCATION ', e.item.x, e.item.y) } //Will log twice for two corners;
corner.removeAll();

public removeDuplicateWalls() source

Ensure we do not have duplicate walls (i.e. same start and end points)

public snapToAxis(tolerance: Number): Object source

Params:

NameTypeAttributeDescription
tolerance Number

The tolerance value within which it will snap to adjacent corners

Return:

Object

snapped Contains keys x and y with true/false values

public updateAttachedRooms() source

When a corner is moved from its location it will impact the connected rooms (Room) shape, thus their areas. This will update the rooms

Example:

let corner = new Corner(floorplan, 0, 0);
corner.move(10, 0);

public wallFrom(corner: Corner): Wall source

Get wall from corner.

Params:

NameTypeAttributeDescription
corner Corner

A corner.

Return:

Wall

The associated wall or null.

public wallTo(corner: Corner): Wall source

Get wall to corner.

Params:

NameTypeAttributeDescription
corner Corner

A corner.

Return:

Wall

The associated wall or null.

public wallToOrFrom(corner: Corner): Wall source

Get wall to or from corner.

Params:

NameTypeAttributeDescription
corner Corner

A corner.

Return:

Wall

The associated wall or null.