diff --git a/.torch.compile.opts.js b/.torch.compile.opts.js index 08210f1a7c..b65d4cd02f 100755 --- a/.torch.compile.opts.js +++ b/.torch.compile.opts.js @@ -10,8 +10,9 @@ module.exports = { include: [ 'src/**/*.js', 'test/**/*.js', - 'node_modules/three/' + 'node_modules/three/**/*.js' ], - exclude: [], + exclude: [ + 'node_modules/@babel/**/*.js' + ] } - \ No newline at end of file diff --git a/demos/01_point_image.html b/demos/01_point_image.html index 278dc9f59d..217d26819e 100644 --- a/demos/01_point_image.html +++ b/demos/01_point_image.html @@ -26,8 +26,8 @@ const scene = new L7.Scene({ mapStyle: 'light', // 样式URL center: [ 120.1243238, 30.27331571 ], pitch: 0, - zoom: 19, - minZoom: 16 + zoom: 10, + minZoom: 9 }); window.scene = scene; scene.image.addImage('bike', './image/Bike.png'); @@ -44,11 +44,18 @@ scene.on('load', () => { .size(128.0) .shape('image:bike') .color('#0198BD') - .style({ - stroke: 'rgb(255,255,255)', - strokeWidth: 0, - opacity: 1.0 + .render(); + }); + $.get('./data/fence.json', data => { + scene.PolygonLayer({ + zIndex: 3 }) + .source(data) + .shape('fill') + .color('#0198BD') + .style({ + opacity:0.8 + }) .render(); }); }); diff --git a/src/core/source.js b/src/core/source.js index 9571663e7e..3a61aead88 100644 --- a/src/core/source.js +++ b/src/core/source.js @@ -2,9 +2,9 @@ * @Author: ThinkGIS * @Date: 2018-06-08 11:19:06 * @Last Modified by: mikey.zhaopeng - * @Last Modified time: 2018-10-30 11:13:39 + * @Last Modified time: 2018-11-01 11:50:43 */ -const Base = require('./base'); +import Base from './base'; const Controller = require('./controller/index'); import { aProjectFlat } from '../geo/project'; export default class Source extends Base { diff --git a/src/core/three.js b/src/core/three.js index abf7ee4136..88c338bff3 100644 --- a/src/core/three.js +++ b/src/core/three.js @@ -1,41 +1,43 @@ -import 'three/src/polyfills.js'; -export * from 'three/src/constants.js'; -export { Scene } from 'three/src/scenes/Scene.js'; -export { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js'; -export { CanvasTexture } from 'three/src/textures/CanvasTexture.js'; -export { Object3D } from 'three/src/core/Object3D.js'; -export { Points } from 'three/src/objects/Points.js'; -export { LineSegments } from 'three/src/objects/LineSegments.js'; -export { Mesh } from 'three/src/objects/Mesh.js'; -export { Texture } from 'three/src/textures/Texture.js'; -export { DirectionalLight } from 'three/src/lights/DirectionalLight.js'; -export { AmbientLight } from 'three/src/lights/AmbientLight.js'; -export { WebGLRenderTarget } from 'three/src/renderers/WebGLRenderTarget.js'; -export { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera.js'; -export { BufferGeometry } from 'three/src/core/BufferGeometry.js'; -export { Raycaster } from 'three/src/core/Raycaster.js'; -export { Matrix4 } from 'three/src/math/Matrix4.js'; -export { Matrix3 } from 'three/src/math/Matrix3.js'; -export { Line } from 'three/src/objects/Line.js'; -export { LineLoop } from 'three/src/objects/LineLoop.js'; -export { Vector4 } from 'three/src/math/Vector4.js'; -export { Vector3 } from 'three/src/math/Vector3.js'; -export { Vector2 } from 'three/src/math/Vector2.js'; -export { TextureLoader } from 'three/src/loaders/TextureLoader.js'; -export { LineDashedMaterial } from 'three/src/materials/LineDashedMaterial.js'; -export { ShaderMaterial } from 'three/src/materials/ShaderMaterial.js'; -export { PointsMaterial } from 'three/src/materials/PointsMaterial.js'; -export { VideoTexture } from 'three/src/textures/VideoTexture.js'; -export { DataTexture } from 'three/src/textures/DataTexture.js'; -export { - Float64BufferAttribute, - Float32BufferAttribute, - Uint32BufferAttribute, - Int32BufferAttribute, - Uint16BufferAttribute, - Int16BufferAttribute, - Uint8ClampedBufferAttribute, - Uint8BufferAttribute, - Int8BufferAttribute, - BufferAttribute -} from 'three/src/core/BufferAttribute.js'; +// import 'three/src/polyfills.js'; +// export * from 'three/src/constants.js'; +// export { Scene } from 'three/src/scenes/Scene.js'; +// export { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js'; +// export { CanvasTexture } from 'three/src/textures/CanvasTexture.js'; +// export { Object3D } from 'three/src/core/Object3D.js'; +// export { Points } from 'three/src/objects/Points.js'; +// export { LineSegments } from 'three/src/objects/LineSegments.js'; +// export { Mesh } from 'three/src/objects/Mesh.js'; +// export { Texture } from 'three/src/textures/Texture.js'; +// export { DirectionalLight } from 'three/src/lights/DirectionalLight.js'; +// export { AmbientLight } from 'three/src/lights/AmbientLight.js'; +// export { WebGLRenderTarget } from 'three/src/renderers/WebGLRenderTarget.js'; +// export { PerspectiveCamera } from 'three/src/cameras/PerspectiveCamera.js'; +// export { BufferGeometry } from 'three/src/core/BufferGeometry.js'; +// export { Raycaster } from 'three/src/core/Raycaster.js'; +// export { Matrix4 } from 'three/src/math/Matrix4.js'; +// export { Matrix3 } from 'three/src/math/Matrix3.js'; +// export { Line } from 'three/src/objects/Line.js'; +// export { LineLoop } from 'three/src/objects/LineLoop.js'; +// export { Vector4 } from 'three/src/math/Vector4.js'; +// export { Vector3 } from 'three/src/math/Vector3.js'; +// export { Vector2 } from 'three/src/math/Vector2.js'; +// export { TextureLoader } from 'three/src/loaders/TextureLoader.js'; +// export { LineDashedMaterial } from 'three/src/materials/LineDashedMaterial.js'; +// export { ShaderMaterial } from 'three/src/materials/ShaderMaterial.js'; +// export { PointsMaterial } from 'three/src/materials/PointsMaterial.js'; +// export { VideoTexture } from 'three/src/textures/VideoTexture.js'; +// export { DataTexture } from 'three/src/textures/DataTexture.js'; +// export { +// Float64BufferAttribute, +// Float32BufferAttribute, +// Uint32BufferAttribute, +// Int32BufferAttribute, +// Uint16BufferAttribute, +// Int16BufferAttribute, +// Uint8ClampedBufferAttribute, +// Uint8BufferAttribute, +// Int8BufferAttribute, +// BufferAttribute +// } from 'three/src/core/BufferAttribute.js'; + +export * from '../../build/Three.js'; \ No newline at end of file diff --git a/src/layer/polygonLayer.js b/src/layer/polygonLayer.js index 4dea4fcfcf..ff7428f204 100644 --- a/src/layer/polygonLayer.js +++ b/src/layer/polygonLayer.js @@ -10,11 +10,12 @@ export default class PolygonLayer extends Layer { } render() { this.type = 'polygon'; + const { opacity} = this.get('styleOptions'); this.init(); const source = this.layerSource; const geometry = this.geometry = new THREE.BufferGeometry(); const lineMaterial = new LineMaterial({ - u_opacity: 1.0 + u_opacity: opacity } ); const buffer = this.buffer = new PolygonBuffer({ @@ -34,8 +35,9 @@ export default class PolygonLayer extends Layer { if (this.shape === 'line') { polygonMesh = new THREE.LineSegments(geometry, lineMaterial); } else { + const material = new PolygonMaterial({ - u_opacity: 1.0 + u_opacity: opacity }); geometry.addAttribute('normal', new THREE.Float32BufferAttribute(attributes.normals, 3)); // geometry.addAttribute('faceUv', new THREE.Float32BufferAttribute(attributes.faceUv, 2)); diff --git a/test/unit/core/image-spec.js b/test/unit/core/image-spec.js index 370384b299..dbed09c88c 100644 --- a/test/unit/core/image-spec.js +++ b/test/unit/core/image-spec.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { LoadImage } from '../../../src/core/image'; +import LoadImage from '../../../src/core/image'; describe('core LoadImage Test', function() { it('test create', function() { diff --git a/webpack.config.js b/webpack.config.js index f1f8844dcf..f5d9835416 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -24,12 +24,12 @@ module.exports = { } } }, - // { - // test: /\.glsl$/, - // use: { - // loader: 'glsl-shaders-loader' - // } - // }, + { + test: /\.glsl$/, + use: { + loader: 'glsl-shaders-loader' + } + }, { test: /global\.js$/, use: {