2018-10-23 23:45:42 +08:00
|
|
|
'use strict';
|
|
|
|
|
2018-05-30 23:02:15 +08:00
|
|
|
const MapStoreMapConfigProvider = require('./map-store-provider');
|
2015-07-11 01:10:55 +08:00
|
|
|
|
2018-05-31 02:28:15 +08:00
|
|
|
module.exports = class CreateLayergroupMapConfigProvider extends MapStoreMapConfigProvider {
|
|
|
|
constructor (mapConfig, user, userLimitsBackend, pgConnection, affectedTablesCache, params) {
|
2018-05-31 20:57:34 +08:00
|
|
|
super(null, user, userLimitsBackend, pgConnection, affectedTablesCache, params);
|
2018-05-31 02:28:15 +08:00
|
|
|
this.mapConfig = mapConfig;
|
2018-03-22 02:08:37 +08:00
|
|
|
}
|
|
|
|
|
2018-05-31 02:28:15 +08:00
|
|
|
getMapConfig (callback) {
|
|
|
|
if (this.mapConfig && this.params && this.context) {
|
|
|
|
return callback(null, this.mapConfig, this.params, this.context);
|
2015-07-11 01:10:55 +08:00
|
|
|
}
|
2018-05-30 23:00:15 +08:00
|
|
|
|
2018-05-31 02:28:15 +08:00
|
|
|
const context = {};
|
2015-07-11 01:10:55 +08:00
|
|
|
|
2018-05-31 02:28:15 +08:00
|
|
|
this.userLimitsBackend.getRenderLimits(this.user, this.params.api_key, (err, renderLimits) => {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2015-07-11 01:10:55 +08:00
|
|
|
|
2018-05-31 02:28:15 +08:00
|
|
|
context.limits = renderLimits;
|
|
|
|
this.context = context;
|
2018-03-21 21:11:54 +08:00
|
|
|
|
2018-05-31 02:28:15 +08:00
|
|
|
return callback(null, this.mapConfig, this.params, context);
|
|
|
|
});
|
|
|
|
}
|
2018-04-06 18:59:53 +08:00
|
|
|
};
|