版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、ArcGIS Engine基礎(chǔ)介紹,Esri西安分公司 姚嘯,介紹內(nèi)容,ArcGIS Engine簡(jiǎn)介 創(chuàng)建第一個(gè)ArcGIS Engine程序 練習(xí)DEMO,ArcGIS Engeine簡(jiǎn)介,ArcGIS Engine Developer Kit,開發(fā)包是組件, APIs 和工具的集合 開發(fā)人員可以用來創(chuàng)建高級(jí)的 GIS 應(yīng)用 組件 Engine 庫 制圖、繪制、選擇、編輯等 Control 庫 地圖控件、布局控件、工具條等 APIs COM、.NET、Java、C+ 工具 文檔、開發(fā)工具,ArcGIS Engine功能框架,基本服務(wù) 應(yīng)用層需要用到的 ArcObjects 核心對(duì)象 幾何圖
2、形的操作與顯示 數(shù)據(jù)訪問 地理數(shù)據(jù)集,矢量,柵格數(shù)據(jù) 地圖分析 屬性、空間查詢,地理數(shù)據(jù)處理 地圖顯示 渲染、標(biāo)注、制圖表達(dá) 開發(fā)組件 各種應(yīng)用層面上的 Control 及 Commands layer.ShowTips = true;,ToolTip tootip1 = new ToolTip; tootip1.SetToolTip(axMapControl1,這是一個(gè)提示);,PageLayoutControl控件,PageLayoutControl 封裝PageLayout coclass 繪制地圖元素 創(chuàng)建版面視圖 打印 設(shè)置當(dāng)前工具 加載地圖文檔 庫 PageLayoutContro
3、l.ocx,PageLayoutControl控件,使用PageLayout 來訪問其它對(duì)象 Elements(例子代碼 MapElements) FrameElements MapFrame MapSurroundFrame GraphicElements PictureElements,使用elements,關(guān)于elements有很多高級(jí)的成員函數(shù) IPageLayoutControl AddElement FindElementByName LocateFrontElement GraphicsContainer,地圖上顯示查詢結(jié)果element,查詢結(jié)果的渲染,ISimpleMarke
4、rSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass(); simpleMarkerSymbol.Color = rgb; simpleMarkerSymbol.Size = 30; IMarkerElement markerElement = new MarkerElementClass(); markerElement.Symbol = simpleMarkerSymbol; element = (IElement)markerElement; element.Geometry = point; graphicsContainer
5、 = (IGraphicsContainer)map; graphicsContainer.AddElement(element, 0);,使用地圖文檔,MXD 文件是結(jié)構(gòu)化的存儲(chǔ)文檔(保存路徑) 通常由ArcMap創(chuàng)建 包含持久對(duì)象 Maps, Layers, PageLayout, MapDocument 使以下成為可能 讀取 mxd, lyr, mxt, and pmf files 寫新的 mxd files 訪問map document的內(nèi)容,IMapDocument與mxd,讀取和寫地圖文檔的成員函數(shù) Open: 打開已經(jīng)存在的地圖文檔 (mxd, mxt, lyr, pmf) Sa
6、veAs: 保存當(dāng)前文檔到新的文件 CheckMxFile:檢查mxd是否存在 LoadMxFile:加載mxd文檔 ReadMxMaps:讀mxd文檔 New:新建mxd文檔 Save:保存mxd文檔,加載mxd,LoadMxFile,if (openFileDialog2.ShowDialog() = DialogResult.OK) string FilePath = openFileDialog2.FileName; if (axMapControl1.CheckMxFile(FilePath) axMapControl1.MousePointer = ESRI.ArcGIS.Cont
7、rols.esriControlsMousePointer.esriPointerHourglass; axMapControl1.LoadMxFile(FilePath, 0, Type.Missing); axMapControl1.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerDefault; else MessageBox.Show(FilePath + is not a vaild ArcMap document); return; ,訪問地圖文檔中的對(duì)象,控件可以直接引用對(duì)象 (Map
8、 and PageLayout) 或訪問自己的拷貝 Reference 直接 Copy 使用ObjectCopy 避免共享引用 深度復(fù)制,IMapDocument mapdoc = new MapDocument(); axMapControl1.Map = mapdoc.get_Map(0) ;,IObjectCopy objectcopy = new ObjectCopyClass(); IPageLayout pagelayout = objectcopy.Copy(mapdoc.PageLayout) as IPageLayout;,框架控件,ToolbarControl 和 TOCC
9、ontrol 被設(shè)計(jì)成和其它控件協(xié)同工作 通過一個(gè)buddy控件自動(dòng)捆綁在一起 根據(jù)彼此的狀態(tài)通信和同步 例子: active tool, layer visibility,Buddy Control,Toolbar,TOC,命令和工具,提供超過 100 個(gè)工具和命令,TocControl,顯示所有的圖層和符號(hào) Simple symbols, renderers Group layers 控制圖層可視性 必須調(diào)用SetBuddyControl 庫 TOCControl.ocx,ToolbarControl,自定義 commands, tools 和 menus的容器 允許命令和以下控件對(duì)象進(jìn)行
10、交互 Map, PageLayout, Scene, 和 Globe 必須調(diào)用 SetBuddyControl 庫 ToolbarControl.ocx,制圖控件命令,系統(tǒng)提供的控件命令, 工具, 工具條, 和菜單 命令和工具 漫游, 縮放, 打開地圖, 圖形繪制, 工具條 要素選擇, 繪圖, 地圖導(dǎo)航, 和 pagelayout 菜單 要素選擇和地圖瀏覽 庫 esriCommandControls.olb 參考 對(duì)象模型圖或技術(shù)文檔,創(chuàng)建第一個(gè)ArcGIS Engeine應(yīng)用程序,創(chuàng)建一個(gè)控件應(yīng)用程序 使用控件成員 使用工具條和TOC控件 加載 MXD 文檔 保存mxd文檔 打開shp,開發(fā)
11、環(huán)境,COM Visual Studio 6.0 (VB、VC+)、Delphi ArcGIS Engine 10 不再支持 VB 6.0 .NET Visual Studio .NET (VB .NET、C#、VC+.NET) ArcGIS Engine 10.1 不支持VS2008 C+ Visual Studio 6.0、Borland C+ Builder、C+ Java JBuilder、Eclipse、JDK,開發(fā)環(huán)境,安裝VS2012 安裝ArcGIS SDK Developer Kit return; ,打開mxd,if (openFileDialog2.ShowDialog(
12、) = DialogResult.OK) string FilePath = openFileDialog2.FileName; if (axMapControl1.CheckMxFile(FilePath) axMapControl1.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerHourglass; axMapControl1.LoadMxFile(FilePath, 0, Type.Missing); axMapControl1.MousePointer = ESRI.ArcGIS.Cont
13、rols.esriControlsMousePointer.esriPointerDefault; else MessageBox.Show(FilePath + is not a vaild ArcMap document); return; ,打開shp,打開shp /axMapControl1.Map.ClearLayers(); IWorkspaceFactory pWorkspaceFactory; IFeatureWorkspace pFeatureWorkspace; IFeatureLayer pFeatureLayer; this.openFileDialog1.Filter
14、 = shp文件|*.shp; if (this.openFileDialog1.ShowDialog() = DialogResult.OK) this.textBox1.Text = this.openFileDialog1.FileName.ToString(); string strFullPath = openFileDialog1.FileName; if (strFullPath = ) return; int Index = strFullPath.LastIndexOf(); string filePath = strFullPath.Substring(0, Index);
15、 string fileName = strFullPath.Substring(Index + 1); /打開工作空間并添加shp文件 pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();/創(chuàng)建工作空間 pFeatureWorkspace = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(filePath, 0);/打開矢量數(shù)據(jù)所在的空間 pFeatureLayer = new FeatureLayerClass();/創(chuàng)建一個(gè)要素圖層 pFeatureLayer.Featur
16、eClass = pFeatureWorkspace.OpenFeatureClass(fileName);/將要素類加如到要素圖層 pFeatureLayer.Name = pFeatureLayer.FeatureClass.AliasName;/將要素類的名稱賦值給要素圖層 axMapControl1.Map.AddLayer(pFeatureLayer);/將圖層加到地圖控件 axMapControl1.ActiveView.Refresh();/刷新地圖,保存mxd,IMapDocument mapDoc4 = new MapDocumentClass(); mapDoc4.New(
17、F:/teuu5.mxd); IMxdContents mxdContents = axMapControl1.Map as IMxdContents; mapDoc4.ReplaceContents(mxdContents); mapDoc4.Save(false, true); mapDoc4.Close();,練習(xí)DEMO,打開數(shù)據(jù)源,打開gdb IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass(); workspace = workspaceFactory.OpenFromFile(“D:/dat
18、a.gdb”, 0); IFeatureWorkspace pFeatWorkspace = workspace as IFeatureWorkspace;IFeatureClass pFeatureClass = pFeatWorkspace.OpenFeatureClass(Water),打開sde IPropertySet propertySet = new PropertySetClass(); propertySet.SetProperty(SERVER, server); propertySet.SetProperty(INSTANCE, instance); propertySe
19、t.SetProperty(DATABASE, database); propertySet.SetProperty(USER, user); propertySet.SetProperty(PASSWORD, password); propertySet.SetProperty(VERSION, version); IWorkspaceFactory workspaceFactory = new SdeWorkspaceFactoryClass(); workspace = workspaceFactory.Open(propertySet, 0);,屬性查詢,ILayer layer =
20、axMapControl1.get_Layer(0); IFeatureLayer featureLayer = layer as IFeatureLayer; /獲取featureLayer的featureClass IFeatureClass featureClass = featureLayer.FeatureClass; IQueryFilter queryFilter = new QueryFilterClass(); IFeatureCursor featureCusor; string filter = DLMC = 旱地; queryFilter.WhereClause = f
21、ilter; featureCusor = featureClass.Search(queryFilter, true); if (featureCusor != null) IFeature fea = featureCusor.NextFeature(); while(fea != null) if (featureCusor = null) return; IGeometry geom = fea.Shape; IPolygon polygon = geom as IPolygon; Common.renderPolygon(polygon, axMapControl1.ActiveVi
22、ew, axMapControl1.Map); fea = featureCusor.NextFeature(); ,查詢所有旱地,繪制多邊形,IFillShapeElement pPolygonElement; ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass(); IPolygon pPolygon = new PolygonClass(); IRubberBand pRubberBand = new RubberPolygonClass(); ISimpleLineSymbol pSimpleLineSymbo
23、l = new SimpleLineSymbolClass(); pPolygonElement = new PolygonElementClass(); if (e.button = 1) pPolygon = (IPolygon)pRubberBand.TrackNew(axMapControl1.ActiveView.ScreenDisplay, null); pSimpleLineSymbol.Width = 2; pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; pSimpleLineSymbol.Color =
24、Common.GetRGBColor(46, 24, 63); pSimpleFillSymbol.Color = Common.GetRGBColor(11, 200, 145); pSimpleFillSymbol.Outline = pSimpleLineSymbol; IElement pElement = (IElement)pPolygonElement; pElement.Geometry = pPolygon; pPolygonElement.Symbol = pSimpleFillSymbol; IGraphicsContainer pGraphicsContainer = (IGraphicsContainer)axMapControl1.Map; pGraphicsContainer.AddElement(IElement)pPolygonElement, 0); axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);,地圖點(diǎn)擊繪制
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)學(xué)倫理教育實(shí)踐與反思總結(jié)
- 手術(shù)室護(hù)理操作規(guī)范與細(xì)節(jié)
- 醫(yī)療溝通:有效表達(dá)與尊重
- 生物醫(yī)學(xué)光學(xué)成像技術(shù)的創(chuàng)新與應(yīng)用
- 兒童護(hù)理心理輔導(dǎo)策略
- 護(hù)理質(zhì)量評(píng)估與改進(jìn)工具介紹
- 兒科診療服務(wù)滿意度提升分析
- 醫(yī)療行業(yè)創(chuàng)新項(xiàng)目投資與退出
- 2026年湖北生物科技職業(yè)學(xué)院高職單招職業(yè)適應(yīng)性考試備考題庫有答案解析
- 兒童保健項(xiàng)目成果展示
- 深圳市南山區(qū)雨污分流施工報(bào)價(jià)表
- 人力資源服務(wù)機(jī)構(gòu)管理制度
- 北師大版六年級(jí)上冊(cè)數(shù)學(xué)錯(cuò)題資源
- 聯(lián)合利華中國(guó)公司銷售運(yùn)作手冊(cè)
- GB/T 42287-2022高電壓試驗(yàn)技術(shù)電磁和聲學(xué)法測(cè)量局部放電
- 電子版?zhèn)€人簡(jiǎn)歷簡(jiǎn)單模板
- 壓覆礦產(chǎn)資源查詢申請(qǐng)表
- GB/T 9115-2010對(duì)焊鋼制管法蘭
- GB/T 6495.1-1996光伏器件第1部分:光伏電流-電壓特性的測(cè)量
- GB/T 26160-2010中國(guó)未成年人頭面部尺寸
- 《凝聚態(tài)物理學(xué)新論》配套教學(xué)課件
評(píng)論
0/150
提交評(píng)論