Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Cesium
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
lyc
Cesium
Commits
1034f898
Commit
1034f898
authored
Jul 11, 2024
by
lyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
cd3d65b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
21 deletions
+87
-21
sector.vue
src/components/sector.vue
+87
-21
No files found.
src/components/sector.vue
View file @
1034f898
...
@@ -7,8 +7,10 @@
...
@@ -7,8 +7,10 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
onMounted
}
from
'vue'
import
{
onMounted
}
from
'vue'
import
*
as
Cesium
from
'cesium'
import
*
as
Cesium
from
'cesium'
import
Viewer
from
'cesium/Source/Widgets/Viewer/Viewer'
;
import
{
ref
}
from
'vue'
import
{
ref
}
from
'vue'
import
{
configProviderContextKey
}
from
'element-plus'
;
...
@@ -18,27 +20,86 @@ onMounted(() => {
...
@@ -18,27 +20,86 @@ onMounted(() => {
selectionIndicator
:
false
,
selectionIndicator
:
false
,
infoBox
:
false
,
infoBox
:
false
,
});
});
// const position = Cesium.Cartographic.fromCartesian(120, 20,2000)
function
draw_sector
(
point
,
angleone
,
angletwo
,
r
)
{
// const triangle =[]
console
.
log
(
angleone
,
angletwo
)
// triangle.push(position)
const
sector
=
viewer
.
entities
.
add
({
// const sector = viewer.entities.add({
name
:
"Wedge"
,
// position:position,
position
:
point
,
// polygon: {
ellipsoid
:
{
// hierarchy: new Cesium.PolygonHierarchy(arrow),
radii
:
new
Cesium
.
Cartesian3
(
r
,
r
,
1.0
),
// show: true,
minimumClock
:
Cesium
.
Math
.
toRadians
(
angleone
),
// fill: true,
maximumClock
:
Cesium
.
Math
.
toRadians
(
angletwo
),
// clampToGround: true,
material
:
Cesium
.
Color
.
DARKCYAN
.
withAlpha
(
0.3
),
// material: Cesium.Color.AQUA.withAlpha(0.9)
outline
:
false
,
// }
},
// });
});
const
polyline
=
viewer
.
entities
.
add
({
return
sector
id
:
'polyline'
,
polyline
:
{
}
positions
:
Cesium
.
Cartesian3
.
fromDegreesArray
([
120
,
20
,
121
,
20
,
121
,
20.5
,
122
,
22
,
120
,
20
]),
let
count
=
0
width
:
10
,
let
onepoint
material
:
Cesium
.
Color
.
YELLOW
let
twopoint
let
threepoint
const
handler
=
new
Cesium
.
ScreenSpaceEventHandler
(
viewer
.
canvas
);
handler
.
setInputAction
(
function
(
event
)
{
const
ray
=
viewer
.
camera
.
getPickRay
(
event
.
position
);
const
earthPosition
=
viewer
.
scene
.
globe
.
pick
(
ray
,
viewer
.
scene
);
let
angleone
let
angletwo
let
r
if
(
Cesium
.
defined
(
earthPosition
))
{
if
(
count
==
0
)
{
onepoint
=
earthPosition
;
count
=
count
+
1
}
else
if
(
count
==
1
)
{
twopoint
=
earthPosition
;
count
=
count
+
1
}
else
if
(
count
==
2
)
{
threepoint
=
earthPosition
;
count
=
count
+
1
}
if
(
count
==
3
)
{
angleone
=
computerJiao
(
onepoint
,
twopoint
)
angletwo
=
computerJiao
(
onepoint
,
threepoint
)
r
=
computerR
(
onepoint
,
twopoint
)
draw_sector
(
onepoint
,
angleone
,
angletwo
,
r
)
console
.
log
(
r
)
count
=
0
}
console
.
log
(
count
)
}
},
Cesium
.
ScreenSpaceEventType
.
LEFT_CLICK
);
function
computerJiao
(
point_one
,
point_two
)
{
let
one
=
Cesium
.
Cartographic
.
fromCartesian
(
point_one
)
let
two
=
Cesium
.
Cartographic
.
fromCartesian
(
point_two
)
let
onelon
=
Cesium
.
Math
.
toDegrees
(
one
.
longitude
)
let
onelat
=
Cesium
.
Math
.
toDegrees
(
one
.
latitude
)
let
twolon
=
Cesium
.
Math
.
toDegrees
(
two
.
longitude
)
let
twolat
=
Cesium
.
Math
.
toDegrees
(
two
.
latitude
)
let
jiaorad
=
Math
.
atan
(((
twolon
)
-
(
onelon
))
/
((
twolat
)
-
(
onelat
)))
let
jiao
=
jiaorad
*
(
180
/
Math
.
PI
)
return
jiao
}
function
computerR
(
point_one
,
point_two
)
{
let
one
=
Cesium
.
Cartographic
.
fromCartesian
(
point_one
)
let
two
=
Cesium
.
Cartographic
.
fromCartesian
(
point_two
)
let
onelon
=
Cesium
.
Math
.
toDegrees
(
one
.
longitude
)
let
onelat
=
Cesium
.
Math
.
toDegrees
(
one
.
latitude
)
let
twolon
=
Cesium
.
Math
.
toDegrees
(
two
.
longitude
)
let
twolat
=
Cesium
.
Math
.
toDegrees
(
two
.
latitude
)
let
chang
=
Math
.
abs
(
onelon
-
twolon
)
let
kuang
=
Math
.
abs
(
onelat
-
twolat
)
let
r
=
Math
.
sqrt
(
chang
*
chang
+
kuang
*
kuang
)
return
r
*
89990
}
}
})
...
@@ -46,6 +107,11 @@ onMounted(() => {
...
@@ -46,6 +107,11 @@ onMounted(() => {
// viewer.zoomTo(polygon)
...
...
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