Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
蒋波涛
/
super_globe_vue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
3cf186e6
authored
2019-12-09 12:07:48 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
'20191208'
1 parent
8afe62ce
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
65 deletions
src/components/viewer_fire.vue
src/components/viewer_underground.vue
src/components/viewer_ymo.vue
src/views/Home.vue
src/components/viewer_fire.vue
View file @
3cf186e
<!--
* 火焰效果
* 鼠标点击处会出现火灾效果
* @Author: jiangbotao
* @Date: 2019-12-08 22:39:07
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-0
8 23:11:03
* @LastEditTime: 2019-12-0
9 12:01:09
* @FilePath: \superglobevue\src\components\viewer_fire.vue
-->
<
template
>
...
...
@@ -50,15 +51,16 @@ export default {
}
},
mounted
:
function
(){
this
.
smviewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
animation
:
true
});
var
scene
=
this
.
smviewer
.
scene
;
var
__this
=
this
;
__this
.
smviewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
animation
:
true
});
var
scene
=
__this
.
smviewer
.
scene
;
// 隐藏logo
$
(
".cesium-widget-credits"
)[
0
].
style
.
visibility
=
"hidden"
;
$
(
".cesium-viewer-animationContainer"
)[
0
].
style
.
visibility
=
"hidden"
;
// 隐藏导航工具
// $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden";
this
.
smviewer
.
imageryLayers
.
addImageryProvider
(
new
Cesium
.
TiandituImageryProvider
({
__
this
.
smviewer
.
imageryLayers
.
addImageryProvider
(
new
Cesium
.
TiandituImageryProvider
({
mapStyle
:
Cesium
.
TiandituMapsStyle
.
IMG_C
,
token
:
URL_CONFIG
.
TOKEN_TIANDITU
}));
...
...
@@ -70,67 +72,82 @@ export default {
});
imageryLayers
.
addImageryProvider
(
labelImagery
);
this
.
smviewer
.
camera
.
setView
({
destination
:
Cesium
.
Cartesian3
.
fromDegrees
(
116.34485552299206
,
39.99754814959118
,
2
50.0
)
__
this
.
smviewer
.
camera
.
setView
({
destination
:
Cesium
.
Cartesian3
.
fromDegrees
(
116.34485552299206
,
39.99754814959118
,
4
50.0
)
});
var
staticPosition
=
Cesium
.
Cartesian3
.
fromDegrees
(
116.34516786934411
,
39.99753297677145
,
10.614538127977399
);
var
entity
=
this
.
smviewer
.
entities
.
add
({
position
:
staticPosition
});
var
particleSystem
=
scene
.
primitives
.
add
(
new
Cesium
.
ParticleSystem
({
// 粒子的图片
image
:
'./images/fire.png'
,
// 起始颜色
startColor
:
new
Cesium
.
Color
(
1
,
1
,
1
,
1
),
// 结束颜色
endColor
:
new
Cesium
.
Color
(
1
,
0
,
0
,
0
),
startScale
:
1.0
,
// 结束大小比例
endScale
:
1.5
,
// 最小生命周期
minimumParticleLife
:
1.5
,
// 最大生命周期
maximumParticleLife
:
5
,
// 最小速度
minimumSpeed
:
7.0
,
// 最大速度
maximumSpeed
:
9.0
,
// 粒子大小
imageSize
:
new
Cesium
.
Cartesian2
(
12
,
12
),
// 粒子数量
emissionRate
:
200
,
lifetime
:
16
,
// 循环是否开启
loop
:
true
,
// 粒子的释放方向
emitter
:
new
Cesium
.
ConeEmitter
(
Cesium
.
Math
.
toRadians
(
45.0
)),
// 是否以米为单位
sizeInMeters
:
true
}))
this
.
smviewer
.
scene
.
preUpdate
.
addEventListener
(
function
(
scene
,
time
)
{
particleSystem
.
modelMatrix
=
computeModelMatrix
(
entity
,
time
)
// Account for any changes to the emitter model matrix.
particleSystem
.
emitterModelMatrix
=
computeEmitterModelMatrix
()
})
function
computeModelMatrix
(
entity
,
time
)
{
return
entity
.
computeModelMatrix
(
time
,
new
Cesium
.
Matrix4
())
}
var
handler
=
new
Cesium
.
ScreenSpaceEventHandler
(
scene
.
canvas
);
handler
.
setInputAction
(
function
(
e
)
{
//首先移除之前添加的点
// viewer.entities.removeAll();
//获取点击位置笛卡尔坐标
var
position
=
scene
.
pickPosition
(
e
.
position
);
//将笛卡尔坐标转化为经纬度坐标
var
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
position
);
var
longitude
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
longitude
);
var
latitude
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
latitude
);
var
height
=
2
;
var
staticPosition
=
Cesium
.
Cartesian3
.
fromDegrees
(
longitude
,
latitude
,
height
);
var
entity
=
__this
.
smviewer
.
entities
.
add
({
position
:
staticPosition
});
var
particleSystem
=
scene
.
primitives
.
add
(
new
Cesium
.
ParticleSystem
({
// 粒子的图片
image
:
'./images/fire.png'
,
// 起始颜色
startColor
:
new
Cesium
.
Color
(
1
,
1
,
1
,
1
),
// 结束颜色
endColor
:
new
Cesium
.
Color
(
1
,
0
,
0
,
0
),
startScale
:
1.0
,
// 结束大小比例
endScale
:
1.5
,
// 最小生命周期
minimumParticleLife
:
1.5
,
// 最大生命周期
maximumParticleLife
:
5
,
// 最小速度
minimumSpeed
:
7.0
,
// 最大速度
maximumSpeed
:
9.0
,
// 粒子大小
imageSize
:
new
Cesium
.
Cartesian2
(
12
,
12
),
// 粒子数量
emissionRate
:
200
,
lifetime
:
16
,
// 循环是否开启
loop
:
true
,
// 粒子的释放方向
emitter
:
new
Cesium
.
ConeEmitter
(
Cesium
.
Math
.
toRadians
(
45.0
)),
// 是否以米为单位
sizeInMeters
:
true
}))
__this
.
smviewer
.
scene
.
preUpdate
.
addEventListener
(
function
(
scene
,
time
)
{
particleSystem
.
modelMatrix
=
computeModelMatrix
(
entity
,
time
)
// Account for any changes to the emitter model matrix.
particleSystem
.
emitterModelMatrix
=
computeEmitterModelMatrix
()
})
function
computeModelMatrix
(
entity
,
time
)
{
return
entity
.
computeModelMatrix
(
time
,
new
Cesium
.
Matrix4
())
}
var
emitterModelMatrix
=
new
Cesium
.
Matrix4
()
var
translation
=
new
Cesium
.
Cartesian3
()
var
rotation
=
new
Cesium
.
Quaternion
()
var
hpr
=
new
Cesium
.
HeadingPitchRoll
()
var
trs
=
new
Cesium
.
TranslationRotationScale
()
var
emitterModelMatrix
=
new
Cesium
.
Matrix4
()
var
translation
=
new
Cesium
.
Cartesian3
()
var
rotation
=
new
Cesium
.
Quaternion
()
var
hpr
=
new
Cesium
.
HeadingPitchRoll
()
var
trs
=
new
Cesium
.
TranslationRotationScale
()
// 改变粒子系统的位置
function
computeEmitterModelMatrix
()
{
hpr
=
Cesium
.
HeadingPitchRoll
.
fromDegrees
(
0.0
,
0.0
,
0.0
,
hpr
)
trs
.
translation
=
Cesium
.
Cartesian3
.
fromElements
(
-
2
,
0
,
2
,
translation
)
trs
.
rotation
=
Cesium
.
Quaternion
.
fromHeadingPitchRoll
(
hpr
,
rotation
)
return
Cesium
.
Matrix4
.
fromTranslationRotationScale
(
trs
,
emitterModelMatrix
)
}
// 改变粒子系统的位置
function
computeEmitterModelMatrix
()
{
hpr
=
Cesium
.
HeadingPitchRoll
.
fromDegrees
(
0.0
,
0.0
,
0.0
,
hpr
)
trs
.
translation
=
Cesium
.
Cartesian3
.
fromElements
(
-
2
,
0
,
2
,
translation
)
trs
.
rotation
=
Cesium
.
Quaternion
.
fromHeadingPitchRoll
(
hpr
,
rotation
)
return
Cesium
.
Matrix4
.
fromTranslationRotationScale
(
trs
,
emitterModelMatrix
)
}
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
$
(
'#loadingbar'
).
remove
();
}
...
...
src/components/viewer_underground.vue
View file @
3cf186e
...
...
@@ -3,7 +3,7 @@
* @Author: jiangbotao
* @Date: 2019-12-07 14:24:01
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-0
7 18:19:06
* @LastEditTime: 2019-12-0
9 11:46:57
* @FilePath: \superglobevue\src\components\viewer_3dmodel.vue
-->
<
template
>
...
...
src/components/viewer_ymo.vue
View file @
3cf186e
...
...
@@ -8,7 +8,7 @@
* @Author: jiangbotao
* @Date: 2019-12-02 09:05:50
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-09
09:50:49
* @LastEditTime: 2019-12-09
11:38:20
* @FilePath: \WebGL_Webpack_Vue\components\viewer.vue
-->
<
template
>
...
...
src/views/Home.vue
View file @
3cf186e
<!--
* 开挖分析
* @Author: jiangbotao
* @Date: 2019-12-03 22:31:08
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-09
09:48:39
* @LastEditTime: 2019-12-09
12:07:37
* @FilePath: \superglobevue\src\views\Home.vue
-->
<
template
>
...
...
@@ -11,7 +10,7 @@
</
template
>
<
script
>
import
viewer
from
"@/components/viewer_
s3m_singl
e.vue"
;
import
viewer
from
"@/components/viewer_
fir
e.vue"
;
export
default
{
name
:
"home"
,
...
...
Please
register
or
sign in
to post a comment