Engine中如何输出地图为图片?

Engine中如何输出地图为图片?
已邀请:

刘峥 - ArcGIS多面手

赞同来自:

【解决办法】:
可以参考以下代码输出图片: 

 
public System.Boolean CreateJPEGHiResolutionFromActiveView(ESRI.ArcGIS.Carto.IActiveView activeView, System.String pathFileName) 

//parameter check 
if (activeView == null || !(pathFileName.EndsWith(.jpg))) 

return false; 

ESRI.ArcGIS.Output.IExport export = new ESRI.ArcGIS.Output.ExportJPEGClass(); 
export.ExportFileName = pathFileName; 

// Because we are exporting to a resolution that differs from screen 
// resolution, we should assign the two values to variables for use 
// in our sizing calculations 
System.Int32 screenResolution = 96; 
System.Int32 outputResolution = 600; 

export.Resolution = outputResolution; 

ESRI.ArcGIS.esriSystem.tagRECT exportRECT; // This is a structure 

exportRECT.left = 0; 
exportRECT.top = 0; 
exportRECT.right = activeView.ExportFrame.right * (outputResolution / screenResolution); 
exportRECT.bottom = activeView.ExportFrame.bottom * (outputResolution / screenResolution); 

// Set up the PixelBounds envelope to match the exportRECT 
ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass(); 
envelope.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom); 
export.PixelBounds = envelope; 

System.Int32 hDC = export.StartExporting(); 

activeView.Output(hDC, (System.Int16)export.Resolution, ref exportRECT, null, null); // Explicit Cast and ''ref'' keyword needed 
export.FinishExporting(); 
export.Cleanup(); 

return true; 
}

要回复问题请先登录注册