@vcmap/viewshed 4.0.0 → 4.1.0
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.
- package/CHANGELOG.md +4 -0
- package/README.md +49 -0
- package/dist/index.js +679 -594
- package/package.json +6 -7
- package/src/callbacks/activateViewshedCallback.ts +57 -0
- package/src/callbacks/deactivateViewshedCallback.ts +26 -0
- package/src/index.ts +84 -25
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -17,3 +17,52 @@ To add and configure the plugin add an entry with name @vcmap/viewshed to the ma
|
|
|
17
17
|
| tools | `Array<'cone' \| '360'>` | `['cone', '360']` | The tools/modes that should be added to the map. |
|
|
18
18
|
| shadowColor | `string` | `#3333331A` | The color of areas that **can not** be seen from the "viewers" position |
|
|
19
19
|
| visibleColor | `string` | `FF990080` | The color of areas that **can** be seen from the "viewers" position |
|
|
20
|
+
|
|
21
|
+
## Callbacks
|
|
22
|
+
|
|
23
|
+
The Viewshed plugin registers two [VcsCallbacks](https://github.com/virtualcitySYSTEMS/map-ui/blob/main/documentation/CALLBACKS.md) that can be used in guided tours, splash screens, or any other callback-driven feature.
|
|
24
|
+
|
|
25
|
+
### ActivateViewshedCallback
|
|
26
|
+
|
|
27
|
+
Activates the Viewshed plugin and optionally sets the mode and viewshed to display.
|
|
28
|
+
|
|
29
|
+
| property | type | description |
|
|
30
|
+
| --------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| m | `'create' \| 'view' \| 'edit' \| 'move'` | The mode to activate the plugin in. Defaults to `create`, which starts the map interaction for placing a viewshed. |
|
|
32
|
+
| cv | `ViewshedOptions` | Optional viewshed to display. Required for `view` and `edit` modes. |
|
|
33
|
+
| cv.viewshedType | `'cone' \| '360'` | The type of viewshed to use. |
|
|
34
|
+
| cv.position | `[number, number, number]` | Position of the viewshed in WGS84 coordinates `[longitude, latitude, height]`. |
|
|
35
|
+
| cv.orientation | `{ heading, pitch, roll }` | Heading, pitch and roll of the viewshed, in radians (cone type only). |
|
|
36
|
+
| cv.heightOffset | `number` | Height offset added to the Z value of the position. |
|
|
37
|
+
|
|
38
|
+
Minimal example — opens the create interaction for a cone viewshed:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"type": "ActivateViewshedCallback"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
A full example displaying an existing viewshed in edit mode:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"type": "ActivateViewshedCallback",
|
|
51
|
+
"m": "edit",
|
|
52
|
+
"cv": {
|
|
53
|
+
"viewshedType": "cone",
|
|
54
|
+
"position": [13.4, 52.5, 50],
|
|
55
|
+
"orientation": { "heading": 0.78, "pitch": -0.17, "roll": 0 }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### DeactivateViewshedCallback
|
|
61
|
+
|
|
62
|
+
Deactivates the Viewshed tool.
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"type": "DeactivateViewshedCallback"
|
|
67
|
+
}
|
|
68
|
+
```
|