ArcGIS Engine地图查询

loading 分享 2026-8-10 下载文档

}

finally

{

try{

ystem.Runtime.InteropServices.Marshal.ReleaseComObject(oField);

System.Runtime.InteropServices.Marshal.ReleaseComObject(oFields);

System.Runtime.InteropServices.Marshal.ReleaseComObject(oFieldsEdit);

System.Runtime.InteropServices.Marshal.ReleaseComObject(oFieldEdit);

System.Runtime.InteropServices.Marshal.ReleaseComObject(pName);

System.Runtime.InteropServices.Marshal.ReleaseComObject(pWSF);

System.Runtime.InteropServices.Marshal.ReleaseComObject(pWSName);

System.Runtime.InteropServices.Marshal.ReleaseComObject(pMemoryWS);

System.Runtime.InteropServices.Marshal.ReleaseComObject(oFeatureClass);

}

catch

{

}

GC.Collect();

}

return oFeatureLayer;

}

catch (Exception Err)

{

MessageBox.Show(Err.Message, \提示\

return null;}

}

CODE:

///

在地图控件上添加透明临时图元///

///

///

///

public void AddTransTempEle(AxMapControl pMapCtrl, IGeometry pGeo, bool bAutoClear)

{

try

{

if (pMapCtrl == null) return;

if (pGeo == null) return;

if (pGeo.IsEmpty) return;

IGeometry pPolygon = null;

if (pGeo is IEnvelope)

{

object Miss = Type.Missing;

pPolygon = new PolygonClass();

IGeometryCollection pGeoColl = pPolygon as IGeometryCollection;

pGeoColl.AddGeometry(pGeo, ref Miss, ref Miss);

}

else if (pGeo is IPolygon)

{

(pGeo as ITopologicalOperator).Simplify();

pPolygon = pGeo;

}

else

{

MessageBox.Show( \几何实体类型不匹配\提示\

return;

}

//获取透明要素层

IFeatureLayer pFlyr = null;

for (int i = 0; i < pMapCtrl.LayerCount; i++)

{

if (pMapCtrl.get_Layer(i).Name == \

{

pFlyr = pMapCtrl.get_Layer(i) as IFeatureLayer;

break;

}

}

//透明临时层不存在需要创建

if (pFlyr == null)

{

pFlyr = AddFeatureLayerByMemoryWS(pMapCtrl,pMapCtrl.SpatialReference);

if (pFlyr == null)

{

MessageBox.Show(\创建透明临时图层发生异常\提示\

MessageBoxIcon.Information);

return;

}

}

IFeatureClass pFC = pFlyr.FeatureClass;

if (bAutoClear)

{

if (pFC.FeatureCount(null) > 0)

{

IFeatureCursor pFCursor = pFC.Search(null, false);

if (pFCursor != null)

{

IFeature pFeature = pFCursor.NextFeature();

if (pFeature != null)

{

while (pFeature != null)

{

pFeature.Delete();

pFeature = pFCursor.NextFeature();

}

}

System.Runtime.InteropServices.Marshal.ReleaseComObject(pFCursor);

}

}

}


ArcGIS Engine地图查询.doc 将本文的Word文档下载到电脑
搜索更多关于: ArcGIS Engine地图查询 的文档
相关推荐
相关阅读