ArcGIS Engine 9.3二次开发----两个面咬合
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcGIS Engine 9.3二次开发----两个面咬合相关的知识,希望对你有一定的参考价值。
如图,两个靠的比较近的面,要把他们之间的空隙去掉,变成两个共边的面。 我的设计是:1.手动选择两个面2.遍历两个面的所有拐点,找到需要的拐点;3.通过拐点自动构建线4.构建的线转成面5.构建成的面与之前手动选择的面中先选择的面进行融合。6.完成。 我是初学Arcengin 二次开发 对其中提供的组件方法函数 不是太了解 麻烦大侠们 能不能提供一下方法 帮助我完成! 目前 我遇到的困难就是,1.怎么能遍历拐点 找到需要的拐点????2.找到拐点后怎么能自动够构建出线来????3.构建成线,如何自动构建出面???? 注意:不改变两个面的空间位置
参考技术A 你不必才华横溢,必须知书达理;不必有标准的五官,必须有独特的气质,当你拥有健康红润的面颊,当你永远表现得神采奕奕精力充沛,当你灿烂的笑容像冬天的暖阳,当你不经意地关心四周的人和事,当你始终如一地保持豁达的风度,这就是你的魅力。ArcGIS Engine生成等值线(C#)
原文:ArcGIS Engine生成等值线(C#)本文介绍c#写的利用ArcGIS Engine生成等值线的方法。
c#写的根据雨量站的降雨量值内插出降雨量等值线的功能。做几点说明:
根据离散点生成等值线:
(1)判断等值线shapefile图层临时存放路径是否存在,如果不存在则创建,如果存在并不为空则删除重建;
(2)加【降雨量】字段并赋值,生成等值线后删除所加字段;
(3)根据所选的字段利用IDW内插生成raster,再设定间距生成contour并标注。
---------------------------------以下是源代码----------------------------------
private void button1_Click(object sender, EventArgs e)
{
//定义等值线临时shapefile图层存放路径
string ls_TempSavePath = @"C:\\HNYTTEMP" ;
if (!Directory.Exists(ls_TempSavePath))//如果目录不存在,则创建
Directory.CreateDirectory(ls_TempSavePath);
DirectoryInfo di = new DirectoryInfo(ls_TempSavePath);
FileInfo[] fi = null;
fi = di.GetFiles();
if (fi.Length != 0)//如果目录不为空,则删除目录,然后重建
{
Directory.Delete(ls_TempSavePath, true);
Directory.CreateDirectory(ls_TempSavePath);
}
IMap pMap = axMapControl1.Map;
IInterpolationOp pInterpolationOp = new RasterInterpolationOpClass();
// Create the input point object
IGeoDataset pInputDataset ;
//雨量站图层【点】
IFeatureLayer pFeatLayer = axMapControl1.get_Layer(0) as IFeatureLayer;
// Calls function to open the point dataset from disk
IFeatureClass pFeatCla = pFeatLayer.FeatureClass;
IFeature pFeature ;
IField pField = new FieldClass();
IFieldEdit pFieldEdit = pField as IFieldEdit;
pFieldEdit .Name_2 = "降雨量";
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
pFieldEdit.Length_2 = 12;
pFieldEdit.IsNullable_2 = false;
pFieldEdit.DefaultValue_2 = 1111;
pFeatCla.AddField(pFieldEdit); //添加那个要用的字段进去
for(int ii=0;ii<pFeatCla.FeatureCount(null) - 1;ii++)
{
pFeature = pFeatCla.GetFeature(ii);
pFeature.set_Value(pFeature.Fields.FindField("降雨量"), 22+1999/(ii+2));
//要素字段赋值,这里是自己随便赋的值,仅做测试用
pFeature.Store();
}
pInputDataset = pFeatLayer as IGeoDataset;
// Define the search radius
IRasterRadius pRadius = new RasterRadiusClass();
object Missing = Type.Missing;
pRadius.SetVariable(12, ref Missing);
//Create FeatureClassDescriptor using a value field
IFeatureClassDescriptor pFCDescriptor = new FeatureClassDescriptorClass();
pFCDescriptor.Create( pFeatLayer.FeatureClass, null, "降雨量");
//Set cellsize for output raster in the environment
object cellSizeProvider = 20;
IRasterAnalysisEnvironment pEnv = pInterpolationOp as IRasterAnalysisEnvironment;
pEnv.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref cellSizeProvider);
//Perform the interpolation
IRaster pOutRaster = pInterpolationOp.IDW(pFCDescriptor as IGeoDataset, 2, pRadius, ref Missing) as IRaster;
//Add output into ArcMap as a raster layer
RasterLayer pOutRasLayer = new RasterLayerClass();
pOutRasLayer.CreateFromRaster(pOutRaster);
pOutRasLayer.Name = "栅格";
//pMap.AddLayer(pOutRasLayer);
IGeoDataset pGeoDataSet = pOutRaster as IGeoDataset;
IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();
IWorkspace pShpWorkspace = pWorkspaceFactory.OpenFromFile(ls_TempSavePath, 0);
ISurfaceOp2 pSurfaceOp2 = new RasterSurfaceOpClass();
IRasterAnalysisEnvironment pRasterAnalysisEnvironment = pSurfaceOp2 as IRasterAnalysisEnvironment;
pRasterAnalysisEnvironment.Reset();
pRasterAnalysisEnvironment.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref cellSizeProvider);
pRasterAnalysisEnvironment.OutWorkspace = pShpWorkspace;
double dInterval =5; //间距
IGeoDataset pOutputDataSet = pSurfaceOp2.Contour(pGeoDataSet, dInterval,ref Missing,ref Missing);
IFeatureClass pFeatureClass= pOutputDataSet as IFeatureClass;
IFeatureLayer pFeatureLayer = new FeatureLayerClass();
pFeatureLayer.FeatureClass = pFeatureClass;
IGeoFeatureLayer pGeoFeatureLayer = pFeatureLayer as IGeoFeatureLayer;
pGeoFeatureLayer.DisplayAnnotation = true;
pGeoFeatureLayer.DisplayField = "Contour";
pGeoFeatureLayer.Name = "降雨量等值线";
pMap.AddLayer( pGeoFeatureLayer);
axMapControl1.Refresh();
//删除【降雨量】字段
IFields pFields = pFeatCla.Fields;
int lFieldnumber = pFields.FindField("降雨量");
IField pField1 = pFields.get_Field(lFieldnumber);
pFeatCla.DeleteField(pField);
}
acelee
以上是关于ArcGIS Engine 9.3二次开发----两个面咬合的主要内容,如果未能解决你的问题,请参考以下文章
C# + arcgis engine 二次开发,怎样设置图层的颜色?
请问你是如何具体实现的 arcgis engine 二次开发怎样获取某线要素的结点及各结点的坐标值?