API Docs for: 2.7.3
Show:

SubSlopeOvertureComponent2D Class

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Manages subslope overtures in 2D.

Constructor

SubSlopeOvertureComponent2D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

appliedMagnetism

(
  • subslopeOV
  • subslope
  • normalVector
  • colVector
)
private

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

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

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

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

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

() private

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

changeAddStateVelux

() private

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

checkCoherence

(
  • data
)
private

Checks the size of the overture : Must be positive.

Parameters:

  • data Object

    The size of the subslope overture.

destroy

()

Inherited from BaseComponent2D:

Method called when the component is destroyed

disable

()

Inherited from BaseComponent2D:

Disables the component

draw

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

Draws an overture on the subslope.

Parameters:

drawCotes

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

Draws the distance between 2 overtures.

Parameters:

drawCotesSS

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

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

Parameters:

drawMagnetism

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

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

Parameters:

drawTarget

(
  • subslopeOverture
  • ctx
  • zoom
)
private

Draws the target : the subslope overture on the canvas.

Parameters:

enable

()

Inherited from BaseComponent2D:

Enables the component

getIntersectPoint

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

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

Parameters:

getTargeted

(
  • vector
)
Object

Inherited from BaseComponent2D:

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:

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

isInSubSlope

(
  • ssCoord
  • ssOvCoord
)

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

(
  • vector
  • overture
)

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

Parameters:

onContextChanged

(
  • context
)

Inherited from BaseComponent2D:

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

Parameters:

  • context String
    The new context

reorganizeSubslopes

(
  • ssArray
  • subslope
  • vector
)
private

Reorganizes the overtures of a subslope.

Parameters:

startListening

()

Inherited from BaseComponent2D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent2D:

Removes all the event listeners.

update

()

Inherited from BaseComponent2D:

Generic update method, called on every frame

Properties

_overture1Magnetism

SubSlopeOvertureStructure[] private

Dragged subslopeOverture (useful for drawing Magnetism)

_overture2Magnetism

SubSlopeOvertureStructure[] private

Other subslopeOverture for drawing Magnetism

_targetedAt

Boolean private

True when an overture is dragged

_targetedAtSide

Number private

The id of the selected side of the subslopeOverture

_tmpOverture

SubSlopeOvertureStructure[] private

Temporary overture when adding a new overture

name

String

Inherited from BaseComponent2D:

Component name

priority

Number private

Inherited from BaseComponent2D

Priority of the component for update callbacks.

Default: 99

priority

Number private

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

structure

wnp.Structure

Inherited from BaseComponent2D:

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

Events

wnp.engine2d.onAddSubSlopeOverture

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

wnp.engine2d.onEditSubSlope

Fired when the user enters the subslope edit mode.

wnp.engine2d.onModeSubSlopeEnd

Fired when the user quits the subslope edit mode.