mirage2d 1.1.68 → 1.1.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- import { Style, Icon } from 'ol/style';
1
+ import { Style } from 'ol/style';
2
2
  import { Coordinate } from "ol/coordinate";
3
- import FillPattern from "ol-ext/style/FillPattern";
4
3
  import { crsType, featuretype } from "../Enum/typeEnum";
5
4
  export interface IContextmenu {
6
5
  classname?: string;
@@ -138,19 +137,19 @@ export interface IClusterImageLayerOption extends IGraphicLayerOption {
138
137
  animationDuration?: number;
139
138
  maxResolution?: number;
140
139
  }
141
- interface ITextOption {
140
+ export interface ITextOption {
142
141
  font?: string;
143
142
  text?: string;
144
- fill?: IFilleOption;
143
+ fill?: IFillOption;
145
144
  stroke?: IStrokeOption;
146
- backgroundFill?: IFilleOption;
145
+ backgroundFill?: IFillOption;
147
146
  backgroundStroke?: IStrokeOption;
148
147
  padding?: Array<number>;
149
148
  offsetX?: number;
150
149
  offsetY?: number;
151
150
  textBaseline?: string;
152
151
  }
153
- interface IStrokeOption {
152
+ export interface IStrokeOption {
154
153
  color?: string;
155
154
  width?: number;
156
155
  lineDash?: Array<number>;
@@ -165,11 +164,11 @@ interface IStrokeOption {
165
164
  scale?: number;
166
165
  ratio?: number;
167
166
  }
168
- interface IFilleOption {
167
+ export interface IFillOption {
169
168
  color?: string;
170
- image?: Icon | undefined;
169
+ image?: string;
171
170
  opacity?: number;
172
- pattern?: FillPattern | string | undefined;
171
+ pattern?: string | undefined;
173
172
  patternColor?: string;
174
173
  offset?: number;
175
174
  size?: number;
@@ -180,6 +179,7 @@ interface IFilleOption {
180
179
  }
181
180
  export interface IGraphicOption {
182
181
  lnglat?: Array<number> | Coordinate[][] | any;
182
+ graphicType: string;
183
183
  dataWkID?: crsType | string;
184
184
  attribute?: any;
185
185
  popupInfo?: any;
@@ -192,19 +192,25 @@ export interface IGraphicOption {
192
192
  };
193
193
  style?: any;
194
194
  }
195
- export interface IPointStyle {
195
+ export interface IImageStyle {
196
+ scale?: number;
197
+ radius?: number;
198
+ fill?: IFillOption;
199
+ stroke?: IStrokeOption;
200
+ }
201
+ export interface ILabelStyle {
196
202
  text?: ITextOption;
197
- image?: {
198
- radius?: number;
199
- scale?: number;
200
- fill?: IFilleOption;
201
- stroke?: IStrokeOption;
202
- };
203
+ image?: IImageStyle;
203
204
  zIndex?: number;
204
205
  }
205
206
  export interface ILabelOption extends IGraphicOption {
206
207
  style: IPointStyle;
207
208
  }
209
+ export interface IPointStyle {
210
+ text?: ITextOption;
211
+ image?: IImageStyle;
212
+ zIndex?: number;
213
+ }
208
214
  export interface IPointOption extends IGraphicOption {
209
215
  style: IPointStyle;
210
216
  }
@@ -223,19 +229,20 @@ export interface IPolylineStyle {
223
229
  export interface IPolylineOption extends IGraphicOption {
224
230
  style: IPolylineStyle;
225
231
  }
232
+ export interface IPolygonStyle {
233
+ text?: ITextOption;
234
+ stroke?: IStrokeOption;
235
+ fill?: IFillOption;
236
+ zIndex?: number;
237
+ }
226
238
  export interface IPolygonOption extends IGraphicOption {
227
- style: {
228
- text?: ITextOption;
229
- stroke?: IStrokeOption;
230
- fill?: IFilleOption;
231
- zIndex?: number;
232
- };
239
+ style: IPolygonStyle;
233
240
  }
234
241
  export interface ICurveGraphicOption extends IGraphicOption {
235
242
  style: {
236
243
  text?: ITextOption;
237
244
  stroke?: IStrokeOption;
238
- fill?: IFilleOption;
245
+ fill?: IFillOption;
239
246
  zIndex?: number;
240
247
  radius?: number;
241
248
  startAngle?: number;
@@ -275,4 +282,3 @@ export interface IPathLayerOption extends IGraphicLayerOption {
275
282
  pointDistance: number;
276
283
  };
277
284
  }
278
- export {};
@@ -1,10 +1,8 @@
1
- import { Geometry } from 'ol/geom';
2
1
  import { baseGraphic } from "./baseGraphic";
3
2
  import { ICurveGraphicOption } from "../base/baseOptionType";
4
- import { Coordinate } from 'ol/coordinate';
5
3
  export declare class CurveGraphic extends baseGraphic {
6
4
  constructor(options: ICurveGraphicOption);
7
5
  setAngle(startAngle: number, stopAngle: number): void;
8
- getCoordinates(): Coordinate[][];
9
- createRegularPolygonCurve(origin: Coordinate, radius: number, startAngle: number, stopAngle: number, rotation: number): Geometry;
6
+ setCoordinates(coordinates: Array<number>, dataWkID?: string): void;
7
+ private createRegularPolygonCurve;
10
8
  }
@@ -1,25 +1,19 @@
1
1
  import { baseGraphic } from "./baseGraphic";
2
- import { IGraphicOption, IPolylineStyle } from "../base/baseOptionType";
2
+ import { IPolylineOption } from "../base/baseOptionType";
3
3
  export declare class LineGraphic extends baseGraphic {
4
- constructor(options: IGraphicOption);
5
- private chaikin_copy;
6
- private chaikin_smooth;
7
- /**
8
- * 平滑方法
9
- * @param coordinate 坐标
10
- * @param param 参数
11
- * @returns {*}
12
- */
13
- private smoothFunc;
14
- /**
15
- * 平滑曲线
16
- * @param param 越大越平滑
17
- */
18
- setSmooth(param?: number): void;
19
- setLineColor(rgba: string): void;
20
- setLineWidth(width: number): void;
21
- setLineDash(lineDash: Array<number>): void;
22
- setLineStyle(lineStyleOption: IPolylineStyle): void;
23
- getCoordinates(): import("ol/coordinate").Coordinate[];
4
+ constructor(options: IPolylineOption);
5
+ getGraphicJson(projection?: string): {
6
+ type: string;
7
+ lnglat: any;
8
+ dataWkID: string;
9
+ style: {
10
+ stroke: any;
11
+ text: any;
12
+ };
13
+ attribute: {
14
+ [x: string]: any;
15
+ };
16
+ };
17
+ setCoordinates(coordinates: Array<number>, dataWkID?: string): void;
24
18
  lineStyle(): any[];
25
19
  }
@@ -1,7 +1,9 @@
1
1
  import { baseGraphic } from "./baseGraphic";
2
- import { IPolygonOption } from "../base/baseOptionType";
2
+ import { IPolygonOption, IPolygonStyle } from "../base/baseOptionType";
3
+ import { crsType } from "../Enum/typeEnum";
3
4
  export declare class PolygonGraphic extends baseGraphic {
4
5
  constructor(options: IPolygonOption);
5
- getCoordinates(): import("ol/coordinate").Coordinate[][];
6
+ setPolygonStyle(polygonStyleOption: IPolygonStyle): void;
7
+ setCoordinates(coordinates: Array<number>, dataWkID?: crsType): void;
6
8
  setGeometryFromExtent(extent: any): void;
7
9
  }
@@ -1,5 +1,5 @@
1
1
  import Feature from "ol/Feature";
2
- import { IFeatureAttribute, IGraphicLayerOption, IGraphicOption, ITooltipInfo } from "../base/baseOptionType";
2
+ import { IFeatureAttribute, IFillOption, IGraphicLayerOption, IGraphicOption, IImageStyle, IStrokeOption, ITextOption, ITooltipInfo } from "../base/baseOptionType";
3
3
  import { proj } from "../proj4/proj";
4
4
  export declare class baseGraphic extends Feature {
5
5
  protected option: IGraphicOption;
@@ -18,4 +18,125 @@ export declare class baseGraphic extends Feature {
18
18
  openPopup(popupInfo?: Array<ITooltipInfo> | string, popupOption?: IGraphicLayerOption["popupOption"]): void;
19
19
  closePopup(): void;
20
20
  openTooltip(tooltipInfo: string, tooltipOption?: IGraphicLayerOption["popupOption"]): void;
21
+ private chaikin_copy;
22
+ private chaikin_smooth_line;
23
+ private chaikin_smooth_polygon;
24
+ /**
25
+ * 平滑方法
26
+ * @param coordinate 坐标
27
+ * @param param 参数
28
+ * @returns {*}
29
+ */
30
+ smoothFunc(coordinate: any[], param?: number, isLine?: boolean): any;
31
+ /**
32
+ * 平滑曲线
33
+ * @param param 越大越平滑
34
+ */
35
+ setSmooth(param?: number, isLine?: boolean): void;
36
+ /**
37
+ * 设置图形文字样式
38
+ * @param ITextOption
39
+ * @example
40
+ * setTextStyle({
41
+ font: "14px Microsoft YaHei",
42
+ text: "示例",
43
+ fill: {
44
+ color: "#8B4513", //"rgba(255, 255, 255, 1)",
45
+ },
46
+ stroke: {
47
+ color: "rgba(255, 255, 255,1)", //"#fff",
48
+ width: 2, //2,
49
+ },
50
+ backgroundFill: {
51
+ color: "rgba(255, 255, 255, 0.0)", //"rgba(255, 255, 255, 1)",
52
+ },
53
+ backgroundStroke: {
54
+ color: "rgba(0, 0, 0, 0.0)", //"#fff",
55
+ width: 2,
56
+ },
57
+ padding: [3, 3, 3, 3],
58
+ offsetX: 0,
59
+ offsetY: -10,
60
+ textBaseline: "bottom",
61
+ })
62
+ */
63
+ setTextStyle(textStyleOption: ITextOption): void;
64
+ setTrianglePointStyle(ImageStyleOption: IImageStyle): void;
65
+ setCirclePointStyle(ImageStyleOption: IImageStyle): void;
66
+ /**
67
+ * 设置边框简单模式样式
68
+ * @param IStrokeOption
69
+ * @example
70
+ * setStrokeSimpleStyle({
71
+ color: "rgba(255, 255, 255,1)", //"#fff",
72
+ width: 2, //2,
73
+ lineDash:[10,10] 或null
74
+ })
75
+ */
76
+ setStrokeSimpleStyle(strokeStyleOption: IStrokeOption): void;
77
+ /**
78
+ * 设置边框图案填充模式样式,pattern与image 二选一,不用的需undefined,同时配置优先pattern
79
+ * @param IStrokeOption
80
+ * @example
81
+ * setStrokePatternStyle({
82
+ pattern: undefined,图案Enum:mirage2d.DataType.featureStyleType.caps
83
+ // image: undefined,
84
+ color: "rgba(255, 255, 0,1)",//背景色
85
+ width: 2,
86
+ lineDash: null,
87
+ ratio: 1,
88
+ patternColor: "rgba(0, 0, 0,1)",//图案颜色
89
+ offset: 0,
90
+ scale: 1,
91
+ size: 5,
92
+ spacing: 10,
93
+ angle: 0
94
+ })
95
+ */
96
+ setStrokePatternStyle(strokeStyleOption: IStrokeOption): void;
97
+ /**
98
+ * 设置填充简单模式样式 ,从图片模式转到普通模式时,需注意等图片加载完成后才可设置
99
+ * @param ITextOption
100
+ * @example
101
+ * setFillColor("rgba(255, 255, 255,1)")//"#fff"
102
+ */
103
+ setFillColor(color: string): void;
104
+ /**
105
+ * 设置多边形图案填充模式样式,pattern与image 二选一,不用的需undefined,同时配置优先pattern
106
+ * @param fillStyleOption
107
+ * @example
108
+ * setFillPatternStyle({
109
+ pattern: undefined,图案Enum:mirage2d.DataType.featureStyleType.caps
110
+ // image: undefined,
111
+ patternColor: "rgba(0, 0, 0,1)",//图案颜色
112
+ fill: "rgba(255, 255, 0,1)",//背景色
113
+ width: 2,
114
+ lineDash: null,
115
+ ratio: 1,
116
+ offset: 0,
117
+ scale: 1,
118
+ size: 5,
119
+ spacing: 10,
120
+ angle: 0
121
+ })
122
+ */
123
+ setFillPatternStyle(fillStyleOption: IFillOption): void;
124
+ /**
125
+ * 设置多边形图片填充模式样式,初始设置时当pattern==null或undefined 且image有值才能生效
126
+ * @param fillStyleOption
127
+ * @example
128
+ * setFillImageStyle(imageurl)
129
+ */
130
+ setFillImageStyle(imageUrl: string): void;
131
+ setZIndex(zindex: number): void;
132
+ getCoordinates(projection?: string): any;
133
+ getGraphicJson(projection?: string): {
134
+ type: string;
135
+ lnglat: any;
136
+ dataWkID: string;
137
+ style: any;
138
+ attribute: {
139
+ [x: string]: any;
140
+ };
141
+ };
21
142
  }
@@ -3,7 +3,7 @@ import { crsType } from "../Enum/typeEnum";
3
3
  import { IimagePointOption } from "../base/baseOptionType";
4
4
  export declare class ImagePointGraphic extends baseGraphic {
5
5
  constructor(options: IimagePointOption);
6
- getCoordinates(): import("ol/coordinate").Coordinate;
6
+ setPointIconStyle(imageOption: any): void;
7
7
  setCoordinates(lng: number, lat: number, dataWkID?: crsType): void;
8
8
  setRotation(angle: number): void;
9
9
  }
@@ -1,25 +1,7 @@
1
1
  import { baseGraphic } from "./baseGraphic";
2
2
  import { crsType } from "../Enum/typeEnum";
3
- import { ILabelOption, IPointStyle } from "../base/baseOptionType";
3
+ import { ILabelOption } from "../base/baseOptionType";
4
4
  export declare class LabelGraphic extends baseGraphic {
5
5
  constructor(options: ILabelOption);
6
- setLabelFont(font: string): void;
7
- setLabelColor(rgba: string): void;
8
- setLabelBackgroundFill(color: string): void;
9
- setLabelBackgroundStroke(width: number, color: string): void;
10
- setLabeloffsetXY(x: number, y: number): void;
11
- setLabelPadding(padding: Array<number>): void;
12
- setLabelTextBaseline(textBaseline: string): void;
13
- setLabelImage(opt: {
14
- scale?: number;
15
- rotation?: number;
16
- line?: {
17
- lineColor: string;
18
- lineWidth: number;
19
- };
20
- fillColor?: string;
21
- }): void;
22
- setLabelStyle(pointStyle: IPointStyle): void;
23
- getCoordinates(): import("ol/coordinate").Coordinate;
24
6
  setCoordinates(lng: number, lat: number, dataWkID?: crsType): void;
25
7
  }
@@ -3,6 +3,5 @@ import { crsType } from "../Enum/typeEnum";
3
3
  import { IPointOption } from "../base/baseOptionType";
4
4
  export declare class PointGraphic extends baseGraphic {
5
5
  constructor(options: IPointOption);
6
- getCoordinates(): import("ol/coordinate").Coordinate;
7
6
  setCoordinates(lng: number, lat: number, dataWkID?: crsType): void;
8
7
  }