mirror of https://gitee.com/cf-fz/WebCAD.git
parent
ded5647607
commit
1bfed1b6a5
@ -0,0 +1,46 @@
|
||||
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
|
||||
|
||||
import { Database } from "../../src/DatabaseServices/Database";
|
||||
import { Curve } from "../../src/DatabaseServices/Entity/Curve";
|
||||
import { RoomRegion } from "../../src/DatabaseServices/Room/Entity/Region/RoomRegion";
|
||||
import { CURVE_DIR_TYPE_KEY, CURVE_WALL_TYPE_KEY, RoomWallBase } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallBase";
|
||||
import { RoomWallLine } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallLine";
|
||||
import { ROOM_REGION_CURVES_KEY, WallCurveDirType } from "../../src/DatabaseServices/Room/ParseService/RoomRegionParse";
|
||||
import { RoomWallParse } from "../../src/DatabaseServices/Room/ParseService/RoomWallParse";
|
||||
|
||||
// file.only
|
||||
|
||||
test('分析房间和墙的关系', () =>
|
||||
{
|
||||
let d =
|
||||
{ "file": [6, "RoomWallLine", 1, 3, 8, 2, 100, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 0, 2700, 729.5325838779954, 5977.297245098039, 0, 729.5325838779954, -183.96925490196065, 0, "RoomWallLine", 1, 3, 8, 2, 101, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 0, 2700, 729.5325838779954, -183.96925490196065, 0, 9350.869283877995, -183.96925490196065, 0, "RoomWallLine", 1, 3, 8, 2, 102, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 0, 2700, 9350.869283877995, -183.96925490196065, 0, 9350.869283877995, 5977.297245098039, 0, "RoomWallLine", 1, 3, 8, 2, 103, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 0, 2700, 9350.869283877995, 5977.297245098039, 0, 729.5325838779954, 5977.297245098039, 0, "RoomWallLine", 1, 3, 8, 2, 107, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 0, 2700, 5040.200933877995, 5977.297245098039, 0, 5040.200933877995, -183.96925490196065, 0, "RoomWallLine", 1, 3, 8, 2, 111, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 240, 0, 2700, 5040.200933877995, 2896.663995098039, 0, 9350.869283877995, 2896.6639950980393, 0], "basePt": { "x": 609.5325838779954, "y": -303.96925490196065, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1] };
|
||||
|
||||
let walls: RoomWallLine[] = LoadEntityFromFileData<RoomWallLine>(d);
|
||||
|
||||
let db = new Database;
|
||||
|
||||
for (let w of walls) db.ModelSpace.Append(w);
|
||||
|
||||
let parse = new RoomWallParse(true, db, false).Parse(walls);
|
||||
|
||||
|
||||
for (let e of db.ModelSpace.Entitys)
|
||||
{
|
||||
if (e instanceof RoomRegion)
|
||||
{
|
||||
let roomRegion: RoomRegion = e;
|
||||
|
||||
let curves = roomRegion[ROOM_REGION_CURVES_KEY] as Curve[];
|
||||
|
||||
curves.length; //?
|
||||
|
||||
for (let c of curves)
|
||||
{
|
||||
let curve_at_wall_dir = c[CURVE_DIR_TYPE_KEY] as WallCurveDirType;//曲线在墙体内的方向 左侧 右侧 还是盖子
|
||||
console.log(curve_at_wall_dir);
|
||||
let curve_at_wall = c[CURVE_WALL_TYPE_KEY] as RoomWallBase;//曲线在哪个墙体里面
|
||||
console.log(curve_at_wall.Id.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Reference in new issue