| 30 | | this.markers = this.getMarkersLayer(); |
| 31 | | this.api.map.addLayer(this.markers); |
| | 35 | if (!config.disableSearch) { |
| | 36 | this.markers = this.getMarkersLayer(); |
| | 37 | this.api.map.addLayer(this.markers); |
| | 38 | |
| | 39 | this.select = new OpenLayers.Control.SelectFeature( |
| | 40 | this.markers, {hover: true, multiple: false} |
| | 41 | ); |
| | 42 | this.api.map.addControl(this.select); |
| | 43 | this.select.activate(); |
| | 44 | |
| | 45 | this.recenterProtocol = new mapfish.Protocol.MapFish({ |
| | 46 | url: this.api.baseConfig.recenterUrl, |
| | 47 | callback: this.recenterProtocolCallback, |
| | 48 | scope: this |
| | 49 | }); |
| | 50 | } |
| | 51 | |
| | 52 | if (!config.disableQuery) { |
| | 53 | this.queryProtocol = new mapfish.Protocol.MapFish({ |
| | 54 | url: this.api.baseConfig.queryUrl, |
| | 55 | format: new OpenLayers.Format.JSON() |
| | 56 | }); |
| | 57 | |
| | 58 | this.eventProtocol = new mapfish.Protocol.TriggerEventDecorator({ |
| | 59 | protocol: this.queryProtocol |
| | 60 | }); |
| | 61 | |
| | 62 | this.filterProtocol = new mapfish.Protocol.MergeFilterDecorator({ |
| | 63 | protocol: this.eventProtocol |
| | 64 | }); |
| | 65 | this.filterProtocol.register({ |
| | 66 | getFilter: function() { |
| | 67 | var layers = []; |
| | 68 | var olLayers = this.api.map.getLayersByName({test: function(str) {return true;}}); |
| | 69 | for (l in olLayers) { |
| | 70 | if (olLayers[l].params && |
| | 71 | olLayers[l].params.LAYERS && |
| | 72 | olLayers[l].params.LAYERS.length > 0) { |
| | 73 | layers = layers.concat(olLayers[l].params.LAYERS); |
| | 74 | } |
| | 75 | } |
| | 76 | return {layers: layers}; |
| | 77 | }.createDelegate(this) |
| | 78 | }); |
| | 79 | |
| | 80 | this.searcher = new mapfish.Searcher.Map({ |
| | 81 | mode: mapfish.Searcher.Map.CLICK, |
| | 82 | searchTolerance: 10, |
| | 83 | protocol: this.filterProtocol |
| | 84 | }); |
| | 85 | |
| | 86 | this.eventProtocol.events.on({ |
| | 87 | crudfinished: this.queryProtocolCallback, |
| | 88 | scope: this |
| | 89 | }); |
| 33 | | this.select = new OpenLayers.Control.SelectFeature( |
| 34 | | this.markers, {hover: true} |
| 35 | | ); |
| 36 | | this.api.map.addControl(this.select); |
| 37 | | this.select.activate(); |
| 38 | | |
| 39 | | this.recenterProtocol = new mapfish.Protocol.MapFish({ |
| 40 | | url: this.api.baseConfig.recenterUrl, |
| 41 | | callback: this.recenterProtocolCallback, |
| 42 | | scope: this |
| 43 | | }); |
| | 91 | this.api.map.addControl(this.searcher); |
| | 92 | this.searcher.activate(); |
| | 93 | } |