@novorender/web_app / DrawModule
Class: DrawModule
Module for converting measure data to drawable objects. functions will generally use Camera to object to project the objects to view space
Extends
BaseModule
Constructors
new DrawModule()
new DrawModule(
worker,
parent,
drawContext): DrawModule
Parameters
Parameter | Type |
---|---|
worker | MeasureWorker |
parent | MeasureView |
drawContext | DrawContext |
Returns
Overrides
BaseModule.constructor
Defined in
@novorender/measure/modules/draw/module.ts:21
Methods
get2dNormal()
get2dNormal(object, line): undefined | object
returs the 2d normal of the first draw part the line hits
Parameters
Parameter | Type | Description |
---|---|---|
object | DrawProduct | Product with parts |
line | object | Line that needs to intersect the product. |
line.end | ReadonlyVec2 | - |
line.start | ReadonlyVec2 | - |
Returns
undefined
| object
The 2d normal of the drawn object at the intersection of the input line.
Defined in
@novorender/measure/modules/draw/module.ts:409
getDrawEntity()
getDrawEntity(entity, setting?): Promise<DrawProduct>
Returns a hierarcical structure of the element, describing how it should be drawn in 2d
Parameters
Parameter | Type | Description |
---|---|---|
entity | DrawableEntity | the entity that is being drawn to screen, this can be any object that furfill the DrawableEntity interface DrawableEntity |
setting ? | MeasureSettings | settings on how the entity is supposed to be displayed |
Returns
Promise
<DrawProduct
>
hierarcical structure of the element, describing how it should be drawn in 2d, including labels and angles
Defined in
@novorender/measure/modules/draw/module.ts:131
getDrawObjectFromLineSegments()
getDrawObjectFromLineSegments(
segments,
id,
settings?,
context?): undefined | DrawProduct
Combines multiple segments into a single drawable object.
Parameters
Parameter | Type | Description |
---|---|---|
segments | ReadonlyVec3 [][] | Line segments to be added to the list, These can be of any lenght |
id | number | - |
settings ? | LinesDrawSetting | - |
context ? | DrawContext | Optional to display the drawn object in another context |
Returns
undefined
| DrawProduct
hierarcical structure of the element, describing how it should be drawn in 2d, including labels and angles
Defined in
@novorender/measure/modules/draw/module.ts:262
getDrawObjectFromPoints()
getDrawObjectFromPoints(
points,
settings?,
context?): undefined | DrawProduct
Converts a list of points to a drawable polygon or linestrip
Parameters
Parameter | Type | Description |
---|---|---|
points | ReadonlyVec3 [] | Set of points describing a polygon or linestrip |
settings ? | LinesDrawSetting | - |
context ? | DrawContext | Optional to display the drawn object in another context |
Returns
undefined
| DrawProduct
hierarcical structure of the element, describing how it should be drawn in 2d, including labels and angles
Defined in
@novorender/measure/modules/draw/module.ts:244
getDrawPartsFromPoints()
getDrawPartsFromPoints(
points,
settings?,
objectId?): DrawPart[]
Converts a list of points to draw parts, these can be added to a DrawObjects.
Parameters
Parameter | Type | Description |
---|---|---|
points | ReadonlyVec3 [] | Set of points describing a polygon or linestrip |
settings ? | LinesDrawSetting | - |
objectId ? | number | - |
Returns
DrawPart
[]
hierarcical structure of the element, describing how it should be drawn in 2d, including labels and angles
Defined in
@novorender/measure/modules/draw/module.ts:168
getDrawText()
getDrawText(
points,
text,
context?): undefined | DrawProduct
Returns a draw object that places a text based on input points.
Parameters
Parameter | Type | Description |
---|---|---|
points | ReadonlyVec3 [] | Set of points for where the text should be placed. |
text | string | Text |
context ? | DrawContext | Optional to display the drawn object in another context |
Returns
undefined
| DrawProduct
Draw product for displaying the text at chosen locations
Defined in
@novorender/measure/modules/draw/module.ts:283
getTraceDrawOject()
getTraceDrawOject(
objects,
line,
align?): DrawProduct
Returns a draw object that traces intersection between the 2d paths and displays the 3d distance as a label
Parameters
Parameter | Type | Description |
---|---|---|
objects | DrawProduct [] | Products that are being traced. |
line | Line2d | Line that traces over objects. |
align ? | ReadonlyVec2 | - |
Returns
Draw product for displaying lines between intersections and distance labels.
Defined in
@novorender/measure/modules/draw/module.ts:302
toMarkerPoints()
toMarkerPoints(points): (undefined | ReadonlyVec2)[]
Converts world space points to on screen space points
Parameters
Parameter | Type | Description |
---|---|---|
points | ReadonlyVec3 [] | World space points that will be projected to screen space |
Returns
(undefined
| ReadonlyVec2
)[]
Screen space points regadless if they are within the current canvas size
Deprecated
use view.convert.worldSpaceToScreenSpace instead
Defined in
@novorender/measure/modules/draw/module.ts:105
toScreenSpace()
toScreenSpace(points): undefined | object
Converts world space lines to on screen space lines
Parameters
Parameter | Type | Description |
---|---|---|
points | ReadonlyVec3 [] | World space points that will be projected to screen space |
Returns
undefined
| object
Screen space points, a path that will cut to the edge of the screen, points2d, all the points in 2d space regadless if they are within the current canvas size and the original points removed from screen points
Defined in
@novorender/measure/modules/draw/module.ts:84
updateProduct()
updateProduct(drawProduct, context): void
Updates the input draw objects with new 2d info based on camera properties
Parameters
Parameter | Type | Description |
---|---|---|
drawProduct | DrawProduct | The product that will be updated based on current camera. |
context | DrawContext | - |
Returns
void
Corresponding 3D position at the view plane in world space, or undefined if there is no active render context.
Defined in
@novorender/measure/modules/draw/module.ts:74
Properties
drawContext
readonly drawContext: DrawContext;
Defined in
@novorender/measure/modules/draw/module.ts:21
parent
readonly parent: MeasureView;
Inherited from
BaseModule.parent
Defined in
@novorender/measure/modules/draw/module.ts:21
worker
readonly worker: MeasureWorker;
Inherited from
BaseModule.worker