openscales2.2 style定义

openscales中的WFS加载的地图样式定义(主要的类图参见如下):

定义元素的样式-》定义多个规则-》规则--对应线、点、多边形或者文本的样式。

具体样式示例:

private function SetPointStyle():Style{
            var pointStyle:Style = new Style();
            var pointrule:Rule = new Rule();
            //定义点显示的图符
            var custommark:org.openscales.core.style.marker.CustomMarker = new org.openscales.core.style.marker.CustomMarker();
            custommark.clip = Bitmap( new PointGif());
            var pointSymb:PointSymbolizer = new PointSymbolizer(custommark);
            pointrule.name="point rule";
            pointrule.symbolizers.push(pointSymb);
            pointStyle.name="PointStyle";
            pointStyle.rules.push( pointrule);
            return pointStyle;
        }
        
        private function SetLineStyle():Style{
            var linestyle:Style = new Style();
            var linerule:Rule = new Rule();
            //定义线的样式:
            var linestroke:Stroke = new Stroke(0x7FFF00,2)
            var lineSymb:LineSymbolizer = new LineSymbolizer(linestroke);
            linerule.name="linerule";
            linerule.symbolizers.push(lineSymb);
            linestyle.name="LineStyle";
            linestyle.rules.push( linerule);
            return linestyle;
        }

  以上当中图片(PointGif)的定义为

[Bindable]
		[Embed(source="/assets/images/icons/Point.gif")]
		private var PointGif:Class;

 在WFS中的引用如下:

<os:WFS
            name="pointend_track"
            url="http://localhost:8085/cgi-bin/mapserv.exe?MAP=D:/tmp/GisDemo/GisDemo/Content/map/OpenscalesDemo.map"
            typename ="pointend_track"
            version="1.0.0"
            useCapabilities="false"
            style="{this.SetPointStyle()}"
        />

参见点的效果如图:

posted @ 2013-04-03 14:55  独孤求败  阅读(429)  评论(0编辑  收藏  举报