• 如何利用Skyline6.1的接口创建动态对象DynamicObject


    思路:根据已知的一条Polyline来创建一个动态对象,沿着这个Polyline轨迹运动的对象;

    在实际的项目应用中,我们可以用这种对象来模拟台风运动轨迹、跟踪车辆GPS轨迹等;

    程序很简单,如下:

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 
     3 <html xmlns="http://www.w3.org/1999/xhtml">
     4 <head>
     5     <title>DynamicObject</title>
     6      <script type = "text/javascript" language = "javascript">
     7          var gPolyObj = null;         
     8          function StartCal() {
     9              var SGWorld = new CreateSGObj();
    10              gPolyObj = SGWorld.Creator.CreateDynamicObject(0, 1, 1, "010", 100, 0, 0, "010");
    11              gPolyObj.CircularRoute = 0;
    12              gPolyObj.TurnSpeed = 100;
    13 
    14              var ItemID = SGWorld.ProjectTree.FindItem("Polyline");
    15              if (ItemID > 0) {
    16                  var obj = SGWorld.ProjectTree.GetObject(ItemID);
    17                  for (var i = 0; i < obj.Geometry.Points.count; i++) {
    18                      var RouteWaypoint = SGWorld.Creator.CreateRouteWaypoint(obj.Geometry.Points.Item(i).X, obj.Geometry.Points.Item(i).Y, obj.Geometry.Points.Item(i).Z,800,0,0,0,0,0,-1);
    19                      
    20                      gPolyObj.Waypoints.AddWaypoint(RouteWaypoint);
    21                  }
    22              }
    23 
    24              SGWorld.Navigate.FlyTo(gPolyObj,11);
    25          }
    26 
    27          function CreateTempGroup(groupname) {
    28              var SGWorld = new CreateSGObj();
    29              var gid = SGWorld.ProjectTree.FindItem(groupname);             
    30              if (gid > 0) {
    31                  
    32              }
    33              else {
    34                  gid = SGWorld.ProjectTree.CreateLockedGroup(groupname, 0);
    35              }
    36              return gid;
    37          }
    38 
    39          function DelTemp(groupname) {
    40              var SGWorld = new CreateSGObj();
    41              var gid = SGWorld.ProjectTree.FindItem(groupname);
    42              if (gid > 0) {
    43                  SGWorld.ProjectTree.DeleteItem(gid);
    44              }
    45          }
    46          
    47          /*  
    48          功能:   创建sgworld对象
    49          备注:   赵贺 2011.04.01.
    50          */
    51          function CreateSGObj() {
    52              var obj = $("sgworld");
    53              if (obj == null) {
    54                  obj = document.createElement('object');
    55                  document.body.appendChild(obj);
    56                  obj.name = "sgworld";
    57                  obj.id = "sgworld";
    58                  obj.classid = "CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1";
    59              }
    60              return obj;
    61          }
    62          function $(id) {
    63              return window.document.getElementById(id);
    64          }        
    65      </script>
    66 </head>
    67 <body>
    68     <table style="margin: 0px; border: 0px;">
    69         <tr>
    70             <td colspan="4">
    71                 <input id="Button6" type="button" value="绘制" onclick="StartCal()" />                        
    72             </td>
    73         </tr>       
    74     </table>
    75 </body>
    76 </html>
  • 相关阅读:
    perl 调短信接口
    MySQL处理千万级数据查询、分页
    tomcat 设置path 访问路径
    Tomcat 设置内存大小
    Tomcat 80端口启动 必须是root
    tomcat server.xml配置解析
    Perl 发送邮件
    单身北漂生活二、三事(上)——北漂18年(8)
    tomcat 应用访问
    Perl 采集监控日志插入数据库
  • 原文地址:https://www.cnblogs.com/yitianhe/p/2833515.html
Copyright © 2020-2023  润新知