mxdraw 0.1.166 → 0.1.169

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/mxdraw.d.ts CHANGED
@@ -441,7 +441,7 @@ interface McGiWorldDraw {
441
441
  * ```
442
442
  *
443
443
  */
444
- setLineWidthIsPixels(isPixels: boolean): void;
444
+ setLineWidthByPixels(isPixels: boolean): void;
445
445
  /**
446
446
  * 得到宽度单位
447
447
  * @returns
@@ -606,16 +606,12 @@ declare abstract class MxDbEntity extends RenderOrderNode<EntityEvent, MxDbEntit
606
606
  * 颜色值
607
607
  * */
608
608
  color: UnstableColor;
609
- /**
610
- * 显示顺序
611
- * */
612
- renderOrder: number;
613
609
  /**
614
610
  * 设置透明度 0 ~ 1,1表示完全不透明,0表示全透明.
615
611
  * */
616
612
  opacity: number;
617
613
  /**
618
- * 该矩形对象是否可见
614
+ * 该对象是否可见
619
615
  * */
620
616
  visible: boolean;
621
617
  /**
@@ -1154,35 +1150,184 @@ declare class MxVueInterface {
1154
1150
  mountMxEvent: (name: string | number, call: any) => void;
1155
1151
  }
1156
1152
 
1157
- interface CanvasParent extends HTMLElement {
1158
- tabindex?: number;
1159
- }
1160
- /** 控件配置 **/
1161
- interface iniConfig {
1162
- /** 启用智能选择 */
1163
- EnableIntelliSelect?: boolean;
1164
- /** 启动O 捕捉功能 */
1165
- EnableOsnapFunction?: boolean;
1166
- /** 启动夹点编辑 */
1167
- EnableGripEidt?: boolean;
1168
- /** 多选 */
1169
- multipleSelect?: boolean;
1170
- /**自动重置渲染器 */
1171
- autoResetRenderer?: boolean;
1172
- /** 更正大坐标 */
1173
- correctLargeCoordinates?: boolean;
1174
- /** 请求标头缓存控制 */
1175
- requestHeaderCacheControl?: boolean;
1176
- /** 选择方式控制 */
1177
- IntelliSelectType?: number;
1178
- }
1179
- interface MxFunType {
1153
+ /**
1154
+ * 创建图纸展示控件实例
1155
+ * @param canvasId 提供一个canvas元素或者唯一的ID或者class类亦或者Jquery选中的元素
1156
+ * @paramType string | HTMLCanvasElement | JQuery<HTMLElement>
1157
+ * @param cadFile 提供要展示的图纸名称
1158
+ * @paramType string
1159
+ * @param callback 图纸展示控件创建完成后的回调函数 回调参数mxDraw和dom
1160
+ * @paramType function
1161
+ * @param isNewFile 是否新建文件
1162
+ * @paramType boolean
1163
+ * @return void
1164
+ * @example
1165
+ * ``` typescript
1166
+ * Mx.MxFun.createMxObject({
1167
+ * canvasId: "my-app",
1168
+ * cadFile: "test2.dwg",
1169
+ * callback(mxDraw, { canvas, canvasParent }) {
1170
+ * console.log(mxDraw, canvas, canvasParent)
1171
+ * },
1172
+ * isNewFile: true
1173
+ * })
1174
+ * ```
1175
+ */
1176
+ declare function createMxObject(this: MxFunType, { canvasId, cadFile, callback, isNewFile, useWebsocket, isAutoResize, mapBox, isMxCAD, userIdentitySign, isCPPMxCAD }: {
1177
+ canvasId?: string;
1178
+ cadFile?: string | string[];
1179
+ callback?: (mxDraw: MxDrawObject, dom: {
1180
+ canvas: HTMLCanvasElement;
1181
+ canvasParent: CanvasParent;
1182
+ }) => void;
1183
+ isNewFile?: boolean;
1184
+ useWebsocket?: boolean;
1185
+ isAutoResize?: boolean;
1186
+ mapBox?: any;
1187
+ isMxCAD?: boolean;
1188
+ userIdentitySign?: string;
1189
+ isCPPMxCAD?: boolean;
1190
+ }): void;
1191
+
1192
+ declare let mxUiData: MxVueInterface;
1193
+ /**
1194
+ * MxFun 模块
1195
+ * 导出库时已实例化,只需要调用实例方法 例如:
1196
+ * ```typescript
1197
+ * Mx.MxFun.createMxObject
1198
+ * ```
1199
+ */
1200
+ declare class MxFunClass {
1201
+ createMxObject: typeof createMxObject;
1202
+ /**
1203
+ * 为程序设置服务器地址
1204
+ * @param MXSERVER 服务器地址
1205
+ * @return void
1206
+ * @example
1207
+ * ``` typescript
1208
+ * Mx.MxFun.setMxServer("ws://localhost:5090")
1209
+ * ```
1210
+ */
1211
+ setMxServer(MXSERVER?: string): void;
1212
+ /**
1213
+ * 屏幕转文档坐标
1214
+ * @param x 坐标x
1215
+ * @param y 坐标y
1216
+ * @param z 坐标z
1217
+ * @return THREE.Vector3 文档坐标
1218
+ * @example
1219
+ * ``` typescript
1220
+ * const vector3 = Mx.MxFun.screenCoord2Doc(36, 21, 0)
1221
+ * console.log(vector3)
1222
+ * ```
1223
+ */
1224
+ screenCoord2Doc(x: number | THREE.Vector3, y?: number): THREE.Vector3;
1225
+ /**
1226
+ * 文档转屏幕坐标.
1227
+ * @param x 坐标x
1228
+ * @param y 坐标y
1229
+ * @param z 坐标z
1230
+ * @return THREE.Vector3 屏幕坐标
1231
+ * @example
1232
+ * ``` typescript
1233
+ * const vector3 = Mx.MxFun.docCoord2Screen(36, 21, 0)
1234
+ * console.log(vector3)
1235
+ * ```
1236
+ */
1237
+ docCoord2Screen(x: number | THREE.Vector3, y?: number): THREE.Vector3;
1238
+ /**
1239
+ * 获取当前MxCAD对象,该函数在MxCAD模式下使用
1240
+ * @return MxDrawObjectType MxCAD对象
1241
+ * @example
1242
+ * ``` typescript
1243
+ * const mxcad = Mx.MxFun.getCurrentMxCAD()
1244
+ * console.log(mxcad)
1245
+ * ```
1246
+ */
1247
+ getCurrentMxCAD(): MxCADObject;
1248
+ /**
1249
+ * 获取当前绘图控件对象
1250
+ * @return MxDrawObjectType 当前绘图控件对象
1251
+ * @example
1252
+ * ``` typescript
1253
+ * const mxDraw = Mx.MxFun.getCurrentDraw()
1254
+ * mxDraw.getScene()
1255
+ * ```
1256
+ */
1257
+ getCurrentDraw(): MxDrawObject;
1258
+ /**
1259
+ * 添加一个MxDbEntity实体到当前绘图对象上。
1260
+ * @param ent 实体对象
1261
+ * @returns number 返回对象的id.
1262
+ * @example
1263
+ * ```typescript
1264
+ *
1265
+ *
1266
+ * ```
1267
+ */
1268
+ addToCurrentSpace(ent: MxDbEntity): number;
1269
+ /**
1270
+ * 初始化插件的UI数据对象。
1271
+ * @param uiDataObj
1272
+ * @return
1273
+ * @example
1274
+ * ``` typescript
1275
+ * ```
1276
+ */
1277
+ initUiDataObject(uiDataObj: typeof mxUiData): void;
1278
+ /**
1279
+ * 获取UI数据对象
1280
+ * @param uiDataObj
1281
+ * @return mxUiData
1282
+ * @example
1283
+ * ``` typescript
1284
+ * ```
1285
+ */
1286
+ getUIData(): MxVueInterface;
1287
+ /**
1288
+ * 获得到当前数据库对象.
1289
+ * @return MxDbDatabase
1290
+ * @example
1291
+ * ``` typescript
1292
+ * ```
1293
+ */
1294
+ getCurrentDatabase(): MxDbDatabase;
1295
+ /**
1296
+ * 梦想开发测试
1297
+ * @param p
1298
+ * @return any
1299
+ * @example
1300
+ * ``` typescript
1301
+ * console.log(Mx.MxFun.TestMX());
1302
+ * ```
1303
+ */
1304
+ testMX(p?: any): any;
1305
+ /**
1306
+ * 加载一个图片对象,返回Three.js材质对象,该函数具有缓存功能,下次加载同样的图片,可以直接返回.
1307
+ * @param p
1308
+ * @return any
1309
+ * @example
1310
+ * ``` typescript
1311
+ *
1312
+ * ```
1313
+ */
1314
+ loadImageMaterial(imageUrlPath: string, callResult?: (material: THREE.MeshLambertMaterial) => void | null): Promise<THREE.MeshLambertMaterial | null>;
1315
+ /**
1316
+ * 在图上选择一个对象。
1317
+ * @param strPrompt 提示字符串
1318
+ * @param filter 过滤条件
1319
+ * @returns number 返回对象的id
1320
+ * @example
1321
+ * ```typescript
1322
+ *
1323
+ *
1324
+ * ```
1325
+ */
1326
+ selectEnt(strPrompt: string, filter?: any): Promise<number>;
1180
1327
  /** 初始化MxDbEntity的类型 */
1181
- initMxDbEntityType(entity: MxDbEntity): void;
1182
- /** 初始化UI数据对象 */
1183
- initUiDataObject(mxUiData: MxVueInterface): unknown;
1328
+ initMxDbEntityType: (entity: MxDbEntity) => void;
1184
1329
  /** 获取THREE */
1185
- getTHREE(): typeof three;
1330
+ getTHREE: () => typeof three;
1186
1331
  /**
1187
1332
  * 设置加载dwg文件,直接使用html get协议加载数据,这样就不需要梦想后台服务器程序。
1188
1333
  * @param isStaticLoad 是否启用html get协议加载数据文件
@@ -1192,7 +1337,7 @@ interface MxFunType {
1192
1337
  * Mx.MxFun.enablStaticLoad(true)
1193
1338
  * ```
1194
1339
  */
1195
- enablStaticLoad(isStaticLoad?: boolean): void;
1340
+ enablStaticLoad: (isStaticLoad?: boolean) => void;
1196
1341
  /**
1197
1342
  * 设置加载dwg文件,直接使用html get协议加载数据时,使用的服务器地址。
1198
1343
  * @param server 服务网络地址.
@@ -1202,7 +1347,7 @@ interface MxFunType {
1202
1347
  * Mx.MxFun.setStaticServer("http://localhost:3000/demo");
1203
1348
  * ```
1204
1349
  */
1205
- setStaticServer(server: string): void;
1350
+ setStaticServer: (server: string) => void;
1206
1351
  /**
1207
1352
  * 注册命令
1208
1353
  * @param cmdName 命令名
@@ -1215,7 +1360,7 @@ interface MxFunType {
1215
1360
  * })
1216
1361
  * ```
1217
1362
  */
1218
- addCommand(cmdName: string, fun: Function): void;
1363
+ addCommand: (cmdName: string, fun: Function) => void;
1219
1364
  /**
1220
1365
  * 执行命令
1221
1366
  * @param cmdName 命令名
@@ -1227,7 +1372,7 @@ interface MxFunType {
1227
1372
  * }
1228
1373
  * ```
1229
1374
  */
1230
- sendStringToExecute(cmdName: string, ...ages: any[]): boolean;
1375
+ sendStringToExecute: (cmdName: string, ...ages: any[]) => boolean;
1231
1376
  /**
1232
1377
  * 调用后台服务程序中的NodeJS用户定义函数 后台程序使用Mx.MxFun.registFun注册用户定义函数
1233
1378
  * @param funName 函数名
@@ -1243,17 +1388,7 @@ interface MxFunType {
1243
1388
  * })
1244
1389
  * ```
1245
1390
  */
1246
- call(funName: string, param?: any, retfun?: Function): void;
1247
- /**
1248
- * 获取当前绘图控件对象
1249
- * @return MxDrawObjectType 当前绘图控件对象
1250
- * @example
1251
- * ``` typescript
1252
- * const mxDraw = Mx.MxFun.getCurrentDraw()
1253
- * mxDraw.getScene()
1254
- * ```
1255
- */
1256
- getCurrentDraw(): MxDrawObject;
1391
+ call: (funName: string, param?: any, retfun?: Function) => void;
1257
1392
  /**
1258
1393
  * 屏幕坐标长度转THREE.JS坐标长度
1259
1394
  * @param len 屏幕坐标长度
@@ -1264,7 +1399,7 @@ interface MxFunType {
1264
1399
  * console.log(len)
1265
1400
  * ```
1266
1401
  */
1267
- screenCoordLong2World(len: number): number;
1402
+ screenCoordLong2World: (len: number) => number;
1268
1403
  /**
1269
1404
  * 屏幕坐标长度转文档坐标长度
1270
1405
  * @param len 屏幕坐标长度
@@ -1275,7 +1410,7 @@ interface MxFunType {
1275
1410
  * console.log(len)
1276
1411
  * ```
1277
1412
  */
1278
- screenCoordLong2Doc(len: number): number;
1413
+ screenCoordLong2Doc: (len: number) => number;
1279
1414
  /**
1280
1415
  * 文档坐标长度转屏幕坐标长度
1281
1416
  * @param len 文档坐标长度
@@ -1286,7 +1421,7 @@ interface MxFunType {
1286
1421
  * console.log(len)
1287
1422
  * ```
1288
1423
  */
1289
- docCoordLong2Screen(len: number): number;
1424
+ docCoordLong2Screen: (len: number) => number;
1290
1425
  /**
1291
1426
  * THREE.JS坐标长度转屏幕坐标长度
1292
1427
  * @param len THREE.JS坐标长度
@@ -1297,7 +1432,7 @@ interface MxFunType {
1297
1432
  * console.log(len)
1298
1433
  * ```
1299
1434
  */
1300
- worldCoordLong2Doc(len: number): number;
1435
+ worldCoordLong2Doc: (len: number) => number;
1301
1436
  /**
1302
1437
  * DWG文档坐标长度到ThreeJS坐标长度
1303
1438
  * @returns number
@@ -1307,7 +1442,7 @@ interface MxFunType {
1307
1442
  *
1308
1443
  * ```
1309
1444
  */
1310
- docCoordLong2World(l: number): number;
1445
+ docCoordLong2World: (l: number) => number;
1311
1446
  /**
1312
1447
  * 屏幕坐标转THREE.JS坐标.
1313
1448
  * @param x 坐标x
@@ -1320,7 +1455,7 @@ interface MxFunType {
1320
1455
  * console.log(vector3)
1321
1456
  * ```
1322
1457
  */
1323
- screenCoord2World(x: number | THREE.Vector3, y?: number, z?: number): THREE.Vector3;
1458
+ screenCoord2World: (x: number | THREE.Vector3, y?: number, z?: number) => THREE.Vector3;
1324
1459
  /**
1325
1460
  * THREE.JS坐标转屏幕坐标.,屏幕坐标的Y轴向下。坐标原点在左上角.
1326
1461
  * @param x 坐标x
@@ -1333,7 +1468,7 @@ interface MxFunType {
1333
1468
  * console.log(vector3)
1334
1469
  * ```
1335
1470
  */
1336
- worldCoord2Screen(x: number | THREE.Vector3, y?: number, z?: number): THREE.Vector3;
1471
+ worldCoord2Screen: (x: number | THREE.Vector3, y?: number, z?: number) => THREE.Vector3;
1337
1472
  /**
1338
1473
  * 文档坐标转THREE.JS坐标
1339
1474
  * 说明: 文档坐标,THREE.JS坐标的X轴都是从左到右,Y轴是下到上,但是屏幕像素坐标系:X轴都是从左到右,Y轴是上到下
@@ -1347,7 +1482,7 @@ interface MxFunType {
1347
1482
  * console.log(vector3)
1348
1483
  * ```
1349
1484
  */
1350
- docCoord2World(x: number, y: number, z: number): THREE.Vector3;
1485
+ docCoord2World: (x: number, y: number, z: number) => THREE.Vector3;
1351
1486
  /**
1352
1487
  * THREE.JS坐标转文档坐标.
1353
1488
  * @param x 坐标x
@@ -1360,7 +1495,7 @@ interface MxFunType {
1360
1495
  * console.log(vector3)
1361
1496
  * ```
1362
1497
  */
1363
- worldCoord2Doc(x: number, y: number, z: number): THREE.Vector3;
1498
+ worldCoord2Doc: (x: number, y: number, z: number) => THREE.Vector3;
1364
1499
  /**
1365
1500
  * 更新显示,使用Three.js绘制了对象,调用该函数更新显示。
1366
1501
  * @return void
@@ -1369,7 +1504,7 @@ interface MxFunType {
1369
1504
  * Mx.MxFun.updateDisplay()
1370
1505
  * ```
1371
1506
  */
1372
- updateDisplay(): void;
1507
+ updateDisplay: () => void;
1373
1508
  /**
1374
1509
  * 设置窗口鼠标等事件的回调操作
1375
1510
  * @param fun 参数1 type: 鼠标事件类型 "mouseup"鼠标释放 、"mousedown" 鼠标按下 参数2 event:事件对象 返回值: number 为0,表示事件往下传递,如果非0,表示事件已经被处理,不要往下传递了
@@ -1390,7 +1525,7 @@ interface MxFunType {
1390
1525
  * })
1391
1526
  * ```
1392
1527
  */
1393
- addWindowsEvent(fun: (type: string, event: any) => number): void;
1528
+ addWindowsEvent: (fun: (type: string, event: any) => number) => void;
1394
1529
  /**
1395
1530
  * 当前是否有命令在运行
1396
1531
  * @return boolean
@@ -1401,7 +1536,7 @@ interface MxFunType {
1401
1536
  * }
1402
1537
  * ```
1403
1538
  */
1404
- isRunningCommand(): boolean;
1539
+ isRunningCommand: () => boolean;
1405
1540
  /**
1406
1541
  * 窗口缩放,把指定的范围内的图形放到视区中
1407
1542
  * @param dLBx 矩形框范围的左下角X坐标
@@ -1415,7 +1550,7 @@ interface MxFunType {
1415
1550
  * Mx.MxFun.zoomW(21, 22, 300, 310, false)
1416
1551
  * ```
1417
1552
  */
1418
- zoomW(dLBx: number, dLBy: number, dRTx: number, dRTy: number, isWorld?: boolean): void;
1553
+ zoomW: (dLBx: number, dLBy: number, dRTx: number, dRTy: number, isWorld?: boolean) => void;
1419
1554
  /**
1420
1555
  * 显示或隐藏图层
1421
1556
  * @param idLayer 图层id,或层名
@@ -1428,7 +1563,7 @@ interface MxFunType {
1428
1563
  * Mx.MxFun.showLayer("2363", fasle, false)
1429
1564
  * ```
1430
1565
  */
1431
- showLayer(idLayer: number | string, isShow: boolean, isSketch?: boolean): void;
1566
+ showLayer: (idLayer: number | string, isShow: boolean, isSketch?: boolean) => void;
1432
1567
  /**
1433
1568
  * 输出字符串到命令行.
1434
1569
  * @param sval 输出字符串
@@ -1449,7 +1584,7 @@ interface MxFunType {
1449
1584
  * if(Mx.MxFun.getQueryString("mousetest") === "y")
1450
1585
  * ```
1451
1586
  */
1452
- getQueryString(name: string): string;
1587
+ getQueryString: (name: string) => string;
1453
1588
  /**
1454
1589
  * 设置控件的配制参数.
1455
1590
  * @param name
@@ -1461,7 +1596,7 @@ interface MxFunType {
1461
1596
  * })
1462
1597
  * ```
1463
1598
  */
1464
- setIniset(iniObj: iniConfig): void;
1599
+ setIniset: (iniObj: iniConfig) => void;
1465
1600
  /**
1466
1601
  * 更新图纸图层数据
1467
1602
  * @param dataLayers
@@ -1475,7 +1610,7 @@ interface MxFunType {
1475
1610
  * }
1476
1611
  * ```
1477
1612
  */
1478
- upDisplayForLayerData(dataLayers: any): boolean;
1613
+ upDisplayForLayerData: (dataLayers: any) => boolean;
1479
1614
  /**
1480
1615
  * 重新打开cad文件,该函数在控件创建完后,需要再次重新打开文件,调用。
1481
1616
  * @param sFile 打的cad文件路径
@@ -1484,22 +1619,11 @@ interface MxFunType {
1484
1619
  * ``` typescript
1485
1620
  * ```
1486
1621
  */
1487
- openFile(sFile: string | string[], useWebsocket?: boolean): boolean;
1488
- /**
1489
- * 添加一个MxDbEntity实体到当前绘图对象上。
1490
- * @param ent 实体对象
1491
- * @returns number 返回对象的id.
1492
- * @example
1493
- * ```typescript
1494
- *
1495
- *
1496
- * ```
1497
- */
1498
- addToCurrentSpace(ent: MxDbEntity): number;
1622
+ openFile: (sFile: string | string[], useWebsocket?: boolean) => boolean;
1499
1623
  /**
1500
1624
  * 调用服务器后台CAD命令.
1501
1625
  * */
1502
- callCommand(cmd: string, param: string, retCall?: (param: any) => void): void;
1626
+ callCommand: (cmd: string, param: string, retCall?: (param: any) => void) => void;
1503
1627
  /**
1504
1628
  * CAD坐标到文档坐标.
1505
1629
  * 默认情况下,cad等于doc,当前m_isCorrectLargeCoordinates为true时,doc变成了把cad图纸修改到小范围坐标系下的坐标。
@@ -1510,7 +1634,7 @@ interface MxFunType {
1510
1634
  *
1511
1635
  * ```
1512
1636
  */
1513
- cadCoord2Doc(x: number, y: number, z: number): THREE.Vector3;
1637
+ cadCoord2Doc: (x: number, y: number, z: number) => THREE.Vector3;
1514
1638
  /**
1515
1639
  * 文档坐标坐标到CAD.
1516
1640
  * 默认情况下,cad等于doc,当前m_isCorrectLargeCoordinates为true时,doc变成了把cad图纸修改到小范围坐标系下的坐标。
@@ -1521,7 +1645,7 @@ interface MxFunType {
1521
1645
  *
1522
1646
  * ```
1523
1647
  */
1524
- docCoord2Cad(x: number, y: number, z: number): THREE.Vector3;
1648
+ docCoord2Cad: (x: number, y: number, z: number) => THREE.Vector3;
1525
1649
  /**
1526
1650
  * 通过id得到对象.
1527
1651
  * @returns 返MxDbEntity
@@ -1531,7 +1655,7 @@ interface MxFunType {
1531
1655
  *
1532
1656
  * ```
1533
1657
  */
1534
- getMxEntity(id: number): MxDbEntity | undefined;
1658
+ getMxEntity: (id: number) => MxDbEntity | undefined;
1535
1659
  /**
1536
1660
  * 停止运行当前命令
1537
1661
  * @returns
@@ -1541,28 +1665,111 @@ interface MxFunType {
1541
1665
  *
1542
1666
  * ```
1543
1667
  */
1544
- stopRunCommand(): void;
1668
+ stopRunCommand: () => void;
1545
1669
  /**
1546
1670
  * 设置当前运行MxCAD的MxCPP环境对象。
1547
1671
  */
1548
- initMxCpp(mxcppimp: any): void;
1672
+ initMxCpp: (mxcppimp: any) => void;
1549
1673
  /**
1550
1674
  * Three.js坐标转MxCAD的DWG坐标长度
1551
1675
  */
1552
- docCoordLong2Cad(l: number): number;
1676
+ docCoordLong2Cad: (l: number) => number;
1553
1677
  /**
1554
1678
  * MxCAD的DWG坐标长度转Three.js坐标.
1555
1679
  */
1556
- cadCoordLong2Doc(l: number): number;
1680
+ cadCoordLong2Doc: (l: number) => number;
1557
1681
  /**
1558
1682
  * View坐标长度转MxCAD的DWG坐标.
1559
1683
  */
1560
- viewCoordLong2Cad(l: number): number;
1684
+ viewCoordLong2Cad: (l: number) => number;
1561
1685
  /**
1562
1686
  * MxCAD的DWG坐标长度转View坐标.
1563
1687
  */
1564
- cadCoordLong2View(l: number): number;
1565
- }
1688
+ cadCoordLong2View: (l: number) => number;
1689
+ /**
1690
+ * 监听命令行消息动态更新的数据
1691
+ * 在取点对象中设置的命令以及我们提供的图形对象中是有一套命令提示和参数化绘图,而该回调函数主要用来监听消息变化
1692
+ * @parma callback 回调函数中data中的msCmdTip表示命令提示 msCmdText表示当前用户输入的输入内容 msCmdDisplay表示所有的消息记录
1693
+ * */
1694
+ listenForCommandLineInput(callback: ((data: {
1695
+ msCmdTip: string;
1696
+ msCmdDisplay: string;
1697
+ msCmdText: string;
1698
+ }) => void) | undefined): void;
1699
+ /**
1700
+ * 设置命令行消息数据 (在监听input输入框的onKeydown事件的回调函数中调用)
1701
+ * @param msCmdText 用户输入的数据 input输入框输入的文本信息
1702
+ * @param keyCode 按键Code input输入框的onKeydown事件的event事件对象的keyCode属性
1703
+ * */
1704
+ setCommandLineInputData(msCmdText: string, keyCode: number): void;
1705
+ /**
1706
+ * 监听指针(鼠标光标)移动变化的坐标信息
1707
+ * @parma callback 回调函数中返回坐标信息
1708
+ * */
1709
+ listenForCoordTip(callback: (coordTip: string) => void): void;
1710
+ /**
1711
+ * 监听光标更新
1712
+ * @parma cursorType当前使用的光标类型
1713
+ * */
1714
+ listenForUpdateCursor(callback: ((cursorType: string) => void) | undefined): void;
1715
+ /**
1716
+ * 返回mxfun.min.js中的THREE.JS对象,可以用它来创建mxfun.min.js中THREE对象。
1717
+ * */
1718
+ getMxFunTHREE: () => any;
1719
+ /**
1720
+ * 返回mxfun.min.js中的ThreeJsTool对象
1721
+ * */
1722
+ getMxFunThreeTool(): any;
1723
+ /**
1724
+ * 创建十字光标图片
1725
+ * */
1726
+ ceneratecursor(cursorSize?: number, squareSize?: number, isRoss?: boolean, color?: string): HTMLImageElement;
1727
+ /**
1728
+ * 得到当前鼠标位置,返回的是屏幕坐标 。
1729
+ * @example
1730
+ * ```typescript
1731
+ *
1732
+ *
1733
+ * ```
1734
+ */
1735
+ getCurrentMousePostion(): THREE.Vector3;
1736
+ /**
1737
+ * 注册一个系统事件的监听
1738
+ * init 事件会在模块加载完成后触发。
1739
+ * */
1740
+ on(eventName: string, call: any): void;
1741
+ /**
1742
+ * 触发一个系统事件的调用
1743
+ * */
1744
+ callEvent(eventName: string, param?: any): void;
1745
+ /** 监听use或者调用自定义图形定义的绘制命令后创建图形对象的回调 */
1746
+ onUseCreateMxDbEntity(callback: (...ages: [MxDbEntity]) => any): void;
1747
+ }
1748
+ declare const MxFun: MxFunClass;
1749
+
1750
+ interface CanvasParent extends HTMLElement {
1751
+ tabindex?: number;
1752
+ }
1753
+ /** 控件配置 **/
1754
+ interface iniConfig {
1755
+ /** 启用智能选择 */
1756
+ EnableIntelliSelect?: boolean;
1757
+ /** 启动O 捕捉功能 */
1758
+ EnableOsnapFunction?: boolean;
1759
+ /** 启动夹点编辑 */
1760
+ EnableGripEidt?: boolean;
1761
+ /** 多选 */
1762
+ multipleSelect?: boolean;
1763
+ /**自动重置渲染器 */
1764
+ autoResetRenderer?: boolean;
1765
+ /** 更正大坐标 */
1766
+ correctLargeCoordinates?: boolean;
1767
+ /** 请求标头缓存控制 */
1768
+ requestHeaderCacheControl?: boolean;
1769
+ /** 选择方式控制 */
1770
+ IntelliSelectType?: number;
1771
+ }
1772
+ type MxFunType = MxFunClass;
1566
1773
 
1567
1774
  /** @module MxDrawObject */
1568
1775
 
@@ -1623,7 +1830,7 @@ interface MxDrawObjectType {
1623
1830
  getViewCenterDocCoord(): THREE.Vector3;
1624
1831
  updateCanvasSize(): void;
1625
1832
  }
1626
- type Events = {
1833
+ type MxDrawEvents = {
1627
1834
  "loadComplete": () => void;
1628
1835
  "render": () => void;
1629
1836
  "addResizeEvent": (resize: Function) => void;
@@ -1654,7 +1861,7 @@ type Events = {
1654
1861
  * {@link MxFun.getCurrentMxCAD} 方法返回值的构造类
1655
1862
  *
1656
1863
  */
1657
- declare class MxDrawObject extends Node<Events, Node<any, any>> {
1864
+ declare class MxDrawObject extends Node<MxDrawEvents, Node<any, any>> {
1658
1865
  private _mxdrawObj;
1659
1866
  private rootLayer;
1660
1867
  constructor(Mxdraw: MxDrawObjectType);
@@ -1870,9 +2077,9 @@ declare class MxDrawObject extends Node<Events, Node<any, any>> {
1870
2077
  * Mx.MxFun.getCurrentDraw().addEvent("MxEntitySelectChange", (aryId:Array<number>)=> {})
1871
2078
  * ```
1872
2079
  */
1873
- addEvent(eventNaem: keyof Events, fun: Events[keyof Events]): void;
1874
- on(event: keyof Events, callback: Events[keyof Events]): void;
1875
- off(event: keyof Events, callback: Events[keyof Events]): boolean;
2080
+ addEvent(eventNaem: keyof MxDrawEvents, fun: MxDrawEvents[keyof MxDrawEvents]): void;
2081
+ on(event: keyof MxDrawEvents, callback: MxDrawEvents[keyof MxDrawEvents]): void;
2082
+ off(event: keyof MxDrawEvents, callback: MxDrawEvents[keyof MxDrawEvents]): boolean;
1876
2083
  /**
1877
2084
  * 移除事件函数。
1878
2085
  * @param options { eventNaem: string, fun:any; }
@@ -1880,7 +2087,7 @@ declare class MxDrawObject extends Node<Events, Node<any, any>> {
1880
2087
  * @example
1881
2088
  * ```
1882
2089
  */
1883
- removeEventFuction(eventNaem: keyof Events, fun: Events[keyof Events]): boolean;
2090
+ removeEventFuction(eventNaem: keyof MxDrawEvents, fun: MxDrawEvents[keyof MxDrawEvents]): boolean;
1884
2091
  /**
1885
2092
  * INI设置
1886
2093
  * @param options { EnableOsnapFunction: boolean; }
@@ -2595,224 +2802,6 @@ type stateType = {
2595
2802
  };
2596
2803
  declare const store: Store<stateType>;
2597
2804
 
2598
- /**
2599
- * 创建图纸展示控件实例
2600
- * @param canvasId 提供一个canvas元素或者唯一的ID或者class类亦或者Jquery选中的元素
2601
- * @paramType string | HTMLCanvasElement | JQuery<HTMLElement>
2602
- * @param cadFile 提供要展示的图纸名称
2603
- * @paramType string
2604
- * @param callback 图纸展示控件创建完成后的回调函数 回调参数mxDraw和dom
2605
- * @paramType function
2606
- * @param isNewFile 是否新建文件
2607
- * @paramType boolean
2608
- * @return void
2609
- * @example
2610
- * ``` typescript
2611
- * Mx.MxFun.createMxObject({
2612
- * canvasId: "my-app",
2613
- * cadFile: "test2.dwg",
2614
- * callback(mxDraw, { canvas, canvasParent }) {
2615
- * console.log(mxDraw, canvas, canvasParent)
2616
- * },
2617
- * isNewFile: true
2618
- * })
2619
- * ```
2620
- */
2621
- declare function createMxObject(this: MxFunType, { canvasId, cadFile, callback, isNewFile, useWebsocket, isAutoResize, mapBox, isMxCAD, userIdentitySign, isCPPMxCAD }: {
2622
- canvasId?: string;
2623
- cadFile?: string | string[];
2624
- callback?: (mxDraw: MxDrawObject, dom: {
2625
- canvas: HTMLCanvasElement;
2626
- canvasParent: CanvasParent;
2627
- }) => void;
2628
- isNewFile?: boolean;
2629
- useWebsocket?: boolean;
2630
- isAutoResize?: boolean;
2631
- mapBox?: any;
2632
- isMxCAD?: boolean;
2633
- userIdentitySign?: string;
2634
- isCPPMxCAD?: boolean;
2635
- }): void;
2636
-
2637
- declare let mxUiData: MxVueInterface;
2638
- declare const MxFun: {
2639
- createMxObject: typeof createMxObject;
2640
- /**
2641
- * 为程序设置服务器地址
2642
- * @param MXSERVER 服务器地址
2643
- * @return void
2644
- * @example
2645
- * ``` typescript
2646
- * Mx.MxFun.setMxServer("ws://localhost:5090")
2647
- * ```
2648
- */
2649
- setMxServer(MXSERVER?: string): void;
2650
- /**
2651
- * 屏幕转文档坐标
2652
- * @param x 坐标x
2653
- * @param y 坐标y
2654
- * @param z 坐标z
2655
- * @return THREE.Vector3 文档坐标
2656
- * @example
2657
- * ``` typescript
2658
- * const vector3 = Mx.MxFun.screenCoord2Doc(36, 21, 0)
2659
- * console.log(vector3)
2660
- * ```
2661
- */
2662
- screenCoord2Doc(x: number | THREE.Vector3, y?: number): THREE.Vector3;
2663
- /**
2664
- * 文档转屏幕坐标.
2665
- * @param x 坐标x
2666
- * @param y 坐标y
2667
- * @param z 坐标z
2668
- * @return THREE.Vector3 屏幕坐标
2669
- * @example
2670
- * ``` typescript
2671
- * const vector3 = Mx.MxFun.docCoord2Screen(36, 21, 0)
2672
- * console.log(vector3)
2673
- * ```
2674
- */
2675
- docCoord2Screen(x: number | THREE.Vector3, y?: number): THREE.Vector3;
2676
- /**
2677
- * 获取当前MxCAD对象,该函数在MxCAD模式下使用
2678
- * @return MxDrawObjectType MxCAD对象
2679
- * @example
2680
- * ``` typescript
2681
- * const mxcad = Mx.MxFun.getCurrentMxCAD()
2682
- * console.log(mxcad)
2683
- * ```
2684
- */
2685
- getCurrentMxCAD(): MxCADObject;
2686
- /**
2687
- * 获取当前绘图控件对象
2688
- * @return MxDrawObjectType 当前绘图控件对象
2689
- * @example
2690
- * ``` typescript
2691
- * const mxDraw = Mx.MxFun.getCurrentDraw()
2692
- * mxDraw.getScene()
2693
- * ```
2694
- */
2695
- getCurrentDraw(): MxDrawObject;
2696
- /**
2697
- * 添加一个MxDbEntity实体到当前绘图对象上。
2698
- * @param ent 实体对象
2699
- * @returns number 返回对象的id.
2700
- * @example
2701
- * ```typescript
2702
- *
2703
- *
2704
- * ```
2705
- */
2706
- addToCurrentSpace(ent: MxDbEntity): number;
2707
- /**
2708
- * 初始化插件的UI数据对象。
2709
- * @param uiDataObj
2710
- * @return
2711
- * @example
2712
- * ``` typescript
2713
- * ```
2714
- */
2715
- initUiDataObject(uiDataObj: typeof mxUiData): void;
2716
- /**
2717
- * 获取UI数据对象
2718
- * @param uiDataObj
2719
- * @return mxUiData
2720
- * @example
2721
- * ``` typescript
2722
- * ```
2723
- */
2724
- getUIData(): MxVueInterface;
2725
- /**
2726
- * 获得到当前数据库对象.
2727
- * @return MxDbDatabase
2728
- * @example
2729
- * ``` typescript
2730
- * ```
2731
- */
2732
- getCurrentDatabase(): MxDbDatabase;
2733
- /**
2734
- * 梦想开发测试
2735
- * @param p
2736
- * @return any
2737
- * @example
2738
- * ``` typescript
2739
- * console.log(Mx.MxFun.TestMX());
2740
- * ```
2741
- */
2742
- testMX(p?: any): any;
2743
- /**
2744
- * 加载一个图片对象,返回Three.js材质对象,该函数具有缓存功能,下次加载同样的图片,可以直接返回.
2745
- * @param p
2746
- * @return any
2747
- * @example
2748
- * ``` typescript
2749
- *
2750
- * ```
2751
- */
2752
- loadImageMaterial(imageUrlPath: string, callResult?: ((material: THREE.MeshLambertMaterial) => void | null) | undefined): Promise<THREE.MeshLambertMaterial | null>;
2753
- /**
2754
- * 在图上选择一个对象。
2755
- * @param strPrompt 提示字符串
2756
- * @param filter 过滤条件
2757
- * @returns number 返回对象的id
2758
- * @example
2759
- * ```typescript
2760
- *
2761
- *
2762
- * ```
2763
- */
2764
- selectEnt(strPrompt: string, filter?: any): Promise<number>;
2765
- /**
2766
- * 监听命令行消息动态更新的数据
2767
- * 在取点对象中设置的命令以及我们提供的图形对象中是有一套命令提示和参数化绘图,而该回调函数主要用来监听消息变化
2768
- * @parma callback 回调函数中data中的msCmdTip表示命令提示 msCmdText表示当前用户输入的输入内容 msCmdDisplay表示所有的消息记录
2769
- * */
2770
- listenForCommandLineInput(callback: ((data: {
2771
- msCmdTip: string;
2772
- msCmdDisplay: string;
2773
- msCmdText: string;
2774
- }) => void) | undefined): void;
2775
- /**
2776
- * 设置命令行消息数据 (在监听input输入框的onKeydown事件的回调函数中调用)
2777
- * @param msCmdText 用户输入的数据 input输入框输入的文本信息
2778
- * @param keyCode 按键Code input输入框的onKeydown事件的event事件对象的keyCode属性
2779
- * */
2780
- setCommandLineInputData(msCmdText: string, keyCode: number): void;
2781
- /**
2782
- * 监听指针(鼠标光标)移动变化的坐标信息
2783
- * @parma callback 回调函数中返回坐标信息
2784
- * */
2785
- listenForCoordTip(callback: (coordTip: string) => void): void;
2786
- /**
2787
- * 监听光标更新
2788
- * @parma cursorType当前使用的光标类型
2789
- * */
2790
- listenForUpdateCursor(callback: ((cursorType: string) => void) | undefined): void;
2791
- /**
2792
- * 返回mxfun.min.js中的THREE.JS对象,可以用它来创建mxfun.min.js中THREE对象。
2793
- * */
2794
- getMxFunTHREE: () => any;
2795
- /**
2796
- * 返回mxfun.min.js中的ThreeJsTool对象
2797
- * */
2798
- getMxFunThreeTool(): any;
2799
- /**
2800
- * 创建十字光标图片
2801
- * */
2802
- ceneratecursor(cursorSize?: number, squareSize?: number, isRoss?: boolean, color?: string): HTMLImageElement;
2803
- /**
2804
- * 得到当前鼠标位置,返回的是屏幕坐标 。
2805
- * @example
2806
- * ```typescript
2807
- *
2808
- *
2809
- * ```
2810
- */
2811
- getCurrentMousePostion(): THREE.Vector3;
2812
- /** 监听use或者调用自定义图形定义的绘制命令后创建图形对象的回调 */
2813
- onUseCreateMxDbEntity(callback: (ages_0: MxDbEntity) => any): void;
2814
- } & MxFunType;
2815
-
2816
2805
  /**
2817
2806
  * MxThreeJS 模块
2818
2807
  * ##### 使用说明:
@@ -3817,7 +3806,7 @@ declare class MxDbShape extends MxDbEntity {
3817
3806
  rotation?: number;
3818
3807
  center?: THREE.Vector2;
3819
3808
  } | undefined;
3820
- setFillImageParam(param: MxDbShape["fillImageParam"]): void;
3809
+ setFillImageParam(param: MxDbShape['fillImageParam']): void;
3821
3810
  /** 线段细分数值 */
3822
3811
  curveSegments: number;
3823
3812
  setCurveSegments(curveSegments: number): this;
@@ -3831,8 +3820,10 @@ declare class MxDbShape extends MxDbEntity {
3831
3820
  /** 获取当前滤镜对象 {@link MxFilters} */
3832
3821
  getFilter(): MxFilters | undefined | null;
3833
3822
  setFilter(filter: MxFilters | undefined | null): void;
3823
+ _cornerRadius: number[] | number;
3834
3824
  /** 圆角半径 (一个向量点对应一个角的半径值)*/
3835
- cornerRadius: number[] | number;
3825
+ get cornerRadius(): number | number[];
3826
+ set cornerRadius(radius: number | number[]);
3836
3827
  /**
3837
3828
  * 设置圆角 圆角的半径(如果参数为数组则一个角度对应一个圆角半径)
3838
3829
  * @param { number | number[] } radius 圆角半径 为数组时[3, 2, 1, 4]分别对应左上角圆角半径3 右上角2 右下角1 左下角4; 或者直接设置半径值 则四个角统一半径
@@ -4855,6 +4846,28 @@ declare class Layer extends RenderOrderNode<{}, MxDbEntity> {
4855
4846
  remove(...entityList: MxDbEntity[]): this;
4856
4847
  }
4857
4848
 
4849
+ declare function drawMxDbSplineCurve(): Promise<void>;
4850
+
4851
+ declare class MxDbSplineCurve extends MxDbEntity {
4852
+ static draw: typeof drawMxDbSplineCurve;
4853
+ static cmd: string;
4854
+ /** 圆中心点 */
4855
+ points: THREE.Vector3[];
4856
+ /** 闭合 */
4857
+ closed: boolean;
4858
+ /** 曲线的张力 */
4859
+ tension: number;
4860
+ /** 曲线类型: centripetal、chordal和catmullrom */
4861
+ curveType: string;
4862
+ worldDraw(pWorldDraw: McGiWorldDraw): void;
4863
+ getGripPoints(): THREE.Vector3[];
4864
+ moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
4865
+ create(): MxDbEntity;
4866
+ dwgIn(obj: any): boolean;
4867
+ dwgOut(obj: any): object;
4868
+ getTypeName(): string;
4869
+ }
4870
+
4858
4871
  declare const Mx_loadCoreCode: typeof loadCoreCode;
4859
4872
  declare const Mx_useCanvasResizeListener: typeof useCanvasResizeListener;
4860
4873
  declare const Mx_store: typeof store;
@@ -4954,6 +4967,8 @@ type Mx_MxDbLineShape = MxDbLineShape;
4954
4967
  declare const Mx_MxDbLineShape: typeof MxDbLineShape;
4955
4968
  type Mx_Layer = Layer;
4956
4969
  declare const Mx_Layer: typeof Layer;
4970
+ type Mx_MxDbSplineCurve = MxDbSplineCurve;
4971
+ declare const Mx_MxDbSplineCurve: typeof MxDbSplineCurve;
4957
4972
  type Mx_MxCursorType = MxCursorType;
4958
4973
  declare const Mx_MxCursorType: typeof MxCursorType;
4959
4974
  declare namespace Mx {
@@ -5015,6 +5030,7 @@ declare namespace Mx {
5015
5030
  Mx_MxDbArrow as MxDbArrow,
5016
5031
  Mx_MxDbLineShape as MxDbLineShape,
5017
5032
  Mx_Layer as Layer,
5033
+ Mx_MxDbSplineCurve as MxDbSplineCurve,
5018
5034
  Mx_MxCursorType as MxCursorType,
5019
5035
  };
5020
5036
  }
@@ -5026,4 +5042,4 @@ declare global {
5026
5042
  }
5027
5043
  }
5028
5044
 
5029
- export { Layer, McEdGetPointWorldDrawObject, McGePoint3d, McGePoint3dArray, McGeTool, McGiWorldDraw, McGiWorldDrawType, MrxDbgUiPrBaseReturn, MrxDbgUiPrPoint, MrxDbgUtils, Mx3PointArc, MxCADObject, MxCursorType, MxDb2LineAngularDimension, MxDbAlignedDimension, MxDbAnyLine, MxDbArcShapeDraw, MxDbArea, MxDbArrow, MxDbCircleArc, MxDbCircleShape, MxDbCloudLine, MxDbCoord, MxDbDatabase, MxDbEllipse, MxDbEllipseArc, MxDbEllipseShape, MxDbEntity, MxDbGradientLine, MxDbGroup, MxDbHatch, MxDbImage, MxDbLayerTableRecord, MxDbLeadComment, MxDbLeadTag, MxDbLine, MxDbLineShape, MxDbPolyline, MxDbRect, MxDbRectBoxLeadComment, MxDbRegularPolygon, MxDbRegularPolygonShape, MxDbRingShape, MxDbSVG, MxDbSVGText, MxDbShape, MxDbStarShape, MxDbText, MxDrawObject, MxFilters, MxFun, MxPaintBrush, MxThreeJS, MxType, Mxassembly, Mx as default, loadCoreCode, store, useCanvasResizeListener };
5045
+ export { Layer, McEdGetPointWorldDrawObject, McGePoint3d, McGePoint3dArray, McGeTool, McGiWorldDraw, McGiWorldDrawType, MrxDbgUiPrBaseReturn, MrxDbgUiPrPoint, MrxDbgUtils, Mx3PointArc, MxCADObject, MxCursorType, MxDb2LineAngularDimension, MxDbAlignedDimension, MxDbAnyLine, MxDbArcShapeDraw, MxDbArea, MxDbArrow, MxDbCircleArc, MxDbCircleShape, MxDbCloudLine, MxDbCoord, MxDbDatabase, MxDbEllipse, MxDbEllipseArc, MxDbEllipseShape, MxDbEntity, MxDbGradientLine, MxDbGroup, MxDbHatch, MxDbImage, MxDbLayerTableRecord, MxDbLeadComment, MxDbLeadTag, MxDbLine, MxDbLineShape, MxDbPolyline, MxDbRect, MxDbRectBoxLeadComment, MxDbRegularPolygon, MxDbRegularPolygonShape, MxDbRingShape, MxDbSVG, MxDbSVGText, MxDbShape, MxDbSplineCurve, MxDbStarShape, MxDbText, MxDrawObject, MxFilters, MxFun, MxPaintBrush, MxThreeJS, MxType, Mxassembly, Mx as default, loadCoreCode, store, useCanvasResizeListener };