AreaMeasurement
Class in @bimworks/viewer3d.
API catalogue · @bimworks/viewer3d · Class
class AreaMeasurementInheritance and interfaces#
Members#
| Member | Kind | Description |
|---|---|---|
| constructor | Method | inheritedFrom: Measurement.constructor |
| applicableAreaModes | Method | |
| area | Method | |
| areaMode | Method | Which figure this measurement reports and draws: "gross" (the polygon as it stands), "net" (the openings of the face it was taken from drawn and subtracted) … |
| coordinates | Method | |
| editable | Method | Whether the points of this measurement can be dragged to a new position after it has been finalized (default true). Supported for area, path and point measur… |
| editable | Method | inheritedFrom: Measurement.editable |
| editState | Method | The point being dragged (see editable): its index, whether it moved yet, and the measurement's value before the drag as its label shows it. Null when no poin… |
| finished | Method | inheritedFrom: Measurement.finished |
| holes | Method | The openings of the face this measurement was taken from, empty for a measurement drawn by hand. Each is a closed ring with the same convention as coordinate… |
| hull | Method | The convex hull of the outer ring, empty unless this is a hull measurement. Read-only geometry like the openings: the drag handles stay on the ring the user … |
| hullArea | Method | Whether the convex hull of the ring is drawn and measured instead of the ring itself. Shorthand for areaMode == "hull" |
| id | Method | Get the unique identifier of this measurement inheritedFrom: Measurement.id |
| netArea | Method | Whether the openings are drawn and subtracted from the area. Shorthand for areaMode == "net" |
| normal | Method | |
| pointCount | Method | inheritedFrom: Measurement.pointCount |
| preferredAreaMode | Method | The mode as chosen, which may not be in force (areaMode is the one in force) |
| snapsToVertices | Method | inheritedFrom: Measurement.snapsToVertices |
| canFinish | Method | inheritedFrom: Measurement.canFinish |
| cycleAreaMode | Method | Advance to the next mode that applies here, in the order gross, net, hull. This is what the "toggleAreaHoles" key does |
| getViewFitPoints | Method | inheritedFrom: Measurement.getViewFitPoints |
| isHovered | Method | inheritedFrom: Measurement.isHovered |
| isSelected | Method | inheritedFrom: Measurement.isSelected |
| preferAreaMode | Method | While the measurement is being taken: choose the mode, also one that does not apply yet. It takes effect on the face that is clicked, or once a ring drawn by… |
| remove | Method | inheritedFrom: Measurement.remove |
| selfIntersects | Method | |
| setAreaMode | Method | Put this measurement in one of the three modes |
| setNetArea | Method | Switch between gross and net. Predates the third mode, setAreaMode is the general form |
| undoPoint | Method | Remove the last placed point while this measurement is being taken, see Measuring.undoLastPoint inheritedFrom: Measurement.undoPoint |
constructor#
constructor()inheritedFrom: Measurement.constructor
applicableAreaModes#
Returns#
The modes that change something for this measurement right now, "gross" always among them
area#
public area(): numberReturns#
The enclosed area of the polygon, always in square millimeters. For self-intersecting polygons this is the net (shoelace) area. What is measured follows the mode (see areaMode): the openings are subtracted for a net measurement, the convex hull of the ring is measured for a hull one
areaMode#
Which figure this measurement reports and draws: "gross" (the polygon as it stands), "net" (the openings of the face it was taken from drawn and subtracted) or "hull" (the convex hull of the ring, every concave feature filled in, openings ignored). The setting belongs to this measurement, not to the viewer. It can be cycled with the "toggleAreaHoles" key binding (O by default) while this measurement is being created or while it is the selected one.
The value is what is actually in force: a mode this polygon cannot honour - "net" without openings, "hull" over an already convex ring - reads back as "gross"
Returns#
The mode in force
coordinates#
Returns#
An array of the polygon coordinates. The closing edge is implied, the first coordinate is not repeated at the end. This is the outer ring only, the openings are reported separately by holes
editable#
public editable(): booleanWhether the points of this measurement can be dragged to a new position after it has been finalized (default true). Supported for area, path and point measurements, and for the laser, which is dragged as a whole by its instrument (a click on it selects it instead); the other types have no draggable points. The points show a pointer cursor on hover; while dragging, vertex snapping applies as during measuring (Shift temporarily disables it) and the label (area/length/position) is updated in realtime. Dropping the point fires the committed listener event, Escape cancels the drag
inheritedFrom: Measurement.editable
editable#
public editable(editable: boolean): voidinheritedFrom: Measurement.editable
Parameters#
| Name | Type | Description |
|---|---|---|
editable |
boolean |
editState#
public editState(): { index: number | null; moved: boolean; originalText: string | null } | nullThe point being dragged (see editable): its index, whether it moved yet, and the measurement's value before the drag as its label shows it. Null when no point is dragged. A right-click during the drag puts the point back, like Escape. For a laser, index is the beam end dragged along its beam (0-2 the ends along the axes, 3-5 those opposite), null while it moves as a whole by its instrument; originalText is null
inheritedFrom: Measurement.editState
finished#
public finished(): booleaninheritedFrom: Measurement.finished
Returns#
Whether this measurement is finished
holes#
The openings of the face this measurement was taken from, empty for a measurement drawn by hand. Each is a closed ring with the same convention as coordinates. They have no drag handles: only the outer ring can be edited
Returns#
An array of rings
hull#
The convex hull of the outer ring, empty unless this is a hull measurement. Read-only geometry like the openings: the drag handles stay on the ring the user authored
Returns#
The hull as a closed ring, with the same convention as coordinates
hullArea#
public hullArea(): booleanWhether the convex hull of the ring is drawn and measured instead of the ring itself. Shorthand for areaMode == "hull"
Returns#
Whether this is a hull area measurement
id#
public id(): numberGet the unique identifier of this measurement
inheritedFrom: Measurement.id
netArea#
public netArea(): booleanWhether the openings are drawn and subtracted from the area. Shorthand for areaMode == "net"
Returns#
Whether this is a net area measurement
normal#
Returns#
A copy of the unit normal of the plane the polygon lies in (the face's own normal for a measurement seeded from a face), or null while fewer than 3 non-collinear points have been committed
pointCount#
public pointCount(): numberinheritedFrom: Measurement.pointCount
Returns#
The points placed so far while this measurement is being taken (objects picked, for an object distance)
preferredAreaMode#
The mode as chosen, which may not be in force (areaMode is the one in force)
snapsToVertices#
public snapsToVertices(): booleaninheritedFrom: Measurement.snapsToVertices
Returns#
Whether the points of this measurement snap to vertices and edges (point, length, area, angle)
canFinish#
public canFinish(): booleaninheritedFrom: Measurement.canFinish
Returns#
Whether finish() would complete this measurement now (enough points for a length or an area)
cycleAreaMode#
Advance to the next mode that applies here, in the order gross, net, hull. This is what the "toggleAreaHoles" key does
Returns#
The mode now in force, or null when this measurement has neither openings nor a concave ring and there was nothing to switch to
getViewFitPoints#
inheritedFrom: Measurement.getViewFitPoints
Returns#
The points (viewer measurement coordinates) a camera fit on this measurement encloses, or null when it has none yet
isHovered#
public isHovered(): booleaninheritedFrom: Measurement.isHovered
Returns#
Whether this measurement is hovered
isSelected#
public isSelected(): booleaninheritedFrom: Measurement.isSelected
Returns#
Whether this measurement is selected
preferAreaMode#
While the measurement is being taken: choose the mode, also one that does not apply yet. It takes effect on the face that is clicked, or once a ring drawn by hand turns concave (hull)
Parameters#
| Name | Type | Description |
|---|---|---|
mode |
AreaMode |
Returns#
False for a finished measurement (use setAreaMode) or a value that is not a mode
remove#
public remove(): voidinheritedFrom: Measurement.remove
Returns#
Remove this Measurement
selfIntersects#
public selfIntersects(): booleanReturns#
Whether the polygon self-intersects. The area label is hidden in the 3D view while this is the case
setAreaMode#
Put this measurement in one of the three modes
Parameters#
| Name | Type | Description |
|---|---|---|
mode |
boolean | AreaMode |
The mode, or the boolean that predates the third one (true meaning "net") |
Returns#
False when the mode does not apply here: "net" without openings to subtract, or "hull" over an already convex ring
setNetArea#
public setNetArea(net: boolean): booleanSwitch between gross and net. Predates the third mode, setAreaMode is the general form
Parameters#
| Name | Type | Description |
|---|---|---|
net |
boolean |
Whether the openings should be subtracted |
Returns#
False when there is nothing to subtract, i.e. the face has no openings or the polygon was drawn by hand
undoPoint#
public undoPoint(): booleanRemove the last placed point while this measurement is being taken, see Measuring.undoLastPoint
inheritedFrom: Measurement.undoPoint
Returns#
Whether a point was taken back