国产久_亚欧精品一区_久久亚洲美女_99精品在线观看_日韩成人三级_久久精品久久久久

顯示源代碼
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-tian-w-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>
        
主站蜘蛛池模板: 夜夜春亚洲嫩草一区二区 | 免费黄色a视频 | 自拍偷拍欧美精品 | 欧美久久久一区二区三区 | 日日爱视频 | 亚洲精品美女在线观看 | sejiujiu| 天天干天天干天天干天天干天天干 | 日本不卡视频在线观看 | 亚洲看片wwwwf5con| 欧美日韩免费一区二区三区 | 夜间福利网站 | 一级性片| 青青手机在线视频 | 午夜精品久久久久久久传媒 | 线观看免费完整aaa 香蕉av777xxx色综合一区 | 欧美日本韩国在线 | 亚洲欧美精品在线 | 99综合色| 特一级黄色 | 日韩精品综合 | 国产精品免费视频二三区 | 亚洲电影天堂网 | 99热精品在线播放 | 国产99久久久久久免费看 | 午夜小影院 | 亚洲四房| 欧美大吊| 成人性生交大片免费卡看 | 精品不卡一区 | 欧美国产中文 | 我要色综合网 | 伊人夜色 | 国产精品女同一区二区 | 黄页网站在线免费观看 | 免费观看一级特黄欧美大片 | 国产又黄又粗 | 亚洲成人毛片 | 中文字幕第一页亚洲 | 日韩三级电影在线 | 成人黄色免费观看 |