123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <!-- 2017-12-4 14:24:10 | 修改 木遥(微信: http://marsgis.cn/weixin.html ) -->
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
- <meta name="apple-touch-fullscreen" content="yes" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <meta name="format-detection" content="telephone=no" />
- <meta name="x5-fullscreen" content="true" />
- <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
- <!-- 标题及搜索关键字 -->
- <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
- <meta
- name="description"
- content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型 gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包 地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
- />
- <link rel="shortcut icon" type="image/x-icon" href="" />
- <title>街景联动 </title>
- <script
- type="text/javascript"
- src="../lib/include-lib.js"
- libpath="../lib/"
- include="jquery,font-awesome,bootstrap,layer,haoutil,mars3d"
- ></script>
- <script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=qObioeG8HeeQVrOVAGScPVhDzlmv6rL9"></script>
- <link href="css/style.css" rel="stylesheet" />
- <style>
- #centerDiv {
- position: absolute;
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- margin: 0;
- padding: 0;
- }
- .stree {
- width: 100%;
- height: 100%;
- overflow: hidden;
- margin: 0;
- }
- #centerDiv3D {
- position: absolute;
- top: 0;
- right: 0;
- height: 100%;
- width: 100%;
- margin: 0;
- padding: 0;
- }
- .streetimg {
- position: absolute;
- right: 10px;
- top: 10px;
- height: 82px;
- width: 60px;
- background-color: rgba(0, 0, 0, 0.4);
- border: 1px solid rgba(128, 128, 128, 0.5);
- box-shadow: 0 3px 14px rgba(128, 128, 128, 0.5);
- }
- .icon {
- position: absolute;
- top: 10%;
- left: 34%;
- }
- .streetimg .text {
- display: block;
- margin-top: 48px;
- margin-left: 18px;
- }
- </style>
- </head>
- <body class="dark">
- <div id="centerDiv">
- <iframe id="streeScape" class="stree" src="./h10_streetview_baidu.html?lng=117.215219&lat=31.861592"></iframe>
- </div>
- <div id="centerDiv3D">
- <div id="mars3dContainer" class="mars3d-container"></div>
- </div>
- <!-- 面板 -->
- <div id="btnStreet" class="streetimg">
- <img id="imgIcon" class="icon" src="img/marker/street.png" alt="全景" />
- <p class="text">全景</p>
- </div>
- <div id="viewQH" class="infoview" style="left: 43%; top: 2px; display: none">
- <input type="button" class="btn btn-primary" value="分屏" onclick=" splitScreen();" />
- <input type="button" class="btn btn-primary" value="仅街景" onclick="streetscape();" />
- <input type="button" class="btn btn-primary" value="仅3D" onclick="viewTo3d();" />
- </div>
- <script src="./js/common.js"></script>
- <script type="text/javascript">
- "use script"; //开发环境建议开启严格模式
- var map;
- var tileLayer;
- var graphicLayer;
- function initMap(options) {
- //合并属性参数,可覆盖config.json中的对应配置
- var mapOptions = mars3d.Util.merge(options, {
- scene: {
- center: { lat: 31.676218, lng: 117.251248, alt: 27740, heading: 1, pitch: -63 },
- },
- control: {
- compass: { bottom: "320px", right: "5px" },
- },
- });
- //创建三维地球场景
- map = new mars3d.Map("mars3dContainer", mapOptions);
- map.basemap = "腾讯电子";
- //矢量图层数据
- graphicLayer = new mars3d.layer.GraphicLayer();
- map.addLayer(graphicLayer);
- //叠加的图层
- tileLayer = new mars3d.layer.BaiduLayer({
- layer: "streetview",
- show: false,
- });
- map.addLayer(tileLayer);
- splitScreen();
- //显示或影藏tileLayer图层
- $("#btnStreet").click(function () {
- if (markerStreet) {
- graphicLayer.removeGraphic(markerStreet, true);
- markerStreet = null;
- }
- if (tileLayer.show) {
- map.off(mars3d.EventType.click, onClickMap);
- tileLayer.show = false;
- if (typeView != 0) {
- viewTo3d();
- }
- $("#btnStreet").css("border", "1px solid rgba(128, 128, 128, 0.5)");
- $("#viewQH").hide();
- } else {
- tileLayer.show = true;
- $("#btnStreet").css("border", "4px solid rgba(54, 108, 179, 0.5)");
- $("#viewQH").show();
- graphicLayer.startDraw({
- type: "billboard",
- style: {
- image: "img/marker/street.png",
- horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
- label: {
- font_size: 30,
- color: "#ffffff",
- outline: true,
- outlineColor: "#000000",
- pixelOffsetY: -50,
- },
- },
- success: function (graphic) {
- markerStreet = graphic;
- },
- });
- map.on(mars3d.EventType.click, onClickMap);
- }
- });
- }
- let typeView = 0;
- //3d显示
- function viewTo3d() {
- typeView = 0;
- $("#centerDiv").hide();
- $("#centerDiv3D").css({ width: "100%" }).show();
- }
- //街景显示
- function streetscape() {
- typeView = 1;
- $("#centerDiv3D").hide();
- $("#centerDiv").css({ width: "100%" }).show();
- }
- //分屏显示
- function splitScreen() {
- typeView = 2;
- $("#centerDiv").css({ width: "50%" }).show();
- $("#centerDiv3D").css({ width: "50%" }).show();
- }
- function onClickMap(event) {
- let point = mars3d.LatLngPoint.fromCartesian(event.cartesian);
- let rightFrame = document.getElementById("streeScape");
- rightFrame.contentWindow.setPosition(point);
- if (typeView == 0) {
- streetscape();
- }
- }
- let markerStreet;
- function updateMarker(position) {
- if (markerStreet) {
- markerStreet.position = position;
- } else {
- markerStreet = new mars3d.graphic.BillboardEntity({
- position: position,
- style: {
- image: "img/marker/street.png",
- scale: 1,
- horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
- verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
- clampToGround: true,
- },
- });
- graphicLayer.addGraphic(markerStreet);
- }
- map.flyToGraphic(markerStreet, { radius: 800 });
- }
- </script>
- </body>
- </html>
|