Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cesium-frame
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jlc
cesium-frame
Commits
d1626de2
Commit
d1626de2
authored
Aug 01, 2024
by
jlc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:代码结构修改
parent
59d0a0eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
172 additions
and
167 deletions
+172
-167
addStation.vue
src/examples/measureStation/addStation/addStation.vue
+11
-10
stationCoordinate-function.js
...reStation/stationCoordinate/stationCoordinate-function.js
+119
-136
stationCoordinate.vue
...es/measureStation/stationCoordinate/stationCoordinate.vue
+42
-21
No files found.
src/examples/measureStation/addStation/addStation.vue
View file @
d1626de2
<
template
>
<
template
>
<div
id=
"cesiumContainer"
class=
"cesium-container"
></div>
<div
id=
"cesiumContainer"
class=
"cesium-container"
></div>
</
template
>
</
template
>
<
script
setup
>
<
script
setup
>
import
{
onMounted
}
from
'vue'
;
import
{
onMounted
}
from
'vue'
;
import
{
addStation
}
from
'./function'
;
import
{
addStation
}
from
'./function'
;
let
viewer
;
let
viewer
;
onMounted
(()
=>
{
onMounted
(()
=>
{
const
script
=
document
.
createElement
(
'script'
);
const
script
=
document
.
createElement
(
'script'
);
script
.
src
=
'https://cesium.com/downloads/cesiumjs/releases/1.99/Build/Cesium/Cesium.js'
;
script
.
src
=
'https://cesium.com/downloads/cesiumjs/releases/1.99/Build/Cesium/Cesium.js'
;
...
@@ -21,25 +23,24 @@ onMounted(() => {
...
@@ -21,25 +23,24 @@ onMounted(() => {
id
:
'site'
,
id
:
'site'
,
position
:
[
20
,
20
,
250
],
position
:
[
20
,
20
,
250
],
ellipsoid
:
{
ellipsoid
:
{
radii
:
[
50000
,
50000
,
50000
],
radii
:
[
50000
,
50000
,
50000
],
innerRadii
:[
1
,
1
,
1
],
innerRadii
:[
1
,
1
,
1
],
minimumClock
:
45
,
minimumClock
:
45
,
maximumClock
:
90
,
maximumClock
:
90
,
minimumCone
:
45
,
minimumCone
:
45
,
maximumCone
:
75
,
maximumCone
:
75
,
outline
:
false
,
outline
:
false
,
fill
:
true
,
fill
:
true
,
},
},
label
:
{
label
:
{
text
:
''
text
:
''
},
},
}
}
addStation
(
viewer
,
siteInfo
)
addStation
(
viewer
,
siteInfo
)
};
};
document
.
head
.
appendChild
(
script
);
document
.
head
.
appendChild
(
script
);
const
link
=
document
.
createElement
(
'link'
);
const
link
=
document
.
createElement
(
'link'
);
link
.
rel
=
'stylesheet'
;
link
.
rel
=
'stylesheet'
;
link
.
href
=
'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Widgets/widgets.css'
;
link
.
href
=
'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Widgets/widgets.css'
;
...
...
src/examples/measureStation/stationCoordinate/stationCoordinate-function.js
View file @
d1626de2
export
function
addStationCoordinate
(
info
)
{
export
function
addStationCoordinate
(
viewer
,
info
)
{
const
script
=
document
.
createElement
(
'script'
);
const
SITE
=
{
script
.
src
=
'https://cesium.com/downloads/cesiumjs/releases/1.99/Build/Cesium/Cesium.js'
;
id
:
null
,
script
.
onload
=
()
=>
{
show
:
true
,
window
.
Cesium
.
Ion
.
defaultAccessToken
=
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3Njg4ZWU5Yi1iZDhiLTRhYmUtOTRiYS04YjM5NmUwNjVmMDMiLCJpZCI6MjI3MzQ3LCJpYXQiOjE3MjA1MjA4Mjh9.E5XW4LnwgfVAaBC-znaYr61m4yK0-j2qEQhi9qwFFPE'
ellipsoid
:
{
show
:
true
,
heightReference
:
undefined
,
radii
:
null
,
innerRadii
:
null
,
minimumClock
:
0.0
,
maximumClock
:
2
*
Cesium
.
Math
.
PI
,
minimumCone
:
0.0
,
maximumCone
:
Cesium
.
Math
.
PI
,
fill
:
true
,
material
:
Cesium
.
Color
.
RED
.
withAlpha
(
0.3
),
outline
:
false
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
1.0
,
stackPartitions
:
8
,
slicePartitions
:
8
,
subdivisions
:
128
,
shadows
:
undefined
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0.0
,
200000.0
),
},
model
:
{
show
:
true
,
uri
:
'https://raw.githubusercontent.com/jinlinchao123/Cesium-assets/main/3Dmodel/Station.glb'
,
scale
:
1
,
minimumPixelSize
:
30
,
maximumScale
:
500
,
incrementallyLoadTextures
:
true
,
runAnimations
:
true
,
clampAnimations
:
true
,
shadows
:
Cesium
.
ShadowMode
.
ENABLED
,
heightReference
:
Cesium
.
HeightReference
.
CLAMP_TO_GROUND
,
silhouetteColor
:
Cesium
.
Color
.
RED
,
silhouetteSize
:
0.0
,
color
:
Cesium
.
Color
.
WHITE
,
colorBlendMode
:
Cesium
.
ColorBlendMode
.
HIGHLIGHT
,
colorBlendAmount
:
0.5
,
imageBasedLightingFactor
:
new
Cesium
.
Cartesian2
(
1.0
,
1.0
),
lightColor
:
undefined
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0.0
,
250000.0
),
nodeTransformations
:
undefined
,
articulations
:
undefined
,
clippingPlanes
:
undefined
,
},
label
:
{
show
:
true
,
text
:
null
,
font
:
'30px sans-serif'
,
style
:
Cesium
.
LabelStyle
.
FILL
,
scale
:
0.5
,
showBackground
:
false
,
backgroundColor
:
new
Cesium
.
Color
(
0.165
,
0.165
,
0.165
,
0.8
),
backgroundPadding
:
new
Cesium
.
Cartesian2
(
7
,
5
),
pixelOffset
:
new
Cesium
.
Cartesian2
(
15
,
0
),
eyeOffset
:
Cesium
.
Cartesian3
.
ZERO
,
horizontalOrigin
:
Cesium
.
HorizontalOrigin
.
LEFT
,
verticalOrigin
:
Cesium
.
VerticalOrigin
.
TOP
,
heightReference
:
Cesium
.
HeightReference
.
NONE
,
fillColor
:
Cesium
.
Color
.
WHITE
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
1.0
,
translucencyByDistance
:
null
,
pixelOffsetScaleByDistance
:
null
,
scaleByDistance
:
null
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0.0
,
250000.0
),
disableDepthTestDistance
:
null
,
},
point
:
{
id
:
null
,
show
:
true
,
pixelSize
:
10
,
heightReference
:
Cesium
.
HeightReference
.
NONE
,
color
:
Cesium
.
Color
.
RED
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
0
,
scaleByDistance
:
undefined
,
translucencyByDistance
:
undefined
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
250000.0
,
99999999999999
),
disableDepthTestDistance
:
undefined
,
}
}
const
viewer
=
new
window
.
Cesium
.
Viewer
(
'cesiumContainer'
,
{
let
{
id
,
position
}
=
{
...
SITE
,
...
info
}
infoBox
:
false
,
let
{
...
label
}
=
{
...
SITE
.
label
,
...
info
.
label
}
shouldAnimate
:
true
let
{
...
ellipsoid
}
=
{
...
SITE
.
ellipsoid
,
...
info
.
ellipsoid
}
});
let
{
...
model
}
=
{
...
SITE
.
model
,
...
info
.
model
}
let
{...
point
}
=
{...
SITE
.
point
,...
info
.
point
}
const
SITE
=
{
ellipsoid
.
radii
=
new
Cesium
.
Cartesian3
(...
ellipsoid
.
radii
)
id
:
null
,
ellipsoid
.
innerRadii
=
new
Cesium
.
Cartesian3
(...
ellipsoid
.
innerRadii
)
show
:
true
,
ellipsoid
.
minimumClock
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
minimumClock
)
ellipsoid
:
{
ellipsoid
.
maximumClock
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
maximumClock
)
show
:
true
,
ellipsoid
.
minimumCone
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
minimumCone
)
heightReference
:
undefined
,
ellipsoid
.
maximumCone
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
maximumCone
)
radii
:
null
,
label
.
text
=
`
${
id
}
`
innerRadii
:
null
,
let
site
=
viewer
.
entities
.
add
({
minimumClock
:
0.0
,
id
:
id
,
maximumClock
:
2
*
Cesium
.
Math
.
PI
,
position
:
Cesium
.
Cartesian3
.
fromDegrees
(...
position
),
minimumCone
:
0.0
,
label
:
label
,
maximumCone
:
Cesium
.
Math
.
PI
,
ellipsoid
:
ellipsoid
,
fill
:
true
,
model
:
model
,
material
:
Cesium
.
Color
.
RED
.
withAlpha
(
0.3
),
point
:
point
,
outline
:
false
,
})
outlineColor
:
Cesium
.
Color
.
BLACK
,
viewer
.
zoomTo
(
site
).
then
(()
=>
{
outlineWidth
:
1.0
,
viewer
.
trackedEntity
=
site
;
stackPartitions
:
8
,
let
matrix
=
site
.
computeModelMatrix
(
Cesium
.
JulianDate
.
fromIso8601
(
'2019-08-28T04:00:00.00Z'
));
slicePartitions
:
8
,
// 通过调试的实体来绘制模型坐标轴
subdivisions
:
128
,
viewer
.
scene
.
primitives
.
add
(
shadows
:
undefined
,
new
Cesium
.
DebugModelMatrixPrimitive
({
// 加载模型偏移矩阵的图元
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0.0
,
200000.0
),
modelMatrix
:
matrix
,
// 设置偏移矩阵
},
length
:
100000
,
model
:
{
width
:
10
show
:
true
,
})
uri
:
'https://raw.githubusercontent.com/jinlinchao123/Cesium-assets/main/3Dmodel/Station.glb'
,
);
scale
:
1
,
}).
catch
(
error
=>
{
minimumPixelSize
:
30
,
console
.
error
(
'Failed to zoom to entity:'
,
error
);
maximumScale
:
500
,
});
incrementallyLoadTextures
:
true
,
runAnimations
:
true
,
clampAnimations
:
true
,
shadows
:
Cesium
.
ShadowMode
.
ENABLED
,
heightReference
:
Cesium
.
HeightReference
.
CLAMP_TO_GROUND
,
silhouetteColor
:
Cesium
.
Color
.
RED
,
silhouetteSize
:
0.0
,
color
:
Cesium
.
Color
.
WHITE
,
colorBlendMode
:
Cesium
.
ColorBlendMode
.
HIGHLIGHT
,
colorBlendAmount
:
0.5
,
imageBasedLightingFactor
:
new
Cesium
.
Cartesian2
(
1.0
,
1.0
),
lightColor
:
undefined
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0.0
,
250000.0
),
nodeTransformations
:
undefined
,
articulations
:
undefined
,
clippingPlanes
:
undefined
,
},
label
:
{
show
:
true
,
text
:
null
,
font
:
'30px sans-serif'
,
style
:
Cesium
.
LabelStyle
.
FILL
,
scale
:
0.5
,
showBackground
:
false
,
backgroundColor
:
new
Cesium
.
Color
(
0.165
,
0.165
,
0.165
,
0.8
),
backgroundPadding
:
new
Cesium
.
Cartesian2
(
7
,
5
),
pixelOffset
:
new
Cesium
.
Cartesian2
(
15
,
0
),
eyeOffset
:
Cesium
.
Cartesian3
.
ZERO
,
horizontalOrigin
:
Cesium
.
HorizontalOrigin
.
LEFT
,
verticalOrigin
:
Cesium
.
VerticalOrigin
.
TOP
,
heightReference
:
Cesium
.
HeightReference
.
NONE
,
fillColor
:
Cesium
.
Color
.
WHITE
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
1.0
,
translucencyByDistance
:
null
,
pixelOffsetScaleByDistance
:
null
,
scaleByDistance
:
null
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
0.0
,
250000.0
),
disableDepthTestDistance
:
null
,
},
point
:
{
id
:
null
,
show
:
true
,
pixelSize
:
10
,
heightReference
:
Cesium
.
HeightReference
.
NONE
,
color
:
Cesium
.
Color
.
RED
,
outlineColor
:
Cesium
.
Color
.
BLACK
,
outlineWidth
:
0
,
scaleByDistance
:
undefined
,
translucencyByDistance
:
undefined
,
distanceDisplayCondition
:
new
Cesium
.
DistanceDisplayCondition
(
250000.0
,
99999999999999
),
disableDepthTestDistance
:
undefined
,
}
}
let
{
id
,
position
}
=
{
...
SITE
,
...
info
}
let
{
...
label
}
=
{
...
SITE
.
label
,
...
info
.
label
}
let
{
...
ellipsoid
}
=
{
...
SITE
.
ellipsoid
,
...
info
.
ellipsoid
}
let
{
...
model
}
=
{
...
SITE
.
model
,
...
info
.
model
}
let
{...
point
}
=
{...
SITE
.
point
,...
info
.
point
}
ellipsoid
.
radii
=
new
Cesium
.
Cartesian3
(...
ellipsoid
.
radii
)
ellipsoid
.
innerRadii
=
new
Cesium
.
Cartesian3
(...
ellipsoid
.
innerRadii
)
ellipsoid
.
minimumClock
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
minimumClock
)
ellipsoid
.
maximumClock
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
maximumClock
)
ellipsoid
.
minimumCone
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
minimumCone
)
ellipsoid
.
maximumCone
=
Cesium
.
Math
.
toRadians
(
ellipsoid
.
maximumCone
)
label
.
text
=
`
${
id
}
`
let
site
=
viewer
.
entities
.
add
({
id
:
id
,
position
:
Cesium
.
Cartesian3
.
fromDegrees
(...
position
),
label
:
label
,
ellipsoid
:
ellipsoid
,
model
:
model
,
point
:
point
,
})
viewer
.
zoomTo
(
site
).
then
(()
=>
{
viewer
.
trackedEntity
=
site
;
let
matrix
=
site
.
computeModelMatrix
(
Cesium
.
JulianDate
.
fromIso8601
(
'2019-08-28T04:00:00.00Z'
));
// 通过调试的实体来绘制模型坐标轴
viewer
.
scene
.
primitives
.
add
(
new
Cesium
.
DebugModelMatrixPrimitive
({
// 加载模型偏移矩阵的图元
modelMatrix
:
matrix
,
// 设置偏移矩阵
length
:
100000
,
width
:
10
})
);
}).
catch
(
error
=>
{
console
.
error
(
'Failed to zoom to entity:'
,
error
);
});
};
document
.
head
.
appendChild
(
script
);
const
link
=
document
.
createElement
(
'link'
);
link
.
rel
=
'stylesheet'
;
link
.
href
=
'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Widgets/widgets.css'
;
document
.
head
.
appendChild
(
link
);
}
}
\ No newline at end of file
src/examples/measureStation/stationCoordinate/stationCoordinate.vue
View file @
d1626de2
<
template
>
<
template
>
<div
id=
"cesiumContainer"
class=
"cesium-container"
></div>
<div
id=
"cesiumContainer"
class=
"cesium-container"
></div>
</
template
>
</
template
>
<
script
setup
>
<
script
setup
>
import
{
onMounted
}
from
'vue'
;
import
{
onMounted
}
from
'vue'
;
import
{
addStationCoordinate
}
from
'./function'
;
import
{
addStationCoordinate
}
from
'./function'
;
let
viewer
;
onMounted
(()
=>
{
onMounted
(()
=>
{
let
siteInfo
=
{
const
script
=
document
.
createElement
(
'script'
);
id
:
'site'
,
script
.
src
=
'https://cesium.com/downloads/cesiumjs/releases/1.99/Build/Cesium/Cesium.js'
;
position
:
[
20
,
20
,
250
],
script
.
onload
=
()
=>
{
ellipsoid
:
{
window
.
Cesium
.
Ion
.
defaultAccessToken
=
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3Njg4ZWU5Yi1iZDhiLTRhYmUtOTRiYS04YjM5NmUwNjVmMDMiLCJpZCI6MjI3MzQ3LCJpYXQiOjE3MjA1MjA4Mjh9.E5XW4LnwgfVAaBC-znaYr61m4yK0-j2qEQhi9qwFFPE'
radii
:
[
50000
,
50000
,
50000
],
innerRadii
:[
1
,
1
,
1
],
viewer
=
new
window
.
Cesium
.
Viewer
(
'cesiumContainer'
,
{
minimumClock
:
45
,
infoBox
:
false
,
maximumClock
:
90
,
shouldAnimate
:
true
minimumCone
:
45
,
});
maximumCone
:
75
,
outline
:
false
,
let
siteInfo
=
{
fill
:
true
,
id
:
'site'
,
},
position
:
[
20
,
20
,
250
],
ellipsoid
:
{
label
:
{
radii
:
[
50000
,
50000
,
50000
],
text
:
''
innerRadii
:[
1
,
1
,
1
],
},
minimumClock
:
45
,
}
maximumClock
:
90
,
addStationCoordinate
(
siteInfo
)
minimumCone
:
45
,
maximumCone
:
75
,
outline
:
false
,
fill
:
true
,
},
label
:
{
text
:
''
},
}
addStationCoordinate
(
viewer
,
siteInfo
)
};
document
.
head
.
appendChild
(
script
);
const
link
=
document
.
createElement
(
'link'
);
link
.
rel
=
'stylesheet'
;
link
.
href
=
'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Widgets/widgets.css'
;
document
.
head
.
appendChild
(
link
);
});
});
</
script
>
</
script
>
<
style
>
<
style
>
.cesium-container
{
.cesium-container
{
width
:
100%
;
width
:
100%
;
height
:
100vh
;
height
:
100vh
;
}
}
</
style
>
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment