@signalk/freeboard-sk 2.0.0-beta.2 → 2.0.0-beta.3

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.
Files changed (148) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/package.json +23 -19
  3. package/public/825.1f150975e9b76d8a.js +1 -0
  4. package/public/assets/help/img/settings_course.png +0 -0
  5. package/public/assets/help/index.html +31 -6
  6. package/public/assets/img/alarms/weather.png +0 -0
  7. package/public/index.html +2 -2
  8. package/public/main.5c6ba1b2f2e8677e.js +1 -0
  9. package/public/polyfills.12ddee7e4cb46a02.js +1 -0
  10. package/public/runtime.f37695a1bd6595d8.js +1 -0
  11. package/public/styles.a0bf4282aea78b28.css +1 -0
  12. package/dist/fb-openlayers/README.md +0 -17
  13. package/dist/fb-openlayers/bundles/fb-openlayers.umd.js +0 -4884
  14. package/dist/fb-openlayers/bundles/fb-openlayers.umd.js.map +0 -1
  15. package/dist/fb-openlayers/esm2015/fb-openlayers.js +0 -5
  16. package/dist/fb-openlayers/esm2015/index.js +0 -92
  17. package/dist/fb-openlayers/esm2015/lib/alarms/layer-anchor-alarm.component.js +0 -136
  18. package/dist/fb-openlayers/esm2015/lib/alarms/layer-cpa-alarm.component.js +0 -135
  19. package/dist/fb-openlayers/esm2015/lib/content.component.js +0 -16
  20. package/dist/fb-openlayers/esm2015/lib/control.component.js +0 -37
  21. package/dist/fb-openlayers/esm2015/lib/controls.directive.js +0 -61
  22. package/dist/fb-openlayers/esm2015/lib/interactions/interaction-draw.component.js +0 -72
  23. package/dist/fb-openlayers/esm2015/lib/interactions/interaction-modify.component.js +0 -72
  24. package/dist/fb-openlayers/esm2015/lib/interactions.directive.js +0 -61
  25. package/dist/fb-openlayers/esm2015/lib/layer.component.js +0 -157
  26. package/dist/fb-openlayers/esm2015/lib/map.component.js +0 -206
  27. package/dist/fb-openlayers/esm2015/lib/map.service.js +0 -70
  28. package/dist/fb-openlayers/esm2015/lib/models.js +0 -37
  29. package/dist/fb-openlayers/esm2015/lib/navigation/layer-arrival-circle.component.js +0 -116
  30. package/dist/fb-openlayers/esm2015/lib/navigation/layer-bearing-line.component.js +0 -229
  31. package/dist/fb-openlayers/esm2015/lib/navigation/layer-xte-path.component.js +0 -120
  32. package/dist/fb-openlayers/esm2015/lib/overlay.component.js +0 -56
  33. package/dist/fb-openlayers/esm2015/lib/resources/layer-charts.component.js +0 -141
  34. package/dist/fb-openlayers/esm2015/lib/resources/layer-notes.component.js +0 -177
  35. package/dist/fb-openlayers/esm2015/lib/resources/layer-regions.component.js +0 -184
  36. package/dist/fb-openlayers/esm2015/lib/resources/layer-resourceset.component.js +0 -226
  37. package/dist/fb-openlayers/esm2015/lib/resources/layer-routes.component.js +0 -188
  38. package/dist/fb-openlayers/esm2015/lib/resources/layer-sktarget-tracks.component.js +0 -213
  39. package/dist/fb-openlayers/esm2015/lib/resources/layer-sktargets.component.js +0 -269
  40. package/dist/fb-openlayers/esm2015/lib/resources/layer-skvessels.component.js +0 -410
  41. package/dist/fb-openlayers/esm2015/lib/resources/layer-tracks.component.js +0 -175
  42. package/dist/fb-openlayers/esm2015/lib/resources/layer-waypoints.component.js +0 -238
  43. package/dist/fb-openlayers/esm2015/lib/util.js +0 -124
  44. package/dist/fb-openlayers/esm2015/lib/vessel/layer-vessel-trail.component.js +0 -178
  45. package/dist/fb-openlayers/esm2015/lib/vessel/layer-vessel.component.js +0 -229
  46. package/dist/fb-openlayers/esm2015/lib/view.directive.js +0 -141
  47. package/dist/fb-openlayers/fb-openlayers.d.ts +0 -5
  48. package/dist/fb-openlayers/fb-openlayers.d.ts.map +0 -1
  49. package/dist/fb-openlayers/fb-openlayers.metadata.json +0 -1
  50. package/dist/fb-openlayers/fesm2015/fb-openlayers.js +0 -4326
  51. package/dist/fb-openlayers/fesm2015/fb-openlayers.js.map +0 -1
  52. package/dist/fb-openlayers/index.d.ts +0 -33
  53. package/dist/fb-openlayers/index.d.ts.map +0 -1
  54. package/dist/fb-openlayers/index.ngfactory.d.ts.map +0 -1
  55. package/dist/fb-openlayers/lib/alarms/layer-anchor-alarm.component.d.ts +0 -44
  56. package/dist/fb-openlayers/lib/alarms/layer-anchor-alarm.component.d.ts.map +0 -1
  57. package/dist/fb-openlayers/lib/alarms/layer-anchor-alarm.component.ngfactory.d.ts.map +0 -1
  58. package/dist/fb-openlayers/lib/alarms/layer-cpa-alarm.component.d.ts +0 -39
  59. package/dist/fb-openlayers/lib/alarms/layer-cpa-alarm.component.d.ts.map +0 -1
  60. package/dist/fb-openlayers/lib/alarms/layer-cpa-alarm.component.ngfactory.d.ts.map +0 -1
  61. package/dist/fb-openlayers/lib/content.component.d.ts +0 -6
  62. package/dist/fb-openlayers/lib/content.component.d.ts.map +0 -1
  63. package/dist/fb-openlayers/lib/content.component.ngfactory.d.ts.map +0 -1
  64. package/dist/fb-openlayers/lib/control.component.d.ts +0 -14
  65. package/dist/fb-openlayers/lib/control.component.d.ts.map +0 -1
  66. package/dist/fb-openlayers/lib/control.component.ngfactory.d.ts.map +0 -1
  67. package/dist/fb-openlayers/lib/controls.directive.d.ts +0 -14
  68. package/dist/fb-openlayers/lib/controls.directive.d.ts.map +0 -1
  69. package/dist/fb-openlayers/lib/controls.directive.ngfactory.d.ts.map +0 -1
  70. package/dist/fb-openlayers/lib/interactions/interaction-draw.component.d.ts +0 -27
  71. package/dist/fb-openlayers/lib/interactions/interaction-draw.component.d.ts.map +0 -1
  72. package/dist/fb-openlayers/lib/interactions/interaction-draw.component.ngfactory.d.ts.map +0 -1
  73. package/dist/fb-openlayers/lib/interactions/interaction-modify.component.d.ts +0 -26
  74. package/dist/fb-openlayers/lib/interactions/interaction-modify.component.d.ts.map +0 -1
  75. package/dist/fb-openlayers/lib/interactions/interaction-modify.component.ngfactory.d.ts.map +0 -1
  76. package/dist/fb-openlayers/lib/interactions.directive.d.ts +0 -14
  77. package/dist/fb-openlayers/lib/interactions.directive.d.ts.map +0 -1
  78. package/dist/fb-openlayers/lib/interactions.directive.ngfactory.d.ts.map +0 -1
  79. package/dist/fb-openlayers/lib/layer.component.d.ts +0 -41
  80. package/dist/fb-openlayers/lib/layer.component.d.ts.map +0 -1
  81. package/dist/fb-openlayers/lib/layer.component.ngfactory.d.ts.map +0 -1
  82. package/dist/fb-openlayers/lib/map.component.d.ts +0 -71
  83. package/dist/fb-openlayers/lib/map.component.d.ts.map +0 -1
  84. package/dist/fb-openlayers/lib/map.component.ngfactory.d.ts.map +0 -1
  85. package/dist/fb-openlayers/lib/map.component.scss.shim.ngstyle.d.ts.map +0 -1
  86. package/dist/fb-openlayers/lib/map.service.d.ts +0 -19
  87. package/dist/fb-openlayers/lib/map.service.d.ts.map +0 -1
  88. package/dist/fb-openlayers/lib/map.service.ngfactory.d.ts.map +0 -1
  89. package/dist/fb-openlayers/lib/models.d.ts +0 -42
  90. package/dist/fb-openlayers/lib/models.d.ts.map +0 -1
  91. package/dist/fb-openlayers/lib/navigation/layer-arrival-circle.component.d.ts +0 -39
  92. package/dist/fb-openlayers/lib/navigation/layer-arrival-circle.component.d.ts.map +0 -1
  93. package/dist/fb-openlayers/lib/navigation/layer-arrival-circle.component.ngfactory.d.ts.map +0 -1
  94. package/dist/fb-openlayers/lib/navigation/layer-bearing-line.component.d.ts +0 -49
  95. package/dist/fb-openlayers/lib/navigation/layer-bearing-line.component.d.ts.map +0 -1
  96. package/dist/fb-openlayers/lib/navigation/layer-bearing-line.component.ngfactory.d.ts.map +0 -1
  97. package/dist/fb-openlayers/lib/navigation/layer-xte-path.component.d.ts +0 -39
  98. package/dist/fb-openlayers/lib/navigation/layer-xte-path.component.d.ts.map +0 -1
  99. package/dist/fb-openlayers/lib/navigation/layer-xte-path.component.ngfactory.d.ts.map +0 -1
  100. package/dist/fb-openlayers/lib/overlay.component.d.ts +0 -25
  101. package/dist/fb-openlayers/lib/overlay.component.d.ts.map +0 -1
  102. package/dist/fb-openlayers/lib/overlay.component.ngfactory.d.ts.map +0 -1
  103. package/dist/fb-openlayers/lib/resources/layer-charts.component.d.ts +0 -20
  104. package/dist/fb-openlayers/lib/resources/layer-charts.component.d.ts.map +0 -1
  105. package/dist/fb-openlayers/lib/resources/layer-charts.component.ngfactory.d.ts.map +0 -1
  106. package/dist/fb-openlayers/lib/resources/layer-notes.component.d.ts +0 -51
  107. package/dist/fb-openlayers/lib/resources/layer-notes.component.d.ts.map +0 -1
  108. package/dist/fb-openlayers/lib/resources/layer-notes.component.ngfactory.d.ts.map +0 -1
  109. package/dist/fb-openlayers/lib/resources/layer-regions.component.d.ts +0 -53
  110. package/dist/fb-openlayers/lib/resources/layer-regions.component.d.ts.map +0 -1
  111. package/dist/fb-openlayers/lib/resources/layer-regions.component.ngfactory.d.ts.map +0 -1
  112. package/dist/fb-openlayers/lib/resources/layer-resourceset.component.d.ts +0 -49
  113. package/dist/fb-openlayers/lib/resources/layer-resourceset.component.d.ts.map +0 -1
  114. package/dist/fb-openlayers/lib/resources/layer-resourceset.component.ngfactory.d.ts.map +0 -1
  115. package/dist/fb-openlayers/lib/resources/layer-routes.component.d.ts +0 -52
  116. package/dist/fb-openlayers/lib/resources/layer-routes.component.d.ts.map +0 -1
  117. package/dist/fb-openlayers/lib/resources/layer-routes.component.ngfactory.d.ts.map +0 -1
  118. package/dist/fb-openlayers/lib/resources/layer-sktarget-tracks.component.d.ts +0 -44
  119. package/dist/fb-openlayers/lib/resources/layer-sktarget-tracks.component.d.ts.map +0 -1
  120. package/dist/fb-openlayers/lib/resources/layer-sktarget-tracks.component.ngfactory.d.ts.map +0 -1
  121. package/dist/fb-openlayers/lib/resources/layer-sktargets.component.d.ts +0 -51
  122. package/dist/fb-openlayers/lib/resources/layer-sktargets.component.d.ts.map +0 -1
  123. package/dist/fb-openlayers/lib/resources/layer-sktargets.component.ngfactory.d.ts.map +0 -1
  124. package/dist/fb-openlayers/lib/resources/layer-skvessels.component.d.ts +0 -60
  125. package/dist/fb-openlayers/lib/resources/layer-skvessels.component.d.ts.map +0 -1
  126. package/dist/fb-openlayers/lib/resources/layer-skvessels.component.ngfactory.d.ts.map +0 -1
  127. package/dist/fb-openlayers/lib/resources/layer-tracks.component.d.ts +0 -50
  128. package/dist/fb-openlayers/lib/resources/layer-tracks.component.d.ts.map +0 -1
  129. package/dist/fb-openlayers/lib/resources/layer-tracks.component.ngfactory.d.ts.map +0 -1
  130. package/dist/fb-openlayers/lib/resources/layer-waypoints.component.d.ts +0 -57
  131. package/dist/fb-openlayers/lib/resources/layer-waypoints.component.d.ts.map +0 -1
  132. package/dist/fb-openlayers/lib/resources/layer-waypoints.component.ngfactory.d.ts.map +0 -1
  133. package/dist/fb-openlayers/lib/util.d.ts +0 -19
  134. package/dist/fb-openlayers/lib/util.d.ts.map +0 -1
  135. package/dist/fb-openlayers/lib/vessel/layer-vessel-trail.component.d.ts +0 -45
  136. package/dist/fb-openlayers/lib/vessel/layer-vessel-trail.component.d.ts.map +0 -1
  137. package/dist/fb-openlayers/lib/vessel/layer-vessel-trail.component.ngfactory.d.ts.map +0 -1
  138. package/dist/fb-openlayers/lib/vessel/layer-vessel.component.d.ts +0 -55
  139. package/dist/fb-openlayers/lib/vessel/layer-vessel.component.d.ts.map +0 -1
  140. package/dist/fb-openlayers/lib/vessel/layer-vessel.component.ngfactory.d.ts.map +0 -1
  141. package/dist/fb-openlayers/lib/view.directive.d.ts +0 -44
  142. package/dist/fb-openlayers/lib/view.directive.d.ts.map +0 -1
  143. package/dist/fb-openlayers/lib/view.directive.ngfactory.d.ts.map +0 -1
  144. package/public/53.4babe18f9baabeea.js +0 -1
  145. package/public/main.a668c86ee67ed842.js +0 -1
  146. package/public/polyfills.1ba4e1a897c69e24.js +0 -1
  147. package/public/runtime.55118010dbcb6e60.js +0 -1
  148. package/public/styles.f013b594260c141e.css +0 -1
@@ -1,4884 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ol/interaction'), require('ol'), require('ol/proj'), require('ol/proj/proj4.js'), require('proj4'), require('rxjs'), require('ol/Overlay'), require('ol/control'), require('ol/View'), require('ol/layer/Image'), require('ol/layer/Tile'), require('ol/layer/VectorTile'), require('ol/source/VectorTile'), require('ol/source'), require('ol/layer/Vector'), require('ol/source/Vector'), require('ol/layer/Tile.js'), require('ol/source/OSM.js'), require('ol/geom/GeometryType'), require('ol/style'), require('ol/geom'), require('ol/format')) :
3
- typeof define === 'function' && define.amd ? define('fb-openlayers', ['exports', '@angular/core', 'ol/interaction', 'ol', 'ol/proj', 'ol/proj/proj4.js', 'proj4', 'rxjs', 'ol/Overlay', 'ol/control', 'ol/View', 'ol/layer/Image', 'ol/layer/Tile', 'ol/layer/VectorTile', 'ol/source/VectorTile', 'ol/source', 'ol/layer/Vector', 'ol/source/Vector', 'ol/layer/Tile.js', 'ol/source/OSM.js', 'ol/geom/GeometryType', 'ol/style', 'ol/geom', 'ol/format'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['fb-openlayers'] = {}, global.ng.core, global.interaction, global.ol, global.proj, global.proj4_js, global.proj4, global.rxjs, global.Overlay, global.control, global.View, global.ImageLayer, global.TileLayer$1, global.VectorTileLayer, global.VectorTileSource, global.source, global.VectorLayer, global.VectorSource, global.TileLayer, global.OSM, global.GeometryType, global.style, global.geom, global.format));
5
- }(this, (function (exports, i0, interaction, ol, proj, proj4_js, proj4, rxjs, Overlay, control, View, ImageLayer, TileLayer$1, VectorTileLayer, VectorTileSource, source, VectorLayer, VectorSource, TileLayer, OSM, GeometryType, style, geom, format) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () {
19
- return e[k];
20
- }
21
- });
22
- }
23
- });
24
- }
25
- n['default'] = e;
26
- return Object.freeze(n);
27
- }
28
-
29
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
- var proj4__default = /*#__PURE__*/_interopDefaultLegacy(proj4);
31
- var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
32
- var View__default = /*#__PURE__*/_interopDefaultLegacy(View);
33
- var ImageLayer__default = /*#__PURE__*/_interopDefaultLegacy(ImageLayer);
34
- var TileLayer__default$1 = /*#__PURE__*/_interopDefaultLegacy(TileLayer$1);
35
- var VectorTileLayer__default = /*#__PURE__*/_interopDefaultLegacy(VectorTileLayer);
36
- var VectorTileSource__default = /*#__PURE__*/_interopDefaultLegacy(VectorTileSource);
37
- var VectorLayer__default = /*#__PURE__*/_interopDefaultLegacy(VectorLayer);
38
- var VectorSource__default = /*#__PURE__*/_interopDefaultLegacy(VectorSource);
39
- var TileLayer__default = /*#__PURE__*/_interopDefaultLegacy(TileLayer);
40
- var OSM__default = /*#__PURE__*/_interopDefaultLegacy(OSM);
41
- var GeometryType__default = /*#__PURE__*/_interopDefaultLegacy(GeometryType);
42
-
43
- /*! *****************************************************************************
44
- Copyright (c) Microsoft Corporation.
45
-
46
- Permission to use, copy, modify, and/or distribute this software for any
47
- purpose with or without fee is hereby granted.
48
-
49
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
51
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
53
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
- PERFORMANCE OF THIS SOFTWARE.
56
- ***************************************************************************** */
57
- /* global Reflect, Promise */
58
- var extendStatics = function (d, b) {
59
- extendStatics = Object.setPrototypeOf ||
60
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
61
- function (d, b) { for (var p in b)
62
- if (Object.prototype.hasOwnProperty.call(b, p))
63
- d[p] = b[p]; };
64
- return extendStatics(d, b);
65
- };
66
- function __extends(d, b) {
67
- if (typeof b !== "function" && b !== null)
68
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
69
- extendStatics(d, b);
70
- function __() { this.constructor = d; }
71
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
72
- }
73
- var __assign = function () {
74
- __assign = Object.assign || function __assign(t) {
75
- for (var s, i = 1, n = arguments.length; i < n; i++) {
76
- s = arguments[i];
77
- for (var p in s)
78
- if (Object.prototype.hasOwnProperty.call(s, p))
79
- t[p] = s[p];
80
- }
81
- return t;
82
- };
83
- return __assign.apply(this, arguments);
84
- };
85
- function __rest(s, e) {
86
- var t = {};
87
- for (var p in s)
88
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
89
- t[p] = s[p];
90
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
91
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
92
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
93
- t[p[i]] = s[p[i]];
94
- }
95
- return t;
96
- }
97
- function __decorate(decorators, target, key, desc) {
98
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
99
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
100
- r = Reflect.decorate(decorators, target, key, desc);
101
- else
102
- for (var i = decorators.length - 1; i >= 0; i--)
103
- if (d = decorators[i])
104
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
105
- return c > 3 && r && Object.defineProperty(target, key, r), r;
106
- }
107
- function __param(paramIndex, decorator) {
108
- return function (target, key) { decorator(target, key, paramIndex); };
109
- }
110
- function __metadata(metadataKey, metadataValue) {
111
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
112
- return Reflect.metadata(metadataKey, metadataValue);
113
- }
114
- function __awaiter(thisArg, _arguments, P, generator) {
115
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
116
- return new (P || (P = Promise))(function (resolve, reject) {
117
- function fulfilled(value) { try {
118
- step(generator.next(value));
119
- }
120
- catch (e) {
121
- reject(e);
122
- } }
123
- function rejected(value) { try {
124
- step(generator["throw"](value));
125
- }
126
- catch (e) {
127
- reject(e);
128
- } }
129
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
130
- step((generator = generator.apply(thisArg, _arguments || [])).next());
131
- });
132
- }
133
- function __generator(thisArg, body) {
134
- var _ = { label: 0, sent: function () { if (t[0] & 1)
135
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
136
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
137
- function verb(n) { return function (v) { return step([n, v]); }; }
138
- function step(op) {
139
- if (f)
140
- throw new TypeError("Generator is already executing.");
141
- while (_)
142
- try {
143
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
144
- return t;
145
- if (y = 0, t)
146
- op = [op[0] & 2, t.value];
147
- switch (op[0]) {
148
- case 0:
149
- case 1:
150
- t = op;
151
- break;
152
- case 4:
153
- _.label++;
154
- return { value: op[1], done: false };
155
- case 5:
156
- _.label++;
157
- y = op[1];
158
- op = [0];
159
- continue;
160
- case 7:
161
- op = _.ops.pop();
162
- _.trys.pop();
163
- continue;
164
- default:
165
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
166
- _ = 0;
167
- continue;
168
- }
169
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
170
- _.label = op[1];
171
- break;
172
- }
173
- if (op[0] === 6 && _.label < t[1]) {
174
- _.label = t[1];
175
- t = op;
176
- break;
177
- }
178
- if (t && _.label < t[2]) {
179
- _.label = t[2];
180
- _.ops.push(op);
181
- break;
182
- }
183
- if (t[2])
184
- _.ops.pop();
185
- _.trys.pop();
186
- continue;
187
- }
188
- op = body.call(thisArg, _);
189
- }
190
- catch (e) {
191
- op = [6, e];
192
- y = 0;
193
- }
194
- finally {
195
- f = t = 0;
196
- }
197
- if (op[0] & 5)
198
- throw op[1];
199
- return { value: op[0] ? op[1] : void 0, done: true };
200
- }
201
- }
202
- var __createBinding = Object.create ? (function (o, m, k, k2) {
203
- if (k2 === undefined)
204
- k2 = k;
205
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
206
- }) : (function (o, m, k, k2) {
207
- if (k2 === undefined)
208
- k2 = k;
209
- o[k2] = m[k];
210
- });
211
- function __exportStar(m, o) {
212
- for (var p in m)
213
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
214
- __createBinding(o, m, p);
215
- }
216
- function __values(o) {
217
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
218
- if (m)
219
- return m.call(o);
220
- if (o && typeof o.length === "number")
221
- return {
222
- next: function () {
223
- if (o && i >= o.length)
224
- o = void 0;
225
- return { value: o && o[i++], done: !o };
226
- }
227
- };
228
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
229
- }
230
- function __read(o, n) {
231
- var m = typeof Symbol === "function" && o[Symbol.iterator];
232
- if (!m)
233
- return o;
234
- var i = m.call(o), r, ar = [], e;
235
- try {
236
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
237
- ar.push(r.value);
238
- }
239
- catch (error) {
240
- e = { error: error };
241
- }
242
- finally {
243
- try {
244
- if (r && !r.done && (m = i["return"]))
245
- m.call(i);
246
- }
247
- finally {
248
- if (e)
249
- throw e.error;
250
- }
251
- }
252
- return ar;
253
- }
254
- /** @deprecated */
255
- function __spread() {
256
- for (var ar = [], i = 0; i < arguments.length; i++)
257
- ar = ar.concat(__read(arguments[i]));
258
- return ar;
259
- }
260
- /** @deprecated */
261
- function __spreadArrays() {
262
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
263
- s += arguments[i].length;
264
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
265
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
266
- r[k] = a[j];
267
- return r;
268
- }
269
- function __spreadArray(to, from) {
270
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
271
- to[j] = from[i];
272
- return to;
273
- }
274
- function __await(v) {
275
- return this instanceof __await ? (this.v = v, this) : new __await(v);
276
- }
277
- function __asyncGenerator(thisArg, _arguments, generator) {
278
- if (!Symbol.asyncIterator)
279
- throw new TypeError("Symbol.asyncIterator is not defined.");
280
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
281
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
282
- function verb(n) { if (g[n])
283
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
284
- function resume(n, v) { try {
285
- step(g[n](v));
286
- }
287
- catch (e) {
288
- settle(q[0][3], e);
289
- } }
290
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
291
- function fulfill(value) { resume("next", value); }
292
- function reject(value) { resume("throw", value); }
293
- function settle(f, v) { if (f(v), q.shift(), q.length)
294
- resume(q[0][0], q[0][1]); }
295
- }
296
- function __asyncDelegator(o) {
297
- var i, p;
298
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
299
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
300
- }
301
- function __asyncValues(o) {
302
- if (!Symbol.asyncIterator)
303
- throw new TypeError("Symbol.asyncIterator is not defined.");
304
- var m = o[Symbol.asyncIterator], i;
305
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
306
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
307
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
308
- }
309
- function __makeTemplateObject(cooked, raw) {
310
- if (Object.defineProperty) {
311
- Object.defineProperty(cooked, "raw", { value: raw });
312
- }
313
- else {
314
- cooked.raw = raw;
315
- }
316
- return cooked;
317
- }
318
- ;
319
- var __setModuleDefault = Object.create ? (function (o, v) {
320
- Object.defineProperty(o, "default", { enumerable: true, value: v });
321
- }) : function (o, v) {
322
- o["default"] = v;
323
- };
324
- function __importStar(mod) {
325
- if (mod && mod.__esModule)
326
- return mod;
327
- var result = {};
328
- if (mod != null)
329
- for (var k in mod)
330
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
331
- __createBinding(result, mod, k);
332
- __setModuleDefault(result, mod);
333
- return result;
334
- }
335
- function __importDefault(mod) {
336
- return (mod && mod.__esModule) ? mod : { default: mod };
337
- }
338
- function __classPrivateFieldGet(receiver, state, kind, f) {
339
- if (kind === "a" && !f)
340
- throw new TypeError("Private accessor was defined without a getter");
341
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
342
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
343
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
344
- }
345
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
346
- if (kind === "m")
347
- throw new TypeError("Private method is not writable");
348
- if (kind === "a" && !f)
349
- throw new TypeError("Private accessor was defined without a setter");
350
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
351
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
352
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
353
- }
354
-
355
- var MapService = /** @class */ (function () {
356
- function MapService() {
357
- this.maps = [];
358
- }
359
- /**
360
- * Retrieves all the maps
361
- */
362
- MapService.prototype.getMaps = function () {
363
- return this.maps;
364
- };
365
- /**
366
- * Returns a map object from the maps array
367
- */
368
- MapService.prototype.getMapById = function (id) {
369
- var map = null;
370
- for (var i = 0; i < this.maps.length; i++) {
371
- if (this.maps[i].getTarget() === id) {
372
- map = this.maps[i];
373
- break;
374
- }
375
- }
376
- return map;
377
- };
378
- MapService.prototype.getLayerByKey = function (key, value) {
379
- var tl;
380
- this.maps.forEach(function (map) {
381
- map.getLayers().forEach(function (layer) {
382
- if (layer.get(key) === value) {
383
- tl = layer;
384
- }
385
- });
386
- });
387
- return tl;
388
- };
389
- MapService.prototype.addMap = function (map) {
390
- this.maps.push(map);
391
- };
392
- MapService.prototype.updateSize = function () {
393
- this.maps.forEach(function (map) {
394
- map.updateSize();
395
- });
396
- };
397
- MapService.prototype.addProj4 = function (epsg, proj4Def, extent) {
398
- var projection = proj.get(epsg);
399
- if (!projection) {
400
- proj4__default['default'].defs(epsg, proj4Def);
401
- proj4_js.register(proj4__default['default']);
402
- projection = proj.get(epsg);
403
- if (extent) {
404
- projection.setExtent(extent);
405
- }
406
- }
407
- if (!projection) {
408
- console.error("Failed to register " + epsg + " projection in OpenLayers");
409
- }
410
- };
411
- return MapService;
412
- }());
413
- MapService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function MapService_Factory() { return new MapService(); }, token: MapService, providedIn: "root" });
414
- MapService.decorators = [
415
- { type: i0.Injectable, args: [{
416
- providedIn: 'root'
417
- },] }
418
- ];
419
- MapService.ctorParameters = function () { return []; };
420
-
421
- var MapComponent = /** @class */ (function () {
422
- function MapComponent(changeDetectorRef, element, mapService) {
423
- var _this = this;
424
- this.changeDetectorRef = changeDetectorRef;
425
- this.element = element;
426
- this.mapService = mapService;
427
- /**
428
- * This event is triggered after the map is initialized
429
- * Use this to have access to the maps and some helper functions
430
- */
431
- this.mapReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
432
- /**
433
- * This event is triggered after the user clicks on the map.
434
- * A true single click with no dragging and no double click.
435
- * Note that this event is delayed by 250 ms to ensure that it is not a double click.
436
- */
437
- this.mapClick = new i0.EventEmitter();
438
- this.mapSingleClick = new i0.EventEmitter();
439
- this.mapDblClick = new i0.EventEmitter();
440
- this.mapMoveStart = new i0.EventEmitter();
441
- this.mapMoveEnd = new i0.EventEmitter();
442
- this.mapPointerDrag = new i0.EventEmitter();
443
- this.mapPointerMove = new i0.EventEmitter();
444
- this.mapPostCompose = new i0.EventEmitter();
445
- this.mapPostRender = new i0.EventEmitter();
446
- this.mapPreCompose = new i0.EventEmitter();
447
- this.mapPropertyChange = new i0.EventEmitter();
448
- this.setFocus = false;
449
- this.hitTolerance = 5;
450
- // Only arrow function works with addEventListener
451
- this.emitClickEvent = function (event) {
452
- _this.mapClick.emit(_this.augmentClickEvent(event));
453
- };
454
- this.emitSingleClickEvent = function (event) {
455
- _this.mapSingleClick.emit(_this.augmentClickEvent(event));
456
- };
457
- this.emitDblClickEvent = function (event) {
458
- _this.mapDblClick.emit(_this.augmentClickEvent(event));
459
- };
460
- this.emitMoveStartEvent = function (event) {
461
- _this.mapMoveStart.emit(_this.augmentMoveEvent(event));
462
- };
463
- this.emitMoveEndEvent = function (event) {
464
- _this.mapMoveEnd.emit(_this.augmentMoveEvent(event));
465
- };
466
- this.emitPointerDragEvent = function (event) {
467
- _this.mapPointerDrag.emit(_this.augmentPointerEvent(event));
468
- };
469
- this.emitPointerMoveEvent = function (event) {
470
- _this.mapPointerMove.emit(_this.augmentPointerEvent(event));
471
- };
472
- this.emitPostComposeEvent = function (event) { return _this.mapPostCompose.emit(event); };
473
- this.emitPostRenderEvent = function (event) { return _this.mapPostRender.emit(event); };
474
- this.emitPreComposeEvent = function (event) { return _this.mapPreCompose.emit(event); };
475
- this.emitPropertyChangeEvent = function (event) { return _this.mapPropertyChange.emit(event); };
476
- this.updateSizeThrottle = function () {
477
- clearTimeout(_this.timeoutId);
478
- _this.timeoutId = setTimeout(function () {
479
- _this.map.updateSize();
480
- }, 100);
481
- };
482
- this.changeDetectorRef.detach();
483
- }
484
- MapComponent.prototype.ngOnInit = function () {
485
- var _this = this;
486
- var target = this.element.nativeElement.firstElementChild;
487
- this.map = new ol.Map(this);
488
- this.map.setTarget(target);
489
- this.map.setProperties(this.properties, true);
490
- // register the map in the injectable mapService
491
- this.mapService.addMap(this.map);
492
- this.map.once('postrender', function (event) {
493
- _this.afterMapReady();
494
- });
495
- };
496
- MapComponent.prototype.ngOnDestroy = function () {
497
- this.map.un('singleclick', this.emitSingleClickEvent);
498
- this.map.un('dblclick', this.emitDblClickEvent);
499
- this.map.un('click', this.emitClickEvent);
500
- this.map.un('movestart', this.emitMoveStartEvent);
501
- this.map.un('moveend', this.emitMoveEndEvent);
502
- this.map.un('pointerdrag', this.emitPointerDragEvent);
503
- this.map.un('pointermove', this.emitPointerMoveEvent);
504
- this.map.un('postcompose', this.emitPostComposeEvent);
505
- this.map.un('postrender', this.emitPostRenderEvent);
506
- this.map.un('precompose', this.emitPreComposeEvent);
507
- this.map.un('propertychange', this.emitPropertyChangeEvent);
508
- window.removeEventListener('resize', this.updateSizeThrottle);
509
- window.removeEventListener('orientationchange', this.updateSizeThrottle);
510
- this.map.setTarget(null);
511
- this.map = null;
512
- };
513
- MapComponent.prototype.ngOnChanges = function (changes) {
514
- if (this.map && typeof changes.setFocus !== 'undefined') {
515
- if (changes.setFocus.currentValue) {
516
- this.focusMap();
517
- }
518
- }
519
- };
520
- MapComponent.prototype.afterMapReady = function () {
521
- // register map events
522
- this.map.on('singleclick', this.emitSingleClickEvent);
523
- this.map.on('dblclick', this.emitDblClickEvent);
524
- this.map.on('click', this.emitClickEvent);
525
- this.map.on('movestart', this.emitMoveStartEvent);
526
- this.map.on('moveend', this.emitMoveEndEvent);
527
- this.map.on('pointerdrag', this.emitPointerDragEvent);
528
- this.map.on('pointermove', this.emitPointerMoveEvent);
529
- this.map.on('postcompose', this.emitPostComposeEvent);
530
- this.map.on('postrender', this.emitPostRenderEvent);
531
- this.map.on('precompose', this.emitPreComposeEvent);
532
- this.map.on('propertychange', this.emitPropertyChangeEvent);
533
- // react on window events
534
- window.addEventListener('resize', this.updateSizeThrottle, false);
535
- window.addEventListener('orientationchange', this.updateSizeThrottle, false);
536
- this.updateSize();
537
- this.mapReady.next({ map: this.map, mapService: this.mapService });
538
- this.mapReady.complete();
539
- if (this.setFocus) {
540
- this.focusMap();
541
- }
542
- };
543
- MapComponent.prototype.focusMap = function () {
544
- this.element.nativeElement.firstElementChild.focus();
545
- };
546
- MapComponent.prototype.getMap = function () {
547
- return this.map;
548
- };
549
- MapComponent.prototype.updateSize = function () {
550
- this.updateSizeThrottle();
551
- };
552
- MapComponent.prototype.getMapCenter = function () {
553
- if (!this.map) {
554
- return [0, 0];
555
- }
556
- return proj.toLonLat(this.map.getView().getCenter());
557
- };
558
- MapComponent.prototype.getMapExtent = function () {
559
- if (!this.map) {
560
- return [0, 0, 0, 0];
561
- }
562
- var v = this.map.getView();
563
- var mrid = v.getProjection().getCode();
564
- return proj.transformExtent(v.calculateExtent(this.map.getSize()), mrid, 'EPSG:4326');
565
- };
566
- // ** add {lonlat, features}fields to event
567
- MapComponent.prototype.augmentClickEvent = function (event) {
568
- return Object.assign(event, {
569
- features: this.map.getFeaturesAtPixel(event.pixel, { hitTolerance: this.hitTolerance }),
570
- lonlat: proj.toLonLat(event.coordinate)
571
- });
572
- };
573
- // ** add {lonlat, zoom, extent, projection code} fields to event
574
- MapComponent.prototype.augmentMoveEvent = function (event) {
575
- return Object.assign(event, {
576
- lonlat: this.getMapCenter(),
577
- zoom: this.map.getView().getZoom(),
578
- extent: this.getMapExtent(),
579
- projCode: this.map.getView().getProjection().getCode()
580
- });
581
- };
582
- // ** add {lonlat} field to event
583
- MapComponent.prototype.augmentPointerEvent = function (event) {
584
- return Object.assign(event, { lonlat: proj.toLonLat(event.coordinate) });
585
- };
586
- return MapComponent;
587
- }());
588
- MapComponent.decorators = [
589
- { type: i0.Component, args: [{
590
- selector: 'ol-map',
591
- template: "\n <div style=\"width: 100%; height: 100%; margin: 0; padding: 0; touch-action: none;\" tabindex=-1>\n </div><ng-content></ng-content>\n ",
592
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
593
- styles: [".ol-box{box-sizing:border-box;border-radius:2px;border:2px solid blue}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-step-marker{width:1px;height:15px;background-color:#000;float:right;z-Index:10}.ol-scale-step-text{bottom:-5px;font-size:12px;z-Index:11}.ol-scale-step-text,.ol-scale-text{position:absolute;color:#000;text-shadow:-2px 0 #fff,0 2px #fff,2px 0 #fff,0 -2px #fff}.ol-scale-text{font-size:14px;text-align:center;bottom:25px}.ol-scale-singlebar{position:relative;height:10px;z-Index:9;box-sizing:border-box;border:1px solid #000}.ol-unsupported{display:none}.ol-unselectable,.ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:grab}.ol-control{position:absolute;background-color:hsla(0,0%,100%,.4);border-radius:4px;padding:2px}.ol-control:hover{background-color:hsla(0,0%,100%,.6)}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:focus,.ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em)}.ol-attribution ul{margin:0;padding:0 .5em;color:#000;text-shadow:0 0 2px #fff}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:\" \"}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button,.ol-attribution ul{display:inline-block}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:hsla(0,0%,100%,.8)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:inline-block}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:hsla(0,0%,100%,.8)}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}"]
594
- },] }
595
- ];
596
- MapComponent.ctorParameters = function () { return [
597
- { type: i0.ChangeDetectorRef },
598
- { type: i0.ElementRef },
599
- { type: MapService }
600
- ]; };
601
- MapComponent.propDecorators = {
602
- mapReady: [{ type: i0.Output }],
603
- mapClick: [{ type: i0.Output }],
604
- mapSingleClick: [{ type: i0.Output }],
605
- mapDblClick: [{ type: i0.Output }],
606
- mapMoveStart: [{ type: i0.Output }],
607
- mapMoveEnd: [{ type: i0.Output }],
608
- mapPointerDrag: [{ type: i0.Output }],
609
- mapPointerMove: [{ type: i0.Output }],
610
- mapPostCompose: [{ type: i0.Output }],
611
- mapPostRender: [{ type: i0.Output }],
612
- mapPreCompose: [{ type: i0.Output }],
613
- mapPropertyChange: [{ type: i0.Output }],
614
- pixelRatio: [{ type: i0.Input }],
615
- keyboardEventTarget: [{ type: i0.Input }],
616
- logo: [{ type: i0.Input }],
617
- properties: [{ type: i0.Input }],
618
- setFocus: [{ type: i0.Input }],
619
- hitTolerance: [{ type: i0.Input }]
620
- };
621
-
622
- var InteractionsDirective = /** @class */ (function () {
623
- function InteractionsDirective(changeDetectorRef, mapComponent) {
624
- this.changeDetectorRef = changeDetectorRef;
625
- this.mapComponent = mapComponent;
626
- this.interactions = [];
627
- this.interactionList = {
628
- dragpan: interaction.DragPan,
629
- dragrotate: interaction.DragRotate,
630
- dragzoom: interaction.DragZoom,
631
- doubleclickzoom: interaction.DoubleClickZoom,
632
- keyboardpan: interaction.KeyboardPan,
633
- keyboardzoom: interaction.KeyboardZoom,
634
- mousewheelzoom: interaction.MouseWheelZoom,
635
- pinchzoom: interaction.PinchZoom
636
- };
637
- this.changeDetectorRef.detach();
638
- }
639
- Object.defineProperty(InteractionsDirective.prototype, "olInteractions", {
640
- set: function (value) {
641
- this.interactions = value;
642
- this.setInteractions();
643
- },
644
- enumerable: false,
645
- configurable: true
646
- });
647
- InteractionsDirective.prototype.ngOnInit = function () {
648
- this.setInteractions();
649
- };
650
- InteractionsDirective.prototype.setInteractions = function () {
651
- var e_1, _a;
652
- var map = this.mapComponent.getMap();
653
- if (undefined !== map) {
654
- map.getInteractions().clear();
655
- if (!this.interactions || this.interactions.length < 0)
656
- return;
657
- try {
658
- for (var _b = __values(this.interactions), _c = _b.next(); !_c.done; _c = _b.next()) {
659
- var config = _c.value;
660
- this.addInteraction(map, config);
661
- }
662
- }
663
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
664
- finally {
665
- try {
666
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
667
- }
668
- finally { if (e_1) throw e_1.error; }
669
- }
670
- this.changeDetectorRef.detectChanges();
671
- }
672
- };
673
- InteractionsDirective.prototype.addInteraction = function (map, controlConfig) {
674
- if (!this.interactionList[controlConfig.name]) {
675
- console.error("Unknown interaction " + controlConfig.name);
676
- return;
677
- }
678
- var newInteraction = new this.interactionList[controlConfig.name](controlConfig.options);
679
- map.addInteraction(newInteraction);
680
- };
681
- return InteractionsDirective;
682
- }());
683
- InteractionsDirective.decorators = [
684
- { type: i0.Directive, args: [{
685
- selector: 'ol-map > [olInteractions]'
686
- },] }
687
- ];
688
- InteractionsDirective.ctorParameters = function () { return [
689
- { type: i0.ChangeDetectorRef },
690
- { type: MapComponent }
691
- ]; };
692
- InteractionsDirective.propDecorators = {
693
- olInteractions: [{ type: i0.Input }]
694
- };
695
-
696
- var OverlayComponent = /** @class */ (function () {
697
- function OverlayComponent(changeDetectorRef, elementRef, mapComponent) {
698
- this.changeDetectorRef = changeDetectorRef;
699
- this.elementRef = elementRef;
700
- this.mapComponent = mapComponent;
701
- this.changeDetectorRef.detach();
702
- }
703
- OverlayComponent.prototype.ngOnInit = function () {
704
- if (this.elementRef.nativeElement) {
705
- this.element = this.elementRef.nativeElement;
706
- this.overlay = new Overlay__default['default'](this);
707
- this.mapComponent.getMap().addOverlay(this.overlay);
708
- this.overlay.setPosition(proj.fromLonLat(this.position));
709
- }
710
- };
711
- OverlayComponent.prototype.ngOnDestroy = function () {
712
- if (this.overlay) {
713
- this.mapComponent.getMap().removeOverlay(this.overlay);
714
- this.overlay = null;
715
- }
716
- };
717
- OverlayComponent.prototype.ngOnChanges = function (changes) {
718
- if (this.overlay && changes.hasOwnProperty('position')) {
719
- this.overlay.setPosition(proj.fromLonLat(changes.position.currentValue));
720
- }
721
- };
722
- OverlayComponent.prototype.panIntoView = function (panIntoViewOptions) {
723
- this.overlay.panIntoView(panIntoViewOptions);
724
- };
725
- return OverlayComponent;
726
- }());
727
- OverlayComponent.decorators = [
728
- { type: i0.Component, args: [{
729
- selector: 'ol-map > ol-overlay',
730
- template: '<ng-content></ng-content>',
731
- changeDetection: i0.ChangeDetectionStrategy.OnPush
732
- },] }
733
- ];
734
- OverlayComponent.ctorParameters = function () { return [
735
- { type: i0.ChangeDetectorRef },
736
- { type: i0.ElementRef },
737
- { type: MapComponent }
738
- ]; };
739
- OverlayComponent.propDecorators = {
740
- id: [{ type: i0.Input }],
741
- className: [{ type: i0.Input }],
742
- offset: [{ type: i0.Input }],
743
- position: [{ type: i0.Input }],
744
- positioning: [{ type: i0.Input }],
745
- stopEvent: [{ type: i0.Input }],
746
- insertFirst: [{ type: i0.Input }]
747
- };
748
-
749
- var ControlsDirective = /** @class */ (function () {
750
- function ControlsDirective(changeDetectorRef, mapComponent) {
751
- this.changeDetectorRef = changeDetectorRef;
752
- this.mapComponent = mapComponent;
753
- this.controls = [];
754
- this.controlList = {
755
- attribution: control.Attribution,
756
- fullscreen: control.FullScreen,
757
- rotate: control.Rotate,
758
- scaleline: control.ScaleLine,
759
- zoom: control.Zoom,
760
- zoomslider: control.ZoomSlider,
761
- zoomtoextent: control.ZoomToExtent
762
- };
763
- this.changeDetectorRef.detach();
764
- }
765
- Object.defineProperty(ControlsDirective.prototype, "olControls", {
766
- set: function (value) {
767
- this.controls = value;
768
- this.setControls();
769
- },
770
- enumerable: false,
771
- configurable: true
772
- });
773
- ControlsDirective.prototype.ngOnInit = function () {
774
- this.setControls();
775
- };
776
- ControlsDirective.prototype.setControls = function () {
777
- var e_1, _a;
778
- var map = this.mapComponent.getMap();
779
- if (undefined !== map) {
780
- map.getControls().clear();
781
- if (!this.controls || this.controls.length < 0) {
782
- return;
783
- }
784
- try {
785
- for (var _b = __values(this.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
786
- var config = _c.value;
787
- this.addControl(map, config);
788
- }
789
- }
790
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
791
- finally {
792
- try {
793
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
794
- }
795
- finally { if (e_1) throw e_1.error; }
796
- }
797
- this.changeDetectorRef.detectChanges();
798
- }
799
- };
800
- ControlsDirective.prototype.addControl = function (map, controlConfig) {
801
- if (!this.controlList[controlConfig.name]) {
802
- console.warn("Unknown control " + controlConfig.name);
803
- return;
804
- }
805
- var newControl = new this.controlList[controlConfig.name](controlConfig.options);
806
- map.addControl(newControl);
807
- };
808
- return ControlsDirective;
809
- }());
810
- ControlsDirective.decorators = [
811
- { type: i0.Directive, args: [{
812
- selector: 'ol-map > [olControls]'
813
- },] }
814
- ];
815
- ControlsDirective.ctorParameters = function () { return [
816
- { type: i0.ChangeDetectorRef },
817
- { type: MapComponent }
818
- ]; };
819
- ControlsDirective.propDecorators = {
820
- olControls: [{ type: i0.Input }]
821
- };
822
-
823
- var animateDuration = 500;
824
- var ViewDirective = /** @class */ (function () {
825
- function ViewDirective(changeDetectorRef, mapComponent) {
826
- var _this = this;
827
- this.changeDetectorRef = changeDetectorRef;
828
- this.mapComponent = mapComponent;
829
- this.viewProperties = {};
830
- this.centerChange = new i0.EventEmitter();
831
- this.rotationChange = new i0.EventEmitter();
832
- this.zoomChange = new i0.EventEmitter();
833
- this.enableAnimation = false;
834
- // Only arrow function works with addEventListener
835
- this.emitCenterChange = function (e) {
836
- clearTimeout(_this.timerCenterId);
837
- _this.timerCenterId = setTimeout(function () { return _this.centerChange.emit(Object.assign(e, {
838
- lonlat: proj.toLonLat(_this.view.getCenter()),
839
- zoom: _this.view.getZoom(),
840
- extent: proj.transformExtent(_this.view.calculateExtent(_this.mapComponent.getMap().getSize()), _this.view.getProjection().getCode(), 'EPSG:4326'),
841
- projCode: _this.view.getProjection().getCode(),
842
- key: e.target.get(e.key)
843
- })); }, animateDuration + 10);
844
- };
845
- this.emitZoomChange = function (e) {
846
- clearTimeout(_this.timerZoomId);
847
- _this.timerZoomId = setTimeout(function () { return _this.zoomChange.emit(Object.assign(e, {
848
- lonlat: proj.toLonLat(_this.view.getCenter()),
849
- zoom: _this.view.getZoom(),
850
- extent: proj.transformExtent(_this.view.calculateExtent(_this.mapComponent.getMap().getSize()), _this.view.getProjection().getCode(), 'EPSG:4326'),
851
- projCode: _this.view.getProjection().getCode(),
852
- key: e.target.get(e.key)
853
- })); }, animateDuration + 10);
854
- };
855
- this.emitRotationChange = function (e) {
856
- clearTimeout(_this.timerRotationId);
857
- _this.timerRotationId = setTimeout(function () { return _this.rotationChange.emit(e.target.get(e.key)); }, animateDuration + 10);
858
- };
859
- this.changeDetectorRef.detach();
860
- }
861
- ViewDirective.prototype.ngOnInit = function () {
862
- var _a;
863
- this.view = new View__default['default'](this.viewProperties);
864
- this.view.setRotation((_a = this.rotation) !== null && _a !== void 0 ? _a : 0);
865
- var map = this.mapComponent.getMap();
866
- if (map) {
867
- map.setView(this.view);
868
- map.updateSize();
869
- }
870
- };
871
- ViewDirective.prototype.ngAfterViewInit = function () {
872
- var map = this.mapComponent.getMap();
873
- if (map) {
874
- // register view events
875
- this.view.on('change:center', this.emitCenterChange);
876
- this.view.on('change:resolution', this.emitZoomChange);
877
- this.view.on('change:rotation', this.emitRotationChange);
878
- }
879
- };
880
- ViewDirective.prototype.ngOnChanges = function (changes) {
881
- var _a;
882
- var properties = {};
883
- for (var key in changes) {
884
- if (key === 'zoom') {
885
- if (this.view) {
886
- if (this.enableAnimation) {
887
- this.view.animate({ zoom: changes[key].currentValue, duration: animateDuration });
888
- }
889
- else {
890
- this.view.setZoom(changes[key].currentValue);
891
- }
892
- }
893
- else {
894
- properties[key] = changes[key].currentValue;
895
- }
896
- }
897
- else if (key === 'center') {
898
- if (this.view) {
899
- if (this.enableAnimation) {
900
- this.view.animate({ center: changes[key].currentValue, duration: animateDuration });
901
- }
902
- else {
903
- this.view.setCenter(proj.fromLonLat(changes[key].currentValue));
904
- }
905
- }
906
- else {
907
- properties[key] = proj.fromLonLat(changes[key].currentValue);
908
- }
909
- }
910
- else {
911
- properties[key] = changes[key].currentValue;
912
- }
913
- }
914
- this.viewProperties = properties;
915
- if (this.view) {
916
- this.view.setProperties(this.viewProperties, false);
917
- this.view.setRotation((_a = this.rotation) !== null && _a !== void 0 ? _a : 0);
918
- }
919
- };
920
- ViewDirective.prototype.ngOnDestroy = function () {
921
- this.view.un('change:center', this.emitCenterChange);
922
- this.view.un('change:resolution', this.emitZoomChange);
923
- this.view.un('change:rotation', this.emitRotationChange);
924
- };
925
- ViewDirective.prototype.getView = function () {
926
- return this.view;
927
- };
928
- return ViewDirective;
929
- }());
930
- ViewDirective.decorators = [
931
- { type: i0.Directive, args: [{
932
- selector: 'ol-map > [olView]'
933
- },] }
934
- ];
935
- ViewDirective.ctorParameters = function () { return [
936
- { type: i0.ChangeDetectorRef },
937
- { type: MapComponent }
938
- ]; };
939
- ViewDirective.propDecorators = {
940
- centerChange: [{ type: i0.Output }],
941
- rotationChange: [{ type: i0.Output }],
942
- zoomChange: [{ type: i0.Output }],
943
- enableAnimation: [{ type: i0.Input }],
944
- constrainRotation: [{ type: i0.Input }],
945
- constrainResolution: [{ type: i0.Input }],
946
- enableRotation: [{ type: i0.Input }],
947
- extent: [{ type: i0.Input }],
948
- maxResolution: [{ type: i0.Input }],
949
- minResolution: [{ type: i0.Input }],
950
- maxZoom: [{ type: i0.Input }],
951
- minZoom: [{ type: i0.Input }],
952
- multiWorld: [{ type: i0.Input }],
953
- resolution: [{ type: i0.Input }],
954
- resolutions: [{ type: i0.Input }],
955
- rotation: [{ type: i0.Input }],
956
- zoom: [{ type: i0.Input }],
957
- zoomFactor: [{ type: i0.Input }],
958
- center: [{ type: i0.Input }],
959
- projection: [{ type: i0.Input }]
960
- };
961
-
962
- var ContentComponent = /** @class */ (function () {
963
- function ContentComponent(elementRef) {
964
- this.elementRef = elementRef;
965
- }
966
- return ContentComponent;
967
- }());
968
- ContentComponent.decorators = [
969
- { type: i0.Component, args: [{
970
- selector: 'ol-map > ol-content',
971
- template: '<ng-content></ng-content>'
972
- },] }
973
- ];
974
- ContentComponent.ctorParameters = function () { return [
975
- { type: i0.ElementRef }
976
- ]; };
977
-
978
- /* enum types */
979
- exports.LayerType = void 0;
980
- (function (LayerType) {
981
- LayerType[LayerType["IMAGE"] = 0] = "IMAGE";
982
- LayerType[LayerType["TILE"] = 1] = "TILE";
983
- LayerType[LayerType["VECTOR_TILE"] = 2] = "VECTOR_TILE";
984
- LayerType[LayerType["VECTOR"] = 3] = "VECTOR";
985
- })(exports.LayerType || (exports.LayerType = {}));
986
- exports.SourceType = void 0;
987
- (function (SourceType) {
988
- SourceType[SourceType["BINGMAPS"] = 0] = "BINGMAPS";
989
- SourceType[SourceType["CARTODB"] = 1] = "CARTODB";
990
- SourceType[SourceType["CLUSTER"] = 2] = "CLUSTER";
991
- SourceType[SourceType["IMAGE"] = 3] = "IMAGE";
992
- SourceType[SourceType["IMAGEARCGISREST"] = 4] = "IMAGEARCGISREST";
993
- SourceType[SourceType["IMAGECANVAS"] = 5] = "IMAGECANVAS";
994
- SourceType[SourceType["IMAGEMAPGUIDE"] = 6] = "IMAGEMAPGUIDE";
995
- SourceType[SourceType["IMAGESTATIC"] = 7] = "IMAGESTATIC";
996
- SourceType[SourceType["IMAGEVECTOR"] = 8] = "IMAGEVECTOR";
997
- SourceType[SourceType["IMAGEWMS"] = 9] = "IMAGEWMS";
998
- SourceType[SourceType["OSM"] = 10] = "OSM";
999
- SourceType[SourceType["RASTER"] = 11] = "RASTER";
1000
- SourceType[SourceType["STAMEN"] = 12] = "STAMEN";
1001
- SourceType[SourceType["TILEARCGISREST"] = 13] = "TILEARCGISREST";
1002
- SourceType[SourceType["TILEDEBUG"] = 14] = "TILEDEBUG";
1003
- SourceType[SourceType["TILEIMAGE"] = 15] = "TILEIMAGE";
1004
- SourceType[SourceType["TILEJSON"] = 16] = "TILEJSON";
1005
- SourceType[SourceType["TILEUTFGRID"] = 17] = "TILEUTFGRID";
1006
- SourceType[SourceType["TILEWMS"] = 18] = "TILEWMS";
1007
- SourceType[SourceType["URLTILE"] = 19] = "URLTILE";
1008
- SourceType[SourceType["VECTOR"] = 20] = "VECTOR";
1009
- SourceType[SourceType["VECTORTILE"] = 21] = "VECTORTILE";
1010
- SourceType[SourceType["WMTS"] = 22] = "WMTS";
1011
- SourceType[SourceType["XYZ"] = 23] = "XYZ";
1012
- SourceType[SourceType["ZOOMIFY"] = 24] = "ZOOMIFY";
1013
- })(exports.SourceType || (exports.SourceType = {}));
1014
-
1015
- function stringToEl(html) {
1016
- var parser = new DOMParser();
1017
- var DOM = parser.parseFromString(html, 'text/html');
1018
- return DOM.body.firstChild;
1019
- }
1020
- function defaultLayers() {
1021
- return [
1022
- osmLayer()
1023
- ];
1024
- }
1025
- function osmLayer() {
1026
- return new TileLayer__default['default']({ source: new OSM__default['default']() });
1027
- }
1028
- function osmSource() {
1029
- return new OSM__default['default']();
1030
- }
1031
- function fromLonLatArray(coords) {
1032
- if (!Array.isArray(coords)) {
1033
- return coords;
1034
- }
1035
- if (typeof coords[0] == 'number') {
1036
- return proj.fromLonLat(coords);
1037
- }
1038
- else if (Array.isArray(coords[0])) {
1039
- return coords.map(function (c) { return fromLonLatArray(c); });
1040
- }
1041
- else {
1042
- return coords;
1043
- }
1044
- }
1045
- /** DateLine Crossing:
1046
- * returns true if point is in the zone for dateline transition
1047
- * zoneValue: lower end of 180 to xx range within which Longitude must fall for retun value to be true
1048
- **/
1049
- function inDLCrossingZone(coord, zoneValue) {
1050
- if (zoneValue === void 0) { zoneValue = 170; }
1051
- return (Math.abs(coord[0]) >= zoneValue) ? true : false;
1052
- }
1053
- // update linestring coords for map display (including dateline crossing)
1054
- function mapifyCoords(coords) {
1055
- if (coords.length == 0) {
1056
- return coords;
1057
- }
1058
- var dlCrossing = 0;
1059
- var last = coords[0];
1060
- for (var i = 0; i < coords.length; i++) {
1061
- if (inDLCrossingZone(coords[i]) || inDLCrossingZone(last)) {
1062
- dlCrossing = (last[0] > 0 && coords[i][0] < 0) ? 1
1063
- : (last[0] < 0 && coords[i][0] > 0) ? -1 : 0;
1064
- if (dlCrossing == 1) {
1065
- coords[i][0] = coords[i][0] + 360;
1066
- }
1067
- if (dlCrossing == -1) {
1068
- coords[i][0] = Math.abs(coords[i][0]) - 360;
1069
- }
1070
- }
1071
- }
1072
- return coords;
1073
- }
1074
- // ** return adjusted radius to correctly render circle on ground at given position.
1075
- function mapifyRadius(radius, position) {
1076
- if (typeof radius === 'undefined' || typeof position === 'undefined') {
1077
- return radius;
1078
- }
1079
- return radius / proj.getPointResolution('EPSG:3857', 1, proj.fromLonLat(position));
1080
- }
1081
- /*
1082
- * Calculate the destination point given start point
1083
- * latitude / longitude (numeric degrees), bearing (radians) and
1084
- * distance (in m).
1085
- *
1086
- * Original scripts by Chris Veness Taken from
1087
- * http://movable-type.co.uk/scripts/latlong-vincenty-direct.html and optimized /
1088
- * cleaned up by Mathias Bynens <http://mathiasbynens.be/> Based on the Vincenty
1089
- * direct formula by T. Vincenty, Direct and Inverse Solutions of Geodesics on
1090
- * the Ellipsoid with application of nested equations, Survey Review, vol XXII
1091
- * no 176, 1975 <http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf> */
1092
- function destCoordinate(coord, brng, dist) {
1093
- var lat1 = coord[1];
1094
- var lon1 = coord[0];
1095
- var a = 6378137, b = 6356752.3142, f = 1 / 298.257223563, // WGS-84
1096
- // ellipsiod
1097
- s = dist, alpha1 = brng, sinAlpha1 = Math.sin(alpha1), cosAlpha1 = Math
1098
- .cos(alpha1), tanU1 = (1 - f) * Math.tan(lat1 * (Math.PI / 180)), cosU1 = 1 / Math
1099
- .sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1, sigma1 = Math
1100
- .atan2(tanU1, cosAlpha1), sinAlpha = cosU1 * sinAlpha1, cosSqAlpha = 1
1101
- - sinAlpha * sinAlpha, uSq = cosSqAlpha * (a * a - b * b) / (b * b), A = 1
1102
- + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq))), B = uSq
1103
- / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq))), sigma = s
1104
- / (b * A), sigmaP = 2 * Math.PI;
1105
- while (Math.abs(sigma - sigmaP) > 1e-12) {
1106
- var cos2SigmaM = Math.cos(2 * sigma1 + sigma), sinSigma = Math
1107
- .sin(sigma), cosSigma = Math.cos(sigma), deltaSigma = B
1108
- * sinSigma
1109
- * (cos2SigmaM + B
1110
- / 4
1111
- * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) - B
1112
- / 6 * cos2SigmaM
1113
- * (-3 + 4 * sinSigma * sinSigma)
1114
- * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
1115
- sigmaP = sigma;
1116
- sigma = s / (b * A) + deltaSigma;
1117
- }
1118
- var tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1, lat2 = Math
1119
- .atan2(sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1, (1 - f)
1120
- * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp)), lambda = Math
1121
- .atan2(sinSigma * sinAlpha1, cosU1 * cosSigma - sinU1 * sinSigma
1122
- * cosAlpha1), C = f / 16 * cosSqAlpha
1123
- * (4 + f * (4 - 3 * cosSqAlpha)), La = lambda
1124
- - (1 - C)
1125
- * f
1126
- * sinAlpha
1127
- * (sigma + C
1128
- * sinSigma
1129
- * (cos2SigmaM + C * cosSigma
1130
- * (-1 + 2 * cos2SigmaM * cos2SigmaM))), revAz = Math
1131
- .atan2(sinAlpha, -tmp); // final bearing
1132
- var llat = lat2 * (180 / Math.PI);
1133
- var llon = lon1 + La * (180 / Math.PI);
1134
- return [llon, llat];
1135
- }
1136
-
1137
- var LayerComponent = /** @class */ (function () {
1138
- function LayerComponent(changeDetectorRef, mapComponent) {
1139
- this.changeDetectorRef = changeDetectorRef;
1140
- this.mapComponent = mapComponent;
1141
- /**
1142
- * This event is triggered after the layer is initialized
1143
- * Use this to have access to the layer and some helper functions
1144
- */
1145
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
1146
- this.changeDetectorRef.detach();
1147
- }
1148
- LayerComponent.prototype.ngOnInit = function () {
1149
- switch (this.layerType) {
1150
- case exports.LayerType.IMAGE:
1151
- this.source = new source.ImageWMS(this.sourceOptions);
1152
- this.layer = new ImageLayer__default['default'](Object.assign(this, Object.assign({}, this.properties)));
1153
- break;
1154
- case exports.LayerType.TILE:
1155
- this.source = this.getTileSource(this.sourceOptions);
1156
- this.layer = new TileLayer__default$1['default'](Object.assign(this, Object.assign({}, this.properties)));
1157
- break;
1158
- case exports.LayerType.VECTOR_TILE:
1159
- this.source = new VectorTileSource__default['default'](this.sourceOptions);
1160
- this.layer = new VectorTileLayer__default['default'](Object.assign(this, Object.assign({}, this.properties)));
1161
- break;
1162
- case exports.LayerType.VECTOR:
1163
- if (this.sourceOptions.sourceType === exports.SourceType.CLUSTER) {
1164
- this.source = new source.Cluster(this.sourceOptions);
1165
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.properties)));
1166
- }
1167
- else {
1168
- this.source = new VectorSource__default['default'](this.sourceOptions);
1169
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.properties)));
1170
- }
1171
- break;
1172
- default:
1173
- this.layer = osmLayer();
1174
- break;
1175
- }
1176
- var map = this.mapComponent.getMap();
1177
- if (this.layer && map) {
1178
- map.addLayer(this.layer);
1179
- map.render();
1180
- this.layerReady.next(this.layer);
1181
- this.layerReady.complete();
1182
- }
1183
- };
1184
- LayerComponent.prototype.ngOnChanges = function (changes) {
1185
- if (this.layer) {
1186
- var properties = {};
1187
- for (var key in changes) {
1188
- properties[key] = changes[key].currentValue;
1189
- }
1190
- this.layer.setProperties(properties, false);
1191
- }
1192
- };
1193
- LayerComponent.prototype.ngOnDestroy = function () {
1194
- var map = this.mapComponent.getMap();
1195
- if (this.layer && map) {
1196
- map.removeLayer(this.layer);
1197
- map.render();
1198
- this.layer = null;
1199
- }
1200
- };
1201
- LayerComponent.prototype.getLayer = function () {
1202
- return this.layer;
1203
- };
1204
- LayerComponent.prototype.getMap = function () {
1205
- return this.mapComponent.getMap();
1206
- };
1207
- LayerComponent.prototype.getSource = function () {
1208
- var olSource = this.layer.getSource();
1209
- if (olSource instanceof source.Cluster) {
1210
- olSource = olSource.getSource();
1211
- }
1212
- return olSource;
1213
- };
1214
- LayerComponent.prototype.getUrl = function () {
1215
- if (this.source instanceof source.ImageWMS) {
1216
- return this.source.getUrl();
1217
- }
1218
- if (this.source instanceof source.WMTS) {
1219
- return this.source.getUrls()[0];
1220
- }
1221
- if (this.source instanceof source.TileWMS) {
1222
- return this.source.getUrls()[0];
1223
- }
1224
- else {
1225
- return '';
1226
- }
1227
- };
1228
- LayerComponent.prototype.updateParams = function (name, value) {
1229
- var params = this.source.getParams();
1230
- if (name && value) {
1231
- params[name.toUpperCase()] = value;
1232
- }
1233
- params['T'] = new Date().getMilliseconds();
1234
- this.source.updateParams(params); // {'TIME': startDate.toISOString()}
1235
- };
1236
- LayerComponent.prototype.getTileSource = function (sourceOptions) {
1237
- switch (sourceOptions.sourceType) {
1238
- case exports.SourceType.IMAGEWMS:
1239
- return new source.ImageWMS(sourceOptions);
1240
- case exports.SourceType.OSM:
1241
- return new source.OSM(sourceOptions);
1242
- case exports.SourceType.TILEWMS:
1243
- return new source.TileWMS(sourceOptions);
1244
- case exports.SourceType.TILEIMAGE:
1245
- return new source.TileImage(sourceOptions);
1246
- case exports.SourceType.WMTS:
1247
- return new source.WMTS(sourceOptions);
1248
- case exports.SourceType.XYZ:
1249
- return new source.XYZ(sourceOptions);
1250
- default:
1251
- return osmSource();
1252
- }
1253
- };
1254
- return LayerComponent;
1255
- }());
1256
- LayerComponent.decorators = [
1257
- { type: i0.Component, args: [{
1258
- selector: 'ol-map > ol-layer',
1259
- template: '<ng-content></ng-content>',
1260
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1261
- },] }
1262
- ];
1263
- LayerComponent.ctorParameters = function () { return [
1264
- { type: i0.ChangeDetectorRef },
1265
- { type: MapComponent }
1266
- ]; };
1267
- LayerComponent.propDecorators = {
1268
- layerReady: [{ type: i0.Output }],
1269
- layerType: [{ type: i0.Input }],
1270
- sourceType: [{ type: i0.Input }],
1271
- opacity: [{ type: i0.Input }],
1272
- visible: [{ type: i0.Input }],
1273
- extent: [{ type: i0.Input }],
1274
- zIndex: [{ type: i0.Input }],
1275
- minResolution: [{ type: i0.Input }],
1276
- maxResolution: [{ type: i0.Input }],
1277
- sourceOptions: [{ type: i0.Input }],
1278
- style: [{ type: i0.Input }],
1279
- properties: [{ type: i0.Input }]
1280
- };
1281
-
1282
- var ControlComponent = /** @class */ (function () {
1283
- function ControlComponent(changeDetectorRef, elementRef, mapComponent) {
1284
- this.changeDetectorRef = changeDetectorRef;
1285
- this.elementRef = elementRef;
1286
- this.mapComponent = mapComponent;
1287
- this.changeDetectorRef.detach();
1288
- }
1289
- ControlComponent.prototype.ngOnInit = function () {
1290
- if (this.elementRef.nativeElement) {
1291
- this.element = this.elementRef.nativeElement;
1292
- this.control = new control.Control({ element: this.element });
1293
- this.mapComponent.getMap().addControl(this.control);
1294
- }
1295
- };
1296
- ControlComponent.prototype.ngOnDestroy = function () {
1297
- if (this.control) {
1298
- this.mapComponent.getMap().removeControl(this.control);
1299
- this.control = null;
1300
- }
1301
- };
1302
- return ControlComponent;
1303
- }());
1304
- ControlComponent.decorators = [
1305
- { type: i0.Component, args: [{
1306
- selector: 'ol-map > ol-control',
1307
- template: '<ng-content></ng-content>',
1308
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1309
- },] }
1310
- ];
1311
- ControlComponent.ctorParameters = function () { return [
1312
- { type: i0.ChangeDetectorRef },
1313
- { type: i0.ElementRef },
1314
- { type: MapComponent }
1315
- ]; };
1316
-
1317
- var InteractionDrawComponent = /** @class */ (function () {
1318
- function InteractionDrawComponent(changeDetectorRef, mapComponent) {
1319
- var _this = this;
1320
- this.changeDetectorRef = changeDetectorRef;
1321
- this.mapComponent = mapComponent;
1322
- this.type = GeometryType__default['default'].LINE_STRING;
1323
- this.change = new i0.EventEmitter();
1324
- this.drawStart = new i0.EventEmitter();
1325
- this.drawEnd = new i0.EventEmitter();
1326
- this.drawAbort = new i0.EventEmitter();
1327
- // ** emit events
1328
- this.emitChangeEvent = function (event) { return _this.change.emit(event); };
1329
- this.emitDrawStartEvent = function (event) { return _this.drawStart.emit(event); };
1330
- this.emitDrawEndEvent = function (event) { return _this.drawEnd.emit(event); };
1331
- this.emitDrawAbortEvent = function (event) { return _this.drawAbort.emit(event); };
1332
- this.changeDetectorRef.detach();
1333
- }
1334
- InteractionDrawComponent.prototype.ngOnInit = function () { };
1335
- InteractionDrawComponent.prototype.ngAfterViewInit = function () {
1336
- this.map = this.mapComponent.getMap();
1337
- this.addDrawInteraction();
1338
- };
1339
- InteractionDrawComponent.prototype.ngOnDestroy = function () {
1340
- this.map.removeInteraction(this.interaction);
1341
- this.interaction.un('change', this.emitChangeEvent);
1342
- this.interaction.un('drawstart', this.emitDrawStartEvent);
1343
- this.interaction.un('drawend', this.emitDrawEndEvent);
1344
- this.interaction.un('drawabort', this.emitDrawAbortEvent);
1345
- this.interaction = null;
1346
- };
1347
- InteractionDrawComponent.prototype.addDrawInteraction = function () {
1348
- if (undefined !== this.map) {
1349
- var opt = {
1350
- type: this.type,
1351
- stopClick: true
1352
- };
1353
- if (this.style) {
1354
- opt.style = this.style;
1355
- }
1356
- this.interaction = new interaction.Draw(opt);
1357
- this.interaction.on('change', this.emitChangeEvent);
1358
- this.interaction.on('drawstart', this.emitDrawStartEvent);
1359
- this.interaction.on('drawend', this.emitDrawEndEvent);
1360
- this.interaction.on('drawabort', this.emitDrawAbortEvent);
1361
- this.map.addInteraction(this.interaction);
1362
- this.changeDetectorRef.detectChanges();
1363
- }
1364
- };
1365
- return InteractionDrawComponent;
1366
- }());
1367
- InteractionDrawComponent.decorators = [
1368
- { type: i0.Component, args: [{
1369
- selector: 'ol-map > ol-draw',
1370
- template: '<ng-content></ng-content>',
1371
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1372
- },] }
1373
- ];
1374
- InteractionDrawComponent.ctorParameters = function () { return [
1375
- { type: i0.ChangeDetectorRef },
1376
- { type: MapComponent }
1377
- ]; };
1378
- InteractionDrawComponent.propDecorators = {
1379
- type: [{ type: i0.Input }],
1380
- style: [{ type: i0.Input }],
1381
- change: [{ type: i0.Output }],
1382
- drawStart: [{ type: i0.Output }],
1383
- drawEnd: [{ type: i0.Output }],
1384
- drawAbort: [{ type: i0.Output }]
1385
- };
1386
-
1387
- var InteractionModifyComponent = /** @class */ (function () {
1388
- function InteractionModifyComponent(changeDetectorRef, mapComponent) {
1389
- var _this = this;
1390
- this.changeDetectorRef = changeDetectorRef;
1391
- this.mapComponent = mapComponent;
1392
- this.change = new i0.EventEmitter();
1393
- this.modifyStart = new i0.EventEmitter();
1394
- this.modifyEnd = new i0.EventEmitter();
1395
- this.propertyChange = new i0.EventEmitter();
1396
- // ** emit events
1397
- this.emitChangeEvent = function (event) { return _this.change.emit(event); };
1398
- this.emitModifyStartEvent = function (event) { return _this.modifyStart.emit(event); };
1399
- this.emitModifyEndEvent = function (event) { return _this.modifyEnd.emit(event); };
1400
- this.emitPropertyChangeEvent = function (event) { return _this.propertyChange.emit(event); };
1401
- this.changeDetectorRef.detach();
1402
- }
1403
- InteractionModifyComponent.prototype.ngOnInit = function () { };
1404
- InteractionModifyComponent.prototype.ngAfterViewInit = function () {
1405
- this.map = this.mapComponent.getMap();
1406
- this.addModifyInteraction();
1407
- };
1408
- InteractionModifyComponent.prototype.ngOnDestroy = function () {
1409
- this.map.removeInteraction(this.interaction);
1410
- this.interaction.un('change', this.emitChangeEvent);
1411
- this.interaction.un('modifystart', this.emitModifyStartEvent);
1412
- this.interaction.un('modifyend', this.emitModifyEndEvent);
1413
- this.interaction.un('propertychange', this.emitPropertyChangeEvent);
1414
- this.interaction = null;
1415
- };
1416
- InteractionModifyComponent.prototype.addModifyInteraction = function () {
1417
- if (undefined !== this.map) {
1418
- this.interaction = new interaction.Modify({
1419
- features: this.features,
1420
- deleteCondition: function (e) {
1421
- if (e.type == 'click' && e.originalEvent.ctrlKey) {
1422
- return true;
1423
- }
1424
- else {
1425
- return false;
1426
- }
1427
- }
1428
- });
1429
- this.interaction.on('change', this.emitChangeEvent);
1430
- this.interaction.on('modifystart', this.emitModifyStartEvent);
1431
- this.interaction.on('modifyend', this.emitModifyEndEvent);
1432
- this.interaction.on('propertychange', this.emitPropertyChangeEvent);
1433
- this.map.addInteraction(this.interaction);
1434
- this.changeDetectorRef.detectChanges();
1435
- }
1436
- };
1437
- return InteractionModifyComponent;
1438
- }());
1439
- InteractionModifyComponent.decorators = [
1440
- { type: i0.Component, args: [{
1441
- selector: 'ol-map > ol-modify',
1442
- template: '<ng-content></ng-content>',
1443
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1444
- },] }
1445
- ];
1446
- InteractionModifyComponent.ctorParameters = function () { return [
1447
- { type: i0.ChangeDetectorRef },
1448
- { type: MapComponent }
1449
- ]; };
1450
- InteractionModifyComponent.propDecorators = {
1451
- features: [{ type: i0.Input }],
1452
- change: [{ type: i0.Output }],
1453
- modifyStart: [{ type: i0.Output }],
1454
- modifyEnd: [{ type: i0.Output }],
1455
- propertyChange: [{ type: i0.Output }]
1456
- };
1457
-
1458
- // ** Signal K resource collection format **
1459
- var WaypointLayerComponent = /** @class */ (function () {
1460
- function WaypointLayerComponent(changeDetectorRef, mapComponent) {
1461
- this.changeDetectorRef = changeDetectorRef;
1462
- this.mapComponent = mapComponent;
1463
- /**
1464
- * This event is triggered after the layer is initialized
1465
- * Use this to have access to the layer and some helper functions
1466
- */
1467
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
1468
- this.labelMinZoom = 10;
1469
- this.mapZoom = 10;
1470
- this.changeDetectorRef.detach();
1471
- }
1472
- WaypointLayerComponent.prototype.ngOnInit = function () {
1473
- this.parseWaypoints(this.waypoints);
1474
- this.source = new VectorSource__default['default']({ features: this.features });
1475
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
1476
- var map = this.mapComponent.getMap();
1477
- if (this.layer && map) {
1478
- map.addLayer(this.layer);
1479
- map.render();
1480
- this.layerReady.next(this.layer);
1481
- this.layerReady.complete();
1482
- }
1483
- };
1484
- WaypointLayerComponent.prototype.ngOnChanges = function (changes) {
1485
- if (this.layer) {
1486
- var properties = {};
1487
- for (var key in changes) {
1488
- if (key == 'waypoints') {
1489
- this.parseWaypoints(changes[key].currentValue);
1490
- if (this.source) {
1491
- this.source.clear();
1492
- this.source.addFeatures(this.features);
1493
- }
1494
- }
1495
- else if (key == 'waypointStyles') { }
1496
- else if (key == 'activeWaypoint') {
1497
- this.parseWaypoints(this.waypoints);
1498
- if (this.source) {
1499
- this.source.clear();
1500
- this.source.addFeatures(this.features);
1501
- }
1502
- }
1503
- else if (key == 'labelMinZoom' || key == 'mapZoom') {
1504
- this.handleLabelZoomChange(key, changes[key]);
1505
- }
1506
- else if (key == 'layerProperties') {
1507
- this.layer.setProperties(properties, false);
1508
- }
1509
- else {
1510
- properties[key] = changes[key].currentValue;
1511
- }
1512
- }
1513
- this.layer.setProperties(properties, false);
1514
- }
1515
- };
1516
- WaypointLayerComponent.prototype.ngOnDestroy = function () {
1517
- var map = this.mapComponent.getMap();
1518
- if (this.layer && map) {
1519
- map.removeLayer(this.layer);
1520
- map.render();
1521
- this.layer = null;
1522
- }
1523
- };
1524
- WaypointLayerComponent.prototype.parseWaypoints = function (waypoints) {
1525
- if (waypoints === void 0) { waypoints = this.waypoints; }
1526
- var fa = [];
1527
- for (var w in waypoints) {
1528
- var f = new ol.Feature({
1529
- geometry: new geom.Point(proj.fromLonLat(waypoints[w].feature.geometry.coordinates)),
1530
- name: waypoints[w].feature.properties.name
1531
- });
1532
- f.setId('waypoint.' + w);
1533
- f.setStyle(this.buildStyle(w, waypoints[w]));
1534
- fa.push(f);
1535
- }
1536
- this.features = fa;
1537
- };
1538
- // ** assess attribute change **
1539
- WaypointLayerComponent.prototype.handleLabelZoomChange = function (key, change) {
1540
- if (key == 'labelMinZoom') {
1541
- if (typeof this.mapZoom !== 'undefined') {
1542
- this.updateLabels();
1543
- }
1544
- }
1545
- else if (key == 'mapZoom') {
1546
- if (typeof this.labelMinZoom !== 'undefined') {
1547
- if ((change.currentValue >= this.labelMinZoom && change.previousValue < this.labelMinZoom) ||
1548
- (change.currentValue < this.labelMinZoom && change.previousValue >= this.labelMinZoom)) {
1549
- this.updateLabels();
1550
- }
1551
- }
1552
- }
1553
- };
1554
- // build waypoint style
1555
- WaypointLayerComponent.prototype.buildStyle = function (id, wpt) {
1556
- if (typeof this.waypointStyles !== 'undefined') {
1557
- if (id == this.activeWaypoint && typeof this.waypointStyles.active !== 'undefined') {
1558
- return this.setTextLabel(this.waypointStyles.active, wpt.feature.properties.name);
1559
- }
1560
- else if (wpt.feature.properties.skType) {
1561
- return this.setTextLabel(this.waypointStyles[wpt.feature.properties.skType], wpt.feature.properties.name);
1562
- }
1563
- else {
1564
- return this.setTextLabel(this.waypointStyles.default, wpt.feature.properties.name);
1565
- }
1566
- }
1567
- else if (this.layerProperties && this.layerProperties.style) {
1568
- return this.setTextLabel(this.layerProperties.style, wpt.feature.properties.name);
1569
- }
1570
- else { // default styles
1571
- var s = void 0;
1572
- if (id == this.activeWaypoint) {
1573
- s = new style.Style({
1574
- image: new style.Circle({
1575
- radius: 5,
1576
- fill: new style.Fill({ color: 'blue' }),
1577
- stroke: new style.Stroke({
1578
- color: 'black',
1579
- width: 2
1580
- })
1581
- }),
1582
- text: new style.Text({
1583
- text: '',
1584
- offsetY: -12
1585
- })
1586
- });
1587
- }
1588
- else {
1589
- s = new style.Style({
1590
- image: new style.Circle({
1591
- radius: 5,
1592
- fill: new style.Fill({ color: 'gold' }),
1593
- stroke: new style.Stroke({
1594
- color: 'black',
1595
- width: 2
1596
- })
1597
- }),
1598
- text: new style.Text({
1599
- text: '',
1600
- offsetY: -12
1601
- })
1602
- });
1603
- }
1604
- return this.setTextLabel(s, wpt.feature.properties.name);
1605
- }
1606
- };
1607
- // update feature labels
1608
- WaypointLayerComponent.prototype.updateLabels = function () {
1609
- var _this = this;
1610
- this.source.getFeatures().forEach(function (f) {
1611
- var s = f.getStyle();
1612
- f.setStyle(_this.setTextLabel(s, f.get('name')));
1613
- });
1614
- };
1615
- // return a Style with label text
1616
- WaypointLayerComponent.prototype.setTextLabel = function (s, text) {
1617
- if (text === void 0) { text = ''; }
1618
- var cs = s.clone();
1619
- var ts = cs.getText();
1620
- if (ts) {
1621
- ts.setText((Math.abs(this.mapZoom) >= this.labelMinZoom) ? text : '');
1622
- }
1623
- return cs;
1624
- };
1625
- return WaypointLayerComponent;
1626
- }());
1627
- WaypointLayerComponent.decorators = [
1628
- { type: i0.Component, args: [{
1629
- selector: 'ol-map > sk-waypoints',
1630
- template: '<ng-content></ng-content>',
1631
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1632
- },] }
1633
- ];
1634
- WaypointLayerComponent.ctorParameters = function () { return [
1635
- { type: i0.ChangeDetectorRef },
1636
- { type: MapComponent }
1637
- ]; };
1638
- WaypointLayerComponent.propDecorators = {
1639
- layerReady: [{ type: i0.Output }],
1640
- waypoints: [{ type: i0.Input }],
1641
- waypointStyles: [{ type: i0.Input }],
1642
- activeWaypoint: [{ type: i0.Input }],
1643
- labelMinZoom: [{ type: i0.Input }],
1644
- mapZoom: [{ type: i0.Input }],
1645
- opacity: [{ type: i0.Input }],
1646
- visible: [{ type: i0.Input }],
1647
- extent: [{ type: i0.Input }],
1648
- zIndex: [{ type: i0.Input }],
1649
- minResolution: [{ type: i0.Input }],
1650
- maxResolution: [{ type: i0.Input }],
1651
- layerProperties: [{ type: i0.Input }]
1652
- };
1653
- // ** Freeboard resource collection format **
1654
- var FreeboardWaypointLayerComponent = /** @class */ (function (_super) {
1655
- __extends(FreeboardWaypointLayerComponent, _super);
1656
- function FreeboardWaypointLayerComponent(changeDetectorRef, mapComponent) {
1657
- var _this = _super.call(this, changeDetectorRef, mapComponent) || this;
1658
- _this.changeDetectorRef = changeDetectorRef;
1659
- _this.mapComponent = mapComponent;
1660
- return _this;
1661
- }
1662
- FreeboardWaypointLayerComponent.prototype.parseWaypoints = function (waypoints) {
1663
- var e_1, _a;
1664
- if (waypoints === void 0) { waypoints = this.waypoints; }
1665
- var fa = [];
1666
- try {
1667
- for (var waypoints_1 = __values(waypoints), waypoints_1_1 = waypoints_1.next(); !waypoints_1_1.done; waypoints_1_1 = waypoints_1.next()) {
1668
- var w = waypoints_1_1.value;
1669
- if (w[2]) { // selected
1670
- var f = new ol.Feature({
1671
- geometry: new geom.Point(proj.fromLonLat(w[1].feature.geometry.coordinates)),
1672
- name: w[1].feature.properties.name
1673
- });
1674
- f.setId('waypoint.' + w[0]);
1675
- f.setStyle(this.buildStyle(w[0], w[1]));
1676
- fa.push(f);
1677
- }
1678
- }
1679
- }
1680
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1681
- finally {
1682
- try {
1683
- if (waypoints_1_1 && !waypoints_1_1.done && (_a = waypoints_1.return)) _a.call(waypoints_1);
1684
- }
1685
- finally { if (e_1) throw e_1.error; }
1686
- }
1687
- this.features = fa;
1688
- };
1689
- return FreeboardWaypointLayerComponent;
1690
- }(WaypointLayerComponent));
1691
- FreeboardWaypointLayerComponent.decorators = [
1692
- { type: i0.Component, args: [{
1693
- selector: 'ol-map > fb-waypoints',
1694
- template: '<ng-content></ng-content>',
1695
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1696
- },] }
1697
- ];
1698
- FreeboardWaypointLayerComponent.ctorParameters = function () { return [
1699
- { type: i0.ChangeDetectorRef },
1700
- { type: MapComponent }
1701
- ]; };
1702
- FreeboardWaypointLayerComponent.propDecorators = {
1703
- waypoints: [{ type: i0.Input }]
1704
- };
1705
-
1706
- // ** Signal K resource collection format **
1707
- var NoteLayerComponent = /** @class */ (function () {
1708
- function NoteLayerComponent(changeDetectorRef, mapComponent) {
1709
- this.changeDetectorRef = changeDetectorRef;
1710
- this.mapComponent = mapComponent;
1711
- /**
1712
- * This event is triggered after the layer is initialized
1713
- * Use this to have access to the layer and some helper functions
1714
- */
1715
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
1716
- this.changeDetectorRef.detach();
1717
- }
1718
- NoteLayerComponent.prototype.ngOnInit = function () {
1719
- this.parseNotes(this.notes);
1720
- this.source = new VectorSource__default['default']({ features: this.features });
1721
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
1722
- var map = this.mapComponent.getMap();
1723
- if (this.layer && map) {
1724
- map.addLayer(this.layer);
1725
- map.render();
1726
- this.layerReady.next(this.layer);
1727
- this.layerReady.complete();
1728
- }
1729
- };
1730
- NoteLayerComponent.prototype.ngOnChanges = function (changes) {
1731
- if (this.layer) {
1732
- var properties = {};
1733
- for (var key in changes) {
1734
- if (key == 'notes') {
1735
- this.parseNotes(changes[key].currentValue);
1736
- if (this.source) {
1737
- this.source.clear();
1738
- this.source.addFeatures(this.features);
1739
- }
1740
- }
1741
- else if (key == 'noteStyles') { }
1742
- else if (key == 'layerProperties') {
1743
- this.layer.setProperties(properties, false);
1744
- }
1745
- else {
1746
- properties[key] = changes[key].currentValue;
1747
- }
1748
- }
1749
- this.layer.setProperties(properties, false);
1750
- }
1751
- };
1752
- NoteLayerComponent.prototype.ngOnDestroy = function () {
1753
- var map = this.mapComponent.getMap();
1754
- if (this.layer && map) {
1755
- map.removeLayer(this.layer);
1756
- map.render();
1757
- this.layer = null;
1758
- }
1759
- };
1760
- NoteLayerComponent.prototype.parseNotes = function (notes) {
1761
- if (notes === void 0) { notes = this.notes; }
1762
- var fa = [];
1763
- for (var w in notes) {
1764
- if (!notes[w].position) {
1765
- continue;
1766
- }
1767
- var f = new ol.Feature({
1768
- geometry: new geom.Point(proj.fromLonLat([
1769
- notes[w].position.longitude,
1770
- notes[w].position.latitude
1771
- ])),
1772
- name: notes[w].title
1773
- });
1774
- f.setId('note.' + w);
1775
- f.setStyle(this.buildStyle(w, notes[w]));
1776
- fa.push(f);
1777
- }
1778
- this.features = fa;
1779
- };
1780
- // build note style
1781
- NoteLayerComponent.prototype.buildStyle = function (id, note) {
1782
- var _a, _b;
1783
- if (typeof this.noteStyles !== 'undefined') {
1784
- if ((_a = note.properties) === null || _a === void 0 ? void 0 : _a.skType) {
1785
- return this.noteStyles[(_b = note.properties) === null || _b === void 0 ? void 0 : _b.skType];
1786
- }
1787
- else {
1788
- return this.noteStyles.default;
1789
- }
1790
- }
1791
- else if (this.layerProperties && this.layerProperties.style) {
1792
- return this.layerProperties.style;
1793
- }
1794
- else { // default styles
1795
- return new style.Style({
1796
- image: new style.RegularShape({
1797
- points: 4,
1798
- radius: 10,
1799
- fill: new style.Fill({ color: 'gold' }),
1800
- stroke: new style.Stroke({
1801
- color: 'black',
1802
- width: 1
1803
- }),
1804
- rotation: (Math.PI / 180) * 45
1805
- })
1806
- });
1807
- }
1808
- };
1809
- return NoteLayerComponent;
1810
- }());
1811
- NoteLayerComponent.decorators = [
1812
- { type: i0.Component, args: [{
1813
- selector: 'ol-map > sk-notes',
1814
- template: '<ng-content></ng-content>',
1815
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1816
- },] }
1817
- ];
1818
- NoteLayerComponent.ctorParameters = function () { return [
1819
- { type: i0.ChangeDetectorRef },
1820
- { type: MapComponent }
1821
- ]; };
1822
- NoteLayerComponent.propDecorators = {
1823
- layerReady: [{ type: i0.Output }],
1824
- notes: [{ type: i0.Input }],
1825
- noteStyles: [{ type: i0.Input }],
1826
- opacity: [{ type: i0.Input }],
1827
- visible: [{ type: i0.Input }],
1828
- extent: [{ type: i0.Input }],
1829
- zIndex: [{ type: i0.Input }],
1830
- minResolution: [{ type: i0.Input }],
1831
- maxResolution: [{ type: i0.Input }],
1832
- layerProperties: [{ type: i0.Input }]
1833
- };
1834
- // ** Freeboard resource collection format **
1835
- var FreeboardNoteLayerComponent = /** @class */ (function (_super) {
1836
- __extends(FreeboardNoteLayerComponent, _super);
1837
- function FreeboardNoteLayerComponent(changeDetectorRef, mapComponent) {
1838
- var _this = _super.call(this, changeDetectorRef, mapComponent) || this;
1839
- _this.changeDetectorRef = changeDetectorRef;
1840
- _this.mapComponent = mapComponent;
1841
- return _this;
1842
- }
1843
- FreeboardNoteLayerComponent.prototype.parseNotes = function (notes) {
1844
- var e_1, _c;
1845
- if (notes === void 0) { notes = this.notes; }
1846
- var fa = [];
1847
- try {
1848
- for (var notes_1 = __values(notes), notes_1_1 = notes_1.next(); !notes_1_1.done; notes_1_1 = notes_1.next()) {
1849
- var w = notes_1_1.value;
1850
- if (!w[1].position) {
1851
- continue;
1852
- }
1853
- var f = new ol.Feature({
1854
- geometry: new geom.Point(proj.fromLonLat([
1855
- w[1].position.longitude,
1856
- w[1].position.latitude
1857
- ])),
1858
- name: w[1].title
1859
- });
1860
- f.setId('note.' + w[0]);
1861
- f.setStyle(this.buildStyle(w[0], w[1]));
1862
- fa.push(f);
1863
- }
1864
- }
1865
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1866
- finally {
1867
- try {
1868
- if (notes_1_1 && !notes_1_1.done && (_c = notes_1.return)) _c.call(notes_1);
1869
- }
1870
- finally { if (e_1) throw e_1.error; }
1871
- }
1872
- this.features = fa;
1873
- };
1874
- return FreeboardNoteLayerComponent;
1875
- }(NoteLayerComponent));
1876
- FreeboardNoteLayerComponent.decorators = [
1877
- { type: i0.Component, args: [{
1878
- selector: 'ol-map > fb-notes',
1879
- template: '<ng-content></ng-content>',
1880
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1881
- },] }
1882
- ];
1883
- FreeboardNoteLayerComponent.ctorParameters = function () { return [
1884
- { type: i0.ChangeDetectorRef },
1885
- { type: MapComponent }
1886
- ]; };
1887
- FreeboardNoteLayerComponent.propDecorators = {
1888
- notes: [{ type: i0.Input }]
1889
- };
1890
-
1891
- // ** Signal K resource collection format **
1892
- var RouteLayerComponent = /** @class */ (function () {
1893
- function RouteLayerComponent(changeDetectorRef, mapComponent) {
1894
- this.changeDetectorRef = changeDetectorRef;
1895
- this.mapComponent = mapComponent;
1896
- /**
1897
- * This event is triggered after the layer is initialized
1898
- * Use this to have access to the layer and some helper functions
1899
- */
1900
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
1901
- this.changeDetectorRef.detach();
1902
- }
1903
- RouteLayerComponent.prototype.ngOnInit = function () {
1904
- this.parseRoutes(this.routes);
1905
- this.source = new VectorSource__default['default']({ features: this.features });
1906
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
1907
- var map = this.mapComponent.getMap();
1908
- if (this.layer && map) {
1909
- map.addLayer(this.layer);
1910
- map.render();
1911
- this.layerReady.next(this.layer);
1912
- this.layerReady.complete();
1913
- }
1914
- };
1915
- RouteLayerComponent.prototype.ngOnChanges = function (changes) {
1916
- if (this.layer) {
1917
- var properties = {};
1918
- for (var key in changes) {
1919
- if (key == 'routes') {
1920
- this.parseRoutes(changes[key].currentValue);
1921
- if (this.source) {
1922
- this.source.clear();
1923
- this.source.addFeatures(this.features);
1924
- }
1925
- }
1926
- else if (key == 'routeStyles') { }
1927
- else if (key == 'activeRoute') {
1928
- this.parseRoutes(this.routes);
1929
- if (this.source) {
1930
- this.source.clear();
1931
- this.source.addFeatures(this.features);
1932
- }
1933
- }
1934
- else if (key == 'layerProperties') {
1935
- this.layer.setProperties(properties, false);
1936
- }
1937
- else {
1938
- properties[key] = changes[key].currentValue;
1939
- }
1940
- }
1941
- this.layer.setProperties(properties, false);
1942
- }
1943
- };
1944
- RouteLayerComponent.prototype.ngOnDestroy = function () {
1945
- var map = this.mapComponent.getMap();
1946
- if (this.layer && map) {
1947
- map.removeLayer(this.layer);
1948
- map.render();
1949
- this.layer = null;
1950
- }
1951
- };
1952
- RouteLayerComponent.prototype.parseRoutes = function (routes) {
1953
- if (routes === void 0) { routes = this.routes; }
1954
- var fa = [];
1955
- for (var w in routes) {
1956
- var mc = mapifyCoords(routes[w].feature.geometry.coordinates);
1957
- var c = fromLonLatArray(mc);
1958
- var f = new ol.Feature({
1959
- geometry: new geom.LineString(c),
1960
- name: routes[w].feature.properties.name
1961
- });
1962
- f.setId('route.' + w);
1963
- f.setStyle(this.buildStyle(w, routes[w]));
1964
- fa.push(f);
1965
- }
1966
- this.features = fa;
1967
- };
1968
- // build route style
1969
- RouteLayerComponent.prototype.buildStyle = function (id, rte) {
1970
- if (typeof this.routeStyles !== 'undefined') {
1971
- if (id == this.activeRoute && typeof this.routeStyles.active !== 'undefined') {
1972
- return this.routeStyles.active;
1973
- }
1974
- else if (rte.feature.properties.skType) {
1975
- return this.routeStyles[rte.feature.properties.skType];
1976
- }
1977
- else {
1978
- return this.routeStyles.default;
1979
- }
1980
- }
1981
- else if (this.layerProperties && this.layerProperties.style) {
1982
- return this.layerProperties.style;
1983
- }
1984
- else { // default styles
1985
- var s = void 0;
1986
- if (id == this.activeRoute) {
1987
- s = new style.Style({
1988
- stroke: new style.Stroke({
1989
- color: 'blue',
1990
- width: 4
1991
- })
1992
- });
1993
- }
1994
- else {
1995
- s = new style.Style({
1996
- stroke: new style.Stroke({
1997
- color: 'green',
1998
- width: 2,
1999
- lineDash: [20, 5, 5, 5]
2000
- })
2001
- });
2002
- }
2003
- return s;
2004
- }
2005
- };
2006
- return RouteLayerComponent;
2007
- }());
2008
- RouteLayerComponent.decorators = [
2009
- { type: i0.Component, args: [{
2010
- selector: 'ol-map > sk-routes',
2011
- template: '<ng-content></ng-content>',
2012
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2013
- },] }
2014
- ];
2015
- RouteLayerComponent.ctorParameters = function () { return [
2016
- { type: i0.ChangeDetectorRef },
2017
- { type: MapComponent }
2018
- ]; };
2019
- RouteLayerComponent.propDecorators = {
2020
- layerReady: [{ type: i0.Output }],
2021
- routes: [{ type: i0.Input }],
2022
- routeStyles: [{ type: i0.Input }],
2023
- activeRoute: [{ type: i0.Input }],
2024
- opacity: [{ type: i0.Input }],
2025
- visible: [{ type: i0.Input }],
2026
- extent: [{ type: i0.Input }],
2027
- zIndex: [{ type: i0.Input }],
2028
- minResolution: [{ type: i0.Input }],
2029
- maxResolution: [{ type: i0.Input }],
2030
- layerProperties: [{ type: i0.Input }]
2031
- };
2032
- // ** Freeboard resource collection format **
2033
- var FreeboardRouteLayerComponent = /** @class */ (function (_super) {
2034
- __extends(FreeboardRouteLayerComponent, _super);
2035
- function FreeboardRouteLayerComponent(changeDetectorRef, mapComponent) {
2036
- var _this = _super.call(this, changeDetectorRef, mapComponent) || this;
2037
- _this.changeDetectorRef = changeDetectorRef;
2038
- _this.mapComponent = mapComponent;
2039
- return _this;
2040
- }
2041
- FreeboardRouteLayerComponent.prototype.parseRoutes = function (routes) {
2042
- var e_1, _a;
2043
- if (routes === void 0) { routes = this.routes; }
2044
- var fa = [];
2045
- try {
2046
- for (var routes_1 = __values(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
2047
- var w = routes_1_1.value;
2048
- if (w[2]) { // selected
2049
- var mc = mapifyCoords(w[1].feature.geometry.coordinates);
2050
- var c = fromLonLatArray(mc);
2051
- var f = new ol.Feature({
2052
- geometry: new geom.LineString(c),
2053
- name: w[1].feature.properties.name
2054
- });
2055
- f.setId('route.' + w[0]);
2056
- f.setStyle(this.buildStyle(w[0], w[1]));
2057
- fa.push(f);
2058
- }
2059
- }
2060
- }
2061
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2062
- finally {
2063
- try {
2064
- if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
2065
- }
2066
- finally { if (e_1) throw e_1.error; }
2067
- }
2068
- this.features = fa;
2069
- };
2070
- return FreeboardRouteLayerComponent;
2071
- }(RouteLayerComponent));
2072
- FreeboardRouteLayerComponent.decorators = [
2073
- { type: i0.Component, args: [{
2074
- selector: 'ol-map > fb-routes',
2075
- template: '<ng-content></ng-content>',
2076
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2077
- },] }
2078
- ];
2079
- FreeboardRouteLayerComponent.ctorParameters = function () { return [
2080
- { type: i0.ChangeDetectorRef },
2081
- { type: MapComponent }
2082
- ]; };
2083
- FreeboardRouteLayerComponent.propDecorators = {
2084
- routes: [{ type: i0.Input }]
2085
- };
2086
-
2087
- // ** Signal K resource collection format **
2088
- var RegionLayerComponent = /** @class */ (function () {
2089
- function RegionLayerComponent(changeDetectorRef, mapComponent) {
2090
- this.changeDetectorRef = changeDetectorRef;
2091
- this.mapComponent = mapComponent;
2092
- /**
2093
- * This event is triggered after the layer is initialized
2094
- * Use this to have access to the layer and some helper functions
2095
- */
2096
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
2097
- this.changeDetectorRef.detach();
2098
- }
2099
- RegionLayerComponent.prototype.ngOnInit = function () {
2100
- this.parseRegions(this.regions);
2101
- this.source = new VectorSource__default['default']({ features: this.features });
2102
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
2103
- var map = this.mapComponent.getMap();
2104
- if (this.layer && map) {
2105
- map.addLayer(this.layer);
2106
- map.render();
2107
- this.layerReady.next(this.layer);
2108
- this.layerReady.complete();
2109
- }
2110
- };
2111
- RegionLayerComponent.prototype.ngOnChanges = function (changes) {
2112
- if (this.layer) {
2113
- var properties = {};
2114
- for (var key in changes) {
2115
- if (key == 'regions') {
2116
- this.parseRegions(changes[key].currentValue);
2117
- if (this.source) {
2118
- this.source.clear();
2119
- this.source.addFeatures(this.features);
2120
- }
2121
- }
2122
- else if (key == 'regionStyles') { }
2123
- else if (key == 'layerProperties') {
2124
- this.layer.setProperties(properties, false);
2125
- }
2126
- else {
2127
- properties[key] = changes[key].currentValue;
2128
- }
2129
- }
2130
- this.layer.setProperties(properties, false);
2131
- }
2132
- };
2133
- RegionLayerComponent.prototype.ngOnDestroy = function () {
2134
- var map = this.mapComponent.getMap();
2135
- if (this.layer && map) {
2136
- map.removeLayer(this.layer);
2137
- map.render();
2138
- this.layer = null;
2139
- }
2140
- };
2141
- RegionLayerComponent.prototype.parseRegions = function (regions) {
2142
- if (regions === void 0) { regions = this.regions; }
2143
- var fa = [];
2144
- for (var w in regions) {
2145
- var c = this.parseCoordinates(regions[w].feature.geometry.coordinates, regions[w].feature.geometry.type);
2146
- var f = new ol.Feature({
2147
- geometry: regions[w].feature.geometry.type == 'MultiPolygon' ?
2148
- new geom.MultiPolygon(c) : new geom.Polygon(c),
2149
- name: regions[w].title
2150
- });
2151
- f.setId('region.' + w);
2152
- f.setStyle(this.buildStyle(w, regions[w]));
2153
- fa.push(f);
2154
- }
2155
- this.features = fa;
2156
- };
2157
- // ** mapify and transform MultiLineString coordinates
2158
- RegionLayerComponent.prototype.parseCoordinates = function (coords, geomType) {
2159
- if (geomType == 'MultiPolygon') {
2160
- var multipoly_1 = [];
2161
- coords.forEach(function (mpoly) {
2162
- var lines = [];
2163
- mpoly.forEach(function (poly) {
2164
- lines.push(mapifyCoords(poly));
2165
- });
2166
- multipoly_1.push(lines);
2167
- });
2168
- return fromLonLatArray(multipoly_1);
2169
- }
2170
- else if (geomType == 'Polygon') {
2171
- var lines_1 = [];
2172
- coords.forEach(function (line) { return lines_1.push(mapifyCoords(line)); });
2173
- return fromLonLatArray(lines_1);
2174
- }
2175
- };
2176
- // build region style
2177
- RegionLayerComponent.prototype.buildStyle = function (id, reg) {
2178
- if (typeof this.regionStyles !== 'undefined') {
2179
- if (reg.feature.properties.skType) {
2180
- return this.regionStyles[reg.feature.properties.skType];
2181
- }
2182
- else {
2183
- return this.regionStyles.default;
2184
- }
2185
- }
2186
- else if (this.layerProperties && this.layerProperties.style) {
2187
- return this.layerProperties.style;
2188
- }
2189
- else { // default styles
2190
- return new style.Style({
2191
- fill: new style.Fill({
2192
- color: 'rgba(255,0,255,0.1)'
2193
- }),
2194
- stroke: new style.Stroke({
2195
- color: 'purple',
2196
- width: 1
2197
- })
2198
- });
2199
- }
2200
- };
2201
- return RegionLayerComponent;
2202
- }());
2203
- RegionLayerComponent.decorators = [
2204
- { type: i0.Component, args: [{
2205
- selector: 'ol-map > sk-regions',
2206
- template: '<ng-content></ng-content>',
2207
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2208
- },] }
2209
- ];
2210
- RegionLayerComponent.ctorParameters = function () { return [
2211
- { type: i0.ChangeDetectorRef },
2212
- { type: MapComponent }
2213
- ]; };
2214
- RegionLayerComponent.propDecorators = {
2215
- layerReady: [{ type: i0.Output }],
2216
- regions: [{ type: i0.Input }],
2217
- regionStyles: [{ type: i0.Input }],
2218
- opacity: [{ type: i0.Input }],
2219
- visible: [{ type: i0.Input }],
2220
- extent: [{ type: i0.Input }],
2221
- zIndex: [{ type: i0.Input }],
2222
- minResolution: [{ type: i0.Input }],
2223
- maxResolution: [{ type: i0.Input }],
2224
- layerProperties: [{ type: i0.Input }]
2225
- };
2226
- // ** Freeboard resource collection format **
2227
- var FreeboardRegionLayerComponent = /** @class */ (function (_super) {
2228
- __extends(FreeboardRegionLayerComponent, _super);
2229
- function FreeboardRegionLayerComponent(changeDetectorRef, mapComponent) {
2230
- var _this = _super.call(this, changeDetectorRef, mapComponent) || this;
2231
- _this.changeDetectorRef = changeDetectorRef;
2232
- _this.mapComponent = mapComponent;
2233
- return _this;
2234
- }
2235
- FreeboardRegionLayerComponent.prototype.parseRegions = function (regions) {
2236
- var e_1, _a;
2237
- if (regions === void 0) { regions = this.regions; }
2238
- var fa = [];
2239
- try {
2240
- for (var regions_1 = __values(regions), regions_1_1 = regions_1.next(); !regions_1_1.done; regions_1_1 = regions_1.next()) {
2241
- var w = regions_1_1.value;
2242
- var c = this.parseCoordinates(w[1].feature.geometry.coordinates, w[1].feature.geometry.type);
2243
- var f = new ol.Feature({
2244
- geometry: w[1].feature.geometry.type == 'MultiPolygon' ?
2245
- new geom.MultiPolygon(c) : new geom.Polygon(c),
2246
- name: w[1].title
2247
- });
2248
- f.setId('region.' + w[0]);
2249
- f.setStyle(this.buildStyle(w[0], w[1]));
2250
- fa.push(f);
2251
- }
2252
- }
2253
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2254
- finally {
2255
- try {
2256
- if (regions_1_1 && !regions_1_1.done && (_a = regions_1.return)) _a.call(regions_1);
2257
- }
2258
- finally { if (e_1) throw e_1.error; }
2259
- }
2260
- this.features = fa;
2261
- };
2262
- return FreeboardRegionLayerComponent;
2263
- }(RegionLayerComponent));
2264
- FreeboardRegionLayerComponent.decorators = [
2265
- { type: i0.Component, args: [{
2266
- selector: 'ol-map > fb-regions',
2267
- template: '<ng-content></ng-content>',
2268
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2269
- },] }
2270
- ];
2271
- FreeboardRegionLayerComponent.ctorParameters = function () { return [
2272
- { type: i0.ChangeDetectorRef },
2273
- { type: MapComponent }
2274
- ]; };
2275
- FreeboardRegionLayerComponent.propDecorators = {
2276
- regions: [{ type: i0.Input }]
2277
- };
2278
-
2279
- // ** Freeboard resource collection format **
2280
- var FreeboardChartLayerComponent = /** @class */ (function () {
2281
- function FreeboardChartLayerComponent(changeDetectorRef, mapComponent, mapService) {
2282
- this.changeDetectorRef = changeDetectorRef;
2283
- this.mapComponent = mapComponent;
2284
- this.mapService = mapService;
2285
- this.layers = new Map();
2286
- this.zIndex = 10; // start number for zIndex of chart layers
2287
- this.changeDetectorRef.detach();
2288
- }
2289
- FreeboardChartLayerComponent.prototype.ngOnInit = function () {
2290
- this.parseCharts(this.charts);
2291
- };
2292
- FreeboardChartLayerComponent.prototype.ngOnChanges = function (changes) {
2293
- for (var key in changes) {
2294
- if (key == 'charts' && !changes[key].firstChange) {
2295
- this.parseCharts(changes[key].currentValue);
2296
- }
2297
- }
2298
- };
2299
- FreeboardChartLayerComponent.prototype.ngOnDestroy = function () {
2300
- this.clearlayers();
2301
- };
2302
- FreeboardChartLayerComponent.prototype.clearlayers = function () {
2303
- var map = this.mapComponent.getMap();
2304
- if (this.layers && map) {
2305
- this.layers.forEach(function (l, k) { return map.removeLayer(l); });
2306
- map.render();
2307
- this.layers.clear();
2308
- }
2309
- };
2310
- FreeboardChartLayerComponent.prototype.parseCharts = function (charts) {
2311
- if (charts === void 0) { charts = this.charts; }
2312
- var map = this.mapComponent.getMap();
2313
- for (var i in charts) {
2314
- // check for existing layer
2315
- var layer = this.mapService.getLayerByKey('id', charts[i][0]);
2316
- if (!charts[i][2]) { // not selected
2317
- if (layer) {
2318
- this.mapComponent.getMap().removeLayer(layer);
2319
- this.layers.delete(charts[i][0]);
2320
- }
2321
- }
2322
- else { // selected
2323
- if (!layer) {
2324
- if (charts[i][0] == 'openstreetmap') { // open street map
2325
- layer = osmLayer();
2326
- layer.setZIndex(this.zIndex + parseInt(i));
2327
- layer.setMinZoom(charts[i][1].minZoom);
2328
- layer.setMaxZoom(charts[i][1].maxZoom);
2329
- }
2330
- else { // signal k charts
2331
- if (charts[i][1].chartFormat == 'pbf' || charts[i][1].chartFormat == 'mvt') { // vector tile
2332
- var source$1 = new VectorTileSource__default['default']({
2333
- url: charts[i][1].tilemapUrl,
2334
- format: new format.MVT({
2335
- layers: charts[i][1].chartLayers ? charts[i][1].chartLayers : null
2336
- })
2337
- });
2338
- layer = new VectorTileLayer__default['default']({
2339
- source: source$1,
2340
- preload: 0,
2341
- zIndex: this.zIndex + parseInt(i),
2342
- style: this.applyVectorStyle,
2343
- minZoom: charts[i][1].minZoom,
2344
- maxZoom: charts[i][1].maxZoom
2345
- });
2346
- }
2347
- else { // raster tile
2348
- var source$1 = // select source type
2349
- void 0; // select source type
2350
- if (charts[i][1].type == 'WMS') {
2351
- source$1 = new source.TileWMS({
2352
- url: charts[i][1].tilemapUrl,
2353
- params: {
2354
- LAYERS: (charts[i][1].chartLayers) ? charts[i][1].chartLayers.join(',') : ''
2355
- }
2356
- });
2357
- }
2358
- else {
2359
- source$1 = new source.XYZ({
2360
- url: charts[i][1].tilemapUrl
2361
- });
2362
- }
2363
- layer = new TileLayer__default$1['default']({
2364
- source: source$1,
2365
- preload: 0,
2366
- zIndex: this.zIndex + parseInt(i),
2367
- minZoom: charts[i][1].minZoom,
2368
- maxZoom: charts[i][1].maxZoom
2369
- });
2370
- }
2371
- }
2372
- layer.set('id', charts[i][0]);
2373
- this.layers.set(charts[i][0], layer);
2374
- map.addLayer(layer);
2375
- }
2376
- }
2377
- }
2378
- if (map) {
2379
- map.render();
2380
- }
2381
- };
2382
- // apply default vectortile style
2383
- FreeboardChartLayerComponent.prototype.applyVectorStyle = function () {
2384
- var params = [];
2385
- for (var _i = 0; _i < arguments.length; _i++) {
2386
- params[_i] = arguments[_i];
2387
- }
2388
- return new style.Style({
2389
- fill: new style.Fill({
2390
- color: 'rgba(#224, 209, 14, 0.8)'
2391
- }),
2392
- stroke: new style.Stroke({
2393
- color: '#444',
2394
- width: 1,
2395
- })
2396
- });
2397
- };
2398
- return FreeboardChartLayerComponent;
2399
- }());
2400
- FreeboardChartLayerComponent.decorators = [
2401
- { type: i0.Component, args: [{
2402
- selector: 'ol-map > fb-charts',
2403
- template: '<ng-content></ng-content>',
2404
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2405
- },] }
2406
- ];
2407
- FreeboardChartLayerComponent.ctorParameters = function () { return [
2408
- { type: i0.ChangeDetectorRef },
2409
- { type: MapComponent },
2410
- { type: MapService }
2411
- ]; };
2412
- FreeboardChartLayerComponent.propDecorators = {
2413
- charts: [{ type: i0.Input }],
2414
- zIndex: [{ type: i0.Input }]
2415
- };
2416
-
2417
- // ** Freeboard Track resources collection format **
2418
- var TrackLayerComponent = /** @class */ (function () {
2419
- function TrackLayerComponent(changeDetectorRef, mapComponent) {
2420
- this.changeDetectorRef = changeDetectorRef;
2421
- this.mapComponent = mapComponent;
2422
- /**
2423
- * This event is triggered after the layer is initialized
2424
- * Use this to have access to the layer and some helper functions
2425
- */
2426
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
2427
- this.labelMinZoom = 10;
2428
- this.mapZoom = 10;
2429
- this.changeDetectorRef.detach();
2430
- }
2431
- TrackLayerComponent.prototype.ngOnInit = function () {
2432
- this.parseTracks(this.tracks);
2433
- this.source = new VectorSource__default['default']({ features: this.features });
2434
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
2435
- var map = this.mapComponent.getMap();
2436
- if (this.layer && map) {
2437
- map.addLayer(this.layer);
2438
- map.render();
2439
- this.layerReady.next(this.layer);
2440
- this.layerReady.complete();
2441
- }
2442
- };
2443
- TrackLayerComponent.prototype.ngOnChanges = function (changes) {
2444
- if (this.layer) {
2445
- var properties = {};
2446
- for (var key in changes) {
2447
- if (key == 'tracks') {
2448
- this.parseTracks(changes[key].currentValue);
2449
- if (this.source) {
2450
- this.source.clear();
2451
- this.source.addFeatures(this.features);
2452
- }
2453
- }
2454
- else if (key == 'trackStyles') { }
2455
- else if (key == 'labelMinZoom' || key == 'mapZoom') {
2456
- this.handleLabelZoomChange(key, changes[key]);
2457
- }
2458
- else if (key == 'layerProperties') {
2459
- this.layer.setProperties(properties, false);
2460
- }
2461
- else {
2462
- properties[key] = changes[key].currentValue;
2463
- }
2464
- }
2465
- this.layer.setProperties(properties, false);
2466
- }
2467
- };
2468
- TrackLayerComponent.prototype.ngOnDestroy = function () {
2469
- var map = this.mapComponent.getMap();
2470
- if (this.layer && map) {
2471
- map.removeLayer(this.layer);
2472
- map.render();
2473
- this.layer = null;
2474
- }
2475
- };
2476
- TrackLayerComponent.prototype.parseTracks = function (tracks) {
2477
- var e_1, _a;
2478
- if (tracks === void 0) { tracks = this.tracks; }
2479
- var fa = [];
2480
- try {
2481
- for (var tracks_1 = __values(tracks), tracks_1_1 = tracks_1.next(); !tracks_1_1.done; tracks_1_1 = tracks_1.next()) {
2482
- var w = tracks_1_1.value;
2483
- var f = new ol.Feature({
2484
- geometry: new geom.MultiLineString(this.parseCoordinates(w.feature.geometry.coordinates)),
2485
- name: w.feature.properties.name
2486
- });
2487
- f.setId('track.' + w.feature.id);
2488
- f.setStyle(this.buildStyle(w));
2489
- fa.push(f);
2490
- }
2491
- }
2492
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2493
- finally {
2494
- try {
2495
- if (tracks_1_1 && !tracks_1_1.done && (_a = tracks_1.return)) _a.call(tracks_1);
2496
- }
2497
- finally { if (e_1) throw e_1.error; }
2498
- }
2499
- this.features = fa;
2500
- };
2501
- // ** assess attribute change **
2502
- TrackLayerComponent.prototype.handleLabelZoomChange = function (key, change) {
2503
- if (key == 'labelMinZoom') {
2504
- if (typeof this.mapZoom !== 'undefined') {
2505
- this.updateLabels();
2506
- }
2507
- }
2508
- else if (key == 'mapZoom') {
2509
- if (typeof this.labelMinZoom !== 'undefined') {
2510
- if ((change.currentValue >= this.labelMinZoom && change.previousValue < this.labelMinZoom) ||
2511
- (change.currentValue < this.labelMinZoom && change.previousValue >= this.labelMinZoom)) {
2512
- this.updateLabels();
2513
- }
2514
- }
2515
- }
2516
- };
2517
- // build track style
2518
- TrackLayerComponent.prototype.buildStyle = function (trk) {
2519
- if (typeof this.trackStyles !== 'undefined') {
2520
- if (trk.feature.properties.skType) {
2521
- return this.setTextLabel(this.trackStyles[trk.feature.properties.skType], trk.feature.properties.name);
2522
- }
2523
- else {
2524
- return this.setTextLabel(this.trackStyles.default, trk.feature.properties.name);
2525
- }
2526
- }
2527
- else if (this.layerProperties && this.layerProperties.style) {
2528
- return this.setTextLabel(this.layerProperties.style, trk.feature.properties.name);
2529
- }
2530
- else { // default styles
2531
- var s = new style.Style({
2532
- stroke: new style.Stroke({
2533
- color: 'rgb(146,11,153)',
2534
- width: 2,
2535
- lineDash: [5, 5]
2536
- }),
2537
- text: new style.Text({
2538
- text: '',
2539
- textAlign: 'center'
2540
- })
2541
- });
2542
- return this.setTextLabel(s, trk.feature.properties.name);
2543
- }
2544
- };
2545
- // update feature labels
2546
- TrackLayerComponent.prototype.updateLabels = function () {
2547
- var _this = this;
2548
- this.source.getFeatures().forEach(function (f) {
2549
- var s = f.getStyle();
2550
- f.setStyle(_this.setTextLabel(s, f.get('name')));
2551
- });
2552
- };
2553
- // return a Style with label text
2554
- TrackLayerComponent.prototype.setTextLabel = function (s, text) {
2555
- var cs = s.clone();
2556
- cs.setText(new style.Text({
2557
- text: (Math.abs(this.mapZoom) >= this.labelMinZoom) ? text : '',
2558
- rotateWithView: false,
2559
- offsetY: -12
2560
- }));
2561
- return cs;
2562
- };
2563
- // ** mapify and transform MultiLineString coordinates
2564
- TrackLayerComponent.prototype.parseCoordinates = function (mls) {
2565
- var lines = [];
2566
- mls.forEach(function (line) { return lines.push(mapifyCoords(line)); });
2567
- return fromLonLatArray(lines);
2568
- };
2569
- return TrackLayerComponent;
2570
- }());
2571
- TrackLayerComponent.decorators = [
2572
- { type: i0.Component, args: [{
2573
- selector: 'ol-map > fb-tracks',
2574
- template: '<ng-content></ng-content>',
2575
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2576
- },] }
2577
- ];
2578
- TrackLayerComponent.ctorParameters = function () { return [
2579
- { type: i0.ChangeDetectorRef },
2580
- { type: MapComponent }
2581
- ]; };
2582
- TrackLayerComponent.propDecorators = {
2583
- layerReady: [{ type: i0.Output }],
2584
- tracks: [{ type: i0.Input }],
2585
- trackStyles: [{ type: i0.Input }],
2586
- labelMinZoom: [{ type: i0.Input }],
2587
- mapZoom: [{ type: i0.Input }],
2588
- opacity: [{ type: i0.Input }],
2589
- visible: [{ type: i0.Input }],
2590
- extent: [{ type: i0.Input }],
2591
- zIndex: [{ type: i0.Input }],
2592
- minResolution: [{ type: i0.Input }],
2593
- maxResolution: [{ type: i0.Input }],
2594
- layerProperties: [{ type: i0.Input }]
2595
- };
2596
-
2597
- // ** Signal K resource collection format **
2598
- var ResourceSetLayerComponent = /** @class */ (function () {
2599
- function ResourceSetLayerComponent(changeDetectorRef, mapComponent) {
2600
- this.changeDetectorRef = changeDetectorRef;
2601
- this.mapComponent = mapComponent;
2602
- /**
2603
- * This event is triggered after the layer is initialized
2604
- * Use this to have access to the layer and some helper functions
2605
- */
2606
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
2607
- this.resourceSets = [];
2608
- this.selected = [];
2609
- this.labelMinZoom = 10;
2610
- this.mapZoom = 10;
2611
- this.changeDetectorRef.detach();
2612
- }
2613
- ResourceSetLayerComponent.prototype.ngOnInit = function () {
2614
- this.parseResourceSets(this.resourceSets);
2615
- this.source = new VectorSource__default['default']({ features: this.features });
2616
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
2617
- var map = this.mapComponent.getMap();
2618
- if (this.layer && map) {
2619
- map.addLayer(this.layer);
2620
- map.render();
2621
- this.layerReady.next(this.layer);
2622
- this.layerReady.complete();
2623
- }
2624
- };
2625
- ResourceSetLayerComponent.prototype.ngOnChanges = function (changes) {
2626
- if (this.layer) {
2627
- var properties = {};
2628
- for (var key in changes) {
2629
- if (key == 'resourceSets') {
2630
- this.parseResourceSets(changes[key].currentValue);
2631
- if (this.source) {
2632
- this.source.clear();
2633
- this.source.addFeatures(this.features);
2634
- }
2635
- }
2636
- else if (key == 'labelMinZoom' || key == 'mapZoom') {
2637
- this.handleLabelZoomChange(key, changes[key]);
2638
- }
2639
- else if (key == 'layerProperties') {
2640
- this.layer.setProperties(properties, false);
2641
- }
2642
- else {
2643
- properties[key] = changes[key].currentValue;
2644
- }
2645
- }
2646
- this.layer.setProperties(properties, false);
2647
- }
2648
- };
2649
- ResourceSetLayerComponent.prototype.ngOnDestroy = function () {
2650
- var map = this.mapComponent.getMap();
2651
- if (this.layer && map) {
2652
- map.removeLayer(this.layer);
2653
- map.render();
2654
- this.layer = null;
2655
- }
2656
- };
2657
- // process resource sets
2658
- ResourceSetLayerComponent.prototype.parseResourceSets = function (resourceSets) {
2659
- var e_1, _j;
2660
- this.features = [];
2661
- try {
2662
- for (var resourceSets_1 = __values(resourceSets), resourceSets_1_1 = resourceSets_1.next(); !resourceSets_1_1.done; resourceSets_1_1 = resourceSets_1.next()) {
2663
- var r = resourceSets_1_1.value;
2664
- if (this.selected.includes(r.id)) {
2665
- this.parseResources(r);
2666
- }
2667
- }
2668
- }
2669
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2670
- finally {
2671
- try {
2672
- if (resourceSets_1_1 && !resourceSets_1_1.done && (_j = resourceSets_1.return)) _j.call(resourceSets_1);
2673
- }
2674
- finally { if (e_1) throw e_1.error; }
2675
- }
2676
- };
2677
- // process a resource set
2678
- ResourceSetLayerComponent.prototype.parseResources = function (rSet) {
2679
- var e_2, _j;
2680
- var fa = [];
2681
- try {
2682
- for (var _k = __values(rSet.values.features), _l = _k.next(); !_l.done; _l = _k.next()) {
2683
- var w = _l.value;
2684
- var f = void 0;
2685
- if (w.geometry.type == 'Point') {
2686
- f = new ol.Feature({
2687
- geometry: new geom.Point(proj.fromLonLat(w.geometry.coordinates)),
2688
- name: w.properties.name
2689
- });
2690
- }
2691
- if (w.geometry.type == 'MultiPoint') {
2692
- f = new ol.Feature({
2693
- geometry: new geom.MultiPoint(fromLonLatArray(w.geometry.coordinates)),
2694
- name: w.properties.name
2695
- });
2696
- }
2697
- else if (w.geometry.type == 'LineString') {
2698
- f = new ol.Feature({
2699
- geometry: new geom.LineString(fromLonLatArray(w.geometry.coordinates)),
2700
- name: w.properties.name
2701
- });
2702
- }
2703
- else if (w.geometry.type == 'MultiLineString') {
2704
- f = new ol.Feature({
2705
- geometry: new geom.MultiLineString(fromLonLatArray(w.geometry.coordinates)),
2706
- name: w.properties.name
2707
- });
2708
- }
2709
- else if (w.geometry.type == 'Polygon') {
2710
- f = new ol.Feature({
2711
- geometry: new geom.Polygon(fromLonLatArray(w.geometry.coordinates)),
2712
- name: w.properties.name
2713
- });
2714
- }
2715
- else if (w.geometry.type == 'MultiPolygon') {
2716
- f = new ol.Feature({
2717
- geometry: new geom.MultiPolygon(fromLonLatArray(w.geometry.coordinates)),
2718
- name: w.properties.name
2719
- });
2720
- }
2721
- if (!f) {
2722
- continue;
2723
- }
2724
- // set style
2725
- if (typeof rSet.styles !== 'undefined') {
2726
- var rs = void 0;
2727
- if (typeof w.properties.styleRef !== 'undefined') {
2728
- rs = this.buildStyle(rSet.styles[w.properties.styleRef], w.geometry.type);
2729
- }
2730
- else if (typeof w.properties.style !== 'undefined') {
2731
- rs = this.buildStyle(w.properties.style, w.geometry.type);
2732
- }
2733
- else {
2734
- rs = this.buildStyle(rSet.styles.default, w.geometry.type);
2735
- }
2736
- f.setStyle(this.setTextLabel(rs, w.properties.name));
2737
- }
2738
- fa.push(f);
2739
- }
2740
- }
2741
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2742
- finally {
2743
- try {
2744
- if (_l && !_l.done && (_j = _k.return)) _j.call(_k);
2745
- }
2746
- finally { if (e_2) throw e_2.error; }
2747
- }
2748
- this.features = this.features.concat(fa);
2749
- };
2750
- // ** assess attribute change **
2751
- ResourceSetLayerComponent.prototype.handleLabelZoomChange = function (key, change) {
2752
- if (key == 'labelMinZoom') {
2753
- if (typeof this.mapZoom !== 'undefined') {
2754
- this.updateLabels();
2755
- }
2756
- }
2757
- else if (key == 'mapZoom') {
2758
- if (typeof this.labelMinZoom !== 'undefined') {
2759
- if ((change.currentValue >= this.labelMinZoom && change.previousValue < this.labelMinZoom) ||
2760
- (change.currentValue < this.labelMinZoom && change.previousValue >= this.labelMinZoom)) {
2761
- this.updateLabels();
2762
- }
2763
- }
2764
- }
2765
- };
2766
- // update feature labels
2767
- ResourceSetLayerComponent.prototype.updateLabels = function () {
2768
- var _this = this;
2769
- this.source.getFeatures().forEach(function (f) {
2770
- var s = f.getStyle();
2771
- f.setStyle(_this.setTextLabel(s, f.get('name')));
2772
- });
2773
- };
2774
- // return a Style with label text
2775
- ResourceSetLayerComponent.prototype.setTextLabel = function (s, text) {
2776
- var cs = s.clone();
2777
- cs.setText(new style.Text({
2778
- text: (Math.abs(this.mapZoom) >= this.labelMinZoom) ? text : '',
2779
- rotateWithView: false,
2780
- offsetY: -12
2781
- }));
2782
- return cs;
2783
- };
2784
- ResourceSetLayerComponent.prototype.buildStyle = function (styleDef, geom) {
2785
- var _a, _b, _c, _d, _e, _f, _g, _h;
2786
- var s = new style.Style();
2787
- if (geom == GeometryType__default['default'].POINT || geom == GeometryType__default['default'].MULTI_POINT) {
2788
- s.setImage(new style.Circle({
2789
- radius: (_a = styleDef.width) !== null && _a !== void 0 ? _a : 5,
2790
- fill: new style.Fill({ color: (_b = styleDef.fill) !== null && _b !== void 0 ? _b : 'blue' }),
2791
- stroke: new style.Stroke({
2792
- color: (_c = styleDef.stroke) !== null && _c !== void 0 ? _c : 'blue',
2793
- width: 2,
2794
- lineDash: (_d = styleDef.lineDash) !== null && _d !== void 0 ? _d : [1]
2795
- })
2796
- }));
2797
- }
2798
- else {
2799
- s.setFill(new style.Fill({ color: (_e = styleDef.fill) !== null && _e !== void 0 ? _e : 'blue' }));
2800
- s.setStroke(new style.Stroke({
2801
- color: (_f = styleDef.stroke) !== null && _f !== void 0 ? _f : 'blue',
2802
- width: (_g = styleDef.width) !== null && _g !== void 0 ? _g : 2,
2803
- lineDash: (_h = styleDef.lineDash) !== null && _h !== void 0 ? _h : [1]
2804
- }));
2805
- }
2806
- return s;
2807
- };
2808
- return ResourceSetLayerComponent;
2809
- }());
2810
- ResourceSetLayerComponent.decorators = [
2811
- { type: i0.Component, args: [{
2812
- selector: 'ol-map > fb-resource-sets',
2813
- template: '<ng-content></ng-content>',
2814
- changeDetection: i0.ChangeDetectionStrategy.OnPush
2815
- },] }
2816
- ];
2817
- ResourceSetLayerComponent.ctorParameters = function () { return [
2818
- { type: i0.ChangeDetectorRef },
2819
- { type: MapComponent }
2820
- ]; };
2821
- ResourceSetLayerComponent.propDecorators = {
2822
- layerReady: [{ type: i0.Output }],
2823
- resourceSets: [{ type: i0.Input }],
2824
- selected: [{ type: i0.Input }],
2825
- labelMinZoom: [{ type: i0.Input }],
2826
- mapZoom: [{ type: i0.Input }],
2827
- opacity: [{ type: i0.Input }],
2828
- visible: [{ type: i0.Input }],
2829
- extent: [{ type: i0.Input }],
2830
- zIndex: [{ type: i0.Input }],
2831
- minResolution: [{ type: i0.Input }],
2832
- maxResolution: [{ type: i0.Input }],
2833
- layerProperties: [{ type: i0.Input }]
2834
- };
2835
-
2836
- // ** Signal K targets **
2837
- var SKTargetsLayerComponent = /** @class */ (function () {
2838
- function SKTargetsLayerComponent(changeDetectorRef, mapComponent) {
2839
- this.changeDetectorRef = changeDetectorRef;
2840
- this.mapComponent = mapComponent;
2841
- /**
2842
- * This event is triggered after the layer is initialized
2843
- * Use this to have access to the layer and some helper functions
2844
- */
2845
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
2846
- this.targets = new Map();
2847
- this.inactiveTime = 180000; // in ms (3 mins)
2848
- this.labelMinZoom = 10;
2849
- this.mapZoom = 10;
2850
- this.updateIds = [];
2851
- this.staleIds = [];
2852
- this.removeIds = [];
2853
- this.changeDetectorRef.detach();
2854
- }
2855
- SKTargetsLayerComponent.prototype.ngOnInit = function () {
2856
- this.source = new VectorSource__default['default']();
2857
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
2858
- this.parseItems(this.extractKeys(this.targets));
2859
- var map = this.mapComponent.getMap();
2860
- if (this.layer && map) {
2861
- map.addLayer(this.layer);
2862
- map.render();
2863
- this.layerReady.next(this.layer);
2864
- this.layerReady.complete();
2865
- }
2866
- };
2867
- SKTargetsLayerComponent.prototype.ngOnChanges = function (changes) {
2868
- if (this.layer) {
2869
- var properties = {};
2870
- for (var key in changes) {
2871
- if (key == 'targets' && changes[key].firstChange) {
2872
- if (!changes[key].currentValue) {
2873
- return;
2874
- }
2875
- if (!this.source) {
2876
- return;
2877
- }
2878
- this.source.clear();
2879
- this.parseItems(this.extractKeys(changes[key].currentValue));
2880
- }
2881
- else if (key == 'updateIds') {
2882
- this.parseItems(changes[key].currentValue);
2883
- }
2884
- else if (key == 'staleIds') {
2885
- this.parseItems(changes[key].currentValue, true);
2886
- }
2887
- else if (key == 'removeIds') {
2888
- this.removeItems(changes[key].currentValue);
2889
- }
2890
- else if (key == 'inactiveTime') {
2891
- this.parseItems(Object.keys(this.targets));
2892
- }
2893
- else if (key == 'targetStyles' && !changes[key].firstChange) {
2894
- this.parseItems(Object.keys(this.targets));
2895
- }
2896
- else if (key == 'labelMinZoom' || key == 'mapZoom') {
2897
- this.handleLabelZoomChange(key, changes[key]);
2898
- }
2899
- else if (key == 'layerProperties') {
2900
- this.layer.setProperties(properties, false);
2901
- }
2902
- else {
2903
- properties[key] = changes[key].currentValue;
2904
- }
2905
- }
2906
- this.layer.setProperties(properties, false);
2907
- }
2908
- };
2909
- SKTargetsLayerComponent.prototype.ngOnDestroy = function () {
2910
- var map = this.mapComponent.getMap();
2911
- if (this.layer && map) {
2912
- map.removeLayer(this.layer);
2913
- map.render();
2914
- this.layer = null;
2915
- }
2916
- };
2917
- // ** assess attribute change **
2918
- SKTargetsLayerComponent.prototype.handleLabelZoomChange = function (key, change) {
2919
- if (key == 'labelMinZoom') {
2920
- if (typeof this.mapZoom !== 'undefined') {
2921
- this.updateLabels();
2922
- }
2923
- }
2924
- else if (key == 'mapZoom') {
2925
- if (typeof this.labelMinZoom !== 'undefined') {
2926
- if ((change.currentValue >= this.labelMinZoom && change.previousValue < this.labelMinZoom) ||
2927
- (change.currentValue < this.labelMinZoom && change.previousValue >= this.labelMinZoom)) {
2928
- this.updateLabels();
2929
- }
2930
- }
2931
- }
2932
- };
2933
- SKTargetsLayerComponent.prototype.extractKeys = function (m) {
2934
- var keys = [];
2935
- m.forEach(function (v, k) { keys.push(k); });
2936
- return keys;
2937
- };
2938
- // add update features
2939
- SKTargetsLayerComponent.prototype.parseItems = function (ids, stale) {
2940
- var _this = this;
2941
- if (stale === void 0) { stale = false; }
2942
- if (!ids || !Array.isArray(ids)) {
2943
- return;
2944
- }
2945
- if (!this.source) {
2946
- return;
2947
- }
2948
- ids.forEach(function (w) {
2949
- if (_this.targetType && w.indexOf(_this.targetType) != 0) {
2950
- return;
2951
- }
2952
- if (_this.targets.has(w)) {
2953
- var target = _this.targets.get(w);
2954
- // ** target **
2955
- var f = _this.source.getFeatureById(w);
2956
- if (f) { // exists so update it
2957
- if (target.position) {
2958
- f.setGeometry(new geom.Point(proj.fromLonLat(target.position)));
2959
- f.setStyle(_this.buildStyle(target, stale));
2960
- }
2961
- else {
2962
- _this.source.removeFeature(f);
2963
- }
2964
- }
2965
- else { // does not exist so create it
2966
- if (target.position) {
2967
- f = new ol.Feature({
2968
- geometry: new geom.Point(proj.fromLonLat(target.position)),
2969
- name: target.name
2970
- });
2971
- f.setId(w);
2972
- f.setStyle(_this.buildStyle(target, stale));
2973
- _this.source.addFeature(f);
2974
- }
2975
- }
2976
- }
2977
- });
2978
- };
2979
- // remove features
2980
- SKTargetsLayerComponent.prototype.removeItems = function (ids) {
2981
- var _this = this;
2982
- if (!ids || !Array.isArray(ids)) {
2983
- return;
2984
- }
2985
- if (!this.source) {
2986
- return;
2987
- }
2988
- ids.forEach(function (w) {
2989
- if (_this.targetType && w.indexOf(_this.targetType) != 0) {
2990
- return;
2991
- }
2992
- var f = _this.source.getFeatureById(w);
2993
- if (f) {
2994
- _this.source.removeFeature(f);
2995
- }
2996
- });
2997
- };
2998
- // build target style
2999
- SKTargetsLayerComponent.prototype.buildStyle = function (item, setStale) {
3000
- if (setStale === void 0) { setStale = false; }
3001
- var _a, _b, _c, _d;
3002
- var s;
3003
- // label text
3004
- var lbl = (_c = (_b = (_a = item.name) !== null && _a !== void 0 ? _a : item.callsign) !== null && _b !== void 0 ? _b : item.mmsi) !== null && _c !== void 0 ? _c : '';
3005
- // ** stale check time ref
3006
- var now = new Date().valueOf();
3007
- if (typeof this.targetStyles !== 'undefined') {
3008
- if (setStale || item.lastUpdated < (now - this.inactiveTime)) { // stale
3009
- s = (_d = this.targetStyles.inactive) !== null && _d !== void 0 ? _d : this.targetStyles.default;
3010
- }
3011
- else {
3012
- s = this.targetStyles.default;
3013
- }
3014
- }
3015
- else if (this.layerProperties && this.layerProperties.style) {
3016
- s = this.layerProperties.style;
3017
- }
3018
- else {
3019
- s = new style.Style({
3020
- image: new style.RegularShape({
3021
- points: 3,
3022
- radius: 7,
3023
- fill: new style.Fill({ color: 'magenta' }),
3024
- stroke: new style.Stroke({
3025
- color: 'black',
3026
- width: 1
3027
- }),
3028
- rotateWithView: true
3029
- })
3030
- });
3031
- }
3032
- s = this.setRotation(this.setTextLabel(s, lbl), item.orientation);
3033
- return s;
3034
- };
3035
- // update feature labels
3036
- SKTargetsLayerComponent.prototype.updateLabels = function () {
3037
- var _this = this;
3038
- this.source.getFeatures().forEach(function (f) {
3039
- var s = f.getStyle();
3040
- f.setStyle(_this.setTextLabel(s, f.get('name')));
3041
- });
3042
- };
3043
- // return a Style with label text set
3044
- SKTargetsLayerComponent.prototype.setTextLabel = function (s, text) {
3045
- if (!s) {
3046
- return s;
3047
- }
3048
- var cs = s.clone();
3049
- var ts = cs.getText();
3050
- if (ts) {
3051
- ts.setText((Math.abs(this.mapZoom) >= this.labelMinZoom) ? text : '');
3052
- cs.setText(ts);
3053
- }
3054
- return cs;
3055
- };
3056
- // return a Style with rotation set
3057
- SKTargetsLayerComponent.prototype.setRotation = function (s, value) {
3058
- if (!s) {
3059
- return s;
3060
- }
3061
- var cs = s.clone();
3062
- var im = cs.getImage();
3063
- if (im) {
3064
- im.setRotation(value !== null && value !== void 0 ? value : 0);
3065
- cs.setImage(im);
3066
- }
3067
- return cs;
3068
- };
3069
- return SKTargetsLayerComponent;
3070
- }());
3071
- SKTargetsLayerComponent.decorators = [
3072
- { type: i0.Component, args: [{
3073
- selector: 'ol-map > sk-targets',
3074
- template: '<ng-content></ng-content>',
3075
- changeDetection: i0.ChangeDetectionStrategy.OnPush
3076
- },] }
3077
- ];
3078
- SKTargetsLayerComponent.ctorParameters = function () { return [
3079
- { type: i0.ChangeDetectorRef },
3080
- { type: MapComponent }
3081
- ]; };
3082
- SKTargetsLayerComponent.propDecorators = {
3083
- layerReady: [{ type: i0.Output }],
3084
- targets: [{ type: i0.Input }],
3085
- targetStyles: [{ type: i0.Input }],
3086
- targetType: [{ type: i0.Input }],
3087
- inactiveTime: [{ type: i0.Input }],
3088
- labelMinZoom: [{ type: i0.Input }],
3089
- mapZoom: [{ type: i0.Input }],
3090
- updateIds: [{ type: i0.Input }],
3091
- staleIds: [{ type: i0.Input }],
3092
- removeIds: [{ type: i0.Input }],
3093
- opacity: [{ type: i0.Input }],
3094
- visible: [{ type: i0.Input }],
3095
- extent: [{ type: i0.Input }],
3096
- zIndex: [{ type: i0.Input }],
3097
- minResolution: [{ type: i0.Input }],
3098
- maxResolution: [{ type: i0.Input }],
3099
- layerProperties: [{ type: i0.Input }]
3100
- };
3101
-
3102
- // ** Signal K Other Vessels **
3103
- var SKVesselsLayerComponent = /** @class */ (function () {
3104
- function SKVesselsLayerComponent(changeDetectorRef, mapComponent) {
3105
- this.changeDetectorRef = changeDetectorRef;
3106
- this.mapComponent = mapComponent;
3107
- this.targetType = 'vessel';
3108
- /**
3109
- * This event is triggered after the layer is initialized
3110
- * Use this to have access to the layer and some helper functions
3111
- */
3112
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
3113
- this.targets = new Map();
3114
- this.inactiveTime = 180000; // in ms (3 mins)
3115
- this.labelMinZoom = 10;
3116
- this.mapZoom = 10;
3117
- this.showVector = true;
3118
- this.vectorMinZoom = 15;
3119
- this.vectorApparent = false;
3120
- this.updateIds = [];
3121
- this.staleIds = [];
3122
- this.removeIds = [];
3123
- this.zoomOffsetLevel = [
3124
- 1, 1000000, 550000, 290000, 140000, 70000,
3125
- 38000, 17000, 7600, 3900, 1900,
3126
- 950, 470, 250, 120, 60,
3127
- 30, 15.5, 8.1, 4, 2,
3128
- 1, .5, .25, .12, .06,
3129
- .03, .015, .008, 1
3130
- ];
3131
- this.changeDetectorRef.detach();
3132
- }
3133
- SKVesselsLayerComponent.prototype.ngOnInit = function () {
3134
- this.source = new VectorSource__default['default']();
3135
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
3136
- this.parseItems(this.extractKeys(this.targets));
3137
- var map = this.mapComponent.getMap();
3138
- if (this.layer && map) {
3139
- map.addLayer(this.layer);
3140
- map.render();
3141
- this.layerReady.next(this.layer);
3142
- this.layerReady.complete();
3143
- }
3144
- };
3145
- SKVesselsLayerComponent.prototype.ngOnChanges = function (changes) {
3146
- if (this.layer) {
3147
- var properties = {};
3148
- for (var key in changes) {
3149
- if (key == 'targets' && changes[key].firstChange) {
3150
- if (!changes[key].currentValue) {
3151
- return;
3152
- }
3153
- if (!this.source) {
3154
- return;
3155
- }
3156
- this.source.clear();
3157
- this.parseItems(this.extractKeys(changes[key].currentValue));
3158
- }
3159
- else if (key == 'updateIds') {
3160
- this.parseItems(changes[key].currentValue);
3161
- }
3162
- else if (key == 'staleIds') {
3163
- this.parseItems(changes[key].currentValue, true);
3164
- }
3165
- else if (key == 'removeIds') {
3166
- this.removeItems(changes[key].currentValue);
3167
- }
3168
- else if (key == 'inactiveTime') {
3169
- this.parseItems(this.extractKeys(this.targets));
3170
- }
3171
- else if (key == 'focusId' || key == 'filterIds' || key == 'vectorApparent') {
3172
- this.parseItems(this.extractKeys(this.targets));
3173
- }
3174
- else if (key == 'targetStyles' && !changes[key].firstChange) {
3175
- this.parseItems(this.extractKeys(this.targets));
3176
- }
3177
- else if (key == 'labelMinZoom' || key == 'mapZoom' || key == 'vectorMinZoom') {
3178
- this.handleLabelZoomChange(key, changes[key]);
3179
- }
3180
- else if (key == 'layerProperties') {
3181
- this.layer.setProperties(properties, false);
3182
- }
3183
- else {
3184
- properties[key] = changes[key].currentValue;
3185
- }
3186
- }
3187
- this.layer.setProperties(properties, false);
3188
- }
3189
- };
3190
- SKVesselsLayerComponent.prototype.ngOnDestroy = function () {
3191
- var map = this.mapComponent.getMap();
3192
- if (this.layer && map) {
3193
- map.removeLayer(this.layer);
3194
- map.render();
3195
- this.layer = null;
3196
- }
3197
- };
3198
- // ** assess attribute change **
3199
- SKVesselsLayerComponent.prototype.handleLabelZoomChange = function (key, change) {
3200
- var _this = this;
3201
- if (key == 'labelMinZoom') {
3202
- if (typeof this.mapZoom !== 'undefined') {
3203
- this.updateLabels();
3204
- }
3205
- }
3206
- else if (key == 'vectorMinZoom') {
3207
- if (typeof this.mapZoom !== 'undefined') {
3208
- this.targets.forEach(function (v, k) { _this.parseWindVector(k, v); });
3209
- }
3210
- }
3211
- else if (key == 'mapZoom') {
3212
- if (typeof this.labelMinZoom !== 'undefined') {
3213
- if ((change.currentValue >= this.labelMinZoom && change.previousValue < this.labelMinZoom) ||
3214
- (change.currentValue < this.labelMinZoom && change.previousValue >= this.labelMinZoom)) {
3215
- this.updateLabels();
3216
- }
3217
- }
3218
- if (typeof this.vectorMinZoom !== 'undefined') {
3219
- if ((change.currentValue >= this.vectorMinZoom && change.previousValue < this.vectorMinZoom) ||
3220
- (change.currentValue < this.vectorMinZoom && change.previousValue >= this.vectorMinZoom)) {
3221
- this.targets.forEach(function (v, k) { _this.parseWindVector(k, v); });
3222
- }
3223
- }
3224
- }
3225
- };
3226
- SKVesselsLayerComponent.prototype.extractKeys = function (m) {
3227
- var _this = this;
3228
- var keys = [];
3229
- m.forEach(function (v, k) {
3230
- if (k.indexOf(_this.targetType) != -1) {
3231
- keys.push(k);
3232
- }
3233
- });
3234
- return keys;
3235
- };
3236
- // returns true if item should be rendered
3237
- SKVesselsLayerComponent.prototype.okToRender = function (id, vector) {
3238
- if (vector && !this.showVector) {
3239
- return false;
3240
- }
3241
- if (!this.filterIds) {
3242
- return true;
3243
- }
3244
- if (Array.isArray(this.filterIds)) {
3245
- return this.filterIds.includes(id);
3246
- }
3247
- else {
3248
- return true;
3249
- }
3250
- };
3251
- // add update features
3252
- SKVesselsLayerComponent.prototype.parseItems = function (ids, stale) {
3253
- var _this = this;
3254
- if (stale === void 0) { stale = false; }
3255
- if (!ids || !Array.isArray(ids)) {
3256
- return;
3257
- }
3258
- if (!this.source) {
3259
- return;
3260
- }
3261
- ids.forEach(function (w) {
3262
- if (w.indexOf('vessel') == -1) {
3263
- return;
3264
- }
3265
- if (_this.targets.has(w)) {
3266
- var target = _this.targets.get(w);
3267
- // ** target **
3268
- var f = _this.source.getFeatureById('ais-' + w);
3269
- if (f) { // exists so update it
3270
- if (_this.okToRender(w) && target.position) {
3271
- f.setGeometry(new geom.Point(proj.fromLonLat(target.position)));
3272
- f.setStyle(_this.buildTargetStyle(w, target, stale));
3273
- }
3274
- else {
3275
- _this.source.removeFeature(f);
3276
- }
3277
- }
3278
- else { // does not exist so create it
3279
- if (_this.okToRender(w) && target.position) {
3280
- f = new ol.Feature({
3281
- geometry: new geom.Point(proj.fromLonLat(target.position)),
3282
- name: target.name
3283
- });
3284
- f.setId('ais-' + w);
3285
- f.setStyle(_this.buildTargetStyle(w, target, stale));
3286
- _this.source.addFeature(f);
3287
- }
3288
- }
3289
- _this.parseWindVector(w, target);
3290
- }
3291
- });
3292
- };
3293
- // add update Wind vector
3294
- SKVesselsLayerComponent.prototype.parseWindVector = function (id, target) {
3295
- if (!this.source) {
3296
- return;
3297
- }
3298
- if (!target.wind || typeof target.orientation === 'undefined') {
3299
- return;
3300
- }
3301
- var windDirection = (this.vectorApparent) ?
3302
- (typeof target.wind.awa !== 'undefined') ? target.orientation + target.wind.awa : null
3303
- : target.wind.direction;
3304
- if (typeof windDirection !== 'number') {
3305
- return;
3306
- }
3307
- var wf = this.source.getFeatureById('wind-' + id);
3308
- if (!this.okToRender(id, true) || !target.position) {
3309
- if (wf) {
3310
- this.source.removeFeature(wf);
3311
- }
3312
- return;
3313
- }
3314
- var windc = destCoordinate(target.position, windDirection, this.zoomOffsetLevel[this.mapZoom]);
3315
- if (wf) { // update vector
3316
- wf.setGeometry(new geom.LineString([
3317
- proj.fromLonLat(target.position),
3318
- proj.fromLonLat(windc)
3319
- ]));
3320
- wf.setStyle(this.buildVectorStyle(id));
3321
- }
3322
- else { // create vector
3323
- wf = new ol.Feature(new geom.LineString([
3324
- proj.fromLonLat(target.position),
3325
- proj.fromLonLat(windc)
3326
- ]));
3327
- wf.setId('wind-' + id);
3328
- wf.setStyle(this.buildVectorStyle(id));
3329
- this.source.addFeature(wf);
3330
- }
3331
- };
3332
- // remove features
3333
- SKVesselsLayerComponent.prototype.removeItems = function (ids) {
3334
- var _this = this;
3335
- if (!ids || !Array.isArray(ids)) {
3336
- return;
3337
- }
3338
- if (!this.source) {
3339
- return;
3340
- }
3341
- ids.forEach(function (w) {
3342
- var f = _this.source.getFeatureById('ais-' + w);
3343
- if (f) {
3344
- _this.source.removeFeature(f);
3345
- }
3346
- f = _this.source.getFeatureById('wind-' + w);
3347
- if (f) {
3348
- _this.source.removeFeature(f);
3349
- }
3350
- });
3351
- };
3352
- // build target style
3353
- SKVesselsLayerComponent.prototype.buildTargetStyle = function (id, item, setStale) {
3354
- if (setStale === void 0) { setStale = false; }
3355
- var _a, _b, _c;
3356
- var s;
3357
- var lbl = (_c = (_b = (_a = item.name) !== null && _a !== void 0 ? _a : item.callsign) !== null && _b !== void 0 ? _b : item.mmsi) !== null && _c !== void 0 ? _c : '';
3358
- // ** stale check time ref
3359
- var now = new Date().valueOf();
3360
- if (typeof this.targetStyles !== 'undefined') {
3361
- if (id == this.focusId && this.targetStyles.focus) {
3362
- s = this.targetStyles.focus;
3363
- }
3364
- else if (setStale || item.lastUpdated < (now - this.inactiveTime)) { // stale
3365
- s = this.targetStyles.inactive;
3366
- }
3367
- else if (item.buddy && this.targetStyles.buddy) {
3368
- s = this.targetStyles.buddy;
3369
- }
3370
- else {
3371
- s = this.targetStyles.default;
3372
- }
3373
- }
3374
- else if (this.layerProperties && this.layerProperties.style) {
3375
- s = this.layerProperties.style;
3376
- }
3377
- else {
3378
- if (id == this.focusId) {
3379
- s = new style.Style({
3380
- image: new style.RegularShape({
3381
- points: 3,
3382
- radius: 4,
3383
- fill: new style.Fill({ color: 'red' }),
3384
- stroke: new style.Stroke({
3385
- color: 'black',
3386
- width: 1
3387
- }),
3388
- rotateWithView: true
3389
- })
3390
- });
3391
- }
3392
- else if (setStale || item.lastUpdated < (now - this.inactiveTime)) {
3393
- s = new style.Style({
3394
- image: new style.RegularShape({
3395
- points: 3,
3396
- radius: 4,
3397
- fill: new style.Fill({ color: 'orange' }),
3398
- stroke: new style.Stroke({
3399
- color: 'black',
3400
- width: 1
3401
- }),
3402
- rotateWithView: true
3403
- })
3404
- });
3405
- }
3406
- else {
3407
- s = new style.Style({
3408
- image: new style.RegularShape({
3409
- points: 3,
3410
- radius: 4,
3411
- fill: new style.Fill({ color: 'magenta' }),
3412
- stroke: new style.Stroke({
3413
- color: 'black',
3414
- width: 1
3415
- }),
3416
- rotateWithView: true
3417
- })
3418
- });
3419
- }
3420
- }
3421
- s = this.setRotation(this.setTextLabel(s, lbl), item.orientation);
3422
- return s;
3423
- };
3424
- // build wind vector style
3425
- SKVesselsLayerComponent.prototype.buildVectorStyle = function (id) {
3426
- var color = (this.vectorApparent) ? '16, 75, 16' : '128, 128, 0';
3427
- var opacity = this.okToRender(id) ? 1 : 0;
3428
- opacity &= (this.mapZoom < this.vectorMinZoom) ? 0 : 1;
3429
- return new style.Style({
3430
- stroke: new style.Stroke({
3431
- width: 2,
3432
- color: "rgba(" + color + "," + opacity + ")"
3433
- }),
3434
- });
3435
- };
3436
- // update feature labels
3437
- SKVesselsLayerComponent.prototype.updateLabels = function () {
3438
- var _this = this;
3439
- this.source.getFeatures().forEach(function (f) {
3440
- var id = f.getId();
3441
- if (id.indexOf('ais-') != -1) {
3442
- var s = f.getStyle();
3443
- f.setStyle(_this.setTextLabel(s, f.get('name')));
3444
- }
3445
- });
3446
- };
3447
- // return a Style with label text set
3448
- SKVesselsLayerComponent.prototype.setTextLabel = function (s, text) {
3449
- if (!s) {
3450
- return s;
3451
- }
3452
- var cs = s.clone();
3453
- var ts = cs.getText();
3454
- if (ts) {
3455
- ts.setText((Math.abs(this.mapZoom) >= this.labelMinZoom) ? text : '');
3456
- cs.setText(ts);
3457
- }
3458
- return cs;
3459
- };
3460
- // return a Style with rotation set
3461
- SKVesselsLayerComponent.prototype.setRotation = function (s, value) {
3462
- if (!s) {
3463
- return s;
3464
- }
3465
- var cs = s.clone();
3466
- var im = cs.getImage();
3467
- if (im) {
3468
- im.setRotation(value !== null && value !== void 0 ? value : 0);
3469
- cs.setImage(im);
3470
- }
3471
- return cs;
3472
- };
3473
- return SKVesselsLayerComponent;
3474
- }());
3475
- SKVesselsLayerComponent.decorators = [
3476
- { type: i0.Component, args: [{
3477
- selector: 'ol-map > sk-ais-vessels',
3478
- template: '<ng-content></ng-content>',
3479
- changeDetection: i0.ChangeDetectionStrategy.OnPush
3480
- },] }
3481
- ];
3482
- SKVesselsLayerComponent.ctorParameters = function () { return [
3483
- { type: i0.ChangeDetectorRef },
3484
- { type: MapComponent }
3485
- ]; };
3486
- SKVesselsLayerComponent.propDecorators = {
3487
- layerReady: [{ type: i0.Output }],
3488
- targets: [{ type: i0.Input }],
3489
- targetStyles: [{ type: i0.Input }],
3490
- focusId: [{ type: i0.Input }],
3491
- inactiveTime: [{ type: i0.Input }],
3492
- labelMinZoom: [{ type: i0.Input }],
3493
- mapZoom: [{ type: i0.Input }],
3494
- showVector: [{ type: i0.Input }],
3495
- vectorMinZoom: [{ type: i0.Input }],
3496
- vectorApparent: [{ type: i0.Input }],
3497
- filterIds: [{ type: i0.Input }],
3498
- updateIds: [{ type: i0.Input }],
3499
- staleIds: [{ type: i0.Input }],
3500
- removeIds: [{ type: i0.Input }],
3501
- opacity: [{ type: i0.Input }],
3502
- visible: [{ type: i0.Input }],
3503
- extent: [{ type: i0.Input }],
3504
- zIndex: [{ type: i0.Input }],
3505
- minResolution: [{ type: i0.Input }],
3506
- maxResolution: [{ type: i0.Input }],
3507
- layerProperties: [{ type: i0.Input }]
3508
- };
3509
-
3510
- // ** Signal K target tracks **
3511
- var SKTargetTracksLayerComponent = /** @class */ (function () {
3512
- function SKTargetTracksLayerComponent(changeDetectorRef, mapComponent) {
3513
- this.changeDetectorRef = changeDetectorRef;
3514
- this.mapComponent = mapComponent;
3515
- /**
3516
- * This event is triggered after the layer is initialized
3517
- * Use this to have access to the layer and some helper functions
3518
- */
3519
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
3520
- this.tracks = new Map();
3521
- this.minZoom = 10;
3522
- this.mapZoom = 10;
3523
- this.showTracks = true;
3524
- this.updateIds = [];
3525
- this.removeIds = [];
3526
- this.changeDetectorRef.detach();
3527
- }
3528
- SKTargetTracksLayerComponent.prototype.ngOnInit = function () {
3529
- this.source = new VectorSource__default['default']();
3530
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
3531
- this.parseItems(this.extractKeys(this.tracks));
3532
- var map = this.mapComponent.getMap();
3533
- if (this.layer && map) {
3534
- map.addLayer(this.layer);
3535
- map.render();
3536
- this.layerReady.next(this.layer);
3537
- this.layerReady.complete();
3538
- }
3539
- };
3540
- SKTargetTracksLayerComponent.prototype.ngOnChanges = function (changes) {
3541
- if (this.layer) {
3542
- var properties = {};
3543
- for (var key in changes) {
3544
- if (key == 'tracks' && changes[key].firstChange) {
3545
- if (!changes[key].currentValue) {
3546
- return;
3547
- }
3548
- if (!this.source) {
3549
- return;
3550
- }
3551
- this.source.clear();
3552
- this.parseItems(this.extractKeys(changes[key].currentValue));
3553
- }
3554
- else if (key == 'updateIds') {
3555
- this.parseItems(changes[key].currentValue);
3556
- }
3557
- else if (key == 'removeIds') {
3558
- this.removeItems(changes[key].currentValue);
3559
- }
3560
- else if (key == 'showTracks' && !changes[key].firstChange) {
3561
- if (changes[key].currentValue) {
3562
- this.parseItems(this.extractKeys(this.tracks));
3563
- }
3564
- else {
3565
- this.source.clear();
3566
- }
3567
- }
3568
- else if (key == 'labelMinZoom' || key == 'mapZoom') {
3569
- this.handleLabelZoomChange(key, changes[key]);
3570
- }
3571
- else if (key == 'layerProperties') {
3572
- this.layer.setProperties(properties, false);
3573
- }
3574
- else {
3575
- properties[key] = changes[key].currentValue;
3576
- }
3577
- }
3578
- this.layer.setProperties(properties, false);
3579
- }
3580
- };
3581
- SKTargetTracksLayerComponent.prototype.ngOnDestroy = function () {
3582
- var map = this.mapComponent.getMap();
3583
- if (this.layer && map) {
3584
- map.removeLayer(this.layer);
3585
- map.render();
3586
- this.layer = null;
3587
- }
3588
- };
3589
- // ** assess attribute change **
3590
- SKTargetTracksLayerComponent.prototype.handleLabelZoomChange = function (key, change) {
3591
- if (key == 'labelMinZoom') {
3592
- if (typeof this.mapZoom !== 'undefined') {
3593
- this.parseItems(this.extractKeys(this.tracks));
3594
- }
3595
- }
3596
- else if (key == 'mapZoom') {
3597
- if (typeof this.minZoom !== 'undefined') {
3598
- if ((change.currentValue >= this.minZoom && change.previousValue < this.minZoom) ||
3599
- (change.currentValue < this.minZoom && change.previousValue >= this.minZoom)) {
3600
- this.parseItems(this.extractKeys(this.tracks));
3601
- }
3602
- }
3603
- }
3604
- };
3605
- SKTargetTracksLayerComponent.prototype.extractKeys = function (m) {
3606
- var keys = [];
3607
- m.forEach(function (v, k) { keys.push(k); });
3608
- return keys;
3609
- };
3610
- // add update features
3611
- SKTargetTracksLayerComponent.prototype.parseItems = function (ids) {
3612
- var _this = this;
3613
- if (!ids || !Array.isArray(ids)) {
3614
- return;
3615
- }
3616
- if (!this.source) {
3617
- return;
3618
- }
3619
- ids.forEach(function (w) {
3620
- if (_this.tracks.has(w)) {
3621
- var target = _this.tracks.get(w);
3622
- // ** target **
3623
- var f = _this.source.getFeatureById('track-' + w);
3624
- if (f) { // exists so update it
3625
- f.setGeometry(new geom.MultiLineString(_this.parseCoordinates(target)));
3626
- f.setStyle(_this.buildStyle(w));
3627
- }
3628
- else { // does not exist so create it
3629
- f = new ol.Feature({
3630
- geometry: new geom.MultiLineString(_this.parseCoordinates(target))
3631
- });
3632
- f.setId('track-' + w);
3633
- f.setStyle(_this.buildStyle(w));
3634
- _this.source.addFeature(f);
3635
- }
3636
- }
3637
- });
3638
- };
3639
- // remove features
3640
- SKTargetTracksLayerComponent.prototype.removeItems = function (ids) {
3641
- var _this = this;
3642
- if (!ids || !Array.isArray(ids)) {
3643
- return;
3644
- }
3645
- if (!this.source) {
3646
- return;
3647
- }
3648
- ids.forEach(function (w) {
3649
- var f = _this.source.getFeatureById('track-' + w);
3650
- if (f) {
3651
- _this.source.removeFeature(f);
3652
- }
3653
- });
3654
- };
3655
- // build target style
3656
- SKTargetTracksLayerComponent.prototype.buildStyle = function (id) {
3657
- var rgb = (id.indexOf('aircraft') != -1) ? '0, 0, 255' : '255, 0, 255';
3658
- var color = (this.mapZoom < this.minZoom) ? "rgba(" + rgb + ",0)" : "rgba(" + rgb + ",1)";
3659
- color = (this.showTracks) ? "rgba(" + rgb + ",1)" : "rgba(" + rgb + ",0)";
3660
- if (this.layerProperties && this.layerProperties.style) {
3661
- var cs = this.layerProperties.style.clone();
3662
- var ls = cs.getStroke();
3663
- ls.setColor(color);
3664
- cs.setStroke(ls);
3665
- return cs;
3666
- }
3667
- else {
3668
- return new style.Style({
3669
- stroke: new style.Stroke({
3670
- width: 1,
3671
- color: color,
3672
- lineDash: [2, 2]
3673
- })
3674
- });
3675
- }
3676
- };
3677
- // ** mapify and transform MultiLineString coordinates
3678
- SKTargetTracksLayerComponent.prototype.parseCoordinates = function (trk) {
3679
- // ** handle dateline crossing **
3680
- var tc = trk.map(function (mls) {
3681
- var lines = [];
3682
- mls.forEach(function (line) { return lines.push(mapifyCoords(line)); });
3683
- return lines;
3684
- });
3685
- return fromLonLatArray(tc);
3686
- };
3687
- return SKTargetTracksLayerComponent;
3688
- }());
3689
- SKTargetTracksLayerComponent.decorators = [
3690
- { type: i0.Component, args: [{
3691
- selector: 'ol-map > sk-target-tracks',
3692
- template: '<ng-content></ng-content>',
3693
- changeDetection: i0.ChangeDetectionStrategy.OnPush
3694
- },] }
3695
- ];
3696
- SKTargetTracksLayerComponent.ctorParameters = function () { return [
3697
- { type: i0.ChangeDetectorRef },
3698
- { type: MapComponent }
3699
- ]; };
3700
- SKTargetTracksLayerComponent.propDecorators = {
3701
- layerReady: [{ type: i0.Output }],
3702
- tracks: [{ type: i0.Input }],
3703
- minZoom: [{ type: i0.Input }],
3704
- mapZoom: [{ type: i0.Input }],
3705
- showTracks: [{ type: i0.Input }],
3706
- updateIds: [{ type: i0.Input }],
3707
- removeIds: [{ type: i0.Input }],
3708
- opacity: [{ type: i0.Input }],
3709
- visible: [{ type: i0.Input }],
3710
- extent: [{ type: i0.Input }],
3711
- zIndex: [{ type: i0.Input }],
3712
- minResolution: [{ type: i0.Input }],
3713
- maxResolution: [{ type: i0.Input }],
3714
- layerProperties: [{ type: i0.Input }]
3715
- };
3716
-
3717
- // ** Freeboard Anchor Alarm component **
3718
- var AnchorAlarmComponent = /** @class */ (function () {
3719
- function AnchorAlarmComponent(changeDetectorRef, mapComponent) {
3720
- this.changeDetectorRef = changeDetectorRef;
3721
- this.mapComponent = mapComponent;
3722
- /**
3723
- * This event is triggered after the layer is initialized
3724
- * Use this to have access to the layer and some helper functions
3725
- */
3726
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
3727
- this.mapifiedRadius = 0;
3728
- this.mapifiedLine = [];
3729
- this.changeDetectorRef.detach();
3730
- }
3731
- AnchorAlarmComponent.prototype.ngOnInit = function () {
3732
- this.parseValues();
3733
- this.source = new VectorSource__default['default']({ features: this.features });
3734
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
3735
- var map = this.mapComponent.getMap();
3736
- if (this.layer && map) {
3737
- map.addLayer(this.layer);
3738
- map.render();
3739
- this.layerReady.next(this.layer);
3740
- this.layerReady.complete();
3741
- }
3742
- };
3743
- AnchorAlarmComponent.prototype.ngOnChanges = function (changes) {
3744
- if (this.layer) {
3745
- var properties = {};
3746
- for (var key in changes) {
3747
- if (key == 'radius' || key == 'anchorPosition' || key == 'lineCoords') {
3748
- this.parseValues();
3749
- if (this.source) {
3750
- this.source.clear();
3751
- this.source.addFeatures(this.features);
3752
- }
3753
- }
3754
- else if (key == 'layerProperties') {
3755
- this.layer.setProperties(properties, false);
3756
- }
3757
- else {
3758
- properties[key] = changes[key].currentValue;
3759
- }
3760
- }
3761
- this.layer.setProperties(properties, false);
3762
- }
3763
- };
3764
- AnchorAlarmComponent.prototype.ngOnDestroy = function () {
3765
- var map = this.mapComponent.getMap();
3766
- if (this.layer && map) {
3767
- map.removeLayer(this.layer);
3768
- map.render();
3769
- this.layer = null;
3770
- }
3771
- };
3772
- AnchorAlarmComponent.prototype.parseValues = function () {
3773
- this.mapifiedRadius = mapifyRadius(this.radius, this.anchorPosition);
3774
- this.mapifiedLine = mapifyCoords(this.lineCoords);
3775
- var fa = [];
3776
- var f = new ol.Feature({
3777
- geometry: new geom.LineString(fromLonLatArray(this.mapifiedLine))
3778
- });
3779
- f.setStyle(this.buildStyle('line'));
3780
- fa.push(f);
3781
- f = new ol.Feature({
3782
- geometry: new geom.Circle(proj.fromLonLat(this.anchorPosition), this.mapifiedRadius)
3783
- });
3784
- f.setStyle(this.buildStyle('circle'));
3785
- fa.push(f);
3786
- f = new ol.Feature({
3787
- geometry: new geom.Point(proj.fromLonLat(this.anchorPosition))
3788
- });
3789
- f.setStyle(this.buildStyle('anchor'));
3790
- fa.push(f);
3791
- this.features = fa;
3792
- };
3793
- // build target style
3794
- AnchorAlarmComponent.prototype.buildStyle = function (key) {
3795
- if (this.anchorStyles && this.anchorStyles[key]) {
3796
- return this.anchorStyles[key];
3797
- }
3798
- else {
3799
- if (this.layerProperties && this.layerProperties.style) {
3800
- return this.layerProperties.style;
3801
- }
3802
- else { // default style
3803
- return new style.Style({
3804
- stroke: new style.Stroke({
3805
- width: 2,
3806
- color: 'black',
3807
- lineDash: [5, 5]
3808
- }),
3809
- fill: new style.Fill({
3810
- color: 'rgba(0, 255, 0, .3)'
3811
- })
3812
- });
3813
- }
3814
- }
3815
- };
3816
- return AnchorAlarmComponent;
3817
- }());
3818
- AnchorAlarmComponent.decorators = [
3819
- { type: i0.Component, args: [{
3820
- selector: 'ol-map > fb-anchor-alarm',
3821
- template: '<ng-content></ng-content>',
3822
- changeDetection: i0.ChangeDetectionStrategy.OnPush
3823
- },] }
3824
- ];
3825
- AnchorAlarmComponent.ctorParameters = function () { return [
3826
- { type: i0.ChangeDetectorRef },
3827
- { type: MapComponent }
3828
- ]; };
3829
- AnchorAlarmComponent.propDecorators = {
3830
- layerReady: [{ type: i0.Output }],
3831
- radius: [{ type: i0.Input }],
3832
- anchorPosition: [{ type: i0.Input }],
3833
- lineCoords: [{ type: i0.Input }],
3834
- anchorStyles: [{ type: i0.Input }],
3835
- opacity: [{ type: i0.Input }],
3836
- visible: [{ type: i0.Input }],
3837
- extent: [{ type: i0.Input }],
3838
- zIndex: [{ type: i0.Input }],
3839
- minResolution: [{ type: i0.Input }],
3840
- maxResolution: [{ type: i0.Input }],
3841
- layerProperties: [{ type: i0.Input }]
3842
- };
3843
-
3844
- // ** Freeboard CPA Alarm component **
3845
- var CPAAlarmComponent = /** @class */ (function () {
3846
- function CPAAlarmComponent(changeDetectorRef, mapComponent) {
3847
- this.changeDetectorRef = changeDetectorRef;
3848
- this.mapComponent = mapComponent;
3849
- /**
3850
- * This event is triggered after the layer is initialized
3851
- * Use this to have access to the layer and some helper functions
3852
- */
3853
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
3854
- this.mapifiedLine = [];
3855
- this.changeDetectorRef.detach();
3856
- }
3857
- CPAAlarmComponent.prototype.ngOnInit = function () {
3858
- this.parseValues();
3859
- this.source = new VectorSource__default['default']({ features: this.features });
3860
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
3861
- var map = this.mapComponent.getMap();
3862
- if (this.layer && map) {
3863
- map.addLayer(this.layer);
3864
- map.render();
3865
- this.layerReady.next(this.layer);
3866
- this.layerReady.complete();
3867
- }
3868
- };
3869
- CPAAlarmComponent.prototype.ngOnChanges = function (changes) {
3870
- if (this.layer) {
3871
- var properties = {};
3872
- for (var key in changes) {
3873
- if (key == 'targetPosition' || key == 'lineCoords') {
3874
- this.parseValues();
3875
- if (this.source) {
3876
- this.source.clear();
3877
- this.source.addFeatures(this.features);
3878
- }
3879
- }
3880
- else if (key == 'layerProperties') {
3881
- this.layer.setProperties(properties, false);
3882
- }
3883
- else {
3884
- properties[key] = changes[key].currentValue;
3885
- }
3886
- }
3887
- this.layer.setProperties(properties, false);
3888
- }
3889
- };
3890
- CPAAlarmComponent.prototype.ngOnDestroy = function () {
3891
- var map = this.mapComponent.getMap();
3892
- if (this.layer && map) {
3893
- map.removeLayer(this.layer);
3894
- map.render();
3895
- this.layer = null;
3896
- }
3897
- };
3898
- CPAAlarmComponent.prototype.parseValues = function () {
3899
- this.mapifiedLine = mapifyCoords(this.lineCoords);
3900
- var fa = [];
3901
- var f = new ol.Feature({
3902
- geometry: new geom.LineString(fromLonLatArray(this.mapifiedLine))
3903
- });
3904
- f.setStyle(this.buildStyle());
3905
- fa.push(f);
3906
- f = new ol.Feature({
3907
- geometry: new geom.Point(proj.fromLonLat(this.targetPosition))
3908
- });
3909
- f.setStyle(this.buildStyle());
3910
- fa.push(f);
3911
- this.features = fa;
3912
- };
3913
- // build target style
3914
- CPAAlarmComponent.prototype.buildStyle = function () {
3915
- var cs;
3916
- if (this.layerProperties && this.layerProperties.style) {
3917
- cs = this.layerProperties.style;
3918
- }
3919
- else { // default style
3920
- cs = new style.Style({
3921
- image: new style.Circle({
3922
- radius: 10,
3923
- stroke: new style.Stroke({
3924
- width: 2,
3925
- color: 'red',
3926
- lineDash: [2, 3]
3927
- }),
3928
- fill: new style.Fill({
3929
- color: 'rgba(255,0,0,.2)'
3930
- })
3931
- }),
3932
- stroke: new style.Stroke({
3933
- width: 2,
3934
- color: 'red',
3935
- lineDash: [2, 3]
3936
- }),
3937
- fill: new style.Fill({
3938
- color: 'rgba(255,0,0,.2)'
3939
- })
3940
- });
3941
- }
3942
- return cs;
3943
- };
3944
- return CPAAlarmComponent;
3945
- }());
3946
- CPAAlarmComponent.decorators = [
3947
- { type: i0.Component, args: [{
3948
- selector: 'ol-map > fb-cpa-alarm',
3949
- template: '<ng-content></ng-content>',
3950
- changeDetection: i0.ChangeDetectionStrategy.OnPush
3951
- },] }
3952
- ];
3953
- CPAAlarmComponent.ctorParameters = function () { return [
3954
- { type: i0.ChangeDetectorRef },
3955
- { type: MapComponent }
3956
- ]; };
3957
- CPAAlarmComponent.propDecorators = {
3958
- layerReady: [{ type: i0.Output }],
3959
- targetPosition: [{ type: i0.Input }],
3960
- lineCoords: [{ type: i0.Input }],
3961
- opacity: [{ type: i0.Input }],
3962
- visible: [{ type: i0.Input }],
3963
- extent: [{ type: i0.Input }],
3964
- zIndex: [{ type: i0.Input }],
3965
- minResolution: [{ type: i0.Input }],
3966
- maxResolution: [{ type: i0.Input }],
3967
- layerProperties: [{ type: i0.Input }]
3968
- };
3969
-
3970
- // ** Freeboard Arrival Circle component **
3971
- var ArrivalCircleComponent = /** @class */ (function () {
3972
- function ArrivalCircleComponent(changeDetectorRef, mapComponent) {
3973
- this.changeDetectorRef = changeDetectorRef;
3974
- this.mapComponent = mapComponent;
3975
- /**
3976
- * This event is triggered after the layer is initialized
3977
- * Use this to have access to the layer and some helper functions
3978
- */
3979
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
3980
- this.mapifiedLine = [];
3981
- this.changeDetectorRef.detach();
3982
- }
3983
- ArrivalCircleComponent.prototype.ngOnInit = function () {
3984
- this.parseValues();
3985
- this.source = new VectorSource__default['default']({ features: this.features });
3986
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
3987
- var map = this.mapComponent.getMap();
3988
- if (this.layer && map) {
3989
- map.addLayer(this.layer);
3990
- map.render();
3991
- this.layerReady.next(this.layer);
3992
- this.layerReady.complete();
3993
- }
3994
- };
3995
- ArrivalCircleComponent.prototype.ngOnChanges = function (changes) {
3996
- if (this.layer) {
3997
- var properties = {};
3998
- for (var key in changes) {
3999
- if (key == 'position' || key == 'radius') {
4000
- this.parseValues();
4001
- if (this.source) {
4002
- this.source.clear();
4003
- this.source.addFeatures(this.features);
4004
- }
4005
- }
4006
- else if (key == 'layerProperties') {
4007
- this.layer.setProperties(properties, false);
4008
- }
4009
- else {
4010
- properties[key] = changes[key].currentValue;
4011
- }
4012
- }
4013
- this.layer.setProperties(properties, false);
4014
- }
4015
- };
4016
- ArrivalCircleComponent.prototype.ngOnDestroy = function () {
4017
- var map = this.mapComponent.getMap();
4018
- if (this.layer && map) {
4019
- map.removeLayer(this.layer);
4020
- map.render();
4021
- this.layer = null;
4022
- }
4023
- };
4024
- ArrivalCircleComponent.prototype.parseValues = function () {
4025
- var fa = [];
4026
- var f = new ol.Feature({
4027
- geometry: new geom.Circle(proj.fromLonLat(this.position), mapifyRadius(this.radius, this.position))
4028
- });
4029
- f.setStyle(this.buildStyle());
4030
- fa.push(f);
4031
- this.features = fa;
4032
- };
4033
- // build target style
4034
- ArrivalCircleComponent.prototype.buildStyle = function () {
4035
- var cs;
4036
- if (this.layerProperties && this.layerProperties.style) {
4037
- cs = this.layerProperties.style;
4038
- }
4039
- else { // default style
4040
- cs = new style.Style({
4041
- fill: new style.Fill({ color: 'rgba(255, 255, 255, .1)' }),
4042
- stroke: new style.Stroke({
4043
- color: 'rgba(242, 153, 10, 1)',
4044
- width: 2,
4045
- lineDash: [5, 5]
4046
- })
4047
- });
4048
- }
4049
- return cs;
4050
- };
4051
- return ArrivalCircleComponent;
4052
- }());
4053
- ArrivalCircleComponent.decorators = [
4054
- { type: i0.Component, args: [{
4055
- selector: 'ol-map > fb-arrival-circle',
4056
- template: '<ng-content></ng-content>',
4057
- changeDetection: i0.ChangeDetectionStrategy.OnPush
4058
- },] }
4059
- ];
4060
- ArrivalCircleComponent.ctorParameters = function () { return [
4061
- { type: i0.ChangeDetectorRef },
4062
- { type: MapComponent }
4063
- ]; };
4064
- ArrivalCircleComponent.propDecorators = {
4065
- layerReady: [{ type: i0.Output }],
4066
- position: [{ type: i0.Input }],
4067
- radius: [{ type: i0.Input }],
4068
- opacity: [{ type: i0.Input }],
4069
- visible: [{ type: i0.Input }],
4070
- extent: [{ type: i0.Input }],
4071
- zIndex: [{ type: i0.Input }],
4072
- minResolution: [{ type: i0.Input }],
4073
- maxResolution: [{ type: i0.Input }],
4074
- layerProperties: [{ type: i0.Input }]
4075
- };
4076
-
4077
- // ** Freeboard XTE path component **
4078
- var XTEPathComponent = /** @class */ (function () {
4079
- function XTEPathComponent(changeDetectorRef, mapComponent) {
4080
- this.changeDetectorRef = changeDetectorRef;
4081
- this.mapComponent = mapComponent;
4082
- /**
4083
- * This event is triggered after the layer is initialized
4084
- * Use this to have access to the layer and some helper functions
4085
- */
4086
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
4087
- this.mapifiedLine = [];
4088
- this.changeDetectorRef.detach();
4089
- }
4090
- XTEPathComponent.prototype.ngOnInit = function () {
4091
- this.parseValues();
4092
- this.source = new VectorSource__default['default']({ features: this.features });
4093
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
4094
- var map = this.mapComponent.getMap();
4095
- if (this.layer && map) {
4096
- map.addLayer(this.layer);
4097
- map.render();
4098
- this.layerReady.next(this.layer);
4099
- this.layerReady.complete();
4100
- }
4101
- };
4102
- XTEPathComponent.prototype.ngOnChanges = function (changes) {
4103
- if (this.layer) {
4104
- var properties = {};
4105
- for (var key in changes) {
4106
- if (key == 'color' || key == 'lineCoords') {
4107
- this.parseValues();
4108
- if (this.source) {
4109
- this.source.clear();
4110
- this.source.addFeatures(this.features);
4111
- }
4112
- }
4113
- else if (key == 'layerProperties') {
4114
- this.layer.setProperties(properties, false);
4115
- }
4116
- else {
4117
- properties[key] = changes[key].currentValue;
4118
- }
4119
- }
4120
- this.layer.setProperties(properties, false);
4121
- }
4122
- };
4123
- XTEPathComponent.prototype.ngOnDestroy = function () {
4124
- var map = this.mapComponent.getMap();
4125
- if (this.layer && map) {
4126
- map.removeLayer(this.layer);
4127
- map.render();
4128
- this.layer = null;
4129
- }
4130
- };
4131
- XTEPathComponent.prototype.parseValues = function () {
4132
- this.mapifiedLine = mapifyCoords(this.lineCoords);
4133
- var fa = [];
4134
- var f = new ol.Feature({
4135
- geometry: new geom.LineString(fromLonLatArray(this.mapifiedLine))
4136
- });
4137
- f.setStyle(this.buildStyle());
4138
- fa.push(f);
4139
- this.features = fa;
4140
- };
4141
- // build target style
4142
- XTEPathComponent.prototype.buildStyle = function () {
4143
- var _a;
4144
- var cs;
4145
- if (this.layerProperties && this.layerProperties.style) {
4146
- cs = this.layerProperties.style;
4147
- }
4148
- else { // default style
4149
- var color = (_a = this.color) !== null && _a !== void 0 ? _a : 'gray';
4150
- cs = new style.Style({
4151
- stroke: new style.Stroke({
4152
- width: 1,
4153
- color: color,
4154
- lineDash: [5, 5]
4155
- }),
4156
- fill: new style.Fill({
4157
- color: 'rgba(255,0,0,.2)'
4158
- })
4159
- });
4160
- }
4161
- return cs;
4162
- };
4163
- return XTEPathComponent;
4164
- }());
4165
- XTEPathComponent.decorators = [
4166
- { type: i0.Component, args: [{
4167
- selector: 'ol-map > fb-xte-path',
4168
- template: '<ng-content></ng-content>',
4169
- changeDetection: i0.ChangeDetectionStrategy.OnPush
4170
- },] }
4171
- ];
4172
- XTEPathComponent.ctorParameters = function () { return [
4173
- { type: i0.ChangeDetectorRef },
4174
- { type: MapComponent }
4175
- ]; };
4176
- XTEPathComponent.propDecorators = {
4177
- layerReady: [{ type: i0.Output }],
4178
- color: [{ type: i0.Input }],
4179
- lineCoords: [{ type: i0.Input }],
4180
- opacity: [{ type: i0.Input }],
4181
- visible: [{ type: i0.Input }],
4182
- extent: [{ type: i0.Input }],
4183
- zIndex: [{ type: i0.Input }],
4184
- minResolution: [{ type: i0.Input }],
4185
- maxResolution: [{ type: i0.Input }],
4186
- layerProperties: [{ type: i0.Input }]
4187
- };
4188
-
4189
- // ** Freeboard Bearing line component **
4190
- var BearingLineComponent = /** @class */ (function () {
4191
- function BearingLineComponent(changeDetectorRef, mapComponent) {
4192
- this.changeDetectorRef = changeDetectorRef;
4193
- this.mapComponent = mapComponent;
4194
- this.features = [];
4195
- /**
4196
- * This event is triggered after the layer is initialized
4197
- * Use this to have access to the layer and some helper functions
4198
- */
4199
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
4200
- this.showMarker = false;
4201
- this.mapZoom = 10;
4202
- this.labelMinZoom = 10;
4203
- this.mapifiedRadius = 0;
4204
- this.mapifiedLine = [];
4205
- this.changeDetectorRef.detach();
4206
- }
4207
- BearingLineComponent.prototype.ngOnInit = function () {
4208
- this.parseValues();
4209
- this.source = new VectorSource__default['default']({ features: this.features });
4210
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
4211
- var map = this.mapComponent.getMap();
4212
- if (this.layer && map) {
4213
- map.addLayer(this.layer);
4214
- map.render();
4215
- this.layerReady.next(this.layer);
4216
- this.layerReady.complete();
4217
- }
4218
- };
4219
- BearingLineComponent.prototype.ngOnChanges = function (changes) {
4220
- if (this.layer) {
4221
- var properties = {};
4222
- for (var key in changes) {
4223
- if (key == 'marker' || key == 'showMarker' || key == 'lineCoords') {
4224
- this.parseValues();
4225
- if (this.source) {
4226
- this.source.clear();
4227
- this.source.addFeatures(this.features);
4228
- }
4229
- }
4230
- else if (key == 'markerName' || key == 'labelMinZoom' || key == 'mapZoom') {
4231
- this.handleLabelZoomChange(key, changes[key]);
4232
- }
4233
- else if (key == 'layerProperties') {
4234
- this.layer.setProperties(properties, false);
4235
- }
4236
- else {
4237
- properties[key] = changes[key].currentValue;
4238
- }
4239
- }
4240
- this.layer.setProperties(properties, false);
4241
- }
4242
- };
4243
- BearingLineComponent.prototype.ngOnDestroy = function () {
4244
- var map = this.mapComponent.getMap();
4245
- if (this.layer && map) {
4246
- map.removeLayer(this.layer);
4247
- map.render();
4248
- this.layer = null;
4249
- }
4250
- };
4251
- BearingLineComponent.prototype.parseValues = function () {
4252
- this.mapifiedLine = mapifyCoords(this.lineCoords);
4253
- var fa = [];
4254
- var f = new ol.Feature({
4255
- geometry: new geom.LineString(fromLonLatArray(this.mapifiedLine))
4256
- });
4257
- f.setStyle(this.buildStyle('base'));
4258
- fa.push(f);
4259
- f = new ol.Feature({
4260
- geometry: new geom.LineString(fromLonLatArray(this.mapifiedLine))
4261
- });
4262
- f.setStyle(this.buildStyle('line'));
4263
- fa.push(f);
4264
- f = new ol.Feature({
4265
- geometry: new geom.Point(proj.fromLonLat(this.marker))
4266
- });
4267
- f.setId('d.base');
4268
- f.setStyle(this.buildStyle('marker-base'));
4269
- this.updateLabel(f);
4270
- fa.push(f);
4271
- if (this.showMarker) {
4272
- f = new ol.Feature({
4273
- geometry: new geom.Point(proj.fromLonLat(this.marker))
4274
- });
4275
- f.setId('dest.point');
4276
- f.setStyle(this.buildStyle('marker'));
4277
- fa.push(f);
4278
- }
4279
- this.features = fa;
4280
- };
4281
- // build target style
4282
- BearingLineComponent.prototype.buildStyle = function (key) {
4283
- if (this.bearingStyles && this.bearingStyles[key]) {
4284
- return this.bearingStyles[key];
4285
- }
4286
- else {
4287
- if (this.layerProperties && this.layerProperties.style) {
4288
- return this.layerProperties.style;
4289
- }
4290
- else { // default style
4291
- if (key == 'base') {
4292
- return new style.Style({
4293
- stroke: new style.Stroke({
4294
- width: 6,
4295
- color: 'white'
4296
- }),
4297
- fill: new style.Fill({
4298
- color: 'white'
4299
- }),
4300
- image: new style.Circle({
4301
- radius: 5,
4302
- stroke: new style.Stroke({
4303
- width: 2,
4304
- color: 'white'
4305
- }),
4306
- fill: new style.Fill({
4307
- color: 'rgba(221, 149, 0, 1)'
4308
- })
4309
- })
4310
- });
4311
- }
4312
- else if (key == 'marker-base') {
4313
- return new style.Style({
4314
- image: new style.Circle({
4315
- radius: 5,
4316
- stroke: new style.Stroke({
4317
- width: 2,
4318
- color: 'white'
4319
- }),
4320
- fill: new style.Fill({
4321
- color: 'rgba(221, 149, 0, 1)'
4322
- })
4323
- }),
4324
- text: new style.Text({
4325
- text: '',
4326
- offsetX: 25
4327
- })
4328
- });
4329
- }
4330
- else {
4331
- return new style.Style({
4332
- stroke: new style.Stroke({
4333
- width: 2,
4334
- color: 'rgba(221, 149, 0, 1)'
4335
- }),
4336
- fill: new style.Fill({
4337
- color: 'rgba(221, 149, 0, 1)'
4338
- })
4339
- });
4340
- }
4341
- }
4342
- }
4343
- };
4344
- // ** assess attribute change **
4345
- BearingLineComponent.prototype.handleLabelZoomChange = function (key, change) {
4346
- if (key == 'labelMinZoom') {
4347
- if (typeof this.mapZoom !== 'undefined') {
4348
- this.updateLabel();
4349
- }
4350
- }
4351
- else if (key == 'mapZoom') {
4352
- if (typeof this.labelMinZoom !== 'undefined') {
4353
- if ((change.currentValue >= this.labelMinZoom && change.previousValue < this.labelMinZoom) ||
4354
- (change.currentValue < this.labelMinZoom && change.previousValue >= this.labelMinZoom)) {
4355
- this.updateLabel();
4356
- }
4357
- }
4358
- }
4359
- };
4360
- // update feature labels
4361
- BearingLineComponent.prototype.updateLabel = function (f) {
4362
- var _a;
4363
- if (!f && this.source) {
4364
- f = this.source.getFeatureById('d.base');
4365
- }
4366
- var s = f.getStyle();
4367
- if (!s) {
4368
- return;
4369
- }
4370
- var ts = s.getText();
4371
- if (!ts) {
4372
- return;
4373
- }
4374
- ts.setText((Math.abs(this.mapZoom) >= this.labelMinZoom) ? (_a = this.markerName) !== null && _a !== void 0 ? _a : '' : '');
4375
- s.setText(ts);
4376
- f.setStyle(s);
4377
- };
4378
- return BearingLineComponent;
4379
- }());
4380
- BearingLineComponent.decorators = [
4381
- { type: i0.Component, args: [{
4382
- selector: 'ol-map > fb-bearing-line',
4383
- template: '<ng-content></ng-content>',
4384
- changeDetection: i0.ChangeDetectionStrategy.OnPush
4385
- },] }
4386
- ];
4387
- BearingLineComponent.ctorParameters = function () { return [
4388
- { type: i0.ChangeDetectorRef },
4389
- { type: MapComponent }
4390
- ]; };
4391
- BearingLineComponent.propDecorators = {
4392
- layerReady: [{ type: i0.Output }],
4393
- marker: [{ type: i0.Input }],
4394
- markerName: [{ type: i0.Input }],
4395
- lineCoords: [{ type: i0.Input }],
4396
- showMarker: [{ type: i0.Input }],
4397
- mapZoom: [{ type: i0.Input }],
4398
- labelMinZoom: [{ type: i0.Input }],
4399
- bearingStyles: [{ type: i0.Input }],
4400
- opacity: [{ type: i0.Input }],
4401
- visible: [{ type: i0.Input }],
4402
- extent: [{ type: i0.Input }],
4403
- zIndex: [{ type: i0.Input }],
4404
- minResolution: [{ type: i0.Input }],
4405
- maxResolution: [{ type: i0.Input }],
4406
- layerProperties: [{ type: i0.Input }]
4407
- };
4408
-
4409
- // ** Freeboard Vessel component **
4410
- var VesselComponent = /** @class */ (function () {
4411
- function VesselComponent(changeDetectorRef, mapComponent) {
4412
- this.changeDetectorRef = changeDetectorRef;
4413
- this.mapComponent = mapComponent;
4414
- /**
4415
- * This event is triggered after the layer is initialized
4416
- * Use this to have access to the layer and some helper functions
4417
- */
4418
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
4419
- this.heading = 0;
4420
- this.showWind = false;
4421
- this.changeDetectorRef.detach();
4422
- }
4423
- VesselComponent.prototype.ngOnInit = function () {
4424
- var fa = [];
4425
- this.parseVessel();
4426
- if (this.vessel) {
4427
- fa.push(this.vessel);
4428
- }
4429
- this.renderVesselLines();
4430
- if (this.headingLine) {
4431
- fa.push(this.headingLine);
4432
- }
4433
- if (this.twdLine) {
4434
- fa.push(this.twdLine);
4435
- }
4436
- if (this.awaLine) {
4437
- fa.push(this.awaLine);
4438
- }
4439
- this.source = new VectorSource__default['default']({ features: fa });
4440
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
4441
- var map = this.mapComponent.getMap();
4442
- if (this.layer && map) {
4443
- map.addLayer(this.layer);
4444
- map.render();
4445
- this.layerReady.next(this.layer);
4446
- this.layerReady.complete();
4447
- }
4448
- };
4449
- VesselComponent.prototype.ngOnChanges = function (changes) {
4450
- if (this.layer) {
4451
- var properties = {};
4452
- for (var key in changes) {
4453
- if (key == 'id' || key == 'activeId' || key == 'position' || key == 'heading') {
4454
- if (this.source) {
4455
- this.parseVessel();
4456
- }
4457
- }
4458
- else if (key == 'vesselLines' || key == 'showWind') {
4459
- if (this.source) {
4460
- this.renderVesselLines();
4461
- }
4462
- }
4463
- else if (key == 'vesselStyles') {
4464
- if (this.source) {
4465
- this.parseVessel();
4466
- }
4467
- }
4468
- else if (key == 'layerProperties') {
4469
- this.layer.setProperties(properties, false);
4470
- }
4471
- else {
4472
- properties[key] = changes[key].currentValue;
4473
- }
4474
- }
4475
- this.layer.setProperties(properties, false);
4476
- }
4477
- };
4478
- VesselComponent.prototype.ngOnDestroy = function () {
4479
- var map = this.mapComponent.getMap();
4480
- if (this.layer && map) {
4481
- map.removeLayer(this.layer);
4482
- map.render();
4483
- this.layer = null;
4484
- }
4485
- };
4486
- VesselComponent.prototype.parseVessel = function () {
4487
- var _a, _b, _c;
4488
- if (!this.vessel) { // create feature
4489
- this.vessel = new ol.Feature(new geom.Point(proj.fromLonLat([
4490
- (_a = this.position[0]) !== null && _a !== void 0 ? _a : 0,
4491
- (_b = this.position[1]) !== null && _b !== void 0 ? _b : 0
4492
- ])));
4493
- }
4494
- //update feature
4495
- if (this.position && Array.isArray(this.position) && this.position.length > 1) {
4496
- var g = this.vessel.getGeometry();
4497
- g.setCoordinates(proj.fromLonLat([
4498
- this.position[0],
4499
- this.position[1]
4500
- ]));
4501
- }
4502
- this.vessel.setId((_c = this.id) !== null && _c !== void 0 ? _c : 'self');
4503
- var s = this.buildStyle();
4504
- if (s) {
4505
- var im = s.getImage();
4506
- if (im) {
4507
- im.setRotation(this.heading);
4508
- }
4509
- ;
4510
- this.vessel.setStyle(s);
4511
- }
4512
- };
4513
- // build target style
4514
- VesselComponent.prototype.buildStyle = function () {
4515
- var _a;
4516
- var cs = new style.Style({
4517
- image: new style.RegularShape({
4518
- points: 3,
4519
- radius: 15,
4520
- fill: new style.Fill({ color: 'red' }),
4521
- stroke: new style.Stroke({
4522
- color: 'black',
4523
- width: 3
4524
- }),
4525
- rotateWithView: true,
4526
- rotation: (_a = this.heading) !== null && _a !== void 0 ? _a : 0
4527
- })
4528
- });
4529
- if (this.vesselStyles) {
4530
- if (this.activeId && this.activeId != this.id) {
4531
- if (this.vesselStyles.inactive) {
4532
- cs = this.vesselStyles.inactive;
4533
- }
4534
- }
4535
- else {
4536
- if (this.vesselStyles.default) {
4537
- cs = this.vesselStyles.default;
4538
- }
4539
- }
4540
- }
4541
- else if (this.layerProperties && this.layerProperties.style) {
4542
- cs = this.layerProperties.style;
4543
- }
4544
- return cs;
4545
- };
4546
- // remove feature from layer
4547
- VesselComponent.prototype.removeFeature = function (f) {
4548
- if (this.source) {
4549
- this.source.removeFeature(f);
4550
- }
4551
- };
4552
- VesselComponent.prototype.renderVesselLines = function () {
4553
- if (!this.vesselLines) {
4554
- return;
4555
- }
4556
- if ('heading' in this.vesselLines) {
4557
- this.headingLine = this.updateLine(this.headingLine, this.vesselLines.heading);
4558
- this.headingLine.setStyle(new style.Style({
4559
- stroke: new style.Stroke({ color: 'rgba(221, 99, 0, 0.5)', width: 4 })
4560
- }));
4561
- }
4562
- else {
4563
- this.removeFeature(this.headingLine);
4564
- }
4565
- if ('twd' in this.vesselLines) {
4566
- this.twdLine = this.updateLine(this.twdLine, this.vesselLines.twd);
4567
- this.twdLine.setStyle(new style.Style({
4568
- stroke: new style.Stroke({ color: "rgb(128, 128, 0, " + (this.showWind ? 1 : 0) + ")", width: 2 })
4569
- }));
4570
- }
4571
- else {
4572
- this.removeFeature(this.twdLine);
4573
- }
4574
- if ('awa' in this.vesselLines) {
4575
- this.awaLine = this.updateLine(this.awaLine, this.vesselLines.awa);
4576
- this.awaLine.setStyle(new style.Style({
4577
- stroke: new style.Stroke({ color: "rgb(16, 75, 16, " + (this.showWind ? 1 : 0) + ")", width: 1 })
4578
- }));
4579
- }
4580
- else {
4581
- this.removeFeature(this.awaLine);
4582
- }
4583
- };
4584
- // ** update line geometry **
4585
- VesselComponent.prototype.updateLine = function (lf, coords) {
4586
- if (!coords || !Array.isArray(coords)) {
4587
- return;
4588
- }
4589
- if (!lf) { // create feature
4590
- lf = new ol.Feature(new geom.LineString(fromLonLatArray(mapifyCoords(coords))));
4591
- }
4592
- else {
4593
- var g = lf.getGeometry();
4594
- g.setCoordinates(fromLonLatArray(mapifyCoords(coords)));
4595
- }
4596
- return lf;
4597
- };
4598
- return VesselComponent;
4599
- }());
4600
- VesselComponent.decorators = [
4601
- { type: i0.Component, args: [{
4602
- selector: 'ol-map > fb-vessel',
4603
- template: '<ng-content></ng-content>',
4604
- changeDetection: i0.ChangeDetectionStrategy.OnPush
4605
- },] }
4606
- ];
4607
- VesselComponent.ctorParameters = function () { return [
4608
- { type: i0.ChangeDetectorRef },
4609
- { type: MapComponent }
4610
- ]; };
4611
- VesselComponent.propDecorators = {
4612
- layerReady: [{ type: i0.Output }],
4613
- id: [{ type: i0.Input }],
4614
- activeId: [{ type: i0.Input }],
4615
- position: [{ type: i0.Input }],
4616
- heading: [{ type: i0.Input }],
4617
- vesselStyles: [{ type: i0.Input }],
4618
- vesselLines: [{ type: i0.Input }],
4619
- showWind: [{ type: i0.Input }],
4620
- opacity: [{ type: i0.Input }],
4621
- visible: [{ type: i0.Input }],
4622
- extent: [{ type: i0.Input }],
4623
- zIndex: [{ type: i0.Input }],
4624
- minResolution: [{ type: i0.Input }],
4625
- maxResolution: [{ type: i0.Input }],
4626
- layerProperties: [{ type: i0.Input }]
4627
- };
4628
-
4629
- // ** Freeboard Vessel trail component **
4630
- var VesselTrailComponent = /** @class */ (function () {
4631
- function VesselTrailComponent(changeDetectorRef, mapComponent) {
4632
- this.changeDetectorRef = changeDetectorRef;
4633
- this.mapComponent = mapComponent;
4634
- /**
4635
- * This event is triggered after the layer is initialized
4636
- * Use this to have access to the layer and some helper functions
4637
- */
4638
- this.layerReady = new rxjs.AsyncSubject(); // AsyncSubject will only store the last value, and only publish it when the sequence is completed
4639
- this.changeDetectorRef.detach();
4640
- }
4641
- VesselTrailComponent.prototype.ngOnInit = function () {
4642
- var fa = [];
4643
- this.parseTrails();
4644
- if (this.trailLocal) {
4645
- fa.push(this.trailLocal);
4646
- }
4647
- if (this.trailServer) {
4648
- fa.push(this.trailServer);
4649
- }
4650
- this.source = new VectorSource__default['default']({ features: fa });
4651
- this.layer = new VectorLayer__default['default'](Object.assign(this, Object.assign({}, this.layerProperties)));
4652
- var map = this.mapComponent.getMap();
4653
- if (this.layer && map) {
4654
- map.addLayer(this.layer);
4655
- map.render();
4656
- this.layerReady.next(this.layer);
4657
- this.layerReady.complete();
4658
- }
4659
- };
4660
- VesselTrailComponent.prototype.ngOnChanges = function (changes) {
4661
- if (this.layer) {
4662
- var properties = {};
4663
- for (var key in changes) {
4664
- if (key == 'localTrail') {
4665
- if (this.source) {
4666
- this.parseLocalTrail();
4667
- }
4668
- }
4669
- if (key == 'serverTrail') {
4670
- if (this.source) {
4671
- this.parseServerTrail();
4672
- }
4673
- }
4674
- if (key == 'trailStyles') {
4675
- if (this.source) {
4676
- this.parseTrails();
4677
- }
4678
- }
4679
- else if (key == 'layerProperties') {
4680
- this.layer.setProperties(properties, false);
4681
- }
4682
- else {
4683
- properties[key] = changes[key].currentValue;
4684
- }
4685
- }
4686
- this.layer.setProperties(properties, false);
4687
- }
4688
- };
4689
- VesselTrailComponent.prototype.ngOnDestroy = function () {
4690
- var map = this.mapComponent.getMap();
4691
- if (this.layer && map) {
4692
- map.removeLayer(this.layer);
4693
- map.render();
4694
- this.layer = null;
4695
- }
4696
- };
4697
- VesselTrailComponent.prototype.parseTrails = function () {
4698
- this.parseLocalTrail();
4699
- this.parseServerTrail();
4700
- };
4701
- VesselTrailComponent.prototype.parseLocalTrail = function () {
4702
- if (!this.localTrail) {
4703
- return;
4704
- }
4705
- var c = fromLonLatArray(this.localTrail);
4706
- if (!this.trailLocal) { // create feature
4707
- this.trailLocal = new ol.Feature(new geom.LineString(mapifyCoords(c)));
4708
- this.trailLocal.setId('trail.self.local');
4709
- this.trailLocal.setStyle(this.buildStyle('local'));
4710
- }
4711
- else { //update feature
4712
- this.trailLocal = this.source.getFeatureById('trail.self.local');
4713
- if (this.localTrail && Array.isArray(this.localTrail)) {
4714
- var g = this.trailLocal.getGeometry();
4715
- g.setCoordinates(mapifyCoords(c));
4716
- }
4717
- }
4718
- };
4719
- VesselTrailComponent.prototype.parseServerTrail = function () {
4720
- if (!this.serverTrail) {
4721
- return;
4722
- }
4723
- var c = fromLonLatArray(this.serverTrail);
4724
- var ca = [];
4725
- c.forEach(function (t) { ca.push(mapifyCoords(t)); });
4726
- if (!this.trailServer) { // create feature
4727
- this.trailServer = new ol.Feature(new geom.MultiLineString(ca));
4728
- this.trailServer.setId('trail.self.server');
4729
- this.trailServer.setStyle(this.buildStyle('server'));
4730
- }
4731
- else { //update feature
4732
- this.trailServer = this.source.getFeatureById('trail.self.server');
4733
- if (this.serverTrail && Array.isArray(this.serverTrail)) {
4734
- var g = this.trailServer.getGeometry();
4735
- g.setCoordinates(ca);
4736
- }
4737
- }
4738
- };
4739
- // build target style
4740
- VesselTrailComponent.prototype.buildStyle = function (type) {
4741
- if (type === void 0) { type = 'local'; }
4742
- var cs;
4743
- if (type == 'server') {
4744
- if (this.trailStyles && this.trailStyles.server) {
4745
- cs = this.trailStyles.server;
4746
- }
4747
- else {
4748
- cs = new style.Style({
4749
- stroke: new style.Stroke({
4750
- color: 'rgb(252, 3, 132)',
4751
- width: 1,
4752
- lineDash: [4, 4]
4753
- })
4754
- });
4755
- }
4756
- }
4757
- else {
4758
- if (this.trailStyles && this.trailStyles.local) {
4759
- cs = this.trailStyles.local;
4760
- }
4761
- else {
4762
- cs = new style.Style({
4763
- stroke: new style.Stroke({
4764
- color: 'rgb(252, 3, 132)',
4765
- width: 1,
4766
- lineDash: [2, 2]
4767
- })
4768
- });
4769
- }
4770
- }
4771
- return cs;
4772
- };
4773
- return VesselTrailComponent;
4774
- }());
4775
- VesselTrailComponent.decorators = [
4776
- { type: i0.Component, args: [{
4777
- selector: 'ol-map > fb-vessel-trail',
4778
- template: '<ng-content></ng-content>',
4779
- changeDetection: i0.ChangeDetectionStrategy.OnPush
4780
- },] }
4781
- ];
4782
- VesselTrailComponent.ctorParameters = function () { return [
4783
- { type: i0.ChangeDetectorRef },
4784
- { type: MapComponent }
4785
- ]; };
4786
- VesselTrailComponent.propDecorators = {
4787
- layerReady: [{ type: i0.Output }],
4788
- localTrail: [{ type: i0.Input }],
4789
- serverTrail: [{ type: i0.Input }],
4790
- trailStyles: [{ type: i0.Input }],
4791
- opacity: [{ type: i0.Input }],
4792
- visible: [{ type: i0.Input }],
4793
- extent: [{ type: i0.Input }],
4794
- zIndex: [{ type: i0.Input }],
4795
- minResolution: [{ type: i0.Input }],
4796
- maxResolution: [{ type: i0.Input }],
4797
- layerProperties: [{ type: i0.Input }]
4798
- };
4799
-
4800
- var declarations = [
4801
- ContentComponent,
4802
- ControlsDirective,
4803
- LayerComponent,
4804
- InteractionsDirective,
4805
- MapComponent,
4806
- OverlayComponent,
4807
- ViewDirective,
4808
- ControlComponent,
4809
- InteractionDrawComponent, InteractionModifyComponent,
4810
- WaypointLayerComponent, FreeboardWaypointLayerComponent,
4811
- NoteLayerComponent, FreeboardNoteLayerComponent,
4812
- RouteLayerComponent, FreeboardRouteLayerComponent,
4813
- RegionLayerComponent, FreeboardRegionLayerComponent,
4814
- TrackLayerComponent, FreeboardChartLayerComponent,
4815
- ResourceSetLayerComponent,
4816
- SKTargetsLayerComponent, SKTargetTracksLayerComponent,
4817
- AnchorAlarmComponent, CPAAlarmComponent,
4818
- ArrivalCircleComponent, XTEPathComponent, BearingLineComponent,
4819
- VesselComponent, VesselTrailComponent, SKVesselsLayerComponent
4820
- ];
4821
- var FreeboardOpenlayersModule = /** @class */ (function () {
4822
- function FreeboardOpenlayersModule() {
4823
- }
4824
- return FreeboardOpenlayersModule;
4825
- }());
4826
- FreeboardOpenlayersModule.decorators = [
4827
- { type: i0.NgModule, args: [{
4828
- imports: [],
4829
- declarations: __spreadArray([], __read(declarations)),
4830
- exports: __spreadArray([], __read(declarations))
4831
- },] }
4832
- ];
4833
-
4834
- /**
4835
- * Generated bundle index. Do not edit.
4836
- */
4837
-
4838
- exports.AnchorAlarmComponent = AnchorAlarmComponent;
4839
- exports.ArrivalCircleComponent = ArrivalCircleComponent;
4840
- exports.BearingLineComponent = BearingLineComponent;
4841
- exports.CPAAlarmComponent = CPAAlarmComponent;
4842
- exports.ContentComponent = ContentComponent;
4843
- exports.ControlComponent = ControlComponent;
4844
- exports.ControlsDirective = ControlsDirective;
4845
- exports.FreeboardChartLayerComponent = FreeboardChartLayerComponent;
4846
- exports.FreeboardNoteLayerComponent = FreeboardNoteLayerComponent;
4847
- exports.FreeboardOpenlayersModule = FreeboardOpenlayersModule;
4848
- exports.FreeboardRegionLayerComponent = FreeboardRegionLayerComponent;
4849
- exports.FreeboardRouteLayerComponent = FreeboardRouteLayerComponent;
4850
- exports.FreeboardWaypointLayerComponent = FreeboardWaypointLayerComponent;
4851
- exports.InteractionDrawComponent = InteractionDrawComponent;
4852
- exports.InteractionModifyComponent = InteractionModifyComponent;
4853
- exports.InteractionsDirective = InteractionsDirective;
4854
- exports.LayerComponent = LayerComponent;
4855
- exports.MapComponent = MapComponent;
4856
- exports.MapService = MapService;
4857
- exports.NoteLayerComponent = NoteLayerComponent;
4858
- exports.OverlayComponent = OverlayComponent;
4859
- exports.RegionLayerComponent = RegionLayerComponent;
4860
- exports.ResourceSetLayerComponent = ResourceSetLayerComponent;
4861
- exports.RouteLayerComponent = RouteLayerComponent;
4862
- exports.SKTargetTracksLayerComponent = SKTargetTracksLayerComponent;
4863
- exports.SKTargetsLayerComponent = SKTargetsLayerComponent;
4864
- exports.SKVesselsLayerComponent = SKVesselsLayerComponent;
4865
- exports.TrackLayerComponent = TrackLayerComponent;
4866
- exports.VesselComponent = VesselComponent;
4867
- exports.VesselTrailComponent = VesselTrailComponent;
4868
- exports.ViewDirective = ViewDirective;
4869
- exports.WaypointLayerComponent = WaypointLayerComponent;
4870
- exports.XTEPathComponent = XTEPathComponent;
4871
- exports.defaultLayers = defaultLayers;
4872
- exports.destCoordinate = destCoordinate;
4873
- exports.fromLonLatArray = fromLonLatArray;
4874
- exports.inDLCrossingZone = inDLCrossingZone;
4875
- exports.mapifyCoords = mapifyCoords;
4876
- exports.mapifyRadius = mapifyRadius;
4877
- exports.osmLayer = osmLayer;
4878
- exports.osmSource = osmSource;
4879
- exports.stringToEl = stringToEl;
4880
-
4881
- Object.defineProperty(exports, '__esModule', { value: true });
4882
-
4883
- })));
4884
- //# sourceMappingURL=fb-openlayers.umd.js.map