导出图片,包含栅格的地图导出的图片模糊,arcgis eingine
2015-07-23 11:48
323 查看
原因:栅格数据重采样了,解决方法:
PixelBoundsEnv = new Envelope() as IEnvelope;
if (bClipToGraphicsExtent && (docActiveView is IPageLayout))
{
docGraphicsExtentEnv = GetGraphicsExtent(docActiveView);
docPageLayout = docActiveView as PageLayout;
pUnitConvertor = new UnitConverter();
//assign the x and y values representing the clipped area to the PixelBounds envelope
PixelBoundsEnv.XMin = 0;
PixelBoundsEnv.YMin = 0;
PixelBoundsEnv.XMax = pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.XMax, docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution - pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.XMin,
docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution;
PixelBoundsEnv.YMax = pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.YMax, docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution - pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.YMin,
docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution;
//'assign the x and y values representing the clipped export extent to the exportRECT
exportRECT.bottom = (int)(PixelBoundsEnv.YMax) + 1;
exportRECT.left = (int)(PixelBoundsEnv.XMin);
exportRECT.top = (int)(PixelBoundsEnv.YMin);
exportRECT.right = (int)(PixelBoundsEnv.XMax) + 1;
//since we're clipping to graphics extent, set the visible bounds.
docMapExtEnv = docGraphicsExtentEnv;
}
else
{
double tempratio = iOutputResolution / iScreenResolution;
double tempbottom = DisplayBounds.bottom * tempratio;
double tempright = DisplayBounds.right * tempratio;
//'The values in the exportRECT tagRECT correspond to the width
//and height to export, measured in pixels with an origin in the top left corner.
exportRECT.bottom = (int)Math.Truncate(tempbottom);
exportRECT.left = 0;
exportRECT.top = 0;
exportRECT.right = (int)Math.Truncate(tempright);
//populate the PixelBounds envelope with the values from exportRECT.
// We need to do this because the exporter object requires an envelope object
// instead of a tagRECT structure.
PixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
//since it's a page layout or an unclipped page layout we don't need docMapExtEnv.
docMapExtEnv = null;
}
// Assign the envelope object to the exporter object's PixelBounds property. The exporter object
// will use these dimensions when allocating memory for the export file.
docExport.PixelBounds = PixelBoundsEnv;
PixelBoundsEnv = new Envelope() as IEnvelope;
if (bClipToGraphicsExtent && (docActiveView is IPageLayout))
{
docGraphicsExtentEnv = GetGraphicsExtent(docActiveView);
docPageLayout = docActiveView as PageLayout;
pUnitConvertor = new UnitConverter();
//assign the x and y values representing the clipped area to the PixelBounds envelope
PixelBoundsEnv.XMin = 0;
PixelBoundsEnv.YMin = 0;
PixelBoundsEnv.XMax = pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.XMax, docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution - pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.XMin,
docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution;
PixelBoundsEnv.YMax = pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.YMax, docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution - pUnitConvertor.ConvertUnits(docGraphicsExtentEnv.YMin,
docPageLayout.Page.Units, esriUnits.esriInches) * docExport.Resolution;
//'assign the x and y values representing the clipped export extent to the exportRECT
exportRECT.bottom = (int)(PixelBoundsEnv.YMax) + 1;
exportRECT.left = (int)(PixelBoundsEnv.XMin);
exportRECT.top = (int)(PixelBoundsEnv.YMin);
exportRECT.right = (int)(PixelBoundsEnv.XMax) + 1;
//since we're clipping to graphics extent, set the visible bounds.
docMapExtEnv = docGraphicsExtentEnv;
}
else
{
double tempratio = iOutputResolution / iScreenResolution;
double tempbottom = DisplayBounds.bottom * tempratio;
double tempright = DisplayBounds.right * tempratio;
//'The values in the exportRECT tagRECT correspond to the width
//and height to export, measured in pixels with an origin in the top left corner.
exportRECT.bottom = (int)Math.Truncate(tempbottom);
exportRECT.left = 0;
exportRECT.top = 0;
exportRECT.right = (int)Math.Truncate(tempright);
//populate the PixelBounds envelope with the values from exportRECT.
// We need to do this because the exporter object requires an envelope object
// instead of a tagRECT structure.
PixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
//since it's a page layout or an unclipped page layout we don't need docMapExtEnv.
docMapExtEnv = null;
}
// Assign the envelope object to the exporter object's PixelBounds property. The exporter object
// will use these dimensions when allocating memory for the export file.
docExport.PixelBounds = PixelBoundsEnv;
相关文章推荐
- Umbrella Header for Module Bolts does not include header 'XXXXXX.h'?
- Android设置EditText中字体颜色不一致以及光标移至到字后边
- HTML5引擎Construct2技术剖析(四)
- The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path
- Flex 布局教程转载
- Eclipse jetty
- 错误收集(一)
- 栅格系统布局--淘宝ued,好文章!
- Go语言并发与并行学习笔记(三)
- 在tomcat下部署drools 6.2.0 workbench
- IP与数字互相转换(PHP )
- Arcgis 由点生成方形缓冲区
- 网页分享
- 在IDEA上用python来连接集群上的hive
- 计算两个日期之间相差几天几小时几分钟
- JMeter压力测试总结
- android 分享到QQ空间的所有操作
- Jsoup 解析 HTML
- 各种排序算法大全
- 两种方法删除NSUserDefaults所有记录