WanaPlan

API Docs for: 2.7.0
Show:

MeasureComponent

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Summary

2D Measures.

Constructor

MeasureComponent

Syntax

MeasureComponent

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

_addOvertureIntersections

Syntax

_addOvertureIntersections

(
  • wall
  • intersections
)
private

Summary

Adds the overtures measures to the existing wall measures.

Parameters:

  • wall WallStructure

    Wall carrying the overtures.

  • intersections BABYLON.Vector2

    Current wall measure points list.

_drawMeasureSlice

Syntax

_drawMeasureSlice

(
  • ctx
  • translation
  • zoom
  • v1
  • v2
)
Number private

Summary

Draws the measure of the distance between two points.

Parameters:

  • ctx CanvasRenderingContext2D

    2D canvas context.

  • translation BABYLON.Vector2

    The canvas translation.

  • zoom Number

    The canvas zoom.

  • v1 BABYLON.Vector2

    Origin point.

  • v2 BABYLON.Vector2

    Ending point.

Returns:

Number:

The rounded value of the measure (in meters).

deleteMeasures

Syntax

deleteMeasures

(
  • measures
)

Summary

Duplicate measures are eliminated

Parameters:

destroy

Inherited from BaseComponent2D:

Syntax

destroy

()

Summary

Method called when the component is destroyed

disable

Inherited from BaseComponent2D:

Syntax

disable

()

Summary

Disables the component

draw

Syntax

draw

(
  • ctx
  • translation
  • zoom
)

Summary

Draws all measures on the canvas.

Parameters:

  • ctx CanvasRenderingContext2D

    The 2D canvas context.

  • translation BABYLON.Vector2

    The canvas translation.

  • zoom Number

    The canvas zoom.

drawTmpWallMesure

Syntax

drawTmpWallMesure

(
  • ctx
  • translation
  • zoom
)
private

Summary

Draws the measure on the wall currently being drawn.

Parameters:

  • ctx CanvasRenderingContext2D

    2D canvas context.

  • translation BABYLON.Vector2

    The canvas translation.

  • zoom Number

    The canvas zoom.

enable

Inherited from BaseComponent2D:

Syntax

enable

()

Summary

Enables the component

getTargeted

Inherited from BaseComponent2D:

Syntax

getTargeted

(
  • vector
)
Object

Summary

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.

initialize

Inherited from BaseComponent2D:

Syntax

initialize

()

Summary

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

mergeMeasures

Syntax

mergeMeasures

(
  • measures
)

Summary

Merges the measures that can be merged (aligned and touching each other)

Parameters:

onContextChanged

Inherited from BaseComponent2D:

Syntax

onContextChanged

(
  • context
)

Summary

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

Parameters:

  • context String
    The new context

startListening

Inherited from BaseComponent2D:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent2D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

update

Inherited from BaseComponent2D:

Syntax

update

()

Summary

Generic update method, called on every frame

Properties

name

Inherited from BaseComponent2D:

Syntax

name

String

Summary

Component name

priority

Inherited from BaseComponent2D:

Syntax

priority

Number

Summary

Priority of the component in the "update" and "draw" routines

structure

Inherited from BaseComponent2D:

Syntax

structure

wnp.Structure

Summary

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