ArcGis Engine中实现对符号的预览图输出
2008-04-18 16:37
309 查看
ArcGis Engine中实现对符号的预览图输出 | ||
07-11-12 11:24:09 作者:Aji 出处:中国GIS资讯网 | ||
|
public static System.Drawing.Bitmap SymbolToBitmp(ISymbol pSymbol, int iwidth, int iheight, int wd)
{
//根据高宽创建图象
Bitmap bmp = new Bitmap(iwidth, iheight);
Graphics gImage = Graphics.FromImage(bmp);
gImage.Clear(Color.White);
double dpi = gImage.DpiX;
IEnvelope pEnvelope = new EnvelopeClass();
pEnvelope.PutCoords(0, 0, (double)bmp.Width, (double)bmp.Height);
tagRECT deviceRect;
deviceRect.left = 0;
deviceRect.right = bmp.Width;
deviceRect.top = 0;
deviceRect.bottom = bmp.Height;
IDisplayTransformation pDisplayTransformation = new DisplayTransformationClass();
pDisplayTransformation.VisibleBounds = pEnvelope;
pDisplayTransformation.Bounds = pEnvelope;
pDisplayTransformation.set_DeviceFrame(ref deviceRect);
pDisplayTransformation.Resolution = dpi;
IGeometry pGeo = CreateSymShape(pSymbol, pEnvelope, wd);
System.IntPtr hdc = new IntPtr();
hdc = gImage.GetHdc();
//将符号的形状绘制到图象中
pSymbol.SetupDC((int)hdc, pDisplayTransformation);
pSymbol.Draw(pGeo);
pSymbol.ResetDC();
gImage.ReleaseHdc(hdc);
gImage.Dispose();
return bmp;
}
public static ESRI.ArcGIS.Geometry.IGeometry CreateSymShape(ISymbol pSymbol, IEnvelope pEnvelope, int wd)
{// 根据传入的符号以及外包矩形区域返回对应的几何空间实体(点,线、面)
//判断是否为“点”符号
if (pSymbol is IMarkerSymbol)
{
// 为“点”符号则返回IEnvelope的中心点
IArea pArea;
pArea = pEnvelope as IArea;
return pArea.Centroid as IGeometry;
}
else
{
//判断是否为“线”符号
if (pSymbol is ILineSymbol)
{
IPolyline IpLine = new PolylineClass();
IpLine.FromPoint.PutCoords(0, pEnvelope.YMax / 2);
IpLine.ToPoint.PutCoords(pEnvelope.Width, pEnvelope.YMax / 2);
return IpLine as IGeometry;
}
else
{
//直接返回一个IEnvelope矩形区域
IEnvelope pnewEnvelope = new EnvelopeClass();
pnewEnvelope.PutCoords(wd, wd, pEnvelope.Width - wd, pEnvelope.Height-wd);
return pnewEnvelope as IGeometry;
}
}
}
相关文章推荐
- ArcGIS Engine中实现对符号的输出预览
- ArcGis Engine中实现对符号的预览图输出
- ArcEngine中实现对符号的预览图输出
- 在ArcGis Engine中实现对符号的预览,生成预览图片
- 使用AutoHotkey 实现MarkDown的英文符号输出
- 汇编实现16位有符号二进制数排序并输出
- loner_li 机试题 编写一个简单的计算器实现加减乘除:输入两个数字和一个运算符号,输出结果(注意容错性)
- 用一个函数实现将一行字符串中最短的单词输出。此行字符串从主函数传递给该函数。假设字符串中包含的单词以空格作为分隔符号,例如”Asia Games 2010 is held in GuangZhou.”,其中最短的单词是”is”和”in”。
- 多种方式实现字符串/无符号数反向输出_栈_递归_头尾指针
- 多种方式实现字符串/无符号数反向输出_栈_递归_头尾指针
- ArcGIS Engine下实现地图输出
- ArcGIS Engine下实现地图输出
- 使用位运算实现有符号的十进制正负数转二进制输出
- ABAP实现ALV表头动态输出--日期
- 输出学生成绩。本题要求编写程序,根据输入学生的成绩,统计并输出学生的平均成绩、最高成绩和最低成绩。建议使用动态内存分配来实现。
- java实现输入一个整数,将其转换成八进制数输出。
- dwz+jquery+fileupload+springmvc实现文件上传 及图片预览
- 完成一个学生管理程序,使用学号作为键添加5个学生对象,并可以将全部信息保存在文件中,可以实现对学生信息的学号查找,输出全部学生信息的功能。
- 完成一个学生管理程序,使用学号作为键添加5个学生对象,并可以将全部信息保存在文件中,可以实现对学生信息的学号查找,输出全部学生信息的功能。
- 输出9乘9乘法口诀表并实现0-9每个数字出现的次数并打印出来