Advertisement
kushaldsouza

GeoExplorer CSW Config (via button)

Jan 14th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Add all your dependencies here.
  3.  *
  4.  * @require widgets/Viewer.js
  5.  * @require plugins/LayerTree.js
  6.  * @require plugins/OLSource.js
  7.  * @require plugins/OSMSource.js
  8.  * @require plugins/WMSCSource.js
  9.  * @require plugins/ZoomToExtent.js
  10.  * @require plugins/NavigationHistory.js
  11.  * @require plugins/Zoom.js
  12.  * @require plugins/AddLayers.js
  13.  * @require plugins/RemoveLayer.js
  14.  * @require RowExpander.js
  15.  * @require plugins/CatalogueSource.js
  16.  * @require plugins/GeoNodeCatalogueSource.js
  17.  * @require plugins/CSWCatalogueSource.js
  18.  * @require widgets/CatalogueSearchPanel.js
  19.  */
  20.  
  21. var app = new gxp.Viewer({
  22.  
  23.     portalConfig: {
  24.         layout: "border",
  25.         region: "center",
  26.  
  27.         // by configuring items here, we don't need to configure portalItems
  28.         // and save a wrapping container
  29.         items: [{
  30.             id: "centerpanel",
  31.             xtype: "panel",
  32.             layout: "fit",
  33.             region: "center",
  34.             border: false,
  35.             items: ["mymap"]
  36.         }, {
  37.             xtype: "container",
  38.             layout: "vbox",
  39.             region: "west",
  40.             width: 200,
  41.             defaults: {
  42.             width: "100%",
  43.             layout: "fit"
  44.             },
  45.             items: [{
  46.                 title: "Layers",
  47.                 id: "westpanel",
  48.                 border: false,
  49.                 flex: 1
  50.             }, {
  51.                 id: "legendpanel",
  52.                 height: 500
  53.             }]
  54.         }],
  55.         bbar: {id: "mybbar"}
  56.     },
  57.  
  58.     // configuration of all tool plugins for this application
  59.     tools: [{
  60.         ptype: "gxp_layertree",
  61.         outputConfig: {
  62.         id: "tree",
  63.         border: true,
  64.         tbar: [] // we will add buttons to "tree.bbar" later
  65.         },
  66.         outputTarget: "westpanel"
  67.     }, {
  68.         ptype: "gxp_removelayer",
  69.         actionTarget: ["tree.tbar", "tree.contextMenu"]
  70.     }],
  71.  
  72.     // layer sources
  73.     sources: {
  74.         local: {
  75.             ptype: "gxp_wmscsource",
  76.             url: "/geoserver/wms",
  77.             version: "1.1.1"
  78.         },
  79.         osm: {
  80.             ptype: "gxp_osmsource"
  81.         },
  82.         geonetwork: {
  83.             ptype: "gxp_cataloguesource",
  84.             url: "/geonetwork/srv/en/csw",
  85.             title: "Geonetwork"
  86.         },
  87.         ol: {
  88.             ptype: "gxp_olsource"
  89.         }
  90.     },
  91.  
  92.     // map and layers
  93.     map: {
  94.         id: "mymap", // id needed to reference map in portalConfig above
  95.         title: "Map",
  96.         //projection: "EPSG:900913",
  97.         //center: [-10764594.758211, 4523072.3184791],
  98.         projection: "EPSG:4326",
  99.         center: [-97, 38],
  100.         zoom: 3,
  101.         layers: [{
  102.         source: "ol",
  103.         type: "OpenLayers.Layer.WMS",
  104.         args: ["World map", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'}],
  105.         group: "background"
  106.         }],
  107.         tbar: [{
  108.             text: "Find Layers",
  109.             handler: createCatalogueSearchPanel
  110.         }]
  111.     }
  112. });
  113.  
  114. /*
  115. * Function that creates a CatalogueSearchPanel
  116. */
  117. function createCatalogueSearchPanel()
  118. {
  119.     var catalogueSearchPanel = new gxp.CatalogueSearchPanel({
  120.         map: app.map,
  121.         selectedSource: "geonetwork",
  122.         sources: {
  123.             geonetwork: {
  124.                 ptype: "gxp_cataloguesource",
  125.                 url: "/geonetwork/srv/en/csw",
  126.                 title: "Geonetwork"
  127.             }
  128.         }
  129.     });
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement