volpino/openlayers-timeline — Issue #1: Impossible to close popups after features are destroyed
Author: ZiglioNZ
Created: 2011-12-01 04:12:34+00:00
State: open

Ciao Fox!

I've discovered a little problem, when the timebar changes and a popup is still open, the feature associated with that popup is destroyed, therefore making it impossible to close the popup.
I've made a number of changes in my repository but perhaps you could use my little routine that cycles through popups on the map:

var i;
for( i in self.map.popups ){
var popup = self.map.popups[i];
self.map.removePopup(popup);
popup.selectedFeature.popup.destroy();
popup = null;
}

I've also provided a kml format. The only problem I need to pass some options to inizialize it (to use Google Maps), so I initialize it before creating timeline, but that can be easily changed:

var in_options = {
'internalProjection': map.baseLayer.projection,
'externalProjection': new OpenLayers.Projection("EPSG:4326")
};

var kmlOptionsIn = OpenLayers.Util.extend({
extractAttributes: true,
extractStyles: true,
extractTracks: true,
trackAttributes: true,
maxDepth: 2
}, in_options);

kmlformat = new OpenLayers.Format.KML(kmlOptionsIn);

timeline = new OpenLayers.Timeline({map: map,
timeline: "#timeline",
date_key: "when",
format: kmlformat,
date_funct: function(date){
return date.getTime()/1000;
},
onFeatureInsert: updateLatestFix
});

Grazie mille!