keep an array of the features we have created. this will allow us to later destroy() them when the time comes.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@542 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -11,6 +11,9 @@ OpenLayers.Layer.Text.prototype =
|
|||||||
* @type str */
|
* @type str */
|
||||||
location:null,
|
location:null,
|
||||||
|
|
||||||
|
/** @type Array(OpenLayers.Feature) */
|
||||||
|
features: null,
|
||||||
|
|
||||||
/** @type OpenLayers.Feature */
|
/** @type OpenLayers.Feature */
|
||||||
selectedFeature: null,
|
selectedFeature: null,
|
||||||
|
|
||||||
@@ -23,10 +26,12 @@ OpenLayers.Layer.Text.prototype =
|
|||||||
initialize: function(name, location) {
|
initialize: function(name, location) {
|
||||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name]);
|
OpenLayers.Layer.Markers.prototype.initialize.apply(this, [name]);
|
||||||
this.location = location;
|
this.location = location;
|
||||||
|
this.features = new Array();
|
||||||
new Ajax.Request(location,
|
new Ajax.Request(location,
|
||||||
{ method: 'get', onComplete:this.parseData.bind(this) } );
|
{ method: 'get', onComplete:this.parseData.bind(this) } );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?} ajaxRequest
|
* @param {?} ajaxRequest
|
||||||
*/
|
*/
|
||||||
@@ -103,6 +108,7 @@ OpenLayers.Layer.Text.prototype =
|
|||||||
data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>';
|
data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>';
|
||||||
}
|
}
|
||||||
var feature = new OpenLayers.Feature(this, location, data);
|
var feature = new OpenLayers.Feature(this, location, data);
|
||||||
|
this.features.append(feature);
|
||||||
var marker = feature.createMarker();
|
var marker = feature.createMarker();
|
||||||
marker.events.register('click', feature, this.markerClick);
|
marker.events.register('click', feature, this.markerClick);
|
||||||
this.addMarker(marker);
|
this.addMarker(marker);
|
||||||
|
|||||||
Reference in New Issue
Block a user