地图输出

很多的时候在地图制作完成以后,我们需要将它用不同的格式输出,如PDF,bmp等格式,这样的格式方便我们用户在没有安装ArcMap的计算机平台上对地图进行浏览,查看。地图输出可以分为两大类,即栅格数据和适量数据格式,前者的如BMP,JPG,而后者的如PDF,,SVG.IExport接口作为地图输出的主要接口,被不同的类实现,如下图所示:

 

这10个类都是组件类,可以直接用来实例化,同样,这10个类对应了ArcGIS 所支持的地图输出格式,同时这10个类也可以划分为两大类,即矢量格式和栅格格式。Window平台的分辨率一般为96dpi,而这个也是ArcGIS栅格 数据输出的默认分辨率,而对于像PDF这样的分辨率,默认为300dpi。IExport接口定义了地图输出的通用方法和属性,如下图:

矢量格式地图输出

矢量格式文件的输出主要是依靠IExportVector接口,该接口被以下5个类实现:

示例:输出EMF格式:
private void ExportEMF()
{
IActiveView pActiveView;
pActiveView = axPageLayoutControl1.ActiveView;
IExport pExport;
pExport = new ExportEMFClass();
pExport.ExportFileName = @"E:\arcgis\Engine\ExportEMF.emf";
pExport.Resolution = 300;
tagRECT exportRECT;
exportRECT = pActiveView.ExportFrame;
IEnvelope pPixelBoundsEnv;
pPixelBoundsEnv = new EnvelopeClass();
pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top,
exportRECT.right, exportRECT.bottom);
pExport.PixelBounds = pPixelBoundsEnv;
int hDC;
hDC = pExport.StartExporting();
pActiveView.Output(hDC, (int)pExport.Resolution, ref exportRECT, null, null);
pExport.FinishExporting();
pExport.Cleanup();
}

示例:输出PDF格式:
private void ExportPDF()
{
IActiveView pActiveView;
pActiveView = axPageLayoutControl1.ActiveView;
IEnvelope pEnv;

pEnv = pActiveView.Extent;
IExport pExport;
pExport = new ExportPDFClass();
pExport.ExportFileName = @"E:\arcgis\Engine\ExportPDF.pdf";
pExport.Resolution = 30;
tagRECT exportRECT;
exportRECT.top = 0;
exportRECT.left = 0;
exportRECT.right = (int)pEnv.Width;
exportRECT.bottom = (int)pEnv.Height;
IEnvelope pPixelBoundsEnv;
pPixelBoundsEnv = new EnvelopeClass();
pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.bottom,
exportRECT.right, exportRECT.top);
pExport.PixelBounds = pPixelBoundsEnv;
int hDC ;
hDC = pExport.StartExporting();
pActiveView.Output(hDC, (int)pExport.Resolution, ref exportRECT, null, null);
pExport.FinishExporting();
pExport.Cleanup();
}

栅格格式地图输出 
栅格格式文件的输出主要是依靠IExportImage接口,该接口被以下5个类实现:

示例:根据传入的分辨率输出JPG格式
public void CreateJPEGHiResolutionFromActiveView(IActiveView pActiveView,String pFileName, Int32 pScreenResolution,
Int32 pOutputResolution)
{
ESRI.ArcGIS.Output.IExport pExport = new ESRI.ArcGIS.Output.ExportJPEGClass();
pExport.ExportFileName = pFileName;
pExport.Resolution = pOutputResolution;

ESRI.ArcGIS.Display.tagRECT pExportRECT;

pExportRECT.left = 0;

pExportRECT.top = 0;
pExportRECT.right = pActiveView.ExportFrame.right * (pOutputResolution / pScreenResolution);
pExportRECT.bottom = pActiveView.ExportFrame.bottom * (pOutputResolution / pScreenResolution);
ESRI.ArcGIS.Geometry.IEnvelope pEnvelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
pEnvelope.PutCoords(pExportRECT.left, pExportRECT.top, pExportRECT.right, pExportRECT.bottom);
pExport.PixelBounds = pEnvelope;
System.Int32 hDC = pExport.StartExporting();
pActiveView.Output(hDC, (System.Int16)pExport.Resolution, ref pExportRECT, null, null);
pExport.FinishExporting();
pExport.Cleanup();
}

 

转载于:https://www.cnblogs.com/ywsoftware/archive/2012/12/17/2821212.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值