zoukankan      html  css  js  c++  java
  • SkylineGlobe TerraExplorer for Web 7.1.0版本 接口示例

    在SkylineGlobe TerraExplorer for Web 7.1.0版本(俗称H5免插件版本)中,如何使用SGWorld接口的三维视域分析方法呢?

    请参考下面的示例:

    通过下面的代码大家不难发现,这个函数方法是基于Cesium的接口重新封装的,示例代码里面也混杂了一些Cesium的接口,

    这样看,如果以后我们要用Skyline的这个H5免插件版本做开发,Cesium的接口也要一并学习啦。

    var MyViewshedTool = function () {
    
     
    
        //SET TOOL ID   
    
        this.getId = function () {
    
            return 'MyViewshedTool';
    
        },
    
     
    
            //SET MENU ENTRY FOR THE TOOL (See example 1 for more details)
    
            this.getMenuEntry = function () {
    
                return TerraExplorer.tools.MenuEntry.addToSidebar(this, "My Viewshed Tool", "./userTools/myToolIcon.png", 3, TerraExplorer.tools.MenuEntry.MenuEntryAnalysis(), "My Tools");
    
            },
    
     
    
            //SET CODE TO EXECUTE WHEN TOOL IS CLICKED IN SIDEBAR
    
            this.open = function () {
    
                //CREATE A MESH LAYER USING THE CreateMeshLayer METHOD
    
                var promise = TerraExplorer.SGWorld.Creator.CreateMeshLayer("Frederick", "http://www.SkylineGlobe.com/SG/streamer.ashx", "Frederick_4TEDF", true);
    
                promise.then(function (teObject) {
    
                    //PRINT DESCRIPTION OF ADDED LAYER
    
                    console.log("Created Mesh layer: " + teObject.description);
    
                    //FLY TO Frederick USING THE camera.flyTo METHOD
    
                    viewer.camera.flyTo({
    
                        destination: new Cesium.Cartesian3.fromDegrees(-77.40982, 39.41875, 600), //Frederick coordinates
    
                        orientation: {
    
                            heading: Cesium.Math.toRadians(180.0),
    
                            pitch: Cesium.Math.toRadians(-55.0),
    
                            roll: 0.0
    
                        },
    
                        complete: function () {
    
                            var hpra = new Cesium.HeadingPitchRange(Cesium.Math.toRadians(90.0), -45, 2000);
    
                            var vsPositionCarto = new Cesium.Cartesian3.fromDegrees(-77.41319, 39.41702, 300); //Other Frederick coordinates
    
                            //CREATE VIEWSHED OBJECT USING THE CreateViewshedObject METHOD
    
                            TerraExplorer.SGWorld.Analysis.CreateViewshedObject('Viewshed On Frederick', vsPositionCarto, 53, 53, hpra, { roll: 0.0 });
    
                        }
    
                    });
    
                }).otherwise(function (err) {
    
                    alert(err);
    
                });
    
     
    
                return true;
    
            }
    
    };
  • 相关阅读:
    将Nginx添加到windows服务中
    springboot使用redis管理session
    GIT常用命令
    阻止360、谷歌浏览器表单自动填充
    谈谈对Spring IOC的理解
    同一个Nginx服务器同一端口配置多个代理服务
    LeetCode 653. Two Sum IV
    109. Convert Sorted List to Binary Search Tree(根据有序链表构造平衡的二叉查找树)
    108. Convert Sorted Array to Binary Search Tree(从有序数组中构造平衡的BST)
    LeetCode 236. Lowest Common Ancestor of a Binary Tree(二叉树求两点LCA)
  • 原文地址:https://www.cnblogs.com/yitianhe/p/9110473.html
Copyright © 2011-2022 走看看