博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AE读取CAD图层包括注记
阅读量:6708 次
发布时间:2019-06-25

本文共 3331 字,大约阅读时间需要 11 分钟。

public override void FillDatabase(Teigha.DatabaseServices.Database pDb)        {            IFeatureClassContainer pFeatureClassContainer = pCADFeatureDataset as IFeatureClassContainer;            IEnumFeatureClass pEnumFeatureClass = pFeatureClassContainer.Classes;            IFeatureClass pFeatureClass = pEnumFeatureClass.Next();                       while (pFeatureClass != null)            {                               LoadLayer(pFeatureClass, pDb);                Debug.WriteLine(pFeatureClass.FeatureType.ToString() + "-" + pFeatureClass.AliasName + "-" + pFeatureClass.ShapeType.ToString());                pFeatureClass = pEnumFeatureClass.Next();            }        }        private void LoadLayer(IFeatureClass pFeatureClass, Teigha.DatabaseServices.Database pDb)        {            int indx = pFeatureClass.FindField("Layer");            int idxColor = pFeatureClass.FindField("Color");            int idxText = pFeatureClass.FindField("TxtMemo");            int idxHandle = pFeatureClass.FindField("Handle");                       pCursor = pFeatureClass.Search(null, false);            IFeature pFeature2 = pCursor.NextFeature();            //写入点线                    if (pFeatureClass.FeatureType == esriFeatureType.esriFTCoverageAnnotation)                {                    while (pFeature2 != null)                    {                        string geoName = "C_" + pFeature2.get_Value(indx).ToString();                        string sAnnotation = pFeature2.get_Value(idxText).ToString();                        IPoint pPoint = pFeature2.Shape as IPoint;                        double x = 0, y = 0;                        pPoint.QueryCoords(out x, out y);                        Point3d pt = new Point3d(x, y, 0);                        addTextEnt(modelSpaceId, pt, pt, sAnnotation, 2, TextHorizontalMode.TextLeft, TextVerticalMode.TextTop, LayerNames[geoName], ttfStyleId);                        pFeature2 = pCursor.NextFeature();                    }                }                else                {                    if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)                    {                        while (pFeature2 != null)                        {                            IPoint pt = pFeature2.Shape as IPoint;                            pFeature2 = pCursor.NextFeature();                        }                    }                    else if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)                    {                        short shtColor = 1;                        while ((pFeature2 = pCursor.NextFeature()) != null)                        {                            string geoName = "C_" + pFeature2.get_Value(indx).ToString();                        }                    }                    else if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)                    {                        short shtColor = 1;                        while ((pFeature2 = pCursor.NextFeature()) != null)                        {                            string geoName = "C_" + pFeature2.get_Value(indx).ToString();                                                   }                    }            }           System.Runtime.InteropServices.Marshal.ReleaseComObject(pCursor);            pCursor = null;        }    }

 

转载地址:http://nrnlo.baihongyu.com/

你可能感兴趣的文章
Clang 之旅—[翻译]添加自定义的 attribute
查看>>
慎用System.nanoTime()
查看>>
2017 移动端 iOS 年终工作总结-纯干货请自备酒水
查看>>
Android小知识-剖析OkHttp中的任务调度器Dispatcher
查看>>
switch的python实现
查看>>
Hybris UI的Route(路由)实现
查看>>
iOS探索:RunLoop本质、数据结构以及常驻线程实现
查看>>
算法的时间复杂度
查看>>
iOS独立开发者使用Bmob第三方后台服务初探
查看>>
共享适合移动端的“拾色器”插件
查看>>
CPU发生异常到生成Crash Log的过程
查看>>
到底什么才是业务架构?
查看>>
基础设施即代码:Terraform和AWS无服务器
查看>>
Atlassian发布事故管理解决方案Jira Ops
查看>>
书评 —— 《Go语言编程》
查看>>
Apache HBase的现状和发展
查看>>
反模式的经典 - Mockito设计解析
查看>>
Zip Slip目录遍历漏洞已影响多个Java项目
查看>>
独家揭秘:微博深度学习平台如何支撑4亿用户愉快吃瓜?
查看>>
Visual Studio 15.7预览版4改进Git、C++支持
查看>>