/**
* Add all your dependencies here.
*
* @require widgets/Viewer.js
* @require plugins/LayerTree.js
* @require plugins/OLSource.js
* @require plugins/OSMSource.js
* @require plugins/WMSCSource.js
* @require plugins/ZoomToExtent.js
* @require plugins/NavigationHistory.js
* @require plugins/Zoom.js
* @require plugins/AddLayers.js
* @require plugins/RemoveLayer.js
* @require RowExpander.js
* @require plugins/MyTree.js
*/
// create our own layer node UI class, using the TreeNodeUIEventMixin
var LayerNodeUI = Ext.extend(GeoExt.tree.LayerNodeUI, new GeoExt.tree.TreeNodeUIEventMixin());
var app = new gxp.Viewer({
portalConfig: {
layout: "border",
region: "center",
// by configuring items here, we don't need to configure portalItems
// and save a wrapping container
items: [{
id: "centerpanel",
xtype: "panel",
layout: "fit",
region: "center",
border: false,
items: ["mymap"]
}, {
id: "tree",
xtype: "treepanel",
border: true,
region: "west",
title: "Layers",
width: 200,
split: true,
collapsible: true,
collapseMode: "mini",
autoScroll: true,
loader: new Ext.tree.TreeLoader({
// applyLoader has to be set to false to not interfer with loaders
// of nodes further down the tree hierarchy
applyLoader: false,
/* uiProviders: {
"layernodeui": LayerNodeUI
} */
}),
root: {
nodeType: "async",
text: "RootNode",
id: "root1",
rootVisible: false,
},
children:[{
nodeType: "gx_baselayercontainer",
Text: "child1",
id:"CH1",
leaf: true
},{
nodeType: "gx_layer",
layer: "mapnik",
isLeaf: false,
loader: {
param: "LAYERS"
}
}]
}
],
bbar: {id: "mybbar"}
},
// configuration of all tool plugins for this application
tools: [ {
ptype: "gxp_zoomtoextent",
actionTarget: "map.tbar"
}, {
ptype: "gxp_zoom",
actionTarget: "map.tbar"
}, {
ptype: "gxp_navigationhistory",
actionTarget: "map.tbar"
}],
// layer sources
sources: {
local: {
ptype: "gxp_wmscsource",
url: "/geoserver/wms",
version: "1.1.1"
},
osm: {
ptype: "gxp_osmsource"
}
},
// map and layers
map: {
id: "mymap", // id needed to reference map in portalConfig above
title: "Map",
projection: "EPSG:900913",
center: [-10764594.758211, 4523072.3184791],
zoom: 3,
layers: [{
source: "osm",
name: "mapnik",
}, {
source: "local",
name: "usa:states",
selected: true
}],
items: [{
xtype: "gx_zoomslider",
vertical: true,
height: 100
}]
}
});