import DirectLineMeasurement3DViewModel from "@arcgis/core/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js";const DirectLineMeasurement3DViewModel = await $arcgis.import("@arcgis/core/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js");- Inheritance:
- DirectLineMeasurement3DViewModel→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.7
Provides the logic for the DirectLineMeasurement3D widget and component.
- See also
DirectLineMeasurement3D widget - Deprecated since 4.33. Use the Direct Line Measurement 3D component instead.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
declaredClass readonly inherited | ||
measurement readonly | | |
state readonly | "disabled" | "ready" | "measuring" | "measured" | |
| | ||
| | ||
| |
analysis
- 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 modelconst 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 viewview.analyses.add(analysis);
// Frame the analysis in the viewview.goTo(analysis.extent);
// Pass the analysis object as a constructor parameter to modify it using the view modelconst viewModel = new DirectLineMeasurement3DViewModel({ analysis: analysis, view: view}); measurement
- Type
- Measurement | null
The current measurement calculated between the two points.
unit
- Type
- SystemOrLengthUnit
Unit system (imperial, metric) or specific unit used for displaying the distance values. Possible values are listed in unitOptions.
unitOptions
- 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.
Methods
clear
- Signature
-
clear (): void
- Since
- ArcGIS Maps SDK for JavaScript 4.16
Clears the current measurement.
- Returns
- void
Type definitions
MeasurementValue
Measurement value.
state
- Type
- "available" | "unavailable"
State of the measured value.
| Value | Description |
|---|---|
| available | measured value is available |
| unavailable | measured 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
mode
- Type
- MeasurementMode
Describes how the horizontalDistance is computed.
- In
euclideanmode, 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
geodesicmode, the horizontal distance is computed geodetically. This mode is used in scenes with geographic coordinate systems (GCS) and in Web Mercator.
directDistance
- 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
- Type
- MeasurementValue
Horizontal distance between the two points.
verticalDistance
- Type
- MeasurementValue
The elevation difference between the two points.