Corner
Extends:
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 |
adjacentCorners(): Corner[] Gets the adjacent corners that are connected to this corner by walls (Wall). |
|
public |
Attaches an end wall. |
|
public |
attachRoom(room: Room): void |
|
public |
attachStart(wall: Wall) Attaches a start wall. |
|
public |
clearAttachedRooms(): void |
|
public |
combineWithCorner(corner: Corner) 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 |
distanceFromCorner(corner: Corner): Number Gets the distance from a corner. |
|
public |
distanceFromWall(wall: Wall): Number 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 |
getAttachedRooms(): Room[] |
|
public |
getX(): * this method was deprecated.
|
|
public |
getY(): * this method was deprecated.
|
|
public |
isWallConnected(wall: Wall): boolean Checks if a wall is connected. |
|
public |
|
|
public |
Moves corner to new position. |
|
public |
relativeMove(dx: Number, dy: Number) 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 |
Get wall from corner. |
|
public |
Get wall to corner. |
|
public |
wallToOrFrom(corner: Corner): Wall Get wall to or from corner. |
Public Constructors
Public Members
public action_callbacks: * source
public attachedRooms: Array source
Properties:
Name | Type | Attribute | Description |
attachedRooms | Array | Array of rooms that have walls using this corner |
public deleted_callbacks: * source
public floorplan: Floorplan source
Properties:
Name | Type | Attribute | Description |
floorplan | Floorplan | Reference to the model floorplan |
public id: String source
Properties:
Name | Type | Attribute | Description |
id | String | The id of this corner. Autogenerated the first time |
public moved_callbacks: * source
public wallEnds: Array source
Properties:
Name | Type | Attribute | Description |
wallEnds | Array | Array of walls that are end walls |
public wallStarts: Array source
Properties:
Name | Type | Attribute | Description |
wallStarts | Array | Array of walls that are start walls |
public x: Number source
Properties:
Name | Type | Attribute | Description |
x | Number | The position in x dimension |
public y: Number source
Properties:
Name | Type | Attribute | Description |
y | Number | The position in y dimension |
Private Members
Public Methods
public adjacentCorners(): Corner[] source
Gets the adjacent corners that are connected to this corner by walls (Wall).
public attachEnd(wall: Wall) source
Attaches an end wall.
Params:
Name | Type | Attribute | Description |
wall | Wall | A wall. |
public attachRoom(room: Room): void source
Params:
Name | Type | Attribute | Description |
room | Room | The room that should be attached to this corner |
Return:
void |
public attachStart(wall: Wall) source
Attaches a start wall.
Params:
Name | Type | Attribute | Description |
wall | Wall | A wall. |
public combineWithCorner(corner: Corner) source
Get wall from corner.
Params:
Name | Type | Attribute | Description |
corner | Corner | A corner. |
public detachWall(wall: Wall) source
Detaches a wall.
Params:
Name | Type | Attribute | Description |
wall | Wall | A wall. |
public distanceFrom(point: Vector2): Number source
Returns the distance between this corner and a point in 2d space
Params:
Name | Type | Attribute | Description |
point | Vector2 |
public distanceFromCorner(corner: Corner): Number source
Gets the distance from a corner.
Params:
Name | Type | Attribute | Description |
corner | Corner | A corner. |
public distanceFromWall(wall: Wall): Number source
Gets the distance from a wall.
Params:
Name | Type | Attribute | Description |
wall | Wall | A wall. |
public fireAction(action: *) source
Params:
Name | Type | Attribute | Description |
action | * |
public fireOnAction(func: *) source
Add function to action callbacks.
Params:
Name | Type | Attribute | Description |
func | * | The function to be added. |
public fireOnDelete(func: *) source
Add function to deleted callbacks.
Params:
Name | Type | Attribute | Description |
func | * | The function to be added. |
public fireOnMove(func: *) source
Add function to moved callbacks.
Params:
Name | Type | Attribute | Description |
func | * | The function to be added. |
public isWallConnected(wall: Wall): boolean source
Checks if a wall is connected.
Params:
Name | Type | Attribute | Description |
wall | Wall | A wall. |
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:
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:
Name | Type | Attribute | Description |
tolerance | Number | The tolerance value within which it will snap to adjacent corners |
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:
Name | Type | Attribute | Description |
corner | Corner | A corner. |