ArcEngine实现空间拓扑空间关联空间距离运算文档格式.docx
《ArcEngine实现空间拓扑空间关联空间距离运算文档格式.docx》由会员分享,可在线阅读,更多相关《ArcEngine实现空间拓扑空间关联空间距离运算文档格式.docx(27页珍藏版)》请在冰豆网上搜索。
A4…………ICurve3接口
A5…………ISegment接口
A6…………ICircularArc接口
---------------------------------------------------------------------------------------------------------
写在前面:
使用空间分析的时候,会提示这样的错误“异常来自HRESULT:
0x80040215”,其原因就是:
在使用ITopologicalOperator求交集等操作的时候,
有时会出现“HRESULT:
0x80040215”这个异常,
原来是空间参考不一样所致。
因此只要SpatialReference
属性设为同一空间参考就不会出现“HRESULT:
0x80040215”异常。
所以在进行空间分析之前,要保证所建立的shapefile文件具有相同的SpatialReference!
╔════════╗
╠════╣第A1个╠══════════════════════════════════════════════════╣
╚════════╝
●ITopologicalOperator5接口:
1.Providesadditionalinformationonnon-simplegeometries.【拓扑操作】
Members
Description
Boundary
返回值:
IGeometry
Theboundaryofthisgeometry.Apolygon'
sboundaryisapolyline.Apolyline'
sboundaryisamultipoint.Apointormultipoint'
sboundaryisanemptypointormultipoint.
Buffer
(doubledistance)
IGeometry
Constructsapolygonthatisthelocusofpointsatadistancelessthanorequaltoaspecifieddistancefromthisgeometry.
通过给定距离,得到操作图形的缓冲区,返回得到缓冲区几何图形!
但是这里面的距离很是蹊跷,同时实验发现,我写入0.01的时候,大约表示1km,所以大约是1:
100000的关系!
Clip
(IEnvelopeclipperEnvelope)
Constructstheintersectionofthisgeometryandthespecifiedenvelope.
返回矩形部分的要素,直接作用在要素上面!
ClipDense
Constructstheintersectionofthisgeometryandthespecifiedenvelope;
densifieslinesinoutputcontributedbytheclippingenvelope.
ClipEx
ClipToDomain
Clipsthegeometrytothedomainofthespatialreference.Usefulforensuringthatbufferscanbefitwithinthespatialdomainofthefeatureclasstowhichtheyarebeingadded.
ConstructUnion
Definesthisgeometrytobetheunionoftheinputs.MoreefficientforunioningmultiplegeometriesthancallingUnionrepeatedly.
ConvexHull
Constructstheconvexhullofthisgeometry.
Cut
Splitsthisgeometryintoapartleftofthecuttingpolyline,andapartrightofit.
Cut2
Dividesageometryintomultipleparts
Difference
Constructsthegeometrycontainingpointsfromthisgeometrybutnottheothergeometry.
GeoNormalizeEx
Shiftslongitudes,ifneedbe,intoacontinuousrangeof360degrees.
Intersect
Constructsthegeometrythatistheset-theoreticintersectionoftheinputgeometries.UsedifferentresultDimensionvaluestogenerateresultsofdifferentdimensions.
IntersectMultidimension
Constructstheset-theoreticintersectionoftheinputs.Theresultsarereturnedinageometrybagwithoneelementperresultdimension.
IsKnownSimple
Indicateswhetherthisgeometryisknown(orassumed)tobetopologicallycorrect.
IsSimple
Indicateswhetherthisgeometryisknown(orassumed)tobetopologicallycorrect,afterexplicitlydeterminingthisifthegeometryisnotalreadyknown(orassumed)tobesimple.
IsSimpleEx
Determineswhyageometryisnotsimple.Currentlyonlyimplementedforpolygons.
QueryClipped
RedefinesclippedGeometrytobetheintersectionofthisgeometryandtheclippingenvelope.
QueryClippedDense
RedefinesclippedGeometrytobetheintersectionofthisgeometryandtheclippingenvelope;
densifieslinesintheoutputcontributedbytheclippingenvelope.
Simplify
Makesthisgeometrytopologicallycorrect.
SymmetricDifference
Constructsthegeometrythatcontainspointsfromeitherbutnotbothinputgeometries.
Union
Constructsthegeometrythatistheset-theoreticunionoftheinputgeometries.
CoClassesthatimplementITopologicalOperator
CoClassesandClasses
GeoEllipse(esriDefenseSolutions)
Itsaspheroidalellipse.
GeometryBag
AnorderedcollectionofobjectsthatsupporttheIGeometryinterface.
GeoPolygon(esriDefenseSolutions)
Itsaspheroidalpolygon.
GeoPolyline(esriDefenseSolutions)
Thisisaspheroidalpolyline.
MultiPatch
Acollectionofsurfacepatches.
Multipoint
Anorderedcollectionofpoints;
optionallyhasmeasure,heightandIDattributes.
Point
Atwodimensionalpoint,optionallywithmeasure,height,andIDattributes.
Polygon
Acollectionofringsorderedbytheircontainmentrelationship;
Polyline
Anorderedcollectionofpaths;
※|※→公共代码部分:
//公共变量!
~
IMappMap;
IActiveViewpActiveView;
IEnvelopepEnv;
ISelectionEnvironmentpSelectionEnv;
IEnumFeaturepEnumFeature;
IGraphicsContainerpGraphicsContainer;
IFeaturepFeature;
IGeometrypGeometry;
IEnvelopepEnvClip;
IPolylinepLineCut;
IPolygonpFirstPolygon;
//鼠标点击事件!
privatevoidaxMapControl1_OnMouseDown(objectsender,IMapControlEvents2_OnMouseDownEvente)
{
axMapControl1.MousePointer=esriControlsMousePointer.esriPointerCrosshair;
if(isClip)//此时要拉Clip框
{
pEnvClip=axMapControl1.TrackRectangle();
isClip=false;
}
elseif(isCut)
pLineCut=axMapControl1.TrackLine()asIPolyline;
isCut=false;
elseif(isFirstIn)
pMap=axMapControl1.Map;
pActiveView=pMapasIActiveView;
pEnv=axMapControl1.TrackRectangle();
pSelectionEnv=newSelectionEnvironment();
pSelectionEnv.DefaultColor=GetColor(0,255,0);
pMap.SelectByShape(pEnv,pSelectionEnv,false);
pActiveView.Refresh();
pEnumFeature=axMapControl1.Map.FeatureSelectionasIEnumFeature;
else
pSelectionEnv.DefaultColor=GetColor(255,0,0);
}
//RGB颜色!
privateIRgbColorGetColor(intr,intg,intb)
IRgbColorpColor=newRgbColor();
pColor.Red=r;
pColor.Green=g;
pColor.Blue=b;
returnpColor;
※|※→Buffer:
privatevoidbutton1_Click(objectsender,EventArgse)
while(true)
pGraphicsContainer=pMapasIGraphicsContainer;
//定义容器
pFeature=pEnumFeature.Next();
//遍历要素
if(pFeature==null)//若不存在要素,则推出循环
break;
pGeometry=pFeature.Shape;
//获取要素的Geometry
ITopologicalOperatorpTopoOperator=pGeometryasITopologicalOperator;
//QI到拓扑操作
IGeometrypBufferGeo=pTopoOperator.Buffer
(2);
//缓冲区分析
IElementpElement=newPolygonElement();
pElement.Geometry=pBufferGeo;
//获取得到的缓冲区
pGraphicsContainer.AddElement(pElement,0);
//显示缓冲区
※|※→Boundary:
privatevoidbutton2_Click(objectsender,EventArgse)
IGeometrypBoundary=pTopoOperator.Boundary;
//获取边界
ILineElementpLineEle=newLineElementClass();
ISimpleLineSymbolpSLS=newSimpleLineSymbol();
IRgbColorpColor=GetColor(0,255,0);
pSLS.Color=pColor;
pSLS.Width=5;
pLineEle.Symbol=pSLS;
IElementpElement=pLineEleasIElement;
pElement.Geometry=pBoundary;
//显示边界
※|※→Clip:
boolisClip=false;
privatevoidbutton3_Click(objectsender,EventArgse)
isClip=true;
privatevoidbutton4_Click(objectsender,EventArgse)
pTopoOperator.Clip(pEnvClip);
pElement.Geometry=pGeometry;
※|※→ConvexHull:
privatevoidbutton5_Click(objectsender,EventArgse)
IGeometrypBufferGeo=pTopoOperator.ConvexHull();
※|※→Cut:
boolisCut=false;
privatevoidbutton6_Click(objectsender,EventArgse)
isCut=true;
privatevoidbutton7_Click(objectsender,EventArgse)
//QI到拓扑操作ry
IGeometrypGeoRight=newPolygonClass();
IGeometrypGeoLeft=newPolygonClass();
pTopoOperator.Cut(pLineCut,outpGeoLeft,outpGeoRight);
IElementpElement=newPolygonEle