ArcMap扩展开发指南(英文版)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

269IllustratedcodesamplesCTheillustratedcodesamplesinthisappendixshowthefundamentalsofprogrammingwithArcObjects.Eachsampleisaccompaniedbyillustrationsoftheassociatedobjectsandtheirrelationships.ThecodecanbetypedorcopiedintoVBA,afterwhichyoucanfollowthroughwiththeVBAdebugger.AppendixC-ics.pmd1/26/2005,7:12AM269270•ArcGISDesktopDeveloperGuideITransform2DIBoundsPropertiesICloneIElementIElementPropertiesIPersistIPersistStreamIPropertySupportIElementProperties2Theobjectmodeldiagramsrevealastructurenotevidentinstandardobjectbrowsers.Shownhereisanabstractclass,Element,withnineinterfaces.TheIElementinterfaceisshownbecauseacodesamplemadeacalltoit.ReadingtheillustratedcodesamplesTheillustratedcodesamplesinthissectionshowyouthefundamentalsofprogrammingwithCOMcomponentsinArcObjects.StartbyenteringtheVBAenvironmentinArcMaporArcCatalogandtypeinthecode.StepthroughthecodeintheVBAdebugger.Lookatthesepagesandstudytherelationshipsbetweencoclassesandinterfaces.AcarefulreadingofthesamplesinthissectiongivesyoualltheimportantconceptsyouneedfordevelopingwithArcObjects,aswellasanintroductiontothemostimportantArcObjectscomponents.TheinterfaceTypeinheritanceInterfaceinheritanceAninterfaceisaspecificationofpropertiesandmethods.Manycoclassescanimplementthesameinterface.Interfacesallowahighdegreeofinteroperabilityandsharedbehavioramongasetofobjects.AreaFieldisareturnpropertyoftypeIField.FeatureClassIDisoftypelong.TheCreateFeaturemethodcreatesanobjectoftypeIFeature.FeatureCounttakesinaqueryfilterandreturnsalong.IFeatureClass:IObjectClassAreaField:IFieldFeatureClassID:LongFeatureDataset:IFeatureDatasetFeatureType:esriFeatureTypeLengthField:IFieldShapeFieldName:StringCreateFeature:IFeatureCreateFeatureBuffer:IFeatureBufferFeatureCount(inQueryFilter:IQueryFilter):LongGetFeature(inID:Long):IFeatureGetFeatures(infids:Variant,inRecycling:Boolean):IFeatureCursorInsert(inuseBuffering:Boolean):IFeatureCursorSearch(inFilter:IQueryFilter,inRecycling:Boolean):IFeatureCursorSelect(inQueryFilter:IQueryFilter,inselType:esriSelectionType,inselOption:esriSelectionOption,inselectionContainer:IWorkspace):ISelectionSetUpdate(inFilter:IQueryFilter,inRecycling:Boolean):IFeatureCursorShapeType:tagesriGeometryTypeAGraphicElementisanabstractclassthatspecifiestheoneinterfaceshownhereaswellasthenineinterfacesontheElementabstractclass.TextElementisacoclassthatimplementsfiveinterfacesinadditiontotheonefromGraphicElementandninefromElement.IGraphicElementGraphic-ElementIElementEditVerticesIGroupSymbolElementITextElementITransformEventsTextElementIElementEditCalloutITextElement:IUnknownScaleText:BooleanSymbol:ITextSymbolText:StringElementIElement:IUnknownLocked:BooleanSelectionTracker:ISelectionTrackerActivate(inDisplay:IDisplay)DeactivateDraw(inDisplay:IDisplay,intrackCancel:ITrackCancel)HitTest(inX:Double,inY:Double,inTolerance:Double):BooleanQueryBounds(inDisplay:IDisplay,inBounds:IEnvelope)QueryOutline(inDisplay:IDisplay,inOutline:IPolygon)Geometry:IGeometryIMapFrameandIMapSurroundFrameinheritfromIFrameElement.AllpropertiesandmethodsofIFrameElementareaccessibletothedeveloperwhoaccessesIMapFrameorIMapSurroundFrame.IFrameElement:IUnknownBackground:IBackgroundBorder:IBorderDraftMode:BooleanObject:VariantThumbnail:LongIMapFrame:IFrameElementContainer:IGraphicsContainerExtentType:esriExtentTypeEnumLocatorRectangleCount:LongMap:IMapMapBounds:IEnvelopeMapScale:DoubleRemoveAllLocatorRectanglesRemoveLocatorRectangle(inLocator:ILocatorRectangle)AddLocatorRectangle(inLocator:ILocatorRectangle)CreateSurroundFrame(inCLSID:IUID,inoptionalStyle:IMapSurround):IMapSurroundFrameLocatorRectangle(inIndex:Long):ILocatorRectangleIMapSurroundFrame:IFrameElementMapSurround:IMapSurroundMapFrame:IMapFrameQueryInterfaceQueryInterfaceisamethodintheIUnknowninterface,whichallCOMobjectsinheritfrom.Thismethodletsyouqueryforandnavigatetomethodsinotherinterfacesimplementedbyanobject.classinterface1method1method2method3method4interface2QueryInterfaceAppendixC-ics.pmd1/26/2005,7:12AM270AppendixCIllustratedcodesamples271LOCATEANDEXECUTECOMMANDONTOOLBARLocateandExecuteCommandonToolbarThissampleillustrateshowtoprogrammaticallyexecuteexistingcommandsoncommandbarswithinArcMap.ICommandItem:IUnknownAction:StringBuiltIn:BooleanCaption:StringCategory:StringCommand:ICommandFaceID:VariantGroup:BooleanHelpContextID:LongHelpFile:StringID:IUIDIndex:LongMessage:StringName:StringParent:ICommandBarStyle:esriCommandStylesTag:StringTooltip:StringType:esriCommandTypesDeleteExecuteRefreshResetDimpCommandItemAsICommandItemSetpCommandItem=ThisDocument.CommandBars.Find(ArcID.Query_ZoomToSelected)If(pCommandItemIsNothing)ThenExitSubpCommandItem.ExecuteSetpCommandItem=ThisDocument.CommandBars.Find(ArcID.ReportObject_CreateReport)If(pCommandItemIsNothing)ThenExitSubpCommandItem.Execute123AddthiscodetotheClickeventofacommandinArcMap.FrameworkArcMapUITofindthecommandtoexecute,youcanusetheCommandBarscollection.ThecommandbarscollectionisapropertyontheIDocumentinterface(ThisDocument).UsingtheFindmethod,searchusingtheArcIDmoduleto

1 / 32
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功