|
|
|
@ -10,6 +10,7 @@
|
|
|
|
|
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
|
|
|
|
|
<title>广州飞行情报区ZGZU</title>
|
|
|
|
|
<script src="/Cesium/Cesium.js"></script>
|
|
|
|
|
<script src="/Public/js/jquery-1.10.2.min.js"></script>
|
|
|
|
|
<style>
|
|
|
|
|
@import url(/Cesium/Widgets/widgets.css);
|
|
|
|
|
|
|
|
|
@ -26,18 +27,123 @@
|
|
|
|
|
.cesium-viewer-geocoderContainer,
|
|
|
|
|
.cesium-home-button,
|
|
|
|
|
.cesium-sceneModePicker-wrapper,
|
|
|
|
|
.cesium-navigationHelpButton-wrapper {
|
|
|
|
|
.cesium-navigationHelpButton-wrapper,
|
|
|
|
|
.cesium-toolbar-button{
|
|
|
|
|
display: none !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cesium-viewer-bottom {
|
|
|
|
|
display: none
|
|
|
|
|
}
|
|
|
|
|
.ol-popup {
|
|
|
|
|
position: absolute;
|
|
|
|
|
padding:0 15px 15px;
|
|
|
|
|
background-color: white;
|
|
|
|
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
border: 1px solid #cccccc;
|
|
|
|
|
top: -1000px;
|
|
|
|
|
min-width: 150px;
|
|
|
|
|
max-width: 300px;
|
|
|
|
|
z-index: 999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ol-popup:after,
|
|
|
|
|
.ol-popup:before {
|
|
|
|
|
top: 100%;
|
|
|
|
|
border: solid transparent;
|
|
|
|
|
content: " ";
|
|
|
|
|
height: 0;
|
|
|
|
|
width: 0;
|
|
|
|
|
position: absolute;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ol-popup:after {
|
|
|
|
|
border-top-color: white;
|
|
|
|
|
border-width: 10px;
|
|
|
|
|
left: 48px;
|
|
|
|
|
margin-left: -10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ol-popup:before {
|
|
|
|
|
border-top-color: #cccccc;
|
|
|
|
|
border-width: 11px;
|
|
|
|
|
left: 48px;
|
|
|
|
|
margin-left: -11px;
|
|
|
|
|
}
|
|
|
|
|
.popup-title{
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
padding:5px 0 ;
|
|
|
|
|
font-weight:border;
|
|
|
|
|
border-bottom:1px solid #5084c2;
|
|
|
|
|
}
|
|
|
|
|
.ol-popup-closer {
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 2px;
|
|
|
|
|
right: 8px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ol-popup-closer:hover {
|
|
|
|
|
color: orange;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ol-popup-closer:after {
|
|
|
|
|
content: "✖";
|
|
|
|
|
}
|
|
|
|
|
.popup-list{
|
|
|
|
|
margin:7px 0;
|
|
|
|
|
}
|
|
|
|
|
.popup-label{
|
|
|
|
|
float:left;
|
|
|
|
|
}
|
|
|
|
|
.popup-con p{
|
|
|
|
|
margin:0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="cesiumContainer"></div>
|
|
|
|
|
<div id="popup" class="ol-popup">
|
|
|
|
|
<a id="popup-closer" class="ol-popup-closer"></a>
|
|
|
|
|
<div class="popup-title">漳州</div>
|
|
|
|
|
<div id="popup-content" class="popup-content">
|
|
|
|
|
<div class="popup-list">
|
|
|
|
|
<label class="popup-label">行政区划:</label>
|
|
|
|
|
<div class="popup-con">
|
|
|
|
|
<p>漳州市下辖芗城区、龙文区、龙海市、云霄县、漳浦县、诏安县、长泰县、东山县、南靖县、平和县、华安县。行政区划较为复杂,市域范围广泛</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="popup-list">
|
|
|
|
|
<label class="popup-label">总 面 积:</label>
|
|
|
|
|
<div class="popup-con">
|
|
|
|
|
<p>12,600平方公里(12,688平方公里)</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="popup-list">
|
|
|
|
|
<label class="popup-label">常住人口:</label>
|
|
|
|
|
<div class="popup-con">
|
|
|
|
|
<p>约为4,812,700人</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="popup-list">
|
|
|
|
|
<label class="popup-label">户籍人口:</label>
|
|
|
|
|
<div class="popup-con">
|
|
|
|
|
<p>约为4,850,000人</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<script>
|
|
|
|
|
var popup = $('#popup');
|
|
|
|
|
|
|
|
|
|
// 假设你有一个函数来确定弹窗的位置
|
|
|
|
|
function showPopupAtPosition(position) {
|
|
|
|
|
console.log(111)
|
|
|
|
|
$('#popup').show();
|
|
|
|
|
};
|
|
|
|
|
const czml = [{
|
|
|
|
|
id: "document",
|
|
|
|
|
name: "CZML Point",
|
|
|
|
@ -382,7 +488,84 @@
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var viewer = new Cesium.Viewer("cesiumContainer");
|
|
|
|
|
|
|
|
|
|
const container = document.getElementById("popup");
|
|
|
|
|
const content = document.getElementById("popup-content");
|
|
|
|
|
const closer = document.getElementById("popup-closer");
|
|
|
|
|
|
|
|
|
|
let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
|
|
|
|
let cartesian = null;
|
|
|
|
|
handler.setInputAction(e => {
|
|
|
|
|
let pick = viewer.scene.pick(e.position);
|
|
|
|
|
if (Cesium.defined(pick)) {
|
|
|
|
|
// let { name, adcode } = pick.id.properties.getValue()
|
|
|
|
|
// content.innerHTML = `
|
|
|
|
|
// <div>name:${name}</div>
|
|
|
|
|
// <div>adcode:${adcode}</div>
|
|
|
|
|
// `
|
|
|
|
|
if(pick.id.name == "漳州机场"){
|
|
|
|
|
let ray = viewer.camera.getPickRay(e.position);
|
|
|
|
|
cartesian = viewer.scene.globe.pick(ray, viewer.scene);
|
|
|
|
|
|
|
|
|
|
container.style.visibility = "visible"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
container.style.visibility = "hidden"
|
|
|
|
|
cartesian = null;
|
|
|
|
|
}
|
|
|
|
|
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
|
|
|
|
|
|
|
|
|
//1、实时更新位置。2、解决滚动不隐藏问题
|
|
|
|
|
viewer.scene.postRender.addEventListener(() => {
|
|
|
|
|
if (!cartesian) return
|
|
|
|
|
//保证弹窗可以随着地球的转动而转动
|
|
|
|
|
let windowPosition = Cesium.SceneTransforms.wgs84ToWindowCoordinates(viewer.scene, cartesian);
|
|
|
|
|
container.style.left = windowPosition.x - 48 + "px"
|
|
|
|
|
container.style.top = windowPosition.y - 88 + "px"
|
|
|
|
|
|
|
|
|
|
// 相机高度
|
|
|
|
|
let camera_height = viewer.camera.positionCartographic.height;
|
|
|
|
|
// 相机高度+地球最大半径
|
|
|
|
|
let height_total = camera_height + viewer.scene.globe.ellipsoid.maximumRadius
|
|
|
|
|
// 实体和相机之间的距离
|
|
|
|
|
let distance_camera_entity = Cesium.Cartesian3.distance(viewer.camera.position, cartesian)
|
|
|
|
|
|
|
|
|
|
if (((distance_camera_entity < height_total)) && camera_height < 50000000) {
|
|
|
|
|
container.style.visibility = "visible"
|
|
|
|
|
} else {
|
|
|
|
|
container.style.visibility = "hidden"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
closer.onclick = () => {
|
|
|
|
|
container.style.visibility = "hidden"
|
|
|
|
|
cartesian = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 改变鼠标样式
|
|
|
|
|
handler.setInputAction((e) => {
|
|
|
|
|
let pick = viewer.scene.pick(e.endPosition);
|
|
|
|
|
if (Cesium.defined(pick)) {
|
|
|
|
|
viewer._container.style.cursor = "pointer"
|
|
|
|
|
} else {
|
|
|
|
|
viewer._container.style.cursor = ""
|
|
|
|
|
}
|
|
|
|
|
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
|
|
|
|
|
// 天地图
|
|
|
|
|
var webKey = "72e2e7be836401af7e79c232285a552e";
|
|
|
|
|
viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
|
|
|
|
|
url: "http://t0.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk="+webKey,
|
|
|
|
|
layer: "tdtVecBasicLayer",
|
|
|
|
|
style: "default",
|
|
|
|
|
format: "image/jpeg",
|
|
|
|
|
tileMatrixSetID: "GoogleMapsCompatible",
|
|
|
|
|
show: false
|
|
|
|
|
}));
|
|
|
|
|
// 假设已经有一个Cesium.Viewer实例叫做`viewer`
|
|
|
|
|
viewer.camera.setView({
|
|
|
|
|
destination: Cesium.Cartesian3.fromDegrees(116.46, 39.92, 10000000.0),
|
|
|
|
@ -495,7 +678,7 @@
|
|
|
|
|
height: 30,
|
|
|
|
|
// distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000),
|
|
|
|
|
// 是否显示
|
|
|
|
|
show: true
|
|
|
|
|
show: true,
|
|
|
|
|
},
|
|
|
|
|
label: {
|
|
|
|
|
text: "漳州",
|
|
|
|
@ -783,11 +966,11 @@
|
|
|
|
|
viewer.zoomTo(billboard);
|
|
|
|
|
viewer.zoomTo(polyline01);
|
|
|
|
|
|
|
|
|
|
viewer.zoomTo(viewer.entities);
|
|
|
|
|
const dataSourcePromise = Cesium.CzmlDataSource.load(czml);
|
|
|
|
|
viewer.dataSources.add(dataSourcePromise);
|
|
|
|
|
viewer.zoomTo(dataSourcePromise);
|
|
|
|
|
viewer.baseLayerPicker.viewModel.selectedImagery = viewer.baseLayerPicker.viewModel.imageryProviderViewModels[4];
|
|
|
|
|
viewer.zoomTo(viewer.entities);
|
|
|
|
|
// viewer.baseLayerPicker.viewModel.selectedImagery = viewer.baseLayerPicker.viewModel.imageryProviderViewModels[4];
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|