顯示源代碼
                視角變換,跳轉(zhuǎn),相機(jī)操作
                 開發(fā)文檔
                            <!DOCTYPE html>
                
                <html>
                <head>
                    <meta charset='UTF-8'/>
                    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
                    <link  rel='stylesheet'/>
                    <script src='http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script>
                    <style>
                        body {
                            margin: 0;
                            padding: 0;
                        }
                
                        #container {
                            position: absolute;
                            top: 0;
                            bottom: 0;
                            width: 100%;
                        }
                         #toolbar select {
                            display: inline-block;
                            position: relative;
                            background: #303336;
                            border: 1px solid #444;
                            color: #edffff;
                            fill: #edffff;
                            border-radius: 4px;
                            padding: 5px 12px;
                            margin: 2px 3px;
                            cursor: pointer;
                            overflow: hidden;
                            -moz-user-select: none;
                            -webkit-user-select: none;
                            -ms-user-select: none;
                            user-select: none;
                        }
                        .bmgl-widget-credits{display:none}
                    </style>
                    <title>part_test</title>
                </head>
                <body>
                
                <div id='container'></div>
                <div id="toolbar">
                    <select data-bind="options: options, optionsText: '_text', value: selectedOption,optionsCaption: '選擇相機(jī)功能'"></select>
                </div>
                <script>
                    bmgl.Config.HTTP_URL = 'http://ua.bigemap.com:30081/bmsdk/';
                    var viewer = new bmgl.Viewer('container', {mapId: 'bigemap.dc-satellite'});
                    var viewModel, rotateEventListener, avaliableOptions,rotateTimer;
                
                    function opt(text, callback) {
                        this._text = text;
                        this._callback = callback
                    }
                
                    viewer.camera.moveStart.addEventListener(function () {
                        if (viewModel.checkCamera) {
                            viewModel.cameraEventInfo("視角變動(dòng)開始");
                        }
                    });
                    viewer.camera.moveEnd.addEventListener(function () {
                        if (viewModel.checkCamera) {
                            viewModel.cameraEventInfo("視角變動(dòng)結(jié)束");
                        }
                    });
                    viewer.camera.changed.addEventListener(function () {
                        var p=bmgl.Cartographic.fromCartesian(viewer.camera.position);
                        if(p.height<1200000){
                           if (rotateEventListener){
                               viewer.clock.onTick.removeEventListener(rotateEventListener);
                               rotateEventListener=null;
                           }
                        };
                    });
                    var flyToLocation = function () {
                        var options = {
                            enableHighAccuracy: true,
                            maximumAge: 1000
                        };
                        if (navigator.geolocation) {
                            navigator.geolocation.getCurrentPosition(fly, onError, options); //瀏覽器支持geolocation
                        } else {
                            //瀏覽器不支持geolocation
                        }
                
                        // Create callback for browser's geolocation
                        function fly(position) {
                            viewer.camera.flyTo({
                                destination: bmgl.Cartesian3.fromDegrees(position.coords.longitude, position.coords.latitude, 1000.0)
                            });
                        }
                
                        //失敗時(shí)
                        function onError(error) {
                            switch (error.code) {
                                case 1:
                                    alert("位置服務(wù)被拒絕");
                                    break;
                                case 2:
                                    alert("暫時(shí)獲取不到位置信息");
                                    break;
                                case 3:
                                    alert("獲取信息超時(shí)");
                                    break;
                                case 4:
                                    alert("未知錯(cuò)誤");
                                    break;
                            }
                        }
                    };
                
                    var flyToSanDiego = function () {
                        viewer.camera.flyTo({
                            destination: bmgl.Cartesian3.fromDegrees(-117.16, 32.71, 15000.0)
                        });
                    };
                
                    var flyToHeadingPitchRoll = function () {
                        viewer.camera.flyTo({
                            destination: bmgl.Cartesian3.fromDegrees(-122.22, 46.12, 5000.0),
                            orientation: {
                                /*弧度*/
                                heading: bmgl.Math.toRadians(20.0),
                                pitch: bmgl.Math.toRadians(-35.0),
                                roll: 0.0
                            }
                        });
                    }
                
                    var viewRectangle = function () {
                        var west = -77.0;
                        var south = 38.0;
                        var east = -72.0;
                        var north = 42.0;
                
                        var rectangle = bmgl.Rectangle.fromDegrees(west, south, east, north);
                        viewer.camera.setView({
                            destination: rectangle
                        });
                
                        // Show the rectangle.  Not required; just for show.
                        viewer.entities.add({
                            rectangle: {
                                coordinates: rectangle,
                                fill: false,
                                outline: true,
                                outlineColor: bmgl.Color.WHITE
                            }
                        });
                    }
                
                    var flyToRectangle = function () {
                        var west = -90.0;
                        var south = 38.0;
                        var east = -87.0;
                        var north = 40.0;
                        var rectangle = bmgl.Rectangle.fromDegrees(west, south, east, north);
                
                        viewer.camera.flyTo({
                            destination: rectangle
                        });
                
                        // Show the rectangle.  Not required; just for show.
                        viewer.entities.add({
                            rectangle: {
                                coordinates: rectangle,
                                fill: false,
                                outline: true,
                                outlineColor: bmgl.Color.WHITE
                            }
                        });
                    }
                
                    var setReferenceFrame = function () {
                        var center = bmgl.Cartesian3.fromDegrees(-75.59777, 40.03883);
                        var transform = bmgl.Transforms.eastNorthUpToFixedFrame(center);
                
                        // View in east-north-up frame
                        var camera = viewer.camera;
                        camera.constrainedAxis = bmgl.Cartesian3.UNIT_Z;
                        camera.lookAtTransform(transform, new bmgl.Cartesian3(-120000.0, -120000.0, 120000.0));
                
                        // Show reference frame.  Not required.
                        viewer.scene.primitives.add(new bmgl.DebugModelMatrixPrimitive({
                            modelMatrix: transform,
                            length: 100000.0
                        }));
                    }
                
                    var setHeadingPitchRoll = function () {
                        viewer.camera.setView({
                            destination: bmgl.Cartesian3.fromDegrees(-75.5847, 40.0397, 1000.0),
                            orientation: {
                                heading: -bmgl.Math.PI_OVER_TWO,
                                pitch: -bmgl.Math.PI_OVER_FOUR,
                                roll: 0.0
                            }
                        });
                    };
                
                    var icrf = function (scene, time) {
                        if (scene.mode !== bmgl.SceneMode.SCENE3D) {
                            return;
                        }
                        var icrfToFixed = bmgl.Transforms.computeIcrfToFixedMatrix(time);
                        if (bmgl.defined(icrfToFixed)) {
                            var camera = viewer.camera;
                            var offset = bmgl.Cartesian3.clone(camera.position);
                            var transform = bmgl.Matrix4.fromRotationTranslation(icrfToFixed);
                            camera.lookAtTransform(transform, offset);
                        }
                    };
                
                    var viewInICRF = function () {
                        var a = viewer.clock.currentTime.secondsOfDay;
                        rotateEventListener = function (e) {
                            var i = viewer.clock.currentTime.secondsOfDay, t = ((i - a) / 1e3) * 0.4;
                            a = i;
                            viewer.scene.camera.rotate(bmgl.Cartesian3.UNIT_Z, -1 * t)
                        };
                        viewer.camera.flyHome(0);
                        viewer.clock.multiplier = 200;
                        viewer.clock.shouldAnimate = !0;
                        viewer.clock.onTick.addEventListener(rotateEventListener);
                    };
                
                    var flyInACity = function () {
                        viewer.scene.camera.flyTo({
                            destination: bmgl.Cartesian3.fromDegrees(-73.98580932617188, 40.74843406689482, 363.34038727246224),
                            complete: function () {
                                setTimeout(function () {
                                    viewer.camera.flyTo({
                                        destination: bmgl.Cartesian3.fromDegrees(-73.98585975679403, 40.75759944127251, 186.50838555841779),
                                        orientation: {
                                            heading: bmgl.Math.toRadians(200.0),
                                            pitch: bmgl.Math.toRadians(-50.0)
                                        },
                                        easingFunction: bmgl.EasingFunction.LINEAR_NONE
                                    });
                                }, 1000);
                            }
                        });
                    };
                
                    var losAngelesToTokyo = function (adjustPitch) {
                        var camera = viewer.scene.camera;
                
                        var tokyoOptions = {
                            destination: bmgl.Cartesian3.fromDegrees(139.8148, 35.7142, 20000.0),
                            orientation: {
                                heading: bmgl.Math.toRadians(15.0),
                                pitch: bmgl.Math.toRadians(-60),
                                roll: 0.0
                            },
                            duration: 20,
                            flyOverLongitude: bmgl.Math.toRadians(60.0)
                        };
                
                        var laOptions = {
                            destination: bmgl.Cartesian3.fromDegrees(-117.729, 34.457, 10000.0),
                            duration: 5,
                            orientation: {
                                heading: bmgl.Math.toRadians(-15.0),
                                pitch: -bmgl.Math.PI_OVER_FOUR,
                                roll: 0.0
                            }
                        };
                        laOptions.complete = function () {
                            setTimeout(function () {
                                camera.flyTo(tokyoOptions);
                            }, 1000);
                        };
                        if (adjustPitch) {
                            tokyoOptions.pitchAdjustHeight = 1000;
                            laOptions.pitchAdjustHeight = 1000;
                        }
                        camera.flyTo(laOptions);
                    };
                
                    var flyOverLongitude = function (adjustPitch) {
                        losAngelesToTokyo();
                    };
                
                    var flyOverLongitudeWithPitch = function () {
                        losAngelesToTokyo(true);
                    };
                
                    function reset() {
                        viewer.entities.removeAll();
                        // viewer.scene.primitives.removeAll();
                        // viewer.scene.tweens.removeAll();
                        viewer.camera.lookAtTransform(bmgl.Matrix4.IDENTITY);
                        rotateEventListener&&viewer.clock.onTick.removeEventListener(rotateEventListener);
                        viewer.clock.shouldAnimate = 0;
                        rotateEventListener = null;
                        viewer.scene.preRender.removeEventListener(icrf);
                        viewer.scene.globe.enableLighting = false;
                    };
                    avaliableOptions = [];
                    avaliableOptions.push(new opt('飛到一個(gè)城市', flyInACity));
                    avaliableOptions.push(new opt('飛往圣地亞哥', flyToSanDiego));
                    avaliableOptions.push(new opt('飛到有航向、俯仰和滾轉(zhuǎn)的位置', flyToHeadingPitchRoll));
                    avaliableOptions.push(new opt('飛到我的位置', flyToLocation));
                    avaliableOptions.push(new opt('飛到矩形', flyToRectangle));
                    avaliableOptions.push(new opt('查看矩形', viewRectangle));
                    avaliableOptions.push(new opt('設(shè)置相機(jī)框架', setReferenceFrame));
                    avaliableOptions.push(new opt('設(shè)置相機(jī)的航向、俯仰和滾轉(zhuǎn)位置', setHeadingPitchRoll));
                    avaliableOptions.push(new opt('旋轉(zhuǎn)球體', viewInICRF));
                    avaliableOptions.push(new opt('從洛杉磯經(jīng)歐洲飛往東京', flyOverLongitude));
                    avaliableOptions.push(new opt('在飛行中向下看', flyOverLongitudeWithPitch));
                    viewModel = {
                        options: avaliableOptions,
                        selectedOption: bmgl.knockout.observable(null),
                        checkCamera: bmgl.knockout.observable(true),
                        cameraEventInfo: bmgl.knockout.observable("")
                    };
                   
                    bmgl.knockout.applyBindings(viewModel, document.getElementById('toolbar'));
                    viewModel.selectedOption.subscribe(function (selected) {
                        reset();
                        selected._callback();
                    });
                </script>
                </body>
                </html>                                                                                                                                                                                                                                                                                                                                            
                主站蜘蛛池模板: 国产成人十八黄网片| 日本高清xxxx| 国产v亚洲v欧美v专区| 99re在线精品视频免费| 日本欧美一区二区三区在线播放| 台湾香港澳门三级在线| 亚洲视频456| 小雪坐莲许老二的胯上| 亚州**色毛片免费观看| 特级aaaaaaaaa毛片免费视频| 国产又色又爽又刺激在线播放 | 特级毛片AAAAAA| 国产A级三级三级三级| jjizz全部免费看片| 天天做人人爱夜夜爽2020毛片| 久久久久亚洲精品无码蜜桃| 欧美人妻日韩精品| 交换年轻夫妇5| 美国式禁忌23| 国产午夜激无码av毛片| 永久看日本大片免费35分钟| 天天摸天天做天天爽水多| 中文字幕无码精品亚洲资源网久久| 末成年美女黄网站色大片连接| 亚洲色无码国产精品网站可下载| 能在线观看的一区二区三区| 国产成人精品免费视频大全可播放的| 91香蕉在线观看免费高清| 少妇高潮惨叫喷水在线观看| 久久久久成人精品无码中文字幕| 欧洲美女与动性zozozo| 亚洲熟妇少妇任你躁在线观看无码 | 久久精品国产99国产精品澳门| 欧美激情另欧美做真爱| 免费不卡在线观看av| 美女被奶乳羞羞漫画在线| 国产午夜激无码av毛片| 免费黄色福利视频| 国产精品扒开腿做爽爽爽视频| AAAA级少妇高潮大片在线观看 | 精品国产一区二区三区AV性色|