backup3

摘要:
privatevoidchangLayoutTemp2(IActiveViewactiveView,IPageLayoutpageLayout,IPageLayoutpTempPageLayout){IPagepTempPage=pTempPagelay.Page;//setpagesizeandunitsIPagepCurPage=pageLayout.Page;pCurPage.Unit
backup3第1张backup3第2张
        private void changLayoutTemp2(IActiveView activeView, IPageLayout pageLayout, IPageLayout pTempPageLayout)
        {
            IPage pTempPage = pTempPageLayout.Page;

            //set page size and units
            IPage pCurPage = pageLayout.Page;
            pCurPage.Units = pTempPage.Units;
            pCurPage.Orientation = pTempPage.Orientation;

            double dWidth, dHeight;
            pTempPage.QuerySize(out dWidth, out dHeight);
            pCurPage.PutCustomSize(dWidth, dHeight);
            //delet all the element in GraphicsContainer except the MapFrame 
            IGraphicsContainer pGraphicsContainer = activeView.GraphicsContainer;
            IMap pMap = activeView.FocusMap;
            //现有的mxd文档
            IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame;


            pGraphicsContainer.Reset();
            IElement pElement = pGraphicsContainer.Next();
            while (pElement != null)
            {
                if (pElement is IMapFrame)
                {
                    //模板的
                    IMapFrame pTempMapFrame = (pTempPageLayout as IGraphicsContainer).FindFrame((pTempPageLayout as IActiveView).FocusMap) as IMapFrame;
                    IElement pTempElement = pTempMapFrame as IElement;
                    pElement.Geometry = pTempElement.Geometry;
                    pMapFrame.Border = pTempMapFrame.Border;


                    //方里网
                    IMapGrids pMapGrids = pMapFrame as IMapGrids;
                    pMapGrids.ClearMapGrids();
                    IMapGrids tempGrids = pTempMapFrame as IMapGrids;
                    for (int i = 0; i < tempGrids.MapGridCount; i++)
                    {
                        pMapGrids.AddMapGrid(tempGrids.get_MapGrid(i));
                    }
                }
                //else
                //{
                //    pGraphicsContainer.DeleteElement(pElement);
                //}
                pElement = pGraphicsContainer.Next();
            }
            
            //add element in the template to your cuurent pagelayout
            IGraphicsContainer pTempGraCon = pTempPageLayout as IGraphicsContainer;
            pTempGraCon.Reset();
            pElement = pTempGraCon.Next();
            while (pElement != null)
            {
                if (pElement is IMapFrame)
                {
                    pElement = pTempGraCon.Next();
                    continue;
                }
                else if (pElement is IMapSurroundFrame)
                {
                    IMapSurroundFrame pTempMapSurroundFrame = pElement as IMapSurroundFrame;
                    pTempMapSurroundFrame.MapFrame = pMapFrame;
                    IMapSurround pTempMapSurround = pTempMapSurroundFrame.MapSurround;
                    pMap.AddMapSurround(pTempMapSurround);
                    pGraphicsContainer.AddElement(pTempMapSurroundFrame as IElement, 0);
                }
                else
                {
                    pGraphicsContainer.AddElement(pElement, 0);
                }
                pElement = pTempGraCon.Next();
            }
        }


        /// <summary>
        /// 为PageLayout对象添加经纬网格
        /// </summary>
        /// <param name="pPageLayout"></param>
        /// 
        private void CreateGraticuleMapGrid(IPageLayout pPageLayout)
        {
            //获取MapFrame对象
            IActiveView pAcitiveView = pPageLayout as IActiveView;
            IMap pMap = pAcitiveView.FocusMap;
            IGraphicsContainer pGraphicsContainer = pAcitiveView as IGraphicsContainer;
            IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pMap) as IMapFrame;

            IRgbColor rgbColor = new RgbColor();

            IMapGrids pMapGrids;
            IMapGrid pMapGrid;

            //Create the grid
            pMapGrid = new GraticuleClass();// (IGraticule)pServerContext.CreateObject("esriCarto.Graticule");
            pMapGrid.Name = "Map Grid";

            rgbColor.Red = 166;
            rgbColor.Green = 187;
            rgbColor.Blue = 208;
            IColor color = rgbColor as IColor;

            //Set the line symbol used to draw the grid
            ICartographicLineSymbol pLineSymbol;
            pLineSymbol = new CartographicLineSymbolClass();
            //pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
            pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
            pLineSymbol.Width = 1;
            pLineSymbol.Color = color;

            pMapGrid.LineSymbol = pLineSymbol;
            pMapGrid.Border = null; // clear the default border;

            //Set the Tick Properties
            pMapGrid.TickLength = 15;
            pLineSymbol = new CartographicLineSymbolClass();
            //pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
            pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
            pLineSymbol.Width = 1;
            pLineSymbol.Color = color;
            pMapGrid.TickLineSymbol = pLineSymbol;
            pMapGrid.TickMarkSymbol = null; //clear the default
            pMapGrid.LabelFormat.Font.Size = 20;

            //Set the Sub Tick Properties
            pMapGrid.SubTickCount = 5;
            pMapGrid.SubTickLength = 10;
            pLineSymbol = new CartographicLineSymbolClass();
            //pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
            pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
            pLineSymbol.Width = 0.1;
            pLineSymbol.Color = color;
            pMapGrid.SubTickLineSymbol = pLineSymbol;

            //Marshal.ReleaseComObject(pLineSymbol);

            //Set the Grid labels properties
            IGridLabel pGridLabel;
            pGridLabel = pMapGrid.LabelFormat;
            pGridLabel.LabelOffset = 15;

            stdole.StdFont pFont = new stdole.StdFont();
            pFont.Name = "Arial";
            pFont.Size = 16;

            pMapGrid.LabelFormat.Font = pFont as stdole.IFontDisp;

            //Set the Tick, SubTick, Label Visibility along the 4 sides of the grid
            pMapGrid.SetTickVisibility(true, true, true, true);
            pMapGrid.SetSubTickVisibility(true, true, true, true);
            pMapGrid.SetLabelVisibility(true, true, true, true);

            //Make map grid visible, so it gets drawn when Active View is updated
            pMapGrid.Visible = true;

            //Set the IMeasuredGrid properties
            IMeasuredGrid pMeasuredGrid;
            pMeasuredGrid = pMapGrid as IMeasuredGrid;
            pMeasuredGrid.FixedOrigin = true;
            pMeasuredGrid.XIntervalSize = 0.5; //meridian interval
            pMeasuredGrid.XOrigin = 109; //shift grid 5
            pMeasuredGrid.YIntervalSize = 0.5; //parallel interval
            pMeasuredGrid.YOrigin = 40; //shift grid 5

            // add mapg grid to Layout and refresh
            pMapGrids = pMapFrame as IMapGrids;
            pMapGrids.AddMapGrid(pMapGrid);
        }





            string aaa = @"C:UsersAdministratorDesktopbbbbbb.mxd";
            IMapDocument pMapDocument = new MapDocumentClass();
            pMapDocument.Open(aaa);

            string file = @"C:UsersAdministratorDesktopA90_90.mxt";
            IMapDocument pMapDocument2 = new MapDocumentClass();
            pMapDocument2.Open(file);//template's  path

            changLayoutTemp2(pMapDocument.ActiveView, pMapDocument.PageLayout, pMapDocument2.PageLayout);
            pMapDocument.SaveAs("d:\aa7.mxd", true, true);
change_layout

免责声明:文章转载自《backup3》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇【b301】神经网络[Contract] Solidity 遍历 mapping 的一种方式下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

双向认证

证书携带公钥信息,用于验证服务器端,加密/解密数据,并作为OSI五类服务的认证(认证)服务和保密服务。这种双重认证是在线银行系统安全的关键!有关单向身份验证,请参阅Java加密技术(X)。双向身份验证要求CA授权机构颁发此类客户端和服务器端证书。首先,CA机构需要构建根证书。我们在linux下直接使用openssl来完成CA。我们需要修改openssl.cn...

jenkins 配置 ssh连接远程服务器并执行相关命令

5、配置完成后,点击TestConfiguration返回Success即证明Jenkins所在宿主机可以正常链接到待部署机。...

DD-wrt+Wiwiz搭建私人免费(收费)WiFi认证页面+详细的操作教程

因此,请选择正确的DD-WRT版本将无线路由器连接到Internet。执行以下命令:#cd;wgethttp://dl.wiwiz.com/hsbuilder-util-latest-DD-WRT.tar.gz#cd/jffs ; tar zxf/tmp/root/hsbuilder-util-lalatest-DD-WRT.tar。gz#/jffs/usr...

VSCode, 当今最流行的免费开源代码编辑器,微软出品,必属精品

Visual Studio代码是一个轻量级但功能强大的源代码编辑器,可以在桌面上运行,可以用于Windows、MacOS和Linux。直接在编辑器中检查差异,暂时保存文件并提交。Visual Studio代码产品在初始操作中的内部代码控制可以通过编辑器内的SCM支持(包括丰富的Git集成)加快发布周期。用户界面-介绍VSCode编辑器的基本UI、命令和功能。...

用arduino做一个智能垃圾桶

这些天我几乎很忙。我有一些时间继续打扰我的arduino。上一次我从TB购买arduino套件时,有一个人体热能感应模块,用于感应人体接近信号。今天我们用这个做一个简单的智能垃圾桶。要实现的功能是:当有人靠近时,垃圾可以自动打开盖子,当人离开时,盖子可以自动关闭。1、 所需材料和工具:1 Arduino SCM我使用Arduino Nano 2人体热能传感模...

关于WINFORM中输入法的设置

关于WINFORM(转移到)John Suna的专栏开发中输入方法的设置,它碰巧遇到了这种问题。网络真的很好:)这是文本集。感谢作者的辛勤工作给您带来的便利。在WINFORM中,我们经常遇到这样的问题:文本输入框中的输入法被禁用或总是更改为全宽输入法。查阅相关数据后,总结如下:(1)Control.ImeMode属性:获取或设置控件的输入方法编辑器模式。此模...