MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / constructor

Method constructor

src/mapboxgl/overlay/LabelThemeLayer.js:38–107  ·  view source on GitHub ↗
(name, options)

Source from the content-addressed store, hash-verified

36export class Label extends GeoFeature {
37
38 constructor(name, options) {
39 super(name, options);
40 /**
41 * @member {boolean} [LabelThemeLayer.prototype.isOverLay=true]
42 * @description 是否进行压盖处理,如果设为 true,将隐藏被压盖的标签。
43 */
44 this.isOverLay = true;
45 /**
46 * @member {boolean} [LabelThemeLayer.prototype.isAvoid=true]
47 * @description 是否进行地图边缘的避让处理,如果设为 true,将把与地图边缘相交的标签移到地图范围内,在地图边缘处做避让处理。
48 */
49 this.isAvoid = true;
50
51 /**
52 * @member {string} LabelThemeLayer.prototype.themeField
53 * @description 用于指定专题要素样式的属性字段名称。</br>
54 * 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。</br>
55 * 使用标签分组显示还需要设置 styleGroups 属性。
56 */
57 this.themeField = null;
58
59 /**
60 * @member {Array.<Object>} LabelThemeLayer.prototype.styleGroups
61 * @description 分组样式。使用此属性需要设置 themeField 属性。</br>
62 * 1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;</br>
63 * 2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;</br>
64 * &nbsp;&nbsp;a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。</br>
65 * &nbsp;&nbsp;b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。</br>
66 * 此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
67 */
68 this.styleGroups = null;
69
70 Util.extend(this, options);
71 this.defaultStyle = {
72 //默认文本样式
73 fontColor: "#000000",
74 fontOpacity: 1,
75 fontSize: "12px",
76 fontStyle: "normal",
77 fontWeight: "normal",
78 labelAlign: "cm",
79 labelXOffset: 0,
80 labelYOffset: 0,
81 labelRotation: 0,
82
83 //默认样式
84 fill: false,
85 fillColor: "#ee9900",
86 fillOpacity: 0.4,
87 stroke: false,
88 strokeColor: "#ee9900",
89 strokeOpacity: 1,
90 strokeWidth: 1,
91 strokeLinecap: "round",
92 strokeDashstyle: "solid",
93
94 //默认显示背景框
95 labelRect: true,

Callers

nothing calls this directly

Calls 1

extendMethod · 0.80

Tested by

no test coverage detected