Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
刘远
/
3d_dc
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f35b59a5
authored
2020-07-29 09:26:56 +0800
by
jikai
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
111111
1 parent
5410061f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
5 deletions
src/views/Home.vue
src/views/Home.vue
View file @
f35b59a
...
...
@@ -5,20 +5,52 @@
</
template
>
<
script
>
export
default
{
components
:
{},
data
()
{
return
{
viewer
:
undefined
,
entity
:
undefined
,
}
},
mounted
()
{
Cesium
.
Ion
.
defaultAccessToken
=
this
.
config
.
mapToken
;
var
viewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
fullscreenButton
:
true
,
this
.
viewer
=
new
Cesium
.
Viewer
(
'cesiumContainer'
,
{
geocoder
:
true
,
timeline
:
false
});
this
.
viewer
.
imageryLayers
.
addImageryProvider
(
new
Cesium
.
UrlTemplateImageryProvider
({
url
:
"https://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali"
}));
let
tileset
=
new
Cesium
.
Cesium3DTileset
({
url
:
'http://localhost:9000/model/e44fe150d09b11eaabec1d24e8548b3a/tileset.json'
,
skipLevelOfDetail
:
true
,
baseScreenSpaceError
:
1024
,
skipScreenSpaceErrorFactor
:
16
,
skipLevels
:
1
,
immediatelyLoadDesiredLevelOfDetail
:
false
,
loadSiblings
:
false
,
cullWithChildrenBounds
:
true
}),
height
=
-
2440
;
this
.
viewer
.
scene
.
primitives
.
add
(
tileset
);
tileset
.
readyPromise
.
then
(
argument
=>
{
var
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
tileset
.
boundingSphere
.
center
);
var
surface
=
Cesium
.
Cartesian3
.
fromRadians
(
cartographic
.
longitude
,
cartographic
.
latitude
,
cartographic
.
height
);
var
offset
=
Cesium
.
Cartesian3
.
fromRadians
(
cartographic
.
longitude
,
cartographic
.
latitude
,
cartographic
.
height
+
height
);
var
translation
=
Cesium
.
Cartesian3
.
subtract
(
offset
,
surface
,
new
Cesium
.
Cartesian3
());
tileset
.
modelMatrix
=
Cesium
.
Matrix4
.
fromTranslation
(
translation
);
this
.
viewer
.
zoomTo
(
tileset
);
});
},
methods
:
{
...
...
Please
register
or
sign in
to post a comment