1.在地面上绘制一条折线:

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

function Init()
        {
            // geometry creator can work on WKT, WKB or array of x,z,y coordinates
            var geometry = SGWorld.Creator.GeometryCreator.CreateLineStringGeometry([-114.73656, 36.01659,0, -115.14515, 36.15498,0, -118.24834, 34.05090,0]);
            var color = SGWorld.Creator.CreateColor(255, 0, 0, 0.7);
            // 2 in AltitudeTypeCode means on terrain, 0 means add to root 
            var line = SGWorld.Creator.CreatePolyline(geometry, color, 2, 0, "my poly on terrain");
            line.LineStyle.Width = 15000; // 15000m (15km)
            line.Position.Distance = 600000.0; // set max viewing distance in meters
            SGWorld.Navigate.FlyTo(line);            
        }
        
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

2. 在空中绘制一条折线:

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

function Init()
        {
            var geometry = SGWorld.Creator.GeometryCreator.CreateLineStringGeometry([-114.73656, 36.01659, 10000, -115.14515, 36.15498, 300000, -118.24834, 34.05090, 700000]);

// 3 in AltitudeTypeCode means absolute, 0 means add to root 
            var line = SGWorld.Creator.CreatePolyline(geometry, "#ff0000", 3, 0, "my poly");
            line.Position.Distance = 900000.0; // set max viewing distance in meters
            SGWorld.Navigate.FlyTo(line);
        }
        
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

3.绘制多边形:

<html>

<head>
        <title>Create Polygons</title>
        <object id="SGWorld" classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
        <script type="text/javascript">
        
        function Init()
        {
            var pointsUtah = SGWorld.Creator.GeometryCreator.CreateGeometryFromWKT("POLYGON((-114.03822 41.99547,-111.04795 41.99626,-111.05028 40.99663,-109.04763 40.99847,-109.04782 36.99664,-114.04313 36.99656,-114.03822 41.99547))");

// 2 in AltitudeTypeCode means on terrain, 0 means add to root 
            var polyUtah = SGWorld.Creator.CreatePolygon(pointsUtah, "#ff0000", SGWorld.Creator.CreateColor(0, 255, 255, 40), 2, 0, "Utah"); //

polyUtah.LineStyle.Width = 5000; // 5000m (5km)

var pointsWyoming = SGWorld.Creator.GeometryCreator.CreateGeometryFromWKT("POLYGON((-111.05265 44.99576,-104.05934 44.99734,-104.05120 41.00322,-111.05028 40.99663,-111.05265 44.99576))");

// 2 in AltitudeTypeCode means on terrain, 0 means add to root 
            var polyWyoming = SGWorld.Creator.CreatePolygon(pointsWyoming, SGWorld.Creator.CreateColor(255, 255, 0, 10), null,2,0, "Wyoming");

polyWyoming.LineStyle.Width = 20000; // 20000m (20km)

polyWyoming.Position.Distance = 1600000;
            SGWorld.Navigate.FlyTo(polyWyoming);
        }
        
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

4.绘制圆形:

<html> 
<head>
        <title>Create Circle</title>
        <object id="SGWorld" classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
        <script type="text/javascript">
        
        function Init()
        {
            var circle = SGWorld.Creator.CreateCircle(SGWorld.Creator.CreatePosition(-71.00864, 42.36229,0,2),  // Pivot
                                                    1000.0,                                                     // Radius (1000m)
                                                    SGWorld.Creator.CreateColor(0, 0, 0, 0),                    // Outline color (in this sample, transparent/no outline)
                                                    SGWorld.Creator.CreateColor(200, 50, 50, 128)               // Fill color
                                                    );
            circle.Position.Distance = 3000;
            SGWorld.Navigate.FlyTo(circle); 
        }
        
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

5.创建文本标签:

<html> 
<head>
        <title>Create Basic Labels</title>
        <object id="SGWorld" classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
        <script type="text/javascript">
                
        function Init()
        {

var labelPos = SGWorld.Creator.CreatePosition(-122.41519, 37.74346, 100, 2);

// Default label
            var label1 = SGWorld.Creator.CreateTextLabel(labelPos, "Default label",SGWorld.Creator.CreateLabelStyle());

var labelStyle = SGWorld.Creator.CreateLabelStyle();

labelStyle.Bold = true;
            labelStyle.LineToGround = true;
            labelStyle.TextColor = SGWorld.Creator.CreateColor(255, 0, 0);

// Label 2
            labelPos.X += 0.001;
            var label2 = SGWorld.Creator.CreateTextLabel(labelPos, "Bold Red label\r\nwith line to ground", labelStyle);
            
            // Labe 3 
            labelStyle.BackgroundColor = SGWorld.Creator.CreateColor(255, 255, 255);
            labelStyle.Italic           = true;
            labelStyle.LineToGround     = false;
            
            labelPos.x += 0.001;            
            var label3 = SGWorld.Creator.CreateTextLabel(labelPos, "Red bold italic label\r\nwith white background", labelStyle);

// Labe 4 
            labelStyle.BackgroundColor = SGWorld.Creator.CreateColor(255, 255, 255, 0.5);
            labelStyle.Underline       = true;
            
            labelPos.y += 0.001;            
            var label4 = SGWorld.Creator.CreateTextLabel(labelPos, "Underlined italic with\r\nsemi transparent background", labelStyle);

// Labe 5 
            labelStyle.FontSize = 24;
            labelStyle.FontName = "Times New Roman";
            
            labelStyle.Bold      = false;
            labelStyle.Italic    = false;
            labelStyle.Underline = false;

labelPos.x -= 0.002;            
            var label5 = SGWorld.Creator.CreateTextLabel(labelPos, "Font:Times New Roman\r\nSize:24px", labelStyle);

SGWorld.Navigate.FlyTo(label1);
        }
        
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

6.创建带图片的文本标签:

<html> 
<head>
        <title>Create Image Labels</title>
        <object id="SGWorld" classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
        <script src="abspath.js" type="text/javascript"></script>

<script type="text/javascript">
                
        function Init()
        {

var labelPos = SGWorld.Creator.CreatePosition(-122.46875, 37.72467, 10, 2);

var label1 = SGWorld.Creator.CreateLabel(labelPos, "", toAbspath("data/Roundabout-large.gif"),SGWorld.Creator.CreateLabelStyle());

SGWorld.Navigate.FlyTo(label1);

labelPos.X += 0.001;
            labelPos.Altitude += 60;
            var label2 = SGWorld.Creator.CreateLabel(labelPos, 
                                                   "Under Constructions.\r\nThis label will not be visible\r\nabove ~800000 meters",
                                                   toAbspath("data/Underconstruction-2.gif"),SGWorld.Creator.CreateLabelStyle()
                                                   );
            label2.Style.TextOnImage = false;
            label2.Style.Bold = true;
            label2.Style.LineToGround = true;
            label2.Style.MultilineJustification = "left";
            label2.Style.TextAlignment = "right";
            label2.Visibility.MaxVisibilityDistance = 800000;

}
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

7.创建三维模型:

<html> 
<head>
        <title>Create Model</title>
        <object id="SGWorld" classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
        <script src="abspath.js" type="text/javascript"></script>

<script type="text/javascript">
                
        function Init()
        {
            var pos = SGWorld.Creator.CreatePosition(-122.38050, // x
                                                      37.62331,  // y
                                                      40.0,      // height
                                                      3,         // absolute
                                                      297.0,     // yaw
                                                      15.0);     // pitch

var model = SGWorld.Creator.CreateModel(pos, toAbspath("data/747.xpc"), 0.2);

SGWorld.Navigate.FlyTo(model);
            
        }
        
        </script>
    </head>
    <body onload="Init();">
    </body>
</html>

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

Skyline软件二次开发初级——3如何在WEB页面中的三维地图上创建几何对象相关推荐

  1. c# 无法加载oraops.dll_Robotstudio软件二次开发:基于C#语言的Smart组件开发基础

    Robotstudio软件除了支持Add-Ins插件的二次开发以外,还支持Smart组件的二次开发.开发语言同样是基于.NET框架的C#语言或VB语言.Smart组件是Robotstudio软件中实现 ...

  2. 欢迎光临CAX软件二次开发开源社区!

    欢迎光临CAX软件二次开发开源社区! http://uucax.uueasy.com 转载于:https://www.cnblogs.com/uucax/archive/2011/02/20/1959 ...

  3. vb杨辉三角代码编写_「二次开发」——基于VB.NET的NX UG软件二次开发基础

    前几期中为大家介绍了CATIA软件.AutoCAD软件基于VB.NET的二次开发,本期再来为大家介绍一下NX UG软件基于VB.NET的二次开发. NX UG软件版本:NX 12.0.0.27 开发软 ...

  4. 金蝶erp系统服务器端,金蝶ERP软件二次开发.doc

    金蝶ERP软件二次开发 摘要 企业要提升快速反应的能力,必须建立以信息集中.流程整合.实施控制为核心特点的快速反应体系,有效整合资源,强化基础管理.ERP软件可以帮助企业实现这些目标,但要成功地实施E ...

  5. Python--中控门禁软件二次开发--引导

    Python--中控门禁软件二次开发--引导 说明 : 公司门禁型号是:中控门禁 F7plus   ,因为没有安装带遥控开门的,也没有什么感应,当有访客过来时,走过去开门有点麻烦,而门禁软件需要每次进 ...

  6. pythoncad二次开发视频_revit二次开发|bim软件二次开发|revit二次开发教程|Revit二次开发技术文档...

    二次开发 revit二次开发|bim软件二次开发|revit二次开发教程|Revit二次开发技术文档2019-07-08赞( 0 ) 记录一下CAD二次开发的一些简单实例. 1.helloworld ...

  7. 速达软件二次开发-销售开单结算单位和账期报表需求

    接到某公司的二次开发需求如下: 1.销售开单中客户名称和结算单位做好匹配,提前在客户资料中录入结算单位资料,如下选择客户名称为"深圳瑞电"的时候结算单位自动跳出"义巍实业 ...

  8. 基于VB.NET的NX UG软件二次开发基础

    本文已经首发在个人微信公众号:工业机器人仿真与编程(微信号:IndRobSim),欢迎关注! 前几期中为大家介绍了CATIA软件.AutoCAD软件基于VB.NET的二次开发,本期再来为大家介绍一下N ...

  9. c#获取autocad安装位置_Robotstudio软件二次开发:基于C#语言的Smart组件开发基础

    Robotstudio软件除了支持Add-Ins插件的二次开发以外,还支持Smart组件的二次开发. 开发语言同样是基于 .NET框架的C#语言或VB语言. Smart组件是Robotstudio软件 ...

  10. ArcGIS二次开发基础教程(03):保存文档和导出地图

    ArcGIS二次开发基础教程(03):保存文档和导出地图 保存文档 保存: //这里的path为全局变量 在打开文件获添加数据时赋值原路径 //判断打开文件是否为mxd文件 是则保存 不是则另存为 i ...

最新文章

  1. Java高并发编程(四):并发编程基础
  2. Scala @BeanProperty注解生成getter/setter
  3. kubernetes一步一步搭建与https访问
  4. 使用用户名/密码和Servlet安全性保护WebSockets
  5. 使用Flex生成GUID
  6. 论文浅尝 - TACL2020 | TYDI QA:Google 发表一个多语言的问答语料库
  7. 《Reids 设计与实现》第十章 客户端
  8. 第6章 数组、指针与字符串(二)指针与函数
  9. 好用的图片压缩工具Tinypng
  10. google fonts 国内使用方案
  11. k3cloud怎样使金额字段显示金额符号
  12. Centos7.6上安装水族馆遇到报错BEGIN failed--compilation aborted at /usr/local/bin/asciiquarium line 42.
  13. GitHub Actions 快速入门
  14. 2019加密市场金融借贷领域研究报告(英文版) | TokenInsight
  15. 十字路口通行优先权,十字路口通行规则图解
  16. 新书封面初稿,征集意见ing【人人都是产品经理:9066】
  17. vue网易云歌单案例
  18. android 全键盘手机排行榜,小巧又精悍 3大系统直板全键盘手机搜罗
  19. tomcat(非安装版) 服务不能启动但是startup 却可以启动的问题
  20. PHP:关于PHP商城秒杀防止超卖问题

热门文章

  1. 全球光伏产业战加剧:美国考虑对进口太阳能电池施加紧急关税
  2. 最大熵模型中的数学推导
  3. 道路照明之电缆线路 - 设计笔记
  4. 联想台式计算机驱动程序,联想台式机网卡驱动,详细教您联想台式机网卡驱动...
  5. 【语言-c#】身份证地址编码列表
  6. java 微信小程序消息模板
  7. mysql 授权_MySQL的授权
  8. 【课程总结】软件工程经济学简答题总结
  9. vc设备工程师_工程/设备工程师简历工作经历填写样本
  10. java在线购物B2C商城源码 单用户商城源码(支持H5+APP+小程序)