ArcGIS接口详细说明之个人开发心1.docx

上传人:b****0 文档编号:16855684 上传时间:2023-07-19 格式:DOCX 页数:71 大小:39.77KB
下载 相关 举报
ArcGIS接口详细说明之个人开发心1.docx_第1页
第1页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第2页
第2页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第3页
第3页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第4页
第4页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第5页
第5页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第6页
第6页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第7页
第7页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第8页
第8页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第9页
第9页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第10页
第10页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第11页
第11页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第12页
第12页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第13页
第13页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第14页
第14页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第15页
第15页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第16页
第16页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第17页
第17页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第18页
第18页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第19页
第19页 / 共71页
ArcGIS接口详细说明之个人开发心1.docx_第20页
第20页 / 共71页
亲,该文档总共71页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

ArcGIS接口详细说明之个人开发心1.docx

《ArcGIS接口详细说明之个人开发心1.docx》由会员分享,可在线阅读,更多相关《ArcGIS接口详细说明之个人开发心1.docx(71页珍藏版)》请在冰点文库上搜索。

ArcGIS接口详细说明之个人开发心1.docx

ArcGIS接口详细说明之个人开发心1

ArcGIS接口详细说明之个人开发心得

1.      关于IField接口(esriGeoDatabase)

2.      关于IFieldEdit接口(esriGeoDatabase)

3.      关于IFields接口(esriGeoDatabase)

4.      关于IPoint接口(esriGeometry)

5.      关于IPointArray接口(esriGeometry)

6.      关于IPointCollection接口(esriGeometry)      

7.      关于IPolyline接口(esriGeometry)

8.      关于IGeometry接口(esriGeometry)

9.      关于IArea接口(esriGeometry)

10.      关于IEnvelope接口(esriGeometry)

11.      关于IFeature接口(esriGeoDatabase)

12.      关于IRow接口(esriGeoDatabase)

13.      关于IFeatureClass接口(esriGeoDatabase)

14.      关于ITable接口(esriGeoDatabase)

15.      关于IFeatureCursor接口(esriGeoDatabase)

16.      关于IQueryFilter接口(esriGeoDatabase)

17.      关于IFeatureLayer接口(esriCarto)

18.      关于IFeatureSelection接口(esriCarto)

19.      关于IMap接口(esriCarto)

20.      关于IPropertySet接口(esriSystem)

21.      关于IFeatureWorkspace接口(esriGeoDatabase)

22.      关于IWorkspaceEdit接口(esriGeoDatabase)

23.      关于IWorkspaceFactory接口(esriGeoDatabase)

24.      关于ITopologicalOperator接口(esriGeometry)

25.      创建Buffer并选择里面的要素

26.      Merge要素Union要素  

27.      怎样从Table中获取具体需求值的Row

28.      怎样ZoomInCenter

29.      怎样读取一个字段内的所有值

30.      怎样编辑更改属性字段的值

31.      怎样将MapControl中的Map复制到PageLayoutControl中

32.      怎样判断是否出于编辑状态

33.      怎样用点创建一个Polygon

34.      怎样运用属性来计算总面积

35.      关于属性域的一些心得

36.      怎样实现翻折Flip方法

37.      回答cumtbGIS关于ITopologicalOperator接口Clip方法的问题

38.      回答机器猫FJJ关于ISpatialFilter接口方法的问题(完整函数)

39.      回答网友韶华响当当关于更改符号的代码(完整函数)

40.      回答网友韶华响当当关于显示属性的代码(完整函数)

1.      关于IField接口(esriGeoDatabase)

IField接口的第一个属性AliasName(只读,获得字段的别名)

IField接口的第二个方法CheckValue(Value)(方法,对于指定的属性字段,基于字段类型判断参数值是否有效,有效,则返回True,否则返回False)

例子代码:

'GetField

SetpField=pFields.Field(6)  

bChkField=pField.CheckValue(45.86)  

IfbChkField=TrueThen

'Adddatatoselectedrowsforthefieldselected.

EndIf

复制代码

IField接口的其他属性均为只读属性,常用有Name(只读,获得字段的名称)

例子代码:

DimpFieldsAsIFields

DimpFieldAsIField

DimpGeoDefAsIGeometryDef

DimpDomainAsIDomain

DimiAsLong

SetpFields=pFeatClass.Fields

Fori=0TopFields.FieldCount-1

  SetpField=pFields.Field(i)

  IfpField.Type=esriFieldTypeGeometryThen

  SetpGeoDef=pField.GeometryDef

  Else

  Debug.PrintpField.AliasName

  Debug.PrintpField.DefaultValue

  SetpDomain=pField.Domain

  Debug.PrintpField.Editable

  Debug.PrintpField.IsNullable

  Debug.PrintpField.Length

  Debug.PrintpField.Name

  Debug.PrintpField.Precision

  Debug.PrintpField.Required

  Debug.PrintpField.Scale

  Debug.PrintpField.Type

  Debug.PrintpField.VarType

  EndIf

Next

2.    关于IFieldEdit接口(esriGeoDatabase)

所有该接口的属性均为可读可写,经常用与对新建字段的设置,因为字段一旦被设置,其基本属性就不能被更改,所以就需要该接口类型的变量去转换,方法为:

IFeatureClasspFC_SCP_PT;

IFieldEditeditPT=newFieldClass();

pFC_SCP_PT.AddField((IField)editPT);

如果在vb中去编写代码,则赋值和获取均为同一属性,而在C#中,为了区分设置和获取,属性均有两个,类似于Name和Name_2,这样就可以区分了,普遍用设置的带有_2的那个属性。

IFieldEdit接口的第一个属性Name(读写,设置或者获取该变量类型变量字段的名称)

IFieldEdit接口的第二个属性Precision(读写,设置或者获取该变量类型变量字段的长度)

IFieldEdit接口的第三个属性Scale(读写,设置或者获取该变量类型变量字段的精度)

IFieldEdit接口的第四个属性Type(读写,设置或者获取该变量类型变量字段的类型)

例子代码:

IFeatureClasspFC_SCP_PT;

editPT=newFieldClass();

editPT.Precision_2=8;

editPT.Scale_2=3;

editPT.Name_2="ELEV1";

editPT.Type_2=esriFieldType.esriFieldTypeDouble;

3.      关于IFields接口(esriGeoDatabase)

IFields接口的第一个属性Field(Index)(只读,以用于获取具体的字段,返回类型为IField)

IFields接口的第二个属性FieldCount(只读,以用于获取属性的数量)

利用上面两个接口并用索引去依次循环获得每一列的属性pField(Ifield接口)

例子代码:

DimiAsLong

DimpFieldAsIField

Fori=0To(pFields.FieldCount-1)

  SetpField=pFields.Field(i)

  Debug.PrintpField.Name&":

"&pField.Type

Nexti

复制代码

IFields接口的第三个方法FindField(Name)(方法,输入想要查找的属性域字段的名称,如果有,则返回该属性域字段在此Fields的索引,没有则返回-1)

例子代码:

DimiAsInteger

DimpFieldsAsIFields

DimpFieldAsIField

'GetFields

SetpFields=pFeatClass.Fields

'Findthefieldnamed"average_income"

i=pFields.FindField("average_income")

'Setthecurrentfield

SetpField=pFields.Field(i)

'Deletefieldfromfeatureclass

pFeatClass.DeleteFieldpField

复制代码

IFields接口的第四个方法FindFieldByAliasName(Name)(方法,与第三个方法类似,此时输入的为该列属性字段的别名,此方法不经常用)

例子代码:

DimiAsInteger

DimpFieldsAsIFields

DimpFieldAsIField

'GetFields

SetpFields=pFeatClass.Fields

'Findthefieldwiththealiasname"currentpopulation"

i=pFields.FindFieldByAliasName("currentpopulation")

'Setthecurrentfield

SetpField=pFields.Field(i)

'Deletefieldfromfeatureclass

pFeatClass.DeleteFieldpField

4.    关于IPoint接口(esriGeometry)

IPoint接口的第一个方法PutCoords(X,Y)(方法,设置该点的坐标)或者直接调用可以读写的属性X和Y,将坐标赋值给X和Y

例子代码:

DimpPointAsIPoint

SetpPoint=NewPoint

pPoint.PutCoords100,100

复制代码

IPoint接口的第二个方法QueryCoords(X,Y)(方法,得到该点的坐标)

例子代码:

DimpPointasIPoint

DimdXasDouble,dYasDouble

pPoint.QueryCoordsdX,dY

复制代码

IPoint接口的第三个方法ConstrainAngle(constraintAngle,anchor,allowOpposite)(方法,如果第三个参数allowOpposite为True,则将第二个参数anchor这个点作为一个原点,然后以第一个参数constraintAngle为与x轴的角度,做一条直线,再将调用此参数的点向该直线做垂线并交于一个新点,并将调用此方法的点移动到该点)

例子代码:

'Findstheclosespointtolinefrom(0,0)withangles

'definedbystepsofpi/4(Noteallanglesinradians)

  DimpApointAsIPoint

  DimpNpointAsIPoint

  DimpiAsDouble

  DimdAngleAsDouble

  DimiAsLong

  

  SetpApoint=NewPoint

  pi=4*Atn

(1)

  dAngle=0

  pApoint.PutCoords0,0

  

  SetpNpoint=NewPoint

  

  Fori=0To7

    pNpoint.PutCoords1,0

    dAngle=i*pi/4

    pNpoint.ConstrainAngledAngle,pApoint,True

    MsgBox"angle="&i&"*pi/4"&vbCrLf&pNpoint.X&","&pNpoint.Y

  Nexti

复制代码

IPoint接口的第四个方法ConstrainDistance(constraintRadius,anchor)(方法,以第二个参数anchor这个点为圆心,然后以第一个参数constraintRadius为半径做一个圆,将调用此参数的点移动到该点与圆心做线段交于该圆的交点上)

例子代码:

PublicSubt_constraindistance()

  DimpPointAsIPoint

  DimpNPointAsIPoint

  DimdRadiusAsDouble

  

  SetpPoint=NewPoint

  pPoint.PutCoords0,0

  SetpNPoint=NewPoint

  pNPoint.PutCoords2,2

  dRadius=1.4142135623731

  

  pNPoint.ConstrainDistancedRadius,pPoint

  MsgBox"Radius="&dRadius&"x,y="&pNPoint.X&","&pNPoint.Y

EndSub

5.    关于IPointArray接口(esriGeometry)

IPointArray接口的第一个方法Add(p)(方法,向该类型的数组变量添加Point)

IPointArray接口的第二个属性Count(只读,获得该数组变量中Point的个数,返回Long类型变量)

IPointArray接口的第三个属性Element(Index)(只读,获得该数组变量中位于参数Index索引位置的点Point,返回一个Point类型的变量)

IPointArray接口的第四个方法Insert(Index,p)(方法,向索引位置Index插入一个点Point)

IPointArray接口的第五个方法Remove(Index)  (方法,移除索引位置Index的点Point)

IPointArray接口的第六个方法RemoveAll(方法,移除所有在此数组中的点)

6.    关于IPointCollection接口(esriGeometry)

IPointCollection接口的第一个方法AddPoint(inPoint[,before][,after])(方法,向该类型的点集变量添加Point,第一个参数为添加的Point,第二个第三个参数为可选择的参数,默认添加进点集的末尾)

IPointCollection接口的第二个属性Point(i)(只读,获得该点集变量中第i个位置的Point,返回IPoint类型变量,i从0计算开始)

IPointCollection接口的第三个属性PointCount(只读,获得该点集变量中点的个数,返回Long类型变量,切记,如果一个PointCollection变量是由闭合的Geometry转换而来的话,那么点的个数比节点数多一个,因为是闭合的,所以首位节点是同一个点)

7.    关于IPolyline接口(esriGeometry)

IPolyline接口的第一个属性FromPoint与ToPoint(读写,设置或者读取该点的起始点和终止点,返回都是IPoint类型的变量)

IPolyline接口的第二个方法QueryFromPoint(from)(方法,返回IPoint类型的变量到参数from)

IPolyline接口的第三个方法QueryToPoint(to)(方法,返回IPoint类型的变量到参数to)

PublicSubt_ICurve_QueryPoints()

  DimpIDAsNewUID

  pID="esriEditor.editor"

  DimpEditorAsIEditor

  DimpAppAsIApplication

  SetpApp=MxApplication

  SetpEditor=pApp.FindExtensionByCLSID(pID)

  

  If  pEditor.SelectionCount<>1Then

    MsgBox"selectoneCurve"

    ExitSub

  EndIf

  

  DimpEnumFeatAsIEnumFeature

  DimpFeatureAsIFeature

  SetpEnumFeat=pEditor.EditSelection

  DimpCurveAsICurve

  DimpPointFromAsIPoint

  DimpPointToAsIPoint

  

  SetpPointFrom=NewPoint

  SetpPointTo=NewPoint

  SetpFeature=pEnumFeat.Next

  WhileNotpFeatureIsNothing

    IfpFeature.Shape.GeometryType=esriGeometryPolylineOr_

    esriGeometryPolylineOresriGeometryLineThen

    SetpCurve=pFeature.Shape

    pCurve.QueryFromPointpPointFrom

    pCurve.QueryToPointpPointTo

    MsgBox"+++ICurveproperties..."&vbCrLf_

      &"Curve.QueryFromPoint(x,y)="&pPointFrom.X&","&pPointFrom.Y&vbCrLf_

      &"Curve.QueryToPoint(x,y)="&pPointTo.X&","&pPointTo.Y&vbCrLf

    EndIf

    SetpFeature=pEnumFeat.Next

  Wend

EndSub

复制代码

IPolyline接口的第四个方法Generalize(maxAllowableOffset)(方法,用道格拉斯普克发来简化polyline)

IPolyline接口的第五个方法Weed(maxAllowableOffsetFactor)(方法,和方法Generalize类似,均为简化polyline的方法,不同的是参数。

8.    关于IGeometry接口(esriGeometry)

PublicSubt_IGeometry_polygon()

  DimpIDAsNewUID

  pID="esriEditor.editor"

  DimpEditorAsIEditor

  DimpAppAsIApplication

  SetpApp=Application

  SetpEditor=pApp.FindExtensionByCLSID(pID)

  

  IfpEditor.SelectionCount<>  1Then

    MsgBox"selectonepolygon"

    ExitSub

  EndIf

  

  DimpEnumFeatAsIEnumFeature

  DimpFeatureAsIFeature

  SetpEnumFeat=pEditor.EditSelection

  DimpGeometryAsIGeometry

  SetpFeature=pEnumFeat.Next

  WhileNotpFeatureIsNothing

    IfpFeature.Shape.GeometryType=esriGeometryPolygonThen

(通过pFeature.Shape获得Geometry)

    SetpGeometry=pFeature.Shape

    MsgBox"+++Polygon:

:

IGeometryproperties..."&vbCrLf_

      &"Dimension="&pGeometry.Dimension&vbCrLf_

      &"Geometrytype="&pGeometry.GeometryType&vbCrLf_

      &"Envelope=  "&pGeometry.Envelope.XMin&","&pGeometry.Envelope.YMin&","_

      &pGeometry.Envelope.XMax&","&pGeometry.Envelope.YMin&vbCrLf_

      &"IsEmpty=  "&pGeometry.IsEmpty&vbCrLf_

      &"SpatialReference="&pGeometry.SpatialReference.Name

    EndIf

    SetpFeature=pEnumFeat.Next

  Wend

EndSub

复制代码

IGeometry接口的第一个属性Dimension(只读,返回一个类型为esriGeometryDime

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2