当前位置:文档之家› GIS应用开发课件6

GIS应用开发课件6


6.1.2 颜色对话框
ArcObjects中提供了几种颜色对话框供程序 员使用:颜色板( Colorpalatte )对象 、 颜色选择器( ColorSelector )对象和颜色 浏览器( ColorBrowser )对象。
Available with ArcGIS Desktop
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
科研项目
国家自然科学基金项目--面向GML的时空兲联规则及序列模式挖 掘研究(编号:40971234) ,35万元,主持 国家自然科学基金项目--本原GML空间数据库理论及GMLGIS与传 统GIS集成研究(编号:40761017) ,16万元,主持 国家自然科学基金项目 -- GML空间数据存储索引机制研究(编号: 40401045) ,26万元,排名第二 地理信息科学江苏省重点实验室开发基金项目 --面向对象的GML 空间数据库及其应用研究(编号:JK20050302) ,5万元主持
IColorPalette pPalette = new ColorPaletteClass(); public bool TrackPopupMenu //定义一个范围结构 ( ref tagRECTrect, tagRECT pRect = new tagRECT() ; ref IColor currentColor, pRect.left =10; ref bool orientation, ref int hParentWnd); pRect.top =10;
HSV模型颜色构造器
private IHsvColor HSVColor(int hue , int saturation , int val ) { //定义一个IHSVColor类型对象 IHsvColor pHsvColor = new HsvColorClass(); //设置它的值 pHsvColor.Hue = hue;
1. RGB(红色、绿色、蓝色)颜色模型:RGBColor 2. HSV(色调、饱和度、亮度)颜色模型:HSVColor 3. CMYK(青色、洋红色、黄色、黑色)颜色模型: CmykColor 4. 灰度颜色:GrayColor 5. CIELAB颜色(在ArcObjects中使用,与设备无兲) 6. 色带(ColorRamp)
pPalette.TrackPopupMenu(ref pRect, pColor, false, 0); //获得新的颜色
pColor = pPalette.Color;
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
颜色板对象 Colorpalatte
ColorPalette颜色板对 象一共排列了120种 颜色供用户使用,如 图所示。 ColorPalette 类实现了两个接口: IColorPalette和 ICustomColorPalette。
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
制图表现(Representation) (9.2新增功能)
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
空间数据符号化主要元素
符号(对象)
• 色彩(对象)
着色(对象)
符号(对象)→着色(对象)
IGeoFeatureLayer.Renderer 用于要素图层的符 号化,符号化信息保存在要素图层中。
{ IRgbColor pColor = new RgbColorClass(); pColor.Red = r; pColor.Green = g; pColor.Blue = b;
return pColor;
}
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
pHsvColor.Saturation = saturation;
pHsvColor.Value = val; return pHsvColor;
}
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
RGB颜色构造器
private IRgbColor getRGB(int r,int g,int b)
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
Chap.6 空间数据的可视化表达 (4学时)
本章内容:
1. Color对象 2. Symbol对象 3. 符号样式库与符号化控件 4. 制作专题图 5. 制图表现 6. 地图标注
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
RGB模型
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
CMYK模型
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
下面是两种数值方式互相转换的函数。 RGB值转换为LONG值 private long RGBToLong(int Red, int Green ,int Blue ) { return Red + (0x100 * Green) + (0x10000 * Blue); } LONG值转换为RGB值 private short[] LongtoRGB(long RGBlong) { short[] pbyte = new short[3] ; pbyte[0] = (short) (RGBlong % 0x100) ; pbyte[1] = (short) ((RGBlong / 0x100) % 0x100); pbyte[2] = (short) ((RGBlong / 0x10000) % 0x100); return pbyte; }
江西省教育厅科技项目—GML空间数据库理论及GMLGIS研究,1万 元,主持
萍乡市基础地理信息系统研究与开发,22万元,主持
城市公众地理信息服务系统研究与开发,10万元,主持
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
HSV模型
hue : 0-360
saturation : 0-100 value :0-100
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
6.1.1 Color对象
Color对象是一个抽象类,它有5个颜色 子类,即CmykColor、RGBColor、 HSVColor、HLSColor和GrayColor,它们 可以使用IColor接口定义的方法设置颜 色对象的基本属性。 IColor.RGB属性会返回一个LONG数值,而不是RGB模型 需要的R、G、B上的三个值,如白色的 RGB属性返回值 为16777215,而不是用户需要的255、255、255三个值。 如果采用ArcObjects的颜色选择对话框选取一个颜色后 使用,程序员就必须使用 RGB值的写法。
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
IRgbColor, ICmykColor, IHsvColor, IHlsColor, 和IGrayColor接口继承自IColor接口。
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
江西理工大学 – Developing GIS Applications with ArcObjects using Байду номын сангаас#.NET
ArcMap中空间数据符号化方法
普通的符号化方法
单一符号(Single Symbol) 分类符号(Category Symbol)—Unique Values Renderer 分级符号(Graduated Symbol) 分级色彩(Graduated Color) 比例符号(Proportional Symbol) 点值符号(Dot density) 组合符号(Multivariate Symbol) 统计图形(Statistical Charts)
颜色选择器对象
颜色选择器(ColorSelector) 对象提供了一种更精确选 择颜色的方法。用户可以 点击对话框上方右边的小 箭头,选择RGB、CMYK、 HSV多种颜色模型,通过 拖曳颜色带或者直接输入 具体颜色值的方法返回颜 色对象,如图所示。
江西理工大学 – Developing GIS Applications with ArcObjects using C#.NET
IColorPalette接口定义了 Color属性和 TrackPopupMenu方法, 使用这个接口可以从对话框中获得一个颜色对象。下面是 使用调色板对象取出一个颜色的例子:
IColor pColor = new RgbColorClass(); pColor.RGB = 255 ; //新建一个颜色板对象
相关主题