OpenScales笔记
程序员文章站
2022-07-14 09:45:48
...
转载请注明出处:http://tedeum.iteye.com
1、添加map点击事件,Feature鼠标事件
map = fxmap.map; map.addEventListener(MouseEvent.CLICK, fxmap_clickHandler); map.addEventListener(FeatureEvent.FEATURE_MOUSEMOVE, feature_mouseOver); private function feature_mouseOver(event:FeatureEvent):void { }
2、手动添加图层
var markers:FeatureLayer = new FeatureLayer("featureLayer"); markers.projection = new ProjProjection("EPSG:4326"); markers.generateResolutions(19); markers.style = Style.getDefaultPointStyle(); //add the first marker var marker:PointFeature = PointFeature.createPointFeature(new Location(100.586111111111,26.7083333333333)); markers.addFeature(marker); // //add a second marker marker = PointFeature.createPointFeature(new Location(4.85780,45.75336)); markers.addFeature(marker); //add marker with different symbol, writing url address //http://hiphotos.baidu.com/zhidao/pic/item/a6efce1b7fbe48cdaf513384.jpg?t=1300258770785&t=1300258828239 C:\\fire.gif C:\\Blue.swf var loader:SWFLoader = new SWFLoader(); //var u:url var uq:URLRequest = new URLRequest("http://localhost:8080/geoserver/fire.swf"); loader.load(uq); //swfLoader.load("C:\\Blue.swf"); //var cMarker:CustomMarker = CustomMarker.createDisplayObjectMarker(loader.content, new Location(100.586111111111,26.7083333333333)); // var cMarker:CustomMarker = CustomMarker.createUrlBasedMarker("http://localhost:8080/geoserver/fire.swf", new Location(100.586111111111,26.7083333333333)); var cMarker:CustomMarker = CustomMarker.createUrlBasedMarker("http://localhost:8080/geoserver/fire.gif", new Location(100.586111111111,26.7083333333333)); cMarker.attributes["name"] = "featureName"; markers.addFeature(cMarker); //add the layer map.addLayer(markers);
3、放大到最大比例
map.zoomToMaxExtent();
4、创建一个swf的点样式
Embed(source="fire.swf")] public var fireClass:Class; private function createShjcPtStyle():Style { var style:Style = new Style(); style.name = "Fire Style"; var stroke:Stroke, symbolizer:Symbolizer, rule:Rule; //var bounds:Bounds; rule = new Rule(); rule.name="Fire Style Rule"; symbolizer = new PointSymbolizer(new DisplayObjectMarker(fireClass)); rule.symbolizers.push(symbolizer); style.rules[0] = rule; //var p:org.openscales.geometry.Point = new org.openscales.geometry.Point(); return style; }
转载请注明出处:http://tedeum.iteye.com
上一篇: (APIO) 非法捕鱼