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
cf92bab6
authored
2019-12-09 14:06:08 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
'20191208'
1 parent
f1d2a487
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
247 additions
and
39 deletions
README.md
src/components/viewer_3dmodel.vue
src/components/viewer_fire.vue
src/components/viewer_s3m_single.vue
src/components/viewer_spatialquery.vue
src/components/viewer_spatialquery_tl.vue
src/config/urlConfig.vue
src/views/Home.vue
README.md
View file @
cf92bab
...
...
@@ -2,7 +2,7 @@
*
@Author: jiangbotao
*
@Date: 2019-12-03 22:31:52
*
@LastEditors: jiangbotao
*
@LastEditTime: 2019-12-0
8 23:13:54
*
@LastEditTime: 2019-12-0
9 13:55:27
*
@FilePath:
\s
uperglobevue
\R
EADME.md
-->
# superglobevue
...
...
@@ -31,6 +31,7 @@ SuperGlobeVue是基于vue-cli3和supermap cesium 的一款Globe地球视图。
-
viewer_underground.vue 地底开挖效果,实际上是改变某个SCP图层的局部透明度
-
viewer_split.vue 地图分屏
-
viewer_spatialquery.vue 空间过滤查询
-
viewer_spatialquery_tl.vue 空间过滤,将结果(面)转换为entity
-
viewer_fire.vue 火焰效果
## 2、设置
...
...
src/components/viewer_3dmodel.vue
View file @
cf92bab
<!--
* 矢量数据白模
* 矢量数据白模
的展示
* @Author: jiangbotao
* @Date: 2019-12-07 14:24:01
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-0
7 18:07:21
* @LastEditTime: 2019-12-0
9 13:09:00
* @FilePath: \superglobevue\src\components\viewer_3dmodel.vue
-->
<
template
>
...
...
@@ -65,6 +65,7 @@ export default {
try
{
//打开所发布三维服务下的所有图层
//GZ_SCENE中只有白模数据,没有矢量数据图层
var
promise
=
scene
.
open
(
URL_CONFIG
.
GZ_SCENE
);
Cesium
.
when
.
all
(
promise
,
function
(
layers
){
//设置图层的阴影模式
...
...
@@ -89,7 +90,6 @@ export default {
widget
.
showErrorPanel
(
title
,
undefined
,
e
);
}
}
$
(
'#loadingbar'
).
remove
();
}
}
...
...
src/components/viewer_fire.vue
View file @
cf92bab
...
...
@@ -59,7 +59,7 @@ export default {
$
(
".cesium-viewer-animationContainer"
)[
0
].
style
.
visibility
=
"hidden"
;
// 隐藏导航工具
// $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden";
// 添加天地图数据
__this
.
smviewer
.
imageryLayers
.
addImageryProvider
(
new
Cesium
.
TiandituImageryProvider
({
mapStyle
:
Cesium
.
TiandituMapsStyle
.
IMG_C
,
token
:
URL_CONFIG
.
TOKEN_TIANDITU
...
...
@@ -75,12 +75,9 @@ export default {
__this
.
smviewer
.
camera
.
setView
({
destination
:
Cesium
.
Cartesian3
.
fromDegrees
(
116.34485552299206
,
39.99754814959118
,
450.0
)
});
// 鼠标左键点击事件
var
handler
=
new
Cesium
.
ScreenSpaceEventHandler
(
scene
.
canvas
);
handler
.
setInputAction
(
function
(
e
)
{
//首先移除之前添加的点
// viewer.entities.removeAll();
//获取点击位置笛卡尔坐标
var
position
=
scene
.
pickPosition
(
e
.
position
);
//将笛卡尔坐标转化为经纬度坐标
...
...
@@ -88,7 +85,7 @@ export default {
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
...
...
@@ -139,7 +136,6 @@ export default {
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
)
...
...
src/components/viewer_s3m_single.vue
View file @
cf92bab
<!--
* @Author: jiangbotao
* 本例中使用了铁岭的倾斜摄影数据发布的服务
* 1、必须同时发布为三维和Rest服务
* 2、使用要素查询方式来选择倾斜摄影覆盖面
* 1、必须同时发布为三维和Rest
数据
服务
* 2、使用要素查询方式来选择倾斜摄影覆盖面
(a、矢量面紧贴S3M;b、矢量面构筑entity)
* 3、使用Popup来弹出倾斜摄影覆盖面的信息
* @Date: 2019-12-03 22:52:56
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-09 1
2:23:57
* @LastEditTime: 2019-12-09 1
3:33:21
* @FilePath: \superglobevue\src\components\viewer.vue
-->
<
template
>
...
...
@@ -62,6 +62,7 @@ export default {
};
},
mounted
:
function
()
{
// cesium视图
this
.
viewer
=
new
Cesium
.
Viewer
(
"cesiumContainer"
,
{
navigationInstructionsInitiallyVisible
:
false
});
// 使用自定义的navigation
var
options
=
{};
...
...
@@ -74,19 +75,24 @@ export default {
$
(
".cesium-widget-credits"
)[
0
].
style
.
visibility
=
"hidden"
;
// 隐藏导航工具
$
(
".cesium-viewer-navigationContainer"
)[
0
].
style
.
visibility
=
"hidden"
;
// 必要的引用对象
var
smviewer
=
this
.
viewer
;
var
scene
=
this
.
viewer
.
scene
;
var
widget
=
this
.
viewer
.
cesiumWidget
;
var
camera
=
scene
.
camera
;
// 场景位置,用于popup定位
var
scenePosition
=
null
;
var
infoboxContainer
=
document
.
getElementById
(
"bubble"
);
var
table
=
document
.
getElementById
(
"tab"
);
try
{
// 添加s3m图层
var
promise2
=
scene
.
addS3MTilesLayerByScp
(
"http://www.supermapol.com/realspace/services/3D-dynamicDTH/rest/realspace/datas/Config%20-%201/config"
,
{
name
:
"oblique photography"
});
Cesium
.
when
.
all
([
promise2
],
function
(
obliqueLayers
){
// 等倾斜摄影数据加载完了再去加载矢量面,否则矢量面找不到目标去贴对象
camera
.
setView
({
// 先定位,开始渲染定位区域的倾斜
Cesium
.
when
.
all
([
promise2
],
function
(
obliqueLayers
){
// 等倾斜摄影数据加载完了再去加载矢量面,否则矢量面找不到目标去贴对象
// 先定位,开始渲染定位区域的倾斜
camera
.
setView
({
destination
:
new
Cesium
.
Cartesian3
(
-
2623004.4174251584
,
3926981.958360567
,
4287374.829655093
),
orientation
:
{
heading
:
4.39611370540786
,
...
...
@@ -103,16 +109,17 @@ export default {
widget
.
showErrorPanel
(
title
,
undefined
,
e
);
}
}
// 倾斜摄影模型下的矢量数据面
var
dataSourceName
=
'铁岭矢量面'
;
// 数据源名称
var
dataSetName
=
'New_Region3D_1'
;
// 数据集名称
var
dataServiceUrl
=
'http://www.supermapol.com/realspace/services/data-dynamicDTH/rest/data/featureResults.rjson?returnContent=true'
;
var
infoboxContainer
=
document
.
getElementById
(
"bubble"
);
var
table
=
document
.
getElementById
(
"tab"
);
// 鼠标左键的触发事件,查询要素并弹出显示
var
handler
=
new
Cesium
.
ScreenSpaceEventHandler
(
this
.
viewer
.
canvas
);
handler
.
setInputAction
(
function
(
e
)
{
// 删除可能存在的identify-area的entity,它是我们后面查询的用于标识模型的三维面
smviewer
.
entities
.
removeById
(
'identify-area'
);
// 当前位置
var
position
=
scene
.
pickPosition
(
e
.
position
);
// 设置场景位置
scenePosition
=
position
;
...
...
@@ -123,24 +130,10 @@ export default {
x
:
longitude
,
y
:
latitude
};
//
console.log(queryPoint);
//
将当前点转换为地理坐标后进行查询
queryByPoint
(
queryPoint
);
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
var
ellipsoid
=
this
.
viewer
.
scene
.
globe
.
ellipsoid
;
handler
.
setInputAction
(
function
(
e
)
{
var
cartesian
=
smviewer
.
camera
.
pickEllipsoid
(
e
.
endPosition
,
ellipsoid
);
if
(
cartesian
){
//将笛卡尔三维坐标转为地图坐标(弧度)
var
cartographic
=
scene
.
globe
.
ellipsoid
.
cartesianToCartographic
(
cartesian
);
//将地图坐标(弧度)转为十进制的度数
var
lat_String
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
latitude
).
toFixed
(
4
);
var
log_String
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
longitude
).
toFixed
(
4
);
var
alti_String
=
(
smviewer
.
camera
.
positionCartographic
.
height
).
toFixed
(
2
);
$
(
'.ant-layout-footer'
).
text
(
'经度 : '
+
log_String
+
' | 纬度 : '
+
lat_String
+
' | 高度 : '
+
alti_String
);
}
},
Cesium
.
ScreenSpaceEventType
.
MOUSE_MOVE
);
$
(
"#close"
).
click
(
function
(){
// 关闭气泡
smviewer
.
entities
.
removeAll
();
...
...
@@ -182,7 +175,7 @@ export default {
if
(
resultObj
.
featureCount
>
0
)
{
var
selectedFeature
=
resultObj
.
features
[
0
];
addClapFeature
(
selectedFeature
);
console
.
log
(
selectedFeature
);
//
console.log(selectedFeature);
$
(
"#bubble"
).
show
();
for
(
var
i
=
table
.
rows
.
length
-
1
;
i
>-
1
;
i
--
){
table
.
deleteRow
(
i
);
...
...
@@ -205,6 +198,9 @@ export default {
}
// 将数据服务查询到的要素添加到场景中高亮显示,表示选中效果。
// 两种方法:
// a. 矢量面紧贴S3M
// b. 使用entity模型
function
addClapFeature
(
feature
)
{
var
lonLatArr
=
getLonLatArray
(
feature
.
geometry
.
points
);
// smviewer.entities.add({
...
...
@@ -216,6 +212,7 @@ export default {
// },
// clampToS3M: true // 贴在S3M模型表面
// });
console
.
log
(
lonLatArr
);
smviewer
.
entities
.
add
({
id
:
'identify-area'
,
name
:
'单体化标识面'
,
...
...
src/components/viewer_spatialquery.vue
View file @
cf92bab
...
...
@@ -165,7 +165,6 @@ export default {
spatialQueryMode
:
SuperMap
.
REST
.
SpatialQueryMode
.
CONTAIN
,
geometry
:
drawGeometryArgs
});
console
.
log
(
'aa'
);
var
url
=
'http://www.supermapol.com/realspace/services/data-cbd/rest/data'
;
getFeaturesByGeometryService
=
new
SuperMap
.
REST
.
GetFeaturesByGeometryService
(
url
,
{
eventListeners
:
{
...
...
src/components/viewer_spatialquery_tl.vue
0 → 100644
View file @
cf92bab
<!--
* 空间查询
* 二维结果面形成entity
* @Author: jiangbotao
* @Date: 2019-12-03 22:52:56
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-09 13:54:49
* @FilePath: \superglobevue\src\components\viewer.vue
-->
<
template
>
<div>
<div
id=
"cesiumContainer"
v-bind:style=
"styleObject"
></div>
<div
id=
'loadingbar'
class=
"spinner"
>
<div
class=
"spinner-container container1"
>
<div
class=
"circle1"
></div>
<div
class=
"circle2"
></div>
<div
class=
"circle3"
></div>
<div
class=
"circle4"
></div>
</div>
<div
class=
"spinner-container container2"
>
<div
class=
"circle1"
></div>
<div
class=
"circle2"
></div>
<div
class=
"circle3"
></div>
<div
class=
"circle4"
></div>
</div>
<div
class=
"spinner-container container3"
>
<div
class=
"circle1"
></div>
<div
class=
"circle2"
></div>
<div
class=
"circle3"
></div>
<div
class=
"circle4"
></div>
</div>
</div>
<div
id=
"toolbar"
class=
"param-container tool-bar"
>
<div>
<button
id=
"search"
>
查询
</button>
</div>
</div>
</div>
</
template
>
<
script
>
import
URL_CONFIG
from
"./../config/urlConfig.vue"
;
const
Cesium
=
window
.
Cesium
;
const
SuperMap
=
window
.
SuperMap
;
export
default
{
data
:
function
()
{
return
{
styleObject
:
{
width
:
"100%"
,
position
:
"absolute"
,
top
:
"0px"
,
bottom
:
"0px"
,
left
:
"0px"
,
backgroundColor
:
"#000000"
},
smviewer
:
{}
};
},
mounted
:
function
()
{
var
__this
=
this
;
__this
.
viewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
animation
:
true
});
var
scene
=
__this
.
viewer
.
scene
;
var
widget
=
__this
.
viewer
.
cesiumWidget
;
var
camera
=
scene
.
camera
;
// 隐藏logo
$
(
".cesium-widget-credits"
)[
0
].
style
.
visibility
=
"hidden"
;
$
(
".cesium-viewer-animationContainer"
)[
0
].
style
.
visibility
=
"hidden"
;
$
(
".cesium-infoBox"
)[
0
].
style
.
visibility
=
'hidden'
;
// 隐藏导航工具
// $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden";
try
{
var
promise2
=
scene
.
addS3MTilesLayerByScp
(
"http://www.supermapol.com/realspace/services/3D-dynamicDTH/rest/realspace/datas/Config%20-%201/config"
,
{
name
:
"oblique photography"
});
Cesium
.
when
([
promise2
],
function
(
layers
)
{
camera
.
setView
({
destination
:
new
Cesium
.
Cartesian3
(
-
2623004.4174251584
,
3926981.958360567
,
4287374.829655093
),
orientation
:
{
heading
:
4.39611370540786
,
pitch
:
-
0.43458664812464143
,
roll
:
2.0174972803488345
e
-
11
}
});
// 去除加载动画
$
(
'#loadingbar'
).
remove
();
var
positions
=
null
;
// 绘制面
var
handlerPolygon
=
new
Cesium
.
DrawHandler
(
__this
.
viewer
,
Cesium
.
DrawMode
.
Polygon
,
0
);
handlerPolygon
.
drawEvt
.
addEventListener
(
function
(
polygon
){
var
points
=
polygon
.
object
.
positions
;
var
arr
=
[];
if
(
points
&&
points
instanceof
Array
&&
points
.
length
>=
3
){
for
(
var
i
=
0
,
j
=
points
.
length
;
i
<
j
;
i
++
){
var
point
=
__this
.
convertPoint
(
points
[
i
]);
if
(
point
){
arr
.
push
(
point
);
}
}
}
var
linearRing
=
new
SuperMap
.
Geometry
.
LinearRing
(
arr
);
var
searchPolygon
=
new
SuperMap
.
Geometry
.
Polygon
(
linearRing
);
query
(
searchPolygon
);
});
$
(
"#search"
).
on
(
"click"
,
function
(){
handlerPolygon
.
activeEvt
.
addEventListener
(
function
(
isActive
){
if
(
isActive
===
true
){
__this
.
viewer
.
enableCursorStyle
=
false
;
__this
.
viewer
.
_element
.
style
.
cursor
=
''
;
$
(
'body'
).
removeClass
(
'drawCur'
).
addClass
(
'drawCur'
);
}
else
{
__this
.
viewer
.
enableCursorStyle
=
true
;
$
(
'body'
).
removeClass
(
'drawCur'
);
}
});
handlerPolygon
&&
handlerPolygon
.
deactivate
();
handlerPolygon
&&
handlerPolygon
.
activate
();
});
function
processCompleted
(
queryEventArgs
){
var
selectedFeatures
=
queryEventArgs
.
originResult
.
features
;
__this
.
viewer
.
entities
.
removeAll
();
console
.
log
(
selectedFeatures
);
for
(
var
i
=
0
;
i
<
selectedFeatures
.
length
;
i
++
){
var
value
=
selectedFeatures
[
i
].
fieldValues
[
"0"
];
var
feature
=
selectedFeatures
[
i
];
var
pts
=
[];
for
(
var
j
=
0
;
j
<
feature
.
geometry
.
points
.
length
;
j
++
){
pts
.
push
(
feature
.
geometry
.
points
[
j
].
x
);
pts
.
push
(
feature
.
geometry
.
points
[
j
].
y
);
}
__this
.
viewer
.
entities
.
add
({
id
:
value
,
name
:
selectedFeatures
[
i
].
fieldValues
[
"0"
],
polygon
:
{
hierarchy
:
Cesium
.
Cartesian3
.
fromDegreesArray
(
pts
),
material
:
new
Cesium
.
Color
(
0.0
,
1.0
,
0.0
,
0.3
),
extrudedHeight
:
100
,
height
:
50
,
vertexFormat
:
Cesium
.
EllipsoidSurfaceAppearance
.
VERTEX_FORMAT
,
outline
:
true
,
outlineColor
:
Cesium
.
Color
.
BLACK
},
});
}
}
function
query
(
drawGeometryArgs
){
var
getFeaturesByGeometryParameters
,
getFeaturesByGeometryService
;
getFeaturesByGeometryParameters
=
new
SuperMap
.
REST
.
GetFeaturesByGeometryParameters
({
datasetNames
:
[
"铁岭矢量面:New_Region3D_1"
],
toIndex
:
-
1
,
spatialQueryMode
:
SuperMap
.
REST
.
SpatialQueryMode
.
INTERSECT
,
geometry
:
drawGeometryArgs
});
var
url
=
'http://www.supermapol.com/realspace/services/data-dynamicDTH/rest/data'
;
getFeaturesByGeometryService
=
new
SuperMap
.
REST
.
GetFeaturesByGeometryService
(
url
,
{
eventListeners
:
{
"processCompleted"
:
processCompleted
,
"processFailed"
:
processFailed
}
});
getFeaturesByGeometryService
.
processAsync
(
getFeaturesByGeometryParameters
);
}
function
processFailed
(
e
)
{
alert
(
e
.
error
.
errorMsg
);
}
},
function
()
{
var
title
=
'加载SCP失败,请检查网络连接状态或者url地址是否正确?'
;
widget
.
showErrorPanel
(
title
,
undefined
,
e
);
});
}
catch
(
e
)
{
if
(
widget
.
_showRenderLoopErrors
)
{
var
title
=
'渲染时发生错误,已停止渲染。'
;
widget
.
showErrorPanel
(
title
,
undefined
,
e
);
}
}
$
(
"#loadingbar"
).
remove
();
},
methods
:{
convertPoint
:
function
(
point
){
var
lonlatPoint
=
Cesium
.
Cartographic
.
fromCartesian
(
point
);
var
x
=
Cesium
.
Math
.
toDegrees
(
lonlatPoint
.
longitude
);
var
y
=
Cesium
.
Math
.
toDegrees
(
lonlatPoint
.
latitude
);
if
(
x
&&
y
){
return
new
SuperMap
.
Geometry
.
Point
(
x
,
y
);
}
return
undefined
;
}
}
};
</
script
>
<
style
>
.sm-compass
{
pointer-events
:
auto
;
position
:
absolute
;
right
:
10px
;
top
:
10px
;
width
:
128px
;
height
:
128px
;
overflow
:
hidden
;
}
.sm-zoom
{
top
:
130px
;
}
.drawCur
{
cursor
:
url(/images/cur/draw.cur)
,
auto
;
}
.cesium-infoBox
{
top
:
20
;
left
:
0
;
transition
:
opacity
0.2s
;
}
</
style
>
src/config/urlConfig.vue
View file @
cf92bab
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-03 22:54:10
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-0
7 14:31:42
* @LastEditTime: 2019-12-0
9 13:10:30
* @FilePath: \superglobevue\src\config\urlConfig.vue
-->
<
script
>
...
...
src/views/Home.vue
View file @
cf92bab
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-03 22:31:08
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-09 1
2:10:58
* @LastEditTime: 2019-12-09 1
3:55:51
* @FilePath: \superglobevue\src\views\Home.vue
-->
<
template
>
...
...
@@ -10,7 +10,7 @@
</
template
>
<
script
>
import
viewer
from
"@/components/viewer_s
3m_single
.vue"
;
import
viewer
from
"@/components/viewer_s
patialquery_tl
.vue"
;
export
default
{
name
:
"home"
,
...
...
Please
register
or
sign in
to post a comment