mxdraw 0.1.105 → 0.1.106
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 +3802 -0
- package/dist/{types/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.d.ts → lib/MxModule/McEdGetPointWorldDrawObject/index.d.ts} +0 -0
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +1 -1
- package/dist/{types/MxModule/McGePoint3d/McGePoint3d.d.ts → lib/MxModule/McGePoint3d/index.d.ts} +0 -0
- package/dist/lib/MxModule/McGePoint3d/index.js +1 -1
- package/dist/{types/MxModule/McGePoint3dArray/McGePoint3dArray.d.ts → lib/MxModule/McGePoint3dArray/index.d.ts} +0 -0
- package/dist/lib/MxModule/McGePoint3dArray/index.js +1 -1
- package/dist/{types/MxModule/McGeTool/McGeTool.d.ts → lib/MxModule/McGeTool/index.d.ts} +3 -2
- package/dist/lib/MxModule/McGeTool/index.js +1 -1
- package/dist/{types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts → lib/MxModule/McGiWorldDraw/index.d.ts} +0 -0
- package/dist/lib/MxModule/McGiWorldDraw/index.js +1 -1
- package/dist/{types/MxModule/McGiWorldDrawType/McGiWorldDrawType.d.ts → lib/MxModule/McGiWorldDrawType/index.d.ts} +0 -0
- package/dist/lib/MxModule/McGiWorldDrawType/index.js +1 -1
- package/dist/{types/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.d.ts → lib/MxModule/MrxDbgUiPrBaseReturn/index.d.ts} +0 -0
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +1 -1
- package/dist/{types/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.d.ts → lib/MxModule/MrxDbgUiPrPoint/index.d.ts} +2 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +1 -1
- package/dist/{types/MxModule/MrxDbgUtils/MrxDbgUtils.d.ts → lib/MxModule/MrxDbgUtils/index.d.ts} +3 -2
- package/dist/lib/MxModule/MrxDbgUtils/index.js +1 -1
- package/dist/{types/MxModule/Mx3PointArc/Mx3PointArc.d.ts → lib/MxModule/Mx3PointArc/index.d.ts} +5 -6
- package/dist/lib/MxModule/Mx3PointArc/index.js +1 -1
- package/dist/{types/MxModule/MxCADObject/MxCADObject.d.ts → lib/MxModule/MxCADObject/index.d.ts} +0 -0
- package/dist/lib/MxModule/MxCADObject/index.js +1 -1
- package/dist/{types/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.d.ts → lib/MxModule/MxDb2LineAngularDimension/index.d.ts} +2 -4
- package/dist/lib/MxModule/MxDb2LineAngularDimension/index.js +1 -1
- package/dist/{types/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.d.ts → lib/MxModule/MxDbAlignedDimension/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +1 -1
- package/dist/{types/MxModule/MxDbAnyLine/MxDbAnyLine.d.ts → lib/MxModule/MxDbAnyLine/index.d.ts} +4 -5
- package/dist/lib/MxModule/MxDbAnyLine/index.js +1 -1
- package/dist/{types/MxModule/MxDbArea/MxDbArea.d.ts → lib/MxModule/MxDbArea/index.d.ts} +1 -3
- package/dist/lib/MxModule/MxDbArea/index.js +1 -1
- package/dist/{types/MxModule/MxDbCloudLine/MxDbCloudLine.d.ts → lib/MxModule/MxDbCloudLine/index.d.ts} +4 -5
- package/dist/lib/MxModule/MxDbCloudLine/index.js +1 -1
- package/dist/{types/MxModule/MxDbCoord/MxDbCoord.d.ts → lib/MxModule/MxDbCoord/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbCoord/index.js +1 -1
- package/dist/{types/MxModule/MxDbDatabase/MxDbDatabase.d.ts → lib/MxModule/MxDbDatabase/index.d.ts} +0 -0
- package/dist/lib/MxModule/MxDbDatabase/index.js +1 -1
- package/dist/{types/MxModule/MxDbEllipse/MxDbEllipse.d.ts → lib/MxModule/MxDbEllipse/index.d.ts} +4 -5
- package/dist/lib/MxModule/MxDbEllipse/index.js +1 -1
- package/dist/{types/MxModule/MxDbEntity/MxDbEntity.d.ts → lib/MxModule/MxDbEntity/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbEntity/index.js +1 -1
- package/dist/{types/MxModule/MxDbGroup/MxDbGroup.d.ts → lib/MxModule/MxDbGroup/index.d.ts} +0 -0
- package/dist/lib/MxModule/MxDbGroup/index.js +1 -1
- package/dist/{types/MxModule/MxDbHatch/MxDbHatch.d.ts → lib/MxModule/MxDbHatch/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbHatch/index.js +1 -1
- package/dist/{types/MxModule/MxDbImage/MxDbImage.d.ts → lib/MxModule/MxDbImage/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbImage/index.js +1 -1
- package/dist/{types/MxModule/MxDbLayerTableRecord/MxDbLayerTableRecord.d.ts → lib/MxModule/MxDbLayerTableRecord/index.d.ts} +0 -0
- package/dist/lib/MxModule/MxDbLayerTableRecord/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxDbLeadComment/MxDbLeadComment.d.ts +0 -0
- package/dist/lib/MxModule/MxDbLeadComment/MxDbLeadComment.js +1 -1
- package/dist/lib/MxModule/MxDbLeadComment/index.d.ts +24 -0
- package/dist/lib/MxModule/MxDbLeadComment/index.js +1 -1
- package/dist/{types/MxModule/MxDbLeadTag/MxDbLeadTag.d.ts → lib/MxModule/MxDbLeadTag/index.d.ts} +1 -2
- package/dist/lib/MxModule/MxDbLeadTag/index.js +1 -1
- package/dist/{types/MxModule/MxDbLine/MxDbLine.d.ts → lib/MxModule/MxDbLine/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbLine/index.js +1 -1
- package/dist/{types/MxModule/MxDbPolyline/MxDbPolyline.d.ts → lib/MxModule/MxDbPolyline/index.d.ts} +0 -1
- package/dist/lib/MxModule/MxDbPolyline/index.js +1 -1
- package/dist/{types/MxModule/MxDbRect/MxDbRect.d.ts → lib/MxModule/MxDbRect/index.d.ts} +5 -6
- package/dist/lib/MxModule/MxDbRect/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxDbRectBoxLeadComment/MxDbRectBoxLeadComment.d.ts +0 -2
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/MxDbRectBoxLeadComment.js +1 -1
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/index.d.ts +26 -0
- package/dist/lib/MxModule/MxDbRectBoxLeadComment/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxDbRegularPolygon/MxDbRegularPolygon.d.ts +4 -5
- package/dist/lib/MxModule/MxDbRegularPolygon/MxDbRegularPolygon.js +1 -1
- package/dist/lib/MxModule/MxDbRegularPolygon/index.d.ts +20 -0
- package/dist/lib/MxModule/MxDbRegularPolygon/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxDbSVG/MxDbSVG.d.ts +0 -1
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +1 -1
- package/dist/lib/MxModule/MxDbSVG/index.d.ts +92 -0
- package/dist/lib/MxModule/MxDbSVG/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxDbSVGText/MxDbSVGText.d.ts +0 -1
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +1 -1
- package/dist/lib/MxModule/MxDbSVGText/index.d.ts +18 -0
- package/dist/lib/MxModule/MxDbSVGText/index.js +1 -1
- package/dist/{types/MxModule/MxDbText/MxDbText.d.ts → lib/MxModule/MxDbText/index.d.ts} +3 -4
- package/dist/lib/MxModule/MxDbText/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxDrawObject/MxDrawObject.d.ts +0 -0
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +1 -1
- package/dist/lib/MxModule/MxDrawObject/index.d.ts +822 -0
- package/dist/lib/MxModule/MxDrawObject/index.js +1 -1
- package/dist/{types/MxModule/MxFilters/MxFilters.d.ts → lib/MxModule/MxFilters/index.d.ts} +3 -4
- package/dist/lib/MxModule/MxFilters/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxFun/MxFun.d.ts +3 -3
- package/dist/lib/MxModule/MxFun/MxFun.js +1 -1
- package/dist/lib/MxModule/MxFun/index.d.ts +592 -0
- package/dist/lib/MxModule/MxFun/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxThreeJS/MxThreeJS.d.ts +10 -11
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +1 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.d.ts +2 -0
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -1
- package/dist/lib/MxModule/MxThreeJS/index.d.ts +3 -0
- package/dist/lib/MxModule/MxThreeJS/index.js +1 -1
- package/dist/{types → lib}/MxModule/MxType/MxType.d.ts +0 -0
- package/dist/lib/MxModule/MxType/MxType.js +1 -1
- package/dist/lib/MxModule/MxType/index.d.ts +44 -0
- package/dist/lib/MxModule/MxType/index.js +1 -1
- package/dist/{types/MxModule/Mxassembly/Mxassembly.d.ts → lib/MxModule/Mxassembly/index.d.ts} +9 -7
- package/dist/lib/MxModule/Mxassembly/index.js +1 -1
- package/dist/{types/MxModule/loadCoreCode/loadCoreCode.d.ts → lib/MxModule/loadCoreCode/index.d.ts} +0 -0
- package/dist/lib/MxModule/loadCoreCode/index.js +1 -1
- package/dist/{types → lib}/MxModule/loadCoreCode/mxUiData.d.ts +2 -2
- package/dist/lib/MxModule/loadCoreCode/mxUiData.js +1 -1
- package/dist/{types → lib}/MxModule/loadCoreCode/mxcadassembly_es5.d.ts +0 -0
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1 -1
- package/dist/{types → lib}/MxModule/loadCoreCode/mxfun.es5.d.ts +0 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
- package/dist/{types → lib}/MxModule/store/PubsubClass.d.ts +0 -0
- package/dist/lib/MxModule/store/PubsubClass.js +1 -1
- package/dist/{types → lib}/MxModule/store/StoreClass.d.ts +1 -1
- package/dist/lib/MxModule/store/StoreClass.js +1 -1
- package/dist/{types → lib}/MxModule/store/index.d.ts +0 -0
- package/dist/lib/MxModule/store/index.js +1 -1
- package/dist/{types → lib}/MxModule/store/store.d.ts +4 -4
- package/dist/lib/MxModule/store/store.js +1 -1
- package/dist/{types/MxModule/useCanvasResizeListener/useCanvasResizeListener.d.ts → lib/MxModule/useCanvasResizeListener/index.d.ts} +2 -2
- package/dist/lib/MxModule/useCanvasResizeListener/index.js +1 -1
- package/dist/{types → lib}/doc.d.ts +1 -1
- package/dist/lib/doc.js +1 -1
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/mxdraw.d.ts +43 -0
- package/dist/lib/mxdraw.js +1 -1
- package/dist/{types → lib}/tools/algorithm/math.d.ts +0 -0
- package/dist/lib/tools/algorithm/math.js +1 -1
- package/dist/{types → lib}/tools/algorithm/random.d.ts +0 -0
- package/dist/lib/tools/algorithm/random.js +1 -1
- package/dist/{types → lib}/tools/dom/create.d.ts +0 -0
- package/dist/lib/tools/dom/create.js +1 -1
- package/dist/{types → lib}/tools/dynamicImport/index.d.ts +0 -0
- package/dist/lib/tools/dynamicImport/index.js +1 -1
- package/dist/{types → lib}/tools/formatting/index.d.ts +0 -0
- package/dist/lib/tools/formatting/index.js +1 -1
- package/dist/{types → lib}/tools/proxy/index.d.ts +0 -0
- package/dist/lib/tools/proxy/index.js +1 -1
- package/dist/{types → lib}/tools/three/index.d.ts +14 -15
- package/dist/lib/tools/three/index.js +1 -1
- package/dist/mxdraw.umd.js +1 -1
- package/package.json +16 -10
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +0 -1
- package/dist/lib/MxModule/McGePoint3d/McGePoint3d.js +0 -1
- package/dist/lib/MxModule/McGePoint3dArray/McGePoint3dArray.js +0 -1
- package/dist/lib/MxModule/McGeTool/McGeTool.js +0 -1
- package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +0 -1
- package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +0 -1
- package/dist/lib/MxModule/MrxDbgUtils/MrxDbgUtils.js +0 -1
- package/dist/lib/MxModule/Mx3PointArc/Mx3PointArc.js +0 -1
- package/dist/lib/MxModule/MxCADObject/MxCADObject.js +0 -1
- package/dist/lib/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.js +0 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +0 -1
- package/dist/lib/MxModule/MxDbAnyLine/MxDbAnyLine.js +0 -1
- package/dist/lib/MxModule/MxDbArea/MxDbArea.js +0 -1
- package/dist/lib/MxModule/MxDbCloudLine/MxDbCloudLine.js +0 -1
- package/dist/lib/MxModule/MxDbCoord/MxDbCoord.js +0 -1
- package/dist/lib/MxModule/MxDbDatabase/MxDbDatabase.js +0 -1
- package/dist/lib/MxModule/MxDbEllipse/MxDbEllipse.js +0 -1
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +0 -1
- package/dist/lib/MxModule/MxDbGroup/MxDbGroup.js +0 -1
- package/dist/lib/MxModule/MxDbHatch/MxDbHatch.js +0 -1
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +0 -1
- package/dist/lib/MxModule/MxDbLayerTableRecord/MxDbLayerTableRecord.js +0 -1
- package/dist/lib/MxModule/MxDbLeadTag/MxDbLeadTag.js +0 -1
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +0 -1
- package/dist/lib/MxModule/MxDbPolyline/MxDbPolyline.js +0 -1
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +0 -1
- package/dist/lib/MxModule/MxDbText/MxDbText.js +0 -1
- package/dist/lib/MxModule/MxFilters/MxFilters.js +0 -1
- package/dist/lib/MxModule/Mxassembly/Mxassembly.js +0 -1
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +0 -1
- package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +0 -1
- package/dist/mxdraw.es5.js +0 -1
- package/dist/types/MxModule/McEdGetPointWorldDrawObject/index.d.ts +0 -3
- package/dist/types/MxModule/McGePoint3d/index.d.ts +0 -3
- package/dist/types/MxModule/McGePoint3dArray/index.d.ts +0 -3
- package/dist/types/MxModule/McGeTool/index.d.ts +0 -4
- package/dist/types/MxModule/McGiWorldDraw/index.d.ts +0 -2
- package/dist/types/MxModule/McGiWorldDrawType/index.d.ts +0 -2
- package/dist/types/MxModule/MrxDbgUiPrBaseReturn/index.d.ts +0 -3
- package/dist/types/MxModule/MrxDbgUiPrPoint/index.d.ts +0 -3
- package/dist/types/MxModule/MrxDbgUtils/index.d.ts +0 -4
- package/dist/types/MxModule/Mx3PointArc/index.d.ts +0 -3
- package/dist/types/MxModule/MxCADObject/index.d.ts +0 -3
- package/dist/types/MxModule/MxDb2LineAngularDimension/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbAlignedDimension/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbAnyLine/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbArea/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbCloudLine/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbCoord/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbDatabase/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbEllipse/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbEntity/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbGroup/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbHatch/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbImage/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbLayerTableRecord/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbLeadComment/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbLeadTag/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbLine/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbPolyline/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbRect/index.d.ts +0 -2
- package/dist/types/MxModule/MxDbRectBoxLeadComment/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbRegularPolygon/index.d.ts +0 -2
- package/dist/types/MxModule/MxDbSVG/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbSVGText/index.d.ts +0 -3
- package/dist/types/MxModule/MxDbText/index.d.ts +0 -3
- package/dist/types/MxModule/MxDrawObject/index.d.ts +0 -3
- package/dist/types/MxModule/MxFilters/index.d.ts +0 -2
- package/dist/types/MxModule/MxFun/index.d.ts +0 -3
- package/dist/types/MxModule/MxThreeJS/MxThreeJS.mixin.d.ts +0 -2
- package/dist/types/MxModule/MxThreeJS/index.d.ts +0 -3
- package/dist/types/MxModule/MxType/index.d.ts +0 -2
- package/dist/types/MxModule/Mxassembly/index.d.ts +0 -3
- package/dist/types/MxModule/loadCoreCode/index.d.ts +0 -3
- package/dist/types/MxModule/useCanvasResizeListener/index.d.ts +0 -3
- package/dist/types/mxdraw.d.ts +0 -86
|
@@ -1 +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}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.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),!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}};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
2
|
+
import MxDbEntity from '../MxDbEntity';
|
|
3
|
+
/**
|
|
4
|
+
* MxDbRectBoxLeadComment 引线审图标注
|
|
5
|
+
* */
|
|
6
|
+
export default class MxDbRectBoxLeadComment extends MxDbEntity {
|
|
7
|
+
/** 云线矩形的对角点1 */
|
|
8
|
+
point1: THREE.Vector3;
|
|
9
|
+
/** 云线矩形的对角点2 */
|
|
10
|
+
point2: THREE.Vector3;
|
|
11
|
+
/** 要标注的内容位置 */
|
|
12
|
+
point3: THREE.Vector3;
|
|
13
|
+
/** 要显示的文字内容*/
|
|
14
|
+
text: string;
|
|
15
|
+
/**文字高度*/
|
|
16
|
+
textHeight: number;
|
|
17
|
+
/** 云线的半圆弧半径 */
|
|
18
|
+
radius: number;
|
|
19
|
+
getTypeName(): string;
|
|
20
|
+
create(): MxDbEntity;
|
|
21
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
22
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
23
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
24
|
+
dwgIn(obj: any): boolean;
|
|
25
|
+
dwgOut(obj: any): object;
|
|
26
|
+
}
|
|
@@ -1 +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}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 p=new MxDbLeadComment;p.point1=i,p.point2=this.point3,p.text=this.text,p.textHeight=this.textHeight,p.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,!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}};
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import MxDbEntity from '../MxDbEntity';
|
|
2
|
-
import { Vector3 } from 'three';
|
|
3
2
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
4
3
|
/**
|
|
5
4
|
* MxDbRegularPolygon 正多边形
|
|
6
5
|
*/
|
|
7
6
|
export default class MxDbRegularPolygon extends MxDbEntity {
|
|
8
7
|
/** 正多边形的中心点位置 */
|
|
9
|
-
centerPoint: Vector3;
|
|
8
|
+
centerPoint: import("three").Vector3;
|
|
10
9
|
/** 正多边形两条边之间的交点位置 */
|
|
11
|
-
otherPoint: Vector3;
|
|
10
|
+
otherPoint: import("three").Vector3;
|
|
12
11
|
/** 正多边形边的数量 */
|
|
13
12
|
sidesNumber: number;
|
|
14
13
|
getTypeName(): string;
|
|
15
14
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
16
|
-
getGripPoints(): Vector3[];
|
|
17
|
-
moveGripPointsAt(index: number, offset: Vector3): boolean;
|
|
15
|
+
getGripPoints(): THREE.Vector3[];
|
|
16
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
18
17
|
create(): MxDbEntity;
|
|
19
18
|
dwgIn(obj: any): boolean;
|
|
20
19
|
dwgOut(obj: any): object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import MxDbEntity from"../MxDbEntity";import MxFun from"../MxFun";import McGiWorldDrawType from"../McGiWorldDrawType";import{createThreeRegularPolygon}from"../../tools/three/index";export default class MxDbRegularPolygon extends MxDbEntity{constructor(){super(...arguments),this.centerPoint=new THREE.Vector3,this.otherPoint=new THREE.Vector3,this.sidesNumber=5}getTypeName(){return"MxDbRegularPolygon"}worldDraw(t){const e=createThreeRegularPolygon(this.centerPoint,this.otherPoint,this.sidesNumber,t.getColor());if(e.geometry.computeBoundingBox(),t.getType()===McGiWorldDrawType.kSelectDraw){const r=new THREE.Vector3;e.geometry.boundingBox.getSize(r),r.addScalar(MxFun.screenCoordLong2Doc(10));const o=r.x/2,n=r.y/2,i={x:this.centerPoint.x-o,y:this.centerPoint.y-n},s={x:this.centerPoint.x+o,y:this.centerPoint.y-n},h={x:this.centerPoint.x+o,y:this.centerPoint.y+n},c={x:this.centerPoint.x-o,y:this.centerPoint.y+n};t.drawLine(i.x,i.y,s.x,s.y),t.drawLine(s.x,s.y,h.x,h.y),t.drawLine(h.x,h.y,c.x,c.y),t.drawLine(c.x,c.y,i.x,i.y)}t.drawEntity(e)}getGripPoints(){return[this.centerPoint,this.otherPoint]}moveGripPointsAt(t,e){return 0===t?(this.centerPoint.add(e),this.otherPoint.add(e)):1===t&&this.otherPoint.add(e),!0}create(){return new MxDbRegularPolygon}dwgIn(t){return this.onDwgIn(t),this.centerPoint.copy(t.centerPoint),this.otherPoint.copy(t.otherPoint),this.sidesNumber=t.sidesNumber,!0}dwgOut(t){return this.onDwgOut(t),t.centerPoint=this.centerPoint,t.otherPoint=this.otherPoint,t.sidesNumber=this.sidesNumber,t}};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import MxDbEntity from '../MxDbEntity';
|
|
2
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
|
+
/**
|
|
4
|
+
* MxDbRegularPolygon 正多边形
|
|
5
|
+
*/
|
|
6
|
+
export default class MxDbRegularPolygon extends MxDbEntity {
|
|
7
|
+
/** 正多边形的中心点位置 */
|
|
8
|
+
centerPoint: import("three").Vector3;
|
|
9
|
+
/** 正多边形两条边之间的交点位置 */
|
|
10
|
+
otherPoint: import("three").Vector3;
|
|
11
|
+
/** 正多边形边的数量 */
|
|
12
|
+
sidesNumber: number;
|
|
13
|
+
getTypeName(): string;
|
|
14
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
15
|
+
getGripPoints(): THREE.Vector3[];
|
|
16
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
17
|
+
create(): MxDbEntity;
|
|
18
|
+
dwgIn(obj: any): boolean;
|
|
19
|
+
dwgOut(obj: any): object;
|
|
20
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"
|
|
1
|
+
import MxDbEntity from"../MxDbEntity";import MxFun from"../MxFun";import McGiWorldDrawType from"../McGiWorldDrawType";import{createThreeRegularPolygon}from"../../tools/three/index";export default class MxDbRegularPolygon extends MxDbEntity{constructor(){super(...arguments),this.centerPoint=new THREE.Vector3,this.otherPoint=new THREE.Vector3,this.sidesNumber=5}getTypeName(){return"MxDbRegularPolygon"}worldDraw(t){const e=createThreeRegularPolygon(this.centerPoint,this.otherPoint,this.sidesNumber,t.getColor());if(e.geometry.computeBoundingBox(),t.getType()===McGiWorldDrawType.kSelectDraw){const r=new THREE.Vector3;e.geometry.boundingBox.getSize(r),r.addScalar(MxFun.screenCoordLong2Doc(10));const o=r.x/2,n=r.y/2,i={x:this.centerPoint.x-o,y:this.centerPoint.y-n},s={x:this.centerPoint.x+o,y:this.centerPoint.y-n},h={x:this.centerPoint.x+o,y:this.centerPoint.y+n},c={x:this.centerPoint.x-o,y:this.centerPoint.y+n};t.drawLine(i.x,i.y,s.x,s.y),t.drawLine(s.x,s.y,h.x,h.y),t.drawLine(h.x,h.y,c.x,c.y),t.drawLine(c.x,c.y,i.x,i.y)}t.drawEntity(e)}getGripPoints(){return[this.centerPoint,this.otherPoint]}moveGripPointsAt(t,e){return 0===t?(this.centerPoint.add(e),this.otherPoint.add(e)):1===t&&this.otherPoint.add(e),!0}create(){return new MxDbRegularPolygon}dwgIn(t){return this.onDwgIn(t),this.centerPoint.copy(t.centerPoint),this.otherPoint.copy(t.otherPoint),this.sidesNumber=t.sidesNumber,!0}dwgOut(t){return this.onDwgOut(t),t.centerPoint=this.centerPoint,t.otherPoint=this.otherPoint,t.sidesNumber=this.sidesNumber,t}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function o(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}(),__awaiter=this&&this.__awaiter||function(t,e,i,o){return new(i||(i=Promise))(function(s,r){function n(t){try{g(o.next(t))}catch(t){r(t)}}function a(t){try{g(o.throw(t))}catch(t){r(t)}}function g(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(n,a)}g((o=o.apply(t,e||[])).next())})},__generator=this&&this.__generator||function(t,e){var i,o,s,r,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,o&&(s=2&r[0]?o.return:r[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,r[1])).done)return s;switch(o=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return n.label++,{value:r[1],done:!1};case 5:n.label++,o=r[1],r=[0];continue;case 7:r=n.ops.pop(),n.trys.pop();continue;default:if(!(s=(s=n.trys).length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){n=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){n.label=r[1];break}if(6===r[0]&&n.label<s[1]){n.label=s[1],s=r;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(r);break}s[2]&&n.ops.pop(),n.trys.pop();continue}r=e.call(t,n)}catch(t){r=[6,t],o=0}finally{i=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}};Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxDbEntity_1=require("../MxDbEntity"),MxDbSVGText_1=require("../MxDbSVGText"),MxThreeJS_1=require("../MxThreeJS"),MxType_1=require("../MxType"),MxDbSVG=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.svgPos=new THREE.Vector3,e.svg=null,e.svgPath="",e.svgSize=new THREE.Vector2(50,50),e.svgAlignmentRatio=new THREE.Vector2(0,0),e.svgRotate=0,e.svgReverse=!1,e.svgMirror=!1,e.svgChildColor=[],e.svgMargin=new THREE.Vector2(0,0),e.isSvgDirtyLocation=!1,e.isLoadFromPath=!0,e.aryText=[],e.svgBoxSize=null,e.fixedSize=!1,e.useSvgColor=!1,e}return __extends(e,t),e.prototype.setSvgChildColor=function(t){if(this.svgChildColor=t,!this.useSvgColor&&this.svg){var e=new THREE.Color(this.getColor()),i=0,o=this;this.svg.traverse(function(t){t.material&&(i<o.svgChildColor.length?t.material.color=new THREE.Color(o.svgChildColor[i]):t.material.color=e,i++)}),this.setNeedUpdateDisplay(!0)}},e.prototype.getSvgChildColor=function(){return this.svgChildColor},e.prototype.calcVewSize=function(t){var e=this.svgSize.x,i=this.svgSize.y;return i<=0&&(i=this.svgBoxSize?this.svgBoxSize.y/this.svgBoxSize.x*e:e),this.fixedSize&&(e=t.screenCoordLong2Doc(e),i=t.screenCoordLong2Doc(i)),[e,i]},e.prototype.worldDraw=function(t){var e=this,i=t.getMxObject();this.calcSvgPosition(i);var o=this.calcVewSize(i),s=o[0],r=o[1],n=new THREE.Matrix4;n.makeScale(this.svgMirror?-1:1,this.svgReverse?-1:1,1);var a=new THREE.Matrix4;a.makeRotationZ(this.svgRotate);var g=new THREE.Matrix4,v=new THREE.Vector3(this.svgPos.x-s*this.svgAlignmentRatio.x,this.svgPos.y-r*this.svgAlignmentRatio.y,0);g.makeTranslation(v.x,v.y,v.z),a.multiply(n),a.premultiply(g);var c=new THREE.Vector3(0,0,0),h=new THREE.Vector3(s,0,0),l=new THREE.Vector3(s,r,0),x=new THREE.Vector3(0,r,0);if(c.applyMatrix4(a),h.applyMatrix4(a),l.applyMatrix4(a),x.applyMatrix4(a),1==t.getType()){if(this.aryText.forEach(function(o){if(o.txt.length>0){var s=new THREE.Vector3(o.txtPos.x,o.txtPos.y,0);e.fixedSize&&(o.txtPos.x>0?s.x=e.svgPos.x+i.screenCoordLong2Doc(o.txtPos.x):s.x=e.svgPos.x-i.screenCoordLong2Doc(o.txtPos.x),o.txtPos.y>0?s.y=e.svgPos.y+i.screenCoordLong2Doc(o.txtPos.y):s.y=e.svgPos.y-i.screenCoordLong2Doc(o.txtPos.y));var r=void 0;o.color&&(r=t.getColor(),t.setColor(o.color));var n=o.txtHeight;e.fixedSize&&(n=i.screenCoordLong2Doc(o.txtHeight)),o._txtObject=t.drawText(o.txt,n,0,s),o._txtAspectRatio=-1,r&&t.setColor(r)}}),this.svg)t.drawEntity(this.svg);else if(this.svgPath.length>0&&this.isLoadFromPath){var u=this,p=t.getMxObject();MxThreeJS_1.default.loadSVG(this.svgPath,void 0,function(e){if(e){var o=e;if(o.boxSize)u.svgBoxSize=o.boxSize.clone();else{var s=(new THREE.Box3).setFromObject(e);u.svgBoxSize||(u.svgBoxSize=new THREE.Vector3),u.svgBoxSize.x=s.max.x-s.min.x,u.svgBoxSize.y=s.max.y-s.min.y}var r=u.calcVewSize(i),n=r[0],a=r[1];u.svgBoxSize&&(e.scale.x=n/u.svgBoxSize.x,e.scale.y=a/u.svgBoxSize.y),e.scale.z=e.scale.x,u.svgReverse&&(e.scale.y*=-1),u.svgMirror&&(e.scale.x*=-1),e.rotateZ(u.svgRotate),u.isSvgDirtyLocation=!0;var g=new THREE.Color(t.getColor()),v=0;e.traverse(function(t){t.material&&(t.material=t.material.clone(),t.material.transparent=!0,t.material.depthTest=!1,u.useSvgColor||(v<u.svgChildColor.length?t.material.color=new THREE.Color(u.svgChildColor[v]):t.material.color=g),v++)}),u.svg=e,u.setNeedUpdateDisplay(),p.updateDisplay()}else console.log("mx LoadSVG:"+u.svgPath+" failed");u.isLoadFromPath=!1})}t.drawSelectLine(c,l),t.drawSelectLine(h,x),t.drawSelectLine(c,h),t.drawSelectLine(h,l),t.drawSelectLine(l,x),t.drawSelectLine(x,c)}else t.drawLine(c,h),t.drawLine(h,l),t.drawLine(l,x),t.drawLine(x,c)},e.prototype.setSvgPath=function(t,e){return void 0===e&&(e=!1),__awaiter(this,void 0,void 0,function(){return __generator(this,function(i){switch(i.label){case 0:return this.svgPath=t,this.svg=null,this.isLoadFromPath=!0,this.svgBoxSize=null,e?[4,MxThreeJS_1.default.loadSVG(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.getSvgPath=function(){return this.svgPath},e.prototype.setSvgPostion=function(t){this.svgPos=t.clone(),this.isSvgDirtyLocation=!0},e.prototype.getSvgPostion=function(){return this.svgPos},e.prototype.setSvgSize=function(t){this.svgSize=t,this.isSvgDirtyLocation=!0},e.prototype.getSvgSize=function(){return this.svgSize},e.prototype.setSvgAlignmentRatio=function(t){this.svgAlignmentRatio=t,this.isSvgDirtyLocation=!0},e.prototype.getSvgAlignmentRatio=function(){return this.svgAlignmentRatio},e.prototype.getText=function(t){return t<this.aryText.length?this.aryText[t]:null},e.prototype.addText=function(t){this.aryText.push(t)},e.prototype.getGripPoints=function(){var t=[];return t.push(this.svgPos),t},e.prototype.moveGripPointsAt=function(t,e){return 0==t&&(this.svgPos.add(e),this.fixedSize||this.aryText.forEach(function(t){t.txtPos.add(e)})),this.isSvgDirtyLocation=!0,!0},e.prototype.calcSvgPosition=function(t){if(this.svg&&this.isSvgDirtyLocation){this.isSvgDirtyLocation=!1;var e=this.calcVewSize(t),i=e[0],o=e[1];this.svg.position.x=this.svgPos.x-i*this.svgAlignmentRatio.x-this.svgMargin.x*i,this.svg.position.y=this.svgPos.y-o*this.svgAlignmentRatio.y-this.svgMargin.y*o}},e.prototype.dwgIn=function(t){var e=this;this.onDwgIn(t),this.fixedSize=t.fixedSize,this.fixedSize?this.svg=null:t.type==MxType_1.default.MxCloneType.kClone&&t.svg&&(this.svg=t.svg.clone()),this.svgPos.copy(t.svgPos),this.svgPath=t.svgPath.substr(0),this.svgSize.copy(t.svgSize),this.svgAlignmentRatio.copy(t.svgAlignmentRatio),this.isSvgDirtyLocation=!0,this.svg||(this.isLoadFromPath=!0),this.svgBoxSize=null;var i=t.txts;return this.aryText=[],i.forEach(function(t){var i=new MxDbSVGText_1.default;i.txt=t.txt,i.txtHeight=t.txtHeight,i.txtPos.copy(t.txtPos),e.aryText.push(i)}),this.svgRotate=t.svgRotate,this.useSvgColor=t.useSvgColor,this.svgReverse=t.svgReverse,this.svgMirror=t.svgMirror,this.svgMargin=t.svgMargin,t.svgChildColor?this.svgChildColor=t.svgChildColor:this.svgChildColor=[],!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.type==MxType_1.default.MxCloneType.kClone&&(t.svg=this.svg),t.svgPath=this.svgPath,t.svgPos=this.svgPos,t.svgSize=this.svgSize,t.svgAlignmentRatio=this.svgAlignmentRatio,t.txts=[],this.aryText.forEach(function(e){var i={txtPos:e.txtPos,txt:e.txt,txtHeight:e.txtHeight,color:e.color,_txtAspectRatio:e._txtAspectRatio};t.txts.push(i)}),t.fixedSize=this.fixedSize,t.svgRotate=this.svgRotate,t.useSvgColor=this.useSvgColor,t.svgReverse=this.svgReverse,t.svgMirror=this.svgMirror,t.svgMargin=this.svgMargin,t.svgChildColor=this.svgChildColor,t},e.prototype.create=function(){return new e},e.prototype.transformBy=function(t){this.svgPos.applyMatrix4(t),this.isSvgDirtyLocation=!0,this.fixedSize||this.aryText.forEach(function(e){e.txtPos.applyMatrix4(t)})},e.prototype.getTypeName=function(){return"MxDbSVG"},e.prototype.setColor=function(e){if(t.prototype.setColor.call(this,e),this.svg){var i=new THREE.Color(this.color);this.svg.traverse(function(t){t.material&&(t.material.color=i)})}},e.prototype.setSvg=function(t){this.svg=t,this.isLoadFromPath=!1,this.svgBoxSize=null},e.prototype.calcSvgBoxSize=function(t){if(!this.svgBoxSize)if(t.boxSize)this.svgBoxSize=t.boxSize.clone();else{var e=(new THREE.Box3).setFromObject(t);this.svgBoxSize||(this.svgBoxSize=new THREE.Vector3),this.svgBoxSize.x=e.max.x-e.min.x,this.svgBoxSize.y=e.max.y-e.min.y}},e.prototype.reComputeSVG=function(){if(this.svg){var t=this.getMxObject();if(t){this.calcSvgBoxSize(this.svg);var e=this.calcVewSize(t),i=e[0],o=e[1];this.svgBoxSize&&(this.svg.scale.x=i/this.svgBoxSize.x,this.svg.scale.y=o/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}}},e.prototype.onViewChange=function(){if(!this.fixedSize)return!1;var t=this.getMxObject();if(null==t)return!1;if(this.svg){this.calcSvgBoxSize(this.svg);var e=this.calcVewSize(t),i=e[0],o=e[1];this.svgBoxSize&&(this.svg.scale.x=i/this.svgBoxSize.x,this.svg.scale.y=o/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}var s=this;return this.aryText.forEach(function(e){if(e._txtObject&&t){var i=t.screenCoordLong2Doc(e.txtHeight);i>1e-5&&(e._txtAspectRatio<=0&&(e._txtAspectRatio=e._txtObject.scale.x/e._txtObject.scale.y),e._txtObject.scale.set(e._txtAspectRatio*i,i,1),e.txtPos.x>0?e._txtObject.position.x=s.svgPos.x+t.screenCoordLong2Doc(e.txtPos.x):e._txtObject.position.x=s.svgPos.x-t.screenCoordLong2Doc(e.txtPos.x),e.txtPos.y>0?e._txtObject.position.y=s.svgPos.y+t.screenCoordLong2Doc(e.txtPos.y):e._txtObject.position.y=s.svgPos.y-t.screenCoordLong2Doc(e.txtPos.y),e._txtObject.updateMatrix())}}),!0},e}(MxDbEntity_1.default);exports.default=MxDbSVG;
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,s,i,e){return new(i||(i=Promise))(function(o,r){function g(t){try{a(e.next(t))}catch(t){r(t)}}function h(t){try{a(e.throw(t))}catch(t){r(t)}}function a(t){var s;t.done?o(t.value):(s=t.value,s instanceof i?s:new i(function(t){t(s)})).then(g,h)}a((e=e.apply(t,s||[])).next())})};import MxDbEntity from"../MxDbEntity";import MxDbSVGText from"../MxDbSVGText";import MxThreeJS from"../MxThreeJS";import MxType from"../MxType";export default class MxDbSVG extends MxDbEntity{constructor(){super(...arguments),this.svgPos=new THREE.Vector3,this.svg=null,this.svgPath="",this.svgSize=new THREE.Vector2(50,50),this.svgAlignmentRatio=new THREE.Vector2(0,0),this.svgRotate=0,this.svgReverse=!1,this.svgMirror=!1,this.svgChildColor=[],this.svgMargin=new THREE.Vector2(0,0),this.isSvgDirtyLocation=!1,this.isLoadFromPath=!0,this.aryText=[],this.svgBoxSize=null,this.fixedSize=!1,this.useSvgColor=!1}setSvgChildColor(t){if(this.svgChildColor=t,!this.useSvgColor&&this.svg){let t=new THREE.Color(this.getColor()),s=0,i=this;this.svg.traverse(function(e){e.material&&(s<i.svgChildColor.length?e.material.color=new THREE.Color(i.svgChildColor[s]):e.material.color=t,s++)}),this.setNeedUpdateDisplay(!0)}}getSvgChildColor(){return this.svgChildColor}calcVewSize(t){let s=this.svgSize.x,i=this.svgSize.y;return i<=0&&(i=this.svgBoxSize?this.svgBoxSize.y/this.svgBoxSize.x*s:s),this.fixedSize&&(s=t.screenCoordLong2Doc(s),i=t.screenCoordLong2Doc(i)),[s,i]}worldDraw(t){let s=t.getMxObject();this.calcSvgPosition(s);let[i,e]=this.calcVewSize(s),o=new THREE.Matrix4;o.makeScale(this.svgMirror?-1:1,this.svgReverse?-1:1,1);let r=new THREE.Matrix4;r.makeRotationZ(this.svgRotate);let g=new THREE.Matrix4,h=new THREE.Vector3(this.svgPos.x-i*this.svgAlignmentRatio.x,this.svgPos.y-e*this.svgAlignmentRatio.y,0);g.makeTranslation(h.x,h.y,h.z),r.multiply(o),r.premultiply(g);let a=new THREE.Vector3(0,0,0),v=new THREE.Vector3(i,0,0),l=new THREE.Vector3(i,e,0),n=new THREE.Vector3(0,e,0);if(a.applyMatrix4(r),v.applyMatrix4(r),l.applyMatrix4(r),n.applyMatrix4(r),1==t.getType()){if(this.aryText.forEach(i=>{if(i.txt.length>0){let e=new THREE.Vector3(i.txtPos.x,i.txtPos.y,0);this.fixedSize&&(i.txtPos.x>0?e.x=this.svgPos.x+s.screenCoordLong2Doc(i.txtPos.x):e.x=this.svgPos.x-s.screenCoordLong2Doc(i.txtPos.x),i.txtPos.y>0?e.y=this.svgPos.y+s.screenCoordLong2Doc(i.txtPos.y):e.y=this.svgPos.y-s.screenCoordLong2Doc(i.txtPos.y));let o=void 0;i.color&&(o=t.getColor(),t.setColor(i.color));let r=i.txtHeight;this.fixedSize&&(r=s.screenCoordLong2Doc(i.txtHeight)),i._txtObject=t.drawText(i.txt,r,0,e),i._txtAspectRatio=-1,o&&t.setColor(o)}}),this.svg)t.drawEntity(this.svg);else if(this.svgPath.length>0&&this.isLoadFromPath){let i=this,e=t.getMxObject();MxThreeJS.loadSVG(this.svgPath,void 0,o=>{if(o){let r=o;if(r.boxSize)i.svgBoxSize=r.boxSize.clone();else{let t=(new THREE.Box3).setFromObject(o);i.svgBoxSize||(i.svgBoxSize=new THREE.Vector3),i.svgBoxSize.x=t.max.x-t.min.x,i.svgBoxSize.y=t.max.y-t.min.y}let[g,h]=i.calcVewSize(s);i.svgBoxSize&&(o.scale.x=g/i.svgBoxSize.x,o.scale.y=h/i.svgBoxSize.y),o.scale.z=o.scale.x,i.svgReverse&&(o.scale.y*=-1),i.svgMirror&&(o.scale.x*=-1),o.rotateZ(i.svgRotate),i.isSvgDirtyLocation=!0;let a=new THREE.Color(t.getColor()),v=0;o.traverse(function(t){t.material&&(t.material=t.material.clone(),t.material.transparent=!0,t.material.depthTest=!1,i.useSvgColor||(v<i.svgChildColor.length?t.material.color=new THREE.Color(i.svgChildColor[v]):t.material.color=a),v++)}),i.svg=o,i.setNeedUpdateDisplay(),e.updateDisplay()}else console.log("mx LoadSVG:"+i.svgPath+" failed");i.isLoadFromPath=!1})}t.drawSelectLine(a,l),t.drawSelectLine(v,n),t.drawSelectLine(a,v),t.drawSelectLine(v,l),t.drawSelectLine(l,n),t.drawSelectLine(n,a)}else t.drawLine(a,v),t.drawLine(v,l),t.drawLine(l,n),t.drawLine(n,a)}setSvgPath(t,s=!1){return __awaiter(this,void 0,void 0,function*(){this.svgPath=t,this.svg=null,this.isLoadFromPath=!0,this.svgBoxSize=null,s&&(yield MxThreeJS.loadSVG(t))})}getSvgPath(){return this.svgPath}setSvgPostion(t){this.svgPos=t.clone(),this.isSvgDirtyLocation=!0}getSvgPostion(){return this.svgPos}setSvgSize(t){this.svgSize=t,this.isSvgDirtyLocation=!0}getSvgSize(){return this.svgSize}setSvgAlignmentRatio(t){this.svgAlignmentRatio=t,this.isSvgDirtyLocation=!0}getSvgAlignmentRatio(){return this.svgAlignmentRatio}getText(t){return t<this.aryText.length?this.aryText[t]:null}addText(t){this.aryText.push(t)}getGripPoints(){let t=[];return t.push(this.svgPos),t}moveGripPointsAt(t,s){return 0==t&&(this.svgPos.add(s),this.fixedSize||this.aryText.forEach(t=>{t.txtPos.add(s)})),this.isSvgDirtyLocation=!0,!0}calcSvgPosition(t){if(!this.svg||!this.isSvgDirtyLocation)return;this.isSvgDirtyLocation=!1;let[s,i]=this.calcVewSize(t);this.svg.position.x=this.svgPos.x-s*this.svgAlignmentRatio.x-this.svgMargin.x*s,this.svg.position.y=this.svgPos.y-i*this.svgAlignmentRatio.y-this.svgMargin.y*i}dwgIn(t){this.onDwgIn(t),this.fixedSize=t.fixedSize,this.fixedSize?this.svg=null:t.type==MxType.MxCloneType.kClone&&t.svg&&(this.svg=t.svg.clone()),this.svgPos.copy(t.svgPos),this.svgPath=t.svgPath.substr(0),this.svgSize.copy(t.svgSize),this.svgAlignmentRatio.copy(t.svgAlignmentRatio),this.isSvgDirtyLocation=!0,this.svg||(this.isLoadFromPath=!0),this.svgBoxSize=null;let s=t.txts;return this.aryText=[],s.forEach(t=>{let s=new MxDbSVGText;s.txt=t.txt,s.txtHeight=t.txtHeight,s.txtPos.copy(t.txtPos),this.aryText.push(s)}),this.svgRotate=t.svgRotate,this.useSvgColor=t.useSvgColor,this.svgReverse=t.svgReverse,this.svgMirror=t.svgMirror,this.svgMargin=t.svgMargin,t.svgChildColor?this.svgChildColor=t.svgChildColor:this.svgChildColor=[],!0}dwgOut(t){return this.onDwgOut(t),t.type==MxType.MxCloneType.kClone&&(t.svg=this.svg),t.svgPath=this.svgPath,t.svgPos=this.svgPos,t.svgSize=this.svgSize,t.svgAlignmentRatio=this.svgAlignmentRatio,t.txts=[],this.aryText.forEach(s=>{let i={txtPos:s.txtPos,txt:s.txt,txtHeight:s.txtHeight,color:s.color,_txtAspectRatio:s._txtAspectRatio};t.txts.push(i)}),t.fixedSize=this.fixedSize,t.svgRotate=this.svgRotate,t.useSvgColor=this.useSvgColor,t.svgReverse=this.svgReverse,t.svgMirror=this.svgMirror,t.svgMargin=this.svgMargin,t.svgChildColor=this.svgChildColor,t}create(){return new MxDbSVG}transformBy(t){this.svgPos.applyMatrix4(t),this.isSvgDirtyLocation=!0,this.fixedSize||this.aryText.forEach(s=>{s.txtPos.applyMatrix4(t)})}getTypeName(){return"MxDbSVG"}setColor(t){if(super.setColor(t),this.svg){let t=new THREE.Color(this.color);this.svg.traverse(function(s){s.material&&(s.material.color=t)})}}setSvg(t){this.svg=t,this.isLoadFromPath=!1,this.svgBoxSize=null}calcSvgBoxSize(t){if(!this.svgBoxSize)if(t.boxSize)this.svgBoxSize=t.boxSize.clone();else{let s=(new THREE.Box3).setFromObject(t);this.svgBoxSize||(this.svgBoxSize=new THREE.Vector3),this.svgBoxSize.x=s.max.x-s.min.x,this.svgBoxSize.y=s.max.y-s.min.y}}reComputeSVG(){if(!this.svg)return;let t=this.getMxObject();if(!t)return;this.calcSvgBoxSize(this.svg);let[s,i]=this.calcVewSize(t);this.svgBoxSize&&(this.svg.scale.x=s/this.svgBoxSize.x,this.svg.scale.y=i/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}onViewChange(){if(!this.fixedSize)return!1;let t=this.getMxObject();if(null==t)return!1;if(this.svg){this.calcSvgBoxSize(this.svg);let[s,i]=this.calcVewSize(t);this.svgBoxSize&&(this.svg.scale.x=s/this.svgBoxSize.x,this.svg.scale.y=i/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}let s=this;return this.aryText.forEach(i=>{if(i._txtObject&&t){let e=t.screenCoordLong2Doc(i.txtHeight);e>1e-5&&(i._txtAspectRatio<=0&&(i._txtAspectRatio=i._txtObject.scale.x/i._txtObject.scale.y),i._txtObject.scale.set(i._txtAspectRatio*e,e,1),i.txtPos.x>0?i._txtObject.position.x=s.svgPos.x+t.screenCoordLong2Doc(i.txtPos.x):i._txtObject.position.x=s.svgPos.x-t.screenCoordLong2Doc(i.txtPos.x),i.txtPos.y>0?i._txtObject.position.y=s.svgPos.y+t.screenCoordLong2Doc(i.txtPos.y):i._txtObject.position.y=s.svgPos.y-t.screenCoordLong2Doc(i.txtPos.y),i._txtObject.updateMatrix())}}),!0}};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/** @module MxDbSVG*/
|
|
2
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
|
+
import MxDbEntity from '../MxDbEntity';
|
|
4
|
+
import MxDbSVGText from '../MxDbSVGText';
|
|
5
|
+
/**
|
|
6
|
+
* MxDbSVG 绘制SVG图形.
|
|
7
|
+
*/
|
|
8
|
+
export default class MxDbSVG extends MxDbEntity {
|
|
9
|
+
private svgPos;
|
|
10
|
+
private svg;
|
|
11
|
+
private svgPath;
|
|
12
|
+
private svgSize;
|
|
13
|
+
private svgAlignmentRatio;
|
|
14
|
+
/** 延z轴旋转的数值 */
|
|
15
|
+
svgRotate: number;
|
|
16
|
+
/** 是否倒置SVG图形 */
|
|
17
|
+
svgReverse: boolean;
|
|
18
|
+
svgMirror: boolean;
|
|
19
|
+
private svgChildColor;
|
|
20
|
+
svgMargin: THREE.Vector2;
|
|
21
|
+
private isSvgDirtyLocation;
|
|
22
|
+
private isLoadFromPath;
|
|
23
|
+
private aryText;
|
|
24
|
+
private svgBoxSize;
|
|
25
|
+
/** 固定尺寸,图片和文字大小,取屏幕像素绘图单位。 */
|
|
26
|
+
fixedSize: boolean;
|
|
27
|
+
/**使用svg的颜色 */
|
|
28
|
+
useSvgColor: boolean;
|
|
29
|
+
setSvgChildColor(aryColor: number[]): void;
|
|
30
|
+
getSvgChildColor(): number[];
|
|
31
|
+
private calcVewSize;
|
|
32
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
33
|
+
/**
|
|
34
|
+
* 设置SVG的路径
|
|
35
|
+
* @param path 路径
|
|
36
|
+
* @param preload 是否提前加载SVG
|
|
37
|
+
* */
|
|
38
|
+
setSvgPath(path: string, preload?: boolean): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* 获取SVG的路径
|
|
41
|
+
* */
|
|
42
|
+
getSvgPath(): string;
|
|
43
|
+
/**
|
|
44
|
+
* 设置SVG显示位置
|
|
45
|
+
* @param pos THREE.Vector3
|
|
46
|
+
* */
|
|
47
|
+
setSvgPostion(pos: THREE.Vector3): void;
|
|
48
|
+
/**
|
|
49
|
+
* 获取SVG显示位置
|
|
50
|
+
* */
|
|
51
|
+
getSvgPostion(): THREE.Vector3;
|
|
52
|
+
/**
|
|
53
|
+
* 设置SVG大小
|
|
54
|
+
* @param size THREE.Vector2 x表示宽度y表示高度
|
|
55
|
+
* */
|
|
56
|
+
setSvgSize(size: THREE.Vector2): void;
|
|
57
|
+
getSvgSize(): THREE.Vector2;
|
|
58
|
+
/** 设置SVG 的调整比例
|
|
59
|
+
* @param alignmentRatio THREE.Vector2
|
|
60
|
+
* */
|
|
61
|
+
setSvgAlignmentRatio(alignmentRatio: THREE.Vector2): void;
|
|
62
|
+
getSvgAlignmentRatio(): THREE.Vector2;
|
|
63
|
+
/** 获取文字数组下标中的文字
|
|
64
|
+
* @param index 数组下标
|
|
65
|
+
* @return {@link MxDbSVGText}
|
|
66
|
+
* */
|
|
67
|
+
getText(index: number): MxDbSVGText | null;
|
|
68
|
+
/** 添加文字
|
|
69
|
+
* @param txt {@link MxDbSVGText}
|
|
70
|
+
* */
|
|
71
|
+
addText(txt: MxDbSVGText): void;
|
|
72
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
73
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
74
|
+
private calcSvgPosition;
|
|
75
|
+
dwgIn(obj: any): boolean;
|
|
76
|
+
dwgOut(obj: any): object;
|
|
77
|
+
create(): MxDbEntity;
|
|
78
|
+
transformBy(mat: THREE.Matrix4): void;
|
|
79
|
+
getTypeName(): string;
|
|
80
|
+
/**
|
|
81
|
+
* 设置颜色
|
|
82
|
+
* @param color 颜色值
|
|
83
|
+
* */
|
|
84
|
+
setColor(color: number | string | THREE.Color): void;
|
|
85
|
+
/**
|
|
86
|
+
* 设置svg对象
|
|
87
|
+
* */
|
|
88
|
+
setSvg(svg: any): void;
|
|
89
|
+
private calcSvgBoxSize;
|
|
90
|
+
reComputeSVG(): void;
|
|
91
|
+
protected onViewChange(): boolean;
|
|
92
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(t,s,i,e){return new(i||(i=Promise))(function(o,r){function g(t){try{a(e.next(t))}catch(t){r(t)}}function h(t){try{a(e.throw(t))}catch(t){r(t)}}function a(t){var s;t.done?o(t.value):(s=t.value,s instanceof i?s:new i(function(t){t(s)})).then(g,h)}a((e=e.apply(t,s||[])).next())})};import MxDbEntity from"../MxDbEntity";import MxDbSVGText from"../MxDbSVGText";import MxThreeJS from"../MxThreeJS";import MxType from"../MxType";export default class MxDbSVG extends MxDbEntity{constructor(){super(...arguments),this.svgPos=new THREE.Vector3,this.svg=null,this.svgPath="",this.svgSize=new THREE.Vector2(50,50),this.svgAlignmentRatio=new THREE.Vector2(0,0),this.svgRotate=0,this.svgReverse=!1,this.svgMirror=!1,this.svgChildColor=[],this.svgMargin=new THREE.Vector2(0,0),this.isSvgDirtyLocation=!1,this.isLoadFromPath=!0,this.aryText=[],this.svgBoxSize=null,this.fixedSize=!1,this.useSvgColor=!1}setSvgChildColor(t){if(this.svgChildColor=t,!this.useSvgColor&&this.svg){let t=new THREE.Color(this.getColor()),s=0,i=this;this.svg.traverse(function(e){e.material&&(s<i.svgChildColor.length?e.material.color=new THREE.Color(i.svgChildColor[s]):e.material.color=t,s++)}),this.setNeedUpdateDisplay(!0)}}getSvgChildColor(){return this.svgChildColor}calcVewSize(t){let s=this.svgSize.x,i=this.svgSize.y;return i<=0&&(i=this.svgBoxSize?this.svgBoxSize.y/this.svgBoxSize.x*s:s),this.fixedSize&&(s=t.screenCoordLong2Doc(s),i=t.screenCoordLong2Doc(i)),[s,i]}worldDraw(t){let s=t.getMxObject();this.calcSvgPosition(s);let[i,e]=this.calcVewSize(s),o=new THREE.Matrix4;o.makeScale(this.svgMirror?-1:1,this.svgReverse?-1:1,1);let r=new THREE.Matrix4;r.makeRotationZ(this.svgRotate);let g=new THREE.Matrix4,h=new THREE.Vector3(this.svgPos.x-i*this.svgAlignmentRatio.x,this.svgPos.y-e*this.svgAlignmentRatio.y,0);g.makeTranslation(h.x,h.y,h.z),r.multiply(o),r.premultiply(g);let a=new THREE.Vector3(0,0,0),v=new THREE.Vector3(i,0,0),l=new THREE.Vector3(i,e,0),n=new THREE.Vector3(0,e,0);if(a.applyMatrix4(r),v.applyMatrix4(r),l.applyMatrix4(r),n.applyMatrix4(r),1==t.getType()){if(this.aryText.forEach(i=>{if(i.txt.length>0){let e=new THREE.Vector3(i.txtPos.x,i.txtPos.y,0);this.fixedSize&&(i.txtPos.x>0?e.x=this.svgPos.x+s.screenCoordLong2Doc(i.txtPos.x):e.x=this.svgPos.x-s.screenCoordLong2Doc(i.txtPos.x),i.txtPos.y>0?e.y=this.svgPos.y+s.screenCoordLong2Doc(i.txtPos.y):e.y=this.svgPos.y-s.screenCoordLong2Doc(i.txtPos.y));let o=void 0;i.color&&(o=t.getColor(),t.setColor(i.color));let r=i.txtHeight;this.fixedSize&&(r=s.screenCoordLong2Doc(i.txtHeight)),i._txtObject=t.drawText(i.txt,r,0,e),i._txtAspectRatio=-1,o&&t.setColor(o)}}),this.svg)t.drawEntity(this.svg);else if(this.svgPath.length>0&&this.isLoadFromPath){let i=this,e=t.getMxObject();MxThreeJS.loadSVG(this.svgPath,void 0,o=>{if(o){let r=o;if(r.boxSize)i.svgBoxSize=r.boxSize.clone();else{let t=(new THREE.Box3).setFromObject(o);i.svgBoxSize||(i.svgBoxSize=new THREE.Vector3),i.svgBoxSize.x=t.max.x-t.min.x,i.svgBoxSize.y=t.max.y-t.min.y}let[g,h]=i.calcVewSize(s);i.svgBoxSize&&(o.scale.x=g/i.svgBoxSize.x,o.scale.y=h/i.svgBoxSize.y),o.scale.z=o.scale.x,i.svgReverse&&(o.scale.y*=-1),i.svgMirror&&(o.scale.x*=-1),o.rotateZ(i.svgRotate),i.isSvgDirtyLocation=!0;let a=new THREE.Color(t.getColor()),v=0;o.traverse(function(t){t.material&&(t.material=t.material.clone(),t.material.transparent=!0,t.material.depthTest=!1,i.useSvgColor||(v<i.svgChildColor.length?t.material.color=new THREE.Color(i.svgChildColor[v]):t.material.color=a),v++)}),i.svg=o,i.setNeedUpdateDisplay(),e.updateDisplay()}else console.log("mx LoadSVG:"+i.svgPath+" failed");i.isLoadFromPath=!1})}t.drawSelectLine(a,l),t.drawSelectLine(v,n),t.drawSelectLine(a,v),t.drawSelectLine(v,l),t.drawSelectLine(l,n),t.drawSelectLine(n,a)}else t.drawLine(a,v),t.drawLine(v,l),t.drawLine(l,n),t.drawLine(n,a)}setSvgPath(t,s=!1){return __awaiter(this,void 0,void 0,function*(){this.svgPath=t,this.svg=null,this.isLoadFromPath=!0,this.svgBoxSize=null,s&&(yield MxThreeJS.loadSVG(t))})}getSvgPath(){return this.svgPath}setSvgPostion(t){this.svgPos=t.clone(),this.isSvgDirtyLocation=!0}getSvgPostion(){return this.svgPos}setSvgSize(t){this.svgSize=t,this.isSvgDirtyLocation=!0}getSvgSize(){return this.svgSize}setSvgAlignmentRatio(t){this.svgAlignmentRatio=t,this.isSvgDirtyLocation=!0}getSvgAlignmentRatio(){return this.svgAlignmentRatio}getText(t){return t<this.aryText.length?this.aryText[t]:null}addText(t){this.aryText.push(t)}getGripPoints(){let t=[];return t.push(this.svgPos),t}moveGripPointsAt(t,s){return 0==t&&(this.svgPos.add(s),this.fixedSize||this.aryText.forEach(t=>{t.txtPos.add(s)})),this.isSvgDirtyLocation=!0,!0}calcSvgPosition(t){if(!this.svg||!this.isSvgDirtyLocation)return;this.isSvgDirtyLocation=!1;let[s,i]=this.calcVewSize(t);this.svg.position.x=this.svgPos.x-s*this.svgAlignmentRatio.x-this.svgMargin.x*s,this.svg.position.y=this.svgPos.y-i*this.svgAlignmentRatio.y-this.svgMargin.y*i}dwgIn(t){this.onDwgIn(t),this.fixedSize=t.fixedSize,this.fixedSize?this.svg=null:t.type==MxType.MxCloneType.kClone&&t.svg&&(this.svg=t.svg.clone()),this.svgPos.copy(t.svgPos),this.svgPath=t.svgPath.substr(0),this.svgSize.copy(t.svgSize),this.svgAlignmentRatio.copy(t.svgAlignmentRatio),this.isSvgDirtyLocation=!0,this.svg||(this.isLoadFromPath=!0),this.svgBoxSize=null;let s=t.txts;return this.aryText=[],s.forEach(t=>{let s=new MxDbSVGText;s.txt=t.txt,s.txtHeight=t.txtHeight,s.txtPos.copy(t.txtPos),this.aryText.push(s)}),this.svgRotate=t.svgRotate,this.useSvgColor=t.useSvgColor,this.svgReverse=t.svgReverse,this.svgMirror=t.svgMirror,this.svgMargin=t.svgMargin,t.svgChildColor?this.svgChildColor=t.svgChildColor:this.svgChildColor=[],!0}dwgOut(t){return this.onDwgOut(t),t.type==MxType.MxCloneType.kClone&&(t.svg=this.svg),t.svgPath=this.svgPath,t.svgPos=this.svgPos,t.svgSize=this.svgSize,t.svgAlignmentRatio=this.svgAlignmentRatio,t.txts=[],this.aryText.forEach(s=>{let i={txtPos:s.txtPos,txt:s.txt,txtHeight:s.txtHeight,color:s.color,_txtAspectRatio:s._txtAspectRatio};t.txts.push(i)}),t.fixedSize=this.fixedSize,t.svgRotate=this.svgRotate,t.useSvgColor=this.useSvgColor,t.svgReverse=this.svgReverse,t.svgMirror=this.svgMirror,t.svgMargin=this.svgMargin,t.svgChildColor=this.svgChildColor,t}create(){return new MxDbSVG}transformBy(t){this.svgPos.applyMatrix4(t),this.isSvgDirtyLocation=!0,this.fixedSize||this.aryText.forEach(s=>{s.txtPos.applyMatrix4(t)})}getTypeName(){return"MxDbSVG"}setColor(t){if(super.setColor(t),this.svg){let t=new THREE.Color(this.color);this.svg.traverse(function(s){s.material&&(s.material.color=t)})}}setSvg(t){this.svg=t,this.isLoadFromPath=!1,this.svgBoxSize=null}calcSvgBoxSize(t){if(!this.svgBoxSize)if(t.boxSize)this.svgBoxSize=t.boxSize.clone();else{let s=(new THREE.Box3).setFromObject(t);this.svgBoxSize||(this.svgBoxSize=new THREE.Vector3),this.svgBoxSize.x=s.max.x-s.min.x,this.svgBoxSize.y=s.max.y-s.min.y}}reComputeSVG(){if(!this.svg)return;let t=this.getMxObject();if(!t)return;this.calcSvgBoxSize(this.svg);let[s,i]=this.calcVewSize(t);this.svgBoxSize&&(this.svg.scale.x=s/this.svgBoxSize.x,this.svg.scale.y=i/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}onViewChange(){if(!this.fixedSize)return!1;let t=this.getMxObject();if(null==t)return!1;if(this.svg){this.calcSvgBoxSize(this.svg);let[s,i]=this.calcVewSize(t);this.svgBoxSize&&(this.svg.scale.x=s/this.svgBoxSize.x,this.svg.scale.y=i/this.svgBoxSize.y),this.svg.scale.z=this.svg.scale.x,this.svgReverse&&(this.svg.scale.y*=-1),this.svgMirror&&(this.svg.scale.x*=-1),this.isSvgDirtyLocation=!0,this.calcSvgPosition(t)}let s=this;return this.aryText.forEach(i=>{if(i._txtObject&&t){let e=t.screenCoordLong2Doc(i.txtHeight);e>1e-5&&(i._txtAspectRatio<=0&&(i._txtAspectRatio=i._txtObject.scale.x/i._txtObject.scale.y),i._txtObject.scale.set(i._txtAspectRatio*e,e,1),i.txtPos.x>0?i._txtObject.position.x=s.svgPos.x+t.screenCoordLong2Doc(i.txtPos.x):i._txtObject.position.x=s.svgPos.x-t.screenCoordLong2Doc(i.txtPos.x),i.txtPos.y>0?i._txtObject.position.y=s.svgPos.y+t.screenCoordLong2Doc(i.txtPos.y):i._txtObject.position.y=s.svgPos.y-t.screenCoordLong2Doc(i.txtPos.y),i._txtObject.updateMatrix())}}),!0}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export default class MxDbSVGText{constructor(){this.txtPos=new THREE.Vector3,this.txt="",this.txtHeight=1,this.color=void 0,this._txtObject=null,this._txtAspectRatio=-1}};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @module MxDbSVG*/
|
|
2
|
+
/**
|
|
3
|
+
* MxDbSVGText 为SVG提供文字数据
|
|
4
|
+
* */
|
|
5
|
+
export default class MxDbSVGText {
|
|
6
|
+
/** 文字的位置 */
|
|
7
|
+
txtPos: THREE.Vector3;
|
|
8
|
+
/** 文字内容 */
|
|
9
|
+
txt: string;
|
|
10
|
+
/** 文字高度 */
|
|
11
|
+
txtHeight: number;
|
|
12
|
+
/** 文字颜色 */
|
|
13
|
+
color: number | string | THREE.Color | undefined;
|
|
14
|
+
/** THREE.Sprite */
|
|
15
|
+
_txtObject: THREE.Sprite | null;
|
|
16
|
+
/** 比例 */
|
|
17
|
+
_txtAspectRatio: number;
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export default class MxDbSVGText{constructor(){this.txtPos=new THREE.Vector3,this.txt="",this.txtHeight=1,this.color=void 0,this._txtObject=null,this._txtAspectRatio=-1}};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import THREE, { Vector3 } from 'three';
|
|
2
1
|
import McGiWorldDraw from '../McGiWorldDraw';
|
|
3
2
|
import MxDbEntity from '../MxDbEntity';
|
|
4
3
|
/**
|
|
@@ -6,7 +5,7 @@ import MxDbEntity from '../MxDbEntity';
|
|
|
6
5
|
*/
|
|
7
6
|
export default class MxDbText extends MxDbEntity {
|
|
8
7
|
/** 文字所在位置*/
|
|
9
|
-
position:
|
|
8
|
+
position: import("three").Vector3;
|
|
10
9
|
/** 文字内容*/
|
|
11
10
|
text: string;
|
|
12
11
|
/** 文字高度*/
|
|
@@ -15,8 +14,8 @@ export default class MxDbText extends MxDbEntity {
|
|
|
15
14
|
angle: number;
|
|
16
15
|
getTypeName(): string;
|
|
17
16
|
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
18
|
-
getGripPoints(): Vector3[];
|
|
19
|
-
moveGripPointsAt(index: number, offset: Vector3): boolean;
|
|
17
|
+
getGripPoints(): THREE.Vector3[];
|
|
18
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
20
19
|
create(): MxDbEntity;
|
|
21
20
|
dwgIn(obj: any): boolean;
|
|
22
21
|
dwgOut(obj: any): object;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"
|
|
1
|
+
import{formatString}from"../../tools/formatting";import McGiWorldDrawType from"../McGiWorldDrawType";import MxDbEntity from"../MxDbEntity";import MxThreeJS from"../MxThreeJS";export default class MxDbText extends MxDbEntity{constructor(){super(...arguments),this.position=new THREE.Vector3,this.text="",this.height=1,this.angle=0}getTypeName(){return"MxDbText"}worldDraw(t){if(this.text.length>0&&(t.drawText(this.text,this.height,this.angle,this.position),t.getType()===McGiWorldDrawType.kSelectDraw)){let i=MxThreeJS.creatTextSprite(this.text,this.position,this.height,this.angle,16777215);if(i){const e=new THREE.Box3;e.expandByObject(i);const n=e.min,o=e.max,s={x:n.x,y:o.y},r={x:o.x,y:n.y};t.drawLine(n.x,n.y,s.x,s.y),t.drawLine(s.x,s.y,o.x,o.y),t.drawLine(o.x,o.y,r.x,r.y),t.drawLine(r.x,r.y,n.x,n.y)}}}getGripPoints(){return[this.position]}moveGripPointsAt(t,i){return 0===t&&this.position.add(i),!0}create(){return new MxDbText}dwgIn(t){return this.onDwgIn(t),this.position.copy(t.position),this.text=t.text.substr(0),this.height=t.height,this.angle=t.angle,!0}dwgOut(t){return this.onDwgOut(t),t.position=this.position,t.text=this.text,t.height=this.height,t.angle=this.angle,t}getGeomExtents(){var t=document.createElement("canvas").getContext("2d");if(null==t)return null;var i=formatString("normal {0}px Arial","256");t.font=i;let e=t.measureText(this.text).width/256,n=this.position.x-e*this.height*.5,o=this.position.y-.5*this.height,s=this.position.x+e*this.height*.5,r=this.position.y+.5*this.height;return new THREE.Box3(new THREE.Vector3(n,o,this.position.z),new THREE.Vector3(s,r,this.position.z))}};
|
|
File without changes
|
|
@@ -1 +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"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()}};
|