PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/apps/ESDIN Data Viewer/Config.js

http://geoext-viewer.googlecode.com/
JavaScript | 289 lines | 216 code | 14 blank | 59 comment | 12 complexity | bdd288a4902debf892a373a411ec14d0 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-3.0
  1. /*
  2. * Copyright (C) 2010 Het Kadaster
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. Ext.namespace("GeoViewer.Map");
  18. GeoViewer.lang = GeoViewer.Catalog.lang.en;
  19. GeoViewer.treeConfig = [
  20. {
  21. text:'Background topography', nodeType: "gx_baselayercontainer"
  22. }
  23. ,{
  24. nodeType: "gx_themenode", theme: 'GN', children:
  25. [
  26. {
  27. nodeType: "gx_featurelayercontainer", featureType: 'NamedPlace'
  28. }
  29. ]
  30. }
  31. ,{
  32. nodeType: "gx_themenode", theme: 'HY', children:
  33. [
  34. {nodeType: "gx_featurelayercontainer", featureType: 'StandingWater'}
  35. ,{nodeType: "gx_featurelayercontainer", featureType: 'Watercourse'}
  36. ,{nodeType: "gx_featurelayercontainer", featureType: 'LandWaterBoundary'}
  37. ,{nodeType: "gx_featurelayercontainer", featureType: 'Lock'}
  38. ,{nodeType: "gx_featurelayercontainer", featureType: 'DamOrWeir'}
  39. ]
  40. }
  41. ,{
  42. nodeType: "gx_themenode", theme: 'TN', children:
  43. [
  44. {nodeType: "gx_featurelayercontainer", featureType: 'RoadArea'}
  45. ,{nodeType: "gx_featurelayercontainer", featureType: 'RoadLink'}
  46. ,{nodeType: "gx_featurelayercontainer", featureType: 'RoadNode'}
  47. ]
  48. }
  49. ,{
  50. nodeType: "gx_themenode", theme: 'AU', children:
  51. [
  52. {nodeType: "gx_featurelayercontainer", featureType: 'AdministrativeBoundary'}
  53. ,{nodeType: "gx_featurelayercontainer", featureType: 'AdministrativeUnit'}
  54. ]
  55. }
  56. ,{
  57. nodeType: "gx_themenode", theme: 'CP', children:
  58. [
  59. {
  60. nodeType: "gx_featurelayercontainer", featureType: 'CadastralParcel'
  61. }
  62. ]
  63. }
  64. ,{
  65. nodeType: "gx_themenode", theme: 'ExM', children:
  66. [
  67. {text:'DamOrWeir', leaf: true}
  68. ,{text:'GlacierSnowfield', leaf: true}
  69. ,{text:'LandWaterBoundary', leaf: true}
  70. ]
  71. }
  72. ];
  73. GeoViewer.layout = {
  74. north: {
  75. options : {
  76. layout: 'border',
  77. width: '100%',
  78. height: 60,
  79. bodyBorder: false,
  80. border: false
  81. },
  82. panels: [
  83. {
  84. type: 'gv-html',
  85. options: {
  86. id: 'gv-logo-panel',
  87. region: 'center',
  88. bodyBorder: false,
  89. border: false,
  90. url: 'viewer-north.html',
  91. height: 55
  92. }
  93. }/*,
  94. {
  95. type: 'gv-user',
  96. options: {
  97. id: 'gv-menu-panel',
  98. region: 'south',
  99. bodyBorder: false,
  100. border: false,
  101. height: 25
  102. }
  103. } */
  104. ]
  105. },
  106. center : {
  107. options : {
  108. layout: 'border',
  109. width: '100%',
  110. collapsible: false,
  111. split : true,
  112. border: false
  113. },
  114. panels: [
  115. {
  116. type: 'gv-map',
  117. options: {
  118. region: 'center',
  119. collapsible : false,
  120. border: false
  121. }
  122. }
  123. /*
  124. ,{
  125. type: 'gv-feature-data'
  126. ,options: {
  127. id: 'gv-feature-data'
  128. ,region : "south"
  129. ,border : true
  130. ,collapsible : true
  131. ,collapsed : false
  132. ,height : 196
  133. ,split : true
  134. ,autoScroll: true
  135. ,deferredRender : false
  136. }
  137. }
  138. */
  139. ]
  140. },
  141. west : {
  142. options : {
  143. layout: 'accordion',
  144. width: 240,
  145. collapsible: true,
  146. split : true,
  147. border: false
  148. }
  149. ,panels: [
  150. {
  151. type: 'gv-layer-browser',
  152. options: {
  153. // Pass in our tree, if none specified the default config is used
  154. tree: GeoViewer.treeConfig
  155. }
  156. }
  157. ,
  158. {
  159. type: 'gv-html',
  160. options: {
  161. id: 'gv-info-west',
  162. autoLoad: 'information.html',
  163. preventBodyReset: true, // prevent ExtJS disabling browser styles
  164. title: 'Information'
  165. }
  166. }
  167. ,
  168. {
  169. type: 'gv-html',
  170. options: {
  171. id: 'gv-help-west',
  172. autoLoad: 'help.html',
  173. preventBodyReset: true, // prevent ExtJS disabling browser styles
  174. title: 'Help'
  175. }
  176. }
  177. ,{
  178. type: 'gv-search',
  179. options: {
  180. title: 'Search for location'
  181. // completeUrl: 'http://research.geodan.nl/esdin/autocomplete/complete.php'
  182. }
  183. }
  184. /*
  185. ,{
  186. type: 'gv-layer-legend'
  187. }
  188. */
  189. ]
  190. }
  191. };
  192. /** Use epsg: 4258 projection/resolutions options. */
  193. GeoViewer.Map.options = GeoViewer.Catalog.options4258;
  194. // load all layers from the catalog:
  195. GeoViewer.Map.layers = [];
  196. for (layer in GeoViewer.Catalog.layers)
  197. {
  198. GeoViewer.Map.layers.push(GeoViewer.Catalog.layers[layer]);
  199. }
  200. GeoViewer.Map.toolbar = [
  201. {
  202. type: "downloadfeatures",
  203. options: {
  204. tooltip: GeoViewer.lang.txtGetFeatures
  205. ,iconCls: "icon-download"
  206. ,enableToggle : false
  207. ,handler: function() {
  208. if (!GeoViewer.FeatureTypeLayers) // To do: Do not check if feature layers exist, but if they are visible
  209. {
  210. Ext.MessageBox.alert('Information', GeoViewer.lang.txtNoFeatureTypesChecked);
  211. return;
  212. }
  213. if (GeoViewer.FeatureTypeLayers.length == 0)
  214. {
  215. Ext.MessageBox.alert('Information', GeoViewer.lang.txtNoFeatureTypesChecked);
  216. return;
  217. }
  218. for (ftLayerName in GeoViewer.FeatureTypeLayers)
  219. {
  220. // remove features and turn source layers back on
  221. var theme = GeoViewer.FeatureTypeLayers[ftLayerName].themeId;
  222. var featureType = GeoViewer.FeatureTypeLayers[ftLayerName].featureType;
  223. if (GeoViewer.FeatureTypeLayers[ftLayerName].getVisibility())
  224. {
  225. GeoViewer.FeatureTypeLayers[ftLayerName].removeFeatures(); // which one?
  226. GeoViewer.FeatureTypeLayers[ftLayerName].destroyFeatures(); // which one?
  227. for (layer in GeoViewer.Map.layers)
  228. {
  229. if (GeoViewer.Map.layers[layer].options)
  230. {
  231. if (GeoViewer.Map.layers[layer].options.themeId)
  232. {
  233. if (GeoViewer.Map.layers[layer].options.themeId == theme)
  234. {
  235. GeoViewer.Map.layers[layer].setVisibility(true);
  236. GeoViewer.Map.layers[layer].events.on({"featuresadded": this.featuresAdded});
  237. GeoViewer.Map.layers[layer].options.strategies[0].activate;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. ,pressed : false
  246. ,id:"downloadfeatures"
  247. //,toggleGroup: "toolGroup"
  248. },
  249. create: function(mapPanel, options) {
  250. return new Ext.Action(options);
  251. }
  252. },
  253. {type: "-"} ,
  254. //{type: "featureinfo"},
  255. //{type: "-"} ,
  256. {type: "pan"},
  257. {type: "zoomin"},
  258. {type: "zoomout"},
  259. {type: "zoomvisible"},
  260. {type: "-"} ,
  261. {type: "zoomprevious"},
  262. {type: "zoomnext"},
  263. {type: "-"},
  264. {type: "measurelength"},
  265. {type: "measurearea"}
  266. ];
  267. /* Map Contexts. */
  268. GeoViewer.contexts = [];
  269. /**
  270. * Invokes GeoViewer as full screen app.
  271. */
  272. Ext.onReady(function() {
  273. GeoViewer.main.create();
  274. GeoViewer.main.showFullScreen();
  275. }, GeoViewer.main);