ArcEngine将线符号化为立方体状
对于二三维同步中的三维视图肯定是需要通过二维元素来符号化成三维元素的,之前项目测试临时采用这个自代的圆管状:
esriSimple3DLineStyle AxisStyle = esriSimple3DLineStyle.esriS3DLSTube; 进行符号化,但是这个自带样式不能做更多的扩展,仍然需要对它进行手动 graphic,今天花了半天时间看了下官方的例子,总算是捣鼓出了将指定坐标的两个点连成的线符号化成正方体状,中间也碰到一些问题。本以为 arcengine提供了相当好的API,我只用传入两个点或是一根线,再给它一个Polygon,它就能帮我沿着这个线的方向画成正方体了,可是弄来弄 去,不是位置不对,就是角度有问题,官方的例子过于简单,拿到我的应用中根本不能使用,于是分析了一下原因,采用以下三步:
第一步: 空间有根线,起点和终点肯定可以得到,我要沿这个线符号化成立方体,那么两点的长度肯定要用到。我们就在坐标原点沿Z坐标画一个立方体,高就是上面提到的线长。
第二步: 我们假定这根线的起点为(0,0,0),即我自定义的原点,通过IVector3D接口很容易得到这根线的偏移角度。这样就在原点把上面那个立方体给进行两次旋转得到正确的线段走向。
第三步: 将第二步的立方体平移到起点位置,完工。
- public static IGeometry getCubeTubeByLinePoint(IPoint fPoint, IPoint tPoint, double width, double height)
- {
- //IPoint fPoint = GeometryUtilities.ConstructPoint3D(5, 6, 3);
- //IPoint tPoint = GeometryUtilities.ConstructPoint3D(15, 13, 13);
- //计算走向-->移动坐标原点
- IVector3D tarPointV3D = GeometryUtilities.ConstructVector3D(tPoint.X - fPoint.X, tPoint.Y - fPoint.Y, tPoint.Z - fPoint.Z);
- //定义两次旋转的轴线
- IVector3D axisOfRotationVector3D_Y = GeometryUtilities.ConstructVector3D(0, 10, 0);
- IVector3D axisOfRotationVector3D_Z = GeometryUtilities.ConstructVector3D(0, 0, 10);
- //定义走向线段
- ILine extrusionLine = new LineClass();
- extrusionLine.FromPoint = fPoint;
- extrusionLine.ToPoint = tPoint;
- double myToZ = extrusionLine.Length; //线段长度
- //初始化截面形状
- IPointCollection polygonPointCollection = new PolygonClass();
- polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-(height / 2), (width / 2)),ref _missing, ref _missing);
- polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D((height / 2), (width / 2)), ref _missing, ref _missing);
- polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D((height / 2), -(width / 2)), ref _missing, ref _missing);
- polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-(height / 2), -(width / 2)), ref _missing, ref _missing);
- IPolygon polygon = polygonPointCollection as IPolygon;
- polygon.Close();
- IGeometry polygonGeometry = polygonPointCollection as IGeometry;
- ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator;
- topologicalOperator.Simplify();
- //Perform Extrusion
- IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
- constructMultiPatch.ConstructExtrudeFromTo(0, myToZ, polygonGeometry);
- //旋转角度
- ITransform3D transform3D = constructMultiPatch as ITransform3D;
- transform3D.RotateVector3D(axisOfRotationVector3D_Y, tarPointV3D.Inclination);
- transform3D.RotateVector3D(axisOfRotationVector3D_Z, GeometryUtilities.GetRadians(90) - tarPointV3D.Azimuth);
- //移动到起点
- transform3D.Move3D(fPoint.X, fPoint.Y, fPoint.Z);
- return constructMultiPatch as IGeometry;
- }
ArcEngine将线符号化为立方体状的更多相关文章
- ArcEngine 创建线要素图层
在创建要素图层的时候,默认的几何类型是Polygon: Dim objectClassDescription As IObjectClassDescription = New FeatureClass ...
- ArcEngine 9.3 学习笔记(六):图层符号化(COlorRamp,MarkerSymbol,LineSymbol,FillSymbol,TextSymbol,3DChartSymbol,使用ServerStyle符号库,FeatureRender,RasterRender)
第四章 图层符号化 AE9.3 提供了SymbologyControl控件,用于显示ARCGIS符号库中的符号. 组件库中的组件对象分为Color(颜色),Symbol(符号),Render(渲染)三 ...
- 【ESRI论坛6周年征文】ArcEngine注记(Anno/ Label/Element等)处理专题 -入门篇
原发表于ESRI中国社区,转过来.我的社区帐号:jhlong http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=122097 ----------- ...
- ArcGIS制图表达Representation实战篇2-河流渐变与符号旋转
ArcGIS制图表达Representation实战篇2-河流渐变与符号旋转 by 李远祥 上一章节主要是从实战中使用规则和几何效果,如何分解制图规则.本章主要还是通过一些特殊要求如河流线宽渐变和符号 ...
- 创建线注记LineElement
1.根据2点创建一条线 /// <summary> /// 创建线 /// </summary> /// <param name="pnt1"> ...
- ArcEngine开发:IElement.Geometry 值不在预期范围内 + 元素绘制代码
IElement pEle = pLineEle as IElement; pEle.Geometry = pLn; pLn为一个ILine对象,想当然的以为它是IGeometry对象,可以赋值,结果 ...
- 基于ArcEngine与C#的鹰眼地图实现
鹰眼图是对全局地图的一种概略表达,具有与全局地图的空间参考和空间范围.为了更好起到空间提示和导航作用,有些还具备全局地图中重要地理要素,如主要河流.道路等的概略表达.通过两个axMapControl控 ...
- 《ArcGIS Engine+C#实例开发教程》第七讲 图层符号选择器的实现2
原文:<ArcGIS Engine+C#实例开发教程>第七讲 图层符号选择器的实现2 摘要:在第七讲 图层符号选择器的实现的第一阶段中,我们完成了符号选择器窗体的创建与调用.在第二阶段中, ...
- 符号化Symbol(符号)体系
http://apps.hi.baidu.com/share/detail/23143648# 符号化Symbol(符号)体系 ArcGIS Engine9.3为开发人员提供了32种符号,主要分为三大 ...
随机推荐
- Linux 性能优化工具 perf top
1. perf perf 是一个调查 Linux 中各种性能问题的有力工具. NAME perf - Performance analysis tools for Linux SYNOPSIS per ...
- 网页实时聊天之js和jQuery实现ajax长轮询
众所周知,HTTP协议是无状态的,所以一次的请求都是一个单独的事件,和前后都没有联系.所以我们在解决网页实时聊天时就遇到一个问题,如何保证与服务器的长时间联系,从而源源不段地获取信息. 一直以来的方式 ...
- React-Native测试报告
React-native 使用js编写android和ios程序,前端时间开始支持android,本人根据官方的教程,先安装开发环境,然后运行hello world,最后看了下官方提供的实例程序UI ...
- Linux文件I/O
文件描述符(File Descriptor) a small, nonnegative integer for use in subsequent system calls (read(2), wri ...
- ES6 Set/WeakSet
ES6里加入了一个新数据解构Set,和Java的Set一样,它里面不存放重复的元素.Set实现为一个类,使用时需要先new. var s1 = new Set() s1.add(1) s1.add(2 ...
- 开启 CONFIG_HUGETLB_PAGE
File systems ---> Pseudo filesystems ---> [*] HugeTLB file system support 相关Kconfig如下 ...
- 【JAVA】调用类中的属性
class person { String name; int age; String like; void setName(String name) { this.name = name; } vo ...
- 入门 ARM 汇编(二)—— 寻址方式
忧愁他整天拉着我的心,像一个琴师操练他的琴:悲哀像是海礁间的飞涛:看他那汹涌,听他那呼号!—— 徐志摩·四行诗一首 ilocker:关注 Android 安全(新手) QQ: 2597294287 立 ...
- WD硬盘型号信息
买硬盘的时候有时候分不清 既然找到了就发上来吧
- 二:C语言(分之结构)
一:if语句 二:while语句 #include <stdio.h> int main() { ; i=; ) //循环条件应该是什么呢? { sum=sum+i; i++ ; //这里 ...