SubSlopeOvertureComponent2D
Summary
Manages subslope overtures in 2D.
Constructor
SubSlopeOvertureComponent2D
Syntax
SubSlopeOvertureComponent2D
-
core
Summary
Parameters:
-
coreCoreThe main engine.
Item Index
Methods
- appliedMagnetism
- appliedSideMagnetism
- calculateDistance
- changeAddStateSubSlopeOverture
- changeAddStateVelux
- checkCoherence
- destroy
- disable
- draw
- drawCotes
- drawCotesSS
- drawMagnetism
- drawTarget
- enable
- getIntersectPoint
- getTargeted
- initialize
- isInSubSlope
- isPointInOvertureSide
- onContextChanged
- reorganizeSubslopes
- startListening
- stopListening
- update
Properties
Methods
appliedMagnetism
Syntax
appliedMagnetism
-
subslopeOV -
subslope -
normalVector -
colVector
Summary
Puts two overtures at the same height if they are close.
Parameters:
-
subslopeOVSubSlopeOvertureStructureThe subslope overture selected.
-
subslopeSubSlopeStructureThe subslope of the subslope overture.
-
normalVectorBABYLON.Vector2The normal vector of the wall of the subslope.
-
colVectorBABYLON.Vector2A vector colinear to the wall vector.
appliedSideMagnetism
Syntax
appliedSideMagnetism
-
subslopeOV -
subslope -
normalVector -
colVector -
moveVector
Summary
Applies the magnetism on a side of the overture.
Parameters:
-
subslopeOVSubSlopeOvertureStructureThe subslope overture selected.
-
subslopeSubSlopeStructureThe subslope of the subslope overture.
-
normalVectorBABYLON.Vector2The normal vector of the wall of the subslope.
-
colVectorBABYLON.Vector2A vector colinear to the wall vector.
-
moveVectorBABYLON.Vector2The movement vector done with the cursor.
calculateDistance
Syntax
Summary
Computes the distance on the canvas between two subslope overtures.
Parameters:
-
subslopeOVSubSlopesOvertureStructureThe 1st overture structure.
-
subslopeOV2SubSlopesOvertureStructureThe 2nd overture structure.
-
VectorBABYLON.Vector2The vector.
-
numberNumberCheck the size we have to change.
Returns:
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
Summary
Checks the size of the overture : Must be positive.
Parameters:
-
dataObjectThe size of the subslope overture.
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentdraw
Syntax
draw
-
overture -
ctx -
translation -
zoom -
selected
Summary
Draws an overture on the subslope.
Parameters:
-
overtureSubSlopeOvertureStructureThe overture which has to be drawn.
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
-
selectedBooleanThe overture is selected or not.
drawCotes
Syntax
drawCotes
-
ssOv1 -
ssOv2 -
ctx -
translation -
zoom -
value
Summary
Draws the distance between 2 overtures.
Parameters:
-
ssOv1SubSlopeOvertureStructureThe 1st subslope overture.
-
ssOv2SubSlopeOvertureStructureThe second subslope overture.
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
-
valueNumberThe value to draw.
drawCotesSS
Syntax
drawCotesSS
-
ssOv -
subslope -
ctx -
translation -
zoom -
value -
vector
Summary
Draws the distance between a subslope overture and the closest side of a subslope.
Parameters:
-
ssOvSubSlopeOvertureStructureThe subslope overture.
-
subslopeSubSlopeStructureThe subslope of the overture.
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
-
valueNumberThe index point of the subslope.
-
vectorBABYLON.Vector2The vector.
drawMagnetism
Syntax
drawMagnetism
-
ssOv1 -
ssOv2 -
ctx -
translation -
zoom
Summary
Draws a line between the positions of 2 overtures with the magnetism.
Parameters:
-
ssOv1SubSlopeOvertureStructureThe 1st subslope overture.
-
ssOv2SubSlopeOvertureStructureThe second subslope overture.
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
drawTarget
Syntax
drawTarget
-
subslopeOverture -
ctx -
zoom
Summary
Draws the target : the subslope overture on the canvas.
Parameters:
-
subslopeOvertureSubSlopeOvertureStructureThe subslope overture structure.
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
zoomNumberThe current zoom of the canvas.
enable
Syntax
enable
()
Summary
Enables the componentgetIntersectPoint
Syntax
getIntersectPoint
-
subslopeOV -
subslope -
Vector -
number -
The
Summary
Returns the point resulting from the intersection of a subslopeOverture and a subslope.
Parameters:
-
subslopeOVSubSlopeOvertureStructureThe overture structure.
-
subslopeSubSlopeStructureThe subslope.
-
VectorBABYLON.Vector2The vector.
-
numberNumberCheck the size we have to change.
-
TheBABYLON.Vector2intersection.
getTargeted
Syntax
Summary
Finds out if the given position is over an element handled by the componentParameters:
-
vectorVectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
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:
-
ssCoordBABYLON.Vector2Array of the polygon points of the subslope.
-
ssOvCoordBABYLON.Vector2Array 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:
-
vectorBABYLON.Vector2Involved point.
-
overtureSubSlopeOvertureStructureThe subslope overture structure.
onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
contextStringThe new context
reorganizeSubslopes
Syntax
reorganizeSubslopes
-
ssArray -
subslope -
vector
Summary
Reorganizes the overtures of a subslope.
Parameters:
-
ssArraySubSlopeOvertureStructure[]Array of all the overtures of a subslope.
-
subslopeSubSlopeStructureThe subslope.
-
vectorBABYLON.Vector2The vector of the wall.
startListening
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
()
Summary
Generic update method, called on every frameProperties
_overture1Magnetism
Syntax
Summary
Dragged subslopeOverture (useful for drawing Magnetism)
_overture2Magnetism
Syntax
Summary
Other subslopeOverture for drawing Magnetism
_targetedAtSide
Syntax
Summary
The id of the selected side of the subslopeOverture
_tmpOverture
Syntax
Summary
Temporary overture when adding a new overture
priority
Syntax
Summary
Priority of the component for update callbacks.
Default: 99
priority
Syntax
Summary
The state of the SubslopeOverture. 1 if in add mode, 0 otherwise
structure
Syntax
structure
wnp.Structure
Summary
Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is savedEvents
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.