haojianlong 8242abe8f3 楼层平面图文档添加 5 yıl önce
..
README.md 8242abe8f3 楼层平面图文档添加 5 yıl önce

README.md

楼层平面图

1.json数据格式

整体数据格式

    export interface FloorData {
        Columns: Column[]; //所有柱子数据
        Doors: Door[]; //所有门数据
        Spaces: Space[]; //所有空间数据
        VirtualWalls: VirtualWall[]; //所有虚拟墙数据
        Walls: Wall[]; //所有墙数据
        Windows: Casement[]; //所有窗户数据
    } // Interface FloorData

柱子具体数据内容

export interface Column {
    /** 名称  */
    Name: string;
    /** 轮廓线  */
    OutLine: Point[][];
    /** 房间边界  */
    RoomBoundary: boolean;
    /** 位置  */
    Location: Place;
    /** 模型id(外键)    */
    ModelId: string;
    /** 对应Revit模型id */
    SourceId: string;
} // Interface Column

门具体数据

export interface Door {
    /** 面朝方向  */
    FaceDirection: Point;
    /** 把手方向  */
    HandDirection: Point;
    /** 位置  */
    Location: Place;
    /** 模型id(外键)    */
    ModelId: string;
    /** 名称  */
    Name: string;
    /** 轮廓线  */
    OutLine: Point[][];
    /** 拥有者的RevitId */
    Owner: string;
    /** 对应Revit模型id */
    SourceId: string;
    /** 厚度  */
    Thick: number;
    /** 所属墙 */
    WallId: string;
    /** 宽度  */
    Width: string;
} // Interface Door

空间具体数据

export interface Space {
    /** 轮廓线段    */
    BoundarySegments: string[];
    /** 位置  */
    Location: Place;
    /** 高度  */
    Height: number;
    /** 模型id(外键)    */
    ModelId: string;
    /** 名称  */
    Name: string;
    /** 轮廓线  */
    OutLine: Point[][];
    /** 对应Revit模型id */
    SourceId: string;
    /** 补充信息    */
    Tag: string;
} // Interface Space

虚拟墙具体数据

export interface VirtualWall {
    /** 位置  */
    Location: Place;
    /** 模型id(外键)    */
    ModelId: string;
    /** 名称  */
    Name: string;
    /** 轮廓线  */
    OutLine: Point[][];
    /** 对应Revit模型id */
    SourceId: string;
} // interface VirtualWall

墙具体数据

export interface Wall {
    /** 层id */
    LevelId: string;
    /** 位置  */
    Location: Place;
    /** 模型id(外键)    */
    ModelId: string;
    /** 名称  */
    Name: string;
    /** 轮廓线  */
    OutLine: Point[][];
    /** 对应Revit模型id */
    SourceId: string;
    /** 厚度  */
    Width: number;
} // Interface Wall

窗户具体数据

export interface Casement {
    /** 位置  */
    Location: Place;
    /** 模型id(外键)    */
    ModelId: string;
    /** 名称  */
    Name: string;
    /** 轮廓线  */
    OutLine: Point[][];
    /** 拥有者的RevitId */
    Owner: string;
    /** 对应Revit模型id */
    SourceId: string;
    /** 厚度  */
    Thick: number;
    /** 所属墙 */
    WallId: string;
    /** 宽度  */
    Width: string;
} // interface Casement

2.下载-解析-生成 过程

下载

方式1 通过楼层对象floormap信息点,直接从文件服务器获取压缩数据

引擎中已封装好函数loadUrl,直接传入文件服务器路径即可;并且会将压缩数据自动解压

loadUrl(url: string): Promise<void> {}

方式2 通过模型后台接口 /base-graph/query 传入模型id 直接获取未压缩数据

引擎中已封装好函数getFloorData,直接传入模型id,url为接口地址

getFloorData(url: string, data: { ModelId: string }) {}

解析

引擎中会读取下载好的数据,按数据将不同的对象分发到引擎中各个添加对象的方法中

private addBaseMapItem(data: FloorData): void {
        if (data.Walls) {
            data.Walls.forEach((t: Wall): void => {
                this.addWall(t);
            });
        }
        if (data.Columns) {
            data.Columns.forEach((t: Column): void => {
                this.addColumn(t);
            });
        }
        if (data.Windows) {
            data.Windows.forEach((t: Casement): void => {
                this.addCasement(t);
            });
        }
        if (data.VirtualWalls) {
            data.VirtualWalls.forEach((t: VirtualWall): void => {
                this.addVirtualWall(t);
            });
        }
        if (data.Doors) {
            data.Doors.forEach((t: Door): void => {
                this.addDoor(t);
            });
        }
        if (data.Spaces) {
            data.Spaces.forEach((t: Space): void => {
                this.addSpace(t);
            });
        }
    } // Function addBaseMapItem()

生成

当视图监听到需要刷新时,就会触发update()方法,刷新视图,用户就可以在页面中看到相应的楼层平面图了


3.划分