mxdraw 0.1.111 → 0.1.113

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/index.d.ts CHANGED
@@ -104,7 +104,9 @@ declare enum MxCloneType {
104
104
  /** 动态拖动Clone */
105
105
  kDragClone = 2,
106
106
  /** 数据归档 */
107
- kMxFileClone = 3
107
+ kMxFileClone = 3,
108
+ /** 保存数据到DWG文件 */
109
+ kSaveDwgClone = 4
108
110
  }
109
111
  /**
110
112
  * 控件对象缺省的绘制顺序
@@ -507,7 +509,10 @@ declare abstract class MxDbEntity {
507
509
  * }
508
510
  * ```
509
511
  */
510
- protected dwgInHelp<T extends string[]>(obj: any, aryProp: T, hooks?: {
512
+ protected dwgInHelp<T extends (string | {
513
+ key: string;
514
+ default: any;
515
+ })[]>(obj: any, aryProp: T, hooks?: {
511
516
  getVal?: (v: any) => any;
512
517
  getCacheVal?: (v: any) => any;
513
518
  }): boolean;
@@ -525,7 +530,10 @@ declare abstract class MxDbEntity {
525
530
  * }
526
531
  * ```
527
532
  */
528
- protected dwgOutHelp(obj: any, aryProp: string[]): any;
533
+ protected dwgOutHelp(obj: any, aryProp: (string | {
534
+ key: string;
535
+ default: any;
536
+ })[]): any;
529
537
  protected callEvent(sEventName: string, param?: any): any;
530
538
  /**
531
539
  * 新创建一个自定义对象 (默认调用该对象的构造函数来创建新的对象)
@@ -905,7 +913,7 @@ interface MxDrawObjectType {
905
913
  addViewObject(obj: THREE.Object3D): void;
906
914
  removeViewObject(obj: THREE.Object3D): void;
907
915
  removeObject(obj: THREE.Object3D, isRemoveSelectObject?: boolean): void;
908
- saveMxEntityToJson(): object;
916
+ saveMxEntityToJson(isSaveToDWG?: boolean): object;
909
917
  loadMxEntityFromJson(dataString: object): Promise<boolean>;
910
918
  eraseAllMxEntity(): void;
911
919
  makeCurrent(): void;
@@ -1481,7 +1489,7 @@ declare class MxDrawObject {
1481
1489
  *
1482
1490
  * ```
1483
1491
  */
1484
- saveMxEntityToJson(): string;
1492
+ saveMxEntityToJson(isSaveToDWG?: boolean): string;
1485
1493
  /**
1486
1494
  * 保存所有MxEntity的数据到js对象.
1487
1495
  * @param
@@ -1492,7 +1500,7 @@ declare class MxDrawObject {
1492
1500
  *
1493
1501
  * ```
1494
1502
  */
1495
- saveMxEntityToObject(): object;
1503
+ saveMxEntityToObject(isSaveToDWG?: boolean): object;
1496
1504
  /**
1497
1505
  * 从json字符串恢复MxEntity
1498
1506
  * @param dataString json字符串.
@@ -1670,6 +1678,24 @@ declare class MxDrawObject {
1670
1678
  * ```
1671
1679
  */
1672
1680
  getViewAngle(): number;
1681
+ /**
1682
+ * 得到系统变量
1683
+ * @example
1684
+ * ```typescript
1685
+ *
1686
+ *
1687
+ * ```
1688
+ */
1689
+ getSysVar(sName: string): any;
1690
+ /**
1691
+ * 设置系统变量
1692
+ * @example
1693
+ * ```typescript
1694
+ *
1695
+ *
1696
+ * ```
1697
+ */
1698
+ setSysVar(sName: string, val: any): void;
1673
1699
  }
1674
1700
 
1675
1701
  /**
@@ -3619,6 +3645,7 @@ declare class MxDbCloudLine extends MxDbEntity {
3619
3645
  * 获取云线的圆弧半径
3620
3646
  * */
3621
3647
  getRadius(): number;
3648
+ getCachePoint(): THREE.Vector3[] | null;
3622
3649
  private clacNewArcDiameterPoint;
3623
3650
  private createCloudArcCurvePoints;
3624
3651
  /**
@@ -3672,9 +3699,9 @@ declare class MxDbRegularPolygon extends MxDbEntity {
3672
3699
  * */
3673
3700
  declare class MxDbLeadComment extends MxDbEntity {
3674
3701
  /** 标注点 */
3675
- point1: three.Vector3;
3702
+ point1: THREE.Vector3;
3676
3703
  /** 文字显示位置 */
3677
- point2: three.Vector3;
3704
+ point2: THREE.Vector3;
3678
3705
  /** 文字内容 */
3679
3706
  text: string;
3680
3707
  /** 文字高度 */
@@ -3685,8 +3712,8 @@ declare class MxDbLeadComment extends MxDbEntity {
3685
3712
  getTypeName(): string;
3686
3713
  create(): MxDbEntity;
3687
3714
  worldDraw(pWorldDraw: McGiWorldDraw): void;
3688
- getGripPoints(): Array<three.Vector3>;
3689
- moveGripPointsAt(index: number, offset: three.Vector3): boolean;
3715
+ getGripPoints(): Array<THREE.Vector3>;
3716
+ moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
3690
3717
  dwgIn(obj: any): boolean;
3691
3718
  dwgOut(obj: any): object;
3692
3719
  protected onViewChange(): boolean;
@@ -3713,6 +3740,7 @@ declare class MxDbRectBoxLeadComment extends MxDbEntity {
3713
3740
  fixedSize: boolean;
3714
3741
  getTypeName(): string;
3715
3742
  create(): MxDbEntity;
3743
+ getCloudLine(): any;
3716
3744
  worldDraw(pWorldDraw: McGiWorldDraw): void;
3717
3745
  getGripPoints(): Array<THREE.Vector3>;
3718
3746
  moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
@@ -1 +1 @@
1
- import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";import{Box3}from"three";const propertyDbKeys=["points"];export default class MxDbAnyLine extends MxDbEntity{constructor(){super(...arguments),this.points=[]}getTypeName(){return"MxDbAnyLine"}create(){return new MxDbAnyLine}worldDraw(t){let e=t.getMxObject();const r=(new Box3).setFromPoints(this.points);let n=new THREE.Vector3;if(r.getCenter(n),t.drawLines(this.points),t.getType()===McGiWorldDrawType.kSelectDraw){const o=new THREE.Vector3;r.getSize(o),o.addScalar(e.screenCoordLong2Doc(20));const i=o.x/2,s=o.y/2,y={x:n.x-i,y:n.y-s},x={x:n.x+i,y:n.y-s},p={x:n.x+i,y:n.y+s},c={x:n.x-i,y:n.y+s};t.drawLine(y.x,y.y,x.x,x.y),t.drawLine(x.x,x.y,p.x,p.y),t.drawLine(p.x,p.y,c.x,c.y),t.drawLine(c.x,c.y,y.x,y.y)}}setPoints(t){return this.points=t,this}getCenter(){const t=new THREE.Geometry;t.vertices=this.points;const e=new THREE.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e}getGripPoints(){return[this.getCenter()]}moveGripPointsAt(t,e){return 0===t&&this.points.forEach(t=>{t.add(e)}),!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t}};
1
+ import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";const propertyDbKeys=["points"];export default class MxDbAnyLine extends MxDbEntity{constructor(){super(...arguments),this.points=[]}getTypeName(){return"MxDbAnyLine"}create(){return new MxDbAnyLine}worldDraw(t){let e=t.getMxObject();const n=(new THREE.Box3).setFromPoints(this.points);let r=new THREE.Vector3;if(n.getCenter(r),t.drawLines(this.points),t.getType()===McGiWorldDrawType.kSelectDraw){const o=new THREE.Vector3;n.getSize(o),o.addScalar(e.screenCoordLong2Doc(20));const i=o.x/2,s=o.y/2,y={x:r.x-i,y:r.y-s},x={x:r.x+i,y:r.y-s},p={x:r.x+i,y:r.y+s},c={x:r.x-i,y:r.y+s};t.drawLine(y.x,y.y,x.x,x.y),t.drawLine(x.x,x.y,p.x,p.y),t.drawLine(p.x,p.y,c.x,c.y),t.drawLine(c.x,c.y,y.x,y.y)}}setPoints(t){return this.points=t,this}getCenter(){const t=new THREE.Geometry;t.vertices=this.points;const e=new THREE.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e}getGripPoints(){return[this.getCenter()]}moveGripPointsAt(t,e){return 0===t&&this.points.forEach(t=>{t.add(e)}),!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t}};
@@ -18,6 +18,7 @@ export default class MxDbCloudLine extends MxDbEntity {
18
18
  * 获取云线的圆弧半径
19
19
  * */
20
20
  getRadius(): number;
21
+ getCachePoint(): THREE.Vector3[] | null;
21
22
  private clacNewArcDiameterPoint;
22
23
  private createCloudArcCurvePoints;
23
24
  /**
@@ -1 +1 @@
1
- import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";const propertyDbKeys=["points","radius","cachePoint"];export default class MxDbCloudLine extends MxDbEntity{constructor(){super(...arguments),this.points=[],this.radius=16,this.cachePoint=null}getTypeName(){return"MxDbCloudLine"}create(){return new MxDbCloudLine}setRadius(t){this.radius=t}getRadius(){return this.radius}clacNewArcDiameterPoint(t){if(0==this.points.length)return t;let e=this.points[this.points.length-1];const n=2*this.radius,i=e.distanceTo(t);if(i<n)return null;const r=n*(t.x-e.x)/i+e.x,o=n*(t.y-e.y)/i+e.y;return new THREE.Vector3(r,o,e.z)}createCloudArcCurvePoints(t,e,n){const i=new THREE.Vector3((t.x+e.x)/2,(t.y+e.y)/2,0);n||(n=i.distanceTo(t));const{startAngle:r,endAngle:o}=function(t,e,n){const i=2*Math.PI/360;return{startAngle:180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI*i,endAngle:180*Math.atan2(n.y-t.y,n.x-t.x)/Math.PI*i}}(i,t,e);return new THREE.ArcCurve(i.x,i.y,n,r,o,!0).getPoints(10)}addPoint(t,e){let n=this.clacNewArcDiameterPoint(t);n&&(this.points.push(n),this.cachePoint=null,e&&(this.cachePoint=this.reCalculateDrawGeometryPoint()))}addLine(t,e){this.addPoint(t);const n=2*this.radius;let i=this.points[this.points.length-1],r=i.distanceTo(e);const o=Math.round(r/n);for(let t=0;t<o;t++){r=i.distanceTo(e);const t=n*(e.x-i.x)/r+i.x,o=n*(e.y-i.y)/r+i.y;let s=new THREE.Vector3(t,o,e.z);this.addPoint(s),i=s}return this.points[this.points.length-1]}reCalculateDrawGeometryPoint(){if(this.points.length<2)return null;let t=this.points[0],e=this.points.length,n=[];for(let i=1;i<e;i++){let e=this.points[i];this.createCloudArcCurvePoints(t,e).forEach(t=>{n.push(new THREE.Vector3(t.x,t.y,0))}),t=e}return n}worldDraw(t){if(this.cachePoint||(this.cachePoint=this.reCalculateDrawGeometryPoint()),this.cachePoint)if(t.getType()===McGiWorldDrawType.kSelectDraw){let e=new THREE.Geometry;this.cachePoint.forEach(t=>{e.vertices.push(new THREE.Vector3(t.x,t.y,0))}),e.computeBoundingBox();const n=new THREE.Vector3;e.boundingBox.getSize(n);let i=new THREE.Vector3;e.boundingBox.getCenter(i);const r=n.x/2,o=n.y/2,s={x:i.x-r,y:i.y-o},c={x:i.x+r,y:i.y-o},a={x:i.x+r,y:i.y+o},h={x:i.x-r,y:i.y+o};t.drawLine(s.x,s.y,c.x,c.y),t.drawLine(c.x,c.y,a.x,a.y),t.drawLine(a.x,a.y,h.x,h.y),t.drawLine(h.x,h.y,s.x,s.y)}else t.drawLines(this.cachePoint)}getCenter(){const t=new THREE.Geometry;t.vertices=this.points;let e=new THREE.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e}getGripPoints(){return[this.getCenter()]}moveGripPointsAt(t,e){return this.points.forEach(t=>{t.add(e)}),this.cachePoint=null,!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t}};
1
+ import MxDbEntity from"../MxDbEntity";import McGiWorldDrawType from"../McGiWorldDrawType";import MxType from"../MxType";const propertyDbKeys=["points","radius"];export default class MxDbCloudLine extends MxDbEntity{constructor(){super(...arguments),this.points=[],this.radius=16,this.cachePoint=null}getTypeName(){return"MxDbCloudLine"}create(){return new MxDbCloudLine}setRadius(t){this.radius=t}getRadius(){return this.radius}getCachePoint(){return this.cachePoint}clacNewArcDiameterPoint(t){if(0==this.points.length)return t;let e=this.points[this.points.length-1];const n=2*this.radius,i=e.distanceTo(t);if(i<n)return null;const r=n*(t.x-e.x)/i+e.x,o=n*(t.y-e.y)/i+e.y;return new THREE.Vector3(r,o,e.z)}createCloudArcCurvePoints(t,e,n){const i=new THREE.Vector3((t.x+e.x)/2,(t.y+e.y)/2,0);n||(n=i.distanceTo(t));const{startAngle:r,endAngle:o}=function(t,e,n){const i=2*Math.PI/360;return{startAngle:180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI*i,endAngle:180*Math.atan2(n.y-t.y,n.x-t.x)/Math.PI*i}}(i,t,e);return new THREE.ArcCurve(i.x,i.y,n,r,o,!0).getPoints(10)}addPoint(t,e){let n=this.clacNewArcDiameterPoint(t);n&&(this.points.push(n),this.cachePoint=null,e&&(this.cachePoint=this.reCalculateDrawGeometryPoint()))}addLine(t,e){this.addPoint(t);const n=2*this.radius;let i=this.points[this.points.length-1],r=i.distanceTo(e);const o=Math.round(r/n);for(let t=0;t<o;t++){r=i.distanceTo(e);const t=n*(e.x-i.x)/r+i.x,o=n*(e.y-i.y)/r+i.y;let s=new THREE.Vector3(t,o,e.z);this.addPoint(s),i=s}return this.points[this.points.length-1]}reCalculateDrawGeometryPoint(){if(this.points.length<2)return null;let t=this.points[0],e=this.points.length,n=[];for(let i=1;i<e;i++){let e=this.points[i];this.createCloudArcCurvePoints(t,e).forEach(t=>{n.push(new THREE.Vector3(t.x,t.y,0))}),t=e}return n}worldDraw(t){if(this.cachePoint||(this.cachePoint=this.reCalculateDrawGeometryPoint()),this.cachePoint)if(t.getType()===McGiWorldDrawType.kSelectDraw){let e=new THREE.Geometry;this.cachePoint.forEach(t=>{e.vertices.push(new THREE.Vector3(t.x,t.y,0))}),e.computeBoundingBox();const n=new THREE.Vector3;e.boundingBox.getSize(n);let i=new THREE.Vector3;e.boundingBox.getCenter(i);const r=n.x/2,o=n.y/2,s={x:i.x-r,y:i.y-o},c={x:i.x+r,y:i.y-o},a={x:i.x+r,y:i.y+o},h={x:i.x-r,y:i.y+o};t.drawLine(s.x,s.y,c.x,c.y),t.drawLine(c.x,c.y,a.x,a.y),t.drawLine(a.x,a.y,h.x,h.y),t.drawLine(h.x,h.y,s.x,s.y)}else t.drawLines(this.cachePoint)}getCenter(){const t=new THREE.Geometry;t.vertices=this.points;let e=new THREE.Vector3;return t.computeBoundingBox(),t.boundingBox.getCenter(e),e}getGripPoints(){return[this.getCenter()]}moveGripPointsAt(t,e){return this.points.forEach(t=>{t.add(e)}),this.cachePoint=null,!0}dwgIn(t){return this.onDwgIn(t),this.dwgInHelp(t,propertyDbKeys),this.cachePoint=null,!0}dwgOut(t){return this.onDwgOut(t),this.dwgOutHelp(t,propertyDbKeys),t.type===MxType.MxCloneType.kSaveDwgClone&&this.dwgOutHelp(t,["cachePoint"]),t}};
@@ -98,7 +98,10 @@ export default abstract class MxDbEntity {
98
98
  * }
99
99
  * ```
100
100
  */
101
- protected dwgInHelp<T extends string[]>(obj: any, aryProp: T, hooks?: {
101
+ protected dwgInHelp<T extends (string | {
102
+ key: string;
103
+ default: any;
104
+ })[]>(obj: any, aryProp: T, hooks?: {
102
105
  getVal?: (v: any) => any;
103
106
  getCacheVal?: (v: any) => any;
104
107
  }): boolean;
@@ -116,7 +119,10 @@ export default abstract class MxDbEntity {
116
119
  * }
117
120
  * ```
118
121
  */
119
- protected dwgOutHelp(obj: any, aryProp: string[]): any;
122
+ protected dwgOutHelp(obj: any, aryProp: (string | {
123
+ key: string;
124
+ default: any;
125
+ })[]): any;
120
126
  protected callEvent(sEventName: string, param?: any): any;
121
127
  /**
122
128
  * 新创建一个自定义对象 (默认调用该对象的构造函数来创建新的对象)
@@ -1 +1 @@
1
- import _ from"lodash";import MxType from"../MxType";import store from"../store";export var DataType;!function(t){t[t.Default=0]="Default",t[t.Color=1]="Color",t[t.Vector2=2]="Vector2",t[t.Vector3=3]="Vector3",t[t.Vector4=4]="Vector4",t[t.Matrix3=5]="Matrix3",t[t.Matrix4=6]="Matrix4"}(DataType||(DataType={}));export const MXDBDATATYPE="datatype";const propertyDbKeys=["color","renderOrder","opacity","visible","userData","sGuid","dLineWidth","lineWidthByPixels","dDashArray","dDashRatio","layer"];export default class MxDbEntity{constructor(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.sGuid="",this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer="",this._event={}}initGuid(t){this.sGuid.length>0?console.log("mx: init guid error"):this.sGuid=t}dwgInHelp(t,e,i){let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone,a=t=>{if(!t)return;const{value:e,[MXDBDATATYPE]:r}=t;switch(r){case DataType.Color:return new THREE.Color(...e);case DataType.Vector2:return new THREE.Vector2(...e);case DataType.Vector3:return new THREE.Vector3(...e);case DataType.Vector4:return new THREE.Vector4(...e);case DataType.Matrix3:return(new THREE.Matrix3).fromArray(e);case DataType.Matrix4:return(new THREE.Matrix4).fromArray(e)}return i&&i.getCacheVal?i.getCacheVal(t):void 0};function h(t){return t instanceof THREE.Color||t instanceof THREE.Vector2||t instanceof THREE.Vector3||t instanceof THREE.Vector4||t instanceof THREE.Matrix3||t instanceof THREE.Matrix4?t.clone():i&&i.getVal?i.getVal(t):void 0}return e.forEach(e=>{r[e]=_.cloneDeepWith(t[e],s?a:h)}),!0}dwgOutHelp(t,e){const i=t=>t instanceof THREE.Color?{[MXDBDATATYPE]:DataType.Color,value:t.toArray()}:t instanceof THREE.Vector2?{[MXDBDATATYPE]:DataType.Vector2,value:t.toArray()}:t instanceof THREE.Vector3?{[MXDBDATATYPE]:DataType.Vector3,value:t.toArray()}:t instanceof THREE.Vector4?{[MXDBDATATYPE]:DataType.Vector4,value:t.toArray()}:t instanceof THREE.Matrix3?{[MXDBDATATYPE]:DataType.Matrix3,value:t.toArray()}:t instanceof THREE.Matrix4?{[MXDBDATATYPE]:DataType.Matrix4,value:t.toArray()}:void 0;let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone;return e.forEach(e=>{t[e]=s?_.cloneDeepWith(r[e],i):r[e]}),t}callEvent(t,e){return void 0!=this._event[t]?this._event[t](e):void 0}create(t){return new(0,this.constructor)(t)}transformBy(t){}getGeomExtents(){return null}getImp(){return this.MxDbEntityImp}setNeedUpdateDisplay(t){let e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)}getMxObject(){let t=this.getImp();return t?t.getMxObject():null}onViewChange(){return!1}objectId(){let t=this.getImp();return t?t.objectId():0}erase(){let t=this.getImp();return!!t&&t.erase()}setLayer(t){let e=this.getImp();e&&e.nodifySetLayer(),this.layer=t}getLayer(){return this.layer}setColor(t){return this.color=t,this}getColor(){return this.color||16777215}clone(t){let e=this.create(),i={type:t||MxType.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e.sGuid="",e}onDwgIn(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer,t.guid&&(this.sGuid=t.guid)}onDwgOut(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer,t.guid=this.sGuid,Object.keys(this.userData).length>0&&(t.userData=this.userData)}rxInit(){store.state.MxFun.initMxDbEntityType(this)}setRenderOrder(t){this.renderOrder=t}getRenderOrder(){return this.renderOrder}setLineWidthByPixels(t){return this.lineWidthByPixels=t,this}getLineWidthByPixels(){return this.lineWidthByPixels}setLineWidth(t){return this.dLineWidth=t,this}getLineWidth(){return this.dLineWidth}getGetLength(){return 0}setDashLen(t){let e=this.getGetLength();if(e<1e-6||t<1e-6)return this;let i=Math.floor(e/t);return i<1e-6&&(this.dDashRatio=0),this.dDashArray=1/i,this}setDashRatio(t){return this.dDashRatio=t,this}setDashArray(t){return this.dDashArray=t,this}setDash(t,e){return this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0),this}getDash(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}}setDashLineDisplay(t){return t?(this.dDashArray<1e-5&&(this.dDashArray=.03),this.dDashRatio<1e-5&&(this.dDashRatio=.1),0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0),this}isDashLineDisplay(){return this.dDashArray>0&&this.dDashRatio>0}guid(){return this.sGuid}onEndGripEidt(){this.callEvent("onEndGripEidt")}onStartGripEidt(){return this.callEvent("onStartGripEidt")}addEvent(t,e){this._event[t]=e}removeEvent(t){this._event[t]=void 0}};
1
+ import _ from"lodash";import MxType from"../MxType";import store from"../store";export var DataType;!function(t){t[t.Default=0]="Default",t[t.Color=1]="Color",t[t.Vector2=2]="Vector2",t[t.Vector3=3]="Vector3",t[t.Vector4=4]="Vector4",t[t.Matrix3=5]="Matrix3",t[t.Matrix4=6]="Matrix4"}(DataType||(DataType={}));export const MXDBDATATYPE="datatype";const propertyDbKeys=["color","renderOrder","opacity","visible","userData","sGuid","dLineWidth","lineWidthByPixels","dDashArray","dDashRatio","layer"];function getDwgKeyVal(t,e){let i,r="";return _.isObject(e)?(i=e.default,r=e.key):"string"==typeof e&&(r=e),[r,void 0===t[r]?i:t[r]]}export default class MxDbEntity{constructor(){this.color=16777215,this.renderOrder=30,this.opacity=1,this.visible=!0,this.userData={},this.sGuid="",this.dLineWidth=0,this.lineWidthByPixels=!0,this.dDashArray=0,this.dDashRatio=0,this.layer="",this._event={}}initGuid(t){this.sGuid.length>0?console.log("mx: init guid error"):this.sGuid=t}dwgInHelp(t,e,i){let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone,a=t=>{if(!t)return;const{value:e,[MXDBDATATYPE]:r}=t;switch(r){case DataType.Color:return new THREE.Color(...e);case DataType.Vector2:return new THREE.Vector2(...e);case DataType.Vector3:return new THREE.Vector3(...e);case DataType.Vector4:return new THREE.Vector4(...e);case DataType.Matrix3:return(new THREE.Matrix3).fromArray(e);case DataType.Matrix4:return(new THREE.Matrix4).fromArray(e)}return i&&i.getCacheVal?i.getCacheVal(t):void 0};function n(t){return t instanceof THREE.Color||t instanceof THREE.Vector2||t instanceof THREE.Vector3||t instanceof THREE.Vector4||t instanceof THREE.Matrix3||t instanceof THREE.Matrix4?t.clone():i&&i.getVal?i.getVal(t):void 0}return e.forEach(e=>{const[i,h]=getDwgKeyVal(t,e);r[i]=_.cloneDeepWith(h,s?a:n)}),!0}dwgOutHelp(t,e){const i=t=>t instanceof THREE.Color?{[MXDBDATATYPE]:DataType.Color,value:t.toArray()}:t instanceof THREE.Vector2?{[MXDBDATATYPE]:DataType.Vector2,value:t.toArray()}:t instanceof THREE.Vector3?{[MXDBDATATYPE]:DataType.Vector3,value:t.toArray()}:t instanceof THREE.Vector4?{[MXDBDATATYPE]:DataType.Vector4,value:t.toArray()}:t instanceof THREE.Matrix3?{[MXDBDATATYPE]:DataType.Matrix3,value:t.toArray()}:t instanceof THREE.Matrix4?{[MXDBDATATYPE]:DataType.Matrix4,value:t.toArray()}:void 0;let r=this;const s=t.type===MxType.MxCloneType.kMxFileClone||t.type===MxType.MxCloneType.kSaveDwgClone;return e.forEach(e=>{const[a,n]=getDwgKeyVal(r,e);t[a]=s?_.cloneDeepWith(n,i):n}),t}callEvent(t,e){return void 0!=this._event[t]?this._event[t](e):void 0}create(t){return new(0,this.constructor)(t)}transformBy(t){}getGeomExtents(){return null}getImp(){return this.MxDbEntityImp}setNeedUpdateDisplay(t){let e=this.getImp();return!!e&&(t?e.upDisplay():e.setDirtyDisplay(!0),!0)}getMxObject(){let t=this.getImp();return t?t.getMxObject():null}onViewChange(){return!1}objectId(){let t=this.getImp();return t?t.objectId():0}erase(){let t=this.getImp();return!!t&&t.erase()}setLayer(t){let e=this.getImp();e&&e.nodifySetLayer(),this.layer=t}getLayer(){return this.layer}setColor(t){return this.color=t,this}getColor(){return this.color||16777215}clone(t){let e=this.create(),i={type:t||MxType.MxCloneType.kClone};return this.dwgOut(i),e.dwgIn(i),e.sGuid="",e}onDwgIn(t){this.color=t.color,this.renderOrder=t.renderOrder,this.opacity=t.opacity,this.visible=t.visible,t.userData?this.userData=JSON.parse(JSON.stringify(t.userData)):this.userData={},this.dLineWidth=t.lineWidth,this.lineWidthByPixels=t.lineWidthByPixels,this.dDashArray=t.dashArray,this.dDashRatio=t.dashRatio,this.layer=t.layer,t.guid&&(this.sGuid=t.guid)}onDwgOut(t){t.color=this.color,t.renderOrder=this.renderOrder,t.opacity=this.opacity,t.visible=this.visible,t.lineWidth=this.dLineWidth,t.lineWidthByPixels=this.lineWidthByPixels,t.dashArray=this.dDashArray,t.dashRatio=this.dDashRatio,t.layer=this.layer,t.guid=this.sGuid,Object.keys(this.userData).length>0&&(t.userData=this.userData)}rxInit(){store.state.MxFun.initMxDbEntityType(this)}setRenderOrder(t){this.renderOrder=t}getRenderOrder(){return this.renderOrder}setLineWidthByPixels(t){return this.lineWidthByPixels=t,this}getLineWidthByPixels(){return this.lineWidthByPixels}setLineWidth(t){return this.dLineWidth=t,this}getLineWidth(){return this.dLineWidth}getGetLength(){return 0}setDashLen(t){let e=this.getGetLength();if(e<1e-6||t<1e-6)return this;let i=Math.floor(e/t);return i<1e-6&&(this.dDashRatio=0),this.dDashArray=1/i,this}setDashRatio(t){return this.dDashRatio=t,this}setDashArray(t){return this.dDashArray=t,this}setDash(t,e){return this.dDashArray=t,this.dDashRatio=e,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0),this}getDash(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}}setDashLineDisplay(t){return t?(this.dDashArray<1e-5&&(this.dDashArray=.03),this.dDashRatio<1e-5&&(this.dDashRatio=.1),0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0),this}isDashLineDisplay(){return this.dDashArray>0&&this.dDashRatio>0}guid(){return this.sGuid}onEndGripEidt(){this.callEvent("onEndGripEidt")}onStartGripEidt(){return this.callEvent("onStartGripEidt")}addEvent(t,e){this._event[t]=e}removeEvent(t){this._event[t]=void 0}};
@@ -1,5 +1,4 @@
1
1
  /** @module MxDbLeadComment*/
2
- import * as THREE from 'three';
3
2
  import McGiWorldDraw from '../McGiWorldDraw';
4
3
  import MxDbEntity from '../MxDbEntity';
5
4
  /**
@@ -1 +1 @@
1
- import*as THREE from"three";import MxDbEntity from"../MxDbEntity";import MxThreeJS from"../MxThreeJS";export default class MxDbLeadComment extends MxDbEntity{constructor(){super(...arguments),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.text="",this.textHeight=20,this.textWidth=0,this.fixedSize=!1}getTypeName(){return"MxDbLeadComment"}create(){return new MxDbLeadComment}worldDraw(t){if(t.drawLine(this.point1,this.point2),this.text.length>0){const e=new THREE.Vector3;let i=this.textHeight,h=this.textWidth,n=t.getMxObject();this.fixedSize&&(i=n.screenCoordLong2Doc(i),h=n.screenCoordLong2Doc(h));let s=MxThreeJS.clacTextSpriteSize(this.text,i,h);e.x=this.point2.x+.5*s.textwidth,e.y=this.point2.y+.5*s.allTextHeight,t.drawText(this.text,i,0,e,h);const o=new THREE.Vector3;o.x=this.point2.x+s.textwidth,o.y=this.point2.y,t.drawLine(o,this.point2)}}getGripPoints(){let t=[];return t.push(this.point1),t.push(this.point2),t}moveGripPointsAt(t,e){return 0==t?this.point1.add(e):1==t&&this.point2.add(e),!0}dwgIn(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),this.text=t.text.substr(0),this.textHeight=t.textHeight,t.textWidth&&(this.textWidth=t.textWidth),this.fixedSize=t.fixedSize,!0}dwgOut(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t.textHeight=this.textHeight,t.text=this.text,t.textWidth=this.textWidth,t.fixedSize=this.fixedSize,t}onViewChange(){return!!this.fixedSize&&(this.setNeedUpdateDisplay(!1),!0)}};
1
+ import MxDbEntity from"../MxDbEntity";import MxThreeJS from"../MxThreeJS";export default class MxDbLeadComment extends MxDbEntity{constructor(){super(...arguments),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.text="",this.textHeight=20,this.textWidth=0,this.fixedSize=!1}getTypeName(){return"MxDbLeadComment"}create(){return new MxDbLeadComment}worldDraw(t){if(t.drawLine(this.point1,this.point2),this.text.length>0){const e=new THREE.Vector3;let i=this.textHeight,h=this.textWidth,n=t.getMxObject();this.fixedSize&&(i=n.screenCoordLong2Doc(i),h=n.screenCoordLong2Doc(h));let s=MxThreeJS.clacTextSpriteSize(this.text,i,h);e.x=this.point2.x+.5*s.textwidth,e.y=this.point2.y+.5*s.allTextHeight,t.drawText(this.text,i,0,e,h);const o=new THREE.Vector3;o.x=this.point2.x+s.textwidth,o.y=this.point2.y,t.drawLine(o,this.point2)}}getGripPoints(){let t=[];return t.push(this.point1),t.push(this.point2),t}moveGripPointsAt(t,e){return 0==t?this.point1.add(e):1==t&&this.point2.add(e),!0}dwgIn(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),this.text=t.text.substr(0),this.textHeight=t.textHeight,t.textWidth&&(this.textWidth=t.textWidth),this.fixedSize=t.fixedSize,!0}dwgOut(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t.textHeight=this.textHeight,t.text=this.text,t.textWidth=this.textWidth,t.fixedSize=this.fixedSize,t}onViewChange(){return!!this.fixedSize&&(this.setNeedUpdateDisplay(!1),!0)}};
@@ -21,6 +21,7 @@ export default class MxDbRectBoxLeadComment extends MxDbEntity {
21
21
  fixedSize: boolean;
22
22
  getTypeName(): string;
23
23
  create(): MxDbEntity;
24
+ getCloudLine(): any;
24
25
  worldDraw(pWorldDraw: McGiWorldDraw): void;
25
26
  getGripPoints(): Array<THREE.Vector3>;
26
27
  moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
@@ -1 +1 @@
1
- import MxDbLeadComment from"../MxDbLeadComment";import MxDbCloudLine from"../MxDbCloudLine";import MxDbEntity from"../MxDbEntity";export default class MxDbRectBoxLeadComment extends MxDbEntity{constructor(){super(...arguments),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.point3=new THREE.Vector3,this.text="",this.textHeight=20,this.radius=16,this.textWidth=0,this.fixedSize=!1}getTypeName(){return"MxDbRectBoxLeadComment"}create(){return new MxDbRectBoxLeadComment}worldDraw(t){let i=new MxDbCloudLine;i.setRadius(this.radius);let e=this.point1.clone(),n=this.point2.clone();if(e.x>n.x){let t=e.x;e.x=n.x,n.x=t}if(e.y>n.y){let t=e.y;e.y=n.y,n.y=t}let o=new THREE.Vector3(e.x,n.y,e.z);o=i.addLine(e,o),n=new THREE.Vector3(n.x,o.y,n.z),n=i.addLine(o,n);let s=new THREE.Vector3(n.x,e.y,e.z);if(s=i.addLine(n,s),e=i.addLine(s,e),i.worldDraw(t),this.text.length>0){let i=e,h=e.distanceTo(this.point3);h>o.distanceTo(this.point3)&&(i=o,h=o.distanceTo(this.point3)),h>n.distanceTo(this.point3)&&(i=n,h=n.distanceTo(this.point3)),h>s.distanceTo(this.point3)&&(i=s,h=s.distanceTo(this.point3));let d=new MxDbLeadComment;d.point1=i,d.point2=this.point3,d.text=this.text,d.textHeight=this.textHeight,d.textWidth=this.textWidth,d.fixedSize=this.fixedSize,d.worldDraw(t)}}getGripPoints(){let t=[];return t.push(this.point1),t.push(this.point2),t.push(this.point3),t}moveGripPointsAt(t,i){return 0==t?this.point1.add(i):1==t?this.point2.add(i):2==t&&this.point3.add(i),!0}dwgIn(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),this.point3.copy(t.point3),this.text=t.text.substr(0),this.textHeight=t.textHeight,this.radius=t.radius,t.textWidth&&(this.textWidth=t.textWidth),this.fixedSize=t.fixedSize,!0}dwgOut(t){return this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t.point3=this.point3,t.textHeight=this.textHeight,t.text=this.text,t.radius=this.radius,t.textWidth=this.textWidth,t.fixedSize=this.fixedSize,t}onViewChange(){return!!this.fixedSize&&(this.setNeedUpdateDisplay(!1),!0)}};
1
+ import MxDbLeadComment from"../MxDbLeadComment";import MxDbCloudLine from"../MxDbCloudLine";import MxDbEntity from"../MxDbEntity";import MxType from"../MxType";export default class MxDbRectBoxLeadComment extends MxDbEntity{constructor(){super(...arguments),this.point1=new THREE.Vector3,this.point2=new THREE.Vector3,this.point3=new THREE.Vector3,this.text="",this.textHeight=20,this.radius=16,this.textWidth=0,this.fixedSize=!1}getTypeName(){return"MxDbRectBoxLeadComment"}create(){return new MxDbRectBoxLeadComment}getCloudLine(){let t=new MxDbCloudLine;t.setRadius(this.radius);let i=this.point1.clone(),e=this.point2.clone();if(i.x>e.x){let t=i.x;i.x=e.x,e.x=t}if(i.y>e.y){let t=i.y;i.y=e.y,e.y=t}let n=new THREE.Vector3(i.x,e.y,i.z);n=t.addLine(i,n),e=new THREE.Vector3(e.x,n.y,e.z),e=t.addLine(n,e);let o=new THREE.Vector3(e.x,i.y,i.z);o=t.addLine(e,o);let s=i=t.addLine(o,i),h=i.distanceTo(this.point3);return h>n.distanceTo(this.point3)&&(s=n,h=n.distanceTo(this.point3)),h>e.distanceTo(this.point3)&&(s=e,h=e.distanceTo(this.point3)),h>o.distanceTo(this.point3)&&(s=o,h=o.distanceTo(this.point3)),{cloudLine:t,pt1:i,pt2:n,pt3:e,pt4:o,leadPt:s}}worldDraw(t){let i=this.getCloudLine();if(i.cloudLine.worldDraw(t),this.text.length>0){let e=i.leadPt,n=new MxDbLeadComment;n.point1=e,n.point2=this.point3,n.text=this.text,n.textHeight=this.textHeight,n.textWidth=this.textWidth,n.fixedSize=this.fixedSize,n.worldDraw(t)}}getGripPoints(){let t=[];return t.push(this.point1),t.push(this.point2),t.push(this.point3),t}moveGripPointsAt(t,i){return 0==t?this.point1.add(i):1==t?this.point2.add(i):2==t&&this.point3.add(i),!0}dwgIn(t){return this.onDwgIn(t),this.point1.copy(t.point1),this.point2.copy(t.point2),this.point3.copy(t.point3),this.text=t.text.substr(0),this.textHeight=t.textHeight,this.radius=t.radius,t.textWidth&&(this.textWidth=t.textWidth),this.fixedSize=t.fixedSize,!0}dwgOut(t){if(this.onDwgOut(t),t.point1=this.point1,t.point2=this.point2,t.point3=this.point3,t.textHeight=this.textHeight,t.text=this.text,t.radius=this.radius,t.textWidth=this.textWidth,t.fixedSize=this.fixedSize,t.type===MxType.MxCloneType.kSaveDwgClone){let i=this.getCloudLine(),e=i.cloudLine.reCalculateDrawGeometryPoint();t.cachePoint=e||[],t.leadPt=i.leadPt}return t}onViewChange(){return!!this.fixedSize&&(this.setNeedUpdateDisplay(!1),!0)}};
@@ -2,7 +2,7 @@
2
2
  import MxCADObject from '../MxCADObject';
3
3
  import MxDbDatabase from '../MxDbDatabase';
4
4
  import MxDbEntity from '../MxDbEntity';
5
- import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
5
+ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
6
6
  export interface MxDrawObjectType {
7
7
  renderer: THREE.WebGLRenderer;
8
8
  addEvent(arg0: string, arg1: (...parmes: any) => any): void;
@@ -55,7 +55,7 @@ export interface MxDrawObjectType {
55
55
  addViewObject(obj: THREE.Object3D): void;
56
56
  removeViewObject(obj: THREE.Object3D): void;
57
57
  removeObject(obj: THREE.Object3D, isRemoveSelectObject?: boolean): void;
58
- saveMxEntityToJson(): object;
58
+ saveMxEntityToJson(isSaveToDWG?: boolean): object;
59
59
  loadMxEntityFromJson(dataString: object): Promise<boolean>;
60
60
  eraseAllMxEntity(): void;
61
61
  makeCurrent(): void;
@@ -631,7 +631,7 @@ export default class MxDrawObject {
631
631
  *
632
632
  * ```
633
633
  */
634
- saveMxEntityToJson(): string;
634
+ saveMxEntityToJson(isSaveToDWG?: boolean): string;
635
635
  /**
636
636
  * 保存所有MxEntity的数据到js对象.
637
637
  * @param
@@ -642,7 +642,7 @@ export default class MxDrawObject {
642
642
  *
643
643
  * ```
644
644
  */
645
- saveMxEntityToObject(): object;
645
+ saveMxEntityToObject(isSaveToDWG?: boolean): object;
646
646
  /**
647
647
  * 从json字符串恢复MxEntity
648
648
  * @param dataString json字符串.
@@ -820,4 +820,22 @@ export default class MxDrawObject {
820
820
  * ```
821
821
  */
822
822
  getViewAngle(): number;
823
+ /**
824
+ * 得到系统变量
825
+ * @example
826
+ * ```typescript
827
+ *
828
+ *
829
+ * ```
830
+ */
831
+ getSysVar(sName: string): any;
832
+ /**
833
+ * 设置系统变量
834
+ * @example
835
+ * ```typescript
836
+ *
837
+ *
838
+ * ```
839
+ */
840
+ setSysVar(sName: string, val: any): void;
823
841
  }
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,r,t,o){return new(t||(t=Promise))(function(n,d){function a(e){try{s(o.next(e))}catch(e){d(e)}}function i(e){try{s(o.throw(e))}catch(e){d(e)}}function s(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t(function(e){e(r)})).then(a,i)}s((o=o.apply(e,r||[])).next())})};import MxCADObject from"../MxCADObject";import MxDbDatabase from"../MxDbDatabase";import MxThreeJS from"../MxThreeJS";export default class MxDrawObject{constructor(e){this._mxdrawObj=e}getScene(){return this._mxdrawObj.getScene()}getCamera(){return this._mxdrawObj.getCamera()}getRenderer(){return this._mxdrawObj.renderer}setMouseRightRotate(e=!0){return this._mxdrawObj.setMouseRightRotate(e)}getFullDisplayRange(){return this._mxdrawObj.getFullDisplayRange()}getCanvas(){return this._mxdrawObj.getCanvas()}updateDisplay(){return this._mxdrawObj.updateDisplay()}createCanvasImageData(e,r){return this._mxdrawObj.createCanvasImageData(e,r)}setViewColor(e){return this._mxdrawObj.setViewColor(e)}setSize(e,r){return this._mxdrawObj.setSize(e,r)}getIntersectObjects(e){return this._mxdrawObj.getIntersectObjects(e)}addObject(e,r=!0){return this._mxdrawObj.addObject(e,r)}addViewObject(e){return this._mxdrawObj.addViewObject(e)}getViewWidth(){return this._mxdrawObj.getViewWidth()}getViewHeight(){return this._mxdrawObj.getViewHeight()}removeObject(e,r=!0){return this._mxdrawObj.removeObject(e,r)}zoomInitialStates(){return this._mxdrawObj.zoomInitialStates()}zoomScale(e){return this._mxdrawObj.zoomScale(e)}zoomW(e,r,t){return this._mxdrawObj.zoomW(e,r,t)}zoomCenter(e,r){return this._mxdrawObj.zoomCenter(e,r)}initZoomW(e,r){return this._mxdrawObj.initZoomW(e,r)}addEvent(e,r){return this._mxdrawObj.addEvent(e,r)}on(e,r){return this._mxdrawObj.addEvent(e,r)}setIniset(e){return this._mxdrawObj.setIniset(e)}screenCoord2World(e,r,t){return this._mxdrawObj.screenCoord2World(e,r,t)}worldCoord2Screen(e,r,t){return this._mxdrawObj.worldCoord2Screen(e,r,t)}screenCoord2Doc(e,r){return this._mxdrawObj.screenCoord2Doc(e,r,0)}worldCoordLong2Doc(e){return this._mxdrawObj.worldCoordLong2Doc(e)}docCoordLong2World(e){return this._mxdrawObj.docCoordLong2World(e)}docCoord2World(e,r,t){return this._mxdrawObj.docCoord2World(e,r,t)}docCoord2World2(e){return this._mxdrawObj.docCoord2World(e.x,e.y,e.z)}worldCoord2Doc(e,r,t){return this._mxdrawObj.worldCoord2Doc(e,r,t)}worldCoord2Doc2(e){return this._mxdrawObj.worldCoord2Doc(e.x,e.y,e.z)}docCoord2Screen(e,r){return this._mxdrawObj.docCoord2Screen(e,r,0)}screenCoordLong2Doc(e){return this._mxdrawObj.screenCoordLong2Doc(e)}docCoordLong2Screen(e){return this._mxdrawObj.docCoordLong2Screen(e)}screenCoordLong2World(e){return this._mxdrawObj.screenCoordLong2World(e)}worldCoordLong2Screen(e){return this._mxdrawObj.worldCoordLong2Screen(e)}initRendererParam(e){return this._mxdrawObj.initRendererParam(e)}addMxEntity(e){return this._mxdrawObj.addMxEntity(e)}getMxCurrentSelect(){let e=this._mxdrawObj.getMxAllSelect();return 0==e.length&&(e=this._mxdrawObj.getPrvCommandSelect()),e}addMxCurrentSelect(e){return this._mxdrawObj.addMxCurrentSelect(e)}clearMxCurrentSelect(){return this._mxdrawObj.clearMxCurrentSelect()}getMxEntity(e){return this._mxdrawObj.getMxEntityUserObject(e)}findMxEntityAtPoint(e){return this._mxdrawObj.findMxEntityAtPoint(e)}getAllMxEntity(){return this._mxdrawObj.getAllMxEntity()}setMouseMiddlePan(e){return this._mxdrawObj.setMouseMiddlePan(e)}resetThreeJSControls(){return this._mxdrawObj.resetThreeJSControls()}enableZoom(e){return this._mxdrawObj.enableZoom(e)}enablePan(e){return this._mxdrawObj.enablePan(e)}eraseMxEntity(e){return this._mxdrawObj.eraseMxEntity(e)}removeViewObject(e){this._mxdrawObj.removeViewObject(e)}saveMxEntityToJson(){return JSON.stringify(this._mxdrawObj.saveMxEntityToJson())}saveMxEntityToObject(){return this._mxdrawObj.saveMxEntityToJson()}loadMxEntityFromJson(e,r=null){return __awaiter(this,void 0,void 0,function*(){if(r){let e=r.length;for(let t=0;t<e;t++)yield MxThreeJS.loadSVG(r[t])}return this.getAllMxEntity().forEach(e=>{for(let r in e)Reflect.deleteProperty(e,r)}),"string"==typeof e?this._mxdrawObj.loadMxEntityFromJson(JSON.parse(e)):this._mxdrawObj.loadMxEntityFromJson(e)})}eraseAllMxEntity(){return this._mxdrawObj.eraseAllMxEntity()}makeCurrent(){this._mxdrawObj.makeCurrent()}getViewCenterDocCoord(){return this._mxdrawObj.getViewCenterDocCoord()}updateCanvasSize(){this._mxdrawObj.updateCanvasSize()}newFile(e,r,t,o){return this._mxdrawObj.newFile(e,r,t,o)}stopAllLoading(){this._mxdrawObj.stopAllLoading()}getOrbitControls(){return this._mxdrawObj.getOrbitControls()}enableViewControls(e){return this._mxdrawObj.enableViewControls(e)}getMxDatabase(){return new MxDbDatabase(this._mxdrawObj.getMxDatabase())}setZoomSpeed(e){return this._mxdrawObj.setZoomSpeed(e)}getMxCAD(){let e=this._mxdrawObj.getMxCAD();return new MxCADObject(e)}resetRenderer(){return this._mxdrawObj.resetRenderer()}setRequestHeader(e){return this._mxdrawObj.setRequestHeader(e)}closeWebSocket(){return this._mxdrawObj.closeWebSocket()}cadCoord2Doc(e,r,t){return this._mxdrawObj.cadCoord2Doc(e,r,t)}docCoord2Cad(e,r,t){return this._mxdrawObj.docCoord2Cad(e,r,t)}setViewAngle(e){return this._mxdrawObj.setViewAngle(e)}getViewAngle(){return this._mxdrawObj.getViewAngle()}};
1
+ var __awaiter=this&&this.__awaiter||function(e,r,t,o){return new(t||(t=Promise))(function(n,a){function d(e){try{s(o.next(e))}catch(e){a(e)}}function i(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t(function(e){e(r)})).then(d,i)}s((o=o.apply(e,r||[])).next())})};import MxCADObject from"../MxCADObject";import MxDbDatabase from"../MxDbDatabase";import MxThreeJS from"../MxThreeJS";export default class MxDrawObject{constructor(e){this._mxdrawObj=e}getScene(){return this._mxdrawObj.getScene()}getCamera(){return this._mxdrawObj.getCamera()}getRenderer(){return this._mxdrawObj.renderer}setMouseRightRotate(e=!0){return this._mxdrawObj.setMouseRightRotate(e)}getFullDisplayRange(){return this._mxdrawObj.getFullDisplayRange()}getCanvas(){return this._mxdrawObj.getCanvas()}updateDisplay(){return this._mxdrawObj.updateDisplay()}createCanvasImageData(e,r){return this._mxdrawObj.createCanvasImageData(e,r)}setViewColor(e){return this._mxdrawObj.setViewColor(e)}setSize(e,r){return this._mxdrawObj.setSize(e,r)}getIntersectObjects(e){return this._mxdrawObj.getIntersectObjects(e)}addObject(e,r=!0){return this._mxdrawObj.addObject(e,r)}addViewObject(e){return this._mxdrawObj.addViewObject(e)}getViewWidth(){return this._mxdrawObj.getViewWidth()}getViewHeight(){return this._mxdrawObj.getViewHeight()}removeObject(e,r=!0){return this._mxdrawObj.removeObject(e,r)}zoomInitialStates(){return this._mxdrawObj.zoomInitialStates()}zoomScale(e){return this._mxdrawObj.zoomScale(e)}zoomW(e,r,t){return this._mxdrawObj.zoomW(e,r,t)}zoomCenter(e,r){return this._mxdrawObj.zoomCenter(e,r)}initZoomW(e,r){return this._mxdrawObj.initZoomW(e,r)}addEvent(e,r){return this._mxdrawObj.addEvent(e,r)}on(e,r){return this._mxdrawObj.addEvent(e,r)}setIniset(e){return this._mxdrawObj.setIniset(e)}screenCoord2World(e,r,t){return this._mxdrawObj.screenCoord2World(e,r,t)}worldCoord2Screen(e,r,t){return this._mxdrawObj.worldCoord2Screen(e,r,t)}screenCoord2Doc(e,r){return this._mxdrawObj.screenCoord2Doc(e,r,0)}worldCoordLong2Doc(e){return this._mxdrawObj.worldCoordLong2Doc(e)}docCoordLong2World(e){return this._mxdrawObj.docCoordLong2World(e)}docCoord2World(e,r,t){return this._mxdrawObj.docCoord2World(e,r,t)}docCoord2World2(e){return this._mxdrawObj.docCoord2World(e.x,e.y,e.z)}worldCoord2Doc(e,r,t){return this._mxdrawObj.worldCoord2Doc(e,r,t)}worldCoord2Doc2(e){return this._mxdrawObj.worldCoord2Doc(e.x,e.y,e.z)}docCoord2Screen(e,r){return this._mxdrawObj.docCoord2Screen(e,r,0)}screenCoordLong2Doc(e){return this._mxdrawObj.screenCoordLong2Doc(e)}docCoordLong2Screen(e){return this._mxdrawObj.docCoordLong2Screen(e)}screenCoordLong2World(e){return this._mxdrawObj.screenCoordLong2World(e)}worldCoordLong2Screen(e){return this._mxdrawObj.worldCoordLong2Screen(e)}initRendererParam(e){return this._mxdrawObj.initRendererParam(e)}addMxEntity(e){return this._mxdrawObj.addMxEntity(e)}getMxCurrentSelect(){let e=this._mxdrawObj.getMxAllSelect();return 0==e.length&&(e=this._mxdrawObj.getPrvCommandSelect()),e}addMxCurrentSelect(e){return this._mxdrawObj.addMxCurrentSelect(e)}clearMxCurrentSelect(){return this._mxdrawObj.clearMxCurrentSelect()}getMxEntity(e){return this._mxdrawObj.getMxEntityUserObject(e)}findMxEntityAtPoint(e){return this._mxdrawObj.findMxEntityAtPoint(e)}getAllMxEntity(){return this._mxdrawObj.getAllMxEntity()}setMouseMiddlePan(e){return this._mxdrawObj.setMouseMiddlePan(e)}resetThreeJSControls(){return this._mxdrawObj.resetThreeJSControls()}enableZoom(e){return this._mxdrawObj.enableZoom(e)}enablePan(e){return this._mxdrawObj.enablePan(e)}eraseMxEntity(e){return this._mxdrawObj.eraseMxEntity(e)}removeViewObject(e){this._mxdrawObj.removeViewObject(e)}saveMxEntityToJson(e){return JSON.stringify(this._mxdrawObj.saveMxEntityToJson(e))}saveMxEntityToObject(e){return this._mxdrawObj.saveMxEntityToJson(e)}loadMxEntityFromJson(e,r=null){return __awaiter(this,void 0,void 0,function*(){if(r){let e=r.length;for(let t=0;t<e;t++)yield MxThreeJS.loadSVG(r[t])}return this.getAllMxEntity().forEach(e=>{for(let r in e)Reflect.deleteProperty(e,r)}),"string"==typeof e?this._mxdrawObj.loadMxEntityFromJson(JSON.parse(e)):this._mxdrawObj.loadMxEntityFromJson(e)})}eraseAllMxEntity(){return this._mxdrawObj.eraseAllMxEntity()}makeCurrent(){this._mxdrawObj.makeCurrent()}getViewCenterDocCoord(){return this._mxdrawObj.getViewCenterDocCoord()}updateCanvasSize(){this._mxdrawObj.updateCanvasSize()}newFile(e,r,t,o){return this._mxdrawObj.newFile(e,r,t,o)}stopAllLoading(){this._mxdrawObj.stopAllLoading()}getOrbitControls(){return this._mxdrawObj.getOrbitControls()}enableViewControls(e){return this._mxdrawObj.enableViewControls(e)}getMxDatabase(){return new MxDbDatabase(this._mxdrawObj.getMxDatabase())}setZoomSpeed(e){return this._mxdrawObj.setZoomSpeed(e)}getMxCAD(){let e=this._mxdrawObj.getMxCAD();return new MxCADObject(e)}resetRenderer(){return this._mxdrawObj.resetRenderer()}setRequestHeader(e){return this._mxdrawObj.setRequestHeader(e)}closeWebSocket(){return this._mxdrawObj.closeWebSocket()}cadCoord2Doc(e,r,t){return this._mxdrawObj.cadCoord2Doc(e,r,t)}docCoord2Cad(e,r,t){return this._mxdrawObj.docCoord2Cad(e,r,t)}setViewAngle(e){return this._mxdrawObj.setViewAngle(e)}getViewAngle(){return this._mxdrawObj.getViewAngle()}getSysVar(e){return this._mxdrawObj.sysVariable().getSysVar()}setSysVar(e,r){return this._mxdrawObj.sysVariable().setSysVar(e,r)}};
@@ -11,7 +11,9 @@ declare enum MxCloneType {
11
11
  /** 动态拖动Clone */
12
12
  kDragClone = 2,
13
13
  /** 数据归档 */
14
- kMxFileClone = 3
14
+ kMxFileClone = 3,
15
+ /** 保存数据到DWG文件 */
16
+ kSaveDwgClone = 4
15
17
  }
16
18
  /**
17
19
  * 控件对象缺省的绘制顺序
@@ -1 +1 @@
1
- var MxCloneType;!function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone",e[e.kMxFileClone=3]="kMxFileClone"}(MxCloneType||(MxCloneType={}));export var MxDefaultRenderOrder;!function(e){e[e.kCADMeshRenderOrder=10]="kCADMeshRenderOrder",e[e.kCADCurveRenderOrder=20]="kCADCurveRenderOrder",e[e.kMxEntityRenderOrder=30]="kMxEntityRenderOrder",e[e.kGripRenderOrder=110]="kGripRenderOrder",e[e.kDynJigRenderOrder=120]="kDynJigRenderOrder"}(MxDefaultRenderOrder||(MxDefaultRenderOrder={}));export var InputToucheType;!function(e){e[e.kGetBegan=1]="kGetBegan",e[e.kGetEnd=2]="kGetEnd"}(InputToucheType||(InputToucheType={}));export default{MxCloneType:MxCloneType,MxDefaultRenderOrder:MxDefaultRenderOrder,InputToucheType:InputToucheType};
1
+ var MxCloneType;!function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone",e[e.kMxFileClone=3]="kMxFileClone",e[e.kSaveDwgClone=4]="kSaveDwgClone"}(MxCloneType||(MxCloneType={}));export var MxDefaultRenderOrder;!function(e){e[e.kCADMeshRenderOrder=10]="kCADMeshRenderOrder",e[e.kCADCurveRenderOrder=20]="kCADCurveRenderOrder",e[e.kMxEntityRenderOrder=30]="kMxEntityRenderOrder",e[e.kGripRenderOrder=110]="kGripRenderOrder",e[e.kDynJigRenderOrder=120]="kDynJigRenderOrder"}(MxDefaultRenderOrder||(MxDefaultRenderOrder={}));export var InputToucheType;!function(e){e[e.kGetBegan=1]="kGetBegan",e[e.kGetEnd=2]="kGetEnd"}(InputToucheType||(InputToucheType={}));export default{MxCloneType:MxCloneType,MxDefaultRenderOrder:MxDefaultRenderOrder,InputToucheType:InputToucheType};
@@ -11,7 +11,9 @@ declare enum MxCloneType {
11
11
  /** 动态拖动Clone */
12
12
  kDragClone = 2,
13
13
  /** 数据归档 */
14
- kMxFileClone = 3
14
+ kMxFileClone = 3,
15
+ /** 保存数据到DWG文件 */
16
+ kSaveDwgClone = 4
15
17
  }
16
18
  /**
17
19
  * 控件对象缺省的绘制顺序
@@ -1 +1 @@
1
- var MxCloneType;!function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone",e[e.kMxFileClone=3]="kMxFileClone"}(MxCloneType||(MxCloneType={}));export var MxDefaultRenderOrder;!function(e){e[e.kCADMeshRenderOrder=10]="kCADMeshRenderOrder",e[e.kCADCurveRenderOrder=20]="kCADCurveRenderOrder",e[e.kMxEntityRenderOrder=30]="kMxEntityRenderOrder",e[e.kGripRenderOrder=110]="kGripRenderOrder",e[e.kDynJigRenderOrder=120]="kDynJigRenderOrder"}(MxDefaultRenderOrder||(MxDefaultRenderOrder={}));export var InputToucheType;!function(e){e[e.kGetBegan=1]="kGetBegan",e[e.kGetEnd=2]="kGetEnd"}(InputToucheType||(InputToucheType={}));export default{MxCloneType:MxCloneType,MxDefaultRenderOrder:MxDefaultRenderOrder,InputToucheType:InputToucheType};
1
+ var MxCloneType;!function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone",e[e.kMxFileClone=3]="kMxFileClone",e[e.kSaveDwgClone=4]="kSaveDwgClone"}(MxCloneType||(MxCloneType={}));export var MxDefaultRenderOrder;!function(e){e[e.kCADMeshRenderOrder=10]="kCADMeshRenderOrder",e[e.kCADCurveRenderOrder=20]="kCADCurveRenderOrder",e[e.kMxEntityRenderOrder=30]="kMxEntityRenderOrder",e[e.kGripRenderOrder=110]="kGripRenderOrder",e[e.kDynJigRenderOrder=120]="kDynJigRenderOrder"}(MxDefaultRenderOrder||(MxDefaultRenderOrder={}));export var InputToucheType;!function(e){e[e.kGetBegan=1]="kGetBegan",e[e.kGetEnd=2]="kGetEnd"}(InputToucheType||(InputToucheType={}));export default{MxCloneType:MxCloneType,MxDefaultRenderOrder:MxDefaultRenderOrder,InputToucheType:InputToucheType};