forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThemeStyle.js
More file actions
192 lines (187 loc) · 10.7 KB
/
ThemeStyle.js
File metadata and controls
192 lines (187 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import {SuperMap} from '../SuperMap';
import {Util} from '../commontypes/Util';
/**
* @class SuperMap.ThemeStyle
* @classdesc 客户端专题图风格类
* @category Visualization Theme
* @param options -{Object} 可选参数。如:<br>
* fill - {boolean} 是否填充,不需要填充则设置为 false,默认值为 true。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。<br>
* fillColor - {string} 十六进制填充颜色。默认值为 "#000000"。<br>
* fillOpacity - {number} 填充不透明度。取值范围[0, 1],默认值 1。<br>
* stroke - {boolean} 是否描边,不需要描边则设置为false,默认值为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。<br>
* strokeColor - {string} 十六进制描边颜色。默认值为 "#000000"。<br>
* strokeOpacity - {number} 描边的不透明度。取值范围[0, 1],默认值 1。<br>
* strokeWidth - {number} 线宽度/描边宽度,默认值 1。<br>
* strokeLinecap - {string} 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"; 默认为"butt"。<br>
* strokeLineJoin - {string} 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"; 默认为"miter"。<br>
* strokeDashstyle - {string} 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。默认值 "solid"。solid 表示实线。<br>
* pointRadius - {number} 点半径,默认为 6 (像素)。<br>
* shadowBlur - {number} 阴影模糊度,(大于 0 有效; 默认值 0)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。<br>
* shadowColor - {string} 阴影颜色; 默认值 '#000000'。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。<br>
* shadowOffsetX - {number} 阴影 X 方向偏移值; 默认值 0。<br>
* shadowOffsetY - {number} 阴影 Y 方向偏移值; 默认值 0。<br>
* label - {string} 专题要素附加文本标签内容。<br>
* fontColor - {string} 附加文本字体颜色。<br>
* fontSize - {number} 附加文本字体大小。默认值 12,单位是像素。<br>
* fontStyle - {string} 附加文本字体样式。可设值:"normal", "italic", "oblique"; 默认值:"normal"。<br>
* fontVariant - {string} 附加文本字体变体。可设值:"normal", "small-caps"; 默认值:"normal"。<br>
* fontWeight - {string} 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"; 默认值:"normal"。<br>
* fontFamily - {string} 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
* 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
* ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。默认值:"arial,sans-serif"。<br>
* labelPosition - {string} 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'; 默认值 'top'。<br>
* labelAlign - {string} 附加文本水平对齐。可以是 'left', 'right', 'center'; 默认值 'center'。<br>
* labelBaseline - {string} 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle';默认值 'middle'。<br>
* labelXOffset - {number} 附加文本在x轴方向的偏移量; 默认值 0。<br>
* labelYOffset - {number} 附加文本在y轴方向的偏移量; 默认值 0。<br>
*/
export class ThemeStyle {
constructor(options) {
options = options || {};
/**
* @member SuperMap.ThemeStyle.prototype.fill - {boolean}
* @description 是否填充,不需要填充则设置为 false,默认值为 true。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
*/
this.fill = true;
/**
* @member SuperMap.ThemeStyle.prototype.fillColor -{string}
* @description 十六进制填充颜色。默认值为 "#000000"。
*/
this.fillColor = "#000000";
/**
* @member SuperMap.ThemeStyle.prototype.fillOpacity -{number}
* @description 填充不透明度。取值范围[0, 1],默认值 1。
*/
this.fillOpacity = 1;
/**
* @member SuperMap.ThemeStyle.prototype.stroke -{boolean}
* @description 是否描边,不需要描边则设置为false,默认值为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
*/
this.stroke = false;
/**
* @member SuperMap.ThemeStyle.prototype.strokeColor -{string}
* @description 十六进制描边颜色。默认值为 "#000000"。
*/
this.strokeColor = "#000000";
/**
* @member SuperMap.ThemeStyle.prototype.strokeOpacity -{number}
* @description 描边的不透明度。取值范围[0, 1],默认值 1。
*/
this.strokeOpacity = 1;
/**
* @member SuperMap.ThemeStyle.prototype.strokeWidth -{number}
* @description 线宽度/描边宽度,默认值 1。
*/
this.strokeWidth = 1;
/**
* @member SuperMap.ThemeStyle.prototype.strokeLinecap -{string}
* @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square"; 默认为"butt"。
*/
this.strokeLinecap = "butt";
/**
* @member SuperMap.ThemeStyle.prototype.strokeLineJoin -{string}
* @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"; 默认为"miter"。
*/
this.strokeLineJoin = "miter";
/**
* @member SuperMap.ThemeStyle.prototype.strokeDashstyle -{string}
* @description 虚线类型; strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
* 默认值 "solid"。solid 表示实线。
*/
this.strokeDashstyle = "solid";
/**
* @member SuperMap.ThemeStyle.prototype.pointRadius -{number}
* @description 点半径,默认为 6 (像素)。
*/
this.pointRadius = 6;
/**
* @member SuperMap.ThemeStyle.prototype.shadowBlur -{number}
* @description 阴影模糊度,(大于 0 有效; 默认值 0)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
*/
this.shadowBlur = 0;
/**
* @member SuperMap.ThemeStyle.prototype.shadowColor -{string}
* @description 阴影颜色; 默认值 '#000000'。 注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
*/
this.shadowColor = "#000000";
/**
* @member SuperMap.ThemeStyle.prototype.shadowOffsetX -{number}
* @description 阴影 X 方向偏移值; 默认值 0。
*/
this.shadowOffsetX = 0;
/**
* @member SuperMap.ThemeStyle.prototype.shadowOffsetY -{number}
* @description Y 方向偏移值; 默认值 0。
*/
this.shadowOffsetY = 0;
/**
* @member SuperMap.ThemeStyle.prototype.label -{string}
* @description 专题要素附加文本标签内容。
*/
this.label = "";
/**
* @member SuperMap.ThemeStyle.prototype.labelRect -boolean
* @description 是否显示文本标签矩形背景。
*/
this.labelRect = false;
/**
* @member SuperMap.ThemeStyle.prototype.fontColor -{string}
* @description 附加文本字体颜色。
*/
this.fontColor = "";
/**
* @member SuperMap.ThemeStyle.prototype.fontSize -{number}
* @description 附加文本字体大小。默认值 12,单位是像素。
*/
this.fontSize = 12;
/**
* @member SuperMap.ThemeStyle.prototype.fontStyle -{string}
* @description 附加文本字体样式。可设值:"normal", "italic", "oblique"; 默认值:"normal" 。
*/
this.fontStyle = "normal";
/**
* @member SuperMap.ThemeStyle.prototype.fontVariant -{string}
* @description 附加文本字体变体。可设值:"normal", "small-caps"; 默认值:"normal" 。
*/
this.fontVariant = "normal";
/**
* @member SuperMap.ThemeStyle.prototype.fontWeight -{string}
* @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"; 默认值:"normal" 。
*/
this.fontWeight = "normal";
/**
* @member SuperMap.ThemeStyle.prototype.fontFamily -{string}
* @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
* 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
* 默认值:"arial,sans-serif".
*/
this.fontFamily = "arial,sans-serif";
/**
* @member SuperMap.ThemeStyle.prototype.labelPosition -{string}
* @description 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'; 默认值 'top'。
*/
this.labelPosition = "top";
/**
* @member SuperMap.ThemeStyle.prototype.labelAlign -{string}
* @description 附加文本水平对齐。可以是 'left', 'right', 'center'; 默认值 'center'。
*/
this.labelAlign = "center";
/**
* @member SuperMap.ThemeStyle.prototype.labelBaseline -{string}
* @description 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle';默认值 'middle'。
*/
this.labelBaseline = "middle";
/**
* @member SuperMap.ThemeStyle.prototype.labelXOffset -{number}
* @description 附加文本在x轴方向的偏移量。
*/
this.labelXOffset = 0;
/**
* @member SuperMap.ThemeStyle.prototype.labelYOffset -{number}
* @description 附加文本在y轴方向的偏移量。
*/
this.labelYOffset = 0;
Util.extend(this, options);
}
}
SuperMap.ThemeStyle = ThemeStyle;