@novorender/api / DrawModule
Class: DrawModule
Defined in: @novorender/src/measure/modules/draw/module.ts:38
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
Constructor
new DrawModule(
worker,
parent,
drawContext): DrawModule;
Defined in: @novorender/src/measure/modules/draw/module.ts:39
Parameters
Parameter | Type |
---|---|
worker | MeasureWorker |
parent | MeasureView |
drawContext | DrawContext |
Returns
DrawModule
Overrides
BaseModule.constructor
Methods
get2dNormal()
get2dNormal(object, line):
| undefined
| {
normal: ReadonlyVec2;
position: ReadonlyVec2;
};
Defined in: @novorender/src/measure/modules/draw/module.ts:584
returs the 2d normal of the first draw part the line hits
Parameters
Parameter | Type | Description |
---|---|---|
object | DrawProduct | Product with parts |
line | { end : ReadonlyVec2 ; start : ReadonlyVec2 ; } | Line that needs to intersect the product. |
line.end | ReadonlyVec2 | - |
line.start | ReadonlyVec2 | - |
Returns
| undefined
| {
normal
: ReadonlyVec2
;
position
: ReadonlyVec2
;
}
The 2d normal of the drawn object at the intersection of the input line.
getDrawEntity()
getDrawEntity(entity, setting?): Promise<DrawProduct>;
Defined in: @novorender/src/measure/modules/draw/module.ts:166
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
getDrawObjectFromLineSegments()
getDrawObjectFromLineSegments(
segments,
id,
settings?,
context?): undefined | DrawProduct;
Defined in: @novorender/src/measure/modules/draw/module.ts:346
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
getDrawObjectFromPoints()
getDrawObjectFromPoints(
points,
settings?,
context?): undefined | DrawProduct;
Defined in: @novorender/src/measure/modules/draw/module.ts:324
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
getDrawPartsFromPoints()
getDrawPartsFromPoints(
points,
settings?,
objectId?): DrawPart[];
Defined in: @novorender/src/measure/modules/draw/module.ts:207
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
getDrawText()
getDrawText(
points,
text,
context?): undefined | DrawProduct;
Defined in: @novorender/src/measure/modules/draw/module.ts:371
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
getTraceDrawOject()
getTraceDrawOject(
objects,
line,
align?): DrawProduct;
Defined in: @novorender/src/measure/modules/draw/module.ts:394
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.
toMarkerPoints()
toMarkerPoints(points): (undefined | ReadonlyVec2)[];
Defined in: @novorender/src/measure/modules/draw/module.ts:140
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
toScreenSpace()
toScreenSpace(points, round):
| undefined
| {
indicesOnScreen: number[];
points2d: ReadonlyVec2[];
screenPoints: ReadonlyVec2[];
};
Defined in: @novorender/src/measure/modules/draw/module.ts:108
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 |
round | { round? : boolean ; } | Round result coordinates. Default is true |
round.round? | boolean | - |
Returns
| undefined
| {
indicesOnScreen
: number
[];
points2d
: ReadonlyVec2
[];
screenPoints
: ReadonlyVec2
[];
}
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
updateProduct()
updateProduct(drawProduct, context): void;
Defined in: @novorender/src/measure/modules/draw/module.ts:97
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.
Properties
drawContext
readonly drawContext: DrawContext;
Defined in: @novorender/src/measure/modules/draw/module.ts:42
parent
readonly parent: MeasureView;
Defined in: @novorender/src/measure/modules/draw/module.ts:41
Inherited from
BaseModule.parent
worker
readonly worker: MeasureWorker;
Defined in: @novorender/src/measure/modules/draw/module.ts:40
Inherited from
BaseModule.worker