new SuperMap.CartoCSS(cartoStr)
common/style/CartoCSS.js, line 7
Name | Type | Description |
---|---|---|
cartoStr |
string |
CartoCSS 样式表字符串 |
Example
var cartocss = "@provinceLineColor:#ddd;
#China_Provinces_L___China400{
line-dasharray:10,10;
line-color:@provinceLineColor;
line-width:1;
}";
new SuperMap.CartoCSS(cartocss);
Members
-
cartoStr
-
CartoCSS 样式表字符串
-
parser
-
解析器
-
ruleSet
-
CartoCSS 规则对象
-
shaders
-
Carto 着色器集
Methods
-
destroy()
common/style/CartoCSS.js, line 1049 -
CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象
-
getParser()
common/style/CartoCSS.js, line 66 -
获取 CartoCSS 解析器
-
getShaders(){Array}
common/style/CartoCSS.js, line 1020 -
获取CartoCSS着色器
Returns:
Type Description Array 着色器集 Example
//shaders的结构大概如下: var shaders=[ { attachment:"one", elements:[], zoom:23, length:2, 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}}, 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}} }, { attachment:"two", elements:[], zoom:23, length:2, 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}}, 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}} } ];
-
parse(){Object}
common/style/CartoCSS.js, line 876 -
利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集
Returns:
Type Description Object CartoCSS规则集 -
toShaders(){Array}
common/style/CartoCSS.js, line 888 -
将CartoCSS规则集转化为着色器
Returns:
Type Description Array CartoCSS着色器集