Create and use ReferenceTrackDataManager to fetch ReferenceTrack data.

This commit is contained in:
Jeremy Goecks
2011-04-14 14:34:39 -04:00
parent 23efa70ebe
commit f514b9471e
+15 -6
View File
@@ -244,11 +244,6 @@ extend(DataManager.prototype, Cache.prototype, {
* Load data from server; returns AJAX object so that use of Deferred is possible.
*/
load_data: function(chrom, low, high, mode, resolution, extra_params) {
if (this.track.track_type == "ReferenceTrack" && resolution > 1) {
// Now that data is pre-fetched before draw, we don't load reference tracks
// unless it's at the bottom level
return;
}
// Setup data request params.
var params = {"chrom": chrom, "low": low, "high": high, "mode": mode,
"resolution": resolution, "dataset_id" : this.track.dataset_id,
@@ -346,6 +341,20 @@ extend(DataManager.prototype, Cache.prototype, {
}
});
var ReferenceTrackDataManager = function(num_elements, track, subset) {
DataManager.call(this, num_elements, track, subset);
};
extend(ReferenceTrackDataManager.prototype, DataManager.prototype, Cache.prototype, {
load_data: function(chrom, low, high, mode, resolution, extra_params) {
if (resolution > 1) {
// Now that data is pre-fetched before draw, we don't load reference tracks
// unless it's at the bottom level
return;
}
return DataManager.prototype.load_data.call(this, chrom, low, high, mode, resolution, extra_params);
}
});
/**
* View object manages complete viz view, including tracks and user interactions.
*/
@@ -1979,7 +1988,7 @@ var ReferenceTrack = function (view) {
this.content_div.css("border", "none");
this.data_url = reference_url;
this.data_url_extra_params = {dbkey: view.dbkey};
this.data_cache = new DataManager(CACHED_DATA, this, false);
this.data_cache = new ReferenceTrackDataManager(CACHED_DATA, this, false);
this.tile_cache = new Cache(CACHED_TILES_LINE);
};
extend(ReferenceTrack.prototype, TiledTrack.prototype, {