地信開(kāi)發(fā)實(shí)習(xí)報(bào)告_第1頁(yè)
地信開(kāi)發(fā)實(shí)習(xí)報(bào)告_第2頁(yè)
地信開(kāi)發(fā)實(shí)習(xí)報(bào)告_第3頁(yè)
地信開(kāi)發(fā)實(shí)習(xí)報(bào)告_第4頁(yè)
地信開(kāi)發(fā)實(shí)習(xí)報(bào)告_第5頁(yè)
已閱讀5頁(yè),還剩26頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

地理信息系統(tǒng)開(kāi)發(fā)與應(yīng)用實(shí)習(xí)報(bào)告學(xué)生姓名翟德坤專業(yè)年級(jí)09級(jí)空間班級(jí)班組一班實(shí)習(xí)日期2011.12.12-2011.12.16指導(dǎo)教師董超山東農(nóng)業(yè)大學(xué)

《ArcGIS二次開(kāi)發(fā)》教學(xué)實(shí)習(xí)一、目的意義通過(guò)實(shí)習(xí)使學(xué)生進(jìn)一步理解地理信息系統(tǒng)的開(kāi)發(fā)模式,熟悉ArcGIS二次開(kāi)發(fā)環(huán)境,能夠自行定制用戶界面,對(duì)AO中的主要對(duì)象模型,包括Map、Element、MapGrid、Style、Symbol和Geodatabase等對(duì)象模型簡(jiǎn)單應(yīng)用。進(jìn)一步鞏固和深化理論知識(shí),并利用AO中的MapControl控件結(jié)合實(shí)際案例進(jìn)行開(kāi)發(fā),鍛煉學(xué)生理論與實(shí)踐相結(jié)合的能力。培養(yǎng)學(xué)生的應(yīng)用能力和創(chuàng)新能力,培養(yǎng)學(xué)生嚴(yán)肅認(rèn)真、實(shí)事求是、吃苦耐勞、團(tuán)結(jié)協(xié)作的精神。要求學(xué)生必須參加每一個(gè)實(shí)習(xí)環(huán)節(jié),協(xié)作完成實(shí)習(xí)任務(wù),獨(dú)立完成實(shí)習(xí)報(bào)告。二、實(shí)習(xí)內(nèi)容:1、熟悉地理信息系統(tǒng)軟件二次開(kāi)發(fā)環(huán)境;2、利用地理信息系統(tǒng)軟件或開(kāi)發(fā)平臺(tái),進(jìn)行簡(jiǎn)單的二次開(kāi)發(fā);3、利用MapControl控件制作相對(duì)鷹眼程序。三、時(shí)間安排時(shí)間任務(wù)周一上午實(shí)習(xí)動(dòng)員、熟悉開(kāi)發(fā)環(huán)境,練習(xí)閱讀OMD圖。周一下午練習(xí)VBA開(kāi)發(fā)實(shí)例。(見(jiàn)附件AO)周二上午練習(xí)VBA開(kāi)發(fā)實(shí)例。(見(jiàn)附件AO)周二下午練習(xí)課件一、二中的例子。周三在二次開(kāi)發(fā)環(huán)境中,練習(xí)第三章:地圖是如何組成的實(shí)例。熟悉Map等對(duì)象模型。周四練習(xí)第五章:AE地圖的顯示中的實(shí)例,熟悉symbol等對(duì)象。周五練習(xí)MapControl控件的使用。結(jié)合實(shí)際,利用MapControl控件制作鷹眼程序。最后總結(jié)完成實(shí)習(xí)報(bào)告。結(jié)果:3.實(shí)例三功能:1.顯示當(dāng)前地圖層要素層層數(shù)代碼:SubZDKmacros3()DimpMxDocumentAsIMxDocumentDimpMapAsIMapDimlCountAsLongDimlIndexAsLongSetpMxDocument=Application.DocumentSetpMap=pMxDocument.FocusMaplCount=0ForlIndex=0To(pMap.LayerCount-1)IfTypeOfpMap.Layer(lIndex)IsIFeatureLayerThenlCount=lCount+1'計(jì)數(shù)器加1EndIfNextlIndexMsgBox"Numberofthefeaturelayers"&_"intheactivemap:"&lCountEndSub結(jié)果:4.實(shí)例四功能:顯示地圖集中第一幅地圖的地圖名稱顯示錯(cuò)誤數(shù)和錯(cuò)誤信息代碼:SubZDKmacros4()DimpMxDocumentAsIMxDocumentDimpMapsAsIMapsDimpMapAsIMapOnErrorGoToSUB_ERRORSetpMxDocument=Application.DocumentSetpMaps=pMxDocument.MapsSetpMap=pMaps.Item(0)MsgBoxpMap.NameExitSubSUB_ERROR:MsgBox"Error:"&Err.Number&"-"&Err.DescriptionEndSub結(jié)果:1.無(wú)錯(cuò)誤2.有錯(cuò)誤5.實(shí)例五功能:使當(dāng)前地圖的第一圖層變?yōu)榭梢暎梢暤脑挷蛔儯豢梢曌優(yōu)榭梢暎┧⑿庐?dāng)前視圖并刷新視圖表代碼:PublicSubZDKmacros5()DimpMxDocumentAsIMxDocumentDimpMapAsIMapDimpFeatureLayerAsIFeatureLayerDimpActiveViewAsIActiveViewDimpContentsViewAsIContentsViewSetpMxDocument=ThisDocumentSetpMap=pMxDocument.FocusMapSetpFeatureLayer=pMap.Layer(0)IfNotpFeatureLayer.VisibleThenpFeatureLayer.Visible=TrueEndIfSetpActiveView=pMappActiveView.RefreshSetpContentsView=pMxDocument.CurrentContentsViewpContentsView.RefreshpFeatureLayerEndSub結(jié)果:未使用前使用后6.實(shí)例六功能:1.按NAME查詢要素,查找“shandong”字段。代碼:SubZDKmacros6()DimpColorAsIRgbColorDimpMxdocumentAsIMxDocumentSetpMxdocument=Application.DocumentDimpMapAsIMapSetpMap=pMxdocument.FocusMapDimpFeaturelayerAsIFeatureLayerSetpFeaturelayer=pMap.Layer(0)DimCitynameAsStringCityname="Shandong"DimpFeatureAsIFeatureSetpFeature=GetCityFeature(pFeaturelayer,Cityname)DimpFeatureSAsIFeatureSelectionSetpFeatureS=pFeaturelayerpFeatureS.AddpFeatureSetpFeatureS.SelectionColor=getRGB(0,0,120)DimpDocAsIMxDocumentDimpActiveViewAsIActiveViewSetpDoc=Application.DocumentSetpActiveView=pDoc.activeViewpActiveView.Extent=pDoc.activeView.FullExtentpActiveView.RefreshEndSubPrivateFunctionGetCityFeature(pFeaturelayerAsIFeatureLayer,strCityNameAsString)AsIFeatureDimpFeatureClassAsIFeatureClassDimpQueryFilterAsIQueryFilterDimpFeatureCursorAsIFeatureCursorSetpFeatureClass=pFeaturelayer.FeatureClassSetpQueryFilter=NewQueryFilterpQueryFilter.WhereClause="NAME_1='"&strCityName&"'"SetpFeatureCursor=pFeatureClass.Search(pQueryFilter,False)DimpFeatureAsIFeatureSetpFeature=pFeatureCursor.NextFeatureIfpFeatureIsNothingThenSetGetCityFeature=NothingElseSetGetCityFeature=pFeatureEndIfEndFunctionPublicFunctiongetRGB(ByValredAsLong,ByValgreenAsLong,ByValblueAsLong)AsIColorDimpColorAsIRgbColorSetpColor=NewRgbColorpColor.red=redpColor.blue=bluepColor.green=greenEndFunction結(jié)果:使用前使用后7.實(shí)例七功能:放大當(dāng)前活動(dòng)地圖2倍縮小當(dāng)前活動(dòng)地圖2倍代碼:’1放大SubZDKmacros7()DimpDocAsIMxDocumentDimpActiveViewAsIActiveViewDimpEnvAsIEnvelopeSetpDoc=Application.DocumentSetpActiveView=pDoc.ActiveViewSetpEnv=pActiveView.ExtentpEnv.Expand0.5,0.5,True'pActiveView.Extent=pEnvpActiveView.RefreshEndSub’2縮小SubZDKmacros7()DimpDocAsIMxDocumentDimpActiveViewAsIActiveViewDimpEnvAsIEnvelopeSetpDoc=Application.DocumentSetpActiveView=pDoc.ActiveViewSetpEnv=pActiveView.ExtentpEnv.Expand2,2,True'pActiveView.Extent=pEnvpActiveView.RefreshEndSub結(jié)果:1.放大前放大后2縮小前縮小后8.實(shí)例八功能:1.顯示全圖代碼:SubZDKmacros8()DimpDocAsIMxDocumentDimpActiveViewAsIActiveViewSetpDoc=Application.DocumentSetpActiveView=pDoc.ActiveViewpActiveView.Extent=pDoc.ActiveView.FullExtentpActiveView.RefreshEndSub結(jié)果:使用前使用后9.實(shí)例九功能:1.清除當(dāng)前活動(dòng)圖層代碼:PrivateSubZDKmacros9()DimpDocAsIMxDocumentDimpActiveViewAsIActiveViewDimpMapAsIMap'地圖SetpDoc=Application.DocumentSetpActiveView=pDoc.ActiveViewIfTypeOfpActiveViewIsIMapThenSetpMap=pActiveViewpMap.ClearLayerspDoc.UpdateContentspActiveView.RefreshEndIfEndSub結(jié)果:使用前使用后10.實(shí)例十功能:1.查找圖層名稱等于CHN_adm1的圖層代碼:SubZDKmacros10()DimpDocAsIMxDocumentDimpmapAsIMapDimnameAsStringDimpLayerAsILayerSetpDoc=Application.DocumentSetpmap=pDoc.FocusMapname="CHN_adm1"SetpLayer=FindLayer(pmap,name)MsgBoxpLEndSubFunctionFindLayer(mapAsIMap,nameAsString)AsILayerDimiAsIntegerFori=0Tomap.LayerCount-1'第一層的索引為1Ifmap.Layer(i).name=nameThen'如果第i層的名稱為nameSetFindLayer=map.Layer(i)'獲取并返回該層ExitFunctionEndIfNextEndFunction結(jié)果:11.實(shí)例11功能:1.添加圖層代碼:SubZDKmacros11()DimwksFactAsIWorkspaceFactory'工作空間管理器DimwksAsIFeatureWorkspace'要素工作空間DimfcAsIFeatureClass'要素類DimlyrAsIFeatureLayer'要素層DimdsAsIDataset'數(shù)據(jù)集DimmxDocAsIMxDocument'地圖文檔DimmapAsIMap'地圖SetwksFact=NewShapefileWorkspaceFactory'創(chuàng)建Shape工作空間管理器Setwks=wksFact.OpenFromFile("E:\Arcgis\country\CHN_adm",0)'獲取工作空間Setfc=wks.OpenFeatureClass("CHN_adm0")'獲取要素類Setlyr=NewFeatureLayer'創(chuàng)建要素層Setlyr.FeatureClass=fc'向要素層中添加要素類Setds=fc'獲取數(shù)據(jù)集='用要素類的名稱命名要素層SetmxDoc=Application.Document'獲取當(dāng)前地圖文檔Setmap=mxDoc.FocusMap'獲取當(dāng)前地圖map.AddLayerlyr'添加圖層EndSub結(jié)果:增加前增加后12.實(shí)例十二功能:1.添加文本,是屏幕顯示“Hello”代碼:SubZDKmacros12()DimpDocAsIMxDocumentDimpActiveViewAsIActiveViewDimsymAsITextSymbolDimbndsAsIAreaSetpDoc=Application.DocumentSetpActiveView=pDoc.activeViewSetsym=NewTextSymbolsym.Font.size=100WithpActiveView.ScreenDisplaySetbnds=.DisplayTransformation.VisibleBounds.StartDrawing.hDC,esriNoScreenCache.SetSymbolsym.DrawTextbnds.Centroid.FinishDrawingEndWithEndSub結(jié)果:13.實(shí)例十三功能:1.選擇要素,顯示出城市名稱為“Jinan”的城市代碼:PrivateSubZDKmacors13()DimmxDocAsIMxDocumentDimlyrAsIFeatureLayerDimselAsIFeatureSelectionDimfilterAsIQueryFilterDimselEventsAsISelectionEventsSetmxDoc=Application.DocumentSetlyr=findlayer(mxDoc.FocusMap,"Cities")Setsel=lyrSetfilter=NewQueryFilterfilter.WhereClause="NAME='Jinan'"sel.SelectFeaturesfilter,esriSelectionResultNew,FalsemxDoc.ActiveView.PartialRefreshesriViewGeoSelection,Nothing,NothingSetselEvents=mxDoc.FocusMapselEvents.SelectionChangedEndSubFunctionfindlayer(pmapAsIMap,nameAsString)AsILayerDimiAsIntegerFori=0Topmap.LayerCount-1Ifpmap.Layer(i).name=nameThenSetfindlayer=pmap.Layer(i)ExitFunctionEndIfNextEndFunction結(jié)果:14.實(shí)例十四功能:1.顯示要素名稱代碼:PrivateSubZDKmacros14()DimpdocAsIMxDocumentSetpdoc=ThisDocumentDimaCtiveviewAsIActiveViewDimfeatureEnumAsIEnumFeatureDimfeatAsIFeatureDimindexAsLongDimmsgAsStringSetaCtiveview=pdoc.ActivatedViewSetfeatureEnum=pdoc.FocusMap.FeatureSelectionfeatureEnum.ResetSetfeat=featureEnum.NextDoWhileNotfeatIsNothingindex=feat.Fields.FindField("NAME")Ifindex<>-1ThenMsgBoxmsg&Chr(13)&Chr(10)&feat.Value(index)'顯示該要素的NameSetfeat=featureEnum.NextLoopEndSub結(jié)果:15.實(shí)例十五功能:顯示圖層名稱打開(kāi)新文檔關(guān)閉現(xiàn)在工作區(qū)間輸出代碼:SubZDKmacros1()DimstrNameAsStringDimpDocAsIDocumentDimpBarAsIStatusBarstrName=AMsgBoxstrNameDimpAppAsIApplicationSetpApp=ApplicationMsgBoxpApp.CaptionpApp.OpenDocument("E:\Arcgis\Zhaidk\Zhaidk1.mxd")pApp.ShutdownApplication.ShutdownDimpMXappAsIMxApplicationSetpMXapp=pApppMXapp.ExportEndSub結(jié)果:16.實(shí)例十六功能:1.調(diào)整窗口大小代碼:SubZDKmacros2()DimpWAsIWindowPositionSetpW=ApplicationpW.Height=300pW.Width=300pW.Left=50pW.Top=50pW.Move0,0EndSub結(jié)果:使用前使用后17.實(shí)例十七功能:交互式工具:創(chuàng)建UIcontrol刷新按鈕代碼:PrivateFunctionUIToolControl1_CursorID()AsVariantUIToolControl1_CursorID=3EndFunctionPrivateSubUIToolControl1_MouseDown(ByValbuttonAsLong,ByValshiftAsLong,ByValxAsLong,ByValyAsLong)DimpDocAsIMxDocumentSetpDoc=ThisDocumentDimpScreenDispAsIScreenDisplaySetpScreenDisp=pDoc.ActivatedView.ScreenDisplayDimpRubberAsIRubberBandDimpEnvAsIEnvelopeSetpRubber=NewRubberEnvelopeSetpEnv=pRubber.TrackNew(pScreenDisp,Nothing)pDoc.ActivatedView.Extent=pEnvpDoc.ActivatedView.RefreshEndSub結(jié)果:18.實(shí)例十八功能:代碼:Private

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論