"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const three_1 = require("three"); const ColorPalette_1 = require("./ColorPalette"); const Text_1 = require("./Text"); const GeUtils_1 = require("./GeUtils"); /** * 标注实体 * * @export * @class Dimension * @extends {Group} */ class Dimension extends three_1.Group { constructor(length, textHeight = 25, mirror = false, mirrorFoot = false) { super(); let footLength = 60; if (mirrorFoot) { footLength = -footLength; } //针脚几何体 let lineGeo = new three_1.Geometry(); lineGeo.vertices.push(new three_1.Vector3(), new three_1.Vector3(0, footLength, 0)); //托盘几何体 let lineGeo2 = new three_1.Geometry(); lineGeo2.vertices.push(new three_1.Vector3(0, footLength), new three_1.Vector3(length, footLength, 0)); let material = ColorPalette_1.ColorMaterial.GetLineMaterial(5); let line1 = new three_1.Line(lineGeo, material); let line2 = new three_1.Line(lineGeo, material); line2.position.x = length; let line3 = new three_1.Line(lineGeo2, material); let text = new Text_1.DbText(parseFloat(length.toFixed(2)).toString(), textHeight); if (mirror) { let roMat = new three_1.Matrix4().makeRotationZ(Math.PI); text.applyMatrix(roMat); text.applyMatrix(GeUtils_1.MoveMatrix(new three_1.Vector3(length * 0.5, footLength - textHeight * 0.1))); } else { text.applyMatrix(GeUtils_1.MoveMatrix(new three_1.Vector3(length * 0.5, footLength * 1.1))); } this.add(text); this.add(line1, line2, line3); } } exports.Dimension = Dimension; //# sourceMappingURL=Dimension.js.map