require(["esri/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel"], (AreaMeasurement3DViewModel) => { /* code goes here */ });
import AreaMeasurement3DViewModel from "@arcgis/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js";
esri/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel
Provides the logic for the AreaMeasurement3D widget.
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The area measurement analysis object being created or modified by the view model. | AreaMeasurement3DViewModel | ||
The name of the class. | Accessor | ||
The current measurement of the area. | AreaMeasurement3DViewModel | ||
The view model's state. | AreaMeasurement3DViewModel | ||
Unit system (imperial, metric) or specific unit used for displaying the area values. | AreaMeasurement3DViewModel | ||
List of available units and unit systems (imperial, metric) for displaying the area values. | AreaMeasurement3DViewModel | ||
The view from which the widget will operate. | AreaMeasurement3DViewModel |
Property Details
-
analysis
analysis AreaMeasurementAnalysisautocastreadonly
Since: ArcGIS Maps SDK for JavaScript 4.23AreaMeasurement3DViewModel since 4.7, analysis added at 4.23. -
The area 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 an area measurement analysis object outside of the view model const analysis = new AreaMeasurementAnalysis({ geometry: { type: "polygon", // autocasts as new Polygon() rings: [ [-73.9817, 40.7681], [-73.9582, 40.8005], [-73.9495, 40.7968], [-73.9730, 40.7644], [-73.9817, 40.7681] ] } }); // 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 AreaMeasurement3DViewModel({ analysis: analysis, view: view });
-
measurement
measurement Objectreadonly
-
The current measurement of the area.
- Properties
-
mode String
Describes the mode in which the measurement is computed. In
euclidean
mode, the area and perimeter length are computed from a flat polygon with straight segments on the perimeter in the ECEF coordinate system. Ingeodesic
mode, the area and perimeter length are computed from a geodesic polygon on the WGS84 ellipsoid.Possible Values:"euclidean"|"geodesic"
area MeasurementValueArea of the polygon.
perimeterLength MeasurementValuePerimeter length of the polygon.
-
state
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
unit SystemOrAreaUnit
-
Unit system (imperial, metric) or specific unit used for displaying the area values. Possible values are listed in unitOptions.
-
unitOptions
unitOptions SystemOrAreaUnit[]
-
List of available units and unit systems (imperial, metric) for displaying the area values. By default, the following units are included:
metric
,imperial
,square-inches
,square-feet
,square-us-feet
,square-yards
,square-miles
,square-meters
,square-kilometers
,acres
,ares
,hectares
. Possible unit values can only be a subset of this list.
-
view
view SceneView
-
The view from which the widget will operate.
Method Overview
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. | AreaMeasurement3DViewModel | ||
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor | ||
Starts a new measurement. | AreaMeasurement3DViewModel |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor 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();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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.
-
Since: ArcGIS Maps SDK for JavaScript 4.16AreaMeasurement3DViewModel since 4.7, clear added at 4.16. -
Clears the current measurement.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
Since: ArcGIS Maps SDK for JavaScript 4.16AreaMeasurement3DViewModel since 4.7, start added at 4.16. -
Starts a new measurement.
Exampleconst areaMeasurement3DViewModel = new AreaMeasurement3DViewModel({ view: view, unit: "square-meters" }); await areaMeasurement3DViewModel.start();
Type Definitions
-
MeasurementValue
MeasurementValue Object
-
Measurement value.
- Properties
-
text String
Textual representation of the measured value.
state StringState of the measured value.
Value Description available measured value is available unavailable measured value is not available due an incomplete measurement invalid measured value is not available due to an invalid measurement configuration (e.g. self-intersecting polygon)