mxdraw 0.1.111 → 0.1.112

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
@@ -507,7 +507,10 @@ declare abstract class MxDbEntity {
507
507
  * }
508
508
  * ```
509
509
  */
510
- protected dwgInHelp<T extends string[]>(obj: any, aryProp: T, hooks?: {
510
+ protected dwgInHelp<T extends (string | {
511
+ key: string;
512
+ default: any;
513
+ })[]>(obj: any, aryProp: T, hooks?: {
511
514
  getVal?: (v: any) => any;
512
515
  getCacheVal?: (v: any) => any;
513
516
  }): boolean;
@@ -525,7 +528,10 @@ declare abstract class MxDbEntity {
525
528
  * }
526
529
  * ```
527
530
  */
528
- protected dwgOutHelp(obj: any, aryProp: string[]): any;
531
+ protected dwgOutHelp(obj: any, aryProp: (string | {
532
+ key: string;
533
+ default: any;
534
+ })[]): any;
529
535
  protected callEvent(sEventName: string, param?: any): any;
530
536
  /**
531
537
  * 新创建一个自定义对象 (默认调用该对象的构造函数来创建新的对象)
@@ -1670,6 +1676,24 @@ declare class MxDrawObject {
1670
1676
  * ```
1671
1677
  */
1672
1678
  getViewAngle(): number;
1679
+ /**
1680
+ * 得到系统变量
1681
+ * @example
1682
+ * ```typescript
1683
+ *
1684
+ *
1685
+ * ```
1686
+ */
1687
+ getSysVar(sName: string): any;
1688
+ /**
1689
+ * 设置系统变量
1690
+ * @example
1691
+ * ```typescript
1692
+ *
1693
+ *
1694
+ * ```
1695
+ */
1696
+ setSysVar(sName: string, val: any): void;
1673
1697
  }
1674
1698
 
1675
1699
  /**
@@ -3672,9 +3696,9 @@ declare class MxDbRegularPolygon extends MxDbEntity {
3672
3696
  * */
3673
3697
  declare class MxDbLeadComment extends MxDbEntity {
3674
3698
  /** 标注点 */
3675
- point1: three.Vector3;
3699
+ point1: THREE.Vector3;
3676
3700
  /** 文字显示位置 */
3677
- point2: three.Vector3;
3701
+ point2: THREE.Vector3;
3678
3702
  /** 文字内容 */
3679
3703
  text: string;
3680
3704
  /** 文字高度 */
@@ -3685,8 +3709,8 @@ declare class MxDbLeadComment extends MxDbEntity {
3685
3709
  getTypeName(): string;
3686
3710
  create(): MxDbEntity;
3687
3711
  worldDraw(pWorldDraw: McGiWorldDraw): void;
3688
- getGripPoints(): Array<three.Vector3>;
3689
- moveGripPointsAt(index: number, offset: three.Vector3): boolean;
3712
+ getGripPoints(): Array<THREE.Vector3>;
3713
+ moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
3690
3714
  dwgIn(obj: any): boolean;
3691
3715
  dwgOut(obj: any): object;
3692
3716
  protected onViewChange(): 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}};
@@ -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,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;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)}};
@@ -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;
@@ -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(){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()}getSysVar(e){return this._mxdrawObj.sysVariable().getSysVar()}setSysVar(e,r){return this._mxdrawObj.sysVariable().setSysVar(e,r)}};