@vitrosoftware/common-ui-ts 1.1.80 → 1.1.82

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrosoftware/common-ui-ts",
3
- "version": "1.1.80",
3
+ "version": "1.1.82",
4
4
  "description": "vitro software common ui ts",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -68,7 +68,8 @@
68
68
  "src/controls/PdfViewer/js/init-viewer-page.js",
69
69
  "src/controls/PdfViewer/js/pdf-viewer.js",
70
70
  "src/controls/BimViewer/js/init-viewer-page.js",
71
- "src/controls/BimViewer/js/bim-viewer.js"
71
+ "src/controls/BimViewer/js/bim-viewer.js",
72
+ "src/controls/BimViewer/js/bim-viewer-models.js"
72
73
  ],
73
74
  "dependencies": {
74
75
  "rollup-plugin-postcss": "^3.1.3",
@@ -0,0 +1,361 @@
1
+ var BIMCommon = BIMCommon ||
2
+ {
3
+ FileItemId: undefined,
4
+ FileVersion: undefined,
5
+
6
+ GetFileItem: function (itemId, version, callback, error) {
7
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
8
+
9
+ jQuery.ajax({
10
+ type: "GET",
11
+ url: webRelativeUrl +
12
+ "/bimViewer/api/Model/Get/" +
13
+ itemId + "/" +
14
+ version,
15
+ cache: false,
16
+ contentType: "application/json",
17
+ error: function (jqXHR, textStatus, errorThrown) {
18
+ if (error) {
19
+ error();
20
+ }
21
+ },
22
+ success: function(modelId, status, jqXHR) {
23
+ if (callback) {
24
+ callback(modelId);
25
+ }
26
+ }
27
+ });
28
+ },
29
+
30
+ GetURLParameter: function(sParam) {
31
+ var sPageURL = window.location.search.substring(1);
32
+
33
+ var sURLVariables = sPageURL.split("&");
34
+ for (var i = 0; i < sURLVariables.length; i++) {
35
+ var sParameterName = sURLVariables[i].split("=");
36
+ if (sParameterName[0] == sParam) {
37
+ return sParameterName[1];
38
+ }
39
+ }
40
+ },
41
+
42
+ CreateWebServerUrl: function() {
43
+ var path = window.location.pathname;
44
+ var idx = path.indexOf("/bimViewer");
45
+
46
+ return path.substring(0, idx);
47
+ }
48
+ }
49
+
50
+ var BIMAnnotation = BIMAnnotation ||
51
+ {
52
+ GetNote: function (callback) {
53
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
54
+ $.ajax({
55
+ type: "POST",
56
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Get",
57
+ data: JSON.stringify(BIMCommon.FileItem),
58
+ contentType: "application/json; charset=utf-8",
59
+ dataType: "json",
60
+ async: false,
61
+ beforeSend: function (data) {
62
+ },
63
+ error: function (jqXHR, textStatus, errorThrown) {
64
+ },
65
+ success: function (data, status, jqXHR) {
66
+ if (callback) {
67
+ callback(data);
68
+ }
69
+ }
70
+ });
71
+ },
72
+
73
+ SaveNote: function (options, callback) {
74
+
75
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
76
+
77
+ var annotation = {};
78
+ annotation.FileItem = BIMCommon.FileItem;
79
+
80
+ annotation.Comment = BIMAnnotation.CreateComment(options.values.title, options.values.description);
81
+
82
+ options.worldPos = [];
83
+ options.worldPos.push(options.pickResult._worldPos[0]);
84
+ options.worldPos.push(options.pickResult._worldPos[1]);
85
+ options.worldPos.push(options.pickResult._worldPos[2]);
86
+
87
+ var eye = options.eye;
88
+ options.eye = [];
89
+ options.eye.push(eye[0]);
90
+ options.eye.push(eye[1]);
91
+ options.eye.push(eye[2]);
92
+
93
+ var look = options.look;
94
+ options.look = [];
95
+ options.look.push(look[0]);
96
+ options.look.push(look[1]);
97
+ options.look.push(look[2]);
98
+
99
+ var up = options.up;
100
+ options.up = [];
101
+ options.up.push(up[0]);
102
+ options.up.push(up[1]);
103
+ options.up.push(up[2]);
104
+
105
+ var pickResult = options.pickResult;
106
+ options.pickResult = null;
107
+
108
+ annotation.AnnotationInfo = options;
109
+ var jsonString = JSON.stringify(annotation);
110
+
111
+ $.ajax({
112
+ type: "POST",
113
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Create",
114
+ data: jsonString,
115
+ contentType: "application/json; charset=utf-8",
116
+ dataType: "json",
117
+ async: false,
118
+ beforeSend: function (data) {
119
+ },
120
+ error: function (jqXHR, textStatus, errorThrown) {
121
+ },
122
+ success: function (data, status, jqXHR) {
123
+ if (callback) {
124
+ options.id = data;
125
+ options.values.glyph = options.id;
126
+ options.pickResult = pickResult;
127
+ callback(options);
128
+ }
129
+ }
130
+ });
131
+ },
132
+
133
+ UpdateNote: function (id, noteTitle, noteDesc, callback) {
134
+
135
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
136
+
137
+ var annotation = {};
138
+ annotation.Id = id;
139
+ annotation.FileItem = BIMCommon.FileItem;
140
+ annotation.Comment = BIMAnnotation.CreateComment(noteTitle, noteDesc);
141
+ var jsonString = JSON.stringify(annotation);
142
+
143
+ $.ajax({
144
+ type: "POST",
145
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Update",
146
+ data: jsonString,
147
+ contentType: "application/json; charset=utf-8",
148
+ dataType: "json",
149
+ async: false,
150
+ beforeSend: function (data) {
151
+ },
152
+ error: function (jqXHR, textStatus, errorThrown) {
153
+ },
154
+ success: function (data, status, jqXHR) {
155
+ if (callback) {
156
+ callback();
157
+ }
158
+ }
159
+ });
160
+ },
161
+
162
+ DeleteNote: function (id, callback) {
163
+
164
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
165
+
166
+ var annotation = {};
167
+ annotation.Id = id;
168
+ annotation.FileItem = BIMCommon.FileItem;
169
+ var jsonString = JSON.stringify(annotation);
170
+
171
+ $.ajax({
172
+ type: "POST",
173
+ url: webRelativeUrl + "/_vti_bin/Vitro/TableView/Comment/AnnotationWebService.svc/Delete",
174
+ data: jsonString,
175
+ contentType: "application/json; charset=utf-8",
176
+ dataType: "json",
177
+ async: false,
178
+ beforeSend: function (data) {
179
+ },
180
+ error: function (jqXHR, textStatus, errorThrown) {
181
+ },
182
+ success: function (data, status, jqXHR) {
183
+ if (callback) {
184
+ callback(id);
185
+ }
186
+ }
187
+ });
188
+ },
189
+
190
+ GoToCommentList: function(id) {
191
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
192
+ window.open(webRelativeUrl + '/_layouts/15/Vitro/TableView/ListView.aspx?List=CommentList&listname=%D0%97%D0%B0%D0%BC%D0%B5%D1%87%D0%B0%D0%BD%D0%B8%D1%8F&Id=' + id);
193
+ },
194
+
195
+ CreateComment: function(title, description) {
196
+ var text = [title, description].filter(Boolean).join(" ");
197
+ return text;
198
+ }
199
+ }
200
+
201
+
202
+ var BIMModel = BIMModel ||
203
+ {
204
+
205
+ GetParentIdList: function (elementId, recurse, isGeometry, callback, error, async = true) {
206
+
207
+ var paramObj = {};
208
+ paramObj.itemId = BIMCommon.FileItemId;
209
+ paramObj.version = BIMCommon.FileVersion;
210
+ paramObj.elementId = elementId.toString();
211
+
212
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
213
+ $.ajax({
214
+ type: "POST",
215
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetParentIdList",
216
+ data: JSON.stringify(paramObj),
217
+ contentType: "application/json; charset=utf-8",
218
+ dataType: "json",
219
+ async: async,
220
+ beforeSend: function (data) {
221
+ },
222
+ error: function (jqXHR, textStatus, errorThrown) {
223
+ if (error) {
224
+ error(jqXHR, textStatus, errorThrown);
225
+ }
226
+ },
227
+ success: function (data, status, jqXHR) {
228
+ //console.log(data);
229
+ if (callback) {
230
+ callback(data);
231
+ }
232
+ }
233
+ });
234
+ },
235
+
236
+ GetPropertyList: function (elementId, callback, error, async = true) {
237
+ var paramObj = {};
238
+ paramObj.itemId = BIMCommon.FileItemId;
239
+ paramObj.version = BIMCommon.FileVersion;
240
+ paramObj.elementId = elementId.toString();
241
+
242
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
243
+ $.ajax({
244
+ type: "POST",
245
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetPropertyList",
246
+ data: JSON.stringify(paramObj),
247
+ contentType: "application/json; charset=utf-8",
248
+ dataType: "json",
249
+ async: async,
250
+ beforeSend: function (data) {
251
+ },
252
+ error: function (jqXHR, textStatus, errorThrown) {
253
+ if (error) {
254
+ error(jqXHR, textStatus, errorThrown);
255
+ }
256
+ },
257
+ success: function (data, status, jqXHR) {
258
+ //console.log(data);
259
+ if (callback) {
260
+ callback(data);
261
+ }
262
+ }
263
+ });
264
+ },
265
+
266
+ GetChildList: function (elementId, recurse, isGeometry, callback, error, async = true) {
267
+
268
+ var paramObj = {};
269
+ paramObj.itemId = BIMCommon.FileItemId;
270
+ paramObj.version = BIMCommon.FileVersion;
271
+ paramObj.elementId = elementId.toString();
272
+ paramObj.recurse = recurse;
273
+ paramObj.isGeometry = isGeometry;
274
+
275
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
276
+ $.ajax({
277
+ type: "POST",
278
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetChildList",
279
+ data: JSON.stringify(paramObj),
280
+ contentType: "application/json; charset=utf-8",
281
+ dataType: "json",
282
+ async: async,
283
+ beforeSend: function (data) {
284
+ },
285
+ error: function (jqXHR, textStatus, errorThrown) {
286
+ if (error) {
287
+ error(jqXHR, textStatus, errorThrown);
288
+ }
289
+ },
290
+ success: function (data, status, jqXHR) {
291
+ //console.log(data);
292
+ if (callback) {
293
+ callback(data);
294
+ }
295
+ }
296
+ });
297
+ },
298
+
299
+ GetChildIdList: function (elementId, recurse, isGeometry, callback, error, async = true) {
300
+
301
+ var paramObj = {};
302
+ paramObj.itemId = BIMCommon.FileItemId;
303
+ paramObj.version = BIMCommon.FileVersion;
304
+ paramObj.elementId = elementId.toString();
305
+ paramObj.recurse = recurse;
306
+ paramObj.isGeometry = isGeometry;
307
+
308
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
309
+ $.ajax({
310
+ type: "POST",
311
+ url: webRelativeUrl + "/bimViewer/api/ModelElement/GetChildIdList",
312
+ data: JSON.stringify(paramObj),
313
+ contentType: "application/json; charset=utf-8",
314
+ dataType: "json",
315
+ async: async,
316
+ beforeSend: function (data) {
317
+ },
318
+ error: function (jqXHR, textStatus, errorThrown) {
319
+ if (error) {
320
+ error(jqXHR, textStatus, errorThrown);
321
+ }
322
+ },
323
+ success: function (data, status, jqXHR) {
324
+ //console.log(data);
325
+ if (callback) {
326
+ callback(data);
327
+ }
328
+ }
329
+ });
330
+ },
331
+
332
+ Compare: function (successFn, failFn) {
333
+
334
+ var webRelativeUrl = BIMCommon.CreateWebServerUrl();
335
+
336
+ var obj = {};
337
+ obj.source = window.model1DataUrl;
338
+ obj.compared = window.model2DataUrl;
339
+ var jsonString = JSON.stringify(obj);
340
+
341
+ $.ajax({
342
+ type: "POST",
343
+ url: webRelativeUrl + "/_vti_bin/Vitro/Viewer/BIM/BIMWebService.svc/CompareModel",
344
+ data: jsonString,
345
+ contentType: "application/json; charset=utf-8",
346
+ dataType: "json",
347
+ async: false,
348
+ beforeSend: function (data) {
349
+ },
350
+ error: function (jqXHR, textStatus, errorThrown) {
351
+ failFn();
352
+ },
353
+ success: function (data, status, jqXHR) {
354
+ if (successFn) {
355
+ successFn(data);
356
+ }
357
+ }
358
+ });
359
+ }
360
+ }
361
+ export {BIMCommon, BIMAnnotation, BIMModel}