mxdraw 0.1.21 → 0.1.25
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/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +1 -128
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +1 -5
- package/dist/lib/MxModule/McGePoint3d/McGePoint3d.js +1 -0
- package/dist/lib/MxModule/McGePoint3d/index.js +1 -0
- package/dist/lib/MxModule/McGePoint3dArray/McGePoint3dArray.js +1 -0
- package/dist/lib/MxModule/McGePoint3dArray/index.js +1 -0
- package/dist/lib/MxModule/McGeTool/McGeTool.js +1 -0
- package/dist/lib/MxModule/McGeTool/index.js +1 -0
- package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +1 -3
- package/dist/lib/MxModule/McGiWorldDraw/index.js +1 -2
- package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +1 -19
- package/dist/lib/MxModule/McGiWorldDrawType/index.js +1 -4
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +1 -31
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +1 -5
- package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +1 -159
- package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +1 -5
- package/dist/lib/MxModule/Mx3PointArc/Mx3PointArc.js +1 -0
- package/dist/lib/MxModule/Mx3PointArc/index.js +1 -0
- package/dist/lib/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.js +1 -0
- package/dist/lib/MxModule/MxDb2LineAngularDimension/index.js +1 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +1 -213
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +1 -5
- package/dist/lib/MxModule/MxDbAnyLine/MxDbAnyLine.js +1 -0
- package/dist/lib/MxModule/MxDbAnyLine/index.js +1 -0
- package/dist/lib/MxModule/MxDbArea/MxDbArea.js +1 -0
- package/dist/lib/MxModule/MxDbArea/index.js +1 -0
- package/dist/lib/MxModule/MxDbCoord/MxDbCoord.js +1 -0
- package/dist/lib/MxModule/MxDbCoord/index.js +1 -0
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +1 -258
- package/dist/lib/MxModule/MxDbEntity/index.js +1 -5
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +1 -160
- package/dist/lib/MxModule/MxDbImage/index.js +1 -5
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +1 -94
- package/dist/lib/MxModule/MxDbLine/index.js +1 -5
- package/dist/lib/MxModule/MxDbPolyline/MxDbPolyline.js +1 -97
- package/dist/lib/MxModule/MxDbPolyline/index.js +1 -5
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +1 -273
- package/dist/lib/MxModule/MxDbRect/index.js +1 -4
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +1 -419
- package/dist/lib/MxModule/MxDbSVG/index.js +1 -5
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +1 -21
- package/dist/lib/MxModule/MxDbSVGText/index.js +1 -5
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +1 -782
- package/dist/lib/MxModule/MxDrawObject/index.js +1 -5
- package/dist/lib/MxModule/MxFilters/MxFilters.js +1 -201
- package/dist/lib/MxModule/MxFilters/index.js +1 -4
- package/dist/lib/MxModule/MxFun/MxFun.js +1 -676
- package/dist/lib/MxModule/MxFun/index.js +1 -4
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +1 -283
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -146
- package/dist/lib/MxModule/MxThreeJS/index.js +1 -7
- package/dist/lib/MxModule/MxType/MxType.js +1 -27
- package/dist/lib/MxModule/MxType/index.js +1 -4
- package/dist/lib/MxModule/Mxassembly/Mxassembly.js +1 -20
- package/dist/lib/MxModule/Mxassembly/index.js +1 -9
- package/dist/lib/MxModule/loadCoreCode/index.js +1 -5
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +1 -125
- package/dist/lib/MxModule/loadCoreCode/mxUiData.js +1 -312
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1 -1519
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -7363
- package/dist/lib/MxModule/store/PubsubClass.js +1 -40
- package/dist/lib/MxModule/store/StoreClass.js +1 -73
- package/dist/lib/MxModule/store/index.js +1 -19
- package/dist/lib/MxModule/store/store.js +1 -25
- package/dist/lib/MxModule/useCanvasResizeListener/index.js +1 -5
- package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +1 -95
- package/dist/lib/doc.js +1 -38
- package/dist/lib/mxdraw.js +1 -67
- package/dist/lib/tools/algorithm/math.js +1 -16
- package/dist/lib/tools/algorithm/random.js +1 -13
- package/dist/lib/tools/dom/create.js +1 -47
- package/dist/lib/tools/dynamicImport/index.js +1 -243
- package/dist/lib/tools/formatting/index.js +1 -20
- package/dist/lib/tools/proxy/index.js +1 -17
- package/dist/lib/tools/three/index.js +1 -124
- package/dist/mxdraw.es5.js +1 -0
- package/dist/mxdraw.umd.js +1 -0
- package/dist/types/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.d.ts +9 -0
- package/dist/types/MxModule/McGePoint3d/McGePoint3d.d.ts +11 -0
- package/dist/types/MxModule/McGePoint3d/index.d.ts +3 -0
- package/dist/types/MxModule/McGePoint3dArray/McGePoint3dArray.d.ts +14 -0
- package/dist/types/MxModule/McGePoint3dArray/index.d.ts +3 -0
- package/dist/types/MxModule/McGeTool/McGeTool.d.ts +38 -0
- package/dist/types/MxModule/McGeTool/index.d.ts +4 -0
- package/dist/types/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.d.ts +18 -1
- package/dist/types/MxModule/Mx3PointArc/Mx3PointArc.d.ts +19 -0
- package/dist/types/MxModule/Mx3PointArc/index.d.ts +3 -0
- package/dist/types/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.d.ts +22 -0
- package/dist/types/MxModule/MxDb2LineAngularDimension/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbAnyLine/MxDbAnyLine.d.ts +18 -0
- package/dist/types/MxModule/MxDbAnyLine/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbArea/MxDbArea.d.ts +17 -0
- package/dist/types/MxModule/MxDbArea/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbCoord/MxDbCoord.d.ts +19 -0
- package/dist/types/MxModule/MxDbCoord/index.d.ts +3 -0
- package/dist/types/MxModule/MxDrawObject/MxDrawObject.d.ts +70 -1
- package/dist/types/MxModule/MxFun/MxFun.d.ts +95 -30
- package/dist/types/MxModule/Mxassembly/Mxassembly.d.ts +11 -2
- package/dist/types/MxModule/store/store.d.ts +2 -2
- package/dist/types/mxdraw.d.ts +17 -4
- package/dist/types/tools/three/index.d.ts +28 -1
- package/package.json +3 -2
- package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +0 -2
- package/dist/lib/MxModule/McGeVector3d/index.js +0 -3
- package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +0 -1862
- package/dist/lib/types/McEdGetPointWorldDrawObject.js +0 -2
- package/dist/lib/types/MrxDbgUiPrPoint.js +0 -2
- package/dist/lib/types/MxCADObject.js +0 -2
- package/dist/lib/types/MxDrawObject.js +0 -2
- package/dist/lib/types/MxFun.js +0 -2
- package/dist/lib/types/Mxassembly.js +0 -2
- package/dist/types/MxModule/McGeVector3d/McGeVector3d.d.ts +0 -17
- package/dist/types/MxModule/McGeVector3d/index.d.ts +0 -3
- package/dist/types/MxModule/MxThreeJS/SVGLoader.d.ts +0 -22
- package/dist/types/types/McEdGetPointWorldDrawObject.d.ts +0 -9
- package/dist/types/types/MrxDbgUiPrPoint.d.ts +0 -23
- package/dist/types/types/MxCADObject.d.ts +0 -40
- package/dist/types/types/MxDrawObject.d.ts +0 -60
- package/dist/types/types/MxFun.d.ts +0 -47
- package/dist/types/types/Mxassembly.d.ts +0 -3
|
@@ -1,97 +1 @@
|
|
|
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 MxDbPolyline*/
|
|
24
|
-
var THREE = require("three");
|
|
25
|
-
var MxDbEntity_1 = require("../MxDbEntity");
|
|
26
|
-
/**
|
|
27
|
-
* MxDbPolyline 多义线对象.
|
|
28
|
-
*/
|
|
29
|
-
var MxDbPolyline = /** @class */ (function (_super) {
|
|
30
|
-
__extends(MxDbPolyline, _super);
|
|
31
|
-
function MxDbPolyline() {
|
|
32
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
-
_this.points = [];
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
MxDbPolyline.prototype.getTypeName = function () {
|
|
37
|
-
return 'MxDbPolyline';
|
|
38
|
-
};
|
|
39
|
-
MxDbPolyline.prototype.worldDraw = function (pWorldDraw) {
|
|
40
|
-
if (this.points.length < 2) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
//eometry.vertices.push(...this.points);
|
|
44
|
-
pWorldDraw.drawLines(this.points);
|
|
45
|
-
};
|
|
46
|
-
MxDbPolyline.prototype.getGripPoints = function () {
|
|
47
|
-
return this.points;
|
|
48
|
-
};
|
|
49
|
-
MxDbPolyline.prototype.moveGripPointsAt = function (index, offset) {
|
|
50
|
-
if (index >= this.points.length) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
this.points[index].add(offset);
|
|
54
|
-
return true;
|
|
55
|
-
};
|
|
56
|
-
MxDbPolyline.prototype.create = function () {
|
|
57
|
-
return new MxDbPolyline();
|
|
58
|
-
};
|
|
59
|
-
MxDbPolyline.prototype.dwgIn = function (obj) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
this.onDwgIn(obj);
|
|
62
|
-
var ary = obj['points'];
|
|
63
|
-
this.points = [];
|
|
64
|
-
ary.forEach(function (val) {
|
|
65
|
-
_this.points.push(new THREE.Vector3(val.x, val.y, val.z));
|
|
66
|
-
});
|
|
67
|
-
return true;
|
|
68
|
-
};
|
|
69
|
-
MxDbPolyline.prototype.dwgOut = function (obj) {
|
|
70
|
-
this.onDwgOut(obj);
|
|
71
|
-
obj['points'] = this.points;
|
|
72
|
-
return obj;
|
|
73
|
-
};
|
|
74
|
-
MxDbPolyline.prototype.addVertexAt = function (pt) {
|
|
75
|
-
this.points.push(pt);
|
|
76
|
-
};
|
|
77
|
-
MxDbPolyline.prototype.numVerts = function () {
|
|
78
|
-
return this.points.length;
|
|
79
|
-
};
|
|
80
|
-
MxDbPolyline.prototype.getPointAt = function (index) {
|
|
81
|
-
if (index < this.points.length) {
|
|
82
|
-
return this.points[index];
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
MxDbPolyline.prototype.setPointAt = function (index, pt) {
|
|
89
|
-
if (index < this.points.length) {
|
|
90
|
-
this.points[index] = pt;
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
};
|
|
95
|
-
return MxDbPolyline;
|
|
96
|
-
}(MxDbEntity_1.default));
|
|
97
|
-
exports.default = MxDbPolyline;
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(n,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])})(n,o)};return function(n,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=n}t(n,o),n.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0});var THREE=require("three"),MxDbEntity_1=require("../MxDbEntity"),MxDbPolyline=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.points=[],n}return __extends(n,t),n.prototype.getTypeName=function(){return"MxDbPolyline"},n.prototype.worldDraw=function(t){this.points.length<2||t.drawLines(this.points)},n.prototype.getGripPoints=function(){return this.points},n.prototype.moveGripPointsAt=function(t,n){return!(t>=this.points.length)&&(this.points[t].add(n),!0)},n.prototype.create=function(){return new n},n.prototype.dwgIn=function(t){var n=this;this.onDwgIn(t);var o=t.points;return this.points=[],o.forEach(function(t){n.points.push(new THREE.Vector3(t.x,t.y,t.z))}),!0},n.prototype.dwgOut=function(t){return this.onDwgOut(t),t.points=this.points,t},n.prototype.addVertexAt=function(t){this.points.push(t)},n.prototype.numVerts=function(){return this.points.length},n.prototype.getPointAt=function(t){return t<this.points.length?this.points[t]:null},n.prototype.setPointAt=function(t,n){return t<this.points.length&&(this.points[t]=n,!0)},n}(MxDbEntity_1.default);exports.default=MxDbPolyline;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @module McEdGetPointWorldDrawObject*/
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
var MxDbPolyline_1 = require("./MxDbPolyline");
|
|
5
|
-
exports.default = MxDbPolyline_1.default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDbPolyline_1=require("./MxDbPolyline");exports.default=MxDbPolyline_1.default;
|
|
@@ -1,273 +1 @@
|
|
|
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
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
30
|
-
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
31
|
-
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
32
|
-
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
33
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
34
|
-
var MxDbEntity_1 = require("../MxDbEntity");
|
|
35
|
-
var three_1 = require("three");
|
|
36
|
-
var index_1 = require("../../tools/three/index");
|
|
37
|
-
// import * as _ from 'lodash'
|
|
38
|
-
var MxFun_1 = require("../MxFun");
|
|
39
|
-
var McGiWorldDrawType_1 = require("../McGiWorldDrawType");
|
|
40
|
-
/**
|
|
41
|
-
* MxRectEntity 矩形对象.
|
|
42
|
-
*/
|
|
43
|
-
var MxDbRect = /** @class */ (function (_super) {
|
|
44
|
-
__extends(MxDbRect, _super);
|
|
45
|
-
function MxDbRect() {
|
|
46
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
47
|
-
// 圆角半径
|
|
48
|
-
_this.cornerRadius = [];
|
|
49
|
-
/**
|
|
50
|
-
* pt1: 构成矩形的第一个点
|
|
51
|
-
* */
|
|
52
|
-
_this.pt1 = new three_1.Vector3();
|
|
53
|
-
/**
|
|
54
|
-
* pt1: 构成矩形的第二个点(对角点)
|
|
55
|
-
* */
|
|
56
|
-
_this.pt2 = new three_1.Vector3();
|
|
57
|
-
/**
|
|
58
|
-
* 是否需要颜色填充.
|
|
59
|
-
* */
|
|
60
|
-
_this.isSolidColorFill = false;
|
|
61
|
-
_this.isLoadMaterialFromPath = true;
|
|
62
|
-
_this.material = null;
|
|
63
|
-
return _this;
|
|
64
|
-
}
|
|
65
|
-
MxDbRect.prototype.worldDraw = function (pWorldDraw) {
|
|
66
|
-
var _this = this;
|
|
67
|
-
// 根据第一个点和对角点 计算矩形的四个点位
|
|
68
|
-
var points = (0, index_1.computeRectPoints)(this.pt1, this.pt2);
|
|
69
|
-
if (this.cornerRadius.length > 0) {
|
|
70
|
-
points = (0, index_1.getToGenerateRoundedCorners)(points, this.cornerRadius);
|
|
71
|
-
}
|
|
72
|
-
if (pWorldDraw.getType() != McGiWorldDrawType_1.default.kWorldDraw) {
|
|
73
|
-
// 动态拖动绘制,或选择绘制 。
|
|
74
|
-
// 组成闭合区域。
|
|
75
|
-
points.push(points[0]);
|
|
76
|
-
pWorldDraw.drawLines(points);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// 公共的material参数
|
|
80
|
-
var materialParam = {
|
|
81
|
-
transparent: true,
|
|
82
|
-
depthTest: false,
|
|
83
|
-
opacity: this.opacity,
|
|
84
|
-
visible: this.visible
|
|
85
|
-
};
|
|
86
|
-
// 如果是填充模式
|
|
87
|
-
if (this.isSolidColorFill) {
|
|
88
|
-
// 三维坐标转二位坐标
|
|
89
|
-
points = points.map(function (_a) {
|
|
90
|
-
var x = _a.x, y = _a.y;
|
|
91
|
-
return new three_1.Vector2(x, y);
|
|
92
|
-
});
|
|
93
|
-
// 计算矩形宽高
|
|
94
|
-
var geometry = void 0;
|
|
95
|
-
geometry = new three_1.ShapeGeometry(new three_1.Shape(points));
|
|
96
|
-
// 颜色填充
|
|
97
|
-
var material = new three_1.MeshBasicMaterial(__assign({ color: this.filter
|
|
98
|
-
? this.filter._getFilterColor(this.color, this.opacity)
|
|
99
|
-
: new three_1.Color(this.color) }, materialParam));
|
|
100
|
-
var mash = new three_1.Mesh(geometry, material);
|
|
101
|
-
pWorldDraw.drawEntity(mash);
|
|
102
|
-
}
|
|
103
|
-
else if (this.fillImageSrc) {
|
|
104
|
-
// 图片填充.
|
|
105
|
-
if (this.material) {
|
|
106
|
-
// 三维坐标转二位坐标
|
|
107
|
-
points = points.map(function (_a) {
|
|
108
|
-
var x = _a.x, y = _a.y;
|
|
109
|
-
return new three_1.Vector2(x, y);
|
|
110
|
-
});
|
|
111
|
-
var material = this.material;
|
|
112
|
-
var geometry = new three_1.ShapeGeometry(new three_1.Shape(points));
|
|
113
|
-
// 修复集合体的uv坐标
|
|
114
|
-
geometry = (0, index_1.repairGeometryFaceVertexUvs)(geometry);
|
|
115
|
-
// 有滤镜对象使用自定义着色器
|
|
116
|
-
if (this.filter) {
|
|
117
|
-
// 纹理属性设置
|
|
118
|
-
var mate = material;
|
|
119
|
-
var map = mate.map;
|
|
120
|
-
if (this.fillImageParam) {
|
|
121
|
-
if (this.fillImageParam.center)
|
|
122
|
-
map.center = this.fillImageParam.center;
|
|
123
|
-
if (this.fillImageParam.offset)
|
|
124
|
-
map.offset = this.fillImageParam.offset;
|
|
125
|
-
if (this.fillImageParam.repeat)
|
|
126
|
-
map.repeat = this.fillImageParam.repeat;
|
|
127
|
-
if (this.fillImageParam.rotation)
|
|
128
|
-
map.rotation = this.fillImageParam.rotation;
|
|
129
|
-
}
|
|
130
|
-
var data = this.filter._getFilterShaderData(map);
|
|
131
|
-
material = new three_1.ShaderMaterial(__assign(__assign({}, data), materialParam));
|
|
132
|
-
}
|
|
133
|
-
// 设置材质属性
|
|
134
|
-
material.depthTest = false;
|
|
135
|
-
material.transparent = true;
|
|
136
|
-
material.opacity = this.opacity;
|
|
137
|
-
material.visible = this.visible;
|
|
138
|
-
var mash = new three_1.Mesh(geometry, material);
|
|
139
|
-
pWorldDraw.drawEntity(mash);
|
|
140
|
-
}
|
|
141
|
-
else if (this.fillImageSrc.length > 0 && this.isLoadMaterialFromPath) {
|
|
142
|
-
var myThis_1 = this;
|
|
143
|
-
MxFun_1.default.loadImageMaterial(this.fillImageSrc, function (material) {
|
|
144
|
-
_this.isLoadMaterialFromPath = false;
|
|
145
|
-
if (!material) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
myThis_1.material = material;
|
|
149
|
-
myThis_1.setNeedUpdateDisplay();
|
|
150
|
-
MxFun_1.default.updateDisplay();
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
// 线框模式
|
|
156
|
-
var geometry = new three_1.BufferGeometry().setFromPoints(points);
|
|
157
|
-
var material = new three_1.LineBasicMaterial(__assign({ color: this.getColor() }, materialParam));
|
|
158
|
-
var line = new three_1.LineLoop(geometry, material);
|
|
159
|
-
pWorldDraw.drawEntity(line);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
MxDbRect.prototype.getGripPoints = function () {
|
|
163
|
-
var ret = [];
|
|
164
|
-
ret.push(this.pt1);
|
|
165
|
-
var lineMath = new three_1.Line3(this.pt1, this.pt2);
|
|
166
|
-
var corePt = new three_1.Vector3();
|
|
167
|
-
lineMath.getCenter(corePt);
|
|
168
|
-
ret.push(corePt);
|
|
169
|
-
ret.push(this.pt2);
|
|
170
|
-
return ret;
|
|
171
|
-
};
|
|
172
|
-
MxDbRect.prototype.moveGripPointsAt = function (index, offset) {
|
|
173
|
-
if (index == 0) {
|
|
174
|
-
this.pt1.add(offset);
|
|
175
|
-
}
|
|
176
|
-
else if (index == 1) {
|
|
177
|
-
this.pt1.add(offset);
|
|
178
|
-
this.pt2.add(offset);
|
|
179
|
-
}
|
|
180
|
-
else if (index == 2) {
|
|
181
|
-
this.pt2.add(offset);
|
|
182
|
-
}
|
|
183
|
-
return true;
|
|
184
|
-
};
|
|
185
|
-
MxDbRect.prototype.dwgIn = function (obj) {
|
|
186
|
-
this.onDwgIn(obj);
|
|
187
|
-
this.pt1.copy(obj['pt1']);
|
|
188
|
-
this.pt2.copy(obj['pt2']);
|
|
189
|
-
this.isSolidColorFill = obj['isSolidColorFill'];
|
|
190
|
-
this.fillImageSrc = obj['fillImageSrc'];
|
|
191
|
-
this.fillImageParam = obj['fillImageParam'];
|
|
192
|
-
this.cornerRadius = obj['cornerRadius'];
|
|
193
|
-
this.filter = obj['filter'];
|
|
194
|
-
this.isLoadMaterialFromPath = true;
|
|
195
|
-
this.material = null;
|
|
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['isSolidColorFill'] = this.isSolidColorFill;
|
|
203
|
-
obj['fillImageSrc'] = this.fillImageSrc;
|
|
204
|
-
obj['fillImageParam'] = this.fillImageParam;
|
|
205
|
-
obj['cornerRadius'] = this.cornerRadius;
|
|
206
|
-
obj['filter'] = this.filter;
|
|
207
|
-
return obj;
|
|
208
|
-
};
|
|
209
|
-
MxDbRect.prototype.create = function () {
|
|
210
|
-
return new MxDbRect();
|
|
211
|
-
};
|
|
212
|
-
MxDbRect.prototype.transformBy = function (mat) {
|
|
213
|
-
this.pt1.applyMatrix4(mat);
|
|
214
|
-
this.pt2.applyMatrix4(mat);
|
|
215
|
-
};
|
|
216
|
-
/**
|
|
217
|
-
* setRadius 设置圆角 圆角的半径 如[3, 2, 1, 4]分别对应左上角圆角半径3 右上角2 右下角1 左下角4
|
|
218
|
-
* @param { number | number[] } radius 圆角半径 为数组时[3, 2, 1, 4]分别对应左上角圆角半径3 右上角2 右下角1 左下角4; 或者直接设置半径值 则四个角统一半径
|
|
219
|
-
* */
|
|
220
|
-
MxDbRect.prototype.setRadius = function (radius, isScreenCoord) {
|
|
221
|
-
if (isScreenCoord === void 0) { isScreenCoord = true; }
|
|
222
|
-
if (radius instanceof Array) {
|
|
223
|
-
this.cornerRadius = radius.map(function (r) {
|
|
224
|
-
if (isScreenCoord)
|
|
225
|
-
return MxFun_1.default.screenCoordLong2Doc(r);
|
|
226
|
-
else
|
|
227
|
-
return r;
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
if (radius > 0) {
|
|
232
|
-
if (isScreenCoord) {
|
|
233
|
-
this.cornerRadius = [
|
|
234
|
-
MxFun_1.default.screenCoordLong2Doc(radius),
|
|
235
|
-
MxFun_1.default.screenCoordLong2Doc(radius),
|
|
236
|
-
MxFun_1.default.screenCoordLong2Doc(radius),
|
|
237
|
-
MxFun_1.default.screenCoordLong2Doc(radius)
|
|
238
|
-
];
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
this.cornerRadius = [radius, radius, radius, radius];
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
this.cornerRadius = [];
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
MxDbRect.prototype.getTypeName = function () {
|
|
250
|
-
return 'MxDbRect';
|
|
251
|
-
};
|
|
252
|
-
MxDbRect.prototype.getFilter = function () {
|
|
253
|
-
return this.filter;
|
|
254
|
-
};
|
|
255
|
-
MxDbRect.prototype.setFilter = function (filter) {
|
|
256
|
-
this.filter = filter;
|
|
257
|
-
this.isLoadMaterialFromPath = true;
|
|
258
|
-
this.material = null;
|
|
259
|
-
};
|
|
260
|
-
MxDbRect.prototype.setFillImagePath = function (sPath) {
|
|
261
|
-
this.fillImageSrc = sPath;
|
|
262
|
-
this.isLoadMaterialFromPath = true;
|
|
263
|
-
this.material = null;
|
|
264
|
-
if (this.fillImageSrc) {
|
|
265
|
-
this.isSolidColorFill = false;
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
MxDbRect.prototype.getFillImagePath = function () {
|
|
269
|
-
return this.fillImageSrc;
|
|
270
|
-
};
|
|
271
|
-
return MxDbRect;
|
|
272
|
-
}(MxDbEntity_1.default));
|
|
273
|
-
exports.default = MxDbRect;
|
|
1
|
+
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var MxDbEntity_1=require("../MxDbEntity"),three_1=require("three"),index_1=require("../../tools/three/index"),MxFun_1=require("../MxFun"),McGiWorldDrawType_1=require("../McGiWorldDrawType"),MxDbRect=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.cornerRadius=[],e.pt1=new three_1.Vector3,e.pt2=new three_1.Vector3,e.isSolidColorFill=!1,e.isLoadMaterialFromPath=!0,e.material=null,e}return __extends(e,t),e.prototype.worldDraw=function(t){var e=this,r=(0,index_1.computeRectPoints)(this.pt1,this.pt2);if(this.cornerRadius.length>0&&(r=(0,index_1.getToGenerateRoundedCorners)(r,this.cornerRadius)),t.getType()!=McGiWorldDrawType_1.default.kWorldDraw)return r.push(r[0]),void t.drawLines(r);var i={transparent:!0,depthTest:!1,opacity:this.opacity,visible:this.visible};if(this.isSolidColorFill){r=r.map(function(t){var e=t.x,r=t.y;return new three_1.Vector2(e,r)});var a=void 0;a=new three_1.ShapeGeometry(new three_1.Shape(r));var o=new three_1.MeshBasicMaterial(__assign({color:this.filter?this.filter._getFilterColor(this.color,this.opacity):new three_1.Color(this.color)},i)),n=new three_1.Mesh(a,o);t.drawEntity(n)}else if(this.fillImageSrc){if(this.material){r=r.map(function(t){var e=t.x,r=t.y;return new three_1.Vector2(e,r)});o=this.material,a=new three_1.ShapeGeometry(new three_1.Shape(r));if(a=(0,index_1.repairGeometryFaceVertexUvs)(a),this.filter){var s=o.map;this.fillImageParam&&(this.fillImageParam.center&&(s.center=this.fillImageParam.center),this.fillImageParam.offset&&(s.offset=this.fillImageParam.offset),this.fillImageParam.repeat&&(s.repeat=this.fillImageParam.repeat),this.fillImageParam.rotation&&(s.rotation=this.fillImageParam.rotation));var l=this.filter._getFilterShaderData(s);o=new three_1.ShaderMaterial(__assign(__assign({},l),i))}o.depthTest=!1,o.transparent=!0,o.opacity=this.opacity,o.visible=this.visible;n=new three_1.Mesh(a,o);t.drawEntity(n)}else if(this.fillImageSrc.length>0&&this.isLoadMaterialFromPath){var h=this;MxFun_1.default.loadImageMaterial(this.fillImageSrc,function(t){e.isLoadMaterialFromPath=!1,t&&(h.material=t,h.setNeedUpdateDisplay(),MxFun_1.default.updateDisplay())})}}else{a=(new three_1.BufferGeometry).setFromPoints(r),o=new three_1.LineBasicMaterial(__assign({color:this.getColor()},i));var p=new three_1.LineLoop(a,o);t.drawEntity(p)}},e.prototype.getGripPoints=function(){var t=[];t.push(this.pt1);var e=new three_1.Line3(this.pt1,this.pt2),r=new three_1.Vector3;return e.getCenter(r),t.push(r),t.push(this.pt2),t},e.prototype.moveGripPointsAt=function(t,e){return 0==t?this.pt1.add(e):1==t?(this.pt1.add(e),this.pt2.add(e)):2==t&&this.pt2.add(e),!0},e.prototype.dwgIn=function(t){return this.onDwgIn(t),this.pt1.copy(t.pt1),this.pt2.copy(t.pt2),this.isSolidColorFill=t.isSolidColorFill,this.fillImageSrc=t.fillImageSrc,this.fillImageParam=t.fillImageParam,this.cornerRadius=t.cornerRadius,this.filter=t.filter,this.isLoadMaterialFromPath=!0,this.material=null,!0},e.prototype.dwgOut=function(t){return this.onDwgOut(t),t.pt1=this.pt1,t.pt2=this.pt2,t.isSolidColorFill=this.isSolidColorFill,t.fillImageSrc=this.fillImageSrc,t.fillImageParam=this.fillImageParam,t.cornerRadius=this.cornerRadius,t.filter=this.filter,t},e.prototype.create=function(){return new e},e.prototype.transformBy=function(t){this.pt1.applyMatrix4(t),this.pt2.applyMatrix4(t)},e.prototype.setRadius=function(t,e){void 0===e&&(e=!0),t instanceof Array?this.cornerRadius=t.map(function(t){return e?MxFun_1.default.screenCoordLong2Doc(t):t}):this.cornerRadius=t>0?e?[MxFun_1.default.screenCoordLong2Doc(t),MxFun_1.default.screenCoordLong2Doc(t),MxFun_1.default.screenCoordLong2Doc(t),MxFun_1.default.screenCoordLong2Doc(t)]:[t,t,t,t]:[]},e.prototype.getTypeName=function(){return"MxDbRect"},e.prototype.getFilter=function(){return this.filter},e.prototype.setFilter=function(t){this.filter=t,this.isLoadMaterialFromPath=!0,this.material=null},e.prototype.setFillImagePath=function(t){this.fillImageSrc=t,this.isLoadMaterialFromPath=!0,this.material=null,this.fillImageSrc&&(this.isSolidColorFill=!1)},e.prototype.getFillImagePath=function(){return this.fillImageSrc},e}(MxDbEntity_1.default);exports.default=MxDbRect;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var MxDbRect_1 = require("./MxDbRect");
|
|
4
|
-
exports.default = MxDbRect_1.default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDbRect_1=require("./MxDbRect");exports.default=MxDbRect_1.default;
|