Flex Viewer 開發教程(1)Flex Viewer配置檔案
Flex Viewer的設計原則是SIMPLICITY(簡單)。因為簡單原則,Flex Viewer易於部署、配置和擴充套件。為了達到“簡單”這個目的,Flex Viewer在設計和實現上未引入第三方框架。但是從其框架結構上,我們能捕捉到一些Flex框架中最佳實踐的影子,比如事件機制就與PureMVC中的Notification機制類似。
其實,Flex Viewer本身就可以被認為是一個框架。在這個框架基礎上,可以通過擴充套件快速實現業務系統原型。本文件將詳細介紹如何在“簡單”原則下實現自定義Widget,以及Widget如何與其它模組互動。
說明
本文件使用的程式碼位於widgets.FlexViewerInAction目錄下。
Flex Viewer通過配置檔案配置系統資料和功能,配置檔案內容如下:
<?xml version="1.0" ?> <configuration> <title>ArcGIS Viewer for Flex</title>① <subtitle>a configurable web mapping application</subtitle>② <logo>assets/images/logo.png</logo>③ <style>④ <colors>0xFFFFFF,0x333333,0x101010,0x000000,0xFFD700</colors> <alpha>0.8</alpha> </style> <bing key="Al0VE_jsmagxk4LFghXGlK5JSHfC0tk-eHRubZv_eMYm6wzgQaStYks8g-wWcgk3"/> <!-- UI elements --> <widget left="10" top="50" config="widgets/Navigation/NavigationWidget.xml" url="widgets/Navigation/NavigationWidget.swf"/>⑤ <widget right="-2" bottom="-2" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/>⑥ <widget right="20" top="55" config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>⑦ <widget left="0" top="0" config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/>⑧
<map initialextent="-14083000 3139000 -10879000 5458000" top="40" wraparound180="true">⑨ <basemaps> <layer label="Streets" type="tiled" visible="true" alpha="1" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <layer label="Aerial" type="tiled" visible="false" alpha="1" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/> <layer label="Topo" type="tiled" visible="false" alpha="1" url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> </basemaps> <operationallayers> <layer label="Boundaries and Places" type="tiled" visible="false" url="http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places_Alternate/MapServer"/> <layer label="Fires" type="feature" visible="false" alpha="1" info="widgets/InfoTemplates/SimpleInfoWinWidget.swf" infoconfig="widgets/InfoTemplates/IWT_Fires.xml" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/0"/> </operationallayers> </map> <!-- widgets organized into widget containers that manage close/open etc --> <!-- supported layout property options: horizontal(default)|float|vertical|fix--> <widgetcontainer layout="horizontal">⑩ <widget label="Bookmarks" left="430" top="90" icon="assets/images/i_bookmark.png" config="widgets/Bookmark/BookmarkWidget.xml" url="widgets/Bookmark/BookmarkWidget.swf"/> <widget label="Find an address" left="100" top="90" preload="open" icon="assets/images/i_target.png" config="widgets/Locate/LocateWidget_Bing.xml" url="widgets/Locate/LocateWidget.swf"/> <widget label="Louisville Police" left="590" top="280" icon="assets/images/i_police.png" config="widgets/Query/QueryWidget_Louisville_PoliceStations.xml" url="widgets/Query/QueryWidget.swf"/> <widget label="Search" left="80" top="280" icon="assets/images/i_search.png" config="widgets/Search/SearchWidget_Louisville.xml" url="widgets/Search/SearchWidget.swf"/> <widget label="Earthquakes (GeoRSS)" left="410" top="280" icon="assets/images/i_rss.png" config="widgets/GeoRSS/GeoRSSWidget.xml" url="widgets/GeoRSS/GeoRSSWidget.swf"/> <widget label="Draw and Measure" left="60" top="400" icon="assets/images/i_draw2.png" config="widgets/Draw/DrawWidget.xml" url="widgets/Draw/DrawWidget.swf"/> <widget label="Print" left="390" top="400" icon="assets/images/i_print.png" config="widgets/Print/PrintWidget.xml" url="widgets/Print/PrintWidget.swf"/> </widgetcontainer> </configuration> |
① title:Flex Viewer自帶Banner實現的標題;
② subtitle:Flex Viewer自帶Banner實現的副標題;
③ logo:Flex Viewer自帶Banner實現的Logo圖示;
④ style:用來設定全域性的元件樣式,具體詳見UIManager程式碼;
⑤⑥⑦⑧ UI Elements:指Control Widget,比如HeaderControllerWidget、NavigationWidget等這些提供系統級別功能的Widget;
⑨ map:Flex Viewer用來設定地圖屬性,包括底圖、業務圖層;
⑩ widgetcontainer:Business Widget的容器,用來管理Business Widget。Business Widget指提供業務功能的Widget。
上述配置檔案並未使用到所有可用的屬性,比如在style中設定font屬性,map中設定fullextent等,此處不一一列舉,詳見ConfigManager程式碼。
需要說明的是,基於Flex Viewer開發業務系統,一般通過實現自定義的Business Widget來實現具體的業務功能,通過修改或者自定義Control Widget實現符合需求的系統級別功能元件。所以,配置檔案中的前三項並不是必須的,通常我們的業務系統需要更具特色的Banner實現。Flex Viewer各部分與配置檔案的對應關係見下圖:
相關文章
- MHT Viewer for Macmhtml檔案檢視器ViewMacACMHTML
- viewerView
- flex:0 flex:1 flex:none flex:auto應該在什麼場景下使用?FlexNone
- VSD Viewer for Mac(Visio繪圖檔案閱讀器)ViewMac繪圖
- Visio繪圖檔案閱讀器:VSD Viewer for Mac繪圖ViewMac
- Visio檔案編輯檢視工具:Visio Viewer for MacViewMac
- vnc viewer 64位下載,在windows安裝vnc viewer客戶端使用教程VNCViewWindows客戶端
- Viewer.ccView
- vnc viewer西西軟體,vnc viewer西西軟體推薦,vnc客戶端使用教程VNCView客戶端
- msg檔案檢視工具:Msg Viewer Pro for Mac 直裝版ViewMac
- VSD Viewer for Mac(Visio繪圖檔案閱讀器) v6.16.1ViewMac繪圖
- Visio Viewer for Mac:完美的Visio檔案編輯和檢視工具ViewMac
- Flex & Bison 開始Flex
- BrainNet Viewer 使用記錄AIView
- ZPL Viewer工具網站View網站
- PDF.js Electron ViewerJSView
- 深入理解 flex-grow、flex-shrink、flex-basisFlex
- flexFlex
- flex:1學習筆記Flex筆記
- VSD Viewer for Mac(Visio繪圖檔案閱讀器)6.16.1啟用版ViewMac繪圖
- CHM Viewer Star for mac(CHM檔案閱讀器) 6.3.2免啟用版ViewMac
- display:flex與inline-flex 區別Flexinline
- CHM檔案閱讀必備 CHM Viewer Star 免啟用最新版View
- CHM檔案閱讀必備:CHM Viewer Star 免啟用最新版View
- VNC, VNC viewer使用方法!VNCView
- Android Tools 之一 Hierarchy ViewerAndroidView
- Cesium筆記----關於viewer的配置及常用東西筆記View
- vnc viewer 遠端桌面,vnc viewer 遠端桌面連線的11個步驟VNCView
- CSS flexCSSFlex
- flex相容Flex
- flex bisonFlex
- 重新總結flex佈局(flex,flex-direction,justify-content,align-items,flex-wrap,align-self)Flex
- 重新認識flex縮寫屬性—[flex]Flex
- Visio繪圖檔案閱讀器推薦:VSD Viewer 啟用最新版繪圖View
- vnc viewer中文版,8步驟在Linux中安裝vnc viewer中文版VNCViewLinux
- SnapGene Viewer for mac分子生物學ViewMac
- flex入門—瞭解這些flex屬性Flex
- VNC viewer 西西軟體,除了VNC viewer 西西軟體,其他好用的VNC軟體下載!VNCView
- vnc viewer免費版,4款你不知道的vnc viewer免費版軟體VNCView