poly-extrude 0.0.1 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/dist/poly-extrude.js +97 -81
  2. package/dist/poly-extrude.js.map +1 -1
  3. package/dist/poly-extrude.min.js +2 -2
  4. package/dist/poly-extrude.mjs +97 -81
  5. package/package.json +7 -2
  6. package/src/polygon.js +12 -12
  7. package/src/polyline.js +21 -8
  8. package/src/util.js +27 -40
  9. package/.eslintignore +0 -12
  10. package/.eslintrc.js +0 -34
  11. package/.vscode/settings.json +0 -3
  12. package/babel.config.js +0 -12
  13. package/pnpm-lock.yaml +0 -3054
  14. package/rollup.config.js +0 -108
  15. package/test/buildings.html +0 -77
  16. package/test/data/a.png +0 -0
  17. package/test/data/building-texture-dark.jpg +0 -0
  18. package/test/data/building.geojson +0 -1118
  19. package/test/data/buildings-ny.geojson +0 -2845
  20. package/test/data/buildings.geojson +0 -1
  21. package/test/data/free-line.geojson +0 -1
  22. package/test/data/line.geojson +0 -1
  23. package/test/data/polygon.geojson +0 -1
  24. package/test/data/simple-hole.geojson +0 -1
  25. package/test/data/simple-line.geojson +0 -45
  26. package/test/data/simple.geojson +0 -1
  27. package/test/data/street.geojson +0 -1
  28. package/test/data//345/244/252/346/271/226.geojson +0 -8
  29. package/test/data//350/210/237/345/261/261/345/270/202.geojson +0 -1
  30. package/test/data//350/213/217/345/267/236.geojson +0 -1
  31. package/test/data//351/204/261/351/230/263/346/271/226.geojson +0 -1
  32. package/test/line-draw.html +0 -100
  33. package/test/line-uv.html +0 -69
  34. package/test/line.html +0 -56
  35. package/test/multi-polygon.html +0 -53
  36. package/test/ny-building.html +0 -67
  37. package/test/simple.html +0 -61
  38. package/test/street.html +0 -52
  39. package/test/util.js +0 -131
  40. 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
- ];
@@ -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