@2112-lab/central-plant 0.1.6 → 0.1.7

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.
@@ -59,29 +59,41 @@ var Export = /*#__PURE__*/function () {
59
59
  includeCustomExtensions: false
60
60
  }, options);
61
61
  _t = format.toLowerCase();
62
- _context.n = _t === 'gltf' ? 2 : _t === 'glb' ? 2 : _t === 'obj' ? 4 : _t === 'stl' ? 6 : 8;
62
+ _context.n = _t === 'gltf' ? 2 : _t === 'glb' ? 2 : _t === 'obj' ? 4 : _t === 'stl' ? 6 : _t === 'ply' ? 8 : _t === 'dae' ? 10 : 12;
63
63
  break;
64
64
  case 2:
65
65
  _context.n = 3;
66
66
  return this.exportGLTF(object, exportOptions);
67
67
  case 3:
68
68
  result = _context.v;
69
- return _context.a(3, 9);
69
+ return _context.a(3, 13);
70
70
  case 4:
71
71
  _context.n = 5;
72
72
  return this.exportOBJ(object, exportOptions);
73
73
  case 5:
74
74
  result = _context.v;
75
- return _context.a(3, 9);
75
+ return _context.a(3, 13);
76
76
  case 6:
77
77
  _context.n = 7;
78
78
  return this.exportSTL(object, exportOptions);
79
79
  case 7:
80
80
  result = _context.v;
81
- return _context.a(3, 9);
81
+ return _context.a(3, 13);
82
82
  case 8:
83
- throw new Error("Unsupported format: ".concat(format));
83
+ _context.n = 9;
84
+ return this.exportPLY(object, exportOptions);
84
85
  case 9:
86
+ result = _context.v;
87
+ return _context.a(3, 13);
88
+ case 10:
89
+ _context.n = 11;
90
+ return this.exportCollada(object, exportOptions);
91
+ case 11:
92
+ result = _context.v;
93
+ return _context.a(3, 13);
94
+ case 12:
95
+ throw new Error("Unsupported format: ".concat(format));
96
+ case 13:
85
97
  exportTime = performance.now() - startTime;
86
98
  exportRecord = {
87
99
  timestamp: new Date().toISOString(),
@@ -99,8 +111,8 @@ var Export = /*#__PURE__*/function () {
99
111
  exportTime: exportTime,
100
112
  filename: this.generateFilename(object.name || 'model', format)
101
113
  });
102
- case 10:
103
- _context.p = 10;
114
+ case 14:
115
+ _context.p = 14;
104
116
  _t2 = _context.v;
105
117
  _exportTime = performance.now() - startTime;
106
118
  _exportRecord = {
@@ -115,10 +127,10 @@ var Export = /*#__PURE__*/function () {
115
127
  this.exportHistory.push(_exportRecord);
116
128
  logger.error("\u274C Failed to export model to ".concat(format.toUpperCase(), ":"), _t2);
117
129
  throw _t2;
118
- case 11:
130
+ case 15:
119
131
  return _context.a(2);
120
132
  }
121
- }, _callee, this, [[1, 10]]);
133
+ }, _callee, this, [[1, 14]]);
122
134
  }));
123
135
  function exportModel(_x, _x2) {
124
136
  return _exportModel.apply(this, arguments);
@@ -243,6 +255,36 @@ var Export = /*#__PURE__*/function () {
243
255
  }
244
256
  return exportPLY;
245
257
  }()
258
+ /**
259
+ * Export to Collada (DAE) format
260
+ * @param {THREE.Object3D} object - Object to export
261
+ * @param {Object} options - Export options
262
+ * @returns {Promise<string>} Collada XML string
263
+ */
264
+ )
265
+ }, {
266
+ key: "exportCollada",
267
+ value: (function () {
268
+ var _exportCollada = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(object) {
269
+ var _this5 = this;
270
+ var options,
271
+ _args6 = arguments;
272
+ return _regenerator().w(function (_context6) {
273
+ while (1) switch (_context6.n) {
274
+ case 0:
275
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
276
+ return _context6.a(2, new Promise(function (resolve) {
277
+ var result = _this5.exporters.collada.parse(object, options);
278
+ resolve(result.data);
279
+ }));
280
+ }
281
+ }, _callee6);
282
+ }));
283
+ function exportCollada(_x7) {
284
+ return _exportCollada.apply(this, arguments);
285
+ }
286
+ return exportCollada;
287
+ }()
246
288
  /**
247
289
  * Export scene configuration to JSON
248
290
  * @param {THREE.Scene} scene - Scene to export
@@ -285,7 +327,7 @@ var Export = /*#__PURE__*/function () {
285
327
  }, {
286
328
  key: "serializeObject",
287
329
  value: function serializeObject(object) {
288
- var _this5 = this;
330
+ var _this6 = this;
289
331
  var serialized = {
290
332
  uuid: object.uuid,
291
333
  name: object.name,
@@ -316,7 +358,7 @@ var Export = /*#__PURE__*/function () {
316
358
 
317
359
  // Recursively serialize children
318
360
  object.children.forEach(function (child) {
319
- serialized.children.push(_this5.serializeObject(child));
361
+ serialized.children.push(_this6.serializeObject(child));
320
362
  });
321
363
  return serialized;
322
364
  }
@@ -489,7 +531,7 @@ var Export = /*#__PURE__*/function () {
489
531
  }, {
490
532
  key: "exportToXML",
491
533
  value: function exportToXML(data) {
492
- var _this6 = this;
534
+ var _this7 = this;
493
535
  var rootElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'root';
494
536
  var xmlHeader = '<?xml version="1.0" encoding="UTF-8"?>\n';
495
537
  var _objectToXML = function objectToXML(obj) {
@@ -508,12 +550,12 @@ var Export = /*#__PURE__*/function () {
508
550
  if (_typeof(item) === 'object') {
509
551
  xml += '\n' + _objectToXML(item, indent + 1) + spaces;
510
552
  } else {
511
- xml += _this6.escapeXML(item);
553
+ xml += _this7.escapeXML(item);
512
554
  }
513
555
  xml += "</".concat(key, ">\n");
514
556
  });
515
557
  } else {
516
- xml += "".concat(spaces, "<").concat(key, ">").concat(_this6.escapeXML(value), "</").concat(key, ">\n");
558
+ xml += "".concat(spaces, "<").concat(key, ">").concat(_this7.escapeXML(value), "</").concat(key, ">\n");
517
559
  }
518
560
  });
519
561
  return xml;
@@ -565,63 +607,63 @@ var Export = /*#__PURE__*/function () {
565
607
  }, {
566
608
  key: "exportBatch",
567
609
  value: (function () {
568
- var _exportBatch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(objects) {
610
+ var _exportBatch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(objects) {
569
611
  var results, errors, _iterator, _step, item, result, _t3, _t4;
570
- return _regenerator().w(function (_context6) {
571
- while (1) switch (_context6.n) {
612
+ return _regenerator().w(function (_context7) {
613
+ while (1) switch (_context7.n) {
572
614
  case 0:
573
615
  logger.info("\uD83D\uDD04 Starting batch export of ".concat(objects.length, " objects..."));
574
616
  results = [];
575
617
  errors = [];
576
618
  _iterator = _createForOfIteratorHelper(objects);
577
- _context6.p = 1;
619
+ _context7.p = 1;
578
620
  _iterator.s();
579
621
  case 2:
580
622
  if ((_step = _iterator.n()).done) {
581
- _context6.n = 7;
623
+ _context7.n = 7;
582
624
  break;
583
625
  }
584
626
  item = _step.value;
585
- _context6.p = 3;
586
- _context6.n = 4;
627
+ _context7.p = 3;
628
+ _context7.n = 4;
587
629
  return this.exportModel(item.object, item.format, item.options);
588
630
  case 4:
589
- result = _context6.v;
631
+ result = _context7.v;
590
632
  results.push(result);
591
- _context6.n = 6;
633
+ _context7.n = 6;
592
634
  break;
593
635
  case 5:
594
- _context6.p = 5;
595
- _t3 = _context6.v;
636
+ _context7.p = 5;
637
+ _t3 = _context7.v;
596
638
  errors.push({
597
639
  object: item.object.name || 'Unnamed Object',
598
640
  format: item.format,
599
641
  error: _t3.message
600
642
  });
601
643
  case 6:
602
- _context6.n = 2;
644
+ _context7.n = 2;
603
645
  break;
604
646
  case 7:
605
- _context6.n = 9;
647
+ _context7.n = 9;
606
648
  break;
607
649
  case 8:
608
- _context6.p = 8;
609
- _t4 = _context6.v;
650
+ _context7.p = 8;
651
+ _t4 = _context7.v;
610
652
  _iterator.e(_t4);
611
653
  case 9:
612
- _context6.p = 9;
654
+ _context7.p = 9;
613
655
  _iterator.f();
614
- return _context6.f(9);
656
+ return _context7.f(9);
615
657
  case 10:
616
658
  logger.info("\u2705 Batch export complete: ".concat(results.length, " successful, ").concat(errors.length, " failed"));
617
- return _context6.a(2, {
659
+ return _context7.a(2, {
618
660
  results: results,
619
661
  errors: errors
620
662
  });
621
663
  }
622
- }, _callee6, this, [[3, 5], [1, 8, 9, 10]]);
664
+ }, _callee7, this, [[3, 5], [1, 8, 9, 10]]);
623
665
  }));
624
- function exportBatch(_x7) {
666
+ function exportBatch(_x8) {
625
667
  return _exportBatch.apply(this, arguments);
626
668
  }
627
669
  return exportBatch;
@@ -1,4 +1,5 @@
1
1
  export { CentralPlant } from './core/centralPlant.js';
2
+ export { SceneViewer } from './core/sceneViewer.js';
2
3
  export { DebugLogger, logger, modelLogger, pathfinderLogger, transformLogger } from './core/debugLogger.js';
3
4
  export { findObjectByHardcodedUuid, generateUuidFromName, getHardcodedUuid } from './core/nameUtils.js';
4
5
  export { MathUtils } from './core/mathUtils.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2112-lab/central-plant",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Utility modules for the Central Plant Application",
5
5
  "main": "dist/bundle/index.js",
6
6
  "module": "dist/esm/index.js",