Skyline软件二次开发初级——2如何在WEB页面中控制三维地图的观察点坐标和角度...

1.放大:

     < html >

<head>

         < title >Zoom In </ title >
         < object  id ="SGWorld"  classid ="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"  style ="visibility:hidden;height:0 " ></ object >
         < script  type ="text/javascript" >
        
         function Init()
        {
            SGWorld.Navigate.ZoomIn();
        }
        
         </ script >
     </ head >
     < body  onload ="Init();" >
     </ body >
</ html >

 

2.缩小: 

     < html >

        <head>

         < title >Zoom Out </ title >
         < object  id ="SGWorld"  classid ="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"  style ="visibility:hidden;height:0 " ></ object >
         < script  type ="text/javascript" >
        
         function Init()
        {
            SGWorld.Navigate.ZoomOut();
        }
        
         </ script >
     </ head >
     < body  onload ="Init();" >
     </ body >
</ html >

3.放大到街道级别:

      < html > 
< head >
         < title >Zoom To Street Level </ title >
         < object  id ="SGWorld"  classid ="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"  style ="visibility:hidden;height:0 " ></ object >
         < script  type ="text/javascript" >

         function Init()
        {
             var position = SGWorld.Navigate.GetPosition();
            position.Altitude = 1000;        //  Street level in TerraExplorer corresponds to altitude of 1000m
            position.AltitudeType = 0;       //  0 is relative to terrain;
            SGWorld.Navigate.FlyTo(position, 0);  //  0 is fly to
        }
        
         </ script >
     </ head >
     < body  onload ="Init();" >
     </ body >
</ html >

4.获取摄像机的位置:

      < html > 
< head >
         < title >Get the current position </ title >
         < object  id ="SGWorld"  classid ="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"  style ="visibility:hidden;height:0 " ></ object >
         < script  type ="text/javascript" >

         function Init()
        {
             var pos = SGWorld.Navigate.GetPosition();

            alert("Current Position:\n\nX: " + pos.X + "\nY: " + pos.Y + "\nHeight: " + pos.Altitude + "\nYaw: " + pos.Yaw + "\nPitch: " + pos.Pitch);
       }
        
         </ script >
     </ head >
     < body  onload ="Init();" >
     </ body >
</ html >

5.设置摄像机的位置:

     < html > 
< head >
         < title >Set the current position </ title >
         < object  id ="SGWorld"  classid ="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"  style ="visibility:hidden;height:0 " ></ object >
         < script  type ="text/javascript" >

         function Init()
        {
             var pos = SGWorld.Creator.CreatePosition(-71.05216,  //  X
                                                       42.34569,  //  Y
                                                       1000,      //  Altitude
                                                       0,  // AltitudeTypeCode.ATC_TERRAIN_RELATIVE, // Altitude type
                                                       0.0,       //  Yaw
                                                      -43.0);      //  Pitch
            
            SGWorld.Navigate.SetPosition(pos);
        }
                     
         </ script >
     </ head >
     < body  onload ="Init();" >
     </ body >
</ html >

6.跳到兴趣点:

< html >
     < head >
         < title >Set the current position </ title >
         < object  id ="SGWorld"  classid ="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"  style ="visibility:hidden;height:0 " ></ object >
         < script  type ="text/javascript" >
         var popup;

         function Init()
        {
            
             var POI = SGWorld.Creator.CreatePosition(-71.07596,  //  Point of interest X   
                                                      42.34998,  //  Point of interest Y
                                                      30,        //  Point of interest altitude (30m)
                                                      0,         //  Altitude type - relative to terrain
                                                      90.0,      //  Direction from which we want to view the point of interest (90.0 means from we are looking east)
                                                     -10.0,      //  Pitch from which we want to view the point of interest (looking 10 degree down)
                                                      0,         //  Roll
                                                      250);      //  The distance we want to be from the point of interest (250m)

            SGWorld.Navigate.JumpTo(POI);
                        
            showPopup();
        }


         function showPopup()
        {
            popup = SGWorld.Creator.CreatePopupMessage("Point Of Interest sample");
            popup.InnerHtml = "<b>Trinity Church Boston</b><br>Distance from camera: 250 meters<br>Looking from west to east";
            SGWorld.Window.ShowPopup(popup);
        }
        
         function onExit()
        {
             if(popup)
                SGWorld.Window.RemovePopup(popup);
        }
        
         </ script >
     </ head >
     < body  onload ="Init();"  onunload ="onExit();" >
     </ body >
</ html >

转载于:https://www.cnblogs.com/yitianhe/archive/2012/09/21/2696518.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值