zoukankan      html  css  js  c++  java
  • 地图输出

    很多的时候在地图制作完成以后,我们需要将它用不同的格式输出,如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();
    }

  • 相关阅读:
    Java基础50道经典练习题(33)——杨辉三角
    Java基础50道经典练习题(32)——左移右移
    团队第二阶段冲刺04
    团队第二阶段冲刺03
    团队第二阶段冲刺02
    团队第二阶段冲刺01
    团队意见汇总
    各组意见汇总
    团队第一阶段冲刺07
    绩效评估01
  • 原文地址:https://www.cnblogs.com/ywsoftware/p/2821212.html
Copyright © 2011-2022 走看看