splatone 0.0.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/.gitattributes +2 -0
- package/.vscode/settings.json +1 -0
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/crawler.js +570 -0
- package/lib/PluginBase.js +23 -0
- package/lib/VisualizerBase.js +15 -0
- package/lib/paletteGenerator.js +532 -0
- package/lib/pluginLoader.js +146 -0
- package/lib/util.js +180 -0
- package/package.json +36 -0
- package/plugins/flickr/index.js +55 -0
- package/plugins/flickr/worker.js +77 -0
- package/public/style.css +318 -0
- package/public/visualizer.js +49 -0
- package/views/index.ejs +740 -0
- package/visualizer/bulky/node.js +41 -0
- package/visualizer/bulky/web.js +29 -0
- package/visualizer/marker-cluster/node.js +50 -0
- package/visualizer/marker-cluster/public/style.css +1 -0
- package/visualizer/marker-cluster/web.js +153 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//targets[sessionId] = { hex: hexFC, triangles: trianglesFC, categories, splatonePalette };
|
|
2
|
+
//
|
|
3
|
+
function addGeoJSONLayer(map, geojson, options = {}) {
|
|
4
|
+
if (!map || !geojson) return null;
|
|
5
|
+
|
|
6
|
+
// GeoJSON レイヤを作成
|
|
7
|
+
const geojsonLayer = L.geoJSON(geojson, {
|
|
8
|
+
pointToLayer: options.pointToLayer,
|
|
9
|
+
onEachFeature: options.onEachFeature,
|
|
10
|
+
});
|
|
11
|
+
geojsonLayer.addTo(map);
|
|
12
|
+
return geojsonLayer;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
使用例:
|
|
17
|
+
const layer = addGeoJSONLayer(map, myGeoJSON, {
|
|
18
|
+
style: f => ({ color: f.properties.color || '#3388ff', weight: 2 }),
|
|
19
|
+
popupProperty: f => `name: ${f.properties.name}`,
|
|
20
|
+
});
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function loadAsset(url) {
|
|
24
|
+
const clean = String(url).split('#')[0].split('?')[0].toLowerCase();
|
|
25
|
+
|
|
26
|
+
if (clean.endsWith('.css')) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const link = document.createElement('link');
|
|
29
|
+
link.rel = 'stylesheet';
|
|
30
|
+
link.href = url;
|
|
31
|
+
link.onload = () => resolve(link);
|
|
32
|
+
link.onerror = () => reject(new Error(`CSS load failed: ${url}`));
|
|
33
|
+
document.head.appendChild(link);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (clean.endsWith('.js') || clean.endsWith('.mjs')) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const s = document.createElement('script');
|
|
40
|
+
s.type = 'module';
|
|
41
|
+
s.src = url;
|
|
42
|
+
s.onload = () => resolve(s);
|
|
43
|
+
s.onerror = () => reject(new Error(`JS load failed: ${url}`));
|
|
44
|
+
document.head.appendChild(s);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return Promise.reject(new Error(`Unsupported extension: ${url}`));
|
|
49
|
+
}
|