blob: 7df7d0edfd755031e8ad82307588d75574a7f5b0 [file] [log] [blame]
import * as zrUtil from 'zrender/src/core/util';
var coordinateSystemCreators = {};
function CoordinateSystemManager() {
this._coordinateSystems = [];
}
CoordinateSystemManager.prototype = {
constructor: CoordinateSystemManager,
create: function (ecModel, api) {
var coordinateSystems = [];
zrUtil.each(coordinateSystemCreators, function (creater, type) {
var list = creater.create(ecModel, api);
coordinateSystems = coordinateSystems.concat(list || []);
});
this._coordinateSystems = coordinateSystems;
},
update: function (ecModel, api) {
zrUtil.each(this._coordinateSystems, function (coordSys) {
// FIXME MUST have
coordSys.update && coordSys.update(ecModel, api);
});
},
getCoordinateSystems: function () {
return this._coordinateSystems.slice();
}
};
CoordinateSystemManager.register = function (type, coordinateSystemCreator) {
coordinateSystemCreators[type] = coordinateSystemCreator;
};
CoordinateSystemManager.get = function (type) {
return coordinateSystemCreators[type];
};
export default CoordinateSystemManager;