MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / toJS

Method toJS

src/common/style/CartoCSS.js:3358–3397  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

3356 }
3357
3358 toJS(env) {
3359 var shaderAttrs = {};
3360
3361 // merge conditions from filters with zoom condition of the
3362 // definition
3363 var zoom = this.zoom;
3364 //var frame_offset = this.frame_offset;
3365 var _if = this.filters.toJS(env);
3366 var filters = [zoom];
3367 if (_if) {filters.push(_if);}
3368 //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
3369 _if = filters.join(" && ");
3370
3371 function eachRule(rule) {
3372 if (rule instanceof CartoCSS.Tree.Rule) {
3373 shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
3374 if (_if) {
3375 shaderAttrs[rule.name].push(
3376 "if(" + _if + "){" + rule.value.toJS(env) + "}"
3377 );
3378 } else {
3379 shaderAttrs[rule.name].push(rule.value.toJS(env));
3380 }
3381 } else {
3382 if (rule instanceof CartoCSS.Tree.Ruleset) {
3383 var sh = rule.toJS(env);
3384 for (var v in sh) {
3385 shaderAttrs[v] = shaderAttrs[v] || [];
3386 for (var attr in sh[v]) {
3387 shaderAttrs[v].push(sh[v][attr]);
3388 }
3389 }
3390 }
3391 }
3392 }
3393 for (var id in this.rules) {
3394 eachRule(this.rules[id]);
3395 }
3396 return shaderAttrs;
3397 }
3398};
3399
3400CartoCSS.Tree.Dimension = class Dimension {

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
toJSMethod · 0.45

Tested by

no test coverage detected