@hpcc-js/map 2.79.1 → 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 (89) 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 +19949 -19949
  11. package/dist/index.es6.js.map +1 -1
  12. package/dist/index.js +19947 -19947
  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
  88. package/types/__package__.d.ts +2 -2
  89. package/types-3.4/__package__.d.ts +2 -2
@@ -1,27 +1,27 @@
1
- .map_Layered .checkerFill {
2
- fill: red;
3
- stroke: red;
4
- opacity: 0.5;
5
- }
6
-
7
- .map_Layered .checkerNoFill {
8
- fill: none;
9
- stroke: none;
10
- opacity: 0.5;
11
- }
12
-
13
- .map_Layered .mesh {
14
- fill: none;
15
- stroke: #6D6E71;
16
- stroke-width: 0.25;
17
- }
18
-
19
- .map_Layered .data {
20
- stroke: none;
21
- stroke-width: 0.25;
22
- }
23
-
24
- .map_Layered .data .shape.selected {
25
- stroke: red;
26
- stroke-width: 1.25px;
27
- }
1
+ .map_Layered .checkerFill {
2
+ fill: red;
3
+ stroke: red;
4
+ opacity: 0.5;
5
+ }
6
+
7
+ .map_Layered .checkerNoFill {
8
+ fill: none;
9
+ stroke: none;
10
+ opacity: 0.5;
11
+ }
12
+
13
+ .map_Layered .mesh {
14
+ fill: none;
15
+ stroke: #6D6E71;
16
+ stroke-width: 0.25;
17
+ }
18
+
19
+ .map_Layered .data {
20
+ stroke: none;
21
+ stroke-width: 0.25;
22
+ }
23
+
24
+ .map_Layered .data .shape.selected {
25
+ stroke: red;
26
+ stroke-width: 1.25px;
27
+ }
package/src/Choropleth.ts CHANGED
@@ -1,195 +1,195 @@
1
- import { Palette, Utility } from "@hpcc-js/common";
2
- import { select as d3Select } from "d3-selection";
3
- import * as topojson from "topojson-client";
4
- import { Layer } from "./Layer";
5
-
6
- import "../src/Choropleth.css";
7
-
8
- declare const window: any;
9
-
10
- let _topoJsonFolder: string = window.__hpcc_topoJsonFolder || "./node_modules/@hpcc-js/map/TopoJSON";
11
- export function topoJsonFolder(_?: string): string {
12
- if (!arguments.length) return _topoJsonFolder;
13
- const retVal = _topoJsonFolder;
14
- _topoJsonFolder = _;
15
- return retVal;
16
- }
17
-
18
- export class Choropleth extends Layer {
19
- _dataMap = {};
20
- _path: any = d3Select(null);
21
- _palette;
22
- _dataMinWeight;
23
- _dataMaxWeight;
24
- _choroplethData;
25
- _choroplethTransform;
26
- _choropleth;
27
- _choroTopology;
28
- _choroTopologyObjects;
29
- _prevProjection;
30
- _prevInternalOnly;
31
-
32
- constructor() {
33
- super();
34
- Utility.SimpleSelectionMixin.call(this);
35
- }
36
-
37
- data(_?) {
38
- const retVal = Layer.prototype.data.apply(this, arguments);
39
- if (arguments.length) {
40
- this._dataMap = {};
41
- this._dataMinWeight = null;
42
- this._dataMaxWeight = null;
43
-
44
- const context = this;
45
- this.data().forEach(function (item) {
46
- context._dataMap[item[0]] = item;
47
- if (!context._dataMinWeight || item[1] < context._dataMinWeight) {
48
- context._dataMinWeight = item[1];
49
- }
50
- if (!context._dataMaxWeight || item[1] > context._dataMaxWeight) {
51
- context._dataMaxWeight = item[1];
52
- }
53
- });
54
- }
55
- return retVal;
56
- }
57
-
58
- getDataBounds() {
59
- const bbox = this._choroplethData.node().getBBox();
60
- const retVal = {
61
- x: bbox.x,
62
- y: bbox.y,
63
- width: bbox.width,
64
- height: bbox.height
65
- };
66
- /*
67
- const scale = this._zoom.scale();
68
- retVal.x *= scale;
69
- retVal.y *= scale;
70
- retVal.width *= scale;
71
- retVal.height *= scale;
72
- const translate = this._zoom.translate();
73
- retVal.x += translate[0];
74
- retVal.y += translate[1];
75
- */
76
- return retVal;
77
- }
78
-
79
- autoScale() {
80
- switch (this.autoScaleMode()) {
81
- case "none":
82
- return;
83
- case "mesh":
84
- this.zoomToBBox(this.getBounds());
85
- break;
86
- case "data":
87
- this.zoomToBBox(this.getDataBounds());
88
- break;
89
- }
90
- }
91
-
92
- layerEnter(base, svgElement, domElement) {
93
- Layer.prototype.layerEnter.apply(this, arguments);
94
- this._choroplethTransform = svgElement;
95
- this._choroplethData = this._choroplethTransform.append("g")
96
- .attr("class", "data")
97
- ;
98
- this._choropleth = this._choroplethTransform.append("path")
99
- .attr("class", "mesh")
100
- ;
101
- }
102
-
103
- layerUpdate(base, forcePath?) {
104
- Layer.prototype.layerUpdate.apply(this, arguments);
105
-
106
- this._palette = this._palette.switch(this.paletteID());
107
- if (this.useClonedPalette()) {
108
- this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
109
- }
110
-
111
- this._choroplethTransform
112
- .style("stroke", this.meshColor())
113
- .style("opacity", this.opacity())
114
- ;
115
-
116
- if (!this.visible() || !this.meshVisible()) {
117
- this._choropleth.attr("d", "");
118
- delete this._prevProjection;
119
- return;
120
- }
121
-
122
- if (forcePath || this._prevProjection !== base.projection() || this._prevInternalOnly !== this.internalOnly()) {
123
- this._choropleth
124
- .attr("d", base._d3GeoPath(topojson.mesh(this._choroTopology, this._choroTopologyObjects, this.internalOnly() ? function (a, b) { return a !== b; } : function (a, b) { return true; })))
125
- ;
126
- this._prevProjection = base.projection();
127
- this._prevInternalOnly = this.internalOnly();
128
- }
129
- this._choropleth
130
- .style("stroke-width", this.meshStrokeWidth())
131
- .style("stroke", this.meshColor())
132
- ;
133
- }
134
-
135
- layerExit(base) {
136
- delete this._prevProjection;
137
- delete this._prevInternalOnly;
138
- }
139
-
140
- layerZoomed(base) {
141
- super.layerZoomed.apply(this, arguments);
142
- this._choroplethData
143
- .style("stroke-width", this.meshVisible() ? "0px" : `${0.5 / base.zoomScale()}px`)
144
- ;
145
- }
146
-
147
- // Events ---
148
- click(row, column, selected) {
149
- }
150
-
151
- dblclick(row, column, selected) {
152
- }
153
- }
154
- Choropleth.prototype._class += " map_Choropleth";
155
- Choropleth.prototype.mixin(Utility.SimpleSelectionMixin);
156
-
157
- Choropleth.prototype._palette = Palette.rainbow("default");
158
-
159
- export interface Choropleth {
160
- autoScaleMode(): string;
161
- autoScaleMode(_: string): this;
162
- autoScaleMode_exists(): boolean;
163
- paletteID(): string;
164
- paletteID(_: string): this;
165
- paletteID_exists(): boolean;
166
- useClonedPalette(): boolean;
167
- useClonedPalette(_: boolean): this;
168
- useClonedPalette_exists(): boolean;
169
- opacity(): number;
170
- opacity(_: number): this;
171
- opacity_exists(): boolean;
172
- meshVisible(): boolean;
173
- meshVisible(_: boolean): this;
174
- meshVisible_exists(): boolean;
175
- meshColor(): string;
176
- meshColor(_: string): this;
177
- meshColor_exists(): boolean;
178
- meshStrokeWidth(): number;
179
- meshStrokeWidth(_: number): this;
180
- meshStrokeWidth_exists(): boolean;
181
- internalOnly(): boolean;
182
- internalOnly(_: boolean): this;
183
- internalOnly_exists(): boolean;
184
- }
185
-
186
- Choropleth.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", Choropleth.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
187
- Choropleth.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
188
-
189
- Choropleth.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
190
-
191
- Choropleth.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
192
- Choropleth.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
193
- Choropleth.prototype.publish("meshStrokeWidth", 0.25, "number", "Stroke Width");
194
- Choropleth.prototype.publish("internalOnly", false, "boolean", "Internal mesh only");
195
- Choropleth.prototype.publish("autoScaleMode", "mesh", "set", "Auto Scale", ["none", "mesh", "data"], { tags: ["Basic"], override: true });
1
+ import { Palette, Utility } from "@hpcc-js/common";
2
+ import { select as d3Select } from "d3-selection";
3
+ import * as topojson from "topojson-client";
4
+ import { Layer } from "./Layer";
5
+
6
+ import "../src/Choropleth.css";
7
+
8
+ declare const window: any;
9
+
10
+ let _topoJsonFolder: string = window.__hpcc_topoJsonFolder || "./node_modules/@hpcc-js/map/TopoJSON";
11
+ export function topoJsonFolder(_?: string): string {
12
+ if (!arguments.length) return _topoJsonFolder;
13
+ const retVal = _topoJsonFolder;
14
+ _topoJsonFolder = _;
15
+ return retVal;
16
+ }
17
+
18
+ export class Choropleth extends Layer {
19
+ _dataMap = {};
20
+ _path: any = d3Select(null);
21
+ _palette;
22
+ _dataMinWeight;
23
+ _dataMaxWeight;
24
+ _choroplethData;
25
+ _choroplethTransform;
26
+ _choropleth;
27
+ _choroTopology;
28
+ _choroTopologyObjects;
29
+ _prevProjection;
30
+ _prevInternalOnly;
31
+
32
+ constructor() {
33
+ super();
34
+ Utility.SimpleSelectionMixin.call(this);
35
+ }
36
+
37
+ data(_?) {
38
+ const retVal = Layer.prototype.data.apply(this, arguments);
39
+ if (arguments.length) {
40
+ this._dataMap = {};
41
+ this._dataMinWeight = null;
42
+ this._dataMaxWeight = null;
43
+
44
+ const context = this;
45
+ this.data().forEach(function (item) {
46
+ context._dataMap[item[0]] = item;
47
+ if (!context._dataMinWeight || item[1] < context._dataMinWeight) {
48
+ context._dataMinWeight = item[1];
49
+ }
50
+ if (!context._dataMaxWeight || item[1] > context._dataMaxWeight) {
51
+ context._dataMaxWeight = item[1];
52
+ }
53
+ });
54
+ }
55
+ return retVal;
56
+ }
57
+
58
+ getDataBounds() {
59
+ const bbox = this._choroplethData.node().getBBox();
60
+ const retVal = {
61
+ x: bbox.x,
62
+ y: bbox.y,
63
+ width: bbox.width,
64
+ height: bbox.height
65
+ };
66
+ /*
67
+ const scale = this._zoom.scale();
68
+ retVal.x *= scale;
69
+ retVal.y *= scale;
70
+ retVal.width *= scale;
71
+ retVal.height *= scale;
72
+ const translate = this._zoom.translate();
73
+ retVal.x += translate[0];
74
+ retVal.y += translate[1];
75
+ */
76
+ return retVal;
77
+ }
78
+
79
+ autoScale() {
80
+ switch (this.autoScaleMode()) {
81
+ case "none":
82
+ return;
83
+ case "mesh":
84
+ this.zoomToBBox(this.getBounds());
85
+ break;
86
+ case "data":
87
+ this.zoomToBBox(this.getDataBounds());
88
+ break;
89
+ }
90
+ }
91
+
92
+ layerEnter(base, svgElement, domElement) {
93
+ Layer.prototype.layerEnter.apply(this, arguments);
94
+ this._choroplethTransform = svgElement;
95
+ this._choroplethData = this._choroplethTransform.append("g")
96
+ .attr("class", "data")
97
+ ;
98
+ this._choropleth = this._choroplethTransform.append("path")
99
+ .attr("class", "mesh")
100
+ ;
101
+ }
102
+
103
+ layerUpdate(base, forcePath?) {
104
+ Layer.prototype.layerUpdate.apply(this, arguments);
105
+
106
+ this._palette = this._palette.switch(this.paletteID());
107
+ if (this.useClonedPalette()) {
108
+ this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
109
+ }
110
+
111
+ this._choroplethTransform
112
+ .style("stroke", this.meshColor())
113
+ .style("opacity", this.opacity())
114
+ ;
115
+
116
+ if (!this.visible() || !this.meshVisible()) {
117
+ this._choropleth.attr("d", "");
118
+ delete this._prevProjection;
119
+ return;
120
+ }
121
+
122
+ if (forcePath || this._prevProjection !== base.projection() || this._prevInternalOnly !== this.internalOnly()) {
123
+ this._choropleth
124
+ .attr("d", base._d3GeoPath(topojson.mesh(this._choroTopology, this._choroTopologyObjects, this.internalOnly() ? function (a, b) { return a !== b; } : function (a, b) { return true; })))
125
+ ;
126
+ this._prevProjection = base.projection();
127
+ this._prevInternalOnly = this.internalOnly();
128
+ }
129
+ this._choropleth
130
+ .style("stroke-width", this.meshStrokeWidth())
131
+ .style("stroke", this.meshColor())
132
+ ;
133
+ }
134
+
135
+ layerExit(base) {
136
+ delete this._prevProjection;
137
+ delete this._prevInternalOnly;
138
+ }
139
+
140
+ layerZoomed(base) {
141
+ super.layerZoomed.apply(this, arguments);
142
+ this._choroplethData
143
+ .style("stroke-width", this.meshVisible() ? "0px" : `${0.5 / base.zoomScale()}px`)
144
+ ;
145
+ }
146
+
147
+ // Events ---
148
+ click(row, column, selected) {
149
+ }
150
+
151
+ dblclick(row, column, selected) {
152
+ }
153
+ }
154
+ Choropleth.prototype._class += " map_Choropleth";
155
+ Choropleth.prototype.mixin(Utility.SimpleSelectionMixin);
156
+
157
+ Choropleth.prototype._palette = Palette.rainbow("default");
158
+
159
+ export interface Choropleth {
160
+ autoScaleMode(): string;
161
+ autoScaleMode(_: string): this;
162
+ autoScaleMode_exists(): boolean;
163
+ paletteID(): string;
164
+ paletteID(_: string): this;
165
+ paletteID_exists(): boolean;
166
+ useClonedPalette(): boolean;
167
+ useClonedPalette(_: boolean): this;
168
+ useClonedPalette_exists(): boolean;
169
+ opacity(): number;
170
+ opacity(_: number): this;
171
+ opacity_exists(): boolean;
172
+ meshVisible(): boolean;
173
+ meshVisible(_: boolean): this;
174
+ meshVisible_exists(): boolean;
175
+ meshColor(): string;
176
+ meshColor(_: string): this;
177
+ meshColor_exists(): boolean;
178
+ meshStrokeWidth(): number;
179
+ meshStrokeWidth(_: number): this;
180
+ meshStrokeWidth_exists(): boolean;
181
+ internalOnly(): boolean;
182
+ internalOnly(_: boolean): this;
183
+ internalOnly_exists(): boolean;
184
+ }
185
+
186
+ Choropleth.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", Choropleth.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
187
+ Choropleth.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
188
+
189
+ Choropleth.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
190
+
191
+ Choropleth.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
192
+ Choropleth.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
193
+ Choropleth.prototype.publish("meshStrokeWidth", 0.25, "number", "Stroke Width");
194
+ Choropleth.prototype.publish("internalOnly", false, "boolean", "Internal mesh only");
195
+ Choropleth.prototype.publish("autoScaleMode", "mesh", "set", "Auto Scale", ["none", "mesh", "data"], { tags: ["Basic"], override: true });
@@ -1,13 +1,13 @@
1
- import { ChoroplethCountries } from "./ChoroplethCountries";
2
-
3
- export class ChoroplethContinents extends ChoroplethCountries {
4
- constructor() {
5
- super();
6
- }
7
-
8
- layerEnter(base, svgElement, domElement) {
9
- ChoroplethCountries.prototype.layerEnter.apply(this, arguments);
10
- this._choroTopologyObjects = this._choroTopologyObjectsLand;
11
- }
12
- }
13
- ChoroplethContinents.prototype._class += " map_ChoroplethContinents";
1
+ import { ChoroplethCountries } from "./ChoroplethCountries";
2
+
3
+ export class ChoroplethContinents extends ChoroplethCountries {
4
+ constructor() {
5
+ super();
6
+ }
7
+
8
+ layerEnter(base, svgElement, domElement) {
9
+ ChoroplethCountries.prototype.layerEnter.apply(this, arguments);
10
+ this._choroTopologyObjects = this._choroTopologyObjectsLand;
11
+ }
12
+ }
13
+ ChoroplethContinents.prototype._class += " map_ChoroplethContinents";