@conterra/ct-mapapps-typings 4.19.0-next.20241106050628 → 4.19.0-next.20241108045540

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,11 +81,24 @@ interface EventEmitter<Events> {
81
81
  */
82
82
  emit<Name extends keyof Events>(name: Name, evt: Events[Name]): void;
83
83
  }
84
+ /**
85
+ * Watch event, this matches the apprt-core/Mutable watch interface.
86
+ * @param NameType the type of the name of the event.
87
+ * @param ValueType the type of the value of the event.
88
+ * @see Watchable
89
+ */
84
90
  interface WatchEvent<NameType, ValueType> {
85
91
  value: ValueType;
86
92
  name: NameType;
87
93
  }
94
+ /**
95
+ * Watch callback, informed about watch events.
96
+ */
88
97
  type WatchCallback<NameType, ValueType> = (event: WatchEvent<NameType, ValueType>) => void;
98
+ /**
99
+ * Interface defining a watch method.
100
+ * It matches the apprt-core/Mutable watch interface.
101
+ */
89
102
  interface Watchable<WatchableProperties> {
90
103
  watch<Name extends keyof WatchableProperties>(name: Name, callBack: WatchCallback<Name, WatchableProperties[Name]>): Handle;
91
104
  }
@@ -0,0 +1,70 @@
1
+ import { Watchable } from 'apprt-core/Types';
2
+ import { Polyline, Polygon } from 'esri/geometry';
3
+ import { SystemOrAreaUnit, SystemOrLengthUnit } from 'esri/core/units';
4
+
5
+ type Measurement2DMode = "off" | "area" | "distance";
6
+ type Measurement2DState = "disabled" | "ready" | "measuring" | "measured";
7
+ /**
8
+ * {@link Watchable} properties of {@link Measurement2DModel}.
9
+ */
10
+ interface Measurement2DModelProperties {
11
+ /**
12
+ * Measurement mode.
13
+ */
14
+ readonly mode: Measurement2DMode;
15
+ /**
16
+ * Measurement state.
17
+ */
18
+ readonly state: Measurement2DState;
19
+ /**
20
+ * Measurement unit is either unit system (metric, imperial) or a specific unit.
21
+ * Available if the `mode` is set to `area` or `distance`.
22
+ */
23
+ readonly unit: SystemOrAreaUnit | SystemOrLengthUnit;
24
+ /**
25
+ * Locale specific representation of the length including the unit.
26
+ * Available if the `mode` is set to `distance`.
27
+ */
28
+ readonly distance: string;
29
+ /**
30
+ * Locale specific representation of the area including the unit.
31
+ * Available if the `mode` is set to `area`.
32
+ */
33
+ readonly area: string;
34
+ /**
35
+ * Locale specific representation of the perimeter including the unit.
36
+ * Available if the `mode` is set to `area`.
37
+ */
38
+ readonly perimeter: string;
39
+ /**
40
+ * The measurement geometry.
41
+ * Available if the `mode` is set to `area` or `distance`.
42
+ * If mode is `area`, the geometry is a polygon.
43
+ * If mode is `distance`, the geometry is a polyline.
44
+ */
45
+ readonly geometry: Polyline | Polygon;
46
+ /**
47
+ * Distance always in meters.
48
+ * Available if the `mode` is set to `distance`.
49
+ */
50
+ readonly rawDistance: number;
51
+ /**
52
+ * Area always in square meter.
53
+ * Available if the `mode` is set to `area`.
54
+ */
55
+ readonly rawArea: number;
56
+ /**
57
+ * Perimeter always in meters.
58
+ * Available if the `mode` is set to `area`.
59
+ */
60
+ readonly rawPerimeter: number;
61
+ }
62
+ /**
63
+ * A model, providing access to the current measurement state.
64
+ *
65
+ * See {@link Measurement2DModelProperties} for documentation of class members.
66
+ */
67
+ interface Measurement2DModel extends Measurement2DModelProperties, Watchable<Measurement2DModelProperties> {
68
+ }
69
+
70
+ export type { Measurement2DMode, Measurement2DModel, Measurement2DModelProperties, Measurement2DState };
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "measurement-2d",
3
+ "version": "4.19.0-SNAPSHOT",
4
+ "types": ""
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conterra/ct-mapapps-typings",
3
- "version": "4.19.0-next.20241106050628",
3
+ "version": "4.19.0-next.20241108045540",
4
4
  "description": "TypeDefinitions for ct-mapapps",
5
5
  "author": "conterra",
6
6
  "license": "Apache-2.0"