Skip to content
import DirectLineMeasurement3DViewModel from "@arcgis/core/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js";
Inheritance:
DirectLineMeasurement3DViewModelAccessor
Since
ArcGIS Maps SDK for JavaScript 4.7

Provides the logic for the DirectLineMeasurement3D widget and component.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
declaredClass
readonly inherited
measurement
readonly
state
readonly
"disabled" | "ready" | "measuring" | "measured"

analysis

autocast Property
Type
DirectLineMeasurementAnalysis
Since
ArcGIS Maps SDK for JavaScript 4.23

The direct line measurement analysis object being created or modified by the view model.

If no analysis is provided, the view model automatically creates its own analysis and adds it to the view. In this case, the analysis will also be automatically removed from the view when the view model is destroyed.

Example
// Construct a direct line measurement analysis object outside of the view model
const analysis = new DirectLineMeasurementAnalysis({
startPoint: {
type: "point", // autocasts as new Point()
x: 7.67,
y: 45.981,
z: 3435.765
},
endPoint: {
type: "point",
x: 7.659,
y: 45.976,
z: 4437
}
});
// Ensure that the analysis is added to the view
view.analyses.add(analysis);
// Frame the analysis in the view
view.goTo(analysis.extent);
// Pass the analysis object as a constructor parameter to modify it using the view model
const viewModel = new DirectLineMeasurement3DViewModel({
analysis: analysis,
view: view
});

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

measurement

readonly Property
Type
Measurement | null

The current measurement calculated between the two points.

state

readonly Property
Type
"disabled" | "ready" | "measuring" | "measured"

The view model's state.

ValueDescription
disablednot ready yet
readyready for measuring
measuringcurrently measuring
measuredmeasuring has finished
Default value
"disabled"

unit

autocast Property
Type
SystemOrLengthUnit

Unit system (imperial, metric) or specific unit used for displaying the distance values. Possible values are listed in unitOptions.

unitOptions

autocast Property
Type
SystemOrLengthUnit[]

List of unit systems (imperial, metric) and specific units for displaying the distance values. By default, the following units are included: metric, imperial, inches, feet, us-feet, yards, miles, nautical-miles, meters, kilometers. Possible unit values can only be a subset of this list.

view

Property
Type
SceneView | null | undefined

The view from which the widget will operate.

Methods

MethodSignatureClass
clear(): void
start(): Promise<void>

clear

Method
Signature
clear (): void
Since
ArcGIS Maps SDK for JavaScript 4.16

Clears the current measurement.

Returns
void

start

Method
Signature
start (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 4.16

Starts a new measurement.

Returns
Promise<void>
Example
const directLineMeasurement3D = new DirectLineMeasurement3D({
view: view,
unit: "kilometers"
});
await directLineMeasurement3D.start();

Type definitions

MeasurementValue

deprecated Type definition

Measurement value.

text

readonly Property
Type
string | null

Textual representation of the measured value.

state

readonly Property
Type
"available" | "unavailable"

State of the measured value.

ValueDescription
availablemeasured value is available
unavailablemeasured value is not available due an incomplete measurement or because the value is not available for the given measurement configuration (e.g. direct distance is unavailable in geodesic mode)

Measurement

deprecated Type definition

mode

readonly Property
Type
MeasurementMode

Describes how the horizontalDistance is computed.

  • In euclidean mode, the horizontal distance is the 2D distance between the two points, computed in a Euclidean manner. This mode is used in scenes with projected coordinate systems (PCS), apart from Web Mercator.
  • In geodesic mode, the horizontal distance is computed geodetically. This mode is used in scenes with geographic coordinate systems (GCS) and in Web Mercator.

directDistance

readonly Property
Type
MeasurementValue

The 3D distance between the two points that is computed in a Euclidean manner. It is only available for distances below 100 kilometers.

horizontalDistance

readonly Property
Type
MeasurementValue

Horizontal distance between the two points.

verticalDistance

readonly Property
Type
MeasurementValue

The elevation difference between the two points.