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
a6970079
authored
2020-08-12 16:51:57 +0800
by
jikai
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
111111
1 parent
25c26130
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
25 deletions
src/assets/js/map/flood.js
src/assets/js/map/shadow.js
src/assets/js/map/viewpoint.js
src/assets/js/map/visual.js
src/assets/js/map/flood.js
View file @
a697007
import
objectManage
from
'./maputils'
;
export
default
class
flood
{
constructor
(
viewer
)
{
constructor
()
{
this
.
positions2d
=
[];
this
.
handlerPolygon
=
new
Cesium
.
DrawHandler
(
viewer
,
Cesium
.
DrawMode
.
Polygon
);
this
.
handlerPolygon
=
new
Cesium
.
DrawHandler
(
objectManage
.
viewer
,
Cesium
.
DrawMode
.
Polygon
);
this
.
handlerPolygon
.
drawEvt
.
addEventListener
(
polygon
=>
{
var
array
=
[].
concat
(
polygon
.
object
.
positions
),
positions
=
[];
for
(
var
i
=
0
,
len
=
array
.
length
;
i
<
len
;
i
++
){
...
...
src/assets/js/map/shadow.js
View file @
a697007
import
objectManage
from
'./maputils'
;
export
default
class
shadow
{
constructor
()
{
this
.
points
=
[];
this
.
shadowQuery
=
new
Cesium
.
ShadowQueryPoints
(
objectManage
.
viewer
.
scene
);
this
.
shadowQuery
.
build
();
this
.
setCurrentTime
();
this
.
init
();
}
setCurrentTime
()
{
objectManage
.
viewer
.
clock
.
currentTime
=
Cesium
.
JulianDate
.
fromDate
(
new
Date
());
let
d
=
new
Date
();
d
.
setHours
(
20
)
objectManage
.
viewer
.
clock
.
currentTime
=
Cesium
.
JulianDate
.
fromDate
(
d
);
objectManage
.
viewer
.
clock
.
multiplier
=
1
;
objectManage
.
viewer
.
clock
.
shouldAnimate
=
true
;
}
init
()
{
this
.
handlerPolygon
=
new
Cesium
.
DrawHandler
(
objectManage
.
viewer
,
Cesium
.
DrawMode
.
Polygon
,
0
);
this
.
tooltip
=
this
.
createTooltip
(
document
.
body
);
this
.
points
=
[]
;
this
.
handlerPolygon
=
new
Cesium
.
DrawHandler
(
objectManage
.
viewer
,
Cesium
.
DrawMode
.
Polygon
,
0
)
;
this
.
handlerPolygon
.
activeEvt
.
addEventListener
(
a
=>
{
let
body
=
$
(
'body'
).
removeClass
(
'measureCur'
);
a
&&
body
.
addClass
(
'measureCur'
);
...
...
src/assets/js/map/viewpoint.js
View file @
a697007
import
objectManage
from
'./maputils'
;
export
default
class
viewpoint
{
constructor
(
viewer
)
{
this
.
viewer
=
viewer
;
this
.
sightline
=
new
Cesium
.
Sightline
(
viewer
.
scene
);
constructor
()
{
this
.
sightline
=
new
Cesium
.
Sightline
(
objectManage
.
viewer
.
scene
);
this
.
sightline
.
couldRemove
=
false
;
this
.
sightline
.
build
();
this
.
handlerPoint
=
new
Cesium
.
DrawHandler
(
viewer
,
Cesium
.
DrawMode
.
Point
);
this
.
handlerPoint
=
new
Cesium
.
DrawHandler
(
objectManage
.
viewer
,
Cesium
.
DrawMode
.
Point
);
this
.
handlerPoint
.
drawEvt
.
addEventListener
(
result
=>
{
var
point
=
result
.
object
;
point
.
show
=
false
;
...
...
@@ -14,9 +15,9 @@ export default class viewpoint {
var
longitude
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
longitude
);
var
latitude
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
latitude
);
var
height
=
cartographic
.
height
;
if
(
viewer
.
scene
.
viewFlag
)
{
if
(
objectManage
.
viewer
.
scene
.
viewFlag
)
{
this
.
sightline
.
viewPosition
=
[
longitude
,
latitude
,
height
];
viewer
.
scene
.
viewFlag
=
false
;
objectManage
.
viewer
.
scene
.
viewFlag
=
false
;
this
.
addPoint
();
}
else
{
this
.
sightline
.
addTargetPoint
({
...
...
@@ -29,13 +30,13 @@ export default class viewpoint {
}
chooseView
()
{
if
(
this
.
handlerPoint
.
active
)
return
;
this
.
viewer
.
scene
.
viewFlag
=
true
;
this
.
viewer
.
entities
.
removeAll
();
objectManage
.
viewer
.
scene
.
viewFlag
=
true
;
objectManage
.
viewer
.
entities
.
removeAll
();
this
.
sightline
.
removeAllTargetPoint
();
this
.
handlerPoint
.
activate
();
}
addPoint
()
{
this
.
viewer
.
scene
.
viewFlag
=
false
;
objectManage
.
viewer
.
scene
.
viewFlag
=
false
;
this
.
handlerPoint
.
activate
();
}
}
\ No newline at end of file
...
...
src/assets/js/map/visual.js
View file @
a697007
import
objectManage
from
'./maputils'
;
export
default
class
visual
{
constructor
(
viewer
)
{
this
.
viewer
=
viewer
;
viewer
.
scene
.
viewFlag
=
true
;
this
.
pointHandler
=
new
Cesium
.
DrawHandler
(
viewer
,
Cesium
.
DrawMode
.
Point
);
this
.
viewshed3D
=
new
Cesium
.
ViewShed3D
(
viewer
.
scene
);
constructor
()
{
objectManage
.
viewer
.
scene
.
viewFlag
=
true
;
this
.
pointHandler
=
new
Cesium
.
DrawHandler
(
objectManage
.
viewer
,
Cesium
.
DrawMode
.
Point
);
this
.
viewshed3D
=
new
Cesium
.
ViewShed3D
(
objectManage
.
viewer
.
scene
);
this
.
viewPosition
;
this
.
viewModel
=
{
direction
:
1.0
,
...
...
@@ -15,7 +15,7 @@ export default class visual {
invisibleAreaColor
:
'#ffffffff'
};
Cesium
.
knockout
.
track
(
this
.
viewModel
);
this
.
init
(
viewer
.
scene
);
this
.
init
(
objectManage
.
viewer
.
scene
);
}
init
(
scene
)
{
this
.
handler
=
new
Cesium
.
ScreenSpaceEventHandler
(
scene
.
canvas
);
...
...
@@ -49,28 +49,29 @@ export default class visual {
this
.
pointHandler
.
drawEvt
.
addEventListener
(
result
=>
{
var
point
=
result
.
object
;
var
position
=
point
.
position
;
viewPosition
=
position
;
this
.
viewPosition
=
position
;
// 将获取的点的位置转化成经纬度
var
cartographic
=
Cesium
.
Cartographic
.
fromCartesian
(
position
);
var
longitude
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
longitude
);
var
latitude
=
Cesium
.
Math
.
toDegrees
(
cartographic
.
latitude
);
var
height
=
cartographic
.
height
+
1.8
;
point
.
position
=
Cesium
.
Cartesian3
.
fromDegrees
(
longitude
,
latitude
,
height
);
if
(
this
.
viewer
.
scene
.
viewFlag
)
{
if
(
objectManage
.
viewer
.
scene
.
viewFlag
)
{
// 设置视口位置
this
.
viewshed3D
.
viewPosition
=
[
longitude
,
latitude
,
height
];
this
.
viewshed3D
.
build
();
// 将标记置为false以激活鼠标移动回调里面的设置可视域操作
this
.
viewer
.
scene
.
viewFlag
=
false
;
objectManage
.
viewer
.
scene
.
viewFlag
=
false
;
}
});
this
.
chooseView
();
}
chooseView
()
{
if
(
this
.
pointHandler
.
active
)
return
;
//先清除之前的可视域分析
this
.
viewer
.
entities
.
removeAll
();
objectManage
.
viewer
.
entities
.
removeAll
();
this
.
viewshed3D
.
distance
=
0.1
;
this
.
viewer
.
scene
.
viewFlag
=
true
;
objectManage
.
viewer
.
scene
.
viewFlag
=
true
;
//激活绘制点类
this
.
pointHandler
.
activate
();
}
...
...
Please
register
or
sign in
to post a comment