diff --git a/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap b/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap index b7beeff75..b6a1aa54b 100644 --- a/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap +++ b/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap @@ -42,6 +42,100 @@ exports[`小圆弧封边 5`] = `"5"`; exports[`无法计算封边 1`] = `"4166.00000"`; +exports[`每段封边对应 1`] = ` +Array [ + 1, + 0, + 0, + 0, + 2, + 2, + 2, +] +`; + +exports[`每段封边对应 2`] = ` +Object { + "buls": Array [ + 0, + 0, + 0, + 0, + 0, + 0, + 0.41421356237309503, + ], + "pts": Array [ + Vector2 { + "x": 239.7404845937969, + "y": 2.842170943040401e-14, + }, + Vector2 { + "x": 597, + "y": 8.526512829121202e-14, + }, + Vector2 { + "x": 597.0000000000001, + "y": 1066.1313131313123, + }, + Vector2 { + "x": 275.28282828282823, + "y": 1066.1313131313123, + }, + Vector2 { + "x": 275.2828282828282, + "y": 1198, + }, + Vector2 { + "x": 2.1316282072803006e-13, + "y": 1198, + }, + Vector2 { + "x": 0, + "y": 239.74048459379705, + }, + ], +} +`; + +exports[`每段封边对应 3`] = ` +Array [ + 1, + 1, + 2, + 1, +] +`; + +exports[`每段封边对应 4`] = ` +Object { + "buls": Array [ + 0.5761636686505207, + -0, + -0, + -0, + ], + "pts": Array [ + Vector2 { + "x": 196.74752165480945, + "y": 0, + }, + Vector2 { + "x": 196.74752165480942, + "y": 348, + }, + Vector2 { + "x": 0, + "y": 348, + }, + Vector2 { + "x": 0, + "y": 0, + }, + ], +} +`; + exports[`特殊链接 圆弧间 1`] = `"187815.39618"`; exports[`特殊链接 圆弧间 2`] = `"190259.30510"`; diff --git a/__test__/EdgeSealing/seal.test.ts b/__test__/EdgeSealing/seal.test.ts index 490e8fd14..10c9bd651 100644 --- a/__test__/EdgeSealing/seal.test.ts +++ b/__test__/EdgeSealing/seal.test.ts @@ -1,5 +1,7 @@ import { Board } from "../../src/DatabaseServices/Entity/Board"; +import { ObjectId } from "../../src/DatabaseServices/ObjectId"; import { GetSealedBoardContour } from "../../src/GraphicsSystem/CalcEdgeSealing"; +import { Production } from "../../src/Production/Product"; import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; import "../Utils/jest.util"; @@ -84,3 +86,19 @@ test('圆弧连接,连接失败了强行连接', () => expect(seald.highSeals.length).toMatchNumberSnapshot(0); } }); + +test('每段封边对应', () => +{ + let d = + { "file": [2, "Board", 10, 2, 128, 0, 1, 2, 71, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 3199.279879469078, -184.30835593784656, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3199.279879469078, -184.30835593784656, 0, 1], 0, 0, 1, 3, 1200, 600.0000000000001, 18, false, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 7, [600, 0], 0, [600.0000000000001, 1068.1313131313123], 0, [277.2828282828283, 1068.1313131313123], 0, [277.28282828282823, 1200], 0, [2.6645352591003757e-13, 1200], 0, [5.3677170396015264e-14, 241.74048459379696], 0.41421356237309503, [241.74048459379696, 0], 0, true, 0, 3, 0, 0, 0, 0, 0, 11, 0, "层板", "", "", "", "", "", 0, 0, "三合一", 2, 5, 1, 0, 0, 0, 2, "0", "2", "2", "1", "", "", "", 7, "三合一", "三合一", "三合一", "三合一", "三合一", "三合一", "三合一", true, true, 1, "1", "1", 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, "Board", 10, 2, 129, 0, 1, 2, 71, [0.9999999999999999, 0, 0, 0, 0, 0.9999999999999999, 0, 0, 0, 0, 1, 0, 3325.715287455372, -16.86877780939915, 0, 1], 0, 0, 1, [0.9999999999999999, 0, 0, 0, 0, 0.9999999999999999, 0, 0, 0, 0, 1, 0, 3325.715287455372, -16.86877780939915, 0, 1], 0, 0, 1, 3, 350, 300, 18, false, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 4, [0, 0], 0, [0, 350], 0, [200, 350], -0.5714285714285715, [200, 0], 0, true, 0, 3, 0, 0, 1, 0, 0, 11, 0, "圆弧板-G", "", "", "默认板材18厘", "生态板", "经典檀木", 1, 1, "三合一", 2, 4, 1, 1, 2, 1, "1", "1", "1", "2", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null], "basePt": { "x": 1999.279879469078, "y": -184.30835593784656, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }; + + let brs = LoadEntityFromFileData(d) as Board[]; + + for (let br of brs) + { + br.objectId = new ObjectId(101);//创造101 + let data = Production.GetBoardSplitOrderData(br); + expect(data.sealing.map(s => s.size)).toMatchSnapshot(); + expect(data.outline).toMatchSnapshot(); + } +});