Navigation
· index
· OpenScales v1.2 documentation »
在阅读本节前请先阅读第二节第 2节 : 创建第一个地图.
mxml文件的as部分将在地图上创建一个标注.
创建一个简单的地图标注你需要以下准备:
创建一个功能层 定义使用层的投影 地图标注显示的分辨率 定义一个默认样式 创建一个正确的坐标点 (需要与层的投影相同) import org.openscales.core.Map; import org.openscales.core.feature.PointFeature; import org.openscales.core.layer.FeatureLayer; import org.openscales.core.style.Style; import org.openscales.geometry.Point; import org.openscales.proj4as.ProjProjection; [Bindable] private var map:Map = null; private function initMap():void { map = fxmap.map; var markers:FeatureLayer = new FeatureLayer("NameOfYourLayerWithMarkers"); markers.projection = new ProjProjection("EPSG:4326"); markers.generateResolutions(19); markers.style = Style.getDefaultPointStyle(); var marker:PointFeature=PointFeature.createPointFeature(new Location(4.85980,45.75336)); markers.addFeature(marker); map.addLayer(markers); } ]]>将以下两行增加到层代码前
map.addLayer(markers); marker = PointFeature.createPointFeature(new Location(4.85980,45.75336)); markers.addFeature(marker);你可以通过一个URL增加一个标示图片:首先需要应用一下库文件:
import org.openscales.core.feature.CustomMarker;然后在增加的层中,增加一个地图标示:
markers.addFeature(CustomMarker.createUrlBasedMarker("http://earth.google.com/intl/en_uk/outreach/images/add_placemark.png", new Location(4.85980,45.75336)));现在你就能够增加一个地图标注在Openscales地图中了.
§ Prerequisites
§ What do you obtain with this tutorial?
§ Action Script code to obtain the map
§ Add a default style marker
§ Add another marker
§ Add marker with custom symbol
§ Here you are
Enter search terms or a module, class or function name.
Navigation
· index
· OpenScales v1.2 documentation »
© Copyright 2010, openscales.org. Created using Sphinx 1.0.4.