mxdraw 0.1.3 → 0.1.4
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/lib/MxModule/MxDbImage/MxDbImage.js +2 -5
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +94 -0
- package/dist/lib/MxModule/MxDbLine/index.js +5 -0
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +219 -0
- package/dist/lib/MxModule/MxDbRect/index.js +4 -0
- package/dist/lib/MxModule/MxFilters/MxFilters.js +201 -0
- package/dist/lib/MxModule/MxFilters/index.js +4 -0
- package/dist/lib/MxModule/MxFun/MxFun.js +5 -2
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -1
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +2 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +20 -14
- package/dist/lib/doc.js +9 -1
- package/dist/lib/mxdraw.js +13 -9
- package/dist/lib/tools/three/index.js +100 -3
- package/dist/mxdraw.es5.js +3 -3
- package/dist/mxdraw.es5.js.map +1 -1
- package/dist/mxdraw.umd.js +3 -3
- package/dist/mxdraw.umd.js.map +1 -1
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +1 -1
- package/dist/types/MxModule/MxDbLine/MxDbLine.d.ts +22 -0
- package/dist/types/MxModule/MxDbLine/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbRect/MxDbRect.d.ts +74 -0
- package/dist/types/MxModule/MxDbRect/index.d.ts +2 -0
- package/dist/types/MxModule/MxFilters/MxFilters.d.ts +94 -0
- package/dist/types/MxModule/MxFilters/index.d.ts +2 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +2 -1
- package/dist/types/doc.d.ts +5 -1
- package/dist/types/mxdraw.d.ts +9 -7
- package/dist/types/tools/three/index.d.ts +20 -1
- package/dist/types/types/MxFun.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6489,45 +6489,51 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6489
6489
|
}, { "./MxDrawData": 40, "./MxJigCmdManager": 48, "./MxThreeJS": 58, three: 19 }], 45: [function (t, e, n) {
|
|
6490
6490
|
"use strict";
|
|
6491
6491
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxFun = void 0;
|
|
6492
|
-
var
|
|
6492
|
+
var p, i, r, a, o, s, l, c, u, h, f, d, m, g, v = t("three"), y = t("./MxManager"), x = t("./MxDrawObject2d"), w = t("./MxDrawObject3d"), b = t("./MxUiObjectMobile"), _ = t("./MxUiObjectPC"), M = t("./MxJigCmdManager"), S = t("./MxJigGetLine"), C = t("./MxCmdRunManager"), T = t("./MxUiVue"), E = t("./MxThreeJS"), A = t("./MxWindowsEvent"), D = t("./MxTools"), O = t("./MxDrawCommands"), L = t("./MxDrawData"), I = t("./MxCADEditDisplay"), P = t("./MxLocalFileLoad"), R = t("./TempTest/MxTestJig");
|
|
6493
6493
|
function k(t) { t.cmd && z(t.cmd); }
|
|
6494
6494
|
function N(t) { var e = new RegExp("(^|&)" + t + "=([^&]*)(&|$)"), n = window.location.search.substr(1).match(e); return null != n ? decodeURIComponent(n[2]) : ""; }
|
|
6495
6495
|
function B() { return y.MxManager.currentMx(); }
|
|
6496
6496
|
function F() { return y.MxManager.currentMx(); }
|
|
6497
6497
|
function z(t, e) { var n = F(); if (n)
|
|
6498
6498
|
return C.MxCmdRunManager.runCmd(n, t, e); }
|
|
6499
|
-
function j(t) { null != t && (t.init(), T.MxUiVue.init(t)),
|
|
6500
|
-
|
|
6499
|
+
function j(t) { null != t && (t.init(), T.MxUiVue.init(t)), f || (f = !0, g = new P.MxLocalNodeJs, M.MxJigCmdManager.init(), A.MxWindowsEvent.registEvent(), y.MxManager.init(), O.MxDrawCommands.registerCommand(), window.mxConfig_isLoadTest && R.MxTest.registerCommand(), m.sendStringToExecute = k); }
|
|
6500
|
+
p = n.MxFun || (n.MxFun = {}), i = ".", l = o = a = -1, h = null, f = !(u = "ws://localhost:5090"), m = {}, g = d = c = s = r = void 0, p.getUiObj = function () { return h; }, p.getNodeJs = function () { return g; }, p.setMxServer = function (t) { u = t; }, p.getMxServer = function () { return u; }, p.isPC = function () { return !/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent); }, p.getClientPlatform = function () { return navigator.platform; }, p.getClientInfo = function () { return { width: document.body.clientWidth, height: document.body.clientHeight }; }, p.curPath = function () { return i; }, p.setCurPath = function (t) { i = t; }, p.getQueryString = N, p.getLocationPageUrl = function () { var t = window.location.href, e = t.lastIndexOf("?"); return -1 == e ? t : t.substring(0, e); }, p.getUrlParams = function () { var t = window.location.search, e = t.substr(1, t.length).split("&"), n = new Array; if (null != e)
|
|
6501
6501
|
for (var i = 0; i < e.length; i++) {
|
|
6502
6502
|
var r = e[i].replace(/[=|^==]/, "&").split("&");
|
|
6503
6503
|
if (1 < r.length) {
|
|
6504
6504
|
var a = new Array;
|
|
6505
6505
|
a.push(decodeURIComponent(r[0])), a.push(decodeURIComponent(r[1])), n.push(a);
|
|
6506
6506
|
}
|
|
6507
|
-
} return n; },
|
|
6508
|
-
return 1 == a; var t = N("select"); return a = 0, null != t && "y" == t.toLowerCase() && (a = 1), 1 == a; },
|
|
6509
|
-
return 1 ==
|
|
6510
|
-
return 1 == o; var t = N("static"); return o = 0, null != t && "y" == t.toLowerCase() && (o = 1), 1 == o; },
|
|
6507
|
+
} return n; }, p.call = function (t, e, n) { null == e ? e = "{}" : "string" == typeof e ? 0 == e.length ? e = "{}" : "[" == e[0] && "]" == e[e.length - 1] || "{" == e[0] && "}" == e[e.length - 1] || (e = '"' + (e = e.replace(/"/g, "'")) + '"') : e = "object" == typeof e ? JSON.stringify(e) : "{}", y.MxManager.currentMx().call(t, e, n); }, p.loadCodeToServer = function (t, e) { y.MxManager.currentMx().loadCodeToServer(t, e); }, p.getCurrentMx = B, p.getCurrentMxCAD = function () { var t = B(); return t ? t.getMxCAD() : null; }, p.openFile = function (t) { return y.MxManager.currentMx().openFile(t); }, p.loadCodeFileToServer = function (t, e, n) { y.MxManager.currentMx().loadCodeFileToServer(t, e, n); }, p.isEnableSelect = function () { if (-1 != a)
|
|
6508
|
+
return 1 == a; var t = N("select"); return a = 0, null != t && "y" == t.toLowerCase() && (a = 1), 1 == a; }, p.is3DDwg = function () { if (-1 != l)
|
|
6509
|
+
return 1 == l; var t = N("3ddwg"); return l = 0, null != t && "y" == t.toLowerCase() && (l = 1), 1 == l; }, p.isStaticLoad = function () { if (-1 != o)
|
|
6510
|
+
return 1 == o; var t = N("static"); return o = 0, null != t && "y" == t.toLowerCase() && (o = 1), 1 == o; }, p.enableSelect = function (t) { a = t ? 1 : 0; }, p.enablStaticLoad = function (t) { o = null == t || t ? 1 : 0; }, p.dwgDir = function () { return null != s || null == (s = N("dwgdir")) && (s = ""), s; }, p.setDwgDir = function (t) { s = t; }, p.getStaticServer = function () { return null != c || null == (c = N("staticServer")) && (c = ""), c; }, p.setStaticServer = function (t) { c = t; }, p.is2dParam = function () { if (null != r)
|
|
6511
6511
|
return r; var t = N("file"); if (r = !1, null != t) {
|
|
6512
6512
|
var e = t.substring(t.lastIndexOf(".") + 1);
|
|
6513
6513
|
"dwg" != e.toLowerCase() && "dxf" != e.toLowerCase() && "dwf" != e.toLowerCase() && "mwg" != e.toLowerCase() || (r = !0);
|
|
6514
|
-
} return r; },
|
|
6515
|
-
return y.MxManager.currentMx().showLayer(t, e, n); "number" == typeof t && I.MxCADDisplayFun.showLayer(i.getDatabase(), t, e); },
|
|
6514
|
+
} return r; }, p.set2dParam = function (t) { r = t; }, p.showLayer = function (t, e, n) { var i = y.MxManager.currentMx().getMxCAD(); if (!i)
|
|
6515
|
+
return y.MxManager.currentMx().showLayer(t, e, n); "number" == typeof t && I.MxCADDisplayFun.showLayer(i.getDatabase(), t, e); }, p.upDisplayForLayerData = function (t) { var e = y.MxManager.currentMx().getMxCAD(); return !!e && e.getDatabase().getLayerTable().upDisplayForLayerData(e.getDatabase(), t); }, p.screenCoord2World = function (t, e, n) { return t instanceof Object ? y.MxManager.currentMx().screenCoord2World(t.x, t.y, t.z) : y.MxManager.currentMx().screenCoord2World(t, e, n); }, p.worldCoord2Screen = function (t, e, n) { return t instanceof Object ? y.MxManager.currentMx().worldCoord2Screen(t.x, t.y, t.z) : y.MxManager.currentMx().worldCoord2Screen(t, e, n); }, p.docCoord2World = function (t, e, n) { return t instanceof Object ? y.MxManager.currentMx().docCoord2World(t.x, t.y, t.z) : y.MxManager.currentMx().docCoord2World(t, e, n); }, p.worldCoord2Doc = function (t, e, n) { return t instanceof Object ? y.MxManager.currentMx().worldCoord2Doc(t.x, t.y, t.z) : y.MxManager.currentMx().worldCoord2Doc(t, e, n); }, p.screenCoord2Doc = function (t, e, n) { return t instanceof Object ? y.MxManager.currentMx().screenCoord2Doc(t.x, t.y, t.z) : y.MxManager.currentMx().screenCoord2Doc(t, e, n); }, p.docCoord2Screen = function (t, e, n) { return t instanceof Object ? y.MxManager.currentMx().docCoord2Screen(t.x, t.y, t.z) : y.MxManager.currentMx().docCoord2Screen(t, e, n); }, p.zoomCenter = function (t, e) { y.MxManager.currentMx().is2D() && (y.MxManager.currentMx().zoomCenter(t, e), y.MxManager.currentMx().updateDisplay()); }, p.zoomW = function (t, e, n, i, r) { y.MxManager.currentMx().is2D() && (y.MxManager.currentMx().zoomW(new v.Vector3(t, e, 0), new v.Vector3(n, i, 0), r), y.MxManager.currentMx().updateDisplay()); }, p.zoomScale = function (t) { y.MxManager.currentMx().is2D() && (y.MxManager.currentMx().zoomScale(t), y.MxManager.currentMx().updateDisplay()); }, p.zoomAll = function () { y.MxManager.currentMx().is2D() && (y.MxManager.currentMx().zoomAll(), y.MxManager.currentMx().updateDisplay()); }, p.deleteAll = function () { return y.MxManager.currentMx().deleteAll(); }, p.callCommand = function (t, e, n) { y.MxManager.currentMx().callCommand(t, e, n); }, p.getCurrentColor = function () { return y.MxManager.currentMx().getCurrentColor(); }, p.setCurrentColor = function (t) { y.MxManager.currentMx().setCurrentColor(t); }, p.undo = function () { y.MxManager.currentMx().undo(); }, p.save = function () { y.MxManager.currentMx().save(); }, p.showLoading = function () { null != h && h.ShowLoading(); }, p.hideLoading = function () { null != h && h.HideLoading(); }, p.showProp = function (t) { null != h && h.ShowObjectProperty(t); }, p.hideProp = function () { null != h && h.HideObjectProp(); }, p.getUiObject = function () { return h; }, p.getViewCenterDocCoord = function () { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().getViewCenterDocCoord() : new v.Vector3(0, 0, 0); }, p.screenCoordLong2Doc = function (t) { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().screenCoordLong2Doc(t) : t; }, p.docCoordLong2Screen = function (t) { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().docCoordLong2Screen(t) : t; }, p.worldCoordLong2Doc = function (t) { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().worldCoordLong2Doc(t) : t; }, p.docCoordLong2World = function (t) { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().docCoordLong2World(t) : t; }, p.screenCoordLong2World = function (t) { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().screenCoordLong2World(t) : t; }, p.worldCoordLong2Screen = function (t) { return y.MxManager.currentMx().is2D() ? y.MxManager.currentMx().worldCoordLong2Screen(t) : t; }, p.addSelectEvent = function (t) { y.MxManager.addSelectEvent(t); }, p.clearSelectEvent = function () { y.MxManager.clearSelectEvent(); }, p.removeThreejsObject = function (t, e, n) { t && (t.traverse(function (t) { (t instanceof v.Mesh || t instanceof v.Line || t instanceof v.LineLoop) && (t.geometry.dispose(), n && (t.material instanceof Array ? t.material.forEach(function (t) { t.dispose(); }) : t.material.dispose())); }), e.remove(t)); }, p.setOutServerDebugCall = function (t) { y.MxManager.setOutDebugCall(t); }, p.updateDisplay = function () { y.MxManager.updateDisplay(); }, p.getCurrentDraw = F, p.formatString = function (t) { for (var e = [], n = 1; n < arguments.length; n++)
|
|
6516
6516
|
e[n - 1] = arguments[n]; for (var i = 0; i < e.length; i++)
|
|
6517
|
-
t = t.replace("{".concat(i, "}"), e[i]); return t; },
|
|
6517
|
+
t = t.replace("{".concat(i, "}"), e[i]); return t; }, p.createMxUiObject = function (t) { var e; return e = this.isPC() ? new _.MxUiObjectPC : new b.MxUiObjectMobile, t(h = e), e.create(), e; }, p.createMxObject = function (t, e, n, i, r, a) { f || j(), "string" == typeof t && (t = 0 == t.length ? void 0 : document.getElementById(t)), null == e && (e = p.getQueryString("file")); var o = null != i && i; if (null != e) {
|
|
6518
6518
|
0 == e.length && (e = "empty");
|
|
6519
|
-
var
|
|
6520
|
-
"dwg" !=
|
|
6519
|
+
var s = e.substring(e.lastIndexOf(".") + 1).toLowerCase();
|
|
6520
|
+
if ("dwg" != s && "dxf" != s && "dwf" != s && "mwg" != s && "wgh" != s || (o = !0), 1 != a && null != a && "wgh" != s) {
|
|
6521
|
+
var l = void 0, c = e.split("/");
|
|
6522
|
+
"$" == (l = 1 == c.length ? c[0] : c[c.length - 1])[0] && (l = l.substring(1));
|
|
6523
|
+
for (var u = void 0, h = 0; h < c.length - 1; h++)
|
|
6524
|
+
u = 0 == h ? c[h] : u + "/" + c[h];
|
|
6525
|
+
e = u + "/$" + l + ".mxb1.wgh";
|
|
6526
|
+
}
|
|
6521
6527
|
}
|
|
6522
6528
|
else
|
|
6523
|
-
e = "empty"; 1 == r && (e = ""); var
|
|
6529
|
+
e = "empty"; 1 == r && (e = ""); var d = null; return o ? (d = new x.MxDrawObject2d).setViewColor(0) : (d = new w.MxDrawObject3d).setViewColor(15790320), null != n && n(d), d.create(t, e), d; }, p.getMxObjectFormElement = function (t) { return y.MxManager.getMxObject(t); }, p.isRunningCommand = function () { return M.MxJigCmdManager.isRunning(); }, p.stopRunCommand = function () { return M.MxJigCmdManager.stopCmd(); }, p.runCommand = function (t) { return M.MxJigCmdManager.runCmd(t); }, p.getTHREE = function () { return v; }, p.getLine = function (t) { var e = new S.MxJigGetLine; e.setRetCall(t), M.MxJigCmdManager.runCmd(e); }, p.addCommand = function (t, e, n) { C.MxCmdRunManager.addCommand(t, e, n); }, p.sendStringToExecute = z, p.initUiDataObject = function (t) { t.init(p), T.MxUiVue.init(t); }, p.init = j, p.addWindowsEvent = function (t) { A.MxWindowsEvent.addEvent(t); }, p.getCurrentMousePostion = function () { return A.MxWindowsEvent.getCurrentMousePostion(); }, p.getMxThreeJS = function () { return E.MxThreeJS; }, p.getMxTools = function () { return D.MxTools; }, p.getMxCmdRunManager = function () { return C.MxCmdRunManager; }, p.getMxJigCmdManager = function () { return M.MxJigCmdManager; }, p.initQuickCommand = function (t) { C.MxCmdRunManager.InitQuickCommand(t); }, p.Assert = function (t) { t || console.log("MxAssert error"); }, p.setIniset = function (t) { L.MxDrawData.setIniset(t); }, p.setPostMessageToParentFrameFunction = function (t) { d = t; }, p.postMessageToParentFrame = function (t) { return null != d && (d(t), !0); }, p.onParentFrameMessage = function (t) { null != t && null != t.type && m[t.type] && m[t.type](t); }, p.acutPrintf = function (t) { for (var e = [], n = 1; n < arguments.length; n++)
|
|
6524
6530
|
e[n - 1] = arguments[n]; if (!T.MxUiVue.isNull()) {
|
|
6525
6531
|
for (var i = arguments, r = i[0], a = 0; a < i.length - 1; a++) {
|
|
6526
6532
|
var o = new RegExp("\\{" + a + "\\}", "gm");
|
|
6527
6533
|
r = r.replace(o, i[a + 1]);
|
|
6528
6534
|
}
|
|
6529
6535
|
T.MxUiVue.AcutPrintfNoFormat(r, !0);
|
|
6530
|
-
} },
|
|
6536
|
+
} }, p.loadImageMaterial = function (t, e) { y.MxManager.getMxDbTextureManager().loadImage(t, e); }, p.pointInPolyline = function (t, e) { return D.MxTools.pointInPolyline(t, e); }, p.calcArea = function (t) { return D.MxTools.calcArea(t); }, p.initMxDbEntityType = function (t) { y.MxManager.getMxDbEntityClassHierarchy().init(t); };
|
|
6531
6537
|
}, { "./MxCADEditDisplay": 26, "./MxCmdRunManager": 33, "./MxDrawCommands": 39, "./MxDrawData": 40, "./MxDrawObject2d": 42, "./MxDrawObject3d": 43, "./MxJigCmdManager": 48, "./MxJigGetLine": 49, "./MxLocalFileLoad": 50, "./MxManager": 51, "./MxThreeJS": 58, "./MxTools": 59, "./MxUiObjectMobile": 62, "./MxUiObjectPC": 63, "./MxUiVue": 64, "./MxWindowsEvent": 65, "./TempTest/MxTestJig": 67, three: 19 }], 46: [function (t, e, n) {
|
|
6532
6538
|
"use strict";
|
|
6533
6539
|
var i, r = this && this.__extends || (i = function (t, e) { return (i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (t, e) { t.__proto__ = e; } || function (t, e) { for (var n in e)
|
package/dist/lib/doc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MxDbEntity = exports.McGiWorldDrawType = exports.useCanvasResizeListener = exports.loadCoreCode = exports.MrxDbgUiPrBaseReturn = exports.McEdGetPointWorldDrawObject = exports.MrxDbgUiPrPoint = exports.MxDrawObject = exports.MxThreeJS = exports.MxFun = void 0;
|
|
3
|
+
exports.MxDbRect = exports.MxDbLine = exports.MxDbSVG = exports.MxDbImage = exports.MxDbEntity = exports.McGiWorldDrawType = exports.useCanvasResizeListener = exports.loadCoreCode = exports.MrxDbgUiPrBaseReturn = exports.McEdGetPointWorldDrawObject = exports.MrxDbgUiPrPoint = exports.MxDrawObject = exports.MxThreeJS = exports.MxFun = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Mx 模块集
|
|
6
6
|
*
|
|
@@ -26,3 +26,11 @@ var McGiWorldDrawType_1 = require("./MxModule/McGiWorldDrawType/McGiWorldDrawTyp
|
|
|
26
26
|
exports.McGiWorldDrawType = McGiWorldDrawType_1.default;
|
|
27
27
|
var MxDbEntity_1 = require("./MxModule/MxDbEntity/MxDbEntity");
|
|
28
28
|
exports.MxDbEntity = MxDbEntity_1.default;
|
|
29
|
+
var MxDbImage_1 = require("./MxModule/MxDbImage/MxDbImage");
|
|
30
|
+
exports.MxDbImage = MxDbImage_1.default;
|
|
31
|
+
var MxDbSVG_1 = require("./MxModule/MxDbSVG/MxDbSVG");
|
|
32
|
+
exports.MxDbSVG = MxDbSVG_1.default;
|
|
33
|
+
var MxDbLine_1 = require("./MxModule/MxDbLine/MxDbLine");
|
|
34
|
+
exports.MxDbLine = MxDbLine_1.default;
|
|
35
|
+
var MxDbRect_1 = require("./MxModule/MxDbRect/MxDbRect");
|
|
36
|
+
exports.MxDbRect = MxDbRect_1.default;
|
package/dist/lib/mxdraw.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MxType = exports.MrxDbgUiPrBaseReturn = exports.McGiWorldDrawType = exports.store = exports.loadCoreCode = exports.useCanvasResizeListener = exports.MxDbAlignedDimension = exports.MxDbSVG = exports.MxDbImage = exports.MxDbEntity = exports.MrxDbgUiPrPoint = exports.McEdGetPointWorldDrawObject = exports.MxThreeJS = exports.Mxassembly = exports.MxFun = void 0;
|
|
3
|
+
exports.MxType = exports.MrxDbgUiPrBaseReturn = exports.McGiWorldDrawType = exports.store = exports.loadCoreCode = exports.useCanvasResizeListener = exports.MxDbAlignedDimension = exports.MxDbRect = exports.MxDbSVG = exports.MxDbLine = exports.MxDbImage = exports.MxDbEntity = exports.MrxDbgUiPrPoint = exports.McEdGetPointWorldDrawObject = exports.MxThreeJS = exports.Mxassembly = exports.MxFun = void 0;
|
|
4
4
|
//src/index.ts
|
|
5
5
|
var loadCoreCode_1 = require("./MxModule/loadCoreCode");
|
|
6
6
|
exports.loadCoreCode = loadCoreCode_1.default;
|
|
7
7
|
var store_1 = require("./MxModule/store");
|
|
8
8
|
exports.store = store_1.default;
|
|
9
|
-
var MxFun_1 = require("./MxModule/MxFun
|
|
9
|
+
var MxFun_1 = require("./MxModule/MxFun");
|
|
10
|
+
exports.MxFun = MxFun_1.default;
|
|
10
11
|
var MxThreeJS_1 = require("./MxModule/MxThreeJS");
|
|
11
12
|
exports.MxThreeJS = MxThreeJS_1.default;
|
|
12
13
|
var MrxDbgUiPrPoint_1 = require("./MxModule/MrxDbgUiPrPoint");
|
|
@@ -23,27 +24,30 @@ var MxDbImage_1 = require("./MxModule/MxDbImage");
|
|
|
23
24
|
exports.MxDbImage = MxDbImage_1.default;
|
|
24
25
|
var MxDbSVG_1 = require("./MxModule/MxDbSVG");
|
|
25
26
|
exports.MxDbSVG = MxDbSVG_1.default;
|
|
27
|
+
var MxDbLine_1 = require("./MxModule/MxDbLine");
|
|
28
|
+
exports.MxDbLine = MxDbLine_1.default;
|
|
29
|
+
var MxDbRect_1 = require("./MxModule/MxDbRect");
|
|
30
|
+
exports.MxDbRect = MxDbRect_1.default;
|
|
26
31
|
var MxDbAlignedDimension_1 = require("./MxModule/MxDbAlignedDimension");
|
|
27
32
|
exports.MxDbAlignedDimension = MxDbAlignedDimension_1.default;
|
|
28
33
|
var McGiWorldDrawType_1 = require("./MxModule/McGiWorldDrawType");
|
|
29
34
|
exports.McGiWorldDrawType = McGiWorldDrawType_1.default;
|
|
30
35
|
var MxType_1 = require("./MxModule/MxType");
|
|
31
36
|
exports.MxType = MxType_1.default;
|
|
32
|
-
var Mxassembly_1 = require("./MxModule/Mxassembly
|
|
33
|
-
|
|
34
|
-
exports.MxFun = MxFun;
|
|
35
|
-
var Mxassembly = new Mxassembly_1.default();
|
|
36
|
-
exports.Mxassembly = Mxassembly;
|
|
37
|
+
var Mxassembly_1 = require("./MxModule/Mxassembly");
|
|
38
|
+
exports.Mxassembly = Mxassembly_1.default;
|
|
37
39
|
// 默认导出
|
|
38
40
|
exports.default = {
|
|
39
|
-
MxFun:
|
|
40
|
-
Mxassembly:
|
|
41
|
+
MxFun: MxFun_1.default,
|
|
42
|
+
Mxassembly: Mxassembly_1.default,
|
|
41
43
|
MxThreeJS: MxThreeJS_1.default,
|
|
42
44
|
McEdGetPointWorldDrawObject: McEdGetPointWorldDrawObject_1.default,
|
|
43
45
|
MrxDbgUiPrPoint: MrxDbgUiPrPoint_1.default,
|
|
44
46
|
MxDbEntity: MxDbEntity_1.default,
|
|
45
47
|
MxDbImage: MxDbImage_1.default,
|
|
48
|
+
MxDbLine: MxDbLine_1.default,
|
|
46
49
|
MxDbSVG: MxDbSVG_1.default,
|
|
50
|
+
MxDbRect: MxDbRect_1.default,
|
|
47
51
|
MxDbAlignedDimension: MxDbAlignedDimension_1.default,
|
|
48
52
|
useCanvasResizeListener: useCanvasResizeListener_1.default,
|
|
49
53
|
loadCoreCode: loadCoreCode_1.default,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.computeRectPoints = exports.getToGenerateRoundedCorners = exports.repairGeometryFaceVertexUvs = exports.setGeometrPostion = void 0;
|
|
4
|
+
var three_1 = require("three");
|
|
4
5
|
/**
|
|
5
6
|
* 移动geometry坐标。
|
|
6
7
|
* @param geometry Three的Geometry对象
|
|
@@ -11,11 +12,107 @@ exports.setGeometryPostion = void 0;
|
|
|
11
12
|
* ```
|
|
12
13
|
*
|
|
13
14
|
*/
|
|
14
|
-
function
|
|
15
|
+
function setGeometrPostion(geometry, pos) {
|
|
15
16
|
for (var i = 0; i < geometry.vertices.length; i++) {
|
|
16
17
|
geometry.vertices[i].x += pos.x;
|
|
17
18
|
geometry.vertices[i].y += pos.y;
|
|
18
19
|
geometry.vertices[i].z += pos.z;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
exports.
|
|
22
|
+
exports.setGeometrPostion = setGeometrPostion;
|
|
23
|
+
/**
|
|
24
|
+
* 生成圆角时修复纹理对应的 uvs
|
|
25
|
+
* @param geometry 几何体
|
|
26
|
+
* */
|
|
27
|
+
function repairGeometryFaceVertexUvs(geometry) {
|
|
28
|
+
geometry.computeBoundingBox();
|
|
29
|
+
var min = geometry.boundingBox.min;
|
|
30
|
+
var max = geometry.boundingBox.max;
|
|
31
|
+
var offset = new three_1.Vector2(0 - min.x, 0 - min.y);
|
|
32
|
+
var size = new three_1.Vector2(max.x - min.x, max.y - min.y);
|
|
33
|
+
geometry.faceVertexUvs[0] = [];
|
|
34
|
+
var faces = geometry.faces;
|
|
35
|
+
for (var i = 0; i < faces.length; i++) {
|
|
36
|
+
var face = faces[i];
|
|
37
|
+
var v1 = geometry.vertices[face.a];
|
|
38
|
+
var v2 = geometry.vertices[face.b];
|
|
39
|
+
var v3 = geometry.vertices[face.c];
|
|
40
|
+
geometry.faceVertexUvs[0].push([
|
|
41
|
+
new three_1.Vector2((v1.x + offset.x) / size.x, (v1.y + offset.y) / size.y),
|
|
42
|
+
new three_1.Vector2((v2.x + offset.x) / size.x, (v2.y + offset.y) / size.y),
|
|
43
|
+
new three_1.Vector2((v3.x + offset.x) / size.x, (v3.y + offset.y) / size.y)
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
geometry.uvsNeedUpdate = true;
|
|
47
|
+
return geometry;
|
|
48
|
+
}
|
|
49
|
+
exports.repairGeometryFaceVertexUvs = repairGeometryFaceVertexUvs;
|
|
50
|
+
/**
|
|
51
|
+
* 获取生成圆角的points定点位置
|
|
52
|
+
* @param points 生成圆角前
|
|
53
|
+
* @param cornerRadius 圆角值
|
|
54
|
+
* @param isClose 生成圆角的图形是否是闭合的
|
|
55
|
+
* */
|
|
56
|
+
function getToGenerateRoundedCorners(points, cornerRadius, isClose) {
|
|
57
|
+
if (isClose === void 0) { isClose = true; }
|
|
58
|
+
if (cornerRadius.length > 0) {
|
|
59
|
+
var curve = new three_1.CurvePath();
|
|
60
|
+
for (var i = 0; i < points.length - 1; i++) {
|
|
61
|
+
//作为拐弯的弧度
|
|
62
|
+
var R = cornerRadius[i] || 0;
|
|
63
|
+
if (i === 0 && !isClose) {
|
|
64
|
+
var dir = points[0].clone().sub(points[1]);
|
|
65
|
+
dir.normalize();
|
|
66
|
+
var p2_1 = points[1].clone();
|
|
67
|
+
p2_1.add(dir.clone().multiplyScalar(R));
|
|
68
|
+
var line_1 = new three_1.LineCurve3(points[0], p2_1);
|
|
69
|
+
curve.curves.push(line_1);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
// 计算三个点构成的两条线的方向
|
|
73
|
+
var dir1 = !isClose && points[i - 1]
|
|
74
|
+
? points[i - 1].clone().sub(points[i])
|
|
75
|
+
: points[points.length - 1].clone().sub(points[0]);
|
|
76
|
+
dir1.normalize();
|
|
77
|
+
var dir2 = !isClose && points[i + 1]
|
|
78
|
+
? points[i + 1].clone().sub(points[i])
|
|
79
|
+
: points[1].clone().sub(points[0]);
|
|
80
|
+
dir2.normalize();
|
|
81
|
+
var p12_ = points[i].clone();
|
|
82
|
+
p12_.add(dir1.clone().multiplyScalar(R));
|
|
83
|
+
var p1 = points[i].clone().add(dir1.clone().multiplyScalar(R));
|
|
84
|
+
var p2 = points[i].clone();
|
|
85
|
+
var p3 = points[i].clone().add(dir2.clone().multiplyScalar(R));
|
|
86
|
+
var beziercurve = new three_1.QuadraticBezierCurve3(p1, p2, p3);
|
|
87
|
+
var line1 = points[i].clone();
|
|
88
|
+
line1.add(dir2.clone().multiplyScalar(R));
|
|
89
|
+
var line2 = points[i + 1].clone();
|
|
90
|
+
if (i < points.length - (isClose ? 1 : 2)) {
|
|
91
|
+
//最后一段不用减掉半径尺寸
|
|
92
|
+
line2.add(dir2.clone().multiplyScalar(-R));
|
|
93
|
+
}
|
|
94
|
+
var line = new three_1.LineCurve3(line1, line2);
|
|
95
|
+
// 把转换曲线和直线插入曲线中
|
|
96
|
+
curve.curves.push(beziercurve, line);
|
|
97
|
+
if (i === 0) {
|
|
98
|
+
points.push(points[0]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return curve.getPoints(5);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.getToGenerateRoundedCorners = getToGenerateRoundedCorners;
|
|
108
|
+
/**
|
|
109
|
+
* 计算矩形点位
|
|
110
|
+
* @param pt1 点1
|
|
111
|
+
* @param pt3 点3
|
|
112
|
+
* */
|
|
113
|
+
function computeRectPoints(pt1, pt3) {
|
|
114
|
+
var pt2 = pt1.clone().set(pt3.x, pt1.y, pt3.z);
|
|
115
|
+
var pt4 = pt3.clone().set(pt1.x, pt3.y, pt1.z);
|
|
116
|
+
return [pt1, pt2, pt3, pt4];
|
|
117
|
+
}
|
|
118
|
+
exports.computeRectPoints = computeRectPoints;
|