mirror of https://gitee.com/antv-l7/antv-l7
rollup
This commit is contained in:
parent
a8326dcc0e
commit
69d280f421
|
@ -1,77 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
||||||
<meta name="geometry" content="diagram">
|
|
||||||
<link rel="stylesheet" href="./assets/common.css">
|
|
||||||
<link rel="stylesheet" href="./assets/info.css">
|
|
||||||
<title>point_circle</title>
|
|
||||||
<style>
|
|
||||||
#map { position:absolute; top:0; bottom:0; width:100%; }
|
|
||||||
.amap-maps {
|
|
||||||
cursor: auto !important
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="map"></div>
|
|
||||||
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
|
|
||||||
<script src="./assets/jquery-3.2.1.min.js"></script>
|
|
||||||
<script src="./assets/dat.gui.min.js"></script>
|
|
||||||
<script src="../build/L7.js"></script>
|
|
||||||
<script>
|
|
||||||
const colorObj ={
|
|
||||||
blue: ["#E8FCFF", "#CFF6FF", "#A1E9ff", "#65CEF7", "#3CB1F0", "#2894E0", "#1772c2", "#105CB3", "#0D408C", "#002466"].reverse(),
|
|
||||||
red: ["#FFF4F2", "#FFDFDB", "#FAADAA", "#F77472", "#F04850", "#D63147", "#BD223E", "#A81642", "#820C37", "#5C0023"].reverse(),
|
|
||||||
orange:["#FFF7EB", "#FFECD4", "#FAD09D", "#F7B16A", "#F08D41", "#DB6C2C", "#C2491D", "#AD2B11", "#871D0C", "#610800"].reverse(),
|
|
||||||
green:["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"].reverse(),
|
|
||||||
yellow:["#FFFFE8", "#FFFECC", "#FAF896", "#F7E463", "#F0CE3A", "#DBB125", "#C29117", "#AD7410", "#87500C", "#613000"].reverse(),
|
|
||||||
purple:["#FCF2FF", "#F5DEFF", "#DDB3F2", "#BE7BE3", "#9B4ECF", "#7737B3", "#5B2899", "#411C85", "#270F5E", "#100338"].reverse()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const scene = new L7.Scene({
|
|
||||||
id: 'map',
|
|
||||||
mapStyle: 'light', // 样式URL
|
|
||||||
center: [ 120.19382669582967, 30.258134 ],
|
|
||||||
pitch: 0,
|
|
||||||
zoom: 4,
|
|
||||||
maxZoom:14,
|
|
||||||
minZoom:4,
|
|
||||||
});
|
|
||||||
window.scene = scene;
|
|
||||||
scene.on('loaded', () => {
|
|
||||||
$.get('https://gw.alipayobjects.com/os/basement_prod/7359a5e9-3c5e-453f-b207-bc892fb23b84.csv', data => {
|
|
||||||
|
|
||||||
|
|
||||||
const circleLayer = scene.PointLayer({
|
|
||||||
zIndex: 2
|
|
||||||
})
|
|
||||||
.source(data,{
|
|
||||||
type: 'csv',
|
|
||||||
x: 'lng',
|
|
||||||
y: 'lat',
|
|
||||||
})
|
|
||||||
.size(1.0)
|
|
||||||
.color('#0D408C')
|
|
||||||
.style({
|
|
||||||
stroke: 'rgb(255,255,255)',
|
|
||||||
strokeWidth: 1,
|
|
||||||
opacity: 1.
|
|
||||||
})
|
|
||||||
.render();
|
|
||||||
|
|
||||||
circleLayer.on('click',(e)=>{
|
|
||||||
console.log(e);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
||||||
<meta name="geometry" content="diagram">
|
|
||||||
<link rel="stylesheet" href="./assets/common.css">
|
|
||||||
<title>point_circle</title>
|
|
||||||
<style>
|
|
||||||
#map { position:absolute; top:0; bottom:0; width:100%; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="map"></div>
|
|
||||||
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
|
|
||||||
<script src="./assets/jquery-3.2.1.min.js"></script>
|
|
||||||
<script src="./assets/dat.gui.min.js"></script>
|
|
||||||
<script src="../build/L7.js"></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
const scene = new L7.Scene({
|
|
||||||
id: 'map',
|
|
||||||
mapStyle: 'dark', // 样式URL
|
|
||||||
center: [ 120.037828998113099, 30.086317611850635 ],
|
|
||||||
pitch: 0,
|
|
||||||
zoom: 5.44
|
|
||||||
});
|
|
||||||
window.scene = scene;
|
|
||||||
var colorObj={
|
|
||||||
'黄色':'yellow',
|
|
||||||
'蓝色':'blue',
|
|
||||||
'橙色':'orange'
|
|
||||||
|
|
||||||
}
|
|
||||||
scene.on('loaded', () => {
|
|
||||||
$.get('./data/waringData.json', data => {
|
|
||||||
scene.PointLayer({
|
|
||||||
zIndex: 2
|
|
||||||
})
|
|
||||||
.source(data, {
|
|
||||||
type: 'array',
|
|
||||||
x: 'lon',
|
|
||||||
y: 'lat',
|
|
||||||
})
|
|
||||||
.shape('2d:radar')
|
|
||||||
.size(80 )
|
|
||||||
.active(false)
|
|
||||||
.color('signallevel',(v)=>{
|
|
||||||
return colorObj[v];
|
|
||||||
})
|
|
||||||
.style({
|
|
||||||
shape:'radar'
|
|
||||||
})
|
|
||||||
.render();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -48,15 +48,21 @@
|
||||||
"open": "~0.0.5",
|
"open": "~0.0.5",
|
||||||
"parseurl": "~1.3.2",
|
"parseurl": "~1.3.2",
|
||||||
"pre-commit": "~1.2.2",
|
"pre-commit": "~1.2.2",
|
||||||
|
"rollup-plugin-buble": "^0.19.6",
|
||||||
|
"rollup-plugin-commonjs": "^9.2.1",
|
||||||
|
"rollup-plugin-node-resolve": "^4.0.1",
|
||||||
|
"rollup-plugin-terser": "^4.0.4",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"shelljs": "~0.7.8",
|
"shelljs": "~0.7.8",
|
||||||
"string-replace-loader": "~1.3.0",
|
"string-replace-loader": "~1.3.0",
|
||||||
"torchjs": "~2.1.0",
|
"torchjs": "~2.1.0",
|
||||||
"uglify-js": "~3.1.10",
|
"uglify-js": "~3.1.10",
|
||||||
"webpack": "~3.10.0",
|
"webpack": "~4.29.6",
|
||||||
"worker-loader": "^2.0.0"
|
"worker-loader": "^2.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"build-dev": "rollup -c --environment BUILD:dev && npm run demos-web",
|
||||||
|
"watch-dev": "rollup -c --environment BUILD:dev --watch",
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"build-lib": "babel src --out-dir lib",
|
"build-lib": "babel src --out-dir lib",
|
||||||
"bundler": "electron ./bundler/app.js",
|
"bundler": "electron ./bundler/app.js",
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import sourcemaps from 'rollup-plugin-sourcemaps';
|
// import sourcemaps from 'rollup-plugin-sourcemaps';
|
||||||
import { plugins } from './build/rollup_plugins';
|
import buble from 'rollup-plugin-buble';
|
||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import commonjs from 'rollup-plugin-commonjs';
|
||||||
|
import { createFilter } from 'rollup-pluginutils';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
const { BUILD, MINIFY } = process.env;
|
const { BUILD, MINIFY } = process.env;
|
||||||
const minified = MINIFY === 'true';
|
const minified = MINIFY === 'true';
|
||||||
const production = BUILD === 'production';
|
const production = BUILD === 'production';
|
||||||
const outputFile = !production
|
const outputFile = !production
|
||||||
? 'dist/l7-dev.js'
|
? 'build/L7.js'
|
||||||
: minified
|
: minified
|
||||||
? 'dist/l7.js'
|
? 'build/l7.js'
|
||||||
: 'dist/l7-unminified.js';
|
: 'build/l7-unminified.js';
|
||||||
|
|
||||||
const config = [
|
const config = [
|
||||||
{
|
{
|
||||||
|
@ -22,12 +26,31 @@ const config = [
|
||||||
},
|
},
|
||||||
experimentalCodeSplitting: true,
|
experimentalCodeSplitting: true,
|
||||||
treeshake: production,
|
treeshake: production,
|
||||||
plugins: plugins()
|
plugins: [
|
||||||
|
glsl(
|
||||||
|
[ './src/geom/shader/*.glsl', './src/core/engine/picking/*.glsl' ],
|
||||||
|
production
|
||||||
|
),
|
||||||
|
minified ? terser() : false,
|
||||||
|
buble({
|
||||||
|
transforms: { dangerousForOf: true },
|
||||||
|
objectAssign: 'Object.assign'
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
browser: true,
|
||||||
|
preferBuiltins: false
|
||||||
|
}),
|
||||||
|
commonjs({
|
||||||
|
// global keyword handling causes Webpack compatibility issues, so we disabled it:
|
||||||
|
// https://github.com/mapbox/mapbox-gl-js/pull/6956
|
||||||
|
ignoreGlobal: true
|
||||||
|
})
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
input: 'rollup/mapboxgl.js',
|
input: 'rollup/l7.js',
|
||||||
output: {
|
output: {
|
||||||
name: 'mapboxgl',
|
name: 'L7',
|
||||||
file: outputFile,
|
file: outputFile,
|
||||||
format: 'umd',
|
format: 'umd',
|
||||||
sourcemap: production ? true : 'inline',
|
sourcemap: production ? true : 'inline',
|
||||||
|
@ -47,3 +70,28 @@ const config = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
function glsl(include, minify) {
|
||||||
|
const filter = createFilter(include);
|
||||||
|
return {
|
||||||
|
name: 'glsl',
|
||||||
|
transform(code, id) {
|
||||||
|
if (!filter(id)) return;
|
||||||
|
|
||||||
|
// barebones GLSL minification
|
||||||
|
if (minify) {
|
||||||
|
code = code
|
||||||
|
.trim() // strip whitespace at the start/end
|
||||||
|
.replace(/\s*\/\/[^\n]*\n/g, '\n') // strip double-slash comments
|
||||||
|
.replace(/\n+/g, '\n') // collapse multi line breaks
|
||||||
|
.replace(/\n\s+/g, '\n') // strip identation
|
||||||
|
.replace(/\s?([+-\/*=,])\s?/g, '$1') // strip whitespace around operators
|
||||||
|
.replace(/([;\(\),\{\}])\n(?=[^#])/g, '$1'); // strip more line breaks
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
code: `export default ${JSON.stringify(code)};`,
|
||||||
|
map: { mappings: '' }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
var shared, worker, L7;
|
||||||
|
// define gets called three times: one for each chunk. we rely on the order
|
||||||
|
// they're imported to know which is which
|
||||||
|
function define(_, chunk) {
|
||||||
|
if (!shared) {
|
||||||
|
shared = chunk;
|
||||||
|
} else if (!worker) {
|
||||||
|
worker = chunk;
|
||||||
|
} else {
|
||||||
|
var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'
|
||||||
|
|
||||||
|
var sharedChunk = {};
|
||||||
|
shared(sharedChunk);
|
||||||
|
L7 = chunk(sharedChunk);
|
||||||
|
L7.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import './build/l7/shared';
|
||||||
|
import './build/l7/worker';
|
||||||
|
import './build/l7/index';
|
||||||
|
export default L7;
|
14
src/index.js
14
src/index.js
|
@ -1,17 +1,9 @@
|
||||||
|
|
||||||
// import Util from './util';
|
|
||||||
import Scene from './core/scene';
|
import Scene from './core/scene';
|
||||||
import Global from './global';
|
import Global from './global';
|
||||||
|
|
||||||
const version = Global.version;
|
const version = Global.version;
|
||||||
const track = function(enable) {
|
const exported = {
|
||||||
Global.trackable = enable;
|
|
||||||
};
|
|
||||||
import './track';
|
|
||||||
export {
|
|
||||||
version,
|
version,
|
||||||
Scene,
|
Scene
|
||||||
track
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
export default exported;
|
||||||
|
|
|
@ -42,33 +42,33 @@ export default class PointLayer extends Layer {
|
||||||
|
|
||||||
switch (pointShapeType) {
|
switch (pointShapeType) {
|
||||||
case 'fill' :// 填充图形
|
case 'fill' :// 填充图形
|
||||||
{
|
{
|
||||||
if (fill !== 'none') { // 是否填充
|
if (fill !== 'none') { // 是否填充
|
||||||
const attributes = PointBuffer.FillBuffer(this.layerData, style);
|
const attributes = PointBuffer.FillBuffer(this.layerData, style);
|
||||||
const meshfill = drawPoint.DrawFill(attributes, this.get('styleOptions'));
|
const meshfill = drawPoint.DrawFill(attributes, this.get('styleOptions'));
|
||||||
this.add(meshfill);
|
this.add(meshfill);
|
||||||
|
}
|
||||||
|
if (stroke !== 'none') { // 是否绘制边界
|
||||||
|
const lineAttribute = PointBuffer.StrokeBuffer(this.layerData, style);
|
||||||
|
const meshStroke = drawPoint.DrawStroke(lineAttribute, this.get('styleOptions'));
|
||||||
|
this.add(meshStroke, 'line');
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (stroke !== 'none') { // 是否绘制边界
|
|
||||||
const lineAttribute = PointBuffer.StrokeBuffer(this.layerData, style);
|
|
||||||
const meshStroke = drawPoint.DrawStroke(lineAttribute, this.get('styleOptions'));
|
|
||||||
this.add(meshStroke, 'line');
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'image':// 绘制图片标注
|
case 'image':// 绘制图片标注
|
||||||
{
|
{
|
||||||
const imageAttribute = PointBuffer.ImageBuffer(this.layerData, { imagePos: this.scene.image.imagePos });
|
const imageAttribute = PointBuffer.ImageBuffer(this.layerData, { imagePos: this.scene.image.imagePos });
|
||||||
const imageMesh = drawPoint.DrawImage(imageAttribute, { ...style, texture: this.scene.image.texture });
|
const imageMesh = drawPoint.DrawImage(imageAttribute, { ...style, texture: this.scene.image.texture });
|
||||||
this.add(imageMesh);
|
this.add(imageMesh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'normal' : // 原生点
|
case 'normal' : // 原生点
|
||||||
{
|
{
|
||||||
const normalAttribute = PointBuffer.NormalBuffer(this.layerData, style);
|
const normalAttribute = PointBuffer.NormalBuffer(this.layerData, style);
|
||||||
const normalPointMesh = drawPoint.DrawNormal(normalAttribute, style);
|
const normalPointMesh = drawPoint.DrawNormal(normalAttribute, style);
|
||||||
this.add(normalPointMesh);
|
this.add(normalPointMesh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ export default function DrawAnimate(attributes, style) {
|
||||||
ANIMATE: true
|
ANIMATE: true
|
||||||
});
|
});
|
||||||
const fillPolygonMesh = new THREE.Mesh(geometry, material);
|
const fillPolygonMesh = new THREE.Mesh(geometry, material);
|
||||||
this.fillPolygonMesh = fillPolygonMesh;
|
|
||||||
return fillPolygonMesh;
|
return fillPolygonMesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,4 @@
|
||||||
import Source from '../core//source';
|
import Source from '../core//source';
|
||||||
this.addEventListener('message', e => {
|
const a = 'webWorker Test';
|
||||||
const res = e.data;
|
export default Source;
|
||||||
// res = {
|
|
||||||
// command : 'POLYGON-EXTRUDE',
|
|
||||||
// data : {data:geojson,options:{}}
|
|
||||||
// }
|
|
||||||
let result;
|
|
||||||
switch (res.command) {
|
|
||||||
case 'geojson':
|
|
||||||
result = res;
|
|
||||||
self.postMessage(result);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
self.postMessage(result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.addEventListener('error', function(e) {
|
|
||||||
console.error(
|
|
||||||
'filename:' + e.filename + '\nmessage:' + e.message + '\nline:' + e.lineno
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue