|
|
本帖最后由 wyude 于 2014-4-21 20:27 编辑
求助,哪位用过GetVolumeAndArea这个函数计算过填方
tinSurface3.GetVolumeAndArea(pPolygon as IGeometry, height, esriPlaneReferenceType.esriPlaneReferenceBelow, out IsOutsideDataArea, volume, area, proarea);
希望得到指导帮助。程序运行到这里就不继续了,也不报错,而且第四个参数在帮助文档里是ref类型,但是在vs2010里面却是out类型。
我的代码
- public override void OnMouseDown(int Button, int Shift, int X, int Y)
- {
- // TODO: Add Length.OnMouseDown implementation
- if (Shift == 1) { MessageBox.Show("Only can choose one graph a time"); return; }
- IGraphicsContainer3D pGCT3D = m_sceneHookHelper.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
- ISceneGraph pSG = m_sceneHookHelper.SceneGraph;
- IPoint pPt;
- object pOwner, pObject;
- pSG.Locate(pSG.ActiveViewer, X, Y, esriScenePickMode.esriScenePickGraphics, false, out pPt, out pOwner, out pObject);
- IElement ele = (IElement)pObject;
- if (ele is IPolygonElement)
- {
- IPolygon pPolygon = ele.Geometry as IPolygon;
- double height = pPolygon.FromPoint.Z+1;//pPt.Z;
- MessageBox.Show("最高点 "+height);
- ITinEdit tinEdit = tin as ITinEdit;
- // tinEdit.StartEditing();
- ITinSurface3 tinSurface3 = tin as ITinSurface3;
- bool IsOutsideDataArea = true;
- object volume = Type.Missing;
- object area = Type.Missing;
- object proarea = Type.Missing;
- MessageBox.Show("doubi");
- tinSurface3.GetVolumeAndArea(pPolygon as IGeometry, height, esriPlaneReferenceType.esriPlaneReferenceBelow, out IsOutsideDataArea, volume, area, proarea);
- MessageBox.Show("doubi2"); MessageBox.Show(Convert.ToString(volume) + Convert.ToString(area));
- }
复制代码
|
|