mirror of https://gitee.com/cf-fz/WebCAD.git
parent
7112f85c86
commit
128348828d
@ -0,0 +1,42 @@
|
|||||||
|
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
|
||||||
|
import { Polyline } from "../../src/DatabaseServices/Polyline";
|
||||||
|
import { equaln } from "../../src/Geometry/GeUtils";
|
||||||
|
|
||||||
|
test('多段线与多段线Join', () =>
|
||||||
|
{
|
||||||
|
let data =
|
||||||
|
[2, "Polyline", 2, 1, 102, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 2, 4, [69.1964285714286, -106.02678571428574], 0, [-60.26785714285711, 58.03571428571427], 0.4847381535042383, [-241.07142857142856, 58.03571428571427], -1.124793513518748, [-340.9598214285714, 157.9241071428571], 0, false, "Polyline", 2, 1, 103, false, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 1, 2, 4, [69.1964285714286, -106.02678571428574], 0, [181.36160714285717, 6.138392857142875], -0.7890083669838478, [389.50892857142867, -121.65178571428574], 1.286428411698261, [556.9196428571429, -132.81250000000003], 0, false]
|
||||||
|
|
||||||
|
let pls = LoadEntityFromFileData(data) as Polyline[];
|
||||||
|
|
||||||
|
let pl1 = pls[0].Clone();
|
||||||
|
let pl2 = pls[1].Clone();
|
||||||
|
|
||||||
|
let length = pl1.Length + pl2.Length;
|
||||||
|
|
||||||
|
//sp sp
|
||||||
|
expect(pl1.Join(pl2)).toBe(1);
|
||||||
|
expect(equaln(pl1.Length, length)).toBeTruthy();
|
||||||
|
|
||||||
|
pl1 = pls[0].Clone();
|
||||||
|
pl2 = pls[1].Clone();
|
||||||
|
pl2.Reverse();
|
||||||
|
//sp ep
|
||||||
|
expect(pl1.Join(pl2)).toBe(1);
|
||||||
|
expect(equaln(pl1.Length, length)).toBeTruthy();
|
||||||
|
|
||||||
|
pl1 = pls[0].Clone();
|
||||||
|
pl2 = pls[1].Clone();
|
||||||
|
pl1.Reverse();
|
||||||
|
//ep sp
|
||||||
|
expect(pl1.Join(pl2)).toBe(1);
|
||||||
|
expect(equaln(pl1.Length, length)).toBeTruthy();
|
||||||
|
|
||||||
|
pl1 = pls[0].Clone();
|
||||||
|
pl2 = pls[1].Clone();
|
||||||
|
pl1.Reverse();
|
||||||
|
pl2.Reverse();
|
||||||
|
//ep ep
|
||||||
|
expect(pl1.Join(pl2)).toBe(1);
|
||||||
|
expect(equaln(pl1.Length, length)).toBeTruthy();
|
||||||
|
});
|
Loading…
Reference in new issue