@lgv/visualization-map 1.1.6 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lgv/visualization-map",
3
- "version": "1.1.6",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "description": "ES6 d3.js core visualization scaffold object and utilities for maps.",
6
6
  "main": "src/index.js",
@@ -21,13 +21,13 @@ import { configuration, configurationLayout } from "../configuration.js";
21
21
  */
22
22
  class VisualizationMap extends LinearGrid {
23
23
 
24
- constructor(dom=null, data, width=configurationLayout.width, height=configurationLayout.height, MapData=null, tileServerUrl=configurationLayout.tileserver, label=configuration.branding, name=configuration.name) {
24
+ constructor(dom=null, data, width=configurationLayout.width, height=configurationLayout.height, MapData=null, center=[0,0], tileServerUrl=configurationLayout.tileserver, label=configuration.branding, name=configuration.name) {
25
25
 
26
26
  // initialize inheritance
27
27
  super(data, width, height, MapData ? MapData : new MD(data), label, name);
28
28
 
29
- let x = 0;
30
- let y = 0;
29
+ let x = center[0];
30
+ let y = center[1];
31
31
 
32
32
  if (this.data) {
33
33
 
@@ -156,6 +156,9 @@ class VisualizationMap extends LinearGrid {
156
156
  // update tile server
157
157
  L.tileLayer(this.tileServerUrl).addTo(this.map);
158
158
 
159
+ // fit to data if provided
160
+ if (this.data) this.fitToData();
161
+
159
162
  }
160
163
 
161
164
  /**
@@ -169,6 +172,9 @@ class VisualizationMap extends LinearGrid {
169
172
  // generate patterns
170
173
  this.generatePatterns();
171
174
 
175
+ // generate chart
176
+ this.generateChart();
177
+
172
178
  // add handlers for leaflet events
173
179
  this.attachEvents();
174
180
 
package/.gitlab-ci.yml DELETED
@@ -1,80 +0,0 @@
1
- stages:
2
- - test
3
- - version
4
- - publish
5
-
6
- include:
7
- ###################################### GITLAB TEMPLATES ######################################
8
- - template: Security/SAST.gitlab-ci.yml
9
-
10
- # overwrites
11
- - project: "lgensinger/cicd-templates"
12
- file: "node/module/semgrep-sast.yml"
13
-
14
- ###################################### TESTING ######################################
15
-
16
- # unit test
17
- - project: "lgensinger/cicd-templates"
18
- file: "node/module/test.yml"
19
-
20
- # coverage
21
- - project: "lgensinger/cicd-templates"
22
- file: "node/module/coverage.yml"
23
-
24
- ###################################### VERSIONING ######################################
25
-
26
- # module
27
- - project: "lgensinger/cicd-templates"
28
- file: "node/module/version.yml"
29
-
30
- ###################################### PUBLISHING ######################################
31
-
32
- # npm
33
- - project: "lgensinger/cicd-templates"
34
- file: "node/module/publish.yml"
35
-
36
- ###################################### ANCHORS ######################################
37
-
38
- .convert-css: &convert-css
39
- - cp node_modules/leaflet/dist/leaflet.css leafletCss.js
40
- - sed -i '1s/^/export default `\n/' leafletCss.js
41
- - echo "\`" >> leafletCss.js
42
- - mv leafletCss.js src/visualization/
43
-
44
- ###################################### OVERWRITES ######################################
45
-
46
- unit test:
47
- script:
48
- # make npm less noisy
49
- - npm config set loglevel=error
50
- # install module locally
51
- - npm install .
52
- # convert leaflet css for js
53
- - *convert-css
54
- # run tests
55
- - npm run test
56
-
57
- coverage:
58
- script:
59
- # make npm less noisy
60
- - npm config set loglevel=error
61
- # install module locally
62
- - npm install .
63
- # convert leaflet css for js
64
- - *convert-css
65
- # run tests
66
- - npm run coverage
67
-
68
- npm:
69
- script:
70
- - npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
71
- # install module
72
- - npm install
73
- # convert leaflet css for js
74
- - *convert-css
75
- # overwrite ignored files so leafletCss makes it to build
76
- - touch .npmignore
77
- # build module for distribution
78
- - npm run build
79
- # publish
80
- - npm publish --access public
@@ -1,39 +0,0 @@
1
- import test from "ava";
2
- import { JSDOM } from "jsdom";
3
- import { LoremIpsum } from "lorem-ipsum";
4
-
5
- /******************** PARAMS ********************/
6
-
7
- const lorem = new LoremIpsum();
8
- const rando = d => Math.floor(Math.random() * d);
9
- const randoLatLng = d => ((Math.random() * (180 - -180)) + -180).toFixed(6) * 1;
10
-
11
- let data = {type: "FeatureCollection",features:[...Array(50).keys().map(i => ({
12
- type: "Feature",
13
- properties: { label: `Location ${i}`},
14
- geometry: { coordinates: [randoLatLng,randoLatLng], type: "Point"}
15
- }))]};
16
-
17
- let div = "<div></div>";
18
- let figure = "<figure></figure>";
19
-
20
- /******************** INITIALIZE ********************/
21
-
22
- test("initialize", async t => {
23
-
24
- let imports = `import { VisualizationMap } from "../src/index.js";`
25
- let initClass = `window.vm = new VisualizationMap(null,${data});`
26
-
27
- const dom = new JSDOM(`${div}${figure}<script defer="defer" type="module">${imports}${initClass}</script>`, { runScripts: "dangerously" });
28
-
29
- //t.true(vm.branding == brand);
30
- //t.true(vm.data.toString() == data.toString());
31
- //t.true(typeof vm.center[0] === "number");
32
- //t.true(typeof vm.center[1] === "number");
33
- //t.true(vm.name == name);
34
- //t.true(vm.prefix == brand);
35
- //t.true(vm.tileServerUrl == configurationLayout.tileserver);
36
-
37
- t.pass();
38
-
39
- });