(() => {
    var lbsMap;
    var indoorMap;
    var buildingId;
    var indoorPos;
    var options = {
        container: 'map',
        // center: [118.856482, 32.031222],
        center: [118.8588, 32.027422],
        bearing: 0,
        //默认放大级别(1-22)
        minZoom: 4,
        zoom: 15,
        maxZoom: 20,
        antialias: true,
        map25D: true,
        server: 'http://202.119.86.17',
        config25D: {
            to2D: [
                0.00000164926743977084, 0.0000025749105714321, 37.6732407548714, 0.00000137043810325462,
                -0.0000020282807754059, 21.5394802403509,
            ],
            to25D: [
                373722.14899006, 293386.125136645, -18956901.8838564, -240139.26219839, 198957.832642276,
                -2287474.37509722,
            ],
            offset: [-49900, 13320],
        },
        style: './style/map-25d.json',
    };
    lbsMap = new sceMap.LbsMap(options);
    lbsMap.on('style.load', (event) => {
        // lbsMap.openBuildingLabel();
        lbsMap.openBuildingBoundTip();
        addMarker();
    });

    function addMarker() {
        var makers = [
            {
                id: 364,
                name: '364-分析测试中心',
                lngLat: { lng: 118.8595, lat: 32.0276 },
            },
            {
                id: 340,
                name: '340-分析测试中心',
                lngLat: { lng: 118.8576, lat: 32.0267 },
            },
            {
                id: 370,
                name: '370-分析测试中心',
                lngLat: { lng: 118.85865, lat: 32.02638 },
            },
        ];


        let nel1 = document.createElement('div');
        let popup1 = `<div style="position: absolute; top: 0; left: 0; display: -webkit-flex; display: flex; will-change: transform; pointer-events: none;-webkit-flex-direction: column-reverse;flex-direction: column-reverse;max-width: 240px;transform: translate(-50%, -170%);    ">
            <div style="width: 0;height: 0;border: 10px solid transparent;z-index: 1;-webkit-align-self: center;align-self: center;border-bottom: none;border-top-color: #fff;"></div>
            <div style="position: relative;background: #fff;border-radius: 10px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);padding: 20px; pointer-events: auto;min-width: 130px;text-align: center;color: #595959;font-size: 15px;">364-分析测试中心</div>
        </div>`
        nel1.innerHTML = popup1;
        const option1= {
            id: 364,
            lngLat: { lng: 118.8595, lat: 32.0276 },
            element: nel1,
        }
        let nel2 = document.createElement('div');
        let popup2 = `<div style="position: absolute; top: 0; left: 0; display: -webkit-flex; display: flex; will-change: transform; pointer-events: none;-webkit-flex-direction: column-reverse;flex-direction: column-reverse;max-width: 240px;transform: translate(-50%, -170%);    ">
            <div style="width: 0;height: 0;border: 10px solid transparent;z-index: 1;-webkit-align-self: center;align-self: center;border-bottom: none;border-top-color: #fff;"></div>
            <div style="position: relative;background: #fff;border-radius: 10px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);padding: 20px; pointer-events: auto;min-width: 130px;text-align: center;color: #595959;font-size: 15px;">340-分析测试中心</div>
        </div>`
        nel2.innerHTML = popup2;
        const option2= {
            id: 340,
            lngLat: { lng: 118.8576, lat: 32.0267 },
            element: nel2,
        }

        let nel3 = document.createElement('div');
        let popup3 = `<div style="position: absolute; top: 0; left: 0; display: -webkit-flex; display: flex; will-change: transform; pointer-events: none;-webkit-flex-direction: column-reverse;flex-direction: column-reverse;max-width: 240px;transform: translate(-50%, -170%);    ">
            <div style="width: 0;height: 0;border: 10px solid transparent;z-index: 1;-webkit-align-self: center;align-self: center;border-bottom: none;border-top-color: #fff;"></div>
            <div style="position: relative;background: #fff;border-radius: 10px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);padding: 20px; pointer-events: auto;min-width: 130px;text-align: center;color: #595959;font-size: 15px;">370-分析测试中心</div>
        </div>`
        nel3.innerHTML = popup3;
        const option3= {
            id: 370,
            lngLat: { lng: 118.85865, lat: 32.02638 },
            element: nel3,
        }

        lbsMap.addMarker(option1);
        lbsMap.addMarker(option2);
        lbsMap.addMarker(option3);

        makers.map((maker) => {
            let el = document.createElement('div');
            el.className = ',marker';
            let text = `<div>
                <svg style="width: 50; height: 50; margin-top: -50%" t="1683192768031" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18140" width="200" height="200"><path d="M511.786667 0C238.72 0 142.72 206.506667 142.72 337.066667c0 139.093333 25.173333 189.013333 333.653333 667.306666a42.666667 42.666667 0 0 0 70.826667 0C855.68 526.08 880.853333 476.586667 880.853333 337.066667 881.28 206.506667 784.853333 0 511.786667 0z" fill="#4988FD" p-id="18141" data-spm-anchor-id="a313x.7781069.0.i15" class=""></path><path d="M469.12 384m-128 0a128 128 0 1 0 256 0 128 128 0 1 0-256 0Z" fill="#4988FD" p-id="18142" data-spm-anchor-id="a313x.7781069.0.i18" class="selected"></path><path d="M511.786667 341.333333m-128 0a128 128 0 1 0 256 0 128 128 0 1 0-256 0Z" fill="#ffffff" p-id="18143" data-spm-anchor-id="a313x.7781069.0.i16" class=""></path></svg>
            </div>`;
            el.innerHTML = text;




            const options = {
                id: maker.id + 1,
                lngLat: maker.lngLat,
                element: el,
            };
            lbsMap.addMarker(options);
        });
    }
}
)()