@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
122 lines (120 loc) • 7.17 kB
TypeScript
import type Point from "../geometry/Point.js";
import type { LengthDimensionMeasureType } from "./Dimension/types.js";
import type { Clonable } from "../core/Clonable.js";
import type { JSONSupportMixin } from "../core/JSONSupport.js";
import type { PointProperties } from "../geometry/Point.js";
export interface LengthDimensionProperties extends Partial<Pick<LengthDimension, "measureType" | "offset" | "orientation">> {
/** Ending point for the dimension. */
endPoint?: PointProperties | null;
/** Starting point for the dimension. */
startPoint?: PointProperties | null;
}
/**
* LengthDimension enables the measurement of linear distances between the specified [start](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#startPoint) and [end](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#endPoint) points.
* Depending on the [measure type](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#measureType), either the direct, horizontal, or vertical distance between these points is measured.
*
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/analysis/dimension-length-measure-type-separate.jpg" alt="length-dimension-measure-types" style="max-width:650px;"/>
*
* Length dimensions can be displayed by adding them to a [DimensionAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionAnalysis/).
*
*
* ```js
* // create the dimension object
* const lengthDimension = new LengthDimension({
* measureType: "vertical",
* startPoint: new Point({
* spatialReference: {
* wkid: 32610
* },
* x: 265,
* y: 24,
* z: 26
* }),
* endPoint: new Point({
* spatialReference: {
* wkid: 32610
* },
* x: 265,
* y: 24,
* z: 38
* }),
* orientation: 90,
* offset: 2
* });
* // create the analysis and add the dimension object to it
* const dimensionAnalysis = new DimensionAnalysis({
* dimensions: [lengthDimension]
* });
* // add the analysis to the view
* view.analyses.add(dimensionAnalysis);
* ```
*
* > [!WARNING]
* >
* > **Known Limitations**
* >
* > Dimensioning is only supported in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
* > Direct and vertical distances are always computed in a Euclidean manner.
* > How horizontal distances are computed depends on the scene's spatial reference:
* > * In geographic coordinate systems (GCS) and in Web Mercator, they are computed geodetically.
* > * In projected coordinate systems (PCS), apart from Web Mercator, they are computed in a Euclidean manner.
* > Vertical and horizontal dimensions can be used to measure distances of up to 100 kilometers. To measure longer distances use the
* > "direct" `measureType` instead.
*
* @since 4.25
* @see [DimensionAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionAnalysis/)
* @see [DimensionSimpleStyle](https://developers.arcgis.com/javascript/latest/references/core/analysis/DimensionSimpleStyle/)
* @see [DimensionLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/DimensionLayer/)
* @see [Sample - Length dimensioning](https://developers.arcgis.com/javascript/latest/sample-code/layers-dimension/)
*/
export default class LengthDimension extends LengthDimensionSuperclass {
constructor(properties?: LengthDimensionProperties);
/** Ending point for the dimension. */
get endPoint(): Point | null | undefined;
set endPoint(value: PointProperties | null | undefined);
/**
* The type of length that should be measured between the [startPoint](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#startPoint) and [endPoint](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#endPoint).
* The `measureType` allows the user to measure either the horizontal distance (delta in xy space),
* vertical distance (elevation difference), or direct distance between the start and end points.
* If either vertical or horizontal mode is used, the [orientation](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#orientation) is not applied
* and the [offset](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#offset) direction is relative to the input points (on a plane derived from them).
*
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/analysis/dimension-length-measure-type.jpg" alt="length-dimension-measure-types" style="max-width:250px;"/>
*
* @default "direct"
*/
accessor measureType: LengthDimensionMeasureType;
/**
* Styling option that controls the shortest distance from the [startPoint](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#startPoint) or [endPoint](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#endPoint) to the dimension line in meters.
*
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/analysis/dimension-length-offset.jpg" alt="length-dimension-offset" style="max-width:250px;"/>
*
* @default 0
*/
accessor offset: number;
/**
* The orientation determines the relative direction the dimension line is extended to.
* It applies only to direct dimensions and when an [offset](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#offset) is specified.
*
* An orientation of 0 extends the [offset](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#offset) upwards, whereas an orientation
* of 90 extends the [offset](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#offset) sideways, to the right side of the dimension when
* viewing from its start point. When the start and end points are vertically aligned,
* increasing the orientation rotates the dimension clockwise relative to compass north.
*
* <img src="https://developers.arcgis.com/javascript/latest/assets/references/core/analysis/dimension-length-orientation.jpg" alt="length-dimension-orientation" style="max-width:500px;"/>
*
* @default 0
*/
accessor orientation: number;
/** Starting point for the dimension. */
get startPoint(): Point | null | undefined;
set startPoint(value: PointProperties | null | undefined);
/**
* Indicates whether the dimension is ready to be computed and interacted with in the view.
* It requires both the [startPoint](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#startPoint) and [endPoint](https://developers.arcgis.com/javascript/latest/references/core/analysis/LengthDimension/#endPoint) to be set.
*
* @since 4.33
*/
get valid(): boolean;
}
declare const LengthDimensionSuperclass: typeof Clonable & typeof JSONSupportMixin