mxdraw 0.1.1 → 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/README.md +19 -15
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +0 -1
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +0 -1
- package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +2 -0
- package/dist/lib/MxModule/McGeVector3d/index.js +3 -0
- package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +0 -1
- package/dist/lib/MxModule/McGiWorldDraw/index.js +0 -1
- package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +0 -1
- package/dist/lib/MxModule/McGiWorldDrawType/index.js +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +0 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +213 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +5 -0
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +85 -7
- package/dist/lib/MxModule/MxDbEntity/index.js +0 -1
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +147 -0
- package/dist/lib/MxModule/MxDbImage/index.js +5 -0
- 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/MxDbSVG/MxDbSVG.js +208 -0
- package/dist/lib/MxModule/MxDbSVG/index.js +5 -0
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +100 -13
- package/dist/lib/MxModule/MxDrawObject/index.js +0 -1
- 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 +98 -15
- package/dist/lib/MxModule/MxFun/index.js +0 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +10 -35
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +71 -29
- package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +0 -1
- package/dist/lib/MxModule/MxThreeJS/index.js +0 -1
- package/dist/lib/MxModule/MxType/MxType.js +27 -0
- package/dist/lib/MxModule/MxType/index.js +4 -0
- package/dist/lib/MxModule/Mxassembly/Mxassembly.js +18 -0
- package/dist/lib/MxModule/Mxassembly/index.js +9 -0
- package/dist/lib/MxModule/loadCoreCode/index.js +0 -1
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +16 -1
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1519 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +755 -693
- package/dist/lib/MxModule/store/PubsubClass.js +0 -1
- package/dist/lib/MxModule/store/StoreClass.js +0 -1
- package/dist/lib/MxModule/store/index.js +0 -1
- package/dist/lib/MxModule/store/store.js +1 -1
- package/dist/lib/MxModule/useCanvasResizeListener/index.js +0 -1
- package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +0 -1
- package/dist/lib/doc.js +9 -2
- package/dist/lib/mxdraw.js +25 -7
- package/dist/lib/tools/algorithm/math.js +0 -1
- package/dist/lib/tools/algorithm/random.js +0 -1
- package/dist/lib/tools/dom/create.js +0 -1
- package/dist/lib/tools/dynamicImport/index.js +0 -1
- package/dist/lib/tools/formatting/index.js +0 -1
- package/dist/lib/tools/proxy/index.js +0 -1
- package/dist/lib/tools/three/index.js +100 -4
- package/dist/lib/types/McEdGetPointWorldDrawObject.js +0 -1
- package/dist/lib/types/MrxDbgUiPrPoint.js +0 -1
- package/dist/lib/types/MxCADObject.js +0 -1
- package/dist/lib/types/MxDrawObject.js +0 -1
- package/dist/lib/types/MxFun.js +0 -1
- package/dist/lib/types/Mxassembly.js +2 -0
- 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/McGeVector3d/McGeVector3d.d.ts +17 -0
- package/dist/types/MxModule/McGeVector3d/index.d.ts +3 -0
- package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +77 -10
- package/dist/types/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.d.ts +21 -0
- package/dist/types/MxModule/MxDbAlignedDimension/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +64 -4
- package/dist/types/MxModule/MxDbImage/MxDbImage.d.ts +28 -0
- package/dist/types/MxModule/MxDbImage/index.d.ts +3 -0
- 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/MxDbSVG/MxDbSVG.d.ts +42 -0
- package/dist/types/MxModule/MxDbSVG/index.d.ts +3 -0
- package/dist/types/MxModule/MxDrawObject/MxDrawObject.d.ts +82 -6
- 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 +82 -12
- package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +4 -7
- package/dist/types/MxModule/MxType/MxType.d.ts +24 -0
- package/dist/types/MxModule/MxType/index.d.ts +2 -0
- package/dist/types/MxModule/Mxassembly/Mxassembly.d.ts +11 -0
- package/dist/types/MxModule/Mxassembly/index.d.ts +3 -0
- package/dist/types/MxModule/loadCoreCode/mxcadassembly_es5.d.ts +1 -0
- package/dist/types/MxModule/store/store.d.ts +2 -0
- package/dist/types/doc.d.ts +5 -1
- package/dist/types/mxdraw.d.ts +17 -4
- package/dist/types/tools/three/index.d.ts +20 -1
- package/dist/types/types/MxDrawObject.d.ts +13 -6
- package/dist/types/types/MxFun.d.ts +15 -8
- package/dist/types/types/Mxassembly.d.ts +3 -0
- package/package.json +1 -1
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js.map +0 -1
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js.map +0 -1
- package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js.map +0 -1
- package/dist/lib/MxModule/McGiWorldDraw/index.js.map +0 -1
- package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js.map +0 -1
- package/dist/lib/MxModule/McGiWorldDrawType/index.js.map +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js.map +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js.map +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js.map +0 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js.map +0 -1
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js.map +0 -1
- package/dist/lib/MxModule/MxDbEntity/index.js.map +0 -1
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js.map +0 -1
- package/dist/lib/MxModule/MxDrawObject/index.js.map +0 -1
- package/dist/lib/MxModule/MxFun/MxFun.js.map +0 -1
- package/dist/lib/MxModule/MxFun/index.js.map +0 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js.map +0 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js.map +0 -1
- package/dist/lib/MxModule/MxThreeJS/SVGLoader.js.map +0 -1
- package/dist/lib/MxModule/MxThreeJS/index.js.map +0 -1
- package/dist/lib/MxModule/loadCoreCode/index.js.map +0 -1
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js.map +0 -1
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js.map +0 -1
- package/dist/lib/MxModule/store/PubsubClass.js.map +0 -1
- package/dist/lib/MxModule/store/StoreClass.js.map +0 -1
- package/dist/lib/MxModule/store/index.js.map +0 -1
- package/dist/lib/MxModule/store/store.js.map +0 -1
- package/dist/lib/MxModule/useCanvasResizeListener/index.js.map +0 -1
- package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js.map +0 -1
- package/dist/lib/doc.js.map +0 -1
- package/dist/lib/mxdraw.js.map +0 -1
- package/dist/lib/tools/algorithm/math.js.map +0 -1
- package/dist/lib/tools/algorithm/random.js.map +0 -1
- package/dist/lib/tools/dom/create.js.map +0 -1
- package/dist/lib/tools/dynamicImport/index.js.map +0 -1
- package/dist/lib/tools/formatting/index.js.map +0 -1
- package/dist/lib/tools/proxy/index.js.map +0 -1
- package/dist/lib/tools/three/index.js.map +0 -1
- package/dist/lib/types/McEdGetPointWorldDrawObject.js.map +0 -1
- package/dist/lib/types/MrxDbgUiPrPoint.js.map +0 -1
- package/dist/lib/types/MxCADObject.js.map +0 -1
- package/dist/lib/types/MxDrawObject.js.map +0 -1
- package/dist/lib/types/MxFun.js.map +0 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
20
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
21
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
/** @module MxDbLine*/
|
|
24
|
+
var THREE = require("three");
|
|
25
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
26
|
+
/**
|
|
27
|
+
* MxDbLine 直线对象.
|
|
28
|
+
*/
|
|
29
|
+
var MxDbLine = /** @class */ (function (_super) {
|
|
30
|
+
__extends(MxDbLine, _super);
|
|
31
|
+
function MxDbLine() {
|
|
32
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
+
// pt1,pt2
|
|
34
|
+
_this.pt1 = new THREE.Vector3();
|
|
35
|
+
_this.pt2 = new THREE.Vector3();
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
MxDbLine.prototype.getTypeName = function () {
|
|
39
|
+
return 'MxDbLine';
|
|
40
|
+
};
|
|
41
|
+
MxDbLine.prototype.worldDraw = function (pWorldDraw) {
|
|
42
|
+
pWorldDraw.drawLine(this.pt1, this.pt2);
|
|
43
|
+
};
|
|
44
|
+
MxDbLine.prototype.setPoint1 = function (pt1) {
|
|
45
|
+
this.pt1 = pt1;
|
|
46
|
+
};
|
|
47
|
+
MxDbLine.prototype.getPoint1 = function () {
|
|
48
|
+
return this.pt1;
|
|
49
|
+
};
|
|
50
|
+
MxDbLine.prototype.setPoint2 = function (pt2) {
|
|
51
|
+
this.pt2 = pt2;
|
|
52
|
+
};
|
|
53
|
+
MxDbLine.prototype.getPoint2 = function () {
|
|
54
|
+
return this.pt2;
|
|
55
|
+
};
|
|
56
|
+
MxDbLine.prototype.getGripPoints = function () {
|
|
57
|
+
var ret = [];
|
|
58
|
+
ret.push(this.pt1);
|
|
59
|
+
ret.push(this.pt2);
|
|
60
|
+
var midPoint = new THREE.Vector3(this.pt1.x + (this.pt2.x - this.pt1.x) * 0.5, this.pt1.y + (this.pt2.y - this.pt1.y) * 0.5, 0);
|
|
61
|
+
ret.push(midPoint);
|
|
62
|
+
return ret;
|
|
63
|
+
};
|
|
64
|
+
MxDbLine.prototype.moveGripPointsAt = function (index, offset) {
|
|
65
|
+
if (index == 0) {
|
|
66
|
+
this.pt1.add(offset);
|
|
67
|
+
}
|
|
68
|
+
else if (index == 1) {
|
|
69
|
+
this.pt2.add(offset);
|
|
70
|
+
}
|
|
71
|
+
else if (index == 2) {
|
|
72
|
+
this.pt1.add(offset);
|
|
73
|
+
this.pt2.add(offset);
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
};
|
|
77
|
+
MxDbLine.prototype.dwgIn = function (obj) {
|
|
78
|
+
this.onDwgIn(obj);
|
|
79
|
+
this.pt1.copy(obj['pt1']);
|
|
80
|
+
this.pt2.copy(obj['pt2']);
|
|
81
|
+
return true;
|
|
82
|
+
};
|
|
83
|
+
MxDbLine.prototype.dwgOut = function (obj) {
|
|
84
|
+
this.onDwgOut(obj);
|
|
85
|
+
obj['pt1'] = this.pt1;
|
|
86
|
+
obj['pt2'] = this.pt2;
|
|
87
|
+
return obj;
|
|
88
|
+
};
|
|
89
|
+
MxDbLine.prototype.create = function () {
|
|
90
|
+
return new MxDbLine();
|
|
91
|
+
};
|
|
92
|
+
return MxDbLine;
|
|
93
|
+
}(MxDbEntity_1.default));
|
|
94
|
+
exports.default = MxDbLine;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
30
|
+
var three_1 = require("three");
|
|
31
|
+
var index_1 = require("../../tools/three/index");
|
|
32
|
+
var MxFun_1 = require("../MxFun");
|
|
33
|
+
/**
|
|
34
|
+
* MxRectEntity 矩形对象.
|
|
35
|
+
*/
|
|
36
|
+
var MxDbRect = /** @class */ (function (_super) {
|
|
37
|
+
__extends(MxDbRect, _super);
|
|
38
|
+
function MxDbRect() {
|
|
39
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
+
/**
|
|
41
|
+
* pt1: 构成矩形的第一个点
|
|
42
|
+
* */
|
|
43
|
+
_this.pt1 = new three_1.Vector3();
|
|
44
|
+
/**
|
|
45
|
+
* pt1: 构成矩形的第二个点(对角点)
|
|
46
|
+
* */
|
|
47
|
+
_this.pt2 = new three_1.Vector3();
|
|
48
|
+
/**
|
|
49
|
+
* width: 在绘制时自动计算矩形像素宽度 单位px
|
|
50
|
+
* */
|
|
51
|
+
_this.width = 0;
|
|
52
|
+
/**
|
|
53
|
+
* height: 在绘制时自动计算矩形像素高度 单位px
|
|
54
|
+
* */
|
|
55
|
+
_this.height = 0;
|
|
56
|
+
/**
|
|
57
|
+
* cornerRadius(优先级大于radius属性): 圆角的半径 如[3, 2, 1, 4]分别对应左上角圆角半径3 右上角2 右下角1 左下角4
|
|
58
|
+
* */
|
|
59
|
+
_this.cornerRadius = [];
|
|
60
|
+
/**
|
|
61
|
+
* transparent 开启透明度
|
|
62
|
+
* */
|
|
63
|
+
_this.transparent = true;
|
|
64
|
+
/**
|
|
65
|
+
* opacity 设置透明度 0 ~ 1
|
|
66
|
+
* */
|
|
67
|
+
_this.opacity = 1;
|
|
68
|
+
/**
|
|
69
|
+
* visible 该矩形对象是否可见
|
|
70
|
+
* */
|
|
71
|
+
_this.visible = true;
|
|
72
|
+
return _this;
|
|
73
|
+
}
|
|
74
|
+
MxDbRect.prototype.worldDraw = function (pWorldDraw) {
|
|
75
|
+
var _this = this;
|
|
76
|
+
// 根据第一个点和对角点 计算矩形的四个点位
|
|
77
|
+
var points = (0, index_1.computeRectPoints)(this.pt1, this.pt2);
|
|
78
|
+
// 计算圆角顶点坐标
|
|
79
|
+
if (this.cornerRadius.length <= 0 && this.radius) {
|
|
80
|
+
this.cornerRadius = [
|
|
81
|
+
MxFun_1.default.screenCoordLong2Doc(this.radius),
|
|
82
|
+
MxFun_1.default.screenCoordLong2Doc(this.radius),
|
|
83
|
+
MxFun_1.default.screenCoordLong2Doc(this.radius),
|
|
84
|
+
MxFun_1.default.screenCoordLong2Doc(this.radius)
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
if (this.cornerRadius.length > 0) {
|
|
88
|
+
points = (0, index_1.getToGenerateRoundedCorners)(points, this.cornerRadius);
|
|
89
|
+
}
|
|
90
|
+
var geometry;
|
|
91
|
+
var material;
|
|
92
|
+
var line = new three_1.Object3D();
|
|
93
|
+
// 公共的material参数
|
|
94
|
+
var materialParam = {
|
|
95
|
+
transparent: this.transparent,
|
|
96
|
+
opacity: this.opacity,
|
|
97
|
+
visible: this.visible
|
|
98
|
+
};
|
|
99
|
+
// 如果是填充模式
|
|
100
|
+
if (this.fillColor || this.fillImageSrc) {
|
|
101
|
+
// 三维坐标转二位坐标
|
|
102
|
+
points = points.map(function (_a) {
|
|
103
|
+
var x = _a.x, y = _a.y;
|
|
104
|
+
return new three_1.Vector2(x, y);
|
|
105
|
+
});
|
|
106
|
+
// 计算矩形宽高
|
|
107
|
+
geometry = new three_1.ShapeGeometry(new three_1.Shape(points));
|
|
108
|
+
geometry.computeBoundingBox();
|
|
109
|
+
var size = new three_1.Vector3();
|
|
110
|
+
geometry.boundingBox.getSize(size);
|
|
111
|
+
this.width = MxFun_1.default.docCoord2Screen(size.x).x;
|
|
112
|
+
this.height = MxFun_1.default.docCoord2Screen(size.y).x;
|
|
113
|
+
// 如果是图片填充
|
|
114
|
+
if (this.fillImageSrc) {
|
|
115
|
+
var imgSrc = this.fillImageSrc;
|
|
116
|
+
MxFun_1.default.loadImageMaterial(imgSrc, function (mate) {
|
|
117
|
+
if (!mate)
|
|
118
|
+
return;
|
|
119
|
+
material = mate;
|
|
120
|
+
geometry = new three_1.ShapeGeometry(new three_1.Shape(points));
|
|
121
|
+
// 修复集合体的uv坐标
|
|
122
|
+
geometry = (0, index_1.repairGeometryFaceVertexUvs)(geometry);
|
|
123
|
+
// 纹理属性设置
|
|
124
|
+
var map = mate.map;
|
|
125
|
+
if (_this.fillImageParam) {
|
|
126
|
+
if (_this.fillImageParam.center)
|
|
127
|
+
map.center = _this.fillImageParam.center;
|
|
128
|
+
if (_this.fillImageParam.offset)
|
|
129
|
+
map.offset = _this.fillImageParam.offset;
|
|
130
|
+
if (_this.fillImageParam.repeat)
|
|
131
|
+
map.repeat = _this.fillImageParam.repeat;
|
|
132
|
+
if (_this.fillImageParam.rotation)
|
|
133
|
+
map.rotation = _this.fillImageParam.rotation;
|
|
134
|
+
}
|
|
135
|
+
// 有滤镜对象使用自定义着色器
|
|
136
|
+
if (_this.filter) {
|
|
137
|
+
var data = _this.filter._getFilterShaderData(map);
|
|
138
|
+
material = new three_1.ShaderMaterial(__assign(__assign({}, data), materialParam));
|
|
139
|
+
}
|
|
140
|
+
// 设置材质属性
|
|
141
|
+
material.depthTest = false;
|
|
142
|
+
material.transparent = _this.transparent;
|
|
143
|
+
material.opacity = _this.opacity;
|
|
144
|
+
material.visible = _this.visible;
|
|
145
|
+
line = new three_1.Mesh(geometry, material);
|
|
146
|
+
pWorldDraw.drawEntity(line);
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// 颜色填充
|
|
152
|
+
material = new three_1.MeshBasicMaterial(__assign({ color: this.filter
|
|
153
|
+
? this.filter._getFilterColor(this.fillColor, this.opacity)
|
|
154
|
+
: new three_1.Color(this.fillColor) }, materialParam));
|
|
155
|
+
line = new three_1.Mesh(geometry, material);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// 线框模式
|
|
160
|
+
geometry = new three_1.BufferGeometry().setFromPoints(points);
|
|
161
|
+
material = new three_1.LineBasicMaterial(__assign({ color: this.getColor() }, materialParam));
|
|
162
|
+
line = new three_1.LineLoop(geometry, material);
|
|
163
|
+
}
|
|
164
|
+
pWorldDraw.drawEntity(line);
|
|
165
|
+
};
|
|
166
|
+
MxDbRect.prototype.getGripPoints = function () {
|
|
167
|
+
var ret = [];
|
|
168
|
+
ret.push(this.pt1);
|
|
169
|
+
var lineMath = new three_1.Line3(this.pt1, this.pt2);
|
|
170
|
+
var corePt = new three_1.Vector3();
|
|
171
|
+
lineMath.getCenter(corePt);
|
|
172
|
+
ret.push(corePt);
|
|
173
|
+
ret.push(this.pt2);
|
|
174
|
+
return ret;
|
|
175
|
+
};
|
|
176
|
+
MxDbRect.prototype.moveGripPointsAt = function (index, offset) {
|
|
177
|
+
if (index == 0) {
|
|
178
|
+
this.pt1.add(offset);
|
|
179
|
+
}
|
|
180
|
+
else if (index == 1) {
|
|
181
|
+
this.pt1.add(offset);
|
|
182
|
+
this.pt2.add(offset);
|
|
183
|
+
}
|
|
184
|
+
else if (index == 2) {
|
|
185
|
+
this.pt2.add(offset);
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
};
|
|
189
|
+
MxDbRect.prototype.dwgIn = function (obj) {
|
|
190
|
+
this.onDwgIn(obj);
|
|
191
|
+
this.pt1.copy(obj['pt1']);
|
|
192
|
+
this.pt2.copy(obj['pt2']);
|
|
193
|
+
this.cornerRadius = obj['cornerRadius'];
|
|
194
|
+
this.radius = obj['radius'];
|
|
195
|
+
this.filter = obj['filter'];
|
|
196
|
+
return true;
|
|
197
|
+
};
|
|
198
|
+
MxDbRect.prototype.dwgOut = function (obj) {
|
|
199
|
+
this.onDwgOut(obj);
|
|
200
|
+
obj['pt1'] = this.pt1;
|
|
201
|
+
obj['pt2'] = this.pt2;
|
|
202
|
+
obj['cornerRadius'] = this.cornerRadius;
|
|
203
|
+
obj['radius'] = this.radius;
|
|
204
|
+
obj['filter'] = this.filter;
|
|
205
|
+
return obj;
|
|
206
|
+
};
|
|
207
|
+
MxDbRect.prototype.create = function () {
|
|
208
|
+
return new MxDbRect();
|
|
209
|
+
};
|
|
210
|
+
MxDbRect.prototype.transformBy = function (mat) {
|
|
211
|
+
this.pt1.applyMatrix4(mat);
|
|
212
|
+
this.pt2.applyMatrix4(mat);
|
|
213
|
+
};
|
|
214
|
+
MxDbRect.prototype.getTypeName = function () {
|
|
215
|
+
return 'MxRectEntity';
|
|
216
|
+
};
|
|
217
|
+
return MxDbRect;
|
|
218
|
+
}(MxDbEntity_1.default));
|
|
219
|
+
exports.default = MxDbRect;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
4
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
5
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
6
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
/** @module MxDbSVG*/
|
|
8
|
+
var __extends = (this && this.__extends) || (function () {
|
|
9
|
+
var extendStatics = function (d, b) {
|
|
10
|
+
extendStatics = Object.setPrototypeOf ||
|
|
11
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
12
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
13
|
+
return extendStatics(d, b);
|
|
14
|
+
};
|
|
15
|
+
return function (d, b) {
|
|
16
|
+
if (typeof b !== "function" && b !== null)
|
|
17
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18
|
+
extendStatics(d, b);
|
|
19
|
+
function __() { this.constructor = d; }
|
|
20
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
21
|
+
};
|
|
22
|
+
})();
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
var THREE = require("three");
|
|
25
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
26
|
+
var MxFun_1 = require("../MxFun");
|
|
27
|
+
var MxThreeJS_1 = require("../MxThreeJS");
|
|
28
|
+
var MxType_1 = require("../MxType");
|
|
29
|
+
/**
|
|
30
|
+
* MxDbSVG SVG对象.
|
|
31
|
+
*/
|
|
32
|
+
var MxDbSVG = /** @class */ (function (_super) {
|
|
33
|
+
__extends(MxDbSVG, _super);
|
|
34
|
+
function MxDbSVG() {
|
|
35
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
36
|
+
_this.svgPos = new THREE.Vector3();
|
|
37
|
+
_this.svgPath = '';
|
|
38
|
+
_this.svgSize = new THREE.Vector2(50, 50);
|
|
39
|
+
_this.svgAlignmentRatio = new THREE.Vector2(0, 0);
|
|
40
|
+
_this.isSvgDirtyLocation = false;
|
|
41
|
+
_this.isLoadFromPath = true;
|
|
42
|
+
_this.txtPos = new THREE.Vector3();
|
|
43
|
+
_this.txt = '';
|
|
44
|
+
_this.txtHeight = 1;
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
MxDbSVG.prototype.worldDraw = function (pWorldDraw) {
|
|
48
|
+
this.calcSvgPosition();
|
|
49
|
+
if (this.txt.length > 0) {
|
|
50
|
+
var posTxt = new THREE.Vector3(this.txtPos.x, this.txtPos.y, 0);
|
|
51
|
+
pWorldDraw.drawText(this.txt, this.txtHeight, 0, posTxt);
|
|
52
|
+
}
|
|
53
|
+
var svgPosX = this.svgPos.x - this.svgSize.x * this.svgAlignmentRatio.x;
|
|
54
|
+
var svgPosY = this.svgPos.y - this.svgSize.y * this.svgAlignmentRatio.y;
|
|
55
|
+
var pt1 = new THREE.Vector3(svgPosX, svgPosY, 0);
|
|
56
|
+
var pt2 = new THREE.Vector3(svgPosX + this.svgSize.x, svgPosY + this.svgSize.y, 0);
|
|
57
|
+
if (pWorldDraw.getType() == 1) {
|
|
58
|
+
if (this.svg) {
|
|
59
|
+
pWorldDraw.drawEntity(this.svg);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (this.svgPath.length > 0 && this.isLoadFromPath) {
|
|
63
|
+
var myThis_1 = this;
|
|
64
|
+
MxThreeJS_1.default.loadSVG(this.svgPath, undefined, function (obj) {
|
|
65
|
+
if (obj) {
|
|
66
|
+
var box = new THREE.Box3().setFromObject(obj);
|
|
67
|
+
obj.scale.x = myThis_1.svgSize.x / (box.max.x - box.min.x);
|
|
68
|
+
obj.scale.y = myThis_1.svgSize.y / (box.max.y - box.min.y);
|
|
69
|
+
obj.scale.z = obj.scale.x;
|
|
70
|
+
myThis_1.isSvgDirtyLocation = true;
|
|
71
|
+
obj.traverse(function (child) {
|
|
72
|
+
if (child.material) {
|
|
73
|
+
child.material.transparent = true;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
//this.svgPos.multiply
|
|
77
|
+
myThis_1.svg = obj;
|
|
78
|
+
myThis_1.setNeedUpdateDisplay(true);
|
|
79
|
+
MxFun_1.default.updateDisplay();
|
|
80
|
+
}
|
|
81
|
+
myThis_1.isLoadFromPath = false;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
pWorldDraw.drawSelectLine(pt1.x, pt1.y, pt2.x, pt2.y);
|
|
86
|
+
pWorldDraw.drawSelectLine(pt1.x, pt2.y, pt2.x, pt1.y);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
pWorldDraw.drawLine(pt1.x, pt1.y, pt1.x, pt2.y);
|
|
90
|
+
pWorldDraw.drawLine(pt1.x, pt2.y, pt2.x, pt2.y);
|
|
91
|
+
pWorldDraw.drawLine(pt2.x, pt2.y, pt2.x, pt1.y);
|
|
92
|
+
pWorldDraw.drawLine(pt2.x, pt1.y, pt1.x, pt1.y);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
MxDbSVG.prototype.setSvgPath = function (path) {
|
|
96
|
+
this.svgPath = path;
|
|
97
|
+
this.svg = null;
|
|
98
|
+
this.isLoadFromPath = true;
|
|
99
|
+
};
|
|
100
|
+
MxDbSVG.prototype.getSvgPath = function () {
|
|
101
|
+
return this.svgPath;
|
|
102
|
+
};
|
|
103
|
+
MxDbSVG.prototype.setSvgPostion = function (pos) {
|
|
104
|
+
this.svgPos = pos;
|
|
105
|
+
this.isSvgDirtyLocation = true;
|
|
106
|
+
};
|
|
107
|
+
MxDbSVG.prototype.getSvgPostion = function () {
|
|
108
|
+
return this.svgPos;
|
|
109
|
+
};
|
|
110
|
+
MxDbSVG.prototype.setSvgSize = function (size) {
|
|
111
|
+
this.svgSize = size;
|
|
112
|
+
this.isSvgDirtyLocation = true;
|
|
113
|
+
};
|
|
114
|
+
MxDbSVG.prototype.getSvgSize = function () {
|
|
115
|
+
return this.svgSize;
|
|
116
|
+
};
|
|
117
|
+
MxDbSVG.prototype.setSvgAlignmentRatio = function (alignmentRatio) {
|
|
118
|
+
this.svgAlignmentRatio = alignmentRatio;
|
|
119
|
+
this.isSvgDirtyLocation = true;
|
|
120
|
+
};
|
|
121
|
+
MxDbSVG.prototype.getSvgAlignmentRatio = function () {
|
|
122
|
+
return this.svgAlignmentRatio;
|
|
123
|
+
};
|
|
124
|
+
//
|
|
125
|
+
MxDbSVG.prototype.setTextHeight = function (height) {
|
|
126
|
+
this.txtHeight = height;
|
|
127
|
+
};
|
|
128
|
+
MxDbSVG.prototype.getTextHeight = function () {
|
|
129
|
+
return this.txtHeight;
|
|
130
|
+
};
|
|
131
|
+
MxDbSVG.prototype.setText = function (txt) {
|
|
132
|
+
this.txt = txt;
|
|
133
|
+
};
|
|
134
|
+
MxDbSVG.prototype.getText = function () {
|
|
135
|
+
return this.txt;
|
|
136
|
+
};
|
|
137
|
+
MxDbSVG.prototype.setTextPostion = function (pos) {
|
|
138
|
+
this.txtPos = pos;
|
|
139
|
+
};
|
|
140
|
+
MxDbSVG.prototype.getTextPostion = function () {
|
|
141
|
+
return this.txtPos;
|
|
142
|
+
};
|
|
143
|
+
MxDbSVG.prototype.getGripPoints = function () {
|
|
144
|
+
var ret = [];
|
|
145
|
+
ret.push(this.svgPos);
|
|
146
|
+
return ret;
|
|
147
|
+
};
|
|
148
|
+
MxDbSVG.prototype.moveGripPointsAt = function (index, offset) {
|
|
149
|
+
if (index == 0) {
|
|
150
|
+
this.svgPos.add(offset);
|
|
151
|
+
this.txtPos.add(offset);
|
|
152
|
+
}
|
|
153
|
+
this.isSvgDirtyLocation = true;
|
|
154
|
+
return true;
|
|
155
|
+
};
|
|
156
|
+
MxDbSVG.prototype.calcSvgPosition = function () {
|
|
157
|
+
if (!this.svg || !this.isSvgDirtyLocation) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.isSvgDirtyLocation = false;
|
|
161
|
+
this.svg.position.x = this.svgPos.x - this.svgSize.x * this.svgAlignmentRatio.x;
|
|
162
|
+
this.svg.position.y = this.svgPos.y - this.svgSize.y * this.svgAlignmentRatio.y;
|
|
163
|
+
};
|
|
164
|
+
MxDbSVG.prototype.dwgIn = function (obj) {
|
|
165
|
+
this.onDwgIn(obj);
|
|
166
|
+
if (obj.type == MxType_1.default.MxCloneType.kClone && obj['svg']) {
|
|
167
|
+
this.svg = obj['svg'].clone();
|
|
168
|
+
}
|
|
169
|
+
this.svgPos.copy(obj['svgPos']);
|
|
170
|
+
this.svgPath = obj['svgPath'].substr(0);
|
|
171
|
+
this.svgSize.copy(obj['svgSize']);
|
|
172
|
+
this.svgAlignmentRatio.copy(obj['svgAlignmentRatio']);
|
|
173
|
+
this.isSvgDirtyLocation = true;
|
|
174
|
+
if (!this.svg)
|
|
175
|
+
this.isLoadFromPath = true;
|
|
176
|
+
this.txt = obj['txt'];
|
|
177
|
+
this.txtHeight = obj['txtHeight'];
|
|
178
|
+
this.txtPos.copy(obj['txtPos']);
|
|
179
|
+
return true;
|
|
180
|
+
};
|
|
181
|
+
MxDbSVG.prototype.dwgOut = function (obj) {
|
|
182
|
+
this.onDwgOut(obj);
|
|
183
|
+
if (obj.type == MxType_1.default.MxCloneType.kClone) {
|
|
184
|
+
obj['svg'] = this.svg;
|
|
185
|
+
}
|
|
186
|
+
obj['svgPath'] = this.svgPath;
|
|
187
|
+
obj['svgPos'] = this.svgPos;
|
|
188
|
+
obj['svgSize'] = this.svgSize;
|
|
189
|
+
obj['svgAlignmentRatio'] = this.svgAlignmentRatio;
|
|
190
|
+
obj['txt'] = this.txt;
|
|
191
|
+
obj['txtHeight'] = this.txtHeight;
|
|
192
|
+
obj['txtPos'] = this.txtPos;
|
|
193
|
+
return obj;
|
|
194
|
+
};
|
|
195
|
+
MxDbSVG.prototype.create = function () {
|
|
196
|
+
return new MxDbSVG();
|
|
197
|
+
};
|
|
198
|
+
MxDbSVG.prototype.transformBy = function (mat) {
|
|
199
|
+
this.svgPos.applyMatrix4(mat);
|
|
200
|
+
this.txtPos.applyMatrix4(mat);
|
|
201
|
+
this.isSvgDirtyLocation = true;
|
|
202
|
+
};
|
|
203
|
+
MxDbSVG.prototype.getTypeName = function () {
|
|
204
|
+
return 'MxDbSVG';
|
|
205
|
+
};
|
|
206
|
+
return MxDbSVG;
|
|
207
|
+
}(MxDbEntity_1.default));
|
|
208
|
+
exports.default = MxDbSVG;
|