顯示源代碼
                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>
                        
                主站蜘蛛池模板: 国产精品黄页网站在线播放免费| 羞羞色在线观看| 忘忧草视频www| 亚洲AV永久精品爱情岛论坛| 精品哟哟哟国产在线不卡| 国产成人精品动图| 丰满少妇作爱视频免费观看 | 精品无码国产自产在线观看水浒传 | 天堂/在线中文在线资源官网| 亚洲图片小说网| 香蕉app在线观看免费版| 少妇大叫太大太爽受不了| 亚洲欧美日韩综合久久| 91丁香亚洲综合社区| 成年女人毛片免费观看97| 亚洲精品无码mv在线观看 | 免费jizz在线播放视频高清版 | 国产123区在线视频观看| 99久re热视频这里只有精品6| 无码一区二区波多野结衣播放搜索 | 我要打飞华人永久免费| 乱中年女人伦av三区| 欧美综合区自拍亚洲综合绿色| 国产在线精彩视频| www.久久.com| 欧美成人在线免费| 国产一区二区三区在线免费| 手机在线看片国产日韩生活片| 日本熟妇色熟妇在线视频播放| 亚洲欧美成人中文在线网站| 精品亚洲成a人无码成a在线观看 | 91久久香蕉国产线看| 性满足久久久久久久久| 亚洲另类欧美综合久久图片区| 诗涵留学荷兰被黑人摘小说| 天天躁夜夜躁狠狠躁2021a| 乱人伦老妇女东北| 欧美精品三级在线| 免费a级毛片无码免费视频| 羞耻暴露办公室调教play视频| 国产国语在线播放视频|