这几天在公司实习,用Arcgis Engine做项目查help时发现一些小问题,害我在找需要使用的接口和类时折腾了半天,把这些记下来方便大家。(本人所写模块有个功能是基于DEM的土方计算,使用的是C#)
1.
RasterSurface 在名字空间ESRI.ArcGIS.Analyst3D下,实现的接口如下
Interfaces | Description |
---|---|
IFunctionalSurface (Geometry) | Provides access to information about the functional surface, generating heights given x,y locations. Also see IFunctionalSurface2. |
IFunctionalSurface2 (Geometry) | Provides access to members that allow changes to be made to the interpolation domain, in addition to the IFunctionalSurface members. |
IRasterSurface | Provides access to members that manipulate and analyze a raster surface. |
ISurface (GeoDatabase) | Provides access to members that control surfaces. |
RasterSurface对应的实体类RasterSurfaceClass下关于ISurface.GetVolume等方法的说明
GetSurfaceArea | Returns the TIN's area measured on its surface above or below an input z value. | |
GetVolume | Returns the TIN's volume above or below an input z value. |
上面只说明返回TIN数据的表面积和体积,我就想是否需要把Raster转为TIN,由于项目相关的数据量很大,有40G,当时就考虑效率的问题,如果转换可能就可能会很慢,用户无法接受,于是在ArcMap下进行了相关的操作,实际使用时并不需要把Raster转换为TIN,我就想RasterSurface中应该有相关的功能,能直接得到Raster图层对应区域的表面积和一定高程相关的体积,我就去查实RasterSurface的对象模型图:RasterSurface实现的接口ISurface中
GetSurfaceArea (in referenceHeight: Double,in Type: esriPlaneReferenceType): Double
GetVolume (in reference: Double, in Type:esriPlaneReferenceType): Double
既然没有相应的说明,我就在代码中使用和计算TIN数据的表面积与体积的方法试验了一下,可以直接计算,而不需转换格式。
2.
由于要通过一个Polygon的参数传入计算土方的区域,我就在RasterClass中查找是否能传入polygon相关的参数,于是我就查询了IFunctionalSurface(Geometry)和IFuncitonalSurface2(Geometry).
IFuncitonalSurface接口
属性或方法 | 描述 | |
---|---|---|
Domain | Surface相关的类 | |
Z | Z = f(x,y). |
其中Z被标注为属性,实际是方法,通过x,y值得到Z值。
[C#]
public double get_Z (
double X,
double Y
);
熟悉C#语法的朋友应该知道,C#中属性的定义是
public porperty {
get{
....
}
set{
....
}
}
属性并不需要传入参数。
3.
IFunctionSurface2接口
它继承至IFunctionSurface.
在RasterSurface的对象模型图中,IFuncitonalSurface.Domain 属性是只读,而IFunctionalSurface2.Domain是只写,而在help中IFunctionalSurface和IFunctionalSurface2的Domain属性是相同链接相同的声明。
实际设置Domain属性时,应该为IFunctionalSurface2.Domain_2(只写) IFunctionalSurface2.Domain(只读)
(Engine的帮助文档还是有一些小错误的,在实际使用的时候和对象模型图对应起来,再在代码中尝试一下才是最重要的。)