Skip to main content

@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

ParameterType
workerMeasureWorker
parentMeasureView
drawContextDrawContext

Returns

DrawModule

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

ParameterTypeDescription
objectDrawProductProduct with parts
lineobjectLine that needs to intersect the product.
line.endReadonlyVec2-
line.startReadonlyVec2-

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

ParameterTypeDescription
entityDrawableEntitythe entity that is being drawn to screen, this can be any object that furfill the DrawableEntity interface DrawableEntity
setting?MeasureSettingssettings 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

ParameterTypeDescription
segmentsReadonlyVec3[][]Line segments to be added to the list, These can be of any lenght
idnumber-
settings?LinesDrawSetting-
context?DrawContextOptional 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

ParameterTypeDescription
pointsReadonlyVec3[]Set of points describing a polygon or linestrip
settings?LinesDrawSetting-
context?DrawContextOptional 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

ParameterTypeDescription
pointsReadonlyVec3[]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

ParameterTypeDescription
pointsReadonlyVec3[]Set of points for where the text should be placed.
textstringText
context?DrawContextOptional 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

ParameterTypeDescription
objectsDrawProduct[]Products that are being traced.
lineLine2dLine that traces over objects.
align?ReadonlyVec2-

Returns

DrawProduct

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

ParameterTypeDescription
pointsReadonlyVec3[]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

ParameterTypeDescription
pointsReadonlyVec3[]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

ParameterTypeDescription
drawProductDrawProductThe product that will be updated based on current camera.
contextDrawContext-

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

Defined in

@novorender/measure/modules/draw/module.ts:21