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

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Skyline软件⼆次开发初级——3如何在WEB页⾯中的三维地图上创

建⼏何对象

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

相关文档
最新文档