Skip to content

Commit e51735f

Browse files
committed
feat:组图层支持透明度设置
1 parent c6f1e5c commit e51735f

File tree

2 files changed

+69
-72
lines changed

2 files changed

+69
-72
lines changed
Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import {
2-
Zondy
3-
} from './Base';
4-
import {
5-
extend
6-
} from "./Util";
7-
import {
8-
DynShowStyle
9-
} from './DynShowStyle'
1+
import { Zondy } from './Base';
2+
import { extend } from './Util';
3+
import { DynShowStyle } from './DynShowStyle';
104

115
/**
126
* 地图文档显示样式对象
@@ -26,11 +20,23 @@ import {
2620
* @param {Boolean} [option.ShowCoordPnt = false] 显示坐标点
2721
* @param {Boolean} [option.ShowElemRect = false] 显示元素的外包矩形
2822
* @param {Array} [option.ShowStyle = null] 图层显示参数 Array, {@link Zondy.Object.DynShowStyle}
23+
* @param {Array} [option.LayerStyles = null] 图层显示参数 Map, {@link Zondy.Object.DynShowStyle}
2924
* @param {Boolean} [option.SymbleShow = false] 是否进行还原显示
3025
* @see Zondy.Service.GetDocImageService
26+
* @example
27+
* var layerStyle = new Zondy.Object.DynShowStyle({
28+
Alpha: 50
29+
});
30+
var style = new Zondy.Object.CDisplayStyle({
31+
LayerStyles: {
32+
0: layerStyle,
33+
1: layerStyle,
34+
'2-0': layerStyle
35+
}
36+
});
3137
*/
3238
var CDisplayStyle = function (option) {
33-
var options = (option !== undefined) ? option : {};
39+
var options = option !== undefined ? option : {};
3440
extend(this, options);
3541

3642
/**
@@ -40,7 +46,7 @@ var CDisplayStyle = function (option) {
4046
* @description 注记符号大小固定
4147
* @default false
4248
*/
43-
this.AnnSizeFixed = (options.AnnSizeFixed !== undefined) ? options.AnnSizeFixed : false;
49+
this.AnnSizeFixed = options.AnnSizeFixed !== undefined ? options.AnnSizeFixed : false;
4450

4551
/**
4652
* @private
@@ -49,7 +55,7 @@ var CDisplayStyle = function (option) {
4955
* @description 图像质量</summary>可选值为:1(低)、2(中)、3(高)
5056
* @default 0
5157
*/
52-
this.DriverQuality = (options.DriverQuality !== undefined) ? options.DriverQuality : 0;
58+
this.DriverQuality = options.DriverQuality !== undefined ? options.DriverQuality : 0;
5359

5460
/**
5561
* @private
@@ -58,7 +64,7 @@ var CDisplayStyle = function (option) {
5864
* @description 是否动态投影
5965
* @default false
6066
*/
61-
this.DynProjFlag = (options.DynProjFlag !== undefined) ? options.DynProjFlag : false;
67+
this.DynProjFlag = options.DynProjFlag !== undefined ? options.DynProjFlag : false;
6268

6369
/**
6470
* @private
@@ -67,7 +73,7 @@ var CDisplayStyle = function (option) {
6773
* @description 符号是否跟随显示放大(该属性已过时,请使用各个要素类的大小固定及线宽固定)
6874
* @default false
6975
*/
70-
this.FollowScale = (options.FollowScale !== undefined) ? options.FollowScale : false;
76+
this.FollowScale = options.FollowScale !== undefined ? options.FollowScale : false;
7177

7278
/**
7379
* @private
@@ -76,7 +82,7 @@ var CDisplayStyle = function (option) {
7682
* @description 线状符号线宽固定
7783
* @default false
7884
*/
79-
this.LinPenWidFixed = (options.LinPenWidFixed !== undefined) ? options.LinPenWidFixed : false;
85+
this.LinPenWidFixed = options.LinPenWidFixed !== undefined ? options.LinPenWidFixed : false;
8086

8187
/**
8288
* @private
@@ -85,7 +91,7 @@ var CDisplayStyle = function (option) {
8591
* @description 线状符号大小固定
8692
* @default false
8793
*/
88-
this.LinSizeFixed = (options.LinSizeFixed !== undefined) ? options.LinSizeFixed : false;
94+
this.LinSizeFixed = options.LinSizeFixed !== undefined ? options.LinSizeFixed : false;
8995

9096
/**
9197
* @private
@@ -94,7 +100,7 @@ var CDisplayStyle = function (option) {
94100
* @description 点状符号线宽固定
95101
* @default false
96102
*/
97-
this.PntPenWidFixed = (options.PntPenWidFixed !== undefined) ? options.PntPenWidFixed : false;
103+
this.PntPenWidFixed = options.PntPenWidFixed !== undefined ? options.PntPenWidFixed : false;
98104

99105
/**
100106
* @private
@@ -103,7 +109,7 @@ var CDisplayStyle = function (option) {
103109
* @description 点状符号大小固定
104110
* @default false
105111
*/
106-
this.PntSizeFixed = (options.PntSizeFixed !== undefined) ? options.PntSizeFixed : false;
112+
this.PntSizeFixed = options.PntSizeFixed !== undefined ? options.PntSizeFixed : false;
107113

108114
/**
109115
* @private
@@ -112,7 +118,7 @@ var CDisplayStyle = function (option) {
112118
* @description 填充符号线宽固定
113119
* @default false
114120
*/
115-
this.RegPenWidFixed = (options.RegPenWidFixed !== undefined) ? options.RegPenWidFixed : false;
121+
this.RegPenWidFixed = options.RegPenWidFixed !== undefined ? options.RegPenWidFixed : false;
116122

117123
/**
118124
* @private
@@ -121,7 +127,7 @@ var CDisplayStyle = function (option) {
121127
* @description 填充符号大小固定
122128
* @default false
123129
*/
124-
this.RegSizeFixed = (options.RegSizeFixed !== undefined) ? options.RegSizeFixed : false;
130+
this.RegSizeFixed = options.RegSizeFixed !== undefined ? options.RegSizeFixed : false;
125131

126132
/**
127133
* @private
@@ -130,7 +136,7 @@ var CDisplayStyle = function (option) {
130136
* @description 显示坐标点
131137
* @default false
132138
*/
133-
this.ShowCoordPnt = (options.ShowCoordPnt !== undefined) ? options.ShowCoordPnt : false;
139+
this.ShowCoordPnt = options.ShowCoordPnt !== undefined ? options.ShowCoordPnt : false;
134140

135141
/**
136142
* @private
@@ -139,7 +145,7 @@ var CDisplayStyle = function (option) {
139145
* @description 显示元素的外包矩形
140146
* @default false
141147
*/
142-
this.ShowElemRect = (options.ShowElemRect !== undefined) ? options.ShowElemRect : false;
148+
this.ShowElemRect = options.ShowElemRect !== undefined ? options.ShowElemRect : false;
143149

144150
/**
145151
* @private
@@ -148,7 +154,16 @@ var CDisplayStyle = function (option) {
148154
* @description 图层显示参数Array<{@link Zondy.Object.DynShowStyle}>
149155
* @default null
150156
*/
151-
this.ShowStyle = (options.ShowStyle !== undefined) ? options.ShowStyle : null;
157+
this.ShowStyle = options.ShowStyle !== undefined ? options.ShowStyle : null;
158+
159+
/**
160+
* @private
161+
* @member Zondy.Object.CDisplayStyle.prototype.LayerStyles
162+
* @type {Map}
163+
* @description 图层显示参数Map<{@link Zondy.Object.DynShowStyle}>
164+
* @default null
165+
*/
166+
this.LayerStyles = options.LayerStyles !== undefined ? options.LayerStyles : null;
152167

153168
/**
154169
* @private
@@ -157,10 +172,8 @@ var CDisplayStyle = function (option) {
157172
* @description 是否进行还原显示
158173
* @default false
159174
*/
160-
this.SymbleShow = (options.SymbleShow !== undefined) ? options.SymbleShow : false;
175+
this.SymbleShow = options.SymbleShow !== undefined ? options.SymbleShow : false;
161176
};
162177

163-
export {
164-
CDisplayStyle
165-
};
166-
Zondy.Object.CDisplayStyle = CDisplayStyle;
178+
export { CDisplayStyle };
179+
Zondy.Object.CDisplayStyle = CDisplayStyle;

src/service/common/DynShowStyle.js

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
1-
import {
2-
Zondy
3-
} from './Base';
4-
import {
5-
extend
6-
} from "./Util";
7-
import {
8-
CDynNoteInfo
9-
} from "./CDynNoteInfo";
10-
import {
11-
ISShowArc
12-
} from "./EnumComm";
13-
import {
14-
CLineInfo
15-
} from "./CLineInfo";
16-
import {
17-
CPointInfo
18-
} from "./CPointInfo";
19-
import {
20-
CRegionInfo
21-
} from "./CRegionInfo";
1+
import { Zondy } from './Base';
2+
import { extend } from './Util';
3+
import { CDynNoteInfo } from './CDynNoteInfo';
4+
import { ISShowArc } from './EnumComm';
5+
import { CLineInfo } from './CLineInfo';
6+
import { CPointInfo } from './CPointInfo';
7+
import { CRegionInfo } from './CRegionInfo';
228

239
/**
2410
* 图层动态显示样式对象
2511
* @class Zondy.Object.DynShowStyle
2612
* @classdesc 地图文档显示样式对象构造函数
2713
* @param {Object} option 属性键值对
28-
* @param {Number} [option.Alpha = 0] 透明度
14+
* @param {Number} [option.Alpha = 0] 透明度(0-100),0表示全部显示,100表示隐藏,50表示半透明
2915
* @param {Boolean} [option.BugSpare = false] 是否使用错误处理符号
3016
* @param {Boolean} [option.CustomRender = false] 是否自绘驱动
3117
* @param {String} [option.CustomRenderPath = false] 自绘驱动路径设置
@@ -47,7 +33,7 @@ import {
4733
* @see Zondy.Object.CDisplayStyle
4834
*/
4935
var DynShowStyle = function (option) {
50-
var options = (option !== undefined) ? option : {};
36+
var options = option !== undefined ? option : {};
5137
extend(this, options);
5238

5339
/**
@@ -56,55 +42,55 @@ var DynShowStyle = function (option) {
5642
* @description 透明度
5743
* @default 0
5844
*/
59-
this.Alpha = (options.Alpha !== undefined) ? options.Alpha : 0;
45+
this.Alpha = options.Alpha !== undefined ? options.Alpha : 0;
6046

6147
/**
6248
* @member Zondy.Object.DynShowStyle.prototype.BugSpare
6349
* @type {Boolean}
6450
* @description 是否使用错误处理符号
6551
* @default false
6652
*/
67-
this.BugSpare = (options.BugSpare !== undefined) ? options.BugSpare : false;
53+
this.BugSpare = options.BugSpare !== undefined ? options.BugSpare : false;
6854

6955
/**
7056
* @member Zondy.Object.DynShowStyle.prototype.CustomRender
7157
* @type {Boolean}
7258
* @description 是否自绘驱动
7359
* @default false
7460
*/
75-
this.CustomRender = (options.CustomRender !== undefined) ? options.CustomRender : false;
61+
this.CustomRender = options.CustomRender !== undefined ? options.CustomRender : false;
7662

7763
/**
7864
* @member Zondy.Object.DynShowStyle.prototype.CustomRenderPath
7965
* @type {String}
8066
* @description 自绘驱动路径设置
8167
* @default null
8268
*/
83-
this.CustomRenderPath = (options.CustomRenderPath !== undefined) ? options.CustomRenderPath : null;
69+
this.CustomRenderPath = options.CustomRenderPath !== undefined ? options.CustomRenderPath : null;
8470

8571
/**
8672
* @member Zondy.Object.DynShowStyle.prototype.DirectionLineClr
8773
* @type {Number}
8874
* @description 显示的线方向线符号(只适用于其颜色)
8975
* @default 0
9076
*/
91-
this.DirectionLineClr = (options.DirectionLineClr !== undefined) ? options.DirectionLineClr : 0;
77+
this.DirectionLineClr = options.DirectionLineClr !== undefined ? options.DirectionLineClr : 0;
9278

9379
/**
9480
* @member Zondy.Object.DynShowStyle.prototype.DynNoteFlag
9581
* @type {String}
9682
* @description 是否动态注记
9783
* @default false
9884
*/
99-
this.DynNoteFlag = (options.DynNoteFlag !== undefined) ? options.DynNoteFlag : false;
85+
this.DynNoteFlag = options.DynNoteFlag !== undefined ? options.DynNoteFlag : false;
10086

10187
/**
10288
* @member Zondy.Object.DynShowStyle.prototype.DynNoteInfo
10389
* @type {Zondy.Object.CDynNoteInfo}
10490
* @description 动态注记参数
10591
* @default null
10692
*/
107-
this.DynNoteInfo = (options.DynNoteInfo !== undefined) ? options.DynNoteInfo : null;
93+
this.DynNoteInfo = options.DynNoteInfo !== undefined ? options.DynNoteInfo : null;
10894

10995
/**
11096
* @member Zondy.Object.DynShowStyle.prototype.IsShowArc
@@ -113,81 +99,79 @@ var DynShowStyle = function (option) {
11399
* 取值范围: 1(Zondy.Enum.ISShowArc.Reg),2(Zondy.Enum.ISShowArc.Arc),3(Zondy.Enum.ISShowArc.All)
114100
* @default 0
115101
*/
116-
this.IsShowArc = (options.IsShowArc !== undefined) ? options.IsShowArc : 0;
102+
this.IsShowArc = options.IsShowArc !== undefined ? options.IsShowArc : 0;
117103

118104
/**
119105
* @member Zondy.Object.DynShowStyle.prototype.ISShowLineDirection
120106
* @type {Boolean}
121107
* @description 是否显示线方向
122108
* @default false
123109
*/
124-
this.ISShowLineDirection = (options.ISShowLineDirection !== undefined) ? options.ISShowLineDirection : false;
110+
this.ISShowLineDirection = options.ISShowLineDirection !== undefined ? options.ISShowLineDirection : false;
125111

126112
/**
127113
* @member Zondy.Object.DynShowStyle.prototype.LineInfo
128114
* @type {Zondy.Object.CLineInfo}
129115
* @description 显示的弧段样式(只适用于其颜色)
130116
* @default null
131117
*/
132-
this.LineInfo = (options.LineInfo !== undefined) ? options.LineInfo : null;
118+
this.LineInfo = options.LineInfo !== undefined ? options.LineInfo : null;
133119

134120
/**
135121
* @member Zondy.Object.DynShowStyle.prototype.MaxScale
136122
* @type {Number}
137123
* @description 最大显示比率
138124
* @default 0.00
139125
*/
140-
this.MaxScale = (options.MaxScale !== undefined) ? options.MaxScale : 0.00;
126+
this.MaxScale = options.MaxScale !== undefined ? options.MaxScale : 0.0;
141127

142128
/**
143129
* @member Zondy.Object.DynShowStyle.prototype.MinScale
144130
* @type {Number}
145131
* @description 最小显示比率
146132
* @default 0.00
147133
*/
148-
this.MinScale = (options.MinScale !== undefined) ? options.MinScale : 0.00;
134+
this.MinScale = options.MinScale !== undefined ? options.MinScale : 0.0;
149135

150136
/**
151137
* @member Zondy.Object.DynShowStyle.prototype.ShowCoordPnt
152138
* @type {Boolean}
153139
* @description 显示坐标点
154140
* @default false
155141
*/
156-
this.ShowCoordPnt = (options.ShowCoordPnt !== undefined) ? options.ShowCoordPnt : false;
142+
this.ShowCoordPnt = options.ShowCoordPnt !== undefined ? options.ShowCoordPnt : false;
157143

158144
/**
159145
* @member Zondy.Object.DynShowStyle.prototype.SpareLineInfo
160146
* @type {Zondy.Object.CLineInfo}
161147
* @description 错误处理线符号
162148
* @default null
163149
*/
164-
this.SpareLineInfo = (options.SpareLineInfo !== undefined) ? options.SpareLineInfo : null;
150+
this.SpareLineInfo = options.SpareLineInfo !== undefined ? options.SpareLineInfo : null;
165151

166152
/**
167153
* @member Zondy.Object.DynShowStyle.prototype.SparePointInfo
168154
* @type {Zondy.Object.CPointInfo}
169155
* @description 错误处理点符号
170156
* @default null
171157
*/
172-
this.SparePointInfo = (options.SparePointInfo !== undefined) ? options.SparePointInfo : null;
158+
this.SparePointInfo = options.SparePointInfo !== undefined ? options.SparePointInfo : null;
173159

174160
/**
175161
* @member Zondy.Object.DynShowStyle.prototype.SpareRegInfo
176162
* @type {Zondy.Object.CRegionInfo}
177163
* @description 错误处理区符号
178164
* @default null
179165
*/
180-
this.SpareRegInfo = (options.SpareRegInfo !== undefined) ? options.SpareRegInfo : null;
166+
this.SpareRegInfo = options.SpareRegInfo !== undefined ? options.SpareRegInfo : null;
181167

182168
/**
183169
* @member Zondy.Object.DynShowStyle.prototype.SymbleScale
184170
* @type {Number}
185171
* @description 符号显示比例
186172
* @default 0.00
187173
*/
188-
this.SymbleScale = (options.SymbleScale !== undefined) ? options.SymbleScale : 0.00;
174+
this.SymbleScale = options.SymbleScale !== undefined ? options.SymbleScale : 0.0;
189175
};
190-
export {
191-
DynShowStyle
192-
};
193-
Zondy.Object.DynShowStyle = DynShowStyle;
176+
export { DynShowStyle };
177+
Zondy.Object.DynShowStyle = DynShowStyle;

0 commit comments

Comments
 (0)