-
Notifications
You must be signed in to change notification settings - Fork 0
/
SVG_map.js
75 lines (56 loc) · 1.47 KB
/
SVG_map.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'use strict';
// ----------------------------------------------------------------------------
// Load CeJS library.
// npm: 若有 CeJS module 則用之。
// globalThis.use_cejs_mudule = true;
try {
require('./_CeL.loader.nodejs.js');
} catch (e) {
require('cejs');
}
CeL.run(['data.XML', 'application.storage', 'data.native']);
// ----------------------------------------------------------------------------
let SVG_map_functions;
function reaad_SVG_file(file_path) {
const XML_data = CeL.read_file(file_path);
return SVG_map_functions.convert_to_SVG_data(XML_data.toString());
}
function write_SVG_file(file_path, SVG_data) {
CeL.write_file(file_path, SVG_data.toString());
}
function main_process() {
const SVG_data = reaad_SVG_file(SVG_map_functions.default_SVG_file_name, { remove_town: true });
const map_options = {
[SVG_map_functions.KEY_default]: {
// county > fill
//fill: '#f00',
// information_label > fill
//color: '#eff',
// information_label > text
//label: 'label',
county: {
//fill: '',
//stroke: '',
},
county_label: {
//text: '',
//fill: '',
},
information_label: {
//text: '',
//fill: '',
},
},
馬祖: {
fill: 'red',
color: 'orange',
label: '馬祖label'
},
};
SVG_map_functions.adapt_map_options(SVG_data, map_options);
write_SVG_file('Taiwan map generated.svg', SVG_data);
}
(async function () {
SVG_map_functions = await import('./SVG_map.core.mjs');
main_process();
})();