搜索
开启辅助访问

QQ登录

只需一步,快速开始

立即注册 找回密码
查看: 56|回复: 0

Skyline中空复杂多边形创建代码

[复制链接]

136

主题

187

帖子

5984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
5984
发表于 2017-8-1 17:50:14 | 显示全部楼层 |阅读模式

复制代码
  1.             int wid = sg.ProjectTree.GetNextItem(0, ItemCode.SELECTED);
  2.             ITerrainPolygon61 pol = sg.ProjectTree.GetObject(wid) as ITerrainPolygon61;
  3.             string abs = pol.Geometry.Wks.ExportToWKT().Split('(')[2].Trim().Split(')')[0];
  4.             string[] abb = abs.Split(',');
  5.             string newgeo = "";
  6.             for (int i = 0; i < abb.Length; i++)
  7.             {
  8.                 newgeo = newgeo + abb[i].Trim().Split(' ')[0].ToString() + ", " + abb[i].Trim().Split(' ')[1].ToString() + ", " + "0,";
  9.             }
  10.            ILinearRing wl1 = pol.Geometry as ILinearRing;
  11.            ILinearRing wl = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3018311752844900, 39.9423237648098210, 0, 116.3018315414795700, 39.9424716752156070, 0, 116.3016383553905900, 39.9424720883235910, 0, 116.3016377550500500, 39.9424667328940050, 0, 116.3015653372294800, 39.9424684722123120, 0, 116.3015650488496000, 39.9424952742448770, 0, 116.3015135777999700, 39.9424959996709110, 0, 116.3015012257596400, 39.9424958410130840, 0, 116.3014752426732900, 39.9424957615242990, 0, 116.3014347734217300, 39.9424959997751830, 0, 116.3013890644028800, 39.9424958122293670, 0, 116.3013893338310800, 39.9424721843999250, 0, 116.3009671549366100, 39.9424720475207450, 0, 116.3009670794519600, 39.9424655020204470, 0, 116.3009382863803900, 39.9424650209708360, 0, 116.3009382184182800, 39.9424246854451680, 0, 116.3009348083540700, 39.9424242671554450, 0, 116.3009348295367700, 39.9423771665411990, 0, 116.3009688491750100, 39.9423767671423850, 0, 116.3011508713695700, 39.9423754419214490,0, });
  12.            ILinearRing nl = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] {116.3009409506069000, 39.9424270690209370, 0,  116.3009686348908200, 39.9424277026227590, 0, 116.3009701776845200, 39.9424515080540840, 0, 116.3009398805183400, 39.9424511142876430, 0, 116.3009409506069000, 39.9424270690209370, 0, });
  13.            ILinearRing n2 = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3014883999635600, 39.9424860305475420, 0, 116.3014899774101700, 39.9424652088340440, 0, 116.3015201496248900, 39.9424652161889920, 0, 116.3015211972173300, 39.9424862641853270, 0, 116.3014883999635600, 39.9424860305475420, 0, });
  14.            ILinearRing n3 = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3014415901855900, 39.9424649234187400, 0, 116.3014413694521200, 39.9424855947040100, 0, 116.3014623688083900, 39.9424855152316100, 0, 116.3014623422390800, 39.9424651644236590, 0, 116.3014415901855900, 39.9424649234187400, 0, });
  15.            ILinearRing n4 = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3014421868220600, 39.9424388295987210, 0, 116.3014417917672900, 39.9424597373838850, 0, 116.3014634603048200, 39.9424592138072610, 0, 116.3014635573611300, 39.9424396837778770, 0, 116.3014421868220600, 39.9424388295987210, 0, });
  16.            ILinearRing n5 = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3014414885077500, 39.9424124344771560, 0, 116.3014414405754900, 39.9424337439338970, 0, 116.3014627450513000, 39.9424335913081240, 0, 116.3014627853298900, 39.9424125343635980, 0, 116.3014414885077500, 39.9424124344771560, 0, });
  17.            ILinearRing n6 = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3014795069969300, 39.9424127150388410, 0, 116.3014788965119900, 39.9424317641950920, 0, 116.3015088985230000, 39.9424318424599110, 0, 116.3015087384040200, 39.9424127695078470, 0, 116.3014795069969300, 39.9424127150388410, 0, });
  18.            ILinearRing n7 = sg.Creator.GeometryCreator.CreateLinearRingGeometry(new double[] { 116.3014793384900000, 39.9424374320305660, 0, 116.3014797802357900, 39.9424566641894360, 0, 116.3015089260293000, 39.9424563335564000, 0, 116.3015091192934000, 39.9424373767130520, 0, 116.3014793384900000, 39.9424374320305660, 0, });
  19.            IPolygon ip6=   sg.Creator.GeometryCreator.CreatePolygonGeometry(wl, new ILinearRing[] { nl, n2, n3, n4, n5, n6, n7 });
  20.            sg.Creator.CreatePolygon(ip6, -1600000, -1000000, AltitudeTypeCode.ATC_ON_TERRAIN, 0, "");
复制代码


QQ|Archiver|手机版|GIS3D 基地 ( 京ICP备16033688号

GMT+8, 2017-8-23 12:13 , Processed in 0.104760 second(s), 28 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表
 
Skyline中文社区-总群
帮主 gis3d 海洪