mxdraw 0.1.156 → 0.1.157

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.
Files changed (51) hide show
  1. package/README.md +188 -188
  2. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.d.ts +8 -8
  3. package/dist/lib/MxModule/McGeTool/index.d.ts +1 -1
  4. package/dist/lib/MxModule/McGeTool/index.js +1 -1
  5. package/dist/lib/MxModule/MrxDbgUtils/index.d.ts +1 -1
  6. package/dist/lib/MxModule/MrxDbgUtils/index.js +1 -1
  7. package/dist/lib/MxModule/Mx3PointArc/index.d.ts +3 -3
  8. package/dist/lib/MxModule/MxDb2LineAngularDimension/draw.d.ts +1 -1
  9. package/dist/lib/MxModule/MxDbAlignedDimension/draw.d.ts +1 -1
  10. package/dist/lib/MxModule/MxDbArcShape/index.d.ts +2 -2
  11. package/dist/lib/MxModule/MxDbArcShapeDraw/index.d.ts +3 -3
  12. package/dist/lib/MxModule/MxDbArrow/index.d.ts +3 -3
  13. package/dist/lib/MxModule/MxDbCircleArc/index.d.ts +3 -3
  14. package/dist/lib/MxModule/MxDbCircleShape/index.d.ts +1 -1
  15. package/dist/lib/MxModule/MxDbEllipse/index.d.ts +3 -3
  16. package/dist/lib/MxModule/MxDbEllipseArc/index.d.ts +5 -5
  17. package/dist/lib/MxModule/MxDbEllipseShape/index.d.ts +2 -2
  18. package/dist/lib/MxModule/MxDbEntity/index.d.ts +3 -3
  19. package/dist/lib/MxModule/MxDbLineShape/index.d.ts +2 -2
  20. package/dist/lib/MxModule/MxDbRegularPolygonShape/index.d.ts +2 -2
  21. package/dist/lib/MxModule/MxDbRingShape/index.d.ts +3 -3
  22. package/dist/lib/MxModule/MxDbShape/index.d.ts +6 -6
  23. package/dist/lib/MxModule/MxDbSplineCurve/index.d.ts +3 -3
  24. package/dist/lib/MxModule/MxDbStarShape/index.d.ts +3 -3
  25. package/dist/lib/MxModule/MxDbText/MxDbText.d.ts +5 -5
  26. package/dist/lib/MxModule/MxDbText/SpriteText.d.ts +1 -2
  27. package/dist/lib/MxModule/MxDbText/index.d.ts +1 -1
  28. package/dist/lib/MxModule/MxDrawObject/index.d.ts +45 -45
  29. package/dist/lib/MxModule/MxFilters/index.d.ts +1 -2
  30. package/dist/lib/MxModule/MxFilters/index.js +1 -1
  31. package/dist/lib/MxModule/MxFun/index.d.ts +3 -3
  32. package/dist/lib/MxModule/MxFun/index.js +1 -1
  33. package/dist/lib/MxModule/MxPaintBrush/index.d.ts +4 -3
  34. package/dist/lib/MxModule/MxPaintBrush/index.js +1 -1
  35. package/dist/lib/MxModule/MxType/index.d.ts +2 -2
  36. package/dist/lib/MxModule/Mxassembly/index.d.ts +1 -1
  37. package/dist/lib/MxModule/Mxassembly/index.js +1 -1
  38. package/dist/lib/MxModule/loadCoreCode/mxUiData.d.ts +2 -2
  39. package/dist/lib/MxModule/loadCoreCode/mxUiData.js +1 -1
  40. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -1
  41. package/dist/lib/MxModule/store/Pubsub.d.ts +1 -0
  42. package/dist/lib/MxModule/store/Pubsub.js +1 -1
  43. package/dist/lib/MxModule/store/Store.d.ts +2 -1
  44. package/dist/lib/MxModule/store/Store.js +1 -1
  45. package/dist/lib/MxModule.d.ts +60 -60
  46. package/dist/lib/doc.d.ts +16 -8
  47. package/dist/lib/doc.js +1 -1
  48. package/dist/lib/tools/registerMxDbEntity/index.d.ts +1 -1
  49. package/dist/mxdraw.es.js +1 -1
  50. package/dist/mxdraw.umd.js +1 -1
  51. package/package.json +1 -1
package/README.md CHANGED
@@ -15,191 +15,191 @@
15
15
  - [License](#license)
16
16
 
17
17
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
18
-
19
- ## 快速上手
20
- ### 简介
21
- #### mxdraw 是什么?
22
- > mxdraw 是个在线CAD的JS库,实现在线CAD,DWG图纸浏览和编辑等功能的一套解决方案, 支持大部分现代主流浏览器比如Chrome、Edge等, 不支持IE浏览器。
23
- > DWG文件通过后端程序格式转换后[后端程序详见](https://help.mxdraw.com/?pid=111),就可使用mxdraw在线打开。
24
- #### 使用人群
25
- > 面向前端开发者 熟悉了解`JavaScript` 并且会使用 `three.js`框架。
26
- > 如从未接触过three.js建议先阅读[three.js中文文档](http://www.yanhuangxueyuan.com/threejs/docs/index.html#manual/zh/) 后再进行开发使用。
27
-
28
- ### 安装
29
- #### npm
30
- ``` sh
31
- yarn add mxdraw 或 npm install mxdraw
32
- ```
33
-
34
- ### 用法
35
-
36
- #### 引入
37
-
38
- ``` javascript
39
- import Mx from "mxdraw"
40
- ```
41
-
42
- #### 加载
43
- > html
44
- ``` html
45
- <canvas id="mxcad">
46
- </canvas>
47
- ```
48
- -------------
49
- > js
50
- ``` javascript
51
- import Mx from "mxdraw"
52
- // 动态加载 js库核心代码
53
- Mx.loadCoreCode().then(()=> {
54
- // 创建控件对象
55
- Mx.MxFun.createMxObject({
56
- canvasId:"mxcad", // canvas元素的id
57
- cadFile:"http://localhost:8088/demo/buf/hhhh.dwg.mxb1.wgh", // 后端程序转换dwg文件后的文件位置。
58
- callback: (mxDrawObject, {
59
- canvas,
60
- canvasParent
61
- }) => {
62
- // 可以拿到canvas元素和它的父级元素
63
- //console.log(canvas, canvasParent)
64
- //console.log(mxDrawObject)
65
- // 图纸加载完成
66
- mxDrawObject.addEvent("loadComplete", () => {
67
- console.log("mx loadComplete");
68
- });
69
- }
70
- })
71
- })
72
- ```
73
-
74
-
75
- #### 如何实现一个画线的功能命令?
76
- ##### 1.实现画线功能
77
- 参考内容:
78
- * [MrxDbgUiPrPointClass | getPoint](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MrxDbgUiPrPointClass.html) 构建取点对象
79
- * [status](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/enums/MrxDbgUiPrBaseReturn.html) MrxDbgUiPrBaseReturn 表示对应状态
80
- * [McEdGetPointWorldDrawObjectClass | pWorldDraw](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/McEdGetPointWorldDrawObjectClass.html) 用于构建一个动态绘制回调对象
81
-
82
- ``` javascript
83
- import Mx from "mxdraw"
84
- // 画线的函数
85
- export async function BR_Line() {
86
-
87
- // 让用在图上点取直线的开始点.
88
- const getPoint = new MrxDbgUiPrPoint();
89
- getPoint.setMessage("\n指定第一点:");
90
- let pt1:THREE.Vector3|null = await getPoint.go();
91
- if(pt1 == null){
92
- return;
93
-
94
- }
95
- getPoint.setBasePt(pt1.clone());
96
- getPoint.setUseBasePt(true);
97
- getPoint.setMessage("\n指定第二点:");
98
-
99
- // 让用在图上点取直线的结束点.
100
- let pt2:THREE.Vector3|null = await getPoint.go();
101
- if(pt2 == null){
102
- return;
103
- }
104
-
105
- // 创建一个直线对象,添加到图上。
106
- let line = new MxDbLine()
107
- line.pt1 = pt1;
108
- line.pt2 = pt2;
109
-
110
- line.setDashLineDisplay(true);
111
- line.setLineWidth(10);
112
- line.setLineWidthByPixels(true);
113
-
114
- MxFun.addToCurrentSpace(line);
115
- }
116
- ```
117
-
118
-
119
-
120
- ##### 2.注册使用命名
121
- 参考内容:
122
- * [MxFun.addCommand](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxFun.html#addCommand) 注册命名方法
123
- * [MxFun.sendStringToExecute](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxFun.html#sendStringToExecute) 执行命名方法
124
- * [MxFun.isRunningCommand](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxFun.html#isRunningCommand) 检查是否有命令在运行
125
-
126
- ``` javascript
127
- import Mx from "mxdraw"
128
- // 注册命名
129
- Mx.MxFun.addCommand("BR_Line", ()=> {
130
- if(Mx.MxFun.isRunningCommand()) {
131
- return
132
- }
133
- BR_Line()
134
- })
135
- // 执行命令
136
- Mx.MxFun.sendStringToExecute("BR_Line")
137
-
138
- ```
139
-
140
-
141
- > 更多Api使用说明请参考[Mx模块集](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/modules.html)对应模块中的Api接口说明
142
-
143
- ## Mx模块集
144
- > 暴露出来的函数/类/对象 包括接口/枚举等Ts的类型
145
-
146
- ### loadCoreCode 动态加载核心(初始化)
147
- > CoreCode 这里加载了核心程序(包括three.js)以及jquery.js库 请在需要时自行调用(所有模块都需要等待CoreCode加载完成才能使用) 列如:
148
- ``` javascript
149
- import { loadCoreCode } from "mxdraw"
150
- loadCoreCode().then(()=> {
151
- console.log('CoreCode加载完成')
152
- })
153
- ```
154
- ### MxFun 方法集合
155
- > MxFun提供了核心方法, 其中最重要的两个方法就是[setMxServer](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxFun.html#setMxServer)设置服务器地址
156
- 以及 [createMxObject](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxFun.html#createMxObject) 创建控制对象
157
- * 服务器地址就是[MxDraw云图开发包](https://www.mxdraw.com/download.html) 所启动的后台服务地址...[详情](https://help.mxdraw.com/?pid=32&keywords=)
158
-
159
- ### MxDrawObject 控件对象
160
- > [MxFun.createMxObject](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxFun.html#createMxObject) 创建的控件对象可以对canvas画布上展示的图纸进行控制修改以及添加three.js中各种组合图形等功能[详情](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxDrawObject.html)
161
-
162
-
163
- ### McEdGetPointWorldDrawObject / MrxDbgUiPrPoint / MrxDbgUiPrBaseReturn 动态绘制
164
- * [McEdGetPointWorldDrawObject](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/McEdGetPointWorldDrawObject.html)是动态绘制对象的类, 一个McEdGetPointWorldDrawObject实例可以使用setDraw方法设置动态的回调函数,一般情况下回调函数中会通过drawCustomEntity或者提供的其他方法绘制出需要动态绘制的部分(鼠标移动将会触发动态回调函数)
165
- * [MrxDbgUiPrPoint](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MrxDbgUiPrPoint.html)是一个配合动态绘制的鼠标去点的类,实例化后通过go或者goWhile 方式设置鼠标点击回调事件, 通过setUserDraw方法设置动态绘制对象, 此时动态绘制对象生效,在鼠标移动时会触发其动态回调函数
166
- * [MrxDbgUiPrBaseReturn](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MrxDbgUiPrBaseReturn.html)是MrxDbgUiPrPoint的go或者goWhile的回调参数判断点击类型的一个枚举类型。
167
- * McEdGetPointWorldDrawObject / MrxDbgUiPrPoint 配合使用 就能够完成大部分图形动态绘制的需求,例:[如何实现一个画线的功能命令?](#%E7%94%A8%E6%B3%95)
168
-
169
- ### MxDbEntity / McGiWorldDraw / McGiWorldDrawType 自定义对象
170
- > 自定义对象是为了更加方便的控制一个图形物体对象创建的一个控制器, 在需要对已经绘制在画布上的图形物体进行动态改动操作时,有一系列繁琐的过程,选取对象/选取状态/生成可改动的顶点/拖动改变顶点位置/动态绘制...
171
-
172
- > 如果遵循自定义对象的规范(实现MxDbEntity抽象类),就可以忽略这些步骤,在实现了预设行为(抽象方法)后,鼠标操作就可以完成对物体对象的顶点操作,从而改变图形物体。
173
-
174
-
175
- * [MxDbEntity](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxDbEntity.html)抽象类 通过继承的方式实现一个自定义对象
176
- * [McGiWorldDraw](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/McGiWorldDraw.html) 是 [MxDbEntity.worldDraw](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/MxDbEntity.html#worldDraw)抽象方法的回调对象 可以实现再鼠标拖动过程中的一些动态绘制任务
177
- * [McGiWorldDrawType](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/McGiWorldDrawType.html) 是[McGiWorldDraw.getType](https://mxtmpweb.mxdraw.f3322.net:3562/mxdrawcloud/classes/McGiWorldDraw.html#getType)方法返回的枚举类型表示MxDbEntity.worldDraw的绘制类型
178
-
179
-
180
- ## 按需引入配置
181
- > 使用`babel` 插件`babel-plugin-import` 实现按需引入
182
- > 需要安装 `npm i babel-plugin-import -D` 然后找到或创建项目根目录的`.babelrc`文件新增如下内容
183
- ```json
184
- {
185
- "plugins": [
186
- [
187
- "import", {
188
- "libraryName": "mxdraw",
189
- "libraryDirectory": "dist/lib/MxModule",
190
- "camel2UnderlineComponentName": false,
191
- "camel2DashComponentName": false
192
- }
193
- ]
194
- ]
195
- }
196
- ```
197
-
198
- > 基于`babel-plugin-import`按需引入
199
- ``` javascript
200
- import { MxFun } from "mxdraw"
201
- ```
202
- > 或者直接通过`import MxFun from "mxdraw/dist/lib/MxModule/MxFun"` 这样的方式直接引入对应模块
203
-
204
- ## License
205
- 版权所有 (c) 2021 成都梦想凯德科技有限公司
18
+
19
+ ## 快速上手
20
+ ### 简介
21
+ #### mxdraw 是什么?
22
+ > mxdraw 是个在线CAD的JS库,实现在线CAD,DWG图纸浏览和编辑等功能的一套解决方案, 支持大部分现代主流浏览器比如Chrome、Edge等, 不支持IE浏览器。
23
+ > DWG文件通过后端程序格式转换后[后端程序详见](https://help.mxdraw.com/?pid=111),就可使用mxdraw在线打开。
24
+ #### 使用人群
25
+ > 面向前端开发者 熟悉了解`JavaScript` 并且会使用 `three.js`框架。
26
+ > 如从未接触过three.js建议先阅读[three.js中文文档](http://www.yanhuangxueyuan.com/threejs/docs/index.html#manual/zh/) 后再进行开发使用。
27
+
28
+ ### 安装
29
+ #### npm
30
+ ``` sh
31
+ yarn add mxdraw 或 npm install mxdraw
32
+ ```
33
+
34
+ ### 用法
35
+
36
+ #### 引入
37
+
38
+ ``` javascript
39
+ import Mx from "mxdraw"
40
+ ```
41
+
42
+ #### 加载
43
+ > html
44
+ ``` html
45
+ <canvas id="mxcad">
46
+ </canvas>
47
+ ```
48
+ -------------
49
+ > js
50
+ ``` javascript
51
+ import Mx from "mxdraw"
52
+ // 动态加载 js库核心代码
53
+ Mx.loadCoreCode().then(()=> {
54
+ // 创建控件对象
55
+ Mx.MxFun.createMxObject({
56
+ canvasId:"mxcad", // canvas元素的id
57
+ cadFile:"http://localhost:8088/demo/buf/hhhh.dwg.mxb1.wgh", // 后端程序转换dwg文件后的文件位置。
58
+ callback: (mxDrawObject, {
59
+ canvas,
60
+ canvasParent
61
+ }) => {
62
+ // 可以拿到canvas元素和它的父级元素
63
+ //console.log(canvas, canvasParent)
64
+ //console.log(mxDrawObject)
65
+ // 图纸加载完成
66
+ mxDrawObject.addEvent("loadComplete", () => {
67
+ console.log("mx loadComplete");
68
+ });
69
+ }
70
+ })
71
+ })
72
+ ```
73
+
74
+
75
+ #### 如何实现一个画线的功能命令?
76
+ ##### 1.实现画线功能
77
+ 参考内容:
78
+ * [MrxDbgUiPrPointClass | getPoint](https://mxcad.github.io/mxdraw_api_docs/classes/MrxDbgUiPrPointClass.html) 构建取点对象
79
+ * [status](https://mxcad.github.io/mxdraw_api_docs/enums/MrxDbgUiPrBaseReturn.html) MrxDbgUiPrBaseReturn 表示对应状态
80
+ * [McEdGetPointWorldDrawObjectClass | pWorldDraw](https://mxcad.github.io/mxdraw_api_docs/classes/McEdGetPointWorldDrawObjectClass.html) 用于构建一个动态绘制回调对象
81
+
82
+ ``` javascript
83
+ import Mx from "mxdraw"
84
+ // 画线的函数
85
+ export async function BR_Line() {
86
+
87
+ // 让用在图上点取直线的开始点.
88
+ const getPoint = new MrxDbgUiPrPoint();
89
+ getPoint.setMessage("\n指定第一点:");
90
+ let pt1:THREE.Vector3|null = await getPoint.go();
91
+ if(pt1 == null){
92
+ return;
93
+
94
+ }
95
+ getPoint.setBasePt(pt1.clone());
96
+ getPoint.setUseBasePt(true);
97
+ getPoint.setMessage("\n指定第二点:");
98
+
99
+ // 让用在图上点取直线的结束点.
100
+ let pt2:THREE.Vector3|null = await getPoint.go();
101
+ if(pt2 == null){
102
+ return;
103
+ }
104
+
105
+ // 创建一个直线对象,添加到图上。
106
+ let line = new MxDbLine()
107
+ line.pt1 = pt1;
108
+ line.pt2 = pt2;
109
+
110
+ line.setDashLineDisplay(true);
111
+ line.setLineWidth(10);
112
+ line.setLineWidthByPixels(true);
113
+
114
+ MxFun.addToCurrentSpace(line);
115
+ }
116
+ ```
117
+
118
+
119
+
120
+ ##### 2.注册使用命名
121
+ 参考内容:
122
+ * [MxFun.addCommand](https://mxcad.github.io/mxdraw_api_docs/classes/MxFun.html#addCommand) 注册命名方法
123
+ * [MxFun.sendStringToExecute](https://mxcad.github.io/mxdraw_api_docs/classes/MxFun.html#sendStringToExecute) 执行命名方法
124
+ * [MxFun.isRunningCommand](https://mxcad.github.io/mxdraw_api_docs/classes/MxFun.html#isRunningCommand) 检查是否有命令在运行
125
+
126
+ ``` javascript
127
+ import Mx from "mxdraw"
128
+ // 注册命名
129
+ Mx.MxFun.addCommand("BR_Line", ()=> {
130
+ if(Mx.MxFun.isRunningCommand()) {
131
+ return
132
+ }
133
+ BR_Line()
134
+ })
135
+ // 执行命令
136
+ Mx.MxFun.sendStringToExecute("BR_Line")
137
+
138
+ ```
139
+
140
+
141
+ > 更多Api使用说明请参考[Mx模块集](https://mxcad.github.io/mxdraw_api_docs/modules.html)对应模块中的Api接口说明
142
+
143
+ ## Mx模块集
144
+ > 暴露出来的函数/类/对象 包括接口/枚举等Ts的类型
145
+
146
+ ### loadCoreCode 动态加载核心(初始化)
147
+ > CoreCode 这里加载了核心程序(包括three.js)以及jquery.js库 请在需要时自行调用(所有模块都需要等待CoreCode加载完成才能使用) 列如:
148
+ ``` javascript
149
+ import { loadCoreCode } from "mxdraw"
150
+ loadCoreCode().then(()=> {
151
+ console.log('CoreCode加载完成')
152
+ })
153
+ ```
154
+ ### MxFun 方法集合
155
+ > MxFun提供了核心方法, 其中最重要的两个方法就是[setMxServer](https://mxcad.github.io/mxdraw_api_docs/classes/MxFun.html#setMxServer)设置服务器地址
156
+ 以及 [createMxObject](https://mxcad.github.io/mxdraw_api_docs/classes/MxFun.html#createMxObject) 创建控制对象
157
+ * 服务器地址就是[MxDraw云图开发包](https://www.mxdraw.com/download.html) 所启动的后台服务地址...[详情](https://help.mxdraw.com/?pid=32&keywords=)
158
+
159
+ ### MxDrawObject 控件对象
160
+ > [MxFun.createMxObject](https://mxcad.github.io/mxdraw_api_docs/classes/MxFun.html#createMxObject) 创建的控件对象可以对canvas画布上展示的图纸进行控制修改以及添加three.js中各种组合图形等功能[详情](https://mxcad.github.io/mxdraw_api_docs/classes/MxDrawObject.html)
161
+
162
+
163
+ ### McEdGetPointWorldDrawObject / MrxDbgUiPrPoint / MrxDbgUiPrBaseReturn 动态绘制
164
+ * [McEdGetPointWorldDrawObject](https://mxcad.github.io/mxdraw_api_docs/classes/McEdGetPointWorldDrawObject.html)是动态绘制对象的类, 一个McEdGetPointWorldDrawObject实例可以使用setDraw方法设置动态的回调函数,一般情况下回调函数中会通过drawCustomEntity或者提供的其他方法绘制出需要动态绘制的部分(鼠标移动将会触发动态回调函数)
165
+ * [MrxDbgUiPrPoint](https://mxcad.github.io/mxdraw_api_docs/classes/MrxDbgUiPrPoint.html)是一个配合动态绘制的鼠标去点的类,实例化后通过go或者goWhile 方式设置鼠标点击回调事件, 通过setUserDraw方法设置动态绘制对象, 此时动态绘制对象生效,在鼠标移动时会触发其动态回调函数
166
+ * [MrxDbgUiPrBaseReturn](https://mxcad.github.io/mxdraw_api_docs/classes/MrxDbgUiPrBaseReturn.html)是MrxDbgUiPrPoint的go或者goWhile的回调参数判断点击类型的一个枚举类型。
167
+ * McEdGetPointWorldDrawObject / MrxDbgUiPrPoint 配合使用 就能够完成大部分图形动态绘制的需求,例:[如何实现一个画线的功能命令?](#%E7%94%A8%E6%B3%95)
168
+
169
+ ### MxDbEntity / McGiWorldDraw / McGiWorldDrawType 自定义对象
170
+ > 自定义对象是为了更加方便的控制一个图形物体对象创建的一个控制器, 在需要对已经绘制在画布上的图形物体进行动态改动操作时,有一系列繁琐的过程,选取对象/选取状态/生成可改动的顶点/拖动改变顶点位置/动态绘制...
171
+
172
+ > 如果遵循自定义对象的规范(实现MxDbEntity抽象类),就可以忽略这些步骤,在实现了预设行为(抽象方法)后,鼠标操作就可以完成对物体对象的顶点操作,从而改变图形物体。
173
+
174
+
175
+ * [MxDbEntity](https://mxcad.github.io/mxdraw_api_docs/classes/MxDbEntity.html)抽象类 通过继承的方式实现一个自定义对象
176
+ * [McGiWorldDraw](https://mxcad.github.io/mxdraw_api_docs/classes/McGiWorldDraw.html) 是 [MxDbEntity.worldDraw](https://mxcad.github.io/mxdraw_api_docs/classes/MxDbEntity.html#worldDraw)抽象方法的回调对象 可以实现再鼠标拖动过程中的一些动态绘制任务
177
+ * [McGiWorldDrawType](https://mxcad.github.io/mxdraw_api_docs/classes/McGiWorldDrawType.html) 是[McGiWorldDraw.getType](https://mxcad.github.io/mxdraw_api_docs/classes/McGiWorldDraw.html#getType)方法返回的枚举类型表示MxDbEntity.worldDraw的绘制类型
178
+
179
+
180
+ ## 按需引入配置
181
+ > 使用`babel` 插件`babel-plugin-import` 实现按需引入
182
+ > 需要安装 `npm i babel-plugin-import -D` 然后找到或创建项目根目录的`.babelrc`文件新增如下内容
183
+ ```json
184
+ {
185
+ "plugins": [
186
+ [
187
+ "import", {
188
+ "libraryName": "mxdraw",
189
+ "libraryDirectory": "dist/lib/MxModule",
190
+ "camel2UnderlineComponentName": false,
191
+ "camel2DashComponentName": false
192
+ }
193
+ ]
194
+ ]
195
+ }
196
+ ```
197
+
198
+ > 基于`babel-plugin-import`按需引入
199
+ ``` javascript
200
+ import { MxFun } from "mxdraw"
201
+ ```
202
+ > 或者直接通过`import MxFun from "mxdraw/dist/lib/MxModule/MxFun"` 这样的方式直接引入对应模块
203
+
204
+ ## License
205
+ 版权所有 (c) 2021 成都梦想凯德科技有限公司
@@ -64,14 +64,14 @@ export default class McEdGetPointWorldDrawObject {
64
64
  */
65
65
  drawMcDbEntity(mcdbEntity: any): any;
66
66
  /**
67
- * 绘制一个MxCAD数据库对象
68
- * @param mcdbEntity MxCAD数据库对象
69
- * @returns void
70
- * @example
71
- * ``` typescript
72
- * ```
73
- *
74
- */
67
+ * 绘制一个MxCAD数据库对象
68
+ * @param mcdbEntity MxCAD数据库对象
69
+ * @returns void
70
+ * @example
71
+ * ``` typescript
72
+ * ```
73
+ *
74
+ */
75
75
  drawMcDbLine(x1: number, y1: number, z1: number, x2: number, y2: number, z2: number): any;
76
76
  /**
77
77
  * 绘制一个文档对象
@@ -6,7 +6,7 @@ import McGePoint3dArray from '../McGePoint3dArray';
6
6
  * @example ```typescript
7
7
  * ```
8
8
  */
9
- declare class McGeToolClass {
9
+ export declare class McGeToolClass {
10
10
  private mxgeTool;
11
11
  private initImp;
12
12
  /**
@@ -1 +1 @@
1
- import Mxassembly from"../Mxassembly";import store from"../store";class McGeToolClass{constructor(){this.mxgeTool=null}initImp(){this.mxgeTool||store.state.Mxassembly&&(this.mxgeTool=new store.state.Mxassembly.McGeTool)}calcArea(e){if(this.initImp(),e instanceof Array){let o=Mxassembly.NewMcGePoint3dArray(e);return this.mxgeTool.calcArea(o)}return this.mxgeTool.calcArea(e)}pointInPolyline(e,o){this.initImp();let t=o;o instanceof Array&&(t=Mxassembly.NewMcGePoint3dArray(o));let s=Mxassembly.NewMcGePoint3d(e.x,e.y,e.z);return this.mxgeTool.pointInPolyline(s,t)}}const McGeTool=new McGeToolClass;export default McGeTool;
1
+ import Mxassembly from"../Mxassembly";import store from"../store";export class McGeToolClass{constructor(){this.mxgeTool=null}initImp(){this.mxgeTool||store.state.Mxassembly&&(this.mxgeTool=new store.state.Mxassembly.McGeTool)}calcArea(e){if(this.initImp(),e instanceof Array){let o=Mxassembly.NewMcGePoint3dArray(e);return this.mxgeTool.calcArea(o)}return this.mxgeTool.calcArea(e)}pointInPolyline(e,o){this.initImp();let t=o;o instanceof Array&&(t=Mxassembly.NewMcGePoint3dArray(o));let s=Mxassembly.NewMcGePoint3d(e.x,e.y,e.z);return this.mxgeTool.pointInPolyline(s,t)}};const McGeTool=new McGeToolClass;export default McGeTool;
@@ -6,7 +6,7 @@ import MxDrawObject from '../MxDrawObject';
6
6
  * @example ```typescript
7
7
  * ```
8
8
  */
9
- declare class MrxDbgUtilsClass {
9
+ export declare class MrxDbgUtilsClass {
10
10
  private imp;
11
11
  private initImp;
12
12
  /**
@@ -1 +1 @@
1
- import MxFun from"../MxFun";import store from"../store";class MrxDbgUtilsClass{constructor(){this.imp=null}initImp(){if(!this.imp&&store.state.MxFun){let t=store.state.MxFun;this.imp=new t.getMrxDbgUtilsClass}}findEntAtPoint(t,i=null,s,n=!0,e){return this.initImp(),s||(s=MxFun.getCurrentDraw()),this.imp.findEntAtPoint(s.getMxObjectImplement(),t,i,n,e)}selectEnt(t,i){return this.initImp(),this.imp.selectEnt(t)}}const MrxDbgUtils=new MrxDbgUtilsClass;export default MrxDbgUtils;
1
+ import MxFun from"../MxFun";import store from"../store";export class MrxDbgUtilsClass{constructor(){this.imp=null}initImp(){if(!this.imp&&store.state.MxFun){let t=store.state.MxFun;this.imp=new t.getMrxDbgUtilsClass}}findEntAtPoint(t,i=null,s,n=!0,e){return this.initImp(),s||(s=MxFun.getCurrentDraw()),this.imp.findEntAtPoint(s.getMxObjectImplement(),t,i,n,e)}selectEnt(t,i){return this.initImp(),this.imp.selectEnt(t)}};const MrxDbgUtils=new MrxDbgUtilsClass;export default MrxDbgUtils;
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbCircleShape from "../MxDbCircleShape";
3
- import drawMx3PointArc from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbCircleShape from '../MxDbCircleShape';
3
+ import drawMx3PointArc from './draw';
4
4
  /** 三点动态绘制圆弧 point1圆弧起始点 point2是圆弧结束点, point3圆弧任意一点 */
5
5
  declare class Mx3PointArc extends MxDbCircleShape {
6
6
  static cmd: string;
@@ -1,2 +1,2 @@
1
- import MxDb2LineAngularDimension from ".";
1
+ import MxDb2LineAngularDimension from '.';
2
2
  export default function drawMxDb2LineAngularDimension(): MxDb2LineAngularDimension;
@@ -1,2 +1,2 @@
1
- import MxDbAlignedDimension from ".";
1
+ import MxDbAlignedDimension from '.';
2
2
  export default function drawMxDbAlignedDimension(): MxDbAlignedDimension;
@@ -1,5 +1,5 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbCircleArc from "../MxDbCircleArc";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbCircleArc from '../MxDbCircleArc';
3
3
  declare class MxDbArcShape extends MxDbCircleArc {
4
4
  /** 环形 */
5
5
  constructor();
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbArcShape from "../MxDbArcShape";
3
- import drawMxDbArcShape from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbArcShape from '../MxDbArcShape';
3
+ import drawMxDbArcShape from './draw';
4
4
  declare class MxDbArcShapeDraw extends MxDbArcShape {
5
5
  static isRegister: boolean;
6
6
  static cmd: string;
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbShape from "../MxDbShape";
3
- import drawMxDbArrow from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbShape from '../MxDbShape';
3
+ import drawMxDbArrow from './draw';
4
4
  declare class MxDbArrow extends MxDbShape {
5
5
  static cmd: string;
6
6
  static draw: typeof drawMxDbArrow;
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbCircleShape from "../MxDbCircleShape";
3
- import drawMxDbCircleArc from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbCircleShape from '../MxDbCircleShape';
3
+ import drawMxDbCircleArc from './draw';
4
4
  declare class MxDbCircleArc extends MxDbCircleShape {
5
5
  static cmd: string;
6
6
  static draw: typeof drawMxDbCircleArc;
@@ -1,4 +1,4 @@
1
- import MxDbEllipseShape from "../MxDbEllipseShape";
1
+ import MxDbEllipseShape from '../MxDbEllipseShape';
2
2
  /*** 圆(弧)形状 */
3
3
  export default class MxDbCircleShape extends MxDbEllipseShape {
4
4
  getTypeName(): string;
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbEllipseShape from "../MxDbEllipseShape";
3
- import drawMxDbEllipse from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbEllipseShape from '../MxDbEllipseShape';
3
+ import drawMxDbEllipse from './draw';
4
4
  /** 通过两个构成矩形的点绘制椭圆形 */
5
5
  declare class MxDbEllipse extends MxDbEllipseShape {
6
6
  static cmd: string;
@@ -1,9 +1,9 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbEllipseShape from "../MxDbEllipseShape";
3
- import drawMxDbEllipseArc from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbEllipseShape from '../MxDbEllipseShape';
3
+ import drawMxDbEllipseArc from './draw';
4
4
  /**
5
- * 根据中心点、椭圆开始点和结束点确定椭圆弧
6
- * */
5
+ * 根据中心点、椭圆开始点和结束点确定椭圆弧
6
+ * */
7
7
  declare class MxDbEllipseArc extends MxDbEllipseShape {
8
8
  static cmd: string;
9
9
  static draw: typeof drawMxDbEllipseArc;
@@ -1,5 +1,5 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbShape from "../MxDbShape";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbShape from '../MxDbShape';
3
3
  /*** 椭圆(弧)形状 */
4
4
  export default class MxDbEllipseShape extends MxDbShape {
5
5
  constructor();
@@ -364,9 +364,9 @@ export default abstract class MxDbEntity {
364
364
  */
365
365
  removeEvent(name: string): void;
366
366
  /**
367
- * 把一个对象变成一个json字体串.
368
- * @returns void
369
- */
367
+ * 把一个对象变成一个json字体串.
368
+ * @returns void
369
+ */
370
370
  toJsonString(type?: MxType.MxCloneType): string;
371
371
  /**
372
372
  * 从一个josn字符串加载数据.
@@ -1,5 +1,5 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbShape from "../MxDbShape";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbShape from '../MxDbShape';
3
3
  /** 线形状 */
4
4
  declare class MxDbLineShape extends MxDbShape {
5
5
  points: THREE.Vector3[];
@@ -1,5 +1,5 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbShape from "../MxDbShape";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbShape from '../MxDbShape';
3
3
  /** 等边多边形 */
4
4
  declare class MxDbRegularPolygonShape extends MxDbShape {
5
5
  center: import("three").Vector3;
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbArcShape from "../MxDbArcShape";
3
- import drawMxDbRingShape from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbArcShape from '../MxDbArcShape';
3
+ import drawMxDbRingShape from './draw';
4
4
  /** 环形 */
5
5
  declare class MxDbRingShape extends MxDbArcShape {
6
6
  static isRegister: boolean;
@@ -1,7 +1,7 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbEntity from "../MxDbEntity";
3
- import MxFilters from "../MxFilters";
4
- import { UnstableColor } from "../MxType";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbEntity from '../MxDbEntity';
3
+ import MxFilters from '../MxFilters';
4
+ import { UnstableColor } from '../MxType';
5
5
  /** 动态绘制形状
6
6
  * 基于THREE.Shape计算实现的形状
7
7
  * 通过扩展可以实现各种2d 3d形状
@@ -30,8 +30,8 @@ export default class MxDbShape extends MxDbEntity {
30
30
  set fillImageSrc(src: string | false | null);
31
31
  setFillImageSrc(fillImageSrc: string): this;
32
32
  /**
33
- * fillImageParam 填充背景图片的参数设置(如果使用了滤镜则部分参数功能失效)
34
- * */
33
+ * fillImageParam 填充背景图片的参数设置(如果使用了滤镜则部分参数功能失效)
34
+ * */
35
35
  fillImageParam: {
36
36
  offset?: THREE.Vector2;
37
37
  repeat?: THREE.Vector2;
@@ -1,6 +1,6 @@
1
- import McGiWorldDraw from "../McGiWorldDraw";
2
- import MxDbEntity from "../MxDbEntity";
3
- import drawMxDbSplineCurve from "./draw";
1
+ import McGiWorldDraw from '../McGiWorldDraw';
2
+ import MxDbEntity from '../MxDbEntity';
3
+ import drawMxDbSplineCurve from './draw';
4
4
  export declare class MxDbSplineCurve extends MxDbEntity {
5
5
  static draw: typeof drawMxDbSplineCurve;
6
6
  /** 圆中心点 */