欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap FreeTalk
   您现在位于: 首页技术专栏ArcGIS应用与开发AO开发 → 正文
出图时加上指北针
08-08-12 09:45:32 作者:vikings 出处:http://i.mop.com/vikings
protected virtual void PutNorthArrow()
        {//地图指北针 目前没有处理   2007-10-22 by xxd
            double xMin,xMax,yMin,yMax;
            IEnvelope aFrameExtent=(this.MapFrame as IElement).Geometry .Envelope ;
            xMin = aFrameExtent.XMax-0.1-2;//指北针的宽度为2,高度为3,位置距离地图最上角0.1 0.1
            xMax = aFrameExtent.XMax-0.1;
            yMin = aFrameExtent.YMax-0.1-3;
            yMax = aFrameExtent.YMax-0.1;
            IEnvelope pEnv =new EnvelopeClass();
            pEnv.PutCoords( xMin,yMin,xMax,yMax);
            UID pID = new  UIDClass();
            pID.Value = "esriCarto.MarkerNorthArrow";
            IMapSurround pMapSurround  = this.CreateSurround(pID,pEnv,"North Arrow",this.MapFrame,this.PageLayout.PageLayout);
            IMarkerNorthArrow pMarkerNorthArrow = pMapSurround as IMarkerNorthArrow; //QI 
            ICharacterMarkerSymbol pCharacterMarkerSymbol = pMarkerNorthArrow.MarkerSymbol as ICharacterMarkerSymbol; //clones the symbol 
            pCharacterMarkerSymbol.CharacterIndex = 167 ;//change the symbol 
            pCharacterMarkerSymbol.Color = GeoUtilities.CreateColor (0,0,0);
            pCharacterMarkerSymbol.Angle = 0;
            pCharacterMarkerSymbol.Size = 100;
            pMarkerNorthArrow.MarkerSymbol = pCharacterMarkerSymbol;//'set it back  
            
//            pEnv.PutCoords(1, 1, 3.4, 2.4);
//            pID.Value = "esriCarto.Legend";//增加legend
//            pMapSurround = CreateSurround(pID, pEnv, "Legend", this.MapFrame,this.PageLayout.PageLayout); //Refresh the graphics 
           
        }
        public IMapSurround CreateSurround(UID pID, IEnvelope pEnv,string strName,IMapFrame pMapFrame,IPageLayout pPageLayout)
        {
            IGraphicsContainer pGraphicsContainer = pPageLayout as IGraphicsContainer;
            IActiveView pActiveView = pPageLayout as IActiveView;
            IMapSurroundFrame  pMapSurroundFrame = pMapFrame.CreateSurroundFrame(pID, null) ;//MapSurroundFrames are related to MapFrames MapFrames hold Maps
            pMapSurroundFrame.MapSurround.Name = this.ElementNamePrefix+strName; //Set the geometry of the MapSurroundFrame to give it a location 
            //Activate it and add it to the PageLayout's graphics container
            IElement pElement = pMapSurroundFrame as IElement;  //MapSurrounds are held in a MapSurroundFram
            pElement.Geometry = pEnv;
            pElement.Activate(pActiveView.ScreenDisplay); //'Allow the legend frame size to be altered after the legend has been  'added to the GraphicsContainer 
            ITrackCancel PTrack = new CancelTrackerClass();
            pElement.Draw(pActiveView.ScreenDisplay, PTrack );
            pGraphicsContainer.AddElement(pElement, 0 );
            //Re-apply the change to the Legend MapSurroundFrame Geometry 
            //pElement.Geometry = pEnv ;
            return pMapSurroundFrame.MapSurround;
        }

(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  
    AE中将二维和三维场景导出为图片和图片空间数据文件

    关于我们友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
     
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.
     

                   滇ICP备05006901号