如何在SceneControl中绘制面?目前好像没有找到相关的代码,我的目的是在ArcScene中显示垂直剖切的剖面,但是面要素类不可以是垂直的!所以只有借助Multipatch了。绘制面这个功能在ArcScene中已经实现了,在ArcScene中获得点是基于现有的面或者要素相交得到的。并不是很好用。绘制面的时候点击产生一系列点,最后双击得到需要的面。开始我以为是采用了某种Delaunay三角化的方法,但是后来觉得似乎并非如此。查对象模型图看到Multipatch包含的类型有三种:TriangleStrip、Ring和TriangleFan。TriangleStrip以前绘制巷道时用过,但是Ring和TriangleFan没有用过。是不是这个Ring的功能呢?Ring继承自Path,Polygon也是有多个Ring组成的。看来有门!
查看AE的示例程序,感觉Ring完全可以满足我的要求,把面要素转成Multipatch!不过这个Ring自身是如何构建的确实是个问题!是属于Mesh(网格,网眼)构模的内容吗?等一下贴出自己讲二维剖面转换为三维剖面的代码!
补充代码:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 IQueryFilter pQueryfilter = new QueryFilterClass();
2 IFeatureCursor featCursor = pInPolygonFClass.Search(null, true);
3 IFeature feat=featCursor.NextFeature();
4 while (feat != null)
5 {
6 if (feat.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
7 {
8 IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();
9 IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch;
10 IPolygon4 polygon = feat.Shape as IPolygon4;
11 //IPolygon4.ExteriorRingBag should be used instead of IPolygon.QueryExteriorRings,
12 //which does not work in .NET because of C-Style Arrays
13 IGeometryBag exteriorRings = polygon.ExteriorRingBag;
14 //For each exterior rings find the number of interior rings associated with it and print it
15 IEnumGeometry exteriorRingsEnum = exteriorRings as IEnumGeometry;
16 exteriorRingsEnum.Reset();
17 IRing currentExteriorRing = exteriorRingsEnum.Next() as IRing;
18
19 int counter = 1;
20 while (currentExteriorRing != null)
21 {
22 IRing ExteriorRing3d = ProfileUtility.Ring_3D_2D_Manual(currentExteriorRing, m_U_Matrix, 0, 1);
23 multiPatchGeometryCollection.AddGeometry(ExteriorRing3d as IGeometry, ref _missing, ref _missing);
24
25 multiPatch.PutRingType(ExteriorRing3d, esriMultiPatchRingType.esriMultiPatchOuterRing);
26 //IPolygon4.get_InteriorRingBag should be used instead of IPolygon.QueryInteriorRings,
27 //which does not work in .NET because of C-Style Arrays
28 IGeometryBag interiorRings = polygon.get_InteriorRingBag(currentExteriorRing);
29 IEnumGeometry interiorRingsEnum = interiorRings as IEnumGeometry;
30 interiorRingsEnum.Reset();
31 IRing currentinteriorRing = interiorRingsEnum.Next() as IRing;
32 while (currentinteriorRing != null)
33 {
34 IRing interiorRing3d = ProfileUtility.Ring_3D_2D_Manual(currentinteriorRing, m_U_Matrix, 0, 1);
35 multiPatchGeometryCollection.AddGeometry(interiorRing3d as IGeometry, ref _missing, ref _missing);
36
37 multiPatch.PutRingType(interiorRing3d, esriMultiPatchRingType.esriMultiPatchInnerRing);
38 currentinteriorRing = interiorRingsEnum.Next() as IRing;
39 }
40 currentExteriorRing = exteriorRingsEnum.Next() as IRing;
41 counter++;
42 }
43 IFeature pFeat = pClass.CreateFeature();
44 pFeat.Shape = multiPatchGeometryCollection as IGeometry;
45 pFeat.set_Value(2, feat.get_Value(0));
46 pFeat.Store();
47 }
48 feat = featCursor.NextFeature();
49 }