OpenScales入门教程 第3节 : 增加一个标注
2011-04-19 19:03
323 查看
Navigation
· index
· OpenScales v1.2 documentation »
第3节 : 增加一个标注¶
准备工作¶
在阅读本节前请先阅读第二节第 2节 : 创建第一个地图.本节范例将展示为以下效果?¶
Action Script代码显示地图¶
import org.openscales.geometry.basetypes.Location;import org.openscales.core.Map;import org.openscales.core.feature.CustomMarker;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();//add the first markervar marker:PointFeature = PointFeature.createPointFeature(new Location(4.85680,45.75336));markers.addFeature(marker);//add a second markermarker = PointFeature.createPointFeature(new Location(4.85780,45.75336));markers.addFeature(marker);//add marker with different symbol, writing url addressmarkers.addFeature(CustomMarker.createUrlBasedMarker("http://earth.google.com/intl/en_uk/outreach/images/add_placemark.png",new Location(4.85580,45.75336)));//add the layermap.addLayer(markers);}]]>增加一个默认的标注样式¶
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地图中了.
Table Of Contents
Tutorial 3 : Add markers
§ 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
This Page
Show Source
Quick search
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.
相关文章推荐
- Express入门教程:一个简单的博客
- 推荐一个React 入门的教程
- 一个很特别的动态规划 入门的教程!
- Altium designer入门教程一:新建一个项目
- 很特别的一个动态规划入门教程
- ASP.NET MVC4入门教程(三):添加一个视图
- Asp.Net MVC4.0 官方教程 入门指南之二--添加一个控制器
- ASP.NET MVC3 快速入门-第六节 增加一个追加数据的方法和一个追加数据的视图
- Asp.Net MVC4.0 官方教程 入门指南之二--添加一个控制器
- Asp.Net MVC4.0 官方教程 入门指南之二--添加一个控制器
- 很特别的一个动态规划入门教程
- Microsoft ASP.NET 快速入门教程的大纲介绍(一个值得推荐的.net网站也可以说是.net资料库)
- 一个不错的Git入门教程
- 很特别的一个动态规划入门教程
- 手把手教你使用FineUI开发一个b/s结构的取送货管理信息系统(附源码+视频教程(第3节))
- 推荐一个Flex的入门教程 Flex Quick Starts: Getting started
- WCF入门教程六[一个简单的Demo]
- ASP.NET Aries 入门开发教程3:开发一个列表页面及操控查询区
- ASP.NET MVC3 快速入门-第六节 增加一个追加数据的方法和一个追加数据的视图(转)
- Android基础入门教程——2.4.7 构建一个可复用的自定义BaseAdapter