AE开发之地图加载12页文档资料.docx
《AE开发之地图加载12页文档资料.docx》由会员分享,可在线阅读,更多相关《AE开发之地图加载12页文档资料.docx(20页珍藏版)》请在冰点文库上搜索。
![AE开发之地图加载12页文档资料.docx](https://file1.bingdoc.com/fileroot1/2023-6/9/fa267046-8987-4ca7-b73b-fcc1fa91d03c/fa267046-8987-4ca7-b73b-fcc1fa91d03c1.gif)
AE开发之地图加载12页文档资料
usingSystem;
我国古代的读书人,从上学之日起,就日诵不辍,一般在几年内就能识记几千个汉字,熟记几百篇文章,写出的诗文也是字斟句酌,琅琅上口,成为满腹经纶的文人。
为什么在现代化教学的今天,我们念了十几年书的高中毕业生甚至大学生,竟提起作文就头疼,写不出像样的文章呢?
吕叔湘先生早在1978年就尖锐地提出:
“中小学语文教学效果差,中学语文毕业生语文水平低,……十几年上课总时数是9160课时,语文是2749课时,恰好是30%,十年的时间,二千七百多课时,用来学本国语文,却是大多数不过关,岂非咄咄怪事!
”寻根究底,其主要原因就是腹中无物。
特别是写议论文,初中水平以上的学生都知道议论文的“三要素”是论点、论据、论证,也通晓议论文的基本结构:
提出问题――分析问题――解决问题,但真正动起笔来就犯难了。
知道“是这样”,就是讲不出“为什么”。
根本原因还是无“米”下“锅”。
于是便翻开作文集锦之类的书大段抄起来,抄人家的名言警句,抄人家的事例,不参考作文书就很难写出像样的文章。
所以,词汇贫乏、内容空洞、千篇一律便成了中学生作文的通病。
要解决这个问题,不能单在布局谋篇等写作技方面下功夫,必须认识到“死记硬背”的重要性,让学生积累足够的“米”。
usingSystem.Collections.Generic;
要练说,得练看。
看与说是统一的,看不准就难以说得好。
练看,就是训练幼儿的观察能力,扩大幼儿的认知范围,让幼儿在观察事物、观察生活、观察自然的活动中,积累词汇、理解词义、发展语言。
在运用观察法组织活动时,我着眼观察于观察对象的选择,着力于观察过程的指导,着重于幼儿观察能力和语言表达能力的提高。
usingSystem.Linq;
唐宋或更早之前,针对“经学”“律学”“算学”和“书学”各科目,其相应传授者称为“博士”,这与当今“博士”含义已经相去甚远。
而对那些特别讲授“武事”或讲解“经籍”者,又称“讲师”。
“教授”和“助教”均原为学官称谓。
前者始于宋,乃“宗学”“律学”“医学”“武学”等科目的讲授者;而后者则于西晋武帝时代即已设立了,主要协助国子、博士培养生徒。
“助教”在古代不仅要作入流的学问,其教书育人的职责也十分明晰。
唐代国子学、太学等所设之“助教”一席,也是当朝打眼的学官。
至明清两代,只设国子监(国子学)一科的“助教”,其身价不谓显赫,也称得上朝廷要员。
至此,无论是“博士”“讲师”,还是“教授”“助教”,其今日教师应具有的基本概念都具有了。
usingSystem.Text;
usingESRI.ArcGIS.AnalysisTools;
usingESRI.ArcGIS.Analyst3D;
usingESRI.ArcGIS.Carto;
usingESRI.ArcGIS.Controls;
usingESRI.ArcGIS.Display;
usingESRI.ArcGIS.DisplayUI;
usingESRI.ArcGIS.esriSystem;
usingESRI.ArcGIS.Geodatabase;
usingESRI.ArcGIS.Geometry;
usingESRI.ArcGIS.GlobeCore;
usingESRI.ArcGIS.Output;
usingESRI.ArcGIS.SystemUI;
usingESRI.ArcGIS.DataSourcesRaster;
usingESRI.ArcGIS.DataSourcesRasterUI;
usingSystem.Windows.Forms;
usingSystem.Drawing;
usingESRI.ArcGIS.DataSourcesFile;
namespaceAEExercise
publicclassGeoMapLoad
publicstaticIMapDocumentpMapDocument;//定义地图文档接口变量
publicstaticintcount=0;
publicstaticIRgbColorpColor;//设置颜色
publicstaticstringtext="空";//标注内容
publicstaticvoidCreateMeasuredGrid(AxPageLayoutControlaxPageLayoutControl1)
//设置格网点
ISnapGridpSnapGrid;
IPageLayoutpPageLayout=axPageLayoutControl1.PageLayout;
pSnapGrid=pPageLayout.SnapGrid;//获取PageLayout的SnapGrid对象
pSnapGrid.VerticalSpacing=2;//设置垂直间距
pSnapGrid.HorizontalSpacing=1;
pSnapGrid.IsVisible=true;//设置为可见
axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);
publicstaticvoidoperatePageLayout(AxPageLayoutControlaxPageLayoutControl1,stringopt,IEnvelopepEnv,intstrBarType=0)
switch(opt)
case"AddScale":
if(count>0)
return;
IScaleBarpScaleBar;
IMapFramepMapFrame;
IMapSurroundFramepMapSurroundFrame;
IMapSurroundpMapSurround;
IElementPropertiespElementPro;
//产生一个UID对象,使用它产生不同的MapSurround对象
UIDpUID=newUIDClass();
pUID.Value="esriCarto.scalebar";
IPageLayoutpPageLayout;
pPageLayout=axPageLayoutControl1.PageLayout;
IGraphicsContainerpGraphicsContainer;
pGraphicsContainer=pPageLayoutasIGraphicsContainer;
IActiveViewpActiveView;
pActiveView=pGraphicsContainerasIActiveView;
IMappMap;
pMap=pActiveView.FocusMap;
//获得于地图相关的MapFrame
pMapFrame=pGraphicsContainer.FindFrame(pMap)asIMapFrame;
//产生MapsurroundFrame
pMapSurroundFrame=pMapFrame.CreateSurroundFrame(pUID,null);
//依据传入参数不同使用不同类型的比例尺
MessageBox.Show(strBarType.ToString());
switch(strBarType)
case0:
//西安交互比例尺pScaleBar=newAlternatingScaleBarClass();
break;
case1:
//双线交互比例尺
pScaleBar=newDoubleAlternatingScaleBarClass();
break;
case2:
//中空式比例尺
pScaleBar=newHollowScaleBarClass();
break;
case3:
//线式比例尺
pScaleBar=newScaleLineClass();
break;
case4:
//分割式比例尺
pScaleBar=newSingleDivisionScaleBarClass();
break;
case5:
//阶梯式比例尺
pScaleBar=newSteppedScaleLineClass();
break;
default:
pScaleBar=newScaleLineClass();
break;
pScaleBar.Division=4;
pScaleBar.Divisions=4;
pScaleBar.LabelGap=4;
pScaleBar.LabelPosition=esriVertPosEnum.esriAbove;
pScaleBar.Map=pMap;
pScaleBar.Name="比例尺";
pScaleBar.Subdivisions=2;
pScaleBar.UnitLabel="千米";
pScaleBar.UnitLabelGap=4;
pScaleBar.UnitLabelPosition=esriScaleBarPos.esriScaleBarAbove;
pScaleBar.Units=esriUnits.esriKilometers;
pMapSurround=pScaleBar;
pMapSurroundFrame.MapSurround=pMapSurround;
pElementPro=pMapSurroundFrameasIElementProperties;
pElementPro.Name="myscalebar";
//将MapSurrooundFrame对象添加到控件中axPageLayoutControl1.AddElement(pMapSurroundFrameasIElement,
pEnv,Type.Missing,Type.Missing,0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);
break;
publicvoidOperateMapDoc(AxMapControlaxMapControl1,AxMapControlaxMapControl2,stringstrOperateType)
//定义打开文件对话框
OpenFileDialogOpenFileDlg=newOpenFileDialog();
//定义保存文件对话框
SaveFileDialogSaveFileDlg=newSaveFileDialog();
OpenFileDlg.Filter="地图文档文件(*.mxd)|*.mxd";
SaveFileDlg.Filter="地图文档文件(*.mxd)|*.mxd";
stringstrDocFileN=string.Empty;
pMapDocument=newMapDocumentClass();
//判断操作文档地图的类型
switch(strOperateType)
case"NewDoc":
SaveFileDlg.Title="输入需要新建地图文档的名称";
SaveFileDlg.ShowDialog();
strDocFileN=SaveFileDlg.FileName;
if(strDocFileN==string.Empty)
return;
pMapDocument.New(strDocFileN);
pMapDocument.Open(strDocFileN,"");
axMapControl1.Map=pMapDocument.get_Map(0);
break;
case"OpenDoc":
OpenFileDlg.Title="选择需要加载的地图文档文件";
OpenFileDlg.ShowDialog();
strDocFileN=OpenFileDlg.FileName;
if(strDocFileN==string.Empty)
return;
//将数据加载入pMapDocument并与map控件联动起来
pMapDocument.Open(strDocFileN,"");
for(inti=0;i//遍历可能的Map对象
axMapControl1.Map=pMapDocument.get_Map(i);
//axMapControl2.Map=pMapDocument.get_Map(i);
//刷新地图
axMapControl1.Refresh();
break;
case"SaveDoc":
//判断文档是否为只读文档
if(pMapDocument.get_IsReadOnly(pMapDocument.DocumentFilename)==true)
MessageBox.Show("此地图文档为只读文档!
","信息提示");
return;
//用相对路径保存地图文档
pMapDocument.Save(pMapDocument.UsesRelativePaths,true);
MessageBox.Show("保存成功!
","信息提示");
break;
case"SaveDocAs":
SaveFileDlg.Title="地图文档另存";
SaveFileDlg.ShowDialog();
strDocFileN=SaveFileDlg.FileName;
if(strDocFileN==string.Empty)
return;
if(strDocFileN==pMapDocument.DocumentFilename)
//将修改后的地图文档保存在原文件中
//用相对路径保存地图文档
pMapDocument.Save(pMapDocument.UsesRelativePaths,true);
MessageBox.Show("保存成功!
","信息提示");
break;
else
//将修改后的地图文档保存为新文件
pMapDocument.SaveAs(strDocFileN,true,true);
MessageBox.Show("保存成功!
","信息提示");
break;
default:
break;
publicvoidSetColor()
pColor=getRGBColor();
publicvoidMapOperate(AxMapControlaxMapControl1,IMapControlEvents2_OnMouseDownEvente,stringstrOperat)
if(pColor==null)
pColor=newRgbColorClass();
pColor.Blue=5;
pColor.Red=213;
pColor.Green=9;
switch(strOperat)
case"strLKoper":
axMapControl1.MousePointer=esriControlsMousePointer.esriPointerCrosshair;
axMapControl1.Extent=axMapControl1.TrackRectangle();
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,null,null);
break;
case"strMapPan":
axMapControl1.Pan();
break;
//绘制线
case"strDrawLine":
//绘制线
IMappMap;
IActiveViewpActiveView;
pMap=axMapControl1.Map;
pActiveView=pMapasIActiveView;
IPolylinepPolyline;
pPolyline=axMapControl1.TrackLine()asIPolyline;
//产生一个SimpleLineSymbol符号
ISimpleLineSymbolpSimpleLineSym;
pSimpleLineSym=newSimpleLineSymbolClass();
pSimpleLineSym.Style=esriSimpleLineStyle.esriSLSSolid;//需要用户动态选择
//设置符号颜色
pSimpleLineSym.Color=pColor;//需要用户动态选择
pSimpleLineSym.Width=1;
//产生一个PolylineElement对象
ILineElementpLineEle;
pLineEle=newLineElementClass();
IElementpEle;
pEle=pLineEleasIElement;
pEle.Geometry=pPolyline;
try
{//将元素添加到Map对象之中
IGraphicsContainerpGraphicsContainer;
pGraphicsContainer=pMapasIGraphicsContainer;
pGraphicsContainer.AddElement(pEle,0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);
catch(ExecutionEngineExceptione3)
MessageBox.Show("两点距离太近");
return;
break;
//绘制面
case"strDrawPolygon":
//绘制面
IMappMap;
IActiveViewpActiveView;
pMap=axMapControl1.Map;
pActiveView=pMapasIActiveView;
IPolygonpPolygion;
pPolygion=axMapControl1.TrackPolygon()asIPolygon;
//产生一个SimpleFillSymbol符号
ISimpleFillSymbolpSimpleFillSym;
pSimpleFillSym=newSimpleFillSymbolClass();
pSimpleFillSym.Style=esriSimpleFillStyle.esriSFSDiagonalCross;//需要用户动态选择
pSimpleFillSym.Color=pColor;//需要用户动态选择
//产生一个PolygonElement对象
IFillShapeElementpPolygonEle;
pPolygonEle=newPolygonElementClass();
pPolygonEle.Symbol=pSimpleFillSym;
IElementpEle;
pEle=pPolygonEleasIElement;
pEle.Geometry=pPolygion;
//将元素添加到Map对象之中
IGraphicsContainerpGraphicsContainer;
pGraphicsContainer=pMapasIGraphicsContainer;
pGraphicsContainer.AddElement(pEle,0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);
break;
//地图标注
case"strMapLable":
//地图标注
IMappMap;
IActiveViewpActiveView;
pMap=axMapControl1.Map;
pActiveView=pMapasIActiveView;
ITextElementpTextEle;
IElementpEles;
//建立文字符号对象,并设置相应的属性
pTextEle=newTextElementClass();
pTextEle.Text=text;
pEles=pTextEleasIElement;
//设置文字字符的几何形体属性
IPointpPoint;
pPoint=newPointClass();
pPoint.PutCoords(e.mapX,e.mapY);
pEles.Geometry=pPoint;
//添加到Map对象中,并刷新显示
IGraphicsContainerpGraphicsContainer;
pGraphicsContainer=pMapasIGraphicsContainer;
pGraphicsContainer.AddElement(pEles,0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);
break;
case"strSelect":
//要素选择
//得到一个包络线Envelope对象
IEnvelopepEnv;
pEnv=axMapControl1.TrackRectangle();
//新建选择集环境对象
ISelectionEnvironmentpSelectionEnv;
pSelectionEnv=newSelectionEnvironmentClass();
//改变选择集的默认颜色
pSelectionEnv.DefaultColor=pColor;
//选择要素,并将其放入选择集
axMapControl1.Map.SelectByShape(pEnv,pSelectio