@inweb/client 25.3.8 → 25.3.10

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,7 +1,5 @@
1
1
  import { EventEmitter2 } from "../Viewer/EventEmitter2";
2
2
  import { ClientEventMap } from "./ClientEvents";
3
- import { Options } from "../Viewer/Options";
4
- import { OptionsEventMap } from "../Viewer/OptionsEvents";
5
3
  import { Assembly } from "./Assembly";
6
4
  import { File } from "./File";
7
5
  import { Job } from "./Job";
@@ -12,8 +10,7 @@ import { User } from "./User";
12
10
  * Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server) resources like
13
11
  * Projects, Files, Issues etc.
14
12
  */
15
- export declare class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
16
- private _options;
13
+ export declare class Client extends EventEmitter2<ClientEventMap> {
17
14
  private _serverUrl;
18
15
  private _httpClient;
19
16
  private _user;
@@ -33,10 +30,10 @@ export declare class Client extends EventEmitter2<ClientEventMap & OptionsEventM
33
30
  */
34
31
  get serverUrl(): string;
35
32
  /**
36
- * `VisualizeJS` parameters. Changes to these parameters are automatically applied to
37
- * `Viewer` instances associated with that client.
33
+ * Deprecated since `25.3`. Use [Viewer.options]{@link Viewer#options} instead to change
34
+ * Viewer parameters.
38
35
  */
39
- get options(): Options;
36
+ get options(): any;
40
37
  /**
41
38
  * Change the client configuration parameters.
42
39
  *
@@ -223,7 +220,7 @@ export declare class Client extends EventEmitter2<ClientEventMap & OptionsEventM
223
220
  * @param params - An object containing upload parameters.
224
221
  * @param params.geometry=true - Create job to extract file geometry data. Can be:
225
222
  *
226
- * - `true` - Extract file geometry data into type, defined by [options]{@link Client#options}.
223
+ * - `true` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
227
224
  * - `vsfx` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
228
225
  * - `gltf` - Extract file geometry data into `glTF` to open the file in `Three.js` viewer.
229
226
  *
@@ -7,10 +7,10 @@ export declare class KonvaCloud implements IMarkupCloud, IMarkupColorable {
7
7
  x: number;
8
8
  y: number;
9
9
  };
10
- width: number;
11
- height: number;
12
- lineWidth: number;
13
- color: string;
10
+ width?: number;
11
+ height?: number;
12
+ lineWidth?: number;
13
+ color?: string;
14
14
  id?: string;
15
15
  }, ref?: any);
16
16
  ref(): import("konva/lib/Shape").Shape<import("konva/lib/Shape").ShapeConfig>;
@@ -11,8 +11,8 @@ export declare class KonvaEllipse implements IMarkupEllipse, IMarkupColorable {
11
11
  x: number;
12
12
  y: number;
13
13
  };
14
- color: string;
15
14
  lineWidth?: number;
15
+ color?: string;
16
16
  id?: string;
17
17
  }, ref?: any);
18
18
  getPosition(): {
@@ -8,9 +8,9 @@ export declare class KonvaLine implements IMarkupLine, IMarkupColorable {
8
8
  x: number;
9
9
  y: number;
10
10
  }[];
11
- color: string;
12
- type: LineType;
13
- width: number;
11
+ type?: LineType;
12
+ width?: number;
13
+ color?: string;
14
14
  id?: string;
15
15
  }, ref?: any);
16
16
  ref(): import("konva/lib/shapes/Line").Line<import("konva/lib/shapes/Line").LineConfig>;
@@ -7,10 +7,10 @@ export declare class KonvaRectangle implements IMarkupRectangle, IMarkupColorabl
7
7
  x: number;
8
8
  y: number;
9
9
  };
10
- color: string;
11
- lineWidth: number;
12
- width: number;
13
- height: number;
10
+ width?: number;
11
+ height?: number;
12
+ lineWidth?: number;
13
+ color?: string;
14
14
  id?: string;
15
15
  }, ref?: any);
16
16
  getPosition(): {
@@ -9,9 +9,9 @@ export declare class KonvaText implements IMarkupText, IMarkupColorable {
9
9
  y: number;
10
10
  };
11
11
  text: string;
12
- fontSize: number;
13
- color: string;
14
- rotation: number;
12
+ rotation?: number;
13
+ fontSize?: number;
14
+ color?: string;
15
15
  id?: string;
16
16
  }, ref?: any);
17
17
  ref(): import("konva/lib/shapes/Text").Text;
@@ -40,58 +40,58 @@ export interface IPerspectiveCamera {
40
40
  export type LineType = "solid" | "dot" | "dash";
41
41
  export interface ILine {
42
42
  points: IPoint[];
43
- color: string;
44
- type: LineType;
45
- width: number;
46
- id: string;
43
+ type?: LineType;
44
+ width?: number;
45
+ color?: string;
46
+ id?: string;
47
47
  }
48
48
  export interface IText {
49
49
  position: IPoint;
50
50
  text: string;
51
- angle: number;
52
- text_size: number;
53
- color: string;
54
- id: string;
55
- font_size: number;
51
+ angle?: number;
52
+ font_size?: number;
53
+ text_size?: number;
54
+ color?: string;
55
+ id?: string;
56
56
  }
57
57
  export interface IArrow {
58
- id: string;
59
58
  start: IPoint;
60
59
  end: IPoint;
61
- color: string;
60
+ color?: string;
61
+ id?: string;
62
62
  }
63
63
  export interface ICloud {
64
- id: string;
65
64
  position: IPoint;
66
- width: number;
67
- height: number;
68
- line_width: number;
69
- color: string;
65
+ width?: number;
66
+ height?: number;
67
+ line_width?: number;
68
+ color?: string;
69
+ id?: string;
70
70
  }
71
71
  export interface IEllipse {
72
- id: string;
73
72
  position: IPoint;
74
73
  radius: {
75
74
  x: number;
76
75
  y: number;
77
76
  };
78
- line_width: number;
79
- color: string;
77
+ line_width?: number;
78
+ color?: string;
79
+ id?: string;
80
80
  }
81
81
  export interface IImage {
82
- id: string;
83
82
  position: IPoint;
84
83
  src: string;
85
84
  width: number;
86
85
  height: number;
86
+ id?: string;
87
87
  }
88
88
  export interface IRectangle {
89
- id: string;
90
89
  position: IPoint;
91
- width: number;
92
- height: number;
93
- line_width: number;
94
- color: string;
90
+ width?: number;
91
+ height?: number;
92
+ line_width?: number;
93
+ color?: string;
94
+ id?: string;
95
95
  }
96
96
  export interface IColoring {
97
97
  handle: string;
@@ -100,10 +100,13 @@ export interface IColoring {
100
100
  export interface IEntity {
101
101
  handle: string;
102
102
  }
103
+ export interface ISnapshot {
104
+ data: string;
105
+ }
103
106
  export interface IViewpoint {
104
107
  bitmaps?: IBitmap[];
105
108
  guid?: string;
106
- file_id: string;
109
+ file_id?: string;
107
110
  assembly_id?: string;
108
111
  orthogonal_camera?: IOrthogonalCamera;
109
112
  perspective_camera?: IPerspectiveCamera;
@@ -121,5 +124,6 @@ export interface IViewpoint {
121
124
  images?: IImage[];
122
125
  rectangles?: IRectangle[];
123
126
  custom_fields?: any;
127
+ snapshot?: ISnapshot;
124
128
  }
125
129
  //# sourceMappingURL=IViewpoint.d.ts.map
@@ -25,7 +25,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
25
25
  protected _options: Options;
26
26
  protected _visualizeJsUrl: string;
27
27
  protected _abortControllerForReferences: AbortController | undefined;
28
- private clientoptionschange;
29
28
  private canvaseventlistener;
30
29
  draggerFactory: Map<string, typeof OdBaseDragger>;
31
30
  canvasEvents: string[];
@@ -58,11 +57,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & OptionsEventM
58
57
  });
59
58
  /**
60
59
  * `VisualizeJS` parameters.
61
- *
62
- * Use this only for standalone viewer instances. Use {@link Client#options | Client.options}
63
- * instead if the viewer was created with a `Client` reference using
64
- * {@link Viewer | Viewer.create(client)}. Changes in client options will be automatically
65
- * applied to the viewer options.
66
60
  */
67
61
  get options(): Options;
68
62
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/client",
3
- "version": "25.3.8",
3
+ "version": "25.3.10",
4
4
  "description": "Client.js is a library for implementing BIM Project management applications.",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
package/src/Api/Client.ts CHANGED
@@ -25,8 +25,6 @@ import { EventEmitter2 } from "../Viewer/EventEmitter2";
25
25
  import { IHttpClient } from "./IHttpClient";
26
26
  import { HttpClient } from "./HttpClient";
27
27
  import { ClientEventMap } from "./ClientEvents";
28
- import { Options } from "../Viewer/Options";
29
- import { OptionsEventMap } from "../Viewer/OptionsEvents";
30
28
  import { Assembly } from "./Assembly";
31
29
  import { File } from "./File";
32
30
  import { Job } from "./Job";
@@ -39,8 +37,7 @@ import { downloadProgress, json, text, parseArgs } from "./impl/Utils";
39
37
  * Server](https://cloud.opendesign.com/docs/index.html#/opencloud_server) resources like
40
38
  * Projects, Files, Issues etc.
41
39
  */
42
- export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
43
- private _options: Options;
40
+ export class Client extends EventEmitter2<ClientEventMap> {
44
41
  private _serverUrl: string;
45
42
 
46
43
  private _httpClient: IHttpClient;
@@ -56,7 +53,6 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
56
53
  super();
57
54
  this.configure(params);
58
55
  this.eventEmitter = this;
59
- this._options = new Options(this);
60
56
  this._user = null;
61
57
  }
62
58
 
@@ -70,11 +66,47 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
70
66
  }
71
67
 
72
68
  /**
73
- * `VisualizeJS` parameters. Changes to these parameters are automatically applied to
74
- * `Viewer` instances associated with that client.
75
- */
76
- get options(): Options {
77
- return this._options;
69
+ * Deprecated since `25.3`. Use [Viewer.options]{@link Viewer#options} instead to change
70
+ * Viewer parameters.
71
+ */
72
+ get options(): any {
73
+ console.warn(
74
+ "Client.options has been deprecated since 25.3 and will be removed in a future release, use Viewer.options instead."
75
+ );
76
+ const data = {
77
+ showWCS: true,
78
+ cameraAnimation: true,
79
+ antialiasing: true,
80
+ groundShadow: false,
81
+ shadows: false,
82
+ cameraAxisXSpeed: 4,
83
+ cameraAxisYSpeed: 1,
84
+ ambientOcclusion: false,
85
+ enableStreamingMode: true,
86
+ enablePartialMode: false,
87
+ memoryLimit: 3294967296,
88
+ cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
89
+ edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
90
+ facesColor: { r: 0xff, g: 0x98, b: 0x00 },
91
+ edgesVisibility: true,
92
+ edgesOverlap: true,
93
+ facesOverlap: false,
94
+ facesTransparancy: 200,
95
+ enableCustomHighlight: true,
96
+ sceneGraph: false,
97
+ edgeModel: true,
98
+ reverseZoomWheel: false,
99
+ enableZoomWheel: true,
100
+ enableGestures: true,
101
+ };
102
+ return {
103
+ ...data,
104
+ data,
105
+ defaults: () => data,
106
+ resetToDefaults: () => {},
107
+ saveToStorage: () => {},
108
+ loadFromStorage: () => {},
109
+ };
78
110
  }
79
111
 
80
112
  /**
@@ -402,7 +434,7 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
402
434
  * @param params - An object containing upload parameters.
403
435
  * @param params.geometry=true - Create job to extract file geometry data. Can be:
404
436
  *
405
- * - `true` - Extract file geometry data into type, defined by [options]{@link Client#options}.
437
+ * - `true` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
406
438
  * - `vsfx` - Extract file geometry data into `VSFX` to open the file in `VisualizeJS` viewer.
407
439
  * - `gltf` - Extract file geometry data into `glTF` to open the file in `Three.js` viewer.
408
440
  *
@@ -441,7 +473,7 @@ export class Client extends EventEmitter2<ClientEventMap & OptionsEventMap> {
441
473
  .then((xhr: XMLHttpRequest) => JSON.parse(xhr.responseText))
442
474
  .then((data) => new File(data, this._httpClient));
443
475
 
444
- const geometryType = typeof params.geometry === "string" ? params.geometry : this.options.geometryType;
476
+ const geometryType = typeof params.geometry === "string" ? params.geometry : "vsfx";
445
477
 
446
478
  const jobs: string[] = [];
447
479
  if (params.geometry) jobs.push((await result.extractGeometry(geometryType)).outputFormat);
@@ -8,10 +8,10 @@ export class KonvaCloud implements IMarkupCloud, IMarkupColorable {
8
8
  constructor(
9
9
  params: {
10
10
  position: { x: number; y: number };
11
- width: number;
12
- height: number;
13
- lineWidth: number;
14
- color: string;
11
+ width?: number;
12
+ height?: number;
13
+ lineWidth?: number;
14
+ color?: string;
15
15
  id?: string;
16
16
  },
17
17
  ref = null
@@ -9,8 +9,8 @@ export class KonvaEllipse implements IMarkupEllipse, IMarkupColorable {
9
9
  params: {
10
10
  position: { x: number; y: number };
11
11
  radius: { x: number; y: number };
12
- color: string;
13
12
  lineWidth?: number;
13
+ color?: string;
14
14
  id?: string;
15
15
  },
16
16
  ref = null
@@ -13,7 +13,7 @@ export class KonvaLine implements IMarkupLine, IMarkupColorable {
13
13
  private _ref: Konva.Line;
14
14
 
15
15
  constructor(
16
- params: { points: { x: number; y: number }[]; color: string; type: LineType; width: number; id?: string },
16
+ params: { points: { x: number; y: number }[]; type?: LineType; width?: number; color?: string; id?: string },
17
17
  ref = null
18
18
  ) {
19
19
  if (ref) {
@@ -8,10 +8,10 @@ export class KonvaRectangle implements IMarkupRectangle, IMarkupColorable {
8
8
  constructor(
9
9
  params: {
10
10
  position: { x: number; y: number };
11
- color: string;
12
- lineWidth: number;
13
- width: number;
14
- height: number;
11
+ width?: number;
12
+ height?: number;
13
+ lineWidth?: number;
14
+ color?: string;
15
15
  id?: string;
16
16
  },
17
17
  ref = null
@@ -31,8 +31,8 @@ export class KonvaRectangle implements IMarkupRectangle, IMarkupColorable {
31
31
  lineJoin: "round",
32
32
  x: params.position.x,
33
33
  y: params.position.y,
34
- width: params.width,
35
- height: params.height,
34
+ width: params.width ?? 200,
35
+ height: params.height ?? 200,
36
36
  draggable: true,
37
37
  strokeScaleEnabled: false,
38
38
  });
@@ -10,9 +10,9 @@ export class KonvaText implements IMarkupText, IMarkupColorable {
10
10
  params: {
11
11
  position: { x: number; y: number };
12
12
  text: string;
13
- fontSize: number;
14
- color: string;
15
- rotation: number;
13
+ rotation?: number;
14
+ fontSize?: number;
15
+ color?: string;
16
16
  id?: string;
17
17
  },
18
18
  ref = null
@@ -48,64 +48,64 @@ export type LineType = "solid" | "dot" | "dash";
48
48
 
49
49
  export interface ILine {
50
50
  points: IPoint[];
51
- color: string;
52
- type: LineType;
53
- width: number;
54
- id: string;
51
+ type?: LineType;
52
+ width?: number;
53
+ color?: string;
54
+ id?: string;
55
55
  }
56
56
 
57
57
  export interface IText {
58
58
  position: IPoint;
59
59
  text: string;
60
- angle: number;
61
- text_size: number;
62
- color: string;
63
- id: string;
64
- font_size: number;
60
+ angle?: number;
61
+ font_size?: number;
62
+ text_size?: number;
63
+ color?: string;
64
+ id?: string;
65
65
  }
66
66
 
67
67
  export interface IArrow {
68
- id: string;
69
68
  start: IPoint;
70
69
  end: IPoint;
71
- color: string;
70
+ color?: string;
71
+ id?: string;
72
72
  }
73
73
 
74
74
  export interface ICloud {
75
- id: string;
76
75
  position: IPoint;
77
- width: number;
78
- height: number;
79
- line_width: number;
80
- color: string;
76
+ width?: number;
77
+ height?: number;
78
+ line_width?: number;
79
+ color?: string;
80
+ id?: string;
81
81
  }
82
82
 
83
83
  export interface IEllipse {
84
- id: string;
85
84
  position: IPoint;
86
85
  radius: {
87
86
  x: number;
88
87
  y: number;
89
88
  };
90
- line_width: number;
91
- color: string;
89
+ line_width?: number;
90
+ color?: string;
91
+ id?: string;
92
92
  }
93
93
 
94
94
  export interface IImage {
95
- id: string;
96
95
  position: IPoint;
97
96
  src: string;
98
97
  width: number;
99
98
  height: number;
99
+ id?: string;
100
100
  }
101
101
 
102
102
  export interface IRectangle {
103
- id: string;
104
103
  position: IPoint;
105
- width: number;
106
- height: number;
107
- line_width: number;
108
- color: string;
104
+ width?: number;
105
+ height?: number;
106
+ line_width?: number;
107
+ color?: string;
108
+ id?: string;
109
109
  }
110
110
 
111
111
  export interface IColoring {
@@ -117,10 +117,14 @@ export interface IEntity {
117
117
  handle: string;
118
118
  }
119
119
 
120
+ export interface ISnapshot {
121
+ data: string;
122
+ }
123
+
120
124
  export interface IViewpoint {
121
125
  bitmaps?: IBitmap[];
122
126
  guid?: string;
123
- file_id: string;
127
+ file_id?: string;
124
128
  assembly_id?: string;
125
129
  orthogonal_camera?: IOrthogonalCamera;
126
130
  perspective_camera?: IPerspectiveCamera;
@@ -138,4 +142,5 @@ export interface IViewpoint {
138
142
  images?: IImage[];
139
143
  rectangles?: IRectangle[];
140
144
  custom_fields?: any;
145
+ snapshot?: ISnapshot;
141
146
  }
@@ -243,10 +243,10 @@ export class KonvaMarkup implements IMarkup {
243
243
  }
244
244
 
245
245
  getViewpoint(): IViewpoint {
246
- // TODO: at the current 25.2 state we need VisualizeJS here and below. In the future we need to use it as an external interface
247
- if (!this._viewer.visualizeJs) return { file_id: "" };
246
+ // TODO: at the current 25.2 state we need VisualizeJS here and below. In the future we need to use it as an external interface.
247
+ if (!this._viewer.visualizeJs) return {};
248
248
 
249
- const viewpoint = {
249
+ const viewpoint: IViewpoint = {
250
250
  lines: [],
251
251
  texts: [],
252
252
  arrows: [],
@@ -254,7 +254,7 @@ export class KonvaMarkup implements IMarkup {
254
254
  ellipses: [],
255
255
  images: [],
256
256
  rectangles: [],
257
- } as any;
257
+ };
258
258
 
259
259
  viewpoint.snapshot = {
260
260
  data: this.combineMarkupWithDrawing(),
@@ -931,9 +931,9 @@ export class KonvaMarkup implements IMarkup {
931
931
 
932
932
  const konvaLine = new KonvaLine({
933
933
  points,
934
- color: color || this._markupColor.HexColor,
935
934
  type: type || "solid",
936
935
  width: width || this.lineWidth,
936
+ color: color || this._markupColor.HexColor,
937
937
  id,
938
938
  });
939
939
 
@@ -1009,9 +1009,9 @@ export class KonvaMarkup implements IMarkup {
1009
1009
  const konvaText = new KonvaText({
1010
1010
  position: { x: position.x, y: position.y },
1011
1011
  text: specifiedText,
1012
+ rotation: angle,
1012
1013
  fontSize,
1013
1014
  color: color || this._markupColor.HexColor,
1014
- rotation: angle,
1015
1015
  id,
1016
1016
  });
1017
1017
 
@@ -1042,10 +1042,10 @@ export class KonvaMarkup implements IMarkup {
1042
1042
 
1043
1043
  const konvaRectangle = new KonvaRectangle({
1044
1044
  position,
1045
- color: color || this._markupColor.HexColor,
1046
- lineWidth: lineWidth || this.lineWidth,
1047
1045
  width,
1048
1046
  height,
1047
+ lineWidth: lineWidth || this.lineWidth,
1048
+ color: color || this._markupColor.HexColor,
1049
1049
  id,
1050
1050
  });
1051
1051
 
@@ -4,7 +4,7 @@ import { OdBaseDragger } from "../../../Draggers/Common/OdBaseDragger";
4
4
  import { MARKUP_ENTITY_LINE, OdaLineDragger } from "../../../Draggers/OdaLineDragger";
5
5
  import { MARKUP_ENTITY_TEXT, OdaTextDragger } from "../../../Draggers/OdaTextDragger";
6
6
  import { IMarkupObject } from "../../Api/IMarkupObject";
7
- import { IViewpoint } from "../../IViewpoint";
7
+ import { ILine, IText, IViewpoint } from "../../IViewpoint";
8
8
 
9
9
  export class VisualizeMarkup implements IMarkup {
10
10
  private _viewer: Viewer;
@@ -133,15 +133,15 @@ export class VisualizeMarkup implements IMarkup {
133
133
  return { x: array[0], y: array[1], z: array[2] };
134
134
  }
135
135
 
136
- if (!this._viewer.visualizeJs) return { file_id: "" };
136
+ if (!this._viewer.visualizeJs) return {};
137
137
 
138
138
  const visLib = this._viewer.visLib();
139
139
  const visViewer = visLib.getViewer();
140
140
 
141
- const viewpoint = {
141
+ const viewpoint: IViewpoint = {
142
142
  lines: [],
143
143
  texts: [],
144
- } as any;
144
+ };
145
145
 
146
146
  const model = visViewer.getMarkupModel();
147
147
  const itr = model.getEntitiesIterator();
@@ -162,7 +162,7 @@ export class VisualizeMarkup implements IMarkup {
162
162
  const polylinePtr = geometryId.openAsPolyline();
163
163
  const points = polylinePtr.getPoints();
164
164
 
165
- const line = {
165
+ const line: ILine = {
166
166
  points: [],
167
167
  };
168
168
  for (const point of points) {
@@ -175,7 +175,7 @@ export class VisualizeMarkup implements IMarkup {
175
175
  const textPtr = geometryId.openAsText();
176
176
  const position = textPtr.getPosition();
177
177
 
178
- const text = {
178
+ const text: IText = {
179
179
  position: getLogicalPoint3dFromArray(position),
180
180
  text: textPtr.getString(),
181
181
  angle: textPtr.getRotation(),