[OpenLayers-Dev] Format.KML and maxDepth: NetworkLinks not
working?
Eric Lemoine
eric.c2c at gmail.com
Tue Dec 9 16:16:18 EST 2008
On Tue, Dec 9, 2008 at 11:14 AM, <bartvde at osgis.nl> wrote:
> Hi list,
>
> reading the Format.KML code it seems NetWorkLinks are not working right
> now. Can anybody confirm this before I open up a ticket?
>
> Since parseData puts in this.maxDepth as options.depth:
>
> // Set default options
> var options = {
> depth: this.maxDepth,
> styleBaseUrl: this.styleBaseUrl
> };
>
> return this.parseData(data, options);
>
> the check in parseLinks will always return false:
>
> parseLinks: function(nodes, options) {
> // Fetch external links <NetworkLink> and <Link>
> // Don't do anything if we have reached our maximum depth for
> recursion
> if (options.depth >= this.maxDepth) {
> return false;
> }
>
> so no NetWorkLinks will be fetched regardless of the maxDepth value passed
> in to the Format.KML constructor.
>
> I think the code should read:
>
> // Set default options
> var options = {
> depth: 0,
> styleBaseUrl: this.styleBaseUrl
> };
>
> but I might be mistaken ....
I agree. options.depth should be initialized to 0, or parseLinks should do:
if (options.depth <= 0) {
return false;
}
var newOptions = OpenLayers.Util.extend({}, options);
newOptions.depth--;
Cheers,
--
Eric
More information about the Dev
mailing list