com.supermap.web.core.styles
public class InfoStyle
继承 InfoStyle Inheritance Style Inheritance flash.events.EventDispatcher

信息显示风格类.

该类用于定义要素信息显示风格,用户可以在其中加入任何 flex 组件,如:图片、文本等。InfoStyle 可以显示在多个位置上,即地图上可以包含多个 InfoStyle。需要注意的是,其显示位置必须是地图单位的坐标点。

查看示例



公共属性
  属性 定义方
    containerStyleName : String
样式名称,该样式用于定义 infoStyle 的容器外观。.
InfoStyle
    infoPlacement : String
获取或设置 InfoStyle 显示的位置.
InfoStyle
    infoRenderer : IFactory
IFactory 类,用户可以通过该属性定义信息显示内容。
InfoStyle
公共方法
  方法 定义方
   
初始化 InfoStyle 类的新实例。
InfoStyle
  Inherited
clear(sprite:Sprite):void
清除显示列表构造块 Sprite.graphics 中装载的所有矢量元素。
Style
   
[Override] 克隆 InfoStyle 对象。
InfoStyle
  Inherited
destroy(sprite:Sprite):void
销毁显示列表构造块 Sprite。
Style
   
draw(sprite:Sprite, geometry:Geometry, attributes:Object, map:Map):void
[Override] 绘制要素。
InfoStyle
  Inherited
initialize(sprite:Sprite, geometry:Geometry, attributes:Object, map:Map):void
初始化 style。
Style
受保护的方法
  方法 定义方
  Inherited
派发 Event.CHANGE 事件。
Style
  Inherited
removeAllChildren(sprite:Sprite):void
清除 Sprite 中的所有子项。
Style
  Inherited
toScreenX(map:Map, mapX:Number):Number
将地图上某一点的 X 坐标转换为屏幕坐标。
Style
  Inherited
toScreenY(map:Map, mapY:Number):Number
将地图上某一点的 Y 坐标转换为屏幕坐标。
Style
属性详细信息
containerStyleName 属性
public var containerStyleName:String

样式名称,该样式用于定义 infoStyle 的容器外观。.

样式可以使用标签语言<fx:style>定义,也可在CSS样式表中定义。InfoStyle 的容器外观样式所包含的类型请参见 Adobe Flex 4.0 API 的 Container 容器样式列表。示例代码如下:

另请参见

infoPlacement 属性  
infoPlacement:String

获取或设置 InfoStyle 显示的位置.

默认为右上角,即 InfoPlacement.UPPERRIGHT。


Implementation
    public function get infoPlacement():String
    public function set infoPlacement(value:String):void

另请参见

com.supermap.web.mapping.supportClasses.InfoPlacement
infoRenderer 属性  
infoRenderer:IFactory

IFactory 类,用户可以通过该属性定义信息显示内容。


Implementation
    public function get infoRenderer():IFactory
    public function set infoRenderer(value:IFactory):void
构造函数详细信息
InfoStyle () 构造函数
public function InfoStyle()

初始化 InfoStyle 类的新实例。

方法详细描述
clone () 方法
override public function clone():Style

克隆 InfoStyle 对象。

返回
Style
draw () 方法  
override public function draw(sprite:Sprite, geometry:Geometry, attributes:Object, map:Map):void

绘制要素。

参数

sprite:Sprite
 
geometry:Geometry
 
attributes:Object
 
map:Map

示例
下面示例显示如何使用 InfoStyle:
 
          
          <fx:Declarations>
              <ic:InfoStyle id="infoStyle">
                  <ic:infoRenderer>
                      <fx:Component>
                          <s:HGroup gap="5">
                              <mx:Image width="100" height="75" source="../assets/pic3.jpg"/>
                              <mx:Text text="千岛湖是世界上岛屿最多的湖。位于东经118°58′—119°17′,北纬29°31′—29°41′之间" 
                                       color="#255" width="150" height="100%"/>
                          </s:HGroup>
                      </fx:Component>
                  </ic:infoRenderer>
              </ic:InfoStyle>
          </fx:Declarations>
          
          //使用 InfoStyle
          var feature:Feature = new Feature();
          feature.geometry = new GeoPoint(119,29); 
          feature.style = infoStyle;
          featureLayer.addFeature(feature); 
          //有关使用 AS 语言定义 InfoStyle 的示例可参见 SuperMap iClient 6R for Flex Samplecode_iServerJava6R