poly-extrude 0.0.1 → 0.0.4
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/dist/poly-extrude.js +97 -81
- package/dist/poly-extrude.js.map +1 -1
- package/dist/poly-extrude.min.js +2 -2
- package/dist/poly-extrude.mjs +97 -81
- package/package.json +7 -2
- package/src/polygon.js +12 -12
- package/src/polyline.js +21 -8
- package/src/util.js +27 -40
- package/.eslintignore +0 -12
- package/.eslintrc.js +0 -34
- package/.vscode/settings.json +0 -3
- package/babel.config.js +0 -12
- package/pnpm-lock.yaml +0 -3054
- package/rollup.config.js +0 -108
- package/test/buildings.html +0 -77
- package/test/data/a.png +0 -0
- package/test/data/building-texture-dark.jpg +0 -0
- package/test/data/building.geojson +0 -1118
- package/test/data/buildings-ny.geojson +0 -2845
- package/test/data/buildings.geojson +0 -1
- package/test/data/free-line.geojson +0 -1
- package/test/data/line.geojson +0 -1
- package/test/data/polygon.geojson +0 -1
- package/test/data/simple-hole.geojson +0 -1
- package/test/data/simple-line.geojson +0 -45
- package/test/data/simple.geojson +0 -1
- package/test/data/street.geojson +0 -1
- package/test/data//345/244/252/346/271/226.geojson +0 -8
- package/test/data//350/210/237/345/261/261/345/270/202.geojson +0 -1
- package/test/data//350/213/217/345/267/236.geojson +0 -1
- package/test/data//351/204/261/351/230/263/346/271/226.geojson +0 -1
- package/test/line-draw.html +0 -100
- package/test/line-uv.html +0 -69
- package/test/line.html +0 -56
- package/test/multi-polygon.html +0 -53
- package/test/ny-building.html +0 -67
- package/test/simple.html +0 -61
- package/test/street.html +0 -52
- package/test/util.js +0 -131
- package/test/uv.html +0 -77
package/rollup.config.js
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
// Rollup plugins
|
2
|
-
|
3
|
-
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
4
|
-
import { babel } from '@rollup/plugin-babel';
|
5
|
-
import commonjs from '@rollup/plugin-commonjs';
|
6
|
-
import json from '@rollup/plugin-json';
|
7
|
-
import { terser } from 'rollup-plugin-terser';
|
8
|
-
// import swc from 'rollup-plugin-swc';
|
9
|
-
import pkg from './package.json';
|
10
|
-
const path = require('path');
|
11
|
-
|
12
|
-
const product = process.env.NODE_ENV.trim() === 'prd';
|
13
|
-
const FILEMANE = pkg.name;
|
14
|
-
const sourceMap = !product;
|
15
|
-
|
16
|
-
const banner = `/*!\n * ${pkg.name} v${pkg.version}\n */`;
|
17
|
-
let outro = pkg.name + ' v' + pkg.version;
|
18
|
-
outro = `typeof console !== 'undefined' && console.log('${outro}');`;
|
19
|
-
const plugins = [
|
20
|
-
json(),
|
21
|
-
nodeResolve(),
|
22
|
-
commonjs(),
|
23
|
-
// swc({
|
24
|
-
// // rollup: {
|
25
|
-
// // exclude: 'path/to/exclude/',
|
26
|
-
// // },
|
27
|
-
// jsc: {
|
28
|
-
// parser: {
|
29
|
-
// syntax: 'ecmascript'
|
30
|
-
// },
|
31
|
-
// target: 'es5'
|
32
|
-
// },
|
33
|
-
// 'sourceMaps': true
|
34
|
-
// })
|
35
|
-
babel({
|
36
|
-
babelHelpers: 'bundled'
|
37
|
-
// exclude: ['node_modules/**']
|
38
|
-
})
|
39
|
-
];
|
40
|
-
const external = [];
|
41
|
-
const globals = {
|
42
|
-
|
43
|
-
};
|
44
|
-
const name = 'polyextrude';
|
45
|
-
export default [
|
46
|
-
{
|
47
|
-
input: path.join(__dirname, './index.js'),
|
48
|
-
plugins: plugins,
|
49
|
-
// sourceMap: true,
|
50
|
-
external,
|
51
|
-
output:
|
52
|
-
{
|
53
|
-
'format': 'umd',
|
54
|
-
'name': name,
|
55
|
-
'file': `dist/${FILEMANE}.js`,
|
56
|
-
'sourcemap': sourceMap,
|
57
|
-
'extend': true,
|
58
|
-
'banner': banner,
|
59
|
-
'outro': outro,
|
60
|
-
'globals': globals
|
61
|
-
}
|
62
|
-
},
|
63
|
-
{
|
64
|
-
input: path.join(__dirname, './index.js'),
|
65
|
-
plugins: plugins.concat([terser()]),
|
66
|
-
// sourceMap: true,
|
67
|
-
external,
|
68
|
-
output:
|
69
|
-
{
|
70
|
-
'format': 'umd',
|
71
|
-
'name': name,
|
72
|
-
'file': `dist/${FILEMANE}.min.js`,
|
73
|
-
'sourcemap': false,
|
74
|
-
'extend': true,
|
75
|
-
'banner': banner,
|
76
|
-
'outro': outro,
|
77
|
-
'globals': globals
|
78
|
-
}
|
79
|
-
},
|
80
|
-
{
|
81
|
-
input: path.join(__dirname, './index.js'),
|
82
|
-
plugins: plugins,
|
83
|
-
// sourceMap: true,
|
84
|
-
external,
|
85
|
-
output:
|
86
|
-
{
|
87
|
-
'format': 'es',
|
88
|
-
'name': name,
|
89
|
-
'file': `dist/${FILEMANE}.mjs`,
|
90
|
-
'sourcemap': false,
|
91
|
-
'extend': true,
|
92
|
-
'banner': banner,
|
93
|
-
'outro': outro,
|
94
|
-
'globals': globals
|
95
|
-
}
|
96
|
-
}
|
97
|
-
// {
|
98
|
-
// 'sourcemap': false,
|
99
|
-
// 'format': 'es',
|
100
|
-
// // banner,
|
101
|
-
// 'file': `dist/${FILEMANE}.es.js`,
|
102
|
-
// 'extend': true,
|
103
|
-
// 'banner': banner,
|
104
|
-
// 'globals': {
|
105
|
-
// 'YY': 'YY'
|
106
|
-
// }
|
107
|
-
// }
|
108
|
-
];
|
package/test/buildings.html
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<meta charset="UTF-8">
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
-
<meta name=renderer content=webkit>
|
6
|
-
<script type="text/javascript" src="https://unpkg.com/@maptalks/geojson-bbox@1.0.4/dist/bbox.umd.js"></script>
|
7
|
-
<script type="text/javascript" src="https://unpkg.com/three@0.138.0/build/three.min.js"></script>
|
8
|
-
<script type="text/javascript" src="https://unpkg.com/three@0.142.0/examples/js/controls/OrbitControls.js"></script>
|
9
|
-
<script type="text/javascript" src="./../dist/poly-extrude.js"></script>
|
10
|
-
<script type="text/javascript" src="./util.js"></script>
|
11
|
-
|
12
|
-
<style type="text/css">
|
13
|
-
html,
|
14
|
-
body {
|
15
|
-
margin: 0px;
|
16
|
-
height: 100%;
|
17
|
-
width: 100%;
|
18
|
-
}
|
19
|
-
|
20
|
-
.container {
|
21
|
-
width: 100%;
|
22
|
-
height: 100%;
|
23
|
-
}
|
24
|
-
</style>
|
25
|
-
|
26
|
-
<body>
|
27
|
-
<script>
|
28
|
-
|
29
|
-
|
30
|
-
const scene = createScene();
|
31
|
-
|
32
|
-
function getTexture() {
|
33
|
-
const texture = new THREE.TextureLoader().load('./data/a.png');
|
34
|
-
texture.needsUpdate = true; //使用贴图时进行更新
|
35
|
-
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
|
36
|
-
// texture.repeat.set(0.002, 0.002);
|
37
|
-
texture.repeat.set(1, 2);
|
38
|
-
return texture;
|
39
|
-
}
|
40
|
-
|
41
|
-
const material = new THREE.MeshBasicMaterial({
|
42
|
-
color: '#FFF',
|
43
|
-
wireframe: false,
|
44
|
-
vertexColors: false,
|
45
|
-
map: getTexture()
|
46
|
-
})
|
47
|
-
|
48
|
-
|
49
|
-
function test() {
|
50
|
-
getGeoJSON('./data/buildings.geojson').then(geojson => {
|
51
|
-
flatCoordinates(geojson);
|
52
|
-
geojson.features.forEach(feature => {
|
53
|
-
const { type, coordinates } = feature.geometry;
|
54
|
-
// const time1 = 'time1';
|
55
|
-
// console.time(time1);
|
56
|
-
// const result1 = geometryExtrude.extrudePolygon(type === 'Polygon' ? [coordinates] : coordinates, { depth: 4 });
|
57
|
-
// console.timeEnd(time1);
|
58
|
-
const time = 'time';
|
59
|
-
console.time(time);
|
60
|
-
const result = polyextrude.extrudePolygons(type === 'Polygon' ? [coordinates] : coordinates, { depth: feature.properties.height / 5 });
|
61
|
-
|
62
|
-
console.timeEnd(time);
|
63
|
-
console.log(result);
|
64
|
-
const geometry = createBufferGeometry(result);
|
65
|
-
const mesh = new THREE.Mesh(geometry, material);
|
66
|
-
scene.add(mesh);
|
67
|
-
});
|
68
|
-
})
|
69
|
-
}
|
70
|
-
test();
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
</script>
|
75
|
-
</body>
|
76
|
-
|
77
|
-
</html>
|
package/test/data/a.png
DELETED
Binary file
|
Binary file
|