2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩39頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、開發(fā) Engine 應(yīng)用程序的基本原理,2-2,課程2,ArcObjects librariesArcObjects Engine APIs開發(fā) Engine 應(yīng)用程序許可,2-3,ArcGIS 結(jié)構(gòu),所有產(chǎn)品共享ArcObjectsEngine包括核心 ArcObjects的功能,ArcGIS Desktop,ArcGIS Engine,ArcGIS Server,,2-4,ArcGIS 庫,所有產(chǎn)品共享庫一些特定庫不被共享

2、例如: esriArcMapUI明確哪些庫是屬于不同產(chǎn)品理解庫的互依賴性開發(fā)工具ArcGIS Developer HelpESRI 自動提及的附加資源,2-5,ArcGIS Engine library 體系結(jié)構(gòu),2-6,ArcObjects,所有ArcGIS產(chǎn)品都是由ArcObjects組成ArcObjects都是C++對象通過不同的應(yīng)用程序接口(API)來進(jìn)行調(diào)用本身其就是COM組成,2-7,,Component

3、(Map.dll),ClientArcMap,COM,連接一個軟件模型和另一個軟件模型的一種協(xié)議獨立的一種語言 二進(jìn)制規(guī)范運(yùn)用界面或組件來開發(fā)、配置程序模型客戶端調(diào)用服務(wù)器并且服務(wù)給予響應(yīng)所有通訊是通過接口進(jìn)行的,2-8,ArcObjects和COM API(應(yīng)用編程接口),所有ArcObjects COM 類型都已在類型庫里定義好并且類型庫是通過二進(jìn)制文件來進(jìn)行描述類: CLSIDs 和ProgIDs接口: IIDs

4、常量和列舉執(zhí)行DLL和 EXE文件開發(fā)工具ArcGIS Developer Help (VB6 or VC++)LibraryLocator, EOBrowser and OleView,*ArcObjects C++*.dll files,*COM Type Libraries*.olb files,2-9,COM 類,COM類執(zhí)行接口所有類執(zhí)行 IUnknown管理所有對象的產(chǎn)生、終結(jié)成員: QueryInter

5、face, AddRef 和 ReleaseCoclasses 是可創(chuàng)建的,Public Sub mapName() Dim pMap As IMap ‘你能通過一個接口來創(chuàng)建一個實例 Set pMap = New MapEnd Sub,,IUnknown,,,2-10,COM 接口,定義一組邏輯的方法和屬性從 IUnknown (default)繼承ArcObjects 支持客戶化接口通過 Quer

6、yInterface (QI)訪問接口,Public Sub mapName() Dim pMap As IMap Set pMap = New Map ‘通過定義的pMap你可以有權(quán)使用其的properties and methods MsgBox pMap.NameEnd Sub,,2-11,COM 外部連接的一些接口,提供跟客戶端來進(jìn)行交換的一些事件的途徑通過連接對象并接收它外部接口許多不同

7、的事件在ArcObjects都是可用的例如: document load events, map drawing events, editing events, …,Private WithEvents MxDocEvents As MxDocumentPrivate Sub setNewValues() . . . Set MxDocEvents = pMxDoc.FocusMap 'Now can a

8、ccess eventsEnd SubPrivate Function MxDocument_NewDocument() As Boolean MsgBox "New ArcMap document"End Function,,2-12,其他,類型庫中包含了所有COM類每個類型都有全球唯一標(biāo)識 (GUID)比如: CLSID, IID, Progid, …使用esriSystem.UID就可以代

9、表一個對象GUID詳細(xì)描述CLSID或ProgID (ProjectName.ClassName),Dim u As New UIDu.Value = "{4FDD8858-DF31-4D6B-8679-1FED633262DA}" 'CLSID of ControlsMapRotateToolDim u As New UIDu.Value = "esriControlCommands.

10、ControlsMapRotateTool“ 'ProgID of ControlsMapRotateTool,Dim command As ICommandcommand = AxToolbarControl1.CommandPool.FindByUID(u)If Not command Is Nothing Then MsgBox(command.Name)End If,2-13,ArcObjects和.NET

11、 API(應(yīng)用編程接口),所有ArcObjects類型 在 .NET 集合中都有定義主要的存儲方式都是 importing the COM type librariesPIA exposes all classes, interfaces and constants as managed .NET types 需要 .NET Framework 1.1開發(fā)工具ArcGIS Developer Help (.NET)ILDAS

12、M.exe,ArcObjects C++,COM Type Libraries,.NET Assemblies,Interop,2-14,ArcGIS .NET 集合 和命名空間,所有.NET項目都必須引用 ESRI集合比如: ESRI.ArcGIS.Carto.dll導(dǎo)入命名空間訪問ArcObjects .NET 類型比如: ESRI.ArcGIS.Carto集合具有互依賴性,‘Visual Basic .NET使用 ’Imp

13、orts‘ 關(guān)鍵字Imports ESRI.ArcGIS.esriSystemImports ESRI.ArcGIS.SystemUIImports ESRI.ArcGIS.CartoImports ESRI.ArcGIS.Display,2-15,.NET 類,被管理.NET類表示ArcObjects 對象兩種類型是可用的”Class”:執(zhí)行所有接口和以及類的成員: 代表真實的ArcObjects對象 創(chuàng)建.NET類

14、實例化實際的COM對象,Dim map as MapClass ‘注意map沒有聲明成IMapmap = New MapClass() map.Extent = envelope ‘Extent是IActiveView的屬性,,2-16,.NET 接口,.NET接口代表ArcObjects接口QueryInterface的不同技術(shù)Implicit castingExplicit casting使用TypeOf 防止使用Im

15、plicit casting而出現(xiàn)InvalidCastException錯誤,geometry = point 'Implicit cast in VB.NET (QI)geometry = CType(point, IGeometry)'Explicit cast in VB.NET (QI),Dim point As New PointClassDim geometry As IGeometry

16、If (TypeOf point Is IGeometry) Then geometry = pointEnd If,2-17,.NET 外接口,可以連接COM對象并且接收其事件使用.NET 類型掛起“Event” 到外接口比如: IActiveViewEvents_Event技術(shù)WithEvents: 用于默認(rèn)外接口Delegates : 用于連接非默認(rèn)外接口,Private SelectionChanged A

17、s IActiveViewEvents_SelectionChangedEventHandlerPublic Overrides Sub OnClick() 創(chuàng)建一個Delegates的實例,并添加其到SelectionChanged事件 SelectionChanged = New IActiveViewEvents_SelectionChangedEventHandler(AddressOf OnSelection

18、Changed) AddHandler map.SelectionChanged, SelectionChangedEnd SubPrivate Sub OnSelectionChanged() 'Event handler MessageBox.Show("Selection Changed")End Sub,2-18,其他,Execptions handling除所有COM之外應(yīng)

19、該聲明的 handle對象處理許多handle都要調(diào)用 ReleaseCOMObject 進(jìn)行釋放,Exception handling and garbage collection (ReleaseCOMObject) in disposeTry Dim env As IEnvelope = New EnvelopeClass() env.PutCoords(0D, 0D, 10D, 10D) Dim trans

20、As ITransform2D = env trans.Rotate(env.LowerLeft, 1D)Catch ex As System.Exception MessageBox.Show("Error: " + ex.Message) ‘ 完成所有事理的代碼.End Try,2-19,ArcObjects和Java API,在ArcObjects開發(fā)包里解壓縮所有Java類和接口通過使用

21、標(biāo)準(zhǔn)JAVA類型產(chǎn)生一個interop層訪問所有COM類型需要 JDK 1.4.2開發(fā)工具ArcGIS Developer Help (Java Doc),ArcObjects C++(*.dll),COM Type Libraries(*.olb),Java Classes(*.jar),,Interop,2-20,ArcObjects Java開發(fā)包和JAR 文件,應(yīng)用程序必須引用ArcObjects JARsarco

22、bjects.jar: Non-UI JNI equivalentsjintegra.jar: Runtime library that handles COM interoparcgis_visualbeans.jar: UI Java beans for controls (optional)導(dǎo)入一個或多個開發(fā)包或獨立類型com.esri.arcgis.com.esri.arcgis.carto.Map;com.esri

23、.arcgis.carto.*;,import com.esri.arcgis.system.*;import com.esri.arcgis.systemUI.*;import com.esri.arcgis.carto.*;import com.esri.arcgis.display.*;,2-21,Java類,Java類允許實例化并訪問ArcObjects COM對象Classes: 不可創(chuàng)建的CoClasses:

24、 使用“new”創(chuàng)建Publicly類,/* 下列方法不能創(chuàng)建類/FeatureClass fc = new FeatureClass();/* 比如通過FeatureWorkspace創(chuàng)建要素類*/ IFeatureClass fc = fw.openFeatureClass("featureclass name");,/* 直接通過NEW創(chuàng)建類*/Envelope env = new Envelope(

25、);,2-22,Java 接口,Java 接口可以表示ArcObjects接口兩類型Java 接口 = ArcObjects 接口Java proxy class = 此類用于執(zhí)行 Java 接口不能通過默認(rèn)proxy class訪問對象,IPointProxy proxyPoint = new IPointProxy(); // 錯誤,interface IArea : IUnknown public interfac

26、e IArea{}public class IAreaProxy implements IArea{},2-23,在Java 中創(chuàng)建接口及訪問接口,通過Java API訪問接口有兩種方法Class cast: 使用對象構(gòu)造器 Cross-cast (QI): 使用proxy class,IFeature feature = featureClass.getFeature(i); IGeometry geom = fea

27、ture.getShape();if (geom.getGeometryType() == esriGeometryType.esriGeometryPolygon){/*Note: “Polygon p = (Polygon) geom;” will give ClassCastException*/ Polygon poly = new Polygon(geom); doSomeProcessingOnPolygon(

28、poly);},IFeature feature = featureClass.getFeature(i);IGeometry geom = feature.getShape();/*Note: “IArea area = (IArea) geom;” will give ClassCastException*/IArea area = new IAreaProxy(geom);doSomeProcessingOnArea(a

29、rea);,2-24,在Java中外接口和事件,使用Java監(jiān)聽器可以連接到COM事件添加 to 外部接口技術(shù)添加和移除listener類如果要使用控件必須使用event adaptor class,// Wire up the events for MapControl map.addIMapControlEvents2Listener( new IMapControlEvents2Adapter() { public

30、 void onAfterDraw( IMapControlEvents2OnAfterDrawEvent evt ) throws IOException { if( evt.getViewDrawPhase() == esriViewDrawPhase.esriViewForeground ) { try { // draw the shape on the MapControl

31、map.drawShape( currentExtent, fillSymbol ); }catch( Exception e ) { System.err.println( "Error in drawing shape on MapControl" ); } }},2-25,其他,All other types handled as classes or interfa

32、cesStructuresEnumerationsVariants are defined as ObjectsReturn as Object type in order to downcast as type,//Structure WKSPointZpublic class _WKSPointZ { public double x; public double y; public double

33、 z;} //Enumeration esri3DAxispublic interface esri3DAxis { public static final int esriXAxis = 0; public static final int esriYAxis = 1; public static final int esriZAxis = 2;},ICursor spCursor = spTable.IT

34、able_search(spQueryFilter, false); IRow spRow = spCursor.nextRow(); //Iterate over the rowswhile (spRow != null) {Short ID = (Short) (spRow.getValue(1));String name = (String) (spRow.getValue(2));Short baseID = (

35、Short) (spRow.getValue(3));System.out.println(“ID=”+ ID +”\t name=”+ name +”\tbaseID=”+ baseID);spRow = spCursor.nextRow(); } //Move to the next row,2-26,,ArcGIS Engine和Desktop 類似兩層許可產(chǎn)品ArcView, ArcEditor 和 ArcInfo

36、Engine standard 和GDB Update擴(kuò)展Spatial, 3D, StreetMap USA,,ArcGIS 產(chǎn)品許可模型,,Desktop,Extensions,,ArcSDE Edit,ArcInfoArcEditor,,,GeodatabaseUpdate Option,Standard,ArcView,StandardEngine,3DAnalyst…,3DAnalyst…,Engine,2-27

37、,ArcGIS Engine runtime 許可: 產(chǎn)品,在運(yùn)行時,所有應(yīng)用程序都必須初始化產(chǎn)品許可使用 esriSystem::AoInitialize初始化產(chǎn)品許可可編寫的產(chǎn)品ArcViewArcEditorArcInfoEngine EngineGeoDB,Private m_pAoInitialize As IAoInitializePrivate Sub Form_Load() Set m_pAoIni

38、tialize = New AoInitialize m_pAoInitialize.Initialize esriLicenseProductCodeEngine End SubPrivate Sub Form_Unload(Cancel As Integer) m_pAoInitialize.ShutdownEnd Sub,2-28,ArcGIS Engine runtime 許可: 擴(kuò)展,應(yīng)用程序還可以初始化擴(kuò)展許

39、可使用AoInitialize管理擴(kuò)展的許可可編寫的擴(kuò)展3DAnalyst, SpatialAnalyst, 和StreetMap,Private m_pAoInitialize As IAoInitializePrivate Sub Form_Load() Set m_pAoInitialize = New AoInitialize m_pAoInitialize.Initialize esriLicenseProd

40、uctCodeEngine m_pAoInitialize.CheckOutExtension esriLicenseExtensionCode3DAnalystEnd SubPrivate Sub Form_Unload(Cancel As Integer) m_pAoInitialize.CheckInExtension (esriLicenseExtensionCode3DAnalyst) m_pAoIniti

41、alize.ShutdownEnd Sub,2-29,區(qū)別ArcGIS Engine和 Desktop許可,應(yīng)用程序能初始化ArcGIS Engine或Desktop許可使用IAoInitialize::IsProductCodeAvailable可以使用License來對用戶進(jìn)行選擇 …,' Try to check out Engine license firstIf m_pAoInitialize.IsProduc

42、tCodeAvailable(esriLicenseProductCodeEngine) = esriLicenseAvailable Then m_pAoInitialize.Initialize esriLicenseProductCodeEngine ' Try to check out Desktop license nextElseIf m_pAoInitialize.IsProductCodeAv

43、ailable(esriLicenseProductCodeArcView) = esriLicenseAvailable Then m_pAoInitialize.Initialize esriLicenseProductCodeArcViewEnd If,2-30,The runtime license 生命周期,步驟Check if the product is available with the IsProduct

44、CodeAvailable method. Check what extensions are available with the IsExtensionCodeAvailable method. Initialize the application with the product license. As required, 執(zhí)行 extension check outs and check ins with the Chec

45、kOutExtension and CheckInExtension methods. Shutdown the product license.,2-31,Licensing 規(guī)則,在執(zhí)行任何ArcObjects code 之前都必須對License initialization 在應(yīng)用程序還在持續(xù)的時候,應(yīng)用程序都將檢查 license 是否存在所有擴(kuò)展 licenses 都要被登記并且是合格的才能使用Cannot comb

46、ine or mix product and extension licensesShould write code to query the level of licensing available and 檢查Licenses的來源盡量初始化使用中用到的最小化的 licensing,2-32,創(chuàng)建Engine應(yīng)用程序: .NET,步驟創(chuàng)建一個項目引用ArcGIS庫初始化許可,2-33,步驟1:創(chuàng)建一個獨立項目,創(chuàng)建一個Wi

47、ndows應(yīng)用程序VB.NET或C#項目名稱是一個namespaceEngineLicenseApp,2-34,步驟2: 引用ArcGIS庫,手動引用ESR集合引用開發(fā)工具ESRI Automatic References add-in在所有類里導(dǎo)入引用,Imports ESRI.ArcGIS.esriSystemPublic Class frmEngineClient Inherits System.Windo

48、ws.Forms.Form,2-35,步驟3:初始化許可,手動實現(xiàn)這段代碼Developer toolsESRI License Initializer add-in,Private m_pAoInitialize As IAoInitializePrivate Sub Form_Load() Set m_pAoInitialize = New AoInitialize m_pAoInitialize.Initializ

49、e esriLicenseProductCodeEngine End SubPrivate Sub Form_Unload(Cancel As Integer) m_pAoInitialize.ShutdownEnd Sub,2-36,創(chuàng)建Engine應(yīng)用程序:Java,步驟:創(chuàng)建一個新的項目引用ArcGIS libraries初始化ArcGIS Engine for Java初始化許可,2-37,步驟1: 創(chuàng)建一個

50、獨立項目,設(shè)置目錄位置C:\Student\DAAE選擇Jframe窗口設(shè)置名字和位置比如: DaaeEngineClient定義開發(fā)包名字比如: com.esri.arcgis.daae.engine,2-38,步驟2: 引用ArcGIS libraries,激活ESRI 開發(fā)包可以訪問所有類在所有類中導(dǎo)入引用,package com.esri.arcgis.daae.engine;import javax.swi

51、ng.*;import java.io.IOException;import com.esri.arcgis.system.*;,2-39,步驟3: 初始化ArcGIS Engine,添加代碼到主要函數(shù)初始化ArcObjects初始化COM runtime for Java允許調(diào)用ArcGIS Engine Java API types,public static void main(String[] args){ //I

52、nitialize ArcGIS Engine for Java API usage. EngineInitializer.initializeEngine(); ...},2-40,步驟4: 初始化許可,手動執(zhí)行代碼Manually implement the codeDeveloper toolsESRI License Initializer add-in,public DaaeEngineClient(

53、) { initComponents(); this.show(); try{ DisableCommandButtons(); m_aoInitialize = new AoInitialize(); m_isProductInitialized = false; initArcObjec

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論