亚洲动漫在线观看-亚洲动漫第一页-亚洲丁香婷婷-亚洲丶国产丶欧美一区二区三区-亚洲第一综合网站-亚洲第一永久色

顯示源代碼
3d行政區域
 開發文檔
            <!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta
            name="viewport"
            content="initial-scale=1,maximum-scale=1,user-scalable=no"
        />
        <link
            href="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/Widgets/widgets.css"
            rel="stylesheet"
        />
        <script src="http://ua.bigemap.com:30081/bmsdk/bigemap-gl.js/v1.1.0/bigemap-gl.js"></script>
        <style>
            body {
                margin: 0;
                padding: 0;
            }
            #container {
                position: absolute;
                top: 0;
                bottom: 0;
                width: 100%;
            }
            .bmgl-widget-credits {
                display: none;
            }
        </style>
        <title>Google Map Streets</title>
    </head>
    <body>
        <div id="container"></div>

        <script>
            bmgl.Config.HTTP_URL = 'http://ua.bigemap.com:30081/bmsdk/';
            window.viewer = new bmgl.Viewer("container", {
                mapId: "bigemap.dc-satellite",
            });
            viewer.BMWidget.screenSpaceEventHandler.removeInputAction(
                bmgl.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
            );
            viewer.BMWidget.screenSpaceEventHandler.removeInputAction(
                bmgl.ScreenSpaceEventType.LEFT_CLICK
            );
            // 是否支持圖像渲染像素化處理
            if (bmgl.FeatureDetection.supportsImageRenderingPixelated()) {
                viewer.resolutionScale = window.devicePixelRatio;
            }
            viewer.scene.postProcessStages.fxaa.enabled = true;
            //   viewer.imageryLayers.removeAll()
            var promise = bmgl.KmlDataSource.load("/bmgl/kml/lsk.kml");
            promise
                .then(function (dataSource) {
                    // viewer.dataSources.add(dataSource);
                    //Get the array of entities
                    window.arrays = [];
                    window.all = [];
                    var entities = dataSource.entities.values;
                    for (var i = 0; i < entities.length; i++) {
                        var entity = entities[i];
                        if (entity.polygon) {
                            var name = entity.name;
                            let aa =
                                entity.polygon.hierarchy.getValue().positions;
                            window.arrays = [];
                            aa.forEach((item) => {
                                var cartographic =
                                    bmgl.Cartographic.fromCartesian(item);
                                window.arrays.push([
                                    bmgl.Math.toDegrees(cartographic.longitude),
                                    bmgl.Math.toDegrees(cartographic.latitude),
                                ]);
                            });
                            // console.log(`window`, window.arrays);
                            getRec(window.arrays);
                            window.all.push(getRec(window.arrays));
                        }
                    }
                    // console.log(`all`, window.all.flat());
                    let aa = getRec(window.all.flat()).flat();
                    // console.log(`zzz`, aa);
                    const rec = {
                        rectangle: new bmgl.RectangleGraphics({
                            coordinates: new bmgl.Rectangle(
                                bmgl.Math.toRadians(aa[0]),
                                bmgl.Math.toRadians(aa[1]),
                                bmgl.Math.toRadians(aa[2]),
                                bmgl.Math.toRadians(aa[3])
                            ),
                            material: new bmgl.ImageMaterialProperty({
                                image: "/bmgl/images/touming.png",
                                repeat: new bmgl.Cartesian2(1, 1),
                                transparent: true,
                                // color: bmgl.Color.WHITE.withAlpha(0.5)
                            }),
                            //   show:false,
                            extrudedHeight: 2100,
                            fill: true,
                            // shadows:ShadowMode.ENABLED
                            // height: 2000
                            // zIndex: 666
                            // outline: true,
                            // outlineColor: bmgl.Color.RED,
                            // heightReference: bmgl.HeightReference.CLAMP_TO_GROUND
                        }),
                    };

                    drawLine();
                    drawWall();
                    viewer.entities.add(rec);
                    viewer.flyTo(viewer.entities);
                })
                .otherwise(function (error) {
                    window.alert(error);
                });
            //繪制外接矩形
            function getRec(array) {
                let xmin, ymin, xmax, ymax;
                for (let i in array) {
                    const coordinates = array[i];
                    const x = coordinates[0];
                    const y = coordinates[1];
                    if (!xmin) {
                        xmin = x;
                    } else {
                        if (x * 1000000 < xmin * 1000000) {
                            xmin = x;
                        }
                    }

                    if (!ymin) {
                        ymin = y;
                    } else {
                        if (y * 1000000 < ymin * 1000000) {
                            ymin = y;
                        }
                    }

                    if (!xmax) {
                        xmax = x;
                    } else {
                        if (x * 1000000 > xmax * 1000000) {
                            xmax = x;
                        }
                    }

                    if (!ymax) {
                        ymax = y;
                    } else {
                        if (y * 1000000 > ymax * 1000000) {
                            ymax = y;
                        }
                    }
                }
                console.log(xmin, ymin, xmax, ymax);
                return [
                    [xmin, ymin],
                    [xmax, ymax],
                ];
            }
            //繪制多邊形
            function drawLine() {
                var promise = bmgl.KmlDataSource.load("/bmgl/kml/lskxj.kml");
                promise
                    .then(function (dataSource) {
                        var entities = dataSource.entities.values;
                        var colorHash = {};
                        for (var i = 0; i < entities.length; i++) {
                            var entity = entities[i];

                            if (entity.polygon) {
                                var name = entity.name;

                                //畫多邊形
                                viewer.entities.add({
                                    name: name,
                                    type: "polygon",
                                    polygon: {
                                        hierarchy:
                                            entity.polygon.hierarchy.getValue(),
                                        material: bmgl.Color.AQUA,
                                        width: 10,
                                        // material:bmgl.Color.BLACK.withAlpha(0.1),
                                        extrudedHeight: 2000,
                                        // height: 2100,
                                        fill: true,
                                    },
                                });
                            }
                        }
                    })
                    .otherwise(function (error) {
                        window.alert(error);
                    });
            }
            //繪制頂層的多邊形
            function drawWall() {
                var promise = bmgl.KmlDataSource.load("/bmgl/kml/lskxj.kml");
                promise
                    .then(function (dataSource) {
                        var entities = dataSource.entities.values;
                        var colorHash = {};
                        for (var i = 0; i < entities.length; i++) {
                            var entity = entities[i];

                            if (entity.polygon) {
                                var name = entity.name;
                                console.log(name, "name");
                                //畫多邊形
                                viewer.entities.add({
                                    name: name,
                                    type: "polygon",
                                    polygon: {
                                        hierarchy:
                                            entity.polygon.hierarchy.getValue(),
                                        width: 10,
                                        material:
                                            bmgl.Color.BLACK.withAlpha(0.1),
                                        extrudedHeight: 2160,
                                        // height: 2100,
                                        fill: true,
                                    },
                                });
                            }
                        }
                    })
                    .otherwise(function (error) {
                        window.alert(error);
                    });
            }
            viewer.scene.screenSpaceCameraController.minimumZoomDistance = 100;
            let lastentity = "";
            let handler = new bmgl.ScreenSpaceEventHandler(viewer.scene.canvas);
            //設置點擊事件
            handler.setInputAction(function (e) {
                var entity = viewer.scene.pick(e.position);
                console.log(entity, "xxx");
                // console.log(lastentity);
                if (entity != undefined) {
                    if (entity.id.type == "polygon") {
                        if (lastentity != "") {
                            lastentity.material = new bmgl.Color(0, 0, 0, 0.1);
                        }
                        lastentity = entity.id.polygon;
                        lastentity.material = new bmgl.Color(0.4, 0, 0, 0.8);
                        console.log(entity.id.name);
                    }
                } else {
                    if (lastentity != "") {
                        lastentity.material = new bmgl.Color(0, 0, 0, 0.1);
                    }
                    lastentity = "";
                }
            }, bmgl.ScreenSpaceEventType.LEFT_CLICK);
        </script>
    </body>
</html>
        
主站蜘蛛池模板: 婷婷综合七月激情啪啪 | 美女做又爽又黄又猛 | 日韩精品一区二区三区中文在线 | 福利姬 magnet | jazz中国女人护士 | 国产卡一卡二卡三乱码手机 | 探花 在线| 国产精品性视频免费播放 | 无人影院免费观看 | 日本成人黄色片 | 校花在公车上被内射好舒 | 亚洲www视频| 青丝视频免费版在线看 | 我的妹妹最近有点怪免费播放 | 狠狠色狠狠色综合婷婷tag | 日韩毛片基地一区二区三区 | 视频大全在线观看网址 | 皇上好大好硬好涨好深好爽 | 日本在线观看免费观看完整版 | yjsp妖精视频在线观看免费 | 日日干影院| 成人xxxxxx| 古装一级毛片 | 色哟呦| bt岛www| 欧美男男gaygaysxxx | 国色天香视频完整版 | 好深快点再快点好爽视频 | 亚洲黑人巨大videos0 | 波多野结衣中文字幕乱七八糟 | 精品一区久久 | 亚拍一区 | 韩国甜性涩爱在线播放 | 国内自拍网红在综合图区 | 99久久精品国产免费 | 久久九九亚洲精品 | 洗濯屋动漫在线观看 | 日韩精品欧美激情国产一区 | 女人张开腿让男人做爽爽 | 日本午夜视频 | 2019亚洲男人天堂 |