DirectLineMeasurement3DViewModel

AMD: require(["esri/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel"], (DirectLineMeasurement3DViewModel) => { /* code goes here */ });
ESM: import DirectLineMeasurement3DViewModel from "@arcgis/core/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js";
Class: esri/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel
Inheritance: DirectLineMeasurement3DViewModel Accessor
Since: ArcGIS Maps SDK for JavaScript 4.7

Provides the logic for the DirectLineMeasurement3D widget.

See also

Constructors

DirectLineMeasurement3DViewModel

Constructor
new DirectLineMeasurement3DViewModel(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

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

DirectLineMeasurement3DViewModel

The name of the class.

Accessor

The current measurement calculated between the two points.

DirectLineMeasurement3DViewModel

The view model's state.

DirectLineMeasurement3DViewModel

Unit system (imperial, metric) or specific unit used for displaying the distance values.

DirectLineMeasurement3DViewModel

List of unit systems (imperial, metric) and specific units for displaying the distance values.

DirectLineMeasurement3DViewModel

The view from which the widget will operate.

DirectLineMeasurement3DViewModel

Property Details

analysis

Property
analysis DirectLineMeasurementAnalysisautocastreadonly
Since: ArcGIS Maps SDK for JavaScript 4.23 DirectLineMeasurement3DViewModel since 4.7, analysis added at 4.23.

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

This property can be set during view model construction, to provide an existing analysis to the view model for modification. Properties on the analysis can also be updated once it's assigned to the view model.

If no analysis is provided during view model construction, 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

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

measurement

Property
measurement Objectreadonly

The current measurement calculated between the two points.

Properties
mode String

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.

Possible Values:"euclidean"|"geodesic"

directDistance 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 MeasurementValue

The 2D distance between the two points.

verticalDistance MeasurementValue

The elevation difference between the two points.

state

Property
state Stringreadonly

The view model's state.

Value Description
disabled not ready yet
ready ready for measuring
measuring currently measuring
measured measuring has finished

Possible Values:"disabled" |"ready" |"measuring" |"measured"

Default Value:disabled

unit

Property
unit SystemOrLengthUnit

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

unitOptions

Property
unitOptions 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
view SceneView

The view from which the widget will operate.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

Clears the current measurement.

DirectLineMeasurement3DViewModel

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Starts a new measurement.

DirectLineMeasurement3DViewModel

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 4.25.

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

clear

Method
clear()
Since: ArcGIS Maps SDK for JavaScript 4.16 DirectLineMeasurement3DViewModel since 4.7, clear added at 4.16.

Clears the current measurement.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 4.25.

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 4.25.

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

start

Method
start()
Since: ArcGIS Maps SDK for JavaScript 4.16 DirectLineMeasurement3DViewModel since 4.7, start added at 4.16.

Starts a new measurement.

Example
const directLineMeasurement3D = new DirectLineMeasurement3D({
  view: view,
  unit: "kilometers"
});

await directLineMeasurement3D.start();

Type Definitions

MeasurementValue

Type Definition
MeasurementValue Object

Measurement value.

Properties
text String

Textual representation of the measured value.

state String

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)

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.