发表用户:cs1234
收集整理:James.Liu
相关讨论:http://www.mygis.com.cn/forum/dispbbs.asp?boardID=4&ID=6376
信息原始来源:不祥

文章标题:MapX图元样式总结


1.1 位图符号样式的详细解释:
属性名称 属性类型 属性含义 备注
SupportsBitmapSymbols Boolean 只读属性标志,标识样式对象是否支持位图符号 当为true时表示支持位图符号,现在只有像素,图层和专题对象支持位图符号。
SymbolBitmapOverrideColor Boolean 定制是否允许自定义位图符号颜色 
SymbolBitmapColor OLE_COLOR 设置位图符号的颜色 为了使位图符号显示你定制的颜色,要经过以下两步:1设置SymbolBitmapColor属性为你想赋值的颜色2设置SymbolBitmapOverrideColor属性为True当你将TrueType字体符号转换为位图符号时MapX将匹配SymbolBitmapColor,SymbolFontColor 
SymbolBitmapName String 用做位图符号的文件名 文件名不必写明路径,因为位图文件必须放在MapX安装路径下面的CUSTSYMB文件夹下面
SymbolBitmapSize Integer 定制位图符号的大小 符号大小的范围是1--48
SymbolBitmapTransparen Boolean 可读写标志,决定位图符号的白色部分是否透明,默认为False 

1.2 字体符号样式的详细解释:


属性名称 属性类型 属性含义 备注
SymbolCharacter Integer 指定TrueType字体中的哪个符号被选用 1—255之间
SymbolFont IFontDispatch, OLE_FONT 允许你改变字体属性来改变字体符号外观,仅支持TrueType 只读属性,改变外观可通过设置字体的属性例:Map1.Layers(1).OverrideStyle = TrueMap1.Layers(1).Style.SymbolFont.Size = 36或赋给一个字体对象,通过字体对象来改变
SymbolFontBackColor OLE_COLOR 标识字体符号背景颜色值,仅支持TrueType字体 
SymbolFontColor OLE_COLOR 标识字体符号前景颜色值,仅支持TrueType字体 
SymbolFontHalo Boolean 规定字体符号是否有光晕效果 
SymbolFontOpaque Boolean 规定字体符号是否显示背景色(即是否透明)仅支持TrueType字体 
SymbolFontRotation Integer TrueType字体符号的旋转角度,仅支持TrueType字体 范围0—360,位图符号不支持旋转,图层,像素,专题等对象支持,如果不支持就会被忽略。
SymbolFontShadow Boolean 规定是否在字体下画阴影仅支持TrueType字体 仅支持图层对象的样式,和标题对象的样式。


1.3 向量符号样式的详细解释:
属性名称 属性类型 属性含义 备注
SymbolVectorColor OLE_COLOR 指定向量符号的颜色默认为miColorBlack. 
SymbolVectorSize Integer 指定向量符号的大小默认为12 
MinVectorSymbolCharacter Integer  
MaxVectorSymbolCharacter   


2.线段样式的详细解释:

属性名称 属性类型 属性含义 备注
LineColor OLE_COLOR 指定线的颜色 
LineSupportsInterleave Boolean 判断是否支持边界 
LineInterleaved Boolean 设定是否支持边界 
LineStyle Integer 设置直线样式 祥见MapX在线帮助:Style.LineStyle
LineStyleCount Integer 只读属性,返回当前设置的LineStyle 
LineWidth Integer 设定线的宽度 
LineWidthUnit miStyleUnitPixel = 0miStyleUnitTenthsOfPoint =1 设定线宽度的单位 


3.区域样式的详细解释:
属性名称 属性类型 属性含义 备注
RegionBackColor OLE_COLOR 设置区域的背景颜色 除了RegionPattern =iPatternSolid以外
RegionColor OLE_COLOR 设置区域的前景颜色 
RegionBorderColor OLE_COLOR 设置区域的边界颜色 
RegionBorderWidth Integer 设置区域的边界宽度 
RegionBorderWidthUnit miStyleUnitPixel = 0miStyleUnitTenthsOfPoint =1 设定区域宽度的单位 
RegionPattern miPatternNoFill  = 0 miPatternHollow = 1 miPatternSolid = 2 miPatternHorizontal = 3 miPatternVertical = 4 miPatternFDiag = 5 miPatternFilBDiag = 6 miPatternCross = 7 miPatternDiagCross = 8 设置区域图案 miPatternNoFill(无填充)miPatternHollow (中空)miPatternSolidmiPatternHorizontal (水行线)miPatternVertical (铅垂线)miPatternFDiag = 5 miPatternFilBDiag = 6 miPatternCross = 7 miPatternDiagCross = 8
RegionTransparent Boolean 设定区域是否透明 
.

4.文本样式的详细解释:
属性名称 属性类型 属性含义 备注
TextFont IFontDispatch, OLE_FONT 允许你改变字体属性来改变文本字体,仅支持TrueType 只读属性,改变外观可通过设置字体的属性或赋给一个字体对象,通过字体对象来改变
TextFontAllCaps Boolean 设定是否文本都显示为大写字母 仅支持Label和layer的样式对象
TextFontBackColor OLE_COLOR 文本字体的背景色 
TextFontColor OLE_COLOR 文本字体的前景色 
TextFontDblSpace Boolean 设置文本之间的空格倍数 仅支持Label和layer的样式对象
TextFontHalo Boolean 规定文本字体是否有光晕效果 
TextFontOpaque Boolean 规定文本字体是否显示背景色(即是否透明) 
TextFontRotation Integer 文本字体的旋转角度,仅支持TrueType字体 范围0—360,仅支持Feature对象,如果不支持就会被忽略。
TextFontShadow Boolean 规定是否在文本字体下画阴影 仅支持图层对象的样式,和标题对象的样式。


5.样式方法的详细解释:.
5.1 DrawSample 系列详细解释:
DrawTextSample      (HDC, Rectangle,SampleText);
DrawLineSample      (HDC, Rectangle);
DrawRegionSample    (HDC, Rectangle);
DrawSymbolSample   (HDC, Rectangle);

功能:在画板上画样式的过程
参数:
参数名称 参数类型 参数意义
HDC HDC 调用画板的设备上下文句柄
Rectangle CMapXRectangle 
SampleText(仅DrawTextSample) String 样本文字(仅DrawTextSample)
例子(delphi):
var
 rect: CMapXRectangle;
begin
  rect := CoRectangle.Create;
 rect.Set_(0, 0, Image1.Width, Image1.Height);
{ To draw a line sample: }
 Map1.DefaultStyle.DrawLineSample(Image1.Canvas.Handle, rect);
 { To draw a region sample: }
 Map1.DefaultStyle.DrawRegionSample(Image1.Canvas.Handle, rect);
{ To draw a symbol sample: }
  Map1.DefaultStyle.DrawSymbolSample(Image1.Canvas.Handle, rect);
  { To draw a text sample: }
  Map1.DefaultStyle.DrawTextSample(Image1.Canvas.Handle, rect, 'The Quick Brown Cow');
end;

 


5.2 ExportSample系列详细解释:
ExportLineSample    (Destination, Format, Width, Height, [BackColor])  
ExportRegionSample  (Location, Format, Width, Height, [BackColor ])
ExportSymbolSample  (Location, Format, Width, Height, [BackColor ] )
ExportTextSample    (Location, Format, Width, Height, [BackColor ])

功能:输出样式的过程,输出的样式为图像文件.
参数:
参数名称 参数类型 参数意义
Location String 输出的样式文件的磁盘位置,如果是”CLIPBOARD”,表示输出到剪贴板上
Format  miFormatWMF = 0 miFormatBMP = 1 miFormatGIF = 2 miFormatJPEG = 3 miFormatTIF = 4 miFormatPNG = 5 miFormatPSD = 6 输出的图像文件的格式
Width  Double 宽度(像素个数)
Height  Double 高度(像素个数)
[BackColor]  OLE_COLOR 可选,背景颜色
例子(delphi):
{ Export a 12 pixel by 9 pixel symbol to the clipboard in BMP Format }
Map1.DefaultStyle.ExportSymbolSample('clipboard', miFormatBMP, 12, 9, miColorWhite);
Style.ExportTextSample
{ Export a 2 pixel by 9 pixel text to the clipboard in BMP Format }
Map1.DefaultStyle.ExportTextSample('clipboard', miFormatBMP, 2, 9, 'Hello World', miColorWhite);


5.3 Pick系列详细解释:
Style.PickLine method 
Style.PickRegion method 
Style.PickSymbol method
Style.PickText method
功能:选择样式.

5.3 Clone详细解释:
功能:返回一个从别的样式对象拷贝过来的Stand-Alone样式对象,
      如果你想改变样式的对象,属于其他对象,那么这样的改变会自动的影响你想要改变样式对象的父对象。
      为了不影响父对象的样式,就需要先调用Clone方法,创建一个样式的拷贝。因为这个拷贝是一个Stand-Alone样式对象,对它的修改不会影响其他的样式对象,所以就不会影响你想要改变样式对象的父对象。
      通过Clone方法调用的得到的样式对象,当且仅当原始对象支持bitmap symbols才会支持bitmap symbol。
例子(delphi):
     var
     s: Style;
begin
       { copy the style from layer 2 to use as starting point }
        s := Map1.Layers.Item(2).Style.Clone;
 { let user modify style }
       s.PickSymbol;
 { now assign to layer 1 note that layer 2's style is not affected }
       Map1.Layers.Item(1).Style := s;
       { make sure that new style is used as override }
       { for all objects in layer }
 Map1.Layers.Item(1).OverrideStyle := True;
end;


                                                                                          乔乔
                                                                                          2003-6-4.