mxcad 1.0.389 → 1.0.391

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/dist/mxcad.d.ts CHANGED
@@ -8383,6 +8383,43 @@ export declare class McDbProxyEntity extends McDbEntity {
8383
8383
  }
8384
8384
  /**
8385
8385
  * 光栅图片类,该类用于在CAD中显示光栅图形
8386
+ * @example
8387
+ * ```ts
8388
+ import { MxCpp, McGePoint3d, McDbRasterImage, McGeVector3d } from "mxcad";
8389
+
8390
+ //画图片
8391
+ function drawImg() {
8392
+ const mxcad = MxCpp.getCurrentMxCAD();
8393
+ // 创建新画布
8394
+ mxcad.newFile();
8395
+ //图片地址
8396
+ let imagUrl = "https://cdn.pixabay.com/photo/2022/11/15/12/23/winter-7593872_960_720.jpg";
8397
+ mxcad.loadImage(imagUrl, (image) => {
8398
+ if (!image) {
8399
+ console.log("loadImage failed");
8400
+ return;
8401
+ }
8402
+ let width = mxcad.mxdraw.viewCoordLong2Cad(100);
8403
+ let height = (image.height / image.width) * width;
8404
+ const id = mxcad.addImageDefine(imagUrl, "winter-7593872_960_720.jpg", true);
8405
+ const img = new McDbRasterImage();
8406
+ img.setImageDefId(id);
8407
+ img.setDwgImageSize(image.width, image.height);
8408
+ const origin = new McGePoint3d(0, 0, 0);
8409
+
8410
+ const uCorner = McGeVector3d.kXAxis.clone();
8411
+ uCorner.mult(width);
8412
+
8413
+ const vOnPlane = McGeVector3d.kYAxis.clone();
8414
+ vOnPlane.mult(height);
8415
+
8416
+ img.setOrientation(origin, uCorner, vOnPlane);
8417
+ mxcad.drawEntity(img);
8418
+ //mxcad.drawImage((pt as any).x, (pt as any).y, width, height, 0, imagUrl,true,image.width,image.height);
8419
+ mxcad.updateDisplay();
8420
+ });
8421
+ };
8422
+ * ```
8386
8423
  */
8387
8424
  export declare class McDbRasterImage extends McDbEntity {
8388
8425
  /**
@@ -8438,12 +8475,10 @@ export declare class McDbRasterImage extends McDbEntity {
8438
8475
  };
8439
8476
  /**
8440
8477
  * 设置保存dwg文件时,图片的宽高像素。
8441
- * ```
8442
8478
  */
8443
8479
  setDwgImageSize(width: number, height: number): boolean;
8444
8480
  /**
8445
8481
  * 返回dwg文件中的图片的宽高像素。
8446
- * ```
8447
8482
  */
8448
8483
  getDwgImageSize(): number[];
8449
8484
  /**
@@ -8461,7 +8496,7 @@ export declare class McDbRasterImage extends McDbEntity {
8461
8496
  */
8462
8497
  setImageDefId(imageId: McObjectId): void;
8463
8498
  /**
8464
- * 获取图像的定义I
8499
+ * 获取图像的定义ID
8465
8500
  * @example
8466
8501
  * ```ts
8467
8502
  * //假设 rasterImage 为光栅图片实例
@@ -8530,7 +8565,6 @@ export declare class McDbRasterImage extends McDbEntity {
8530
8565
  export declare class McDbWipeout extends McDbEntity {
8531
8566
  /**
8532
8567
  * 构造函数。
8533
- * ```
8534
8568
  */
8535
8569
  constructor(x?: object);
8536
8570
  /**
@@ -8589,7 +8623,6 @@ export declare class McDbSpline extends McDbCurve {
8589
8623
  /**
8590
8624
  * 得到样条线的数据.
8591
8625
  * @example
8592
- * ```
8593
8626
  */
8594
8627
  getNurbsData(): {
8595
8628
  degree: number;
@@ -8605,7 +8638,7 @@ export declare class McDbSpline extends McDbCurve {
8605
8638
  /**
8606
8639
  * 设置样条线的数据.
8607
8640
  * @example
8608
- * ```
8641
+ *
8609
8642
  */
8610
8643
  setNurbsData(data: {
8611
8644
  degree: number;
@@ -8621,7 +8654,6 @@ export declare class McDbSpline extends McDbCurve {
8621
8654
  /**
8622
8655
  * 得到样条线的拟合数据.
8623
8656
  * @example
8624
- * ```
8625
8657
  */
8626
8658
  getFitPoints(): {
8627
8659
  degree: number;
@@ -8634,7 +8666,6 @@ export declare class McDbSpline extends McDbCurve {
8634
8666
  /**
8635
8667
  *设置样条线的拟合数据.
8636
8668
  * @example
8637
- * ```
8638
8669
  */
8639
8670
  setFitPoints(data: {
8640
8671
  degree: number;
@@ -8651,7 +8682,7 @@ export declare class McDbSpline extends McDbCurve {
8651
8682
  * ```ts
8652
8683
  * ```
8653
8684
  */
8654
- export declare class McDbXline extends McDbEntity {
8685
+ export declare class McDbXline extends McDbCurve {
8655
8686
  /**
8656
8687
  * 构造函数。
8657
8688
  * @param imp 内部对象。
@@ -8721,7 +8752,7 @@ export declare class McDbXline extends McDbEntity {
8721
8752
  * ```ts
8722
8753
  * ```
8723
8754
  */
8724
- export declare class McDbRay extends McDbEntity {
8755
+ export declare class McDbRay extends McDbCurve {
8725
8756
  /**
8726
8757
  * 构造函数。
8727
8758
  * @param imp 内部对象。
package/dist/mxcad.es.js CHANGED
@@ -14596,7 +14596,7 @@ win.McDrawObjectEvent_asciiToUTF8 = function (hexstr) {
14596
14596
  return MxG2312Obj.decodeFromGb2312Imp(hexstr);
14597
14597
  };
14598
14598
 
14599
- const version$1 = "1.0.388";
14599
+ const version$1 = "1.0.390";
14600
14600
 
14601
14601
  var isSharedArrayBuffer = "SharedArrayBuffer" in window;
14602
14602
  var isCdn = document.currentScript && /unpkg\.com\/mxcad/.test(document.currentScript.src);
@@ -19049,7 +19049,7 @@ var McDbRasterImage = /*#__PURE__*/function (_McDbEntity9) {
19049
19049
  }, {
19050
19050
  key: "setDwgImageSize",
19051
19051
  value: function setDwgImageSize(width, height) {
19052
- return this.imp.setImageSize(width, height);
19052
+ return this.imp.setImageSize(new McGePoint3d(width, height).imp);
19053
19053
  }
19054
19054
  }, {
19055
19055
  key: "getDwgImageSize",
@@ -19256,8 +19256,8 @@ var McDbSpline = /*#__PURE__*/function (_McDbCurve6) {
19256
19256
  }]);
19257
19257
  return McDbSpline;
19258
19258
  }(McDbCurve);
19259
- var McDbXline = /*#__PURE__*/function (_McDbEntity10) {
19260
- _inherits$1(McDbXline, _McDbEntity10);
19259
+ var McDbXline = /*#__PURE__*/function (_McDbCurve7) {
19260
+ _inherits$1(McDbXline, _McDbCurve7);
19261
19261
  var _super25 = _createSuper$9(McDbXline);
19262
19262
  function McDbXline(imp) {
19263
19263
  var _this21;
@@ -19296,9 +19296,9 @@ var McDbXline = /*#__PURE__*/function (_McDbEntity10) {
19296
19296
  }
19297
19297
  }]);
19298
19298
  return McDbXline;
19299
- }(McDbEntity);
19300
- var McDbRay = /*#__PURE__*/function (_McDbEntity11) {
19301
- _inherits$1(McDbRay, _McDbEntity11);
19299
+ }(McDbCurve);
19300
+ var McDbRay = /*#__PURE__*/function (_McDbCurve8) {
19301
+ _inherits$1(McDbRay, _McDbCurve8);
19302
19302
  var _super26 = _createSuper$9(McDbRay);
19303
19303
  function McDbRay(imp) {
19304
19304
  var _this22;
@@ -19337,9 +19337,9 @@ var McDbRay = /*#__PURE__*/function (_McDbEntity11) {
19337
19337
  }
19338
19338
  }]);
19339
19339
  return McDbRay;
19340
- }(McDbEntity);
19341
- var McDbMxRegion = /*#__PURE__*/function (_McDbEntity12) {
19342
- _inherits$1(McDbMxRegion, _McDbEntity12);
19340
+ }(McDbCurve);
19341
+ var McDbMxRegion = /*#__PURE__*/function (_McDbEntity10) {
19342
+ _inherits$1(McDbMxRegion, _McDbEntity10);
19343
19343
  var _super27 = _createSuper$9(McDbMxRegion);
19344
19344
  function McDbMxRegion(imp) {
19345
19345
  var _this23;
@@ -19417,8 +19417,8 @@ var McDbMxRegion = /*#__PURE__*/function (_McDbEntity12) {
19417
19417
  }]);
19418
19418
  return McDbMxRegion;
19419
19419
  }(McDbEntity);
19420
- var McDbViewport = /*#__PURE__*/function (_McDbEntity13) {
19421
- _inherits$1(McDbViewport, _McDbEntity13);
19420
+ var McDbViewport = /*#__PURE__*/function (_McDbEntity11) {
19421
+ _inherits$1(McDbViewport, _McDbEntity11);
19422
19422
  var _super28 = _createSuper$9(McDbViewport);
19423
19423
  function McDbViewport(x) {
19424
19424
  var _this24;