Christopher, I hold OpenLayers in the highest regard because it never fails to amaze me with its power and flexibility. And that regard extends right to you and the other devs.
Your feedback below cause me to toss a bunch of hopeless code and replace it a few lines that are clear and concise. Thank you! And handling the args in init() makes perfect sense and simplified the problem significantly. Here is a page using the permalink code extended to support my version of pgRouting: http://imaptools.com/leaddog/routing/dd.html?lat=33.8916&lon=35.5027&zoom=11&layers=B0TTTFT&start=35.490318%2033.868424&stop=35.501906%2033.883822&method=STS&lang=eng Man, I think I owe you a LOT of beers at this point :) Many thanks, -Steve Christopher Schmidt wrote: > On Fri, Nov 21, 2008 at 11:36:59AM -0500, Stephen Woodbridge wrote: >> I have an idea that might be a useful extension to the Permalink control >> that would allow it to support arbitrary additional parameters. It would >> involve adding a callback to the control creation and adding an >> additional method(s) for setting the additional argument values. >> >> Usage would be something like this: >> >> var plink = new OpenLayers.Control.Permalink( >> "permalink", base, {}, mycallback); >> >> map.addControl(plink); > > The third argument of controls is an options hash. All options hashes in > OpenLayers extend the default/base object properties and methods -- any > 'key' in the option hash will override the corresponding key on the > class you're using. > > With the existing code, this means that you can do the following: > > * Create a new myCreateArgs function: > > function myCreateArgs() { > var args = > OpenLayers.Control.Permalink.prototype.createParams.apply( > this, arguments > ); > args['myOption'] = myOptionSetting; > } > > * Pass this in to the argumets hash, overriding the createParams > function: > > var plink = new OpenLayers.Control.Permalink(null, null, > {'createParams': myCreateArgs}) > > * When something changes, call plink.updateLink(); > > >> And then, when the page is reinstantiated, the argParser would call: >> >> if (this.callback) { >> this.callback(args); >> } > > You can already create a customized ArgParser class and pass it to your > Permalink, but I'm not even sure that you should be parsing these things > in the argParser -- just parse them in your init() code instead, no need > to do any modifications or subclassing. > > Regards, _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
