@hpcc-js/map 2.79.2 → 2.79.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 (87) 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.es6.js +19969 -19969
  11. package/dist/index.es6.js.map +1 -1
  12. package/dist/index.js +19967 -19967
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.min.js +2 -2
  15. package/dist/index.min.js.map +1 -1
  16. package/package.json +9 -9
  17. package/src/CanvasPinLayer.ts +99 -99
  18. package/src/CanvasPins.ts +396 -396
  19. package/src/Choropleth.css +27 -27
  20. package/src/Choropleth.ts +195 -195
  21. package/src/ChoroplethContinents.ts +13 -13
  22. package/src/ChoroplethCounties.ts +109 -109
  23. package/src/ChoroplethCountries.ts +100 -100
  24. package/src/ChoroplethStates.ts +104 -104
  25. package/src/ChoroplethStatesHeat.ts +8 -8
  26. package/src/GMap.css +16 -16
  27. package/src/GMap.ts +879 -879
  28. package/src/GMapCounties.ts +93 -93
  29. package/src/GMapGraph.ts +61 -61
  30. package/src/GMapHeat.ts +27 -27
  31. package/src/GMapLayered.ts +94 -94
  32. package/src/GMapPin.ts +115 -115
  33. package/src/GMapPinLine.ts +125 -125
  34. package/src/GeoHash.css +15 -15
  35. package/src/GeoHash.ts +125 -125
  36. package/src/Graph.css +10 -10
  37. package/src/Graph.ts +98 -98
  38. package/src/Graticule.css +13 -13
  39. package/src/Graticule.ts +90 -90
  40. package/src/Heat.css +2 -2
  41. package/src/Heat.ts +82 -82
  42. package/src/IChoropleth.ts +8 -8
  43. package/src/Layer.ts +90 -90
  44. package/src/Layered.css +19 -19
  45. package/src/Layered.ts +206 -206
  46. package/src/Lines.css +9 -9
  47. package/src/Lines.ts +75 -75
  48. package/src/OpenStreet.css +15 -15
  49. package/src/OpenStreet.ts +123 -123
  50. package/src/Pins.css +18 -18
  51. package/src/Pins.ts +319 -319
  52. package/src/Projection.ts +42 -42
  53. package/src/TestHeatMap.ts +8 -8
  54. package/src/TopoJSONChoropleth.ts +114 -114
  55. package/src/Utility.ts +482 -482
  56. package/src/__package__.ts +3 -3
  57. package/src/index.ts +34 -34
  58. package/src/leaflet/AlbersPR.ts +48 -48
  59. package/src/leaflet/Blank.ts +9 -9
  60. package/src/leaflet/Circles.ts +139 -139
  61. package/src/leaflet/ClusterCircles.css +26 -26
  62. package/src/leaflet/ClusterCircles.ts +88 -88
  63. package/src/leaflet/Countries.ts +43 -43
  64. package/src/leaflet/DrawLayer.ts +167 -167
  65. package/src/leaflet/FeatureLayer.ts +138 -138
  66. package/src/leaflet/GMap.ts +44 -44
  67. package/src/leaflet/HeatLayer.ts +77 -77
  68. package/src/leaflet/Icons.ts +60 -60
  69. package/src/leaflet/Leaflet.css +3 -3
  70. package/src/leaflet/Leaflet.ts +238 -238
  71. package/src/leaflet/MapBox.ts +35 -35
  72. package/src/leaflet/Markers.ts +109 -109
  73. package/src/leaflet/OpenStreet.ts +27 -27
  74. package/src/leaflet/Path.ts +138 -138
  75. package/src/leaflet/Pins.ts +73 -73
  76. package/src/leaflet/Polygons.ts +113 -113
  77. package/src/leaflet/Region.ts +138 -138
  78. package/src/leaflet/Text.ts +99 -99
  79. package/src/leaflet/TileLayer.ts +81 -81
  80. package/src/leaflet/TopoJSON.ts +146 -146
  81. package/src/leaflet/US.ts +15 -15
  82. package/src/leaflet/USCounties.ts +43 -43
  83. package/src/leaflet/USStates.ts +41 -41
  84. package/src/leaflet/World.css +3 -3
  85. package/src/leaflet/World.ts +171 -171
  86. package/src/leaflet/index.ts +18 -18
  87. package/src/test.ts +114 -114
package/src/Pins.ts CHANGED
@@ -1,319 +1,319 @@
1
- import { Platform, Utility } from "@hpcc-js/common";
2
- import { select as d3Select } from "d3-selection";
3
- import { Layer } from "./Layer";
4
- import * as MapUtility from "./Utility";
5
-
6
- import "../src/Pins.css";
7
-
8
- export class Pins extends Layer {
9
- _geohash;
10
- _pinsTransform;
11
- _selection;
12
- pinsPaths;
13
-
14
- constructor() {
15
- super();
16
- Utility.SimpleSelectionMixin.call(this);
17
- this._geohash = new MapUtility.Geohash();
18
- }
19
-
20
- pinsData() {
21
- const geohashField = this._db.fieldByLabel(this.geohashColumn());
22
- const tooltipField = this._db.fieldByLabel(this.tooltipColumn());
23
- const latField = this._db.fieldByLabel(this.latColumn());
24
- const longField = this._db.fieldByLabel(this.longColumn());
25
- const context = this;
26
- return this.data().filter(function (row) {
27
- const lat = latField ? row[latField.idx] : row[0];
28
- const long = longField ? row[longField.idx] : row[1];
29
- if (context.omitNullLatLong() && lat === 0 && long === 0) {
30
- return false;
31
- }
32
- return true;
33
- }).map(function (row, idx) {
34
- const lat = latField ? row[latField.idx] : row[0];
35
- const long = longField ? row[longField.idx] : row[1];
36
- const retVal = {
37
- idx,
38
- lat,
39
- long,
40
- ext: row[2] instanceof Object ? row[2] : {},
41
- origRow: row
42
- };
43
- if (geohashField) {
44
- try {
45
- const pos = this._geohash.bounds(row[geohashField.idx]);
46
- retVal.lat = (pos.ne.lat + pos.sw.lat) / 2;
47
- retVal.long = (pos.ne.lon + pos.sw.lon) / 2;
48
- } catch (e) {
49
- }
50
- }
51
- if (tooltipField) {
52
- retVal.ext.tooltip = row[tooltipField.idx];
53
- }
54
- return retVal;
55
- }, this);
56
- }
57
-
58
- layerEnter(base, svgElement, domElement) {
59
- Layer.prototype.layerEnter.apply(this, arguments);
60
-
61
- this._pinsTransform = svgElement;
62
- this._selection.widgetElement(this._pinsTransform);
63
- this.pinsPaths = d3Select(null);
64
- this.tooltipHTML(function (d) {
65
- return d.ext.tooltip === undefined ? "" : d.ext.tooltip;
66
- });
67
- }
68
-
69
- layerUpdate(base) {
70
- Layer.prototype.layerUpdate.apply(this, arguments);
71
-
72
- this._pinsTransform
73
- .style("opacity", this.opacity())
74
- ;
75
-
76
- this.pinsPaths = this._pinsTransform.selectAll(".pin").data(this.visible() ? this.pinsData() : [], d => d.idx);
77
- const context = this;
78
- const updatesPaths = this.pinsPaths.enter().append("g")
79
- .attr("class", "pin")
80
- .call(this._selection.enter.bind(this._selection))
81
- .on("click", function (d) {
82
- context.click(context.rowToObj(d.origRow), "geohash", context._selection.selected(this));
83
- })
84
- .on("dblclick", function (d) {
85
- context.dblclick(context.rowToObj(d.origRow), "geohash", context._selection.selected(this));
86
- })
87
- .on("mouseover", function (d) {
88
- if (!Platform.isIE) {
89
- this.parentNode.appendChild(this);
90
- }
91
- })
92
- .on("mouseout.tooltip", function (d) {
93
- if (d.ext && d.ext.tooltip) {
94
- context.tooltip.hide.apply(this, arguments);
95
- }
96
- })
97
- .on("mousemove.tooltip", function (d) {
98
- if (d.ext && d.ext.tooltip) {
99
- context.tooltip.show.apply(this, arguments);
100
- }
101
- })
102
- .each(function (d) {
103
- const element = d3Select(this);
104
- element.append("path")
105
- .attr("class", "data")
106
- ;
107
- element.append("text")
108
- .attr("text-anchor", "middle")
109
- ;
110
- }).merge(this.pinsPaths);
111
- updatesPaths.selectAll("text")
112
- .style("stroke", this.fontColor())
113
- .style("fill", this.fontColor())
114
- .style("font-size", this.fontSize())
115
- .style("font-family", this.fontFamily())
116
- .style("dominant-baseline", this.textBaseline())
117
- .attr("dx", 0)
118
- .attr("dy", this.pinTextDY())
119
- .text(function (d) {
120
- return d.ext && d.ext.text ? d.ext.text : "";
121
- });
122
- const svgPath = this.svgPinPath();
123
- updatesPaths.selectAll("path.data")
124
- .attr("d", svgPath)
125
- .attr("stroke-width", this.strokeWidth() + "px")
126
- .style("display", function (d) {
127
- const pos = base.project(d.lat, d.long);
128
- if (!pos) {
129
- return "none";
130
- }
131
- return null;
132
- })
133
- .style("stroke", function (d) {
134
- return d.ext && d.ext.strokeColor ? d.ext.strokeColor : context.strokeColor();
135
- })
136
- .style("fill", function (d) {
137
- return d.ext && d.ext.fillColor ? d.ext.fillColor : context.fillColor();
138
- })
139
- ;
140
- this.pinsPaths.exit().remove();
141
- }
142
-
143
- layerZoomed(base) {
144
- Layer.prototype.layerZoomed.apply(this, arguments);
145
- this.pinsPaths
146
- .attr("transform", function (d) {
147
- let pos = base.project(d.lat, d.long);
148
- if (!pos) {
149
- pos = [0, 0];
150
- }
151
- return "translate(" + pos[0] + ", " + pos[1] + ")scale(" + (1 / base.zoomScale()) + ")";
152
- })
153
- ;
154
- }
155
-
156
- pinTextDY() {
157
- switch (this.pinType()) {
158
- case "pin":
159
- case "rectangle-pin":
160
- return -this.arrowHeight();
161
- case "circle":
162
- case "rectangle":
163
- return 0;
164
- }
165
- }
166
- svgPinPath() {
167
- switch (this.pinType()) {
168
- case "pin":
169
- return this.circlePinPath();
170
- case "circle":
171
- return this.circlePath();
172
- case "rectangle":
173
- return this.rectanglePath();
174
- case "rectangle-pin":
175
- return this.rectanglePinPath();
176
- }
177
- }
178
-
179
- rectanglePinPath() {
180
- const width = this.pinWidth();
181
- const height = this.pinHeight();
182
- const radius = this.cornerRadius();
183
- const arrow_h = this.arrowHeight();
184
- const arrow_w = this.arrowWidth();
185
- const x = 0 - width / 2;
186
- const y = 0 - height + radius;
187
- const arrow_b = (width - radius * 2 - arrow_w) / 2;
188
- return "M" + x + "," + y +
189
- "a" + -radius + "," + -radius + " 0 0 1 " + radius + "," + -radius +
190
- "h" + (width + -radius * 2) +
191
- "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius +
192
- "v" + (height + -radius * 2) +
193
- "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius +
194
- "h" + -arrow_b +
195
- "l" + -arrow_w / 2 + "," + arrow_h +
196
- "l" + -arrow_w / 2 + "," + -arrow_h +
197
- "h" + -arrow_b +
198
- "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius +
199
- "z";
200
- }
201
- rectanglePath() {
202
- const width = this.pinWidth();
203
- const height = this.pinHeight();
204
- const radius = this.cornerRadius();
205
- const x = -width / 2;
206
- let y = -height / 2;
207
- y += radius;
208
- return "M" + x + "," + y +
209
- "a" + -radius + "," + -radius + " 0 0 1 " + radius + "," + -radius +
210
- "h" + (width + -radius * 2) +
211
- "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius +
212
- "v" + (height + -radius * 2) +
213
- "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius +
214
- "h" + (-width + radius * 2) +
215
- "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius +
216
- "z";
217
- }
218
- circlePinPath() {
219
- const arrow_h = this.arrowHeight();
220
- const arrow_w = this.arrowWidth();
221
- const x = 0 - arrow_w / 2;
222
- const y = 0 - arrow_h;
223
- const bezier_x = arrow_w / 2;
224
- const bezier_y = arrow_h;
225
- const c_dx1 = -bezier_x;
226
- const c_dy1 = -bezier_y;
227
- const c_dx2 = arrow_w + bezier_x;
228
- const c_dy2 = c_dy1;
229
- const c_dx = arrow_w;
230
- const c_dy = 0;
231
- return "M" + x + "," + y +
232
- "c" + c_dx1 + " " + c_dy1 + ", " + c_dx2 + " " + c_dy2 + ", " + c_dx + " " + c_dy +
233
- "l" + -arrow_w / 2 + "," + arrow_h +
234
- "l" + -arrow_w / 2 + "," + -arrow_h +
235
- "z";
236
- }
237
-
238
- circlePath() {
239
- const radius = +this.pinRadius();
240
- return `M 0, 0 m ${-radius}, 0 a ${radius},${radius} 0 1,0 ${radius * 2},0 a ${radius},${radius} 0 1,0 ${-radius * 2},0`;
241
- }
242
-
243
- // Events ---
244
- click(row, column, selected) {
245
- }
246
-
247
- dblclick(row, column, selected) {
248
- }
249
-
250
- latColumn: { (): string; (_: string): Pins };
251
- latColumn_exists: () => boolean;
252
- longColumn: { (): string; (_: string): Pins };
253
- longColumn_exists: () => boolean;
254
- geohashColumn: { (): string; (_: string): Pins };
255
- geohashColumn_exists: () => boolean;
256
- tooltipColumn: { (): string; (_: string): Pins };
257
- tooltipColumn_exists: () => boolean;
258
- opacity: { (): number; (_: number): Pins };
259
- opacity_exists: () => boolean;
260
- fillColor: { (): string; (_: string): Pins };
261
- fillColor_exists: () => boolean;
262
- omitNullLatLong: { (): boolean; (_: boolean): Pins };
263
- omitNullLatLong_exists: () => boolean;
264
- strokeWidth: { (): number; (_: number): Pins };
265
- strokeWidth_exists: () => boolean;
266
- strokeColor: { (): string; (_: string): Pins };
267
- strokeColor_exists: () => boolean;
268
- fontSize: { (): number; (_: number): Pins };
269
- fontSize_exists: () => boolean;
270
- fontFamily: { (): string; (_: string): Pins };
271
- fontFamily_exists: () => boolean;
272
- fontColor: { (): string; (_: string): Pins };
273
- fontColor_exists: () => boolean;
274
- pinType: { (): string; (_: string): Pins };
275
- pinType_exists: () => boolean;
276
- arrowWidth: { (): number; (_: number): Pins };
277
- arrowWidth_exists: () => boolean;
278
- arrowHeight: { (): number; (_: number): Pins };
279
- arrowHeight_exists: () => boolean;
280
- pinWidth: { (): number; (_: number): Pins };
281
- pinWidth_exists: () => boolean;
282
- pinHeight: { (): number; (_: number): Pins };
283
- pinHeight_exists: () => boolean;
284
- cornerRadius: { (): number; (_: number): Pins };
285
- cornerRadius_exists: () => boolean;
286
- pinRadius: { (): number; (_: number): Pins };
287
- pinRadius_exists: () => boolean;
288
- textBaseline: { (): string; (_: string): Pins };
289
- textBaseline_exists: () => boolean;
290
- }
291
- Pins.prototype._class += " map_Pins";
292
- Pins.prototype.mixin(Utility.SimpleSelectionMixin);
293
-
294
- Pins.prototype.publish("geohashColumn", null, "set", "Geohash column", function () { return this.columns(); }, { optional: true });
295
- Pins.prototype.publish("tooltipColumn", null, "set", "Tooltip column", function () { return this.columns(); }, { optional: true });
296
- Pins.prototype.publish("latColumn", null, "set", "Latitude column", function () { return this.columns(); }, { optional: true });
297
- Pins.prototype.publish("longColumn", null, "set", "Longitude column", function () { return this.columns(); }, { optional: true });
298
- Pins.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
299
- Pins.prototype.publish("fillColor", "#00FFDD", "html-color", "Pin Color", null, { optional: true });
300
- Pins.prototype.publish("omitNullLatLong", false, "boolean", "Remove lat=0,lng=0 from pinsData", null, { tags: ["Basic"] });
301
-
302
- Pins.prototype.publish("strokeWidth", 0.5, "number", "Pin Border Thickness (pixels)", null, { tags: ["Basic"] });
303
- Pins.prototype.publish("strokeColor", "", "html-color", "Pin Border Color", null, { optional: true });
304
-
305
- Pins.prototype.publish("fontSize", 18, "number", "Font Size", null, { tags: ["Basic", "Shared"] });
306
- Pins.prototype.publish("fontFamily", "Verdana", "string", "Font Name", null, { tags: ["Basic", "Shared", "Shared"] });
307
- Pins.prototype.publish("fontColor", "#000000", "html-color", "Font Color", null, { tags: ["Basic", "Shared"] });
308
-
309
- Pins.prototype.publish("pinType", "pin", "set", "Pin Type", ["pin", "circle", "rectangle", "rectangle-pin"], { tags: ["Basic"] });
310
- Pins.prototype.publish("arrowWidth", 8, "number", "Pin arrow width (pixels)", null, { tags: ["Basic"], disable: w => ["pin", "rectangle-pin"].indexOf(w.pinType()) === -1 });
311
- Pins.prototype.publish("arrowHeight", 12, "number", "Pin arrow height (pixels)", null, { tags: ["Basic"], disable: w => ["pin", "rectangle-pin"].indexOf(w.pinType()) === -1 });
312
-
313
- Pins.prototype.publish("pinWidth", 20, "number", "Width of pin (pixels)", null, { tags: ["Basic"], disable: w => ["rectangle", "rectangle-pin"].indexOf(w.pinType()) === -1 });
314
- Pins.prototype.publish("pinHeight", 20, "number", "Height of pin (pixels) (not including arrow)", null, { tags: ["Basic"], disable: w => ["rectangle", "rectangle-pin"].indexOf(w.pinType()) === -1 });
315
- Pins.prototype.publish("cornerRadius", 10, "number", "Radius of rectangular pin corners (pixels)", null, { tags: ["Basic"], disable: w => ["rectangle", "rectangle-pin"].indexOf(w.pinType()) === -1 });
316
-
317
- Pins.prototype.publish("pinRadius", 12, "number", "Radius of circle (pixels)", null, { tags: ["Basic"], disable: w => w.pinType() !== "circle" });
318
-
319
- Pins.prototype.publish("textBaseline", "central", "set", "Pin text vertical alignment", ["auto", "use-script", "no-change", "reset-size", "ideographic", "alphabetic", "hanging", "mathematical", "central", "middle", "text-after-edge", "text-before-edge", "inherit"], { tags: ["Basic"] });
1
+ import { Platform, Utility } from "@hpcc-js/common";
2
+ import { select as d3Select } from "d3-selection";
3
+ import { Layer } from "./Layer";
4
+ import * as MapUtility from "./Utility";
5
+
6
+ import "../src/Pins.css";
7
+
8
+ export class Pins extends Layer {
9
+ _geohash;
10
+ _pinsTransform;
11
+ _selection;
12
+ pinsPaths;
13
+
14
+ constructor() {
15
+ super();
16
+ Utility.SimpleSelectionMixin.call(this);
17
+ this._geohash = new MapUtility.Geohash();
18
+ }
19
+
20
+ pinsData() {
21
+ const geohashField = this._db.fieldByLabel(this.geohashColumn());
22
+ const tooltipField = this._db.fieldByLabel(this.tooltipColumn());
23
+ const latField = this._db.fieldByLabel(this.latColumn());
24
+ const longField = this._db.fieldByLabel(this.longColumn());
25
+ const context = this;
26
+ return this.data().filter(function (row) {
27
+ const lat = latField ? row[latField.idx] : row[0];
28
+ const long = longField ? row[longField.idx] : row[1];
29
+ if (context.omitNullLatLong() && lat === 0 && long === 0) {
30
+ return false;
31
+ }
32
+ return true;
33
+ }).map(function (row, idx) {
34
+ const lat = latField ? row[latField.idx] : row[0];
35
+ const long = longField ? row[longField.idx] : row[1];
36
+ const retVal = {
37
+ idx,
38
+ lat,
39
+ long,
40
+ ext: row[2] instanceof Object ? row[2] : {},
41
+ origRow: row
42
+ };
43
+ if (geohashField) {
44
+ try {
45
+ const pos = this._geohash.bounds(row[geohashField.idx]);
46
+ retVal.lat = (pos.ne.lat + pos.sw.lat) / 2;
47
+ retVal.long = (pos.ne.lon + pos.sw.lon) / 2;
48
+ } catch (e) {
49
+ }
50
+ }
51
+ if (tooltipField) {
52
+ retVal.ext.tooltip = row[tooltipField.idx];
53
+ }
54
+ return retVal;
55
+ }, this);
56
+ }
57
+
58
+ layerEnter(base, svgElement, domElement) {
59
+ Layer.prototype.layerEnter.apply(this, arguments);
60
+
61
+ this._pinsTransform = svgElement;
62
+ this._selection.widgetElement(this._pinsTransform);
63
+ this.pinsPaths = d3Select(null);
64
+ this.tooltipHTML(function (d) {
65
+ return d.ext.tooltip === undefined ? "" : d.ext.tooltip;
66
+ });
67
+ }
68
+
69
+ layerUpdate(base) {
70
+ Layer.prototype.layerUpdate.apply(this, arguments);
71
+
72
+ this._pinsTransform
73
+ .style("opacity", this.opacity())
74
+ ;
75
+
76
+ this.pinsPaths = this._pinsTransform.selectAll(".pin").data(this.visible() ? this.pinsData() : [], d => d.idx);
77
+ const context = this;
78
+ const updatesPaths = this.pinsPaths.enter().append("g")
79
+ .attr("class", "pin")
80
+ .call(this._selection.enter.bind(this._selection))
81
+ .on("click", function (d) {
82
+ context.click(context.rowToObj(d.origRow), "geohash", context._selection.selected(this));
83
+ })
84
+ .on("dblclick", function (d) {
85
+ context.dblclick(context.rowToObj(d.origRow), "geohash", context._selection.selected(this));
86
+ })
87
+ .on("mouseover", function (d) {
88
+ if (!Platform.isIE) {
89
+ this.parentNode.appendChild(this);
90
+ }
91
+ })
92
+ .on("mouseout.tooltip", function (d) {
93
+ if (d.ext && d.ext.tooltip) {
94
+ context.tooltip.hide.apply(this, arguments);
95
+ }
96
+ })
97
+ .on("mousemove.tooltip", function (d) {
98
+ if (d.ext && d.ext.tooltip) {
99
+ context.tooltip.show.apply(this, arguments);
100
+ }
101
+ })
102
+ .each(function (d) {
103
+ const element = d3Select(this);
104
+ element.append("path")
105
+ .attr("class", "data")
106
+ ;
107
+ element.append("text")
108
+ .attr("text-anchor", "middle")
109
+ ;
110
+ }).merge(this.pinsPaths);
111
+ updatesPaths.selectAll("text")
112
+ .style("stroke", this.fontColor())
113
+ .style("fill", this.fontColor())
114
+ .style("font-size", this.fontSize())
115
+ .style("font-family", this.fontFamily())
116
+ .style("dominant-baseline", this.textBaseline())
117
+ .attr("dx", 0)
118
+ .attr("dy", this.pinTextDY())
119
+ .text(function (d) {
120
+ return d.ext && d.ext.text ? d.ext.text : "";
121
+ });
122
+ const svgPath = this.svgPinPath();
123
+ updatesPaths.selectAll("path.data")
124
+ .attr("d", svgPath)
125
+ .attr("stroke-width", this.strokeWidth() + "px")
126
+ .style("display", function (d) {
127
+ const pos = base.project(d.lat, d.long);
128
+ if (!pos) {
129
+ return "none";
130
+ }
131
+ return null;
132
+ })
133
+ .style("stroke", function (d) {
134
+ return d.ext && d.ext.strokeColor ? d.ext.strokeColor : context.strokeColor();
135
+ })
136
+ .style("fill", function (d) {
137
+ return d.ext && d.ext.fillColor ? d.ext.fillColor : context.fillColor();
138
+ })
139
+ ;
140
+ this.pinsPaths.exit().remove();
141
+ }
142
+
143
+ layerZoomed(base) {
144
+ Layer.prototype.layerZoomed.apply(this, arguments);
145
+ this.pinsPaths
146
+ .attr("transform", function (d) {
147
+ let pos = base.project(d.lat, d.long);
148
+ if (!pos) {
149
+ pos = [0, 0];
150
+ }
151
+ return "translate(" + pos[0] + ", " + pos[1] + ")scale(" + (1 / base.zoomScale()) + ")";
152
+ })
153
+ ;
154
+ }
155
+
156
+ pinTextDY() {
157
+ switch (this.pinType()) {
158
+ case "pin":
159
+ case "rectangle-pin":
160
+ return -this.arrowHeight();
161
+ case "circle":
162
+ case "rectangle":
163
+ return 0;
164
+ }
165
+ }
166
+ svgPinPath() {
167
+ switch (this.pinType()) {
168
+ case "pin":
169
+ return this.circlePinPath();
170
+ case "circle":
171
+ return this.circlePath();
172
+ case "rectangle":
173
+ return this.rectanglePath();
174
+ case "rectangle-pin":
175
+ return this.rectanglePinPath();
176
+ }
177
+ }
178
+
179
+ rectanglePinPath() {
180
+ const width = this.pinWidth();
181
+ const height = this.pinHeight();
182
+ const radius = this.cornerRadius();
183
+ const arrow_h = this.arrowHeight();
184
+ const arrow_w = this.arrowWidth();
185
+ const x = 0 - width / 2;
186
+ const y = 0 - height + radius;
187
+ const arrow_b = (width - radius * 2 - arrow_w) / 2;
188
+ return "M" + x + "," + y +
189
+ "a" + -radius + "," + -radius + " 0 0 1 " + radius + "," + -radius +
190
+ "h" + (width + -radius * 2) +
191
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius +
192
+ "v" + (height + -radius * 2) +
193
+ "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius +
194
+ "h" + -arrow_b +
195
+ "l" + -arrow_w / 2 + "," + arrow_h +
196
+ "l" + -arrow_w / 2 + "," + -arrow_h +
197
+ "h" + -arrow_b +
198
+ "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius +
199
+ "z";
200
+ }
201
+ rectanglePath() {
202
+ const width = this.pinWidth();
203
+ const height = this.pinHeight();
204
+ const radius = this.cornerRadius();
205
+ const x = -width / 2;
206
+ let y = -height / 2;
207
+ y += radius;
208
+ return "M" + x + "," + y +
209
+ "a" + -radius + "," + -radius + " 0 0 1 " + radius + "," + -radius +
210
+ "h" + (width + -radius * 2) +
211
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius +
212
+ "v" + (height + -radius * 2) +
213
+ "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius +
214
+ "h" + (-width + radius * 2) +
215
+ "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius +
216
+ "z";
217
+ }
218
+ circlePinPath() {
219
+ const arrow_h = this.arrowHeight();
220
+ const arrow_w = this.arrowWidth();
221
+ const x = 0 - arrow_w / 2;
222
+ const y = 0 - arrow_h;
223
+ const bezier_x = arrow_w / 2;
224
+ const bezier_y = arrow_h;
225
+ const c_dx1 = -bezier_x;
226
+ const c_dy1 = -bezier_y;
227
+ const c_dx2 = arrow_w + bezier_x;
228
+ const c_dy2 = c_dy1;
229
+ const c_dx = arrow_w;
230
+ const c_dy = 0;
231
+ return "M" + x + "," + y +
232
+ "c" + c_dx1 + " " + c_dy1 + ", " + c_dx2 + " " + c_dy2 + ", " + c_dx + " " + c_dy +
233
+ "l" + -arrow_w / 2 + "," + arrow_h +
234
+ "l" + -arrow_w / 2 + "," + -arrow_h +
235
+ "z";
236
+ }
237
+
238
+ circlePath() {
239
+ const radius = +this.pinRadius();
240
+ return `M 0, 0 m ${-radius}, 0 a ${radius},${radius} 0 1,0 ${radius * 2},0 a ${radius},${radius} 0 1,0 ${-radius * 2},0`;
241
+ }
242
+
243
+ // Events ---
244
+ click(row, column, selected) {
245
+ }
246
+
247
+ dblclick(row, column, selected) {
248
+ }
249
+
250
+ latColumn: { (): string; (_: string): Pins };
251
+ latColumn_exists: () => boolean;
252
+ longColumn: { (): string; (_: string): Pins };
253
+ longColumn_exists: () => boolean;
254
+ geohashColumn: { (): string; (_: string): Pins };
255
+ geohashColumn_exists: () => boolean;
256
+ tooltipColumn: { (): string; (_: string): Pins };
257
+ tooltipColumn_exists: () => boolean;
258
+ opacity: { (): number; (_: number): Pins };
259
+ opacity_exists: () => boolean;
260
+ fillColor: { (): string; (_: string): Pins };
261
+ fillColor_exists: () => boolean;
262
+ omitNullLatLong: { (): boolean; (_: boolean): Pins };
263
+ omitNullLatLong_exists: () => boolean;
264
+ strokeWidth: { (): number; (_: number): Pins };
265
+ strokeWidth_exists: () => boolean;
266
+ strokeColor: { (): string; (_: string): Pins };
267
+ strokeColor_exists: () => boolean;
268
+ fontSize: { (): number; (_: number): Pins };
269
+ fontSize_exists: () => boolean;
270
+ fontFamily: { (): string; (_: string): Pins };
271
+ fontFamily_exists: () => boolean;
272
+ fontColor: { (): string; (_: string): Pins };
273
+ fontColor_exists: () => boolean;
274
+ pinType: { (): string; (_: string): Pins };
275
+ pinType_exists: () => boolean;
276
+ arrowWidth: { (): number; (_: number): Pins };
277
+ arrowWidth_exists: () => boolean;
278
+ arrowHeight: { (): number; (_: number): Pins };
279
+ arrowHeight_exists: () => boolean;
280
+ pinWidth: { (): number; (_: number): Pins };
281
+ pinWidth_exists: () => boolean;
282
+ pinHeight: { (): number; (_: number): Pins };
283
+ pinHeight_exists: () => boolean;
284
+ cornerRadius: { (): number; (_: number): Pins };
285
+ cornerRadius_exists: () => boolean;
286
+ pinRadius: { (): number; (_: number): Pins };
287
+ pinRadius_exists: () => boolean;
288
+ textBaseline: { (): string; (_: string): Pins };
289
+ textBaseline_exists: () => boolean;
290
+ }
291
+ Pins.prototype._class += " map_Pins";
292
+ Pins.prototype.mixin(Utility.SimpleSelectionMixin);
293
+
294
+ Pins.prototype.publish("geohashColumn", null, "set", "Geohash column", function () { return this.columns(); }, { optional: true });
295
+ Pins.prototype.publish("tooltipColumn", null, "set", "Tooltip column", function () { return this.columns(); }, { optional: true });
296
+ Pins.prototype.publish("latColumn", null, "set", "Latitude column", function () { return this.columns(); }, { optional: true });
297
+ Pins.prototype.publish("longColumn", null, "set", "Longitude column", function () { return this.columns(); }, { optional: true });
298
+ Pins.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
299
+ Pins.prototype.publish("fillColor", "#00FFDD", "html-color", "Pin Color", null, { optional: true });
300
+ Pins.prototype.publish("omitNullLatLong", false, "boolean", "Remove lat=0,lng=0 from pinsData", null, { tags: ["Basic"] });
301
+
302
+ Pins.prototype.publish("strokeWidth", 0.5, "number", "Pin Border Thickness (pixels)", null, { tags: ["Basic"] });
303
+ Pins.prototype.publish("strokeColor", "", "html-color", "Pin Border Color", null, { optional: true });
304
+
305
+ Pins.prototype.publish("fontSize", 18, "number", "Font Size", null, { tags: ["Basic", "Shared"] });
306
+ Pins.prototype.publish("fontFamily", "Verdana", "string", "Font Name", null, { tags: ["Basic", "Shared", "Shared"] });
307
+ Pins.prototype.publish("fontColor", "#000000", "html-color", "Font Color", null, { tags: ["Basic", "Shared"] });
308
+
309
+ Pins.prototype.publish("pinType", "pin", "set", "Pin Type", ["pin", "circle", "rectangle", "rectangle-pin"], { tags: ["Basic"] });
310
+ Pins.prototype.publish("arrowWidth", 8, "number", "Pin arrow width (pixels)", null, { tags: ["Basic"], disable: w => ["pin", "rectangle-pin"].indexOf(w.pinType()) === -1 });
311
+ Pins.prototype.publish("arrowHeight", 12, "number", "Pin arrow height (pixels)", null, { tags: ["Basic"], disable: w => ["pin", "rectangle-pin"].indexOf(w.pinType()) === -1 });
312
+
313
+ Pins.prototype.publish("pinWidth", 20, "number", "Width of pin (pixels)", null, { tags: ["Basic"], disable: w => ["rectangle", "rectangle-pin"].indexOf(w.pinType()) === -1 });
314
+ Pins.prototype.publish("pinHeight", 20, "number", "Height of pin (pixels) (not including arrow)", null, { tags: ["Basic"], disable: w => ["rectangle", "rectangle-pin"].indexOf(w.pinType()) === -1 });
315
+ Pins.prototype.publish("cornerRadius", 10, "number", "Radius of rectangular pin corners (pixels)", null, { tags: ["Basic"], disable: w => ["rectangle", "rectangle-pin"].indexOf(w.pinType()) === -1 });
316
+
317
+ Pins.prototype.publish("pinRadius", 12, "number", "Radius of circle (pixels)", null, { tags: ["Basic"], disable: w => w.pinType() !== "circle" });
318
+
319
+ Pins.prototype.publish("textBaseline", "central", "set", "Pin text vertical alignment", ["auto", "use-script", "no-change", "reset-size", "ideographic", "alphabetic", "hanging", "mathematical", "central", "middle", "text-after-edge", "text-before-edge", "inherit"], { tags: ["Basic"] });