flexviewer 环境搭建及新建项目1

                                                           flexviewer 环境搭建1

1, FlexViewer 是ArcGis为非专业GIS开发员对Flex开发一个框架,该框架对整个界面已作了很多的封装,开发人员主要专注专业务的开发,减少了很多的界面工作开发,整体使用的是事件模式。下载网站:http://support.esrichina.com.cn/support/download/software/

去下载, ArcGIS API for Flex ,  ArcGIS Viewer for Flex  下载这两个版本,如果要开发的话,还要下载它的源码包,点 ArcGIS Viewer for Flex 进去,它有一个 2.5, 3.0 版本的

github 源码下载地址, 3.0 版本对应是Flex4.5以上,本人现下载是2.5 对应flex4.1 。

2. 先安装flexBuilder4.1 ,见另一文章。

3. 下载下来解压如下:

 

<!--EndFragment-->

 

<!--EndFragment-->

注意,在开发环境下时,要把这个.swc加到flex_libs 中,

这个samples 中也有很多例子可以放在开发环境中运行查看。

4.flex_viewer & flex_viewer_src

当然在可以直接把ArcGIS_flexviewer-2.5-src直接导入到eclipse中的,它本身也是flex工程,如果在web中不建议这么做,

flexviewer-2.5 这是一个编译后的工程,它也是直接可以运行的一个工程。

 

5,eclipse 搭建Web工程:

  1

  

 

 2.

  

   先不选远程对象访问服务,以后flex 与java 通讯时,再加入BlazeDS 。

3.

 

 我在这里把输出文件改为:  WebContent\flexviewer 这个表示,编译后的SWF放在哪里

 

 

 

 

 4.

  

再点完后即可。

 

5.  工程如下 :

 

 

把上面flex_view_src工程下的src 中的全部,都copy 到当前工程中的flex_src下, 再把arcgis_api_for_flex_2.5工程下的lib中的一个 .swc copy 到当前工程中的 flex_libs 中 。

如图:

     

 

 导入后,它会自动编译,但有一个错误,查看Problems 中报找不到  zh_CN  所对应的ViewerStrings 文件,这是一个国际化的文件,

在当前工程下,和 flex_src 平级的下,把 flex_viewer_src_2.5源码工程下的locale copye 到当前工程下 , 这个主要是在编译时,它会去使用哪个国际化的文件,在你打开主页面时,上面的文字可以是中文,英文等 。

copy 进来后,这个错误,还是没有解决,对项目右键,选中最后一个properties属性,

找到flex 编译器,在编译器参数后加一空格后加 : -source-path=locale/{locale} -keep-all-type-selectors=true

即可。

6.  到此,你可以把你的项目部署到tomcat 中,但你的项目运行起来,不会显示出地图,最后一步:

你上面 flex_viewer_src 工程下有一个文件 .actionScriptProperties 打开它,

<modules>
    <module application="src/index.mxml" destPath="widgets/Bookmark/BookmarkWidget.swf" optimize="true" sourcePath="src/widgets/Bookmark/BookmarkWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Coordinate/CoordinateWidget.swf" optimize="true" sourcePath="src/widgets/Coordinate/CoordinateWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Chart/ChartWidget.swf" optimize="true" sourcePath="src/widgets/Chart/ChartWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/DataExtract/DataExtractWidget.swf" optimize="true" sourcePath="src/widgets/DataExtract/DataExtractWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Draw/DrawWidget.swf" optimize="true" sourcePath="src/widgets/Draw/DrawWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Edit/EditWidget.swf" optimize="true" sourcePath="src/widgets/Edit/EditWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Geoprocessing/GeoprocessingWidget.swf" optimize="true" sourcePath="src/widgets/Geoprocessing/GeoprocessingWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/GeoRSS/GeoRSSWidget.swf" optimize="true" sourcePath="src/widgets/GeoRSS/GeoRSSWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/HeaderController/HeaderControllerWidget.swf" optimize="true" sourcePath="src/widgets/HeaderController/HeaderControllerWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/InfoTemplates/InfoPopupWidget.swf" optimize="true" sourcePath="src/widgets/InfoTemplates/InfoPopupWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/InfoTemplates/SimpleInfoWinWidget.swf" optimize="true" sourcePath="src/widgets/InfoTemplates/SimpleInfoWinWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/LayerList/LayerListWidget.swf" optimize="true" sourcePath="src/widgets/LayerList/LayerListWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Locate/LocateWidget.swf" optimize="true" sourcePath="src/widgets/Locate/LocateWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Legend/LegendWidget.swf" optimize="true" sourcePath="src/widgets/Legend/LegendWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/MapSwitcher/MapSwitcherWidget.swf" optimize="true" sourcePath="src/widgets/MapSwitcher/MapSwitcherWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Navigation/NavigationWidget.swf" optimize="true" sourcePath="src/widgets/Navigation/NavigationWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/OverviewMap/OverviewMapWidget.swf" optimize="true" sourcePath="src/widgets/OverviewMap/OverviewMapWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Print/PrintWidget.swf" optimize="true" sourcePath="src/widgets/Print/PrintWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Query/QueryWidget.swf" optimize="true" sourcePath="src/widgets/Query/QueryWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Samples/HelloWorld/HelloWorldWidget.swf" optimize="true" sourcePath="src/widgets/Samples/HelloWorld/HelloWorldWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Samples/ThematicQuery/InfoColumnChartWidget.swf" optimize="true" sourcePath="src/widgets/Samples/ThematicQuery/InfoColumnChartWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Samples/ThematicQuery/ThematicQueryWidget.swf" optimize="true" sourcePath="src/widgets/Samples/ThematicQuery/ThematicQueryWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Search/SearchWidget.swf" optimize="true" sourcePath="src/widgets/Search/SearchWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Splash/SplashWidget.swf" optimize="true" sourcePath="src/widgets/Splash/SplashWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/StaticImage/StaticImageWidget.swf" optimize="true" sourcePath="src/widgets/StaticImage/StaticImageWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/Time/TimeWidget.swf" optimize="true" sourcePath="src/widgets/Time/TimeWidget.mxml"/>
    <module application="src/index.mxml" destPath="widgets/WidgetContainer/WidgetContainerWidget.swf" optimize="true" sourcePath="src/widgets/WidgetContainer/WidgetContainerWidget.mxml"/>
  </modules>

把这些所有的modules copy 到你当前工程下的文件中,相同的文件里面去,

copy 完后,对项目刷新一下 ,再对eclipse 当前项目右键 点properties 属性 ,选如图:

注意,把以上,修改为当前包下的 Widget ... 把优化对象,改为你导入的源码包中的index.mxml , 把所有的都改下,或在上一步,copy文件时就把它改掉,  保存,它会自动编译,编译完可以到WebRoot下的flexview 相应的目录下去看,会生成swf ,如果没有生成,说明没有编译成功,动行不了 。

7.  编译完后, 运行项目即可,界面如图:

 

本地网络慢,没显示出地图,flash player 请使用最新版,

给一个flexviewer 学习网站:http://help.arcgis.com/en/webapps/flexviewer/help/index.html#/Widget_framework/01m30000001z000000/

 

简介..... ................................................................................................................................... 4 1.1 准备知识.......................................................................................................................... 4 1.1.1 技能与软件需求......................................................................................................... 4 1.1.2 获取源代码与所需库.................................................................................................. 4 1.2 文件组织…..................................................................................................................... 5 2 Sample Flex Viewe架构 ....................................................................................................... 5 2.1 架构介绍 .......................................................................................................................5 2.2 Sample Flex Viewer实例的生命周期............................................................................ 6 2.3 Sample Flex Viewer容器............................................................................................... 7 2.4 理解Widget编程模型..................................................................................................... 8 2.5 Widget命名习惯............................................................................................................. 9 3 为Widget开发建一个Flex Builder项目................................................................................ 9 3.1 用Sample Flex Viewer FlexBuilder项目开发一个微件.................................................. 10 3.2 在Sample Flex Viewer的FB项目之外开发一个widget.................................................. 12 3.3 为Flex Builder设置测试服务器...................................................................................... 14 4 开发一个widget ..................................................................................................................... 15 4.1 使用WidgetTemplate模板 ............................................................................................. 16 4.2 获取地图信息............................................................................................................... 17 4.3 在地图上显示widget数据 ............................................................................................. 19 4.4 从地图接收数据(通过单击,画线等操作实现)............................................................. 20 4.5 在widget中控制导航.................................................................................................... 21 4.6 不使用WidgetTemplate模板开发Widget ..................................................................... 22 4.7 开发一个自己的Widget模板 ........................................................................................ 23 4.8 修改或是创建一个主题 ................................................................................................ 24 4.9 Widget的配置............................................................................................................... 25 5 了解Sample Flex Viewer核心代码...................................................................................... 26 5.1 事件总线容器 .............................................................................................................. 26 5.2 依赖注入(DI,也叫控制反转)...................................................................................... 29 5.3 国际化 ......................................................................................................................... 30 第 3 页 5.3.1 使用Flex的国际化特性 .................................................................................................30 5.3.2 本地化设置 ................................................................................................................ 32 5.4 日志和错误处理 .......................................................................................................... 33 6 Sample Flex Viewer框架和Widget部署.............................................................................. 35 6.1 部署一个Sample Flex Viewer应用程序....................................................................... 35 6.2 部署一个widget到Sample Flex Viewer ........................................................................ 35 6.3 安全性考虑 ................................................................................................................. 36 6.3.1 crossdomain.xml ..................................................................................................... 36 6.3.2 网络资源代理........................................................................................................... 37 7 附录A: Configuration XML..................................................................................................37
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值