`

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/

 

  • 大小: 15.7 KB
  • 大小: 29.7 KB
  • 大小: 14.8 KB
  • 大小: 88.7 KB
  • 大小: 58.3 KB
  • 大小: 87.4 KB
  • 大小: 19.1 KB
  • 大小: 29.8 KB
  • 大小: 112.1 KB
  • 大小: 286.1 KB
  • 大小: 67.2 KB
  • 大小: 67.2 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics