[OpenLayers-Dev] Re: How to override abstract
OpenLayers.Protocol.WFS.v1?
myOpenLayersUName
joanne.mcgraw at SYMPATICO.CA
Mon Jul 4 13:14:42 EDT 2011
Tim,
I've been able to reproduce my problem with code that is 99% not my own. I
used the example page for the WFS:Get Feature control
(http://openlayers.org/dev/examples/getfeature-wfs.html) as my starting
point.
My test page has none of my application's code in it except for the
extension to the OpenLayers.Protocol.WFS.v1 we've been talking about. That
script's contents are as follows and contained in the script src'd at
"/agmaf/js/AgMaf/OpenLayers/Protocol/WFS/v1.js" in the test page:
var orig = OpenLayers.Protocol.WFS.v1.prototype.handleRead;
OpenLayers.Util.extend(OpenLayers.Protocol.WFS.v1.prototype, {
handleRead: function(response, options) {
alert("handleRead");
orig.apply(this, arguments);
}
});
As for my test page, I tried to remove all superfluous code in the example
page and was left with this:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css"
href="/openlayers/theme/default/style.css" />
</head>
<body onload="init();">
<div id="map"></div>
</body>
</html>
I am still able to reproduce the handleRead function not being overridden
properly. That is, when I draw a box on the map's features and the WFS
GetFeatureInfo request is sent and processed, the alert box saying
"handleRead" does not appear. The original handleRead from the OpenLayers
script is being run instead.
Now, a couple of items may need to be mentioned/clarified here:
1. I am using OpenLayers 2.8. This work is part of an existing application
in production and there are no plans to upgrade at this time; therefore, I
must work in that version.
2. I'm testing this in IE 6 (although I don't think that really matters but
it explains why I'm able to circumvent the cross-domain service requests to
the WMS/WFS above...I just say yes to the message. When I tried it in FF
3.6, I changed the WMS/WFS to one on my local network for which I have a
reverse proxy already defined from my localhost. Didn't show the alert box
there either.
3. Finally, the "OpenLayers_original.js" src'd in my test page is the
originally-circulated OpenLayers.js script that came with 2.8. We use a cut
down version in our application that leaves out a lot of classes we don't
use. For this, though, I went back to the full script.
Is it possible there's something wrong with how this stuff was set up in
OpenLayers 2.8 that has since been corrected and that's why it's working for
you? Or, is there something about the way the GetFeature control with the
WFS Protocol is using these classes that isn't allowing it to "override"
properly?
Any ideas at all? Feel free to say no...after all, it's not your problem.
It's just that given that this isn't working in the test page, which is as
simple an example as I can make that replicates what I'm trying to do and is
almost entirely not my own code (and less likely to be wrong, I hope), I
really haven't a clue how to proceed. In theory, it should be working.
Cheers,
jtm
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-override-abstract-OpenLayers-Protocol-WFS-v1-tp6534072p6546844.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list