补充布尔测试

pull/246/head
ChenX 6 years ago
parent 2253023733
commit 270507e47b

@ -1,6 +1,6 @@
import { Region } from "../../src/DatabaseServices/Region";
import { LoadRegionsFromFileData } from "../Utils/LoadEntity.util";
import { BoolOpeartionType } from "../../src/GraphicsSystem/BoolOperateUtils";
import { LoadRegionsFromFileData } from "../Utils/LoadEntity.util";
test("#IRFL2面域消失", () =>
{
@ -60,3 +60,16 @@ test("包含差集的对象,差一点就可以切断", () =>
expect(regs[0].ShapeManager.ShapeCount).toBe(1);
expect(regs[0].ShapeManager.ShapeList[0].Holes.length).toBe(1);
});
test('矩形只有尖角重合并进行并集', () =>
{
let d =
[2, "Region", 2, 1, 114, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 1, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 0, 2, 4, [1010.1971830985912, 770.3662408450699], 0, [1188.676083098591, 770.3662408450699], 0, [1188.676083098591, 1153.69014084507], 0, [1010.1971830985912, 1153.69014084507], 0, true, 0, "Region", 2, 1, 115, false, 7, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 1, 1, 1, 1, 1, "Polyline", 2, 1, 0, false, 1, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1], 0, 2, 4, [1188.676083098591, 1153.69014084507], 0, [1273.859183098591, 1153.69014084507], 0, [1273.859183098591, 1315.94364084507], 0, [1188.676083098591, 1315.94364084507], 0, true, 0]
let regs: Region[] = LoadRegionsFromFileData(d);
regs[0].BooleanOper(regs[1], BoolOpeartionType.Union);
let ens = regs[0].Explode();
//炸开后应该还是2个面域
expect(ens.length).toBe(2);
});

Loading…
Cancel
Save