@hpcc-js/map 3.5.4 → 3.5.6

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 (95) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +88 -88
  3. package/TopoJSON/BR.json +122 -122
  4. package/TopoJSON/GB_idx.json +1 -1
  5. package/TopoJSON/IE_idx.json +1 -1
  6. package/TopoJSON/ND_idx.json +1 -1
  7. package/TopoJSON/countries.json +257 -257
  8. package/TopoJSON/us-counties.json +16550 -16550
  9. package/TopoJSON/us-states.json +458 -458
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.umd.cjs +1 -1
  13. package/dist/index.umd.cjs.map +1 -1
  14. package/package.json +12 -10
  15. package/src/CanvasPinLayer.ts +99 -99
  16. package/src/CanvasPins.ts +397 -397
  17. package/src/Choropleth.css +26 -26
  18. package/src/Choropleth.ts +203 -203
  19. package/src/ChoroplethContinents.ts +13 -13
  20. package/src/ChoroplethCounties.ts +111 -111
  21. package/src/ChoroplethCountries.ts +100 -100
  22. package/src/ChoroplethStates.ts +103 -103
  23. package/src/ChoroplethStatesHeat.ts +8 -8
  24. package/src/GMap.css +20 -20
  25. package/src/GMap.ts +880 -880
  26. package/src/GMapCounties.ts +93 -93
  27. package/src/GMapGraph.ts +61 -61
  28. package/src/GMapHeat.ts +27 -27
  29. package/src/GMapLayered.ts +94 -94
  30. package/src/GMapPin.ts +115 -115
  31. package/src/GMapPinLine.ts +138 -138
  32. package/src/GeoHash.css +14 -14
  33. package/src/GeoHash.ts +139 -139
  34. package/src/Graph.css +9 -9
  35. package/src/Graph.ts +98 -98
  36. package/src/Graticule.css +12 -12
  37. package/src/Graticule.ts +97 -97
  38. package/src/Heat.ts +87 -87
  39. package/src/IChoropleth.ts +8 -8
  40. package/src/Layer.ts +99 -99
  41. package/src/Layered.css +18 -18
  42. package/src/Layered.ts +206 -206
  43. package/src/Lines.css +8 -8
  44. package/src/Lines.ts +78 -78
  45. package/src/OpenStreet.css +15 -15
  46. package/src/OpenStreet.ts +126 -126
  47. package/src/Pins.css +17 -17
  48. package/src/Pins.ts +350 -350
  49. package/src/Projection.ts +42 -42
  50. package/src/TestHeatMap.ts +8 -8
  51. package/src/TopoJSONChoropleth.ts +125 -125
  52. package/src/Utility.ts +484 -484
  53. package/src/__package__.ts +3 -3
  54. package/src/index.ts +33 -33
  55. package/src/leaflet/AlbersPR.ts +48 -48
  56. package/src/leaflet/Blank.ts +9 -9
  57. package/src/leaflet/Circles.ts +139 -139
  58. package/src/leaflet/ClusterCircles.css +26 -26
  59. package/src/leaflet/ClusterCircles.ts +88 -88
  60. package/src/leaflet/Countries.ts +43 -43
  61. package/src/leaflet/DrawLayer.ts +167 -167
  62. package/src/leaflet/FeatureLayer.ts +138 -138
  63. package/src/leaflet/GMap.ts +44 -44
  64. package/src/leaflet/HeatLayer.ts +77 -77
  65. package/src/leaflet/Icons.ts +60 -60
  66. package/src/leaflet/Leaflet.css +3 -3
  67. package/src/leaflet/Leaflet.ts +239 -239
  68. package/src/leaflet/MapBox.ts +35 -35
  69. package/src/leaflet/Markers.ts +109 -109
  70. package/src/leaflet/OpenStreet.ts +27 -27
  71. package/src/leaflet/Path.ts +138 -138
  72. package/src/leaflet/Pins.ts +73 -73
  73. package/src/leaflet/Polygons.ts +113 -113
  74. package/src/leaflet/Region.ts +138 -138
  75. package/src/leaflet/Text.ts +99 -99
  76. package/src/leaflet/TileLayer.ts +81 -81
  77. package/src/leaflet/TopoJSON.ts +146 -146
  78. package/src/leaflet/US.ts +15 -15
  79. package/src/leaflet/USCounties.ts +43 -43
  80. package/src/leaflet/USStates.ts +41 -41
  81. package/src/leaflet/World.css +3 -3
  82. package/src/leaflet/World.ts +172 -172
  83. package/src/leaflet/index.ts +18 -18
  84. package/src/leaflet/leaflet-shim.ts +18 -18
  85. package/src/leaflet/plugins/BeautifyIcon.css +44 -44
  86. package/src/leaflet/plugins/BeautifyIcon.ts +190 -190
  87. package/src/leaflet/plugins/BeutifyIcon.licence +20 -20
  88. package/src/leaflet/plugins/D3SvgOverlay.css +2 -2
  89. package/src/leaflet/plugins/D3SvgOverlay.licence +20 -20
  90. package/src/leaflet/plugins/D3SvgOverlay.ts +175 -175
  91. package/src/leaflet/plugins/HeatLayer.license +21 -21
  92. package/src/leaflet/plugins/HeatLayer.ts +224 -224
  93. package/src/leaflet/plugins/Leaflet.GoogleMutant.ts +424 -424
  94. package/src/leaflet/plugins/lru_map.ts +352 -352
  95. package/src/test.ts +114 -114
@@ -1,239 +1,239 @@
1
- import { Button, HTMLWidget, IconBar, Spacer, Widget } from "@hpcc-js/common";
2
- import { LatLngBounds, Map } from "./leaflet-shim.ts";
3
- import { AlbersLayer } from "./AlbersPR.ts";
4
- import { BlankLayer } from "./Blank.ts";
5
- import { GMapLayer } from "./GMap.ts";
6
- import { MapBoxLayer } from "./MapBox.ts";
7
- import { OpenStreetLayer } from "./OpenStreet.ts";
8
- import { ILayer, TileLayer } from "./TileLayer.ts";
9
-
10
- import "../../src/leaflet/Leaflet.css";
11
-
12
- export class Leaflet extends HTMLWidget {
13
-
14
- protected _leafletElement;
15
- private _leafletMap: Map;
16
-
17
- protected _iconBar = new IconBar()
18
- .buttons([
19
- new Button().faChar("fa-plus").tooltip("Zoom in")
20
- .on("click", () => {
21
- this.zoomPlus();
22
- }),
23
- new Button().faChar("fa-minus").tooltip("Zoom out")
24
- .on("click", () => {
25
- this.zoomMinus();
26
- }),
27
- new Spacer(),
28
- new Button().faChar("fa-arrows-alt").tooltip("Zoom to fit")
29
- .on("click", () => {
30
- this.zoomToFit();
31
- })
32
- ])
33
- ;
34
-
35
- _blankLayer = new BlankLayer();
36
- _albersLayer = new AlbersLayer();
37
- _mapBoxLayer = new MapBoxLayer();
38
- _openStreetLayer = new OpenStreetLayer();
39
- _gmapLayer = new GMapLayer();
40
-
41
- constructor() {
42
- super();
43
- this.baseLayer();
44
- }
45
-
46
- zoom() {
47
- return this._leafletMap.getZoom();
48
- }
49
-
50
- zoomPlus() {
51
- this._leafletMap.zoomIn();
52
- }
53
-
54
- zoomMinus() {
55
- this._leafletMap.zoomOut();
56
- }
57
-
58
- zoomToDefault() {
59
- this._leafletMap.flyTo({ lat: this.defaultLat(), lng: this.defaultLong() }, this.defaultZoom(), { animate: false });
60
- }
61
-
62
- zoomToFit() {
63
- let bounds: LatLngBounds;
64
- if (this.mapType() === "AlbersPR") {
65
- bounds = this._albersLayer.getBounds();
66
- } else {
67
- this.layers().filter(l => l.hasBounds()).forEach(layer => {
68
- if (!bounds) {
69
- bounds = layer.getBounds();
70
- } else {
71
- bounds.extend(layer.getBounds());
72
- }
73
- });
74
- }
75
- if (bounds && bounds.isValid()) {
76
- this._leafletMap.fitBounds(bounds, { maxZoom: 14 });
77
- } else {
78
- this.zoomToDefault();
79
- }
80
- }
81
-
82
- syncLayers(sLayers: ILayer[], domNode, element) {
83
- const added: ILayer[] = [...sLayers];
84
- const updated: ILayer[] = [];
85
- const removed: ILayer[] = [];
86
- this._leafletMap.eachLayer(layer => {
87
- const idx = added.indexOf((layer as any).__hpcc_layer);
88
- if (idx >= 0) {
89
- updated.push((layer as any).__hpcc_layer);
90
- added.splice(idx, 1);
91
- } else if ((layer as any).__hpcc_layer) {
92
- removed.push((layer as any).__hpcc_layer);
93
- }
94
- });
95
- added.forEach(sl => {
96
- sl.layerEnter(this._leafletMap);
97
- sl.layerUpdate(this._leafletMap);
98
- });
99
- updated.forEach(sl => {
100
- sl.layerUpdate(this._leafletMap);
101
- });
102
- removed.forEach(sl => {
103
- sl.layerExit(this._leafletMap);
104
- });
105
- }
106
-
107
- protected _owner: HTMLWidget;
108
- isLayer(): boolean {
109
- return this._owner !== undefined && this._owner !== this;
110
- }
111
-
112
- baseLayer(): BlankLayer | AlbersLayer | MapBoxLayer | OpenStreetLayer | GMapLayer {
113
- switch (this.mapType()) {
114
- case "AlbersPR":
115
- this.map(this._albersLayer);
116
- break;
117
- case "MapBox":
118
- this.map(this._mapBoxLayer);
119
- break;
120
- case "OpenStreet":
121
- this.map(this._openStreetLayer);
122
- break;
123
- case "Google":
124
- this.map(this._gmapLayer);
125
- break;
126
- case "None":
127
- default:
128
- this.map(this._blankLayer);
129
- break;
130
- }
131
- return this.map();
132
- }
133
-
134
- enter(domNode, element) {
135
- super.enter(domNode, element);
136
- element.style("position", "relative");
137
- this._leafletElement = element.append("div")
138
- .style("position", "absolute")
139
- .style("width", `${this.width()}px`)
140
- .style("height", `${this.height()}px`)
141
- ;
142
-
143
- this._iconBar.target(domNode);
144
- }
145
-
146
- private _prevCRS;
147
- update(domNode, element) {
148
- super.update(domNode, element);
149
- this._leafletElement
150
- .style("width", `${this.width()}px`)
151
- .style("height", `${this.height()}px`)
152
- ;
153
-
154
- const baseLayer = this.baseLayer();
155
- if (this._prevCRS !== baseLayer.crs()) {
156
- this._prevCRS = baseLayer.crs();
157
- if (this._leafletMap) {
158
- this.syncLayers([], domNode, element);
159
- this._leafletMap.remove();
160
- this._leafletElement.html("");
161
- }
162
- this._leafletMap = new Map(this._leafletElement.node(), {
163
- trackResize: false,
164
- zoomControl: false,
165
- zoomSnap: this.mapType() === "AlbersPR" ? 0.1 : 1,
166
- crs: baseLayer.crs(),
167
- maxZoom: (baseLayer as any).getMaxZoom ? (baseLayer as any).getMaxZoom() : 18
168
- });
169
- this._leafletMap.setView([this.defaultLat(), this.defaultLong()], this.defaultZoom());
170
- this._leafletMap["attributionControl"].setPrefix(baseLayer.attribution());
171
- this._leafletMap.on("zoomend", e => this.layers().forEach(layer => layer.zoomEnd(e)));
172
- this._leafletMap.on("moveend", e => this.layers().forEach(layer => layer.moveEnd(e)));
173
- this._leafletMap.on("viewreset", e => this.layers().forEach(layer => layer.viewReset(e)));
174
-
175
- this._renderCount = 0;
176
- }
177
- this.syncLayers([baseLayer, ...this.layers()], domNode, element);
178
- this._leafletMap.invalidateSize();
179
- if (this.autoZoomToFit()) {
180
- this._leafletMap.whenReady(function () {
181
- this.zoomToFit();
182
- }, this);
183
- }
184
- this._iconBar
185
- .visible(this.showToolbar())
186
- .render((w: IconBar) => {
187
- const bbox = w.getBBox();
188
- w.element()
189
- .style("z-index", 5000)
190
- .style("left", `${this.width() - bbox.width - 4}px`)
191
- ;
192
- })
193
- ;
194
- }
195
-
196
- exit(domNode, element) {
197
- this._iconBar.target(null);
198
- super.exit(domNode, element);
199
- }
200
-
201
- render(callback?: (w: Widget) => void): this {
202
- const promises = [this.baseLayer().init(), ...this.layers().map(l => l.init())];
203
- Promise.all(promises).then(() => {
204
- super.render(callback);
205
- });
206
- return this;
207
- }
208
- }
209
- Leaflet.prototype._class += " map_Leaflet";
210
-
211
- export interface Leaflet {
212
- showToolbar(): boolean;
213
- showToolbar(_: boolean): this;
214
- mapType(): "None" | "AlbersPR" | "MapBox" | "OpenStreet" | "Google";
215
- mapType(_: "None" | "AlbersPR" | "MapBox" | "OpenStreet" | "Google"): this;
216
- mapType_default(_: "None" | "AlbersPR" | "MapBox" | "OpenStreet" | "Google"): this;
217
- map(): TileLayer;
218
- map(_: TileLayer): this;
219
- layers(): ILayer[];
220
- layers(_: ILayer[]): this;
221
- layers_default(_: ILayer[]): this;
222
- defaultLat(): number;
223
- defaultLat(_: number): this;
224
- defaultLong(): number;
225
- defaultLong(_: number): this;
226
- defaultZoom(): number;
227
- defaultZoom(_: number): this;
228
- autoZoomToFit(): boolean;
229
- autoZoomToFit(_: boolean): this;
230
- }
231
-
232
- Leaflet.prototype.publish("showToolbar", true, "boolean", "Show toolbar", undefined, { hidden: (w: Leaflet) => w.isLayer() });
233
- Leaflet.prototype.publish("mapType", "Google", "set", "Base Layer Type", ["None", "AlbersPR", "MapBox", "OpenStreet", "Google"], { hidden: (w: Leaflet) => w.isLayer() });
234
- Leaflet.prototype.publish("map", null, "widget", "Base Layer", undefined, { internal: true });
235
- Leaflet.prototype.publish("layers", [], "propertyArray", "Layers", undefined, { hidden: (w: Leaflet) => w.isLayer() });
236
- Leaflet.prototype.publish("defaultLat", 42.877742, "number", "Center Latitude", undefined, { hidden: (w: Leaflet) => w.isLayer() });
237
- Leaflet.prototype.publish("defaultLong", -97.380979, "number", "Center Longitude", undefined, { hidden: (w: Leaflet) => w.isLayer() });
238
- Leaflet.prototype.publish("defaultZoom", 4, "number", "Zoom Level", undefined, { hidden: (w: Leaflet) => w.isLayer() });
239
- Leaflet.prototype.publish("autoZoomToFit", true, "boolean", "Auto zoom to fit Data", undefined, { hidden: (w: Leaflet) => w.isLayer() });
1
+ import { Button, HTMLWidget, IconBar, Spacer, Widget } from "@hpcc-js/common";
2
+ import { LatLngBounds, Map } from "./leaflet-shim.ts";
3
+ import { AlbersLayer } from "./AlbersPR.ts";
4
+ import { BlankLayer } from "./Blank.ts";
5
+ import { GMapLayer } from "./GMap.ts";
6
+ import { MapBoxLayer } from "./MapBox.ts";
7
+ import { OpenStreetLayer } from "./OpenStreet.ts";
8
+ import { ILayer, TileLayer } from "./TileLayer.ts";
9
+
10
+ import "../../src/leaflet/Leaflet.css";
11
+
12
+ export class Leaflet extends HTMLWidget {
13
+
14
+ protected _leafletElement;
15
+ private _leafletMap: Map;
16
+
17
+ protected _iconBar = new IconBar()
18
+ .buttons([
19
+ new Button().faChar("fa-plus").tooltip("Zoom in")
20
+ .on("click", () => {
21
+ this.zoomPlus();
22
+ }),
23
+ new Button().faChar("fa-minus").tooltip("Zoom out")
24
+ .on("click", () => {
25
+ this.zoomMinus();
26
+ }),
27
+ new Spacer(),
28
+ new Button().faChar("fa-arrows-alt").tooltip("Zoom to fit")
29
+ .on("click", () => {
30
+ this.zoomToFit();
31
+ })
32
+ ])
33
+ ;
34
+
35
+ _blankLayer = new BlankLayer();
36
+ _albersLayer = new AlbersLayer();
37
+ _mapBoxLayer = new MapBoxLayer();
38
+ _openStreetLayer = new OpenStreetLayer();
39
+ _gmapLayer = new GMapLayer();
40
+
41
+ constructor() {
42
+ super();
43
+ this.baseLayer();
44
+ }
45
+
46
+ zoom() {
47
+ return this._leafletMap.getZoom();
48
+ }
49
+
50
+ zoomPlus() {
51
+ this._leafletMap.zoomIn();
52
+ }
53
+
54
+ zoomMinus() {
55
+ this._leafletMap.zoomOut();
56
+ }
57
+
58
+ zoomToDefault() {
59
+ this._leafletMap.flyTo({ lat: this.defaultLat(), lng: this.defaultLong() }, this.defaultZoom(), { animate: false });
60
+ }
61
+
62
+ zoomToFit() {
63
+ let bounds: LatLngBounds;
64
+ if (this.mapType() === "AlbersPR") {
65
+ bounds = this._albersLayer.getBounds();
66
+ } else {
67
+ this.layers().filter(l => l.hasBounds()).forEach(layer => {
68
+ if (!bounds) {
69
+ bounds = layer.getBounds();
70
+ } else {
71
+ bounds.extend(layer.getBounds());
72
+ }
73
+ });
74
+ }
75
+ if (bounds && bounds.isValid()) {
76
+ this._leafletMap.fitBounds(bounds, { maxZoom: 14 });
77
+ } else {
78
+ this.zoomToDefault();
79
+ }
80
+ }
81
+
82
+ syncLayers(sLayers: ILayer[], domNode, element) {
83
+ const added: ILayer[] = [...sLayers];
84
+ const updated: ILayer[] = [];
85
+ const removed: ILayer[] = [];
86
+ this._leafletMap.eachLayer(layer => {
87
+ const idx = added.indexOf((layer as any).__hpcc_layer);
88
+ if (idx >= 0) {
89
+ updated.push((layer as any).__hpcc_layer);
90
+ added.splice(idx, 1);
91
+ } else if ((layer as any).__hpcc_layer) {
92
+ removed.push((layer as any).__hpcc_layer);
93
+ }
94
+ });
95
+ added.forEach(sl => {
96
+ sl.layerEnter(this._leafletMap);
97
+ sl.layerUpdate(this._leafletMap);
98
+ });
99
+ updated.forEach(sl => {
100
+ sl.layerUpdate(this._leafletMap);
101
+ });
102
+ removed.forEach(sl => {
103
+ sl.layerExit(this._leafletMap);
104
+ });
105
+ }
106
+
107
+ protected _owner: HTMLWidget;
108
+ isLayer(): boolean {
109
+ return this._owner !== undefined && this._owner !== this;
110
+ }
111
+
112
+ baseLayer(): BlankLayer | AlbersLayer | MapBoxLayer | OpenStreetLayer | GMapLayer {
113
+ switch (this.mapType()) {
114
+ case "AlbersPR":
115
+ this.map(this._albersLayer);
116
+ break;
117
+ case "MapBox":
118
+ this.map(this._mapBoxLayer);
119
+ break;
120
+ case "OpenStreet":
121
+ this.map(this._openStreetLayer);
122
+ break;
123
+ case "Google":
124
+ this.map(this._gmapLayer);
125
+ break;
126
+ case "None":
127
+ default:
128
+ this.map(this._blankLayer);
129
+ break;
130
+ }
131
+ return this.map();
132
+ }
133
+
134
+ enter(domNode, element) {
135
+ super.enter(domNode, element);
136
+ element.style("position", "relative");
137
+ this._leafletElement = element.append("div")
138
+ .style("position", "absolute")
139
+ .style("width", `${this.width()}px`)
140
+ .style("height", `${this.height()}px`)
141
+ ;
142
+
143
+ this._iconBar.target(domNode);
144
+ }
145
+
146
+ private _prevCRS;
147
+ update(domNode, element) {
148
+ super.update(domNode, element);
149
+ this._leafletElement
150
+ .style("width", `${this.width()}px`)
151
+ .style("height", `${this.height()}px`)
152
+ ;
153
+
154
+ const baseLayer = this.baseLayer();
155
+ if (this._prevCRS !== baseLayer.crs()) {
156
+ this._prevCRS = baseLayer.crs();
157
+ if (this._leafletMap) {
158
+ this.syncLayers([], domNode, element);
159
+ this._leafletMap.remove();
160
+ this._leafletElement.html("");
161
+ }
162
+ this._leafletMap = new Map(this._leafletElement.node(), {
163
+ trackResize: false,
164
+ zoomControl: false,
165
+ zoomSnap: this.mapType() === "AlbersPR" ? 0.1 : 1,
166
+ crs: baseLayer.crs(),
167
+ maxZoom: (baseLayer as any).getMaxZoom ? (baseLayer as any).getMaxZoom() : 18
168
+ });
169
+ this._leafletMap.setView([this.defaultLat(), this.defaultLong()], this.defaultZoom());
170
+ this._leafletMap["attributionControl"].setPrefix(baseLayer.attribution());
171
+ this._leafletMap.on("zoomend", e => this.layers().forEach(layer => layer.zoomEnd(e)));
172
+ this._leafletMap.on("moveend", e => this.layers().forEach(layer => layer.moveEnd(e)));
173
+ this._leafletMap.on("viewreset", e => this.layers().forEach(layer => layer.viewReset(e)));
174
+
175
+ this._renderCount = 0;
176
+ }
177
+ this.syncLayers([baseLayer, ...this.layers()], domNode, element);
178
+ this._leafletMap.invalidateSize();
179
+ if (this.autoZoomToFit()) {
180
+ this._leafletMap.whenReady(function () {
181
+ this.zoomToFit();
182
+ }, this);
183
+ }
184
+ this._iconBar
185
+ .visible(this.showToolbar())
186
+ .render((w: IconBar) => {
187
+ const bbox = w.getBBox();
188
+ w.element()
189
+ .style("z-index", 5000)
190
+ .style("left", `${this.width() - bbox.width - 4}px`)
191
+ ;
192
+ })
193
+ ;
194
+ }
195
+
196
+ exit(domNode, element) {
197
+ this._iconBar.target(null);
198
+ super.exit(domNode, element);
199
+ }
200
+
201
+ render(callback?: (w: Widget) => void): this {
202
+ const promises = [this.baseLayer().init(), ...this.layers().map(l => l.init())];
203
+ Promise.all(promises).then(() => {
204
+ super.render(callback);
205
+ });
206
+ return this;
207
+ }
208
+ }
209
+ Leaflet.prototype._class += " map_Leaflet";
210
+
211
+ export interface Leaflet {
212
+ showToolbar(): boolean;
213
+ showToolbar(_: boolean): this;
214
+ mapType(): "None" | "AlbersPR" | "MapBox" | "OpenStreet" | "Google";
215
+ mapType(_: "None" | "AlbersPR" | "MapBox" | "OpenStreet" | "Google"): this;
216
+ mapType_default(_: "None" | "AlbersPR" | "MapBox" | "OpenStreet" | "Google"): this;
217
+ map(): TileLayer;
218
+ map(_: TileLayer): this;
219
+ layers(): ILayer[];
220
+ layers(_: ILayer[]): this;
221
+ layers_default(_: ILayer[]): this;
222
+ defaultLat(): number;
223
+ defaultLat(_: number): this;
224
+ defaultLong(): number;
225
+ defaultLong(_: number): this;
226
+ defaultZoom(): number;
227
+ defaultZoom(_: number): this;
228
+ autoZoomToFit(): boolean;
229
+ autoZoomToFit(_: boolean): this;
230
+ }
231
+
232
+ Leaflet.prototype.publish("showToolbar", true, "boolean", "Show toolbar", undefined, { hidden: (w: Leaflet) => w.isLayer() });
233
+ Leaflet.prototype.publish("mapType", "Google", "set", "Base Layer Type", ["None", "AlbersPR", "MapBox", "OpenStreet", "Google"], { hidden: (w: Leaflet) => w.isLayer() });
234
+ Leaflet.prototype.publish("map", null, "widget", "Base Layer", undefined, { internal: true });
235
+ Leaflet.prototype.publish("layers", [], "propertyArray", "Layers", undefined, { hidden: (w: Leaflet) => w.isLayer() });
236
+ Leaflet.prototype.publish("defaultLat", 42.877742, "number", "Center Latitude", undefined, { hidden: (w: Leaflet) => w.isLayer() });
237
+ Leaflet.prototype.publish("defaultLong", -97.380979, "number", "Center Longitude", undefined, { hidden: (w: Leaflet) => w.isLayer() });
238
+ Leaflet.prototype.publish("defaultZoom", 4, "number", "Zoom Level", undefined, { hidden: (w: Leaflet) => w.isLayer() });
239
+ Leaflet.prototype.publish("autoZoomToFit", true, "boolean", "Auto zoom to fit Data", undefined, { hidden: (w: Leaflet) => w.isLayer() });
@@ -1,35 +1,35 @@
1
- import { Map, TileLayer as LeafletTileLayer } from "./leaflet-shim.ts";
2
- import { TileLayer } from "./TileLayer.ts";
3
-
4
- declare const window: any;
5
-
6
- export class MapBoxLayer extends TileLayer {
7
-
8
- constructor() {
9
- super();
10
- }
11
-
12
- attribution(): string {
13
- return !window.__hpcc_mapbox_apikey ? "DEVELOPER USE ONLY (@hpcc-js)" : "";
14
- }
15
-
16
- getMaxZoom(): number {
17
- return 18;
18
- }
19
-
20
- layerEnter(map: Map) {
21
- super.layerEnter(map);
22
- // Default key should be in sync with packages/map-deck/src/Common.ts
23
- if (!window.__hpcc_mapbox_apikey) {
24
- console.warn("__hpcc_mapbox_apikey does not contain a valid API key, reverting to developers key (expect limited performance)");
25
- }
26
- const hpcc_mapbox_apikey = window.__hpcc_mapbox_apikey || "pk.eyJ1IjoibGVzY2htb28iLCJhIjoiY2psY2FqY3l3MDhqNDN3cDl1MzFmZnkwcCJ9.HRoFwmz1j80gyz18ruggqw";
27
- this.add(new LeafletTileLayer(`https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token=${hpcc_mapbox_apikey}`, {
28
- attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
29
- maxZoom: 18,
30
- id: "streets-v11",
31
- accessToken: hpcc_mapbox_apikey
32
- } as any));
33
- }
34
- }
35
- MapBoxLayer.prototype._class += " map_MapBoxLayer";
1
+ import { Map, TileLayer as LeafletTileLayer } from "./leaflet-shim.ts";
2
+ import { TileLayer } from "./TileLayer.ts";
3
+
4
+ declare const window: any;
5
+
6
+ export class MapBoxLayer extends TileLayer {
7
+
8
+ constructor() {
9
+ super();
10
+ }
11
+
12
+ attribution(): string {
13
+ return !window.__hpcc_mapbox_apikey ? "DEVELOPER USE ONLY (@hpcc-js)" : "";
14
+ }
15
+
16
+ getMaxZoom(): number {
17
+ return 18;
18
+ }
19
+
20
+ layerEnter(map: Map) {
21
+ super.layerEnter(map);
22
+ // Default key should be in sync with packages/map-deck/src/Common.ts
23
+ if (!window.__hpcc_mapbox_apikey) {
24
+ console.warn("__hpcc_mapbox_apikey does not contain a valid API key, reverting to developers key (expect limited performance)");
25
+ }
26
+ const hpcc_mapbox_apikey = window.__hpcc_mapbox_apikey || "pk.eyJ1IjoibGVzY2htb28iLCJhIjoiY2psY2FqY3l3MDhqNDN3cDl1MzFmZnkwcCJ9.HRoFwmz1j80gyz18ruggqw";
27
+ this.add(new LeafletTileLayer(`https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token=${hpcc_mapbox_apikey}`, {
28
+ attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
29
+ maxZoom: 18,
30
+ id: "streets-v11",
31
+ accessToken: hpcc_mapbox_apikey
32
+ } as any));
33
+ }
34
+ }
35
+ MapBoxLayer.prototype._class += " map_MapBoxLayer";