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 = ; 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, );
}
else
{
pGraphicsContainer.AddElement(pElement, );
}
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 = ;
rgbColor.Green = ;
rgbColor.Blue = ;
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 = ;
pLineSymbol.Color = color; pMapGrid.LineSymbol = pLineSymbol;
pMapGrid.Border = null; // clear the default border; //Set the Tick Properties
pMapGrid.TickLength = ;
pLineSymbol = new CartographicLineSymbolClass();
//pLineSymbol = (ICartographicLineSymbol)pServerContext.CreateObject("esriDisplay.CartographicLineSymbol");
pLineSymbol.Cap = esriLineCapStyle.esriLCSButt;
pLineSymbol.Width = ;
pLineSymbol.Color = color;
pMapGrid.TickLineSymbol = pLineSymbol;
pMapGrid.TickMarkSymbol = null; //clear the default
pMapGrid.LabelFormat.Font.Size = ; //Set the Sub Tick Properties
pMapGrid.SubTickCount = ;
pMapGrid.SubTickLength = ;
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 = ; stdole.StdFont pFont = new stdole.StdFont();
pFont.Name = "Arial";
pFont.Size = ; 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 = ; //shift grid 5
pMeasuredGrid.YIntervalSize = 0.5; //parallel interval
pMeasuredGrid.YOrigin = ; //shift grid 5 // add mapg grid to Layout and refresh
pMapGrids = pMapFrame as IMapGrids;
pMapGrids.AddMapGrid(pMapGrid);
} string aaa = @"C:\Users\Administrator\Desktop\bbbbbbb.mxd";
IMapDocument pMapDocument = new MapDocumentClass();
pMapDocument.Open(aaa); string file = @"C:\Users\Administrator\Desktop\A90_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的更多相关文章

  1. backup3:master 数据库的备份和还原

    在SQL Server 中,master 数据库记录系统级别的元数据,例如,logon accounts, endpoints, linked servers, and system configur ...

  2. 工行ICBC_WAPB_B2C支付接口

    一. 前期准备 手机银行(WAP)B2C在线支付接口说明V1.0.0.6.doc 手机银行移动生活商户及门户网站js接口API.doc 支付组件ICBCEBankUtil.dll和infosecapi ...

  3. Linux下不同服务器间数据传输--转载

    因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...

  4. Linux下不同服务器间数据传输

    因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...

  5. linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl)(zz)

    linux下不同服务器间数据传输(rcp,scp,rsync,ftp,sftp,lftp,wget,curl) 分类: linux2011-10-10 13:21 8773人阅读 评论(1) 收藏 举 ...

  6. Windows下ELK环境搭建(单机多节点集群部署)

    1.背景 日志主要包括系统日志.应用程序日志和安全日志.系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安全性,从而及时 ...

  7. Mysql的实时同步 - 双机互备

    设置方法: 步一设 A 服务服 (192.168.1.43) 上用户为 backup, 123456 , 同步的数据库为test; B 服务服 (192.168.1.23) 上用户为 root, 12 ...

  8. MySQL学习总结(摘抄)

    1.数据库概述 简 而言之,数据库(DataBase)就是一个存储数据的仓库.为了方便数据的存储和管理,将数据按照特定的规律存储在磁盘上.通过数据库管理系统,可以有 效的组织和管理存储在数据库中的数据 ...

  9. MYSQL集群的搭建

    按照此配置完全可以配置成功!! 一.介绍========测试环境:Server1:ndbd 192.168.1.225Server2:ndbd 192.168.1.226Server3:mysqld ...

随机推荐

  1. 缓存,socket乱码等

    在服务端默认的编码情况下,JAVA的SOCKET接收需要GBK编码,而C#的接收需要UTF-8编码

  2. nwjs 配置文件package.json 转载

    配置文件package.json nw在启动应用程序时,首先要读取package.json文件,初始化基本属性,下面我们看看package.json的完整参数.每个参数配置都标有注释. { /**指定 ...

  3. clang编译器简介

    本文部分内容引用: 中文维基百科. 结构化编译器前端--clang介绍. 什么是clang编译器? clang是LLVM编译器工具集的一个用于编译C.C++.Objective-C的前端.LLVM项目 ...

  4. 打算从oschina的博客搬运到cnblog了

    如题,感觉cnblog似乎要更加专业一点,顺便也禁水.提高下文章质量 以后就都是干货了 oschina原址 顺便庆祝一下Windows Live Writer配置成功

  5. 1.AutoMapper核心:扁平化

    对象 - 对象映射的一个常见用法是获取一个复杂的对象模型,并将其展开成一个更简单的模型. 您可以采取复杂的模型,如: public class Order { private readonly ILi ...

  6. file_get_contents()函数

    $data = file_get_contents('http://www.zgjmwl.com/jinshui/pro_one/ceshi_a.php'); var_dump(substr($dat ...

  7. LeetCode "Is Subsequence"

    There are 3 possible approaches: DP, divide&conquer and greedy. And apparently, DP has O(n^2) co ...

  8. [译]How to Setup Sync Gateway on Ubuntu如何在ubuntu上安装sync-gateway

    参考文章https://hidekiitakura.com/2015/03/21/how-to-setup-sync-gateway-on-ubuntudigitalocean/ 在此对作者表示感谢 ...

  9. R语言-实用数据对象处理函数

    length(object) 显示对象中元素/成分的数量 dim(object) 显示某个对象的维度 str(object) 显示某个对象的结构 class(object) 显示某个对象的类或类型 m ...

  10. php生成curl命令行

    e.g. curl “http://localhost/other/serverInfo.php?dd=ddd” -H “Host:localhost” -H “Connection:keep-ali ...