Changeset 5364
- Timestamp:
- 12/08/07 13:53:40 (1 year ago)
- Files:
-
- sandbox/ominiverdi/ows/OWSManager/examples/wms_manager_stile.html (modified) (4 diffs)
- sandbox/ominiverdi/ows/OWSManager/lib/OpenLayers/Control/WMSQuery.js (modified) (4 diffs)
- sandbox/ominiverdi/ows/OWSManager/lib/OpenLayers/Control/WMSToolbar.js (modified) (2 diffs)
- sandbox/ominiverdi/ows/OWSManager/lib/OpenLayers/Control/WMSqueryTool.js (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/drag-rectangle-off.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/drag-rectangle-on.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/identify-off.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/identify-on.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/identify_off.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/identify_on.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/pan_off.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/pan_on.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/panning-hand-off.png (added)
- sandbox/ominiverdi/ows/OWSManager/theme/OWSManager/img/panning-hand-on.png (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/ominiverdi/ows/OWSManager/examples/wms_manager_stile.html
r5356 r5364 54 54 55 55 <script src="../lib/OpenLayers/Control/SLDManager.js"></script> 56 <script src="../lib/OpenLayers/Control/WMSQueryTool.js"></script> 56 57 <script src="../lib/OpenLayers/Format/SLD.js"></script> 57 58 <script src="../lib/OpenLayers/Format/WMC.js" type="text/javascript"></script> … … 97 98 //['SP - Asturias','http://www.cartografia.asturias.es/wmsortofotos/request.asp?'], 98 99 ['SP - Comunidad Valenciana - Conselleria de Territori i Habitatge, GVA - Servici WMS: wms_senderos','http://orto.cth.gva.es/wmsconnector/com.esri.wms.Esrimap/wms_senderos?'] 99 //['SP - Euskadi (Pais Vasco)',' http://www1.euskadi.net/servlet/com.esri.wms.Esrimap?ServiceName=GVasco']100 //['SP - Euskadi (Pais Vasco)','OpenLayers.Control.WMSQueryToohttp://www1.euskadi.net/servlet/com.esri.wms.Esrimap?ServiceName=GVasco'] 100 101 //['SP - La Rioja','http://wms.larioja.org/request.asp'] 101 102 … … 113 114 //map.addControl(new OpenLayers.Control.Permalink()); 114 115 //map.addControl(new OpenLayers.Control.Permalink('permalink')); 115 map.addControl(new OpenLayers.Control.MousePosition()); 116 117 //map.addControl(new OpenLayers.Control.MousePosition()); 116 118 map.addControl(new OpenLayers.Control.OverviewMap()); 117 119 map.addControl(new OpenLayers.Control.KeyboardDefaults()); … … 124 126 125 127 //map.addControl(new OpenLayers.Control.NavToolbar()); 126 //var queryTarget = $('queryOut');127 //WMSToolbar = new OpenLayers.Control.WMSToolbar({queryTarget: queryTarget});128 //map.addControl(WMSToolbar);129 map.addControl(new OpenLayers.Control.NavToolbar());128 var queryTarget = $('output'); 129 WMSToolbar = new OpenLayers.Control.WMSToolbar({queryTarget: queryTarget}); 130 map.addControl(WMSToolbar); 131 //map.addControl(new OpenLayers.Control.NavToolbar()); 130 132 //alert(WMSToolbar.div.id); 131 133 //WMSToolbar.style.display = "none"; sandbox/ominiverdi/ows/OWSManager/lib/OpenLayers/Control/WMSQuery.js
r5096 r5364 1 /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.1 /* Copyright (c) 2006-2007 MetaCarta, Inc., published under a modified BSD license. 2 2 * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt 3 3 * for the full text of the license. */ 4 4 5 5 /** 6 * @class7 *8 6 * @requires OpenLayers/Control.js 9 7 * @requires OpenLayers/Handler/Box.js 8 * 9 * Class: OpenLayers.Control.WMSQuery 10 * 11 * Inherits from: 12 * - <OpenLayers.Control> 10 13 */ 11 OpenLayers.Control.WMSQuery = OpenLayers.Class.create(); 12 OpenLayers.Control.WMSQuery.prototype = 13 OpenLayers.Class.inherit( OpenLayers.Control, { 14 /** @type OpenLayers.Control.TYPE_* */ 14 OpenLayers.Control.WMSQuery = OpenLayers.Class(OpenLayers.Control, { 15 /** 16 * Property: type 17 * {OpenLayers.Control.TYPE} 18 */ 15 19 type: OpenLayers.Control.TYPE_TOOL, 16 20 21 /** 22 * Property: message 23 * {String} the output message for query 24 */ 25 message: '', 26 /** 27 * Property: requested 28 * 29 * {Int} number of appended messages 30 */ 31 requested : 0, 32 /** 33 * Property: numLayers 34 * 35 * {Int} number of layers queryed 36 */ 37 numLayers:0, 17 38 /** 18 * 39 * Method: draw 19 40 */ 20 41 draw: function() { 21 42 this.handler = new OpenLayers.Handler.Box( this, 22 43 {done: this.WMSQuery}, {keyMask: this.keyMask} ); 23 //alert(this.queryTarget);24 44 }, 25 45 46 /** 47 * Method: WMSQuery 48 * 49 * Parameters: 50 * position - {<OpenLayers.Bounds>} or {<OpenLayers.Pixel>} 51 */ 26 52 WMSQuery: function (position) { 27 28 53 if (position instanceof OpenLayers.Bounds) { 29 alert('query rect');54 alert('query rect'); 30 55 var minXY = this.map.getLonLatFromPixel( 31 56 new OpenLayers.Pixel(position.left, position.bottom)); … … 36 61 this.map.zoomToExtent(bounds); 37 62 } else { // it's a pixel 38 //alert('query point'); 39 // this.map.setCenter(this.map.getLonLatFromPixel(position), this.map.getZoom() + 1); 40 //alert(this.map.controls); 41 /*var WMSManager = null; 42 for(var i=0; i< this.map.controls.length; i++) { 63 64 //Check if OWSManager is an active Control 65 var OWSManager=null; 66 for(var i=0; i< this.map.controls.length; i++) { 43 67 var control = this.map.controls[i]; 44 if(control.CLASS_NAME =='OpenLayers.Control. WMSManager'){45 WMSManager = control;68 if(control.CLASS_NAME =='OpenLayers.Control.OWSManager'){ 69 OWSManager = control; 46 70 } 47 71 } 48 if(!WMSManager) return alert('no WMSManager available'); 49 */ 50 var LatLon = this.map.getLonLatFromPixel(position); 51 this.queryTarget.innerHTML = ''; 52 var targetObj = document.createElement('div'); 53 var requested = 0; 72 if(!OWSManager) return alert('no OWSManager available'); 73 74 //Get pixel coords 75 var LatLon = this.map.getLonLatFromPixel(position); 76 this.setOutput('querying remote server'); 77 // var targetObj = document.createElement('div'); 78 this.requested = 0; 79 this.numLayers = 0; 54 80 for(var i=0; i< this.map.layers.length; i++){ 55 81 var layer = this.map.layers[i]; 56 if(layer.visibility){ 57 for(var j=0; j< layer.aWMSLayers.length; j++) { 58 var WMSlayer = layer.aWMSLayers[j]; 59 var layerObj = document.createElement('div'); 60 layerObj.id= WMSlayer[0]; 61 targetObj.appendChild(layerObj); 82 //this.setOutput(layer.OWSQuery); 83 // console.log(layer); 84 if(layer.visibility && layer.OWSqueryable){ 85 var queryables = layer.OWSqueryable.split('||||'); 86 for(var j=0; j< queryables.length; j++) { 87 var WMSlayer = layer.OWSName.split('||||')[j]; 88 62 89 //layer.WMSinfo 63 90 //THIS SHOULD BE WMSlayer[5] == 1 64 if( WMSlayer[5]==1){91 if(queryables[j]==1){ 65 92 //alert(WMSlayer[0]+ ' '+ WMSlayer[5]); 66 93 //var url = + ; 94 layer.myTarget = this; 67 95 var url = layer.getFullRequestString({ 68 96 REQUEST: "GetFeatureInfo", … … 71 99 X: position.x, 72 100 Y: position.y, 73 INFO_FORMAT: 'text/ html',74 QUERY_LAYERS: WMSlayer [0],101 INFO_FORMAT: 'text/plain', 102 QUERY_LAYERS: WMSlayer, 75 103 WIDTH: layer.map.size.w, 76 104 HEIGHT: layer.map.size.h}); 77 105 //OpenLayers.loadURL(url, '', this, this.printQuery); 78 OpenLayers.loadURL(url, '', layerObj, this.printQuery); 79 requested++; 106 OpenLayers.loadURL(url, '', this, this.printQuery); 80 107 108 this.numLayers++; 81 109 } 82 110 } 83 111 } 84 112 } 85 if(requested)this.queryTarget.appendChild(targetObj); 86 else this.queryTarget.innerHTML = 'no queryable layers available'; 113 if(!this.numLayers) alert('no queryable layers found'); 114 //if(requested)this.queryTarget.appendChild(targetObj); 115 //else this.queryTarget.innerHTML = 'no queryable layers available'; 116 87 117 } 88 118 }, 89 90 119 /** 91 120 * @private … … 94 123 */ 95 124 printQuery: function(ajaxRequest){ 96 if(this.id){125 97 126 var text = ajaxRequest.responseText; 98 this.innerHTML = text; 99 } else alert(text); 127 this.requested++; 128 // this.setOutput(text); 129 this.setOutput(text); 130 131 }, 132 /** 133 * @private 134 * 135 * @param {String} string to print on target 136 */ 137 setOutput: function(text){ 138 console.log(this.requested + ': '+text+''); 139 if(this.requested==1) 140 this.queryTarget.value = text; 141 else 142 this.queryTarget.value += text; 100 143 }, 101 144 102 /**103 * @param {Event} evt104 */105 doubleClick: function (evt) {106 return alert('double click');107 108 var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );109 // this.map.setCenter(newCenter, this.map.zoom + 1);110 111 OpenLayers.Event.stop(evt);112 return false;113 },114 115 /** @final @type String */116 145 CLASS_NAME: "OpenLayers.Control.WMSQuery" 117 146 }); sandbox/ominiverdi/ows/OWSManager/lib/OpenLayers/Control/WMSToolbar.js
r5096 r5364 1 /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.1 /* Copyright (c) 2006-2007 MetaCarta, Inc., published under a modified BSD license. 2 2 * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt 3 3 * for the full text of the license. */ 4 4 5 5 /** 6 * @class7 *8 6 * @requires OpenLayers/Control/Panel.js 9 7 * @requires OpenLayers/Control/Navigation.js 10 8 * @requires OpenLayers/Control/ZoomBox.js 9 * 10 * Class: OpenLayers.Control.WMSToolbar 11 11 */ 12 OpenLayers.Control.WMSToolbar = OpenLayers.Class.create(); 13 OpenLayers.Control.WMSToolbar.prototype = 14 OpenLayers.Class.inherit( OpenLayers.Control.Panel, { 12 OpenLayers.Control.WMSToolbar = OpenLayers.Class(OpenLayers.Control.Panel, { 15 13 16 14 /** 15 * Constructor: OpenLayers.Control.WMSToolbar 17 16 * Add our two mousedefaults controls. 17 * 18 * Parameters: 19 * options - {Object} An optional object whose properties will be used 20 * to extend the control. 18 21 */ 19 22 initialize: function(options) { 20 OpenLayers.Control.Panel.prototype.initialize.apply(this, arguments);23 OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); 21 24 this.addControls([ 22 25 new OpenLayers.Control.Navigation(), 23 new OpenLayers.Control.ZoomBox() 24 ,new OpenLayers.Control.WMSQuery({queryTarget: this.queryTarget})26 new OpenLayers.Control.ZoomBox(), 27 new OpenLayers.Control.WMSQuery({queryTarget: this.queryTarget}) 25 28 ]); 26 27 29 }, 28 30 29 31 /** 32 * Method: draw 30 33 * calls the default draw, and then activates mouse defaults. 31 34 */ … … 37 40 38 41 CLASS_NAME: "OpenLayers.Control.WMSToolbar" 39 }); 42 });
