@ohuoy/easymap 1.0.19 → 1.0.21
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/bundle.js +318 -290
- package/dist/example - /345/211/257/346/234/254/bundle.js" +318 -290
- package/dist/example - /345/211/257/346/234/254/index.html" +11 -11
- package/index.js +4 -0
- package/lib/threebox-plugin/CHANGELOG.md +665 -0
- package/lib/threebox-plugin/LICENSE.txt +97 -0
- package/lib/threebox-plugin/README.md +199 -0
- package/lib/threebox-plugin/exports.js +2 -0
- package/lib/threebox-plugin/main.js +8 -0
- package/lib/threebox-plugin/package.json +44 -0
- package/lib/threebox-plugin/server.stop.js +13 -0
- package/lib/threebox-plugin/src/Threebox.js +1216 -0
- package/lib/threebox-plugin/src/animation/AnimationManager.js +483 -0
- package/lib/threebox-plugin/src/camera/CameraSync.js +302 -0
- package/lib/threebox-plugin/src/objects/CSS2DRenderer.js +245 -0
- package/lib/threebox-plugin/src/objects/LabelRenderer.js +71 -0
- package/lib/threebox-plugin/src/objects/Object3D.js +34 -0
- package/lib/threebox-plugin/src/objects/effects/BuildingShadows.js +115 -0
- package/lib/threebox-plugin/src/objects/extrusion.js +61 -0
- package/lib/threebox-plugin/src/objects/fflate.min.js +15 -0
- package/lib/threebox-plugin/src/objects/label.js +29 -0
- package/lib/threebox-plugin/src/objects/line.js +1386 -0
- package/lib/threebox-plugin/src/objects/loadObj.js +142 -0
- package/lib/threebox-plugin/src/objects/loaders/ColladaLoader.js +3751 -0
- package/lib/threebox-plugin/src/objects/loaders/FBXLoader.js +3864 -0
- package/lib/threebox-plugin/src/objects/loaders/GLTFLoader.js +3857 -0
- package/lib/threebox-plugin/src/objects/loaders/MTLLoader.js +498 -0
- package/lib/threebox-plugin/src/objects/loaders/OBJLoader.js +818 -0
- package/lib/threebox-plugin/src/objects/objects.js +1113 -0
- package/lib/threebox-plugin/src/objects/sphere.js +28 -0
- package/lib/threebox-plugin/src/objects/tooltip.js +27 -0
- package/lib/threebox-plugin/src/objects/tube.js +35 -0
- package/lib/threebox-plugin/src/three.js +6 -0
- package/lib/threebox-plugin/src/three.module.js +54571 -0
- package/lib/threebox-plugin/src/utils/ValueGenerator.js +11 -0
- package/lib/threebox-plugin/src/utils/constants.js +21 -0
- package/lib/threebox-plugin/src/utils/material.js +52 -0
- package/lib/threebox-plugin/src/utils/suncalc.js +322 -0
- package/lib/threebox-plugin/src/utils/utils.js +424 -0
- package/lib/threebox-plugin/src/utils/validate.js +115 -0
- package/package.json +18 -18
- package/src/components/EasyMapMarker.js +8 -0
- package/src/components/control/DrawBar.js +5 -0
- package/src/components/control/TilesBar.js +116 -27
- package/src/components/control/Toobars.js +20 -1
- package/src/components/layer/AlarmLayer.js +4 -1
- package/src/components/layer/AnimationBarbsLayer.js +1 -1
- package/src/components/layer/AnimationLayer copy.js +1 -1
- package/src/components/layer/AnimationLayer.js +11 -3
- package/src/components/layer/CustomIconLayer.js +1 -1
- package/src/components/layer/ExtrusionLayer.js +1 -1
- package/src/components/layer/ExtrusionLayerold.js +2 -1
- package/src/components/layer/MarkerAreaLayer.js +1 -1
- package/src/components/layer/PathLineLayer.js +1 -1
- package/src/components/layer/ThreeScanLayer.js +51 -14
- package/src/components/layer/ThreeWallLayer.js +1 -1
- package/webpack.config.js +2 -1
|
@@ -4,8 +4,57 @@ export default class TilesBar {
|
|
|
4
4
|
config = {
|
|
5
5
|
btnClass:''
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
openBtn=['standard','satellite','tiandi','gaode','arcgis']
|
|
8
|
+
constructor(openBtn){
|
|
9
|
+
this.openBtn = ['standard','satellite','tiandi']
|
|
10
|
+
}
|
|
8
11
|
|
|
12
|
+
getBtnList(){
|
|
13
|
+
let htmlStr = ''
|
|
14
|
+
for(let b of this.openBtn){
|
|
15
|
+
if(b == 'standard'){
|
|
16
|
+
htmlStr+=`<div class="mapboxgl-btn-standard" style='width:100%;display:flex;'>
|
|
17
|
+
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
18
|
+
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"/>%3C/svg>'/>
|
|
19
|
+
</span>
|
|
20
|
+
<button style='width:100%'>标准</button>
|
|
21
|
+
</div>
|
|
22
|
+
`
|
|
23
|
+
}
|
|
24
|
+
if(b == 'satellite'){
|
|
25
|
+
htmlStr+=` <div class="mapboxgl-btn-satellite" style='width:100%;display:flex;'>
|
|
26
|
+
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
27
|
+
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M5,3C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M15.78,5H19V17.18C18.74,16.38 17.69,15.79 16.8,15.79H15.8V12.79A1,1 0 0,0 14.8,11.79H8.8V9.79H10.8A1,1 0 0,0 11.8,8.79V6.79H13.8C14.83,6.79 15.67,6 15.78,5M5,10.29L9.8,14.79V15.79C9.8,16.9 10.7,17.79 11.8,17.79V19H5V10.29Z"/>%3C/svg>'/>
|
|
28
|
+
</span>
|
|
29
|
+
<button style='width:100%'>卫星图</button>
|
|
30
|
+
</div>`
|
|
31
|
+
}
|
|
32
|
+
if(b == 'tiandi'){
|
|
33
|
+
htmlStr+=` <div class="mapboxgl-btn-tiandi" style='width:100%;display:flex;'>
|
|
34
|
+
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
35
|
+
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M9,7V9H11V17H13V9H15V7H9M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3Z"/>%3C/svg>'/>
|
|
36
|
+
</span>
|
|
37
|
+
<button style='width:100%'>天地图</button>
|
|
38
|
+
</div>`
|
|
39
|
+
}
|
|
40
|
+
if(b == 'gaode'){
|
|
41
|
+
htmlStr+=` <div class="mapboxgl-btn-gaode" style='width:100%;display:flex;'>
|
|
42
|
+
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
43
|
+
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M9,7V9H11V17H13V9H15V7H9M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3Z"/>%3C/svg>'/>
|
|
44
|
+
</span>
|
|
45
|
+
<button style='width:100%'>高德地图</button>
|
|
46
|
+
</div>`
|
|
47
|
+
}
|
|
48
|
+
if(b == 'arcgis'){
|
|
49
|
+
htmlStr+=` <div class="mapboxgl-btn-arcgis" style='width:100%;display:flex;'>
|
|
50
|
+
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
51
|
+
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M9,7V9H11V17H13V9H15V7H9M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3Z"/>%3C/svg>'/>
|
|
52
|
+
</span>
|
|
53
|
+
<button style='width:100%'>ArcGis</button>
|
|
54
|
+
</div>`
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return htmlStr
|
|
9
58
|
}
|
|
10
59
|
|
|
11
60
|
onAdd(map) {
|
|
@@ -22,41 +71,36 @@ export default class TilesBar {
|
|
|
22
71
|
|
|
23
72
|
</button>
|
|
24
73
|
<div class="mapboxgl-legend-list" style='position:absolute;width:80px;background:#fff;margin:0 28px;top:0px;color:#000;display:none;'>
|
|
25
|
-
|
|
26
|
-
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
27
|
-
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"/>%3C/svg>'/>
|
|
28
|
-
</span>
|
|
29
|
-
<button style='width:100%'>标准</button>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="mapboxgl-btn-satellite" style='width:100%;display:flex;'>
|
|
32
|
-
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
33
|
-
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M5,3C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H5M15.78,5H19V17.18C18.74,16.38 17.69,15.79 16.8,15.79H15.8V12.79A1,1 0 0,0 14.8,11.79H8.8V9.79H10.8A1,1 0 0,0 11.8,8.79V6.79H13.8C14.83,6.79 15.67,6 15.78,5M5,10.29L9.8,14.79V15.79C9.8,16.9 10.7,17.79 11.8,17.79V19H5V10.29Z"/>%3C/svg>'/>
|
|
34
|
-
</span>
|
|
35
|
-
<button style='width:100%'>卫星图</button>
|
|
36
|
-
</div>
|
|
37
|
-
<div class="mapboxgl-btn-tiandi" style='width:100%;display:flex;'>
|
|
38
|
-
<span style='display:flex;align-item:center;' class="mapboxgl-ctrl-icon" aria-hidden="true" title="图层">
|
|
39
|
-
<img style='margin:auto;' src='data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">%3Cpath d="M9,7V9H11V17H13V9H15V7H9M5,3H19A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3Z"/>%3C/svg>'/>
|
|
40
|
-
</span>
|
|
41
|
-
<button style='width:100%'>天地图</button>
|
|
42
|
-
</div>
|
|
74
|
+
${this.getBtnList()}
|
|
43
75
|
</div>
|
|
44
76
|
</div>
|
|
45
77
|
`;
|
|
46
78
|
let btnStandard = this._container.getElementsByClassName('mapboxgl-btn-standard')[0]
|
|
47
79
|
let btnSatellite = this._container.getElementsByClassName('mapboxgl-btn-satellite')[0]
|
|
48
80
|
let btnTiandi = this._container.getElementsByClassName('mapboxgl-btn-tiandi')[0]
|
|
81
|
+
let btnGaode = this._container.getElementsByClassName('mapboxgl-btn-gaode')[0]
|
|
82
|
+
let btnArcgis = this._container.getElementsByClassName('mapboxgl-btn-arcgis')[0]
|
|
49
83
|
let box = this._container.getElementsByClassName('mapboxgl-legend-list')[0]
|
|
50
84
|
let btn = this._container.getElementsByClassName('tileschange')[0]
|
|
51
85
|
btn.addEventListener('mouseenter',()=>{
|
|
52
|
-
box.style.display = 'block'
|
|
86
|
+
box.style.display = 'block'
|
|
87
|
+
let pos = box.getBoundingClientRect()
|
|
88
|
+
if(pos.x > document.body.clientWidth/2){
|
|
89
|
+
box.style.right = 0
|
|
90
|
+
box.style.left = ''
|
|
91
|
+
}else{
|
|
92
|
+
box.style.right = ''
|
|
93
|
+
box.style.left = 0
|
|
94
|
+
}
|
|
53
95
|
})
|
|
54
96
|
this._container.addEventListener('mouseleave',()=>{
|
|
55
97
|
box.style.display = 'none'
|
|
56
98
|
})
|
|
57
|
-
this.addEvent(btnStandard,'standard')
|
|
58
|
-
this.addEvent(btnSatellite,'satellite')
|
|
59
|
-
this.addEvent(btnTiandi,'tiandi')
|
|
99
|
+
btnStandard ? this.addEvent(btnStandard,'standard'): ''
|
|
100
|
+
btnSatellite ? this.addEvent(btnSatellite,'satellite'):''
|
|
101
|
+
btnTiandi?this.addEvent(btnTiandi,'tiandi'):''
|
|
102
|
+
btnGaode?this.addEvent(btnGaode,'gaode'):''
|
|
103
|
+
btnArcgis? this.addEvent(btnArcgis,'arcgis'):''
|
|
60
104
|
return this._container;
|
|
61
105
|
}
|
|
62
106
|
|
|
@@ -66,29 +110,74 @@ export default class TilesBar {
|
|
|
66
110
|
let beforeId = this._map.style.stylesheet.layers[currentFillLayerIndex].id
|
|
67
111
|
if(key == 'standard'){
|
|
68
112
|
if (this._map.getLayer('yingxiang')) this._map.removeLayer('yingxiang');
|
|
69
|
-
if (this._map.getLayer('tiandi')) this._map.removeLayer('tiandi');
|
|
113
|
+
if (this._map.getLayer('tiandi')) this._map.removeLayer('tiandi');
|
|
114
|
+
if (this._map.getLayer('gode')) this._map.removeLayer('gode');
|
|
115
|
+
if (this._map.getLayer('arcgis')) this._map.removeLayer('arcgis');
|
|
116
|
+
if (this._map.getLayer('zhuji')) this._map.removeLayer('zhuji');
|
|
70
117
|
}
|
|
71
118
|
if(key == 'satellite'){
|
|
72
119
|
if (this._map.getLayer('tiandi')) this._map.removeLayer('tiandi');
|
|
120
|
+
if (this._map.getLayer('zhuji')) this._map.removeLayer('zhuji');
|
|
121
|
+
if (this._map.getLayer('gode')) this._map.removeLayer('gode');
|
|
122
|
+
if (this._map.getLayer('arcgis')) this._map.removeLayer('arcgis');
|
|
73
123
|
if (!this._map.getLayer('yingxiang')){
|
|
74
124
|
this._map.addLayer({
|
|
75
125
|
"id": "yingxiang",
|
|
76
126
|
"source": "yingxiang",
|
|
77
127
|
"type": "raster"
|
|
78
|
-
}
|
|
128
|
+
})
|
|
79
129
|
};
|
|
80
130
|
}
|
|
81
131
|
if(key == 'tiandi'){
|
|
82
132
|
if (this._map.getLayer('yingxiang')) this._map.removeLayer('yingxiang');
|
|
133
|
+
if (this._map.getLayer('gode')) this._map.removeLayer('gode');
|
|
134
|
+
if (this._map.getLayer('arcgis')) this._map.removeLayer('arcgis');
|
|
83
135
|
if (!this._map.getLayer('tiandi')){
|
|
84
136
|
this._map.addLayer({
|
|
85
137
|
"id": "tiandi",
|
|
86
138
|
"source": "tianditu",
|
|
87
139
|
"type": "raster"
|
|
88
|
-
}
|
|
140
|
+
})
|
|
141
|
+
};
|
|
142
|
+
if (!this._map.getLayer('zhuji')){
|
|
143
|
+
this._map.addLayer({
|
|
144
|
+
"id": "zhuji",
|
|
145
|
+
"source": "zhuji",
|
|
146
|
+
"type": "raster"
|
|
147
|
+
})
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if(key == 'gaode'){
|
|
151
|
+
if (this._map.getLayer('yingxiang')) this._map.removeLayer('yingxiang');
|
|
152
|
+
if (this._map.getLayer('tiandi')) this._map.removeLayer('tiandi');
|
|
153
|
+
if (this._map.getLayer('zhuji')) this._map.removeLayer('zhuji');
|
|
154
|
+
if (this._map.getLayer('arcgis')) this._map.removeLayer('arcgis');
|
|
155
|
+
if (!this._map.getLayer('gaode')){
|
|
156
|
+
this._map.addLayer({
|
|
157
|
+
"id": "gaode",
|
|
158
|
+
"source": "gaode",
|
|
159
|
+
"type": "raster"
|
|
160
|
+
})
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
if(key == 'arcgis'){
|
|
164
|
+
if (this._map.getLayer('yingxiang')) this._map.removeLayer('yingxiang');
|
|
165
|
+
if (this._map.getLayer('tiandi')) this._map.removeLayer('tiandi');
|
|
166
|
+
if (this._map.getLayer('zhuji')) this._map.removeLayer('zhuji');
|
|
167
|
+
if (this._map.getLayer('gode')) this._map.removeLayer('gode');
|
|
168
|
+
if (!this._map.getLayer('arcgis')){
|
|
169
|
+
this._map.addLayer({
|
|
170
|
+
"id": "arcgis",
|
|
171
|
+
"source": "arcgis",
|
|
172
|
+
"type": "raster"
|
|
173
|
+
})
|
|
89
174
|
};
|
|
90
175
|
}
|
|
91
|
-
|
|
92
176
|
})
|
|
93
177
|
}
|
|
178
|
+
|
|
179
|
+
onRemove() {
|
|
180
|
+
this._container.parentNode.removeChild(this._container);
|
|
181
|
+
this._map = undefined;
|
|
182
|
+
}
|
|
94
183
|
}
|
|
@@ -135,6 +135,15 @@ export default class Toobars {
|
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
btn.addEventListener('click',()=>{
|
|
138
|
+
let box = this._container.getElementsByClassName('linedis-message-show')[0].parentNode;
|
|
139
|
+
let pos = box.getBoundingClientRect()
|
|
140
|
+
if(pos.x > document.body.clientWidth/2){
|
|
141
|
+
box.style.right = 0
|
|
142
|
+
box.style.left = ''
|
|
143
|
+
}else{
|
|
144
|
+
box.style.right = ''
|
|
145
|
+
box.style.left = 0
|
|
146
|
+
}
|
|
138
147
|
lineDis = {
|
|
139
148
|
'type': 'FeatureCollection',
|
|
140
149
|
'features': []
|
|
@@ -294,6 +303,7 @@ export default class Toobars {
|
|
|
294
303
|
}
|
|
295
304
|
|
|
296
305
|
addPosition(btn){
|
|
306
|
+
|
|
297
307
|
if(!this.mousemovePositionFun){
|
|
298
308
|
this.mousemovePositionFun = (e) => {
|
|
299
309
|
let lngLat = transform([e.lngLat.lng,e.lngLat.lat],true)
|
|
@@ -302,7 +312,16 @@ export default class Toobars {
|
|
|
302
312
|
: `经度:${lngLat[0].toFixed(6)}<br/>纬度:${lngLat[1].toFixed(6)}`
|
|
303
313
|
}
|
|
304
314
|
}
|
|
305
|
-
btn.addEventListener('click',()=>{
|
|
315
|
+
btn.addEventListener('click',()=>{
|
|
316
|
+
let box = this._container.getElementsByClassName('position-message-show')[0].parentNode;
|
|
317
|
+
let pos = box.getBoundingClientRect()
|
|
318
|
+
if(pos.x > document.body.clientWidth/2){
|
|
319
|
+
box.style.right = 0
|
|
320
|
+
box.style.left = ''
|
|
321
|
+
}else{
|
|
322
|
+
box.style.right = ''
|
|
323
|
+
box.style.left = 0
|
|
324
|
+
}
|
|
306
325
|
// jump with zoom, pitch, and bearing options
|
|
307
326
|
if(!this.positionClicked){
|
|
308
327
|
this.positionClicked = true
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
2
2
|
import * as THREE from 'three'
|
|
3
3
|
import { sleep } from '../../utils/util';
|
|
4
4
|
import {hasProperty,transform} from '../../utils/util'
|
|
@@ -96,6 +96,9 @@ export default class AlarmLayer{
|
|
|
96
96
|
//console.log(point)
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
onRemove(){
|
|
100
|
+
this.alarmList.forEach(a=>this.remove(a))
|
|
101
|
+
}
|
|
99
102
|
drawPoint(point){
|
|
100
103
|
let lng = point.lng;
|
|
101
104
|
let lat = point.lat;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {hasProperty,transform} from '../../utils/util.js'
|
|
3
3
|
import mapboxgl from '../../../lib/mapbox-gl/dist/mapbox-gl.js';
|
|
4
|
-
import {
|
|
4
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
5
5
|
import { sleep } from '../../utils/util.js';
|
|
6
6
|
import { SVGLoader } from 'three/addons/loaders/SVGLoader.js';
|
|
7
7
|
import getBarbs from '../../utils/barbsHelper.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {hasProperty,transform} from '../../utils/util'
|
|
3
3
|
import mapboxgl from '../../../lib/mapbox-gl/dist/mapbox-gl.js';
|
|
4
|
-
import {
|
|
4
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
5
5
|
import { sleep } from '../../utils/util';
|
|
6
6
|
import * as THREE from 'three'
|
|
7
7
|
var tb = {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {hasProperty,transform} from '../../utils/util'
|
|
3
3
|
import mapboxgl from '../../../lib/mapbox-gl/dist/mapbox-gl.js';
|
|
4
|
-
import {
|
|
4
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
5
5
|
import { sleep } from '../../utils/util';
|
|
6
6
|
import * as THREE from 'three'
|
|
7
7
|
var tb = {};
|
|
@@ -69,7 +69,10 @@ export default class AnimationLayer{
|
|
|
69
69
|
let texture = new THREE.TextureLoader().load(
|
|
70
70
|
_item.image);
|
|
71
71
|
texture.encoding = THREE.sRGBEncoding;
|
|
72
|
-
texture.flipY = false;
|
|
72
|
+
//texture.flipY = false;
|
|
73
|
+
texture.center.set(0.5,0.5);
|
|
74
|
+
texture.rotation = -Math.PI;
|
|
75
|
+
texture.colorSpace = THREE.SRGBColorSpace
|
|
73
76
|
this.itemList.push({
|
|
74
77
|
texture:texture,
|
|
75
78
|
item:_item
|
|
@@ -93,7 +96,7 @@ export default class AnimationLayer{
|
|
|
93
96
|
let _item = this.itemList[0].item;
|
|
94
97
|
let geometry = new THREE.PlaneGeometry(_item.width *20,_item.width*20);
|
|
95
98
|
//geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
96
|
-
let material = new THREE.
|
|
99
|
+
let material = new THREE.MeshBasicMaterial({
|
|
97
100
|
map:texture,
|
|
98
101
|
opacity:this.opacity,
|
|
99
102
|
transparent: true,
|
|
@@ -112,6 +115,11 @@ export default class AnimationLayer{
|
|
|
112
115
|
return mesh;
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
setOpacity(opacity){
|
|
119
|
+
this.opacity = opacity
|
|
120
|
+
this.obj.model.material.opacity = this.opacity;
|
|
121
|
+
}
|
|
122
|
+
|
|
115
123
|
pause(){
|
|
116
124
|
this.status = actionStatus.Pause
|
|
117
125
|
this.getProgress(this.progress.value,this.status)
|
|
@@ -5,7 +5,7 @@ import * as THREE from 'three'
|
|
|
5
5
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer';
|
|
6
6
|
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass';
|
|
7
7
|
import { OutlinePass } from 'three/examples/jsm/postprocessing/OutlinePass';
|
|
8
|
-
import {
|
|
8
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
9
9
|
import { lnglatsToWorld ,normalizeVertices,flattenVectors,projectToWorld} from '../../utils/mapUtil';
|
|
10
10
|
import CameraSync from '../../utils/CameraSync';
|
|
11
11
|
import { LineGeometry } from 'three/addons/lines/LineGeometry.js';
|
|
@@ -5,7 +5,7 @@ import * as THREE from 'three'
|
|
|
5
5
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer';
|
|
6
6
|
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass';
|
|
7
7
|
import { OutlinePass } from 'three/examples/jsm/postprocessing/OutlinePass';
|
|
8
|
-
import {
|
|
8
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
9
9
|
import { lnglatsToWorld ,normalizeVertices,flattenVectors,projectToWorld} from '../../utils/mapUtil';
|
|
10
10
|
import CameraSync from '../../utils/CameraSync';
|
|
11
11
|
import { LineGeometry } from 'three/addons/lines/LineGeometry.js';
|
|
@@ -439,6 +439,7 @@ export default class ExtrusionLayer{
|
|
|
439
439
|
|
|
440
440
|
let bf = new Uint8Array(this.w * this.h * 4)
|
|
441
441
|
this.renderer.readRenderTargetPixels(target, 0, 0, this.w, this.h, bf)
|
|
442
|
+
this.renderer.autoClear = false
|
|
442
443
|
this.flipY(bf,this.w,this.h)
|
|
443
444
|
let clamped = new Uint8ClampedArray(bf,bf)
|
|
444
445
|
let imageData = new ImageData(clamped, this.w, this.h)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {hasProperty,transform,downloadFileByBase64, sleep} from '../../utils/util'
|
|
3
3
|
import mapboxgl from '../../../lib/mapbox-gl/dist/mapbox-gl.js';
|
|
4
4
|
import * as THREE from 'three'
|
|
5
|
-
import {
|
|
5
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
6
6
|
var tb = {};
|
|
7
7
|
let markerGroup = new THREE.Group();
|
|
8
8
|
export default class MarkerAreaLayer{
|
|
@@ -6,7 +6,7 @@ import { LineGeometry } from 'three/addons/lines/LineGeometry.js';
|
|
|
6
6
|
import { Line2 } from 'three/addons/lines/Line2.js';
|
|
7
7
|
import {LineMaterial} from 'three/examples/jsm/lines/LineMaterial.js'
|
|
8
8
|
import * as THREE from 'three'
|
|
9
|
-
import {
|
|
9
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
10
10
|
var tb = {};
|
|
11
11
|
export default class ThreeScanLayer{
|
|
12
12
|
drawArray = []
|
|
@@ -43,6 +43,11 @@ export default class ThreeScanLayer{
|
|
|
43
43
|
return canvas.toDataURL();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
|
|
47
|
+
onRemove(){
|
|
48
|
+
this.removeAll()
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
remove(point){
|
|
47
52
|
point.mesh.label.element.remove()
|
|
48
53
|
tb.remove(point.mesh)
|
|
@@ -152,27 +157,59 @@ export default class ThreeScanLayer{
|
|
|
152
157
|
resolve(_texture)
|
|
153
158
|
})
|
|
154
159
|
})
|
|
155
|
-
texture = await p()
|
|
160
|
+
texture = await p()
|
|
161
|
+
texture.center.set(0.5,0.5);
|
|
162
|
+
texture.rotation = -Math.PI;
|
|
156
163
|
}
|
|
164
|
+
texture.colorSpace = THREE.SRGBColorSpace
|
|
157
165
|
texture.encoding = THREE.sRGBEncoding;
|
|
158
|
-
texture.flipY = false;
|
|
159
|
-
//texture.flipX = true;
|
|
166
|
+
// texture.flipY = false;
|
|
167
|
+
// texture.flipX = true;
|
|
160
168
|
let index = this.drawArray.findIndex(a=>a.center[0] == point.center[0] && a.center[1] == point.center[1])
|
|
161
169
|
if(index >= 0){
|
|
162
|
-
|
|
163
170
|
let _point = this.drawArray[index]
|
|
164
|
-
if(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
if(_point && point.width != _point.width){
|
|
172
|
+
this.remove(this.drawArray[index])
|
|
173
|
+
this.drawArray[index] = null
|
|
174
|
+
this.drawArray = this.drawArray.filter(a=>a)
|
|
175
|
+
let geometry = new THREE.PlaneGeometry(point.width *20,point.width*20);
|
|
176
|
+
//geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
177
|
+
let material = new THREE.MeshBasicMaterial({
|
|
178
|
+
map:texture,
|
|
179
|
+
opacity:this.opacity,
|
|
180
|
+
transparent: true,
|
|
181
|
+
});
|
|
182
|
+
material.color.convertSRGBToLinear();
|
|
183
|
+
let mesh = new THREE.Mesh(geometry, material);
|
|
184
|
+
mesh.name = 'scanimg'
|
|
185
|
+
mesh = tb.Object3D({ obj: mesh, units: 'meters',fixedZoom :15 ,anchor:'center'});
|
|
186
|
+
mesh.setCoords( transform(point.center));
|
|
187
|
+
tb.renderer.outputEncoding = THREE.sRGBEncoding;
|
|
188
|
+
tb.add(mesh);
|
|
189
|
+
let dom =document.createElement('div')
|
|
190
|
+
mesh.addLabel(dom,true,{x:mesh.anchor.x,y:mesh.anchor.y+point.distance *1200,z:mesh.anchor.z},0)
|
|
191
|
+
mesh.label.element.className += ('' +this.textClass)
|
|
192
|
+
mesh.label.element.style.fontSize = '24px'
|
|
193
|
+
mesh.label.element.innerHTML = point.text
|
|
194
|
+
point.mesh = mesh;
|
|
195
|
+
this.drawArray.push(point)
|
|
196
|
+
if(point.rect){
|
|
197
|
+
this.updateRect(point)
|
|
198
|
+
}
|
|
199
|
+
}else{
|
|
200
|
+
if(this.forceClear) {
|
|
201
|
+
_point.mesh.model.material.map.dispose();
|
|
202
|
+
}
|
|
203
|
+
_point.mesh.model.material.map = texture
|
|
204
|
+
_point.mesh.label.element.innerHTML = point.text
|
|
205
|
+
if(point.rect){
|
|
206
|
+
this.updateRect(point)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
172
209
|
}else{
|
|
173
210
|
let geometry = new THREE.PlaneGeometry(point.width *20,point.width*20);
|
|
174
211
|
//geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
175
|
-
let material = new THREE.
|
|
212
|
+
let material = new THREE.MeshBasicMaterial({
|
|
176
213
|
map:texture,
|
|
177
214
|
opacity:this.opacity,
|
|
178
215
|
transparent: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
import { getBBox } from '../../utils/util';
|
|
3
|
-
import {
|
|
3
|
+
import {Threebox} from '../../../lib/threebox-plugin';
|
|
4
4
|
import { lnglatsToWorld ,normalizeVertices,flattenVectors,projectToWorld} from '../../utils/mapUtil';
|
|
5
5
|
import CameraSync from '../../utils/CameraSync';
|
|
6
6
|
const WORLD_SIZE = 1024000;
|
package/webpack.config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const path=require('path')
|
|
2
2
|
module.exports={
|
|
3
3
|
mode:'development', // 开发模式
|
|
4
|
+
//target:'web',
|
|
4
5
|
entry:path.resolve(__dirname,'./main.js'),
|
|
5
6
|
module:{
|
|
6
7
|
// env: {
|
|
@@ -16,7 +17,7 @@ module.exports={
|
|
|
16
17
|
loader: 'babel-loader',
|
|
17
18
|
options: {
|
|
18
19
|
presets: ['@babel/preset-env'],
|
|
19
|
-
ignore: [ './node_modules/mapbox-gl/dist/mapbox-gl.js','./lib/mapbox-gl/dist/mapbox-gl.js' ]
|
|
20
|
+
ignore: [ './node_modules/mapbox-gl/dist/mapbox-gl.js','./lib/mapbox-gl/dist/mapbox-gl.js','./lib/threebox-plugin' ]
|
|
20
21
|
},
|
|
21
22
|
},
|
|
22
23
|
},
|