[Commits] r229 - sandbox/opengeo/drake/trunk/apps/geoexplorer
commits at geoext.org
commits at geoext.org
Wed Mar 18 18:47:08 CET 2009
Author: dwins
Date: 2009-03-18 18:47:08 +0100 (Wed, 18 Mar 2009)
New Revision: 229
Modified:
sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html
Log:
Update GeoExplorer to have just one GetFeatureInfo control and to have the popups it creates be anchored to the map.
Modified: sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html
===================================================================
--- sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html 2009-03-16 21:22:32 UTC (rev 228)
+++ sandbox/opengeo/drake/trunk/apps/geoexplorer/index.html 2009-03-18 17:47:08 UTC (rev 229)
@@ -22,7 +22,7 @@
GeoExplorer = {
load: function() {
this.map = new OpenLayers.Map();
- this.selectionLayer = new OpenLayers.Layer.Vector('Selection', { });
+ this.selectionLayer = new OpenLayers.Layer.Vector('Selection', { displayInLayerSwitcher: false});
this.map.addLayers([
new OpenLayers.Layer.WMS("TOPP States",
'/geoserver/wms' ,{
@@ -43,42 +43,29 @@
})
});
- var highlight = new OpenLayers.Control.WMSGetFeatureInfo('/geoserver/wms', {
- hover: true,
- title: 'Highlight features by hovering',
- layers: 'topp:states',
- infoFormat: 'application/vnd.ogc.gml',
- format: new OpenLayers.Format.WMSGetFeatureInfo({
- typeName: 'states',
- featureNS: 'http://www.openplans.org/topp'
- })
- });
-
identify.events.register('getfeatureinfo', this,
function(evt) {
var html = evt.features && evt.features.length
? 'Found ' + evt.features.length + ' features'
: evt.text;
- var win = new Ext.Window({
+ var lonLat = GeoExplorer.map.getLonLatFromPixel(evt.clickPosition);
+ var win = new GeoExt.popup.Popup({
html: html,
- title: "Feature Info"
+ title: "Feature Info",
+ width: 250,
+ feature: new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(lonLat.lon, lonLat.lat)
+ )
});
- GeoExplorer.mapPanel.add(win);
+ console.log(evt.clickPosition);
+ console.log(lonLat);
+ console.log(win);
+ win.addToMapPanel(GeoExplorer.mapPanel);
win.show();
}
);
- highlight.events.register('getfeatureinfo', this,
- function(evt){
- GeoExplorer.selectionLayer.destroyFeatures();
- if (evt.features){
- GeoExplorer.selectionLayer.addFeatures(evt.features);
- }
- }
- );
-
this.map.addControl(identify);
- this.map.addControl(highlight);
var idButton = new Ext.Button({
text: 'Identify',
@@ -93,23 +80,10 @@
}
});
- var selectButton = new Ext.Button({
- text: 'Select',
- enableToggle: true
- });
-
- selectButton.on('toggle', function(btn, pressed){
- if (pressed){
- highlight.activate();
- } else {
- highlight.deactivate();
- }
- });
-
this.mapPanel = new GeoExt.MapPanel({
map: this.map,
region: 'center',
- tbar: ['->', selectButton, idButton]
+ tbar: ['->', idButton]
});
this.layerTree = new Ext.tree.TreePanel({
@@ -130,7 +104,6 @@
Ext.onReady(function() {
GeoExplorer.load();
});
-
</script>
</head>
<body>
More information about the Commits
mailing list