WanaPlan

API Docs for: 2.7.0
Show:

SubSlopeOvertureComponent2D

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Summary

Manages subslope overtures in 2D.

Constructor

SubSlopeOvertureComponent2D

Syntax

SubSlopeOvertureComponent2D

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

appliedMagnetism

Syntax

appliedMagnetism

(
  • subslopeOV
  • subslope
  • normalVector
  • colVector
)
private

Summary

Puts two overtures at the same height if they are close.

Parameters:

  • subslopeOV SubSlopeOvertureStructure

    The subslope overture selected.

  • subslope SubSlopeStructure

    The subslope of the subslope overture.

  • normalVector BABYLON.Vector2

    The normal vector of the wall of the subslope.

  • colVector BABYLON.Vector2

    A vector colinear to the wall vector.

appliedSideMagnetism

Syntax

appliedSideMagnetism

(
  • subslopeOV
  • subslope
  • normalVector
  • colVector
  • moveVector
)
private

Summary

Applies the magnetism on a side of the overture.

Parameters:

  • subslopeOV SubSlopeOvertureStructure

    The subslope overture selected.

  • subslope SubSlopeStructure

    The subslope of the subslope overture.

  • normalVector BABYLON.Vector2

    The normal vector of the wall of the subslope.

  • colVector BABYLON.Vector2

    A vector colinear to the wall vector.

  • moveVector BABYLON.Vector2

    The movement vector done with the cursor.

calculateDistance

Syntax

calculateDistance

(
  • subslopeOV
  • subslopeOV2
  • Vector
  • number
)
Number private

Summary

Computes the distance on the canvas between two subslope overtures.

Parameters:

  • subslopeOV SubSlopesOvertureStructure

    The 1st overture structure.

  • subslopeOV2 SubSlopesOvertureStructure

    The 2nd overture structure.

  • Vector BABYLON.Vector2

    The vector.

  • number Number

    Check the size we have to change.

Returns:

Number:

The distance between the subslope overture.

changeAddStateSubSlopeOverture

Syntax

changeAddStateSubSlopeOverture

() private

Summary

When the user changes the type of overture, we change the event.

changeAddStateVelux

Syntax

changeAddStateVelux

() private

Summary

When the user changes the type of overture, we change the event.

checkCoherence

Syntax

checkCoherence

(
  • data
)
private

Summary

Checks the size of the overture : Must be positive.

Parameters:

  • data Object

    The size of the subslope overture.

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

(
  • overture
  • ctx
  • translation
  • zoom
  • selected
)
private

Summary

Draws an overture on the subslope.

Parameters:

  • overture SubSlopeOvertureStructure

    The overture which has to be drawn.

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

  • selected Boolean

    The overture is selected or not.

drawCotes

Syntax

drawCotes

(
  • ssOv1
  • ssOv2
  • ctx
  • translation
  • zoom
  • value
)
private

Summary

Draws the distance between 2 overtures.

Parameters:

  • ssOv1 SubSlopeOvertureStructure

    The 1st subslope overture.

  • ssOv2 SubSlopeOvertureStructure

    The second subslope overture.

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

  • value Number

    The value to draw.

drawCotesSS

Syntax

drawCotesSS

(
  • ssOv
  • subslope
  • ctx
  • translation
  • zoom
  • value
  • vector
)
private

Summary

Draws the distance between a subslope overture and the closest side of a subslope.

Parameters:

  • ssOv SubSlopeOvertureStructure

    The subslope overture.

  • subslope SubSlopeStructure

    The subslope of the overture.

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

  • value Number

    The index point of the subslope.

  • vector BABYLON.Vector2

    The vector.

drawMagnetism

Syntax

drawMagnetism

(
  • ssOv1
  • ssOv2
  • ctx
  • translation
  • zoom
)
private

Summary

Draws a line between the positions of 2 overtures with the magnetism.

Parameters:

  • ssOv1 SubSlopeOvertureStructure

    The 1st subslope overture.

  • ssOv2 SubSlopeOvertureStructure

    The second subslope overture.

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

drawTarget

Syntax

drawTarget

(
  • subslopeOverture
  • ctx
  • zoom
)
private

Summary

Draws the target : the subslope overture on the canvas.

Parameters:

  • subslopeOverture SubSlopeOvertureStructure

    The subslope overture structure.

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • zoom Number

    The current zoom of the canvas.

enable

Inherited from BaseComponent2D:

Syntax

enable

()

Summary

Enables the component

getIntersectPoint

Syntax

getIntersectPoint

(
  • subslopeOV
  • subslope
  • Vector
  • number
  • The
)
private

Summary

Returns the point resulting from the intersection of a subslopeOverture and a subslope.

Parameters:

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.

isInSubSlope

Syntax

isInSubSlope

(
  • ssCoord
  • ssOvCoord
)

Summary

Returns true if the given subslope overture is inside the subslope's polygon

Parameters:

  • ssCoord BABYLON.Vector2

    Array of the polygon points of the subslope.

  • ssOvCoord BABYLON.Vector2

    Array of the polygon points of the subslope overture.

isPointInOvertureSide

Syntax

isPointInOvertureSide

(
  • vector
  • overture
)

Summary

Checks if a point is nearby the side of a subslope overture.

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

reorganizeSubslopes

Syntax

reorganizeSubslopes

(
  • ssArray
  • subslope
  • vector
)
private

Summary

Reorganizes the overtures of a subslope.

Parameters:

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

_overture1Magnetism

Syntax

_overture1Magnetism

SubSlopeOvertureStructure[] private

Summary

Dragged subslopeOverture (useful for drawing Magnetism)

_overture2Magnetism

Syntax

_overture2Magnetism

SubSlopeOvertureStructure[] private

Summary

Other subslopeOverture for drawing Magnetism

_targetedAt

Syntax

_targetedAt

Boolean private

Summary

True when an overture is dragged

_targetedAtSide

Syntax

_targetedAtSide

Number private

Summary

The id of the selected side of the subslopeOverture

_tmpOverture

Syntax

_tmpOverture

SubSlopeOvertureStructure[] private

Summary

Temporary overture when adding a new overture

name

Inherited from BaseComponent2D:

Syntax

name

String

Summary

Component name

priority

Inherited from BaseComponent2D

Syntax

priority

Number private

Summary

Priority of the component for update callbacks.

Default: 99

priority

Syntax

priority

Number private

Summary

The state of the SubslopeOverture. 1 if in add mode, 0 otherwise

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

Events

wnp.engine2d.onAddSubSlopeOverture

Syntax

wnp.engine2d.onAddSubSlopeOverture

Summary

Fired when the user requests the addition of a subslopeOverture (click on the button)

wnp.engine2d.onEditSubSlope

Syntax

wnp.engine2d.onEditSubSlope

Summary

Fired when the user enters the subslope edit mode.

wnp.engine2d.onModeSubSlopeEnd

Syntax

wnp.engine2d.onModeSubSlopeEnd

Summary

Fired when the user quits the subslope edit mode.