1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
| <script type="text/javascript">
// reference local blank image
Ext.BLANK_IMAGE_URL = '../../mfbase/ext/resources/images/default/s.gif';
Ext.onReady(function() {
var map = new OpenLayers.Map('mymap',{
projection: "EPSG:4326",
maxExtent: new OpenLayers.Bounds(17,36,32,42),
controls: [
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.Permalink('permalink'),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.KeyboardDefaults()
]
});
var wms = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'}, {buffer: 0});
map.addLayer(wms);
//Add WMS
var ktbase = new OpenLayers.Layer.WMS("Ktimatologio",
"http://gis.ktimanet.gr/wms/wmsopen/wmsserver.aspx", {isBaseLayer: false, layers: 'KTBASEMAP'}, {buffer: 0});
map.addLayer(ktbase);
// Add geodata
mydata = new OpenLayers.Layer.GML("my geodata", "mydata.kml", {
format: OpenLayers.Format.KML,
formatOption: {
extractStyles: true,
extractAttributes: true
},
})
map.addLayer(mydata);
var store = new Ext.data.SimpleStore({
fields: ['value', 'text', 'bbox'],
data : [['OC', 'Athens', new OpenLayers.Bounds(23.43, 37.77, 24.06, 38.14)],
['NA', 'Thessaloniki', new OpenLayers.Bounds(22.68, 40.48, 23.13, 40.73)],
['SA', 'Crete', new OpenLayers.Bounds(23.30,34.76, 26.45, 35.97)],
['AF', 'Patras', new OpenLayers.Bounds(21.68, 38.19, 21.81, 38.27)],
['EU', 'Larissa', new OpenLayers.Bounds(22.36, 39.59, 22.48, 39.65)],
['AS', 'Volos', new OpenLayers.Bounds(22.90, 39.34, 22.97, 39.38)]]
});
var shortcuts = new mapfish.widgets.Shortcuts({
map: map,
store: store,
templates: {
header: new Ext.Template("Choose a continent in the list"),
footer: new Ext.Template("The map will automatically center to this location")
}
});
map.addControl(new OpenLayers.Control.LayerSwitcher());
var viewport = new Ext.Viewport({
layout:'border',
items:[
new Ext.BoxComponent({ // raw
region: 'north',
el: 'north',
height: 60,
margins: {left: 5,top: 5}
}),{
region: 'south',
contentEl: 'south',
split: true,
height: 100,
minSize: 100,
maxSize: 200,
collapsible: true,
title: 'South',
margins: '0 0 0 0'
},{
region: 'west',
id: 'west-panel',
title: 'West',
split: true,
width: 200,
minSize: 175,
maxSize: 400,
collapsible: true,
margins: '0 0 0 5',
layout: 'accordion',
layoutConfig:{
animate: true
},
items: [{
contentEl: 'west',
title: 'Layer Tree',
border: false,
xtype: 'layertree',
enableDD: true,
map: map
},{
title: 'Settings',
html: '<p>Some settings in here.</p>',
border: false
},{
title:'Shortcuts',
html:'<p>Choose a city in the list.The map will automatically center to this location.</p>',
items: shortcuts,
border:false,
},{
id: 'recenter-widget',
title: 'Recenter',
xtype: 'coordsrecenter',
map: map,
labelAlign: 'top',
hideMode: 'offsets',
showCenter: true, // boolean, indicates if a symbol must be shown at the new center
scales: [1000000, 2500000, 5000000, 10000000, 25000000],
bodyStyle: 'padding: 5px',
defaults: {
width: 170
}
}]
},{
region: 'center',
title: 'Map',
layout: 'fit',
xtype: 'gx_mappanel',
map: map
}
]
});
var tree = new mapfish.widgets.LayerTree({map: map,
el: 'tree',
enableDD: true
});
tree.render();
});
</script> |
Partager