# 楼栋单元到层到户图层(Building-Block)

根据数据呈现分层分户视觉效果以及交互功能,支持夜光视觉效果。

# 示例

    const layer = new aimap.BuildingBlockLayer({
        joinData: [
            [{members: 5}, {members: 4}, {members: 2}], // 某一户从1楼到3楼的数据
            [{members: 2}, {members: 1}, {members: 3}],
        ],
        data: featureCollection, // feature 会被切成两户的形状
        style: {
            "building-height": 15,                                //栋楼高度
            "building-opacity": 1.5,                              //透明度
            "building-base": 0,                                   //栋楼基础高度
            "building-luminous-bright": "#0d00ff",                //夜光效果亮部颜色
            "building-luminous-dark": "#ff00ff",                  //夜光效果暗部颜色
            "room-split": [0.00001, 1, 2, 1],                     //切割的间隔以及比例
        }
    })

    layer.on("mousemove", (e) => {
        const [feature] = e.features; //feature.properties中有户以及楼层的字段信息

        // 根据户和楼层的信息设置样式
        layer.setStyle({
            "building-opacity":  ['case', 
                ["all" ,
                    ['==', ['get', 'floor'], feature.properties.room],            // 楼层
                    ["==", ["get", "room"], feature.properties.room],             // 房间号
                ],
            , 0, 1]
        })
    })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
最后更新于: 6/13/2022, 10:31:36 AM