backup3
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的更多相关文章
- backup3:master 数据库的备份和还原
在SQL Server 中,master 数据库记录系统级别的元数据,例如,logon accounts, endpoints, linked servers, and system configur ...
- 工行ICBC_WAPB_B2C支付接口
一. 前期准备 手机银行(WAP)B2C在线支付接口说明V1.0.0.6.doc 手机银行移动生活商户及门户网站js接口API.doc 支付组件ICBCEBankUtil.dll和infosecapi ...
- Linux下不同服务器间数据传输--转载
因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...
- Linux下不同服务器间数据传输
因为工作原因,需要经常在不同的服务器见进行文件传输,特别是大文件的传输,因此对linux下不同服务器间数据传输命令和工具进行了研究和总结.主要是rcp,scp,rsync,ftp,sftp,lftp, ...
- 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) 收藏 举 ...
- Windows下ELK环境搭建(单机多节点集群部署)
1.背景 日志主要包括系统日志.应用程序日志和安全日志.系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安全性,从而及时 ...
- Mysql的实时同步 - 双机互备
设置方法: 步一设 A 服务服 (192.168.1.43) 上用户为 backup, 123456 , 同步的数据库为test; B 服务服 (192.168.1.23) 上用户为 root, 12 ...
- MySQL学习总结(摘抄)
1.数据库概述 简 而言之,数据库(DataBase)就是一个存储数据的仓库.为了方便数据的存储和管理,将数据按照特定的规律存储在磁盘上.通过数据库管理系统,可以有 效的组织和管理存储在数据库中的数据 ...
- MYSQL集群的搭建
按照此配置完全可以配置成功!! 一.介绍========测试环境:Server1:ndbd 192.168.1.225Server2:ndbd 192.168.1.226Server3:mysqld ...
随机推荐
- 用js判断页面刷新或关闭的方法
Onunload,onbeforeunload都是在刷新或关闭时调用,可以在<script>脚本中通过window.onunload来指定或者在<body>里指定.区别在于on ...
- Lua Serial/Serialize/Serializer/Serializing 序列化/反序列化
第一篇 有点内容的.. 支持 表/函数/数值/布尔/字符串 做 键.值 支持 循环/嵌套 支持 元表(支持弱表分析) 支持 表被任意数量.位置引用 支持 扩展引用外部 支持 格式化输出 支持 嵌套优化 ...
- JS自动格式化输入的数字/千位分隔符
<script> function cc(s){ if(/[^0-9\.]/.test(s)) return "invalid value"; ...
- memcache原理、简单使用、分布式实现方案
原理:http://www.cnblogs.com/chy2055/p/5127499.html 使用教程:http://www.travisup.com/post/index/21 memcache ...
- 存储过程procedure
存储过程(procedure) 修改mysql结束符 delimiter name procedure创建语法: create procedure p ...
- JQuery实现列表中复选框全选反选功能封装
我们在做列表的时候经常会遇到全选,反选进行批量处理问题,例如: 我当时就是简单的实现了,然后想封装到公共的js中,封装的太烂,不好意思贴出来了(就是把实现代码之间放到公共js中,然后每个页面都用固定的 ...
- [Linux] -Docker修改空间大小
Docker默认空间大小分为两个,一个是池空间大小,另一个是容器空间大小. 池空间大小默认为:100G 容器空间大小默认为是:10G 所以修改空间大小也分为两个: 这里使用centos下的yum进行安 ...
- redis缓存
参考: java对redis的基本操作 http://www.cnblogs.com/edisonfeng/p/3571870.html 一.支持类型: key:一般设计为标准的字符串, values ...
- linux---mysql安装
一.查询本机是否有mysql service mysql status 二.检查已安装的mysql版本 mysql –uroot -p status 三.查看已安装的mysql的组件 dpkg --g ...
- ngCordova
参见:http://blog.csdn.net/Luo_xinran/article/details/52164480 ngCordova是基于Cordova封装的AngularJS的调用本地设备接口 ...