动态路径飞行-源代码示例 运行 重置

                    <!DOCTYPE html>
<html lang="en">

<head>
    <!-- Use correct character set. -->
    <meta charset="utf-8">
    <!-- Tell IE to use the latest, best version. -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>Hello World!</title>
    <link href='http://www.bigemap.com:9000/bigemap-gl.js/v1.1.0/Widgets/widgets.css' rel='stylesheet' />
    <script src='http://www.bigemap.com:9000/bigemap-gl.js/v1.1.0/bigemap-gl.js'></script>
    <style>
        html,
        body,
        #Container {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
    </style>
</head>

<body>
    <div id="credit"></div>
    <div id="Container">
    </div>
    <script>
        bmgl.Config.HTTP_URL = 'http://www.bigemap.com:9000';
        var viewer = new bmgl.Viewer('Container', { mapId: 'bigemap.arcgis-map', shouldAnimate: true });

        var czml = [{
            "id": "document",
            "name": "polygon",
            "version": "1.0",
            "clock": {
                "interval": "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
                "currentTime": "2012-08-04T16:00:00Z",
                "multiplier": 10
            }
        }, {
            "id": "planeModel",
            "name": "Red box with black outline",
            "availability": "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
            /*"position" : {
                "cartographicDegrees" : [-66.62557, 516.92809, 100.0]
            },*/
            "model": {
                "gltf": "/templates/glb/bmgl_Air.glb",
                "scale": 2.0,
                "minimumPixelSize": 128
            },
            "path": {
                "material": {
                    "solidColor": {
                        "color": {
                            "interval": "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
                            "rgba": [255, 0, 0, 128]
                        }
                    }
                },
                "width": [{
                    "interval": "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
                    "number": 3.0
                }],
                "show": [{
                    "interval": "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
                    "boolean": true
                }]
            },
            "position": {
                "interpolationAlgorithm": "LAGRANGE",
                "interpolationDegree": 1,
                "epoch": "2012-08-04T16:00:00Z",
                "cartographicDegrees": [
                    0.0, 118.87841653400005, 30.95679870500004, 0.0,
                    10.0, 118.87826541800007, 30.95680770900003, 0.0,
                    20.0, 118.8774481050001, 30.956860625000047, 0.0,
                    30.0, 118.87660414600009, 30.956910105000077, 0.0,
                    40.0, 118.8759846580001, 30.95694296000005, 0.0,
                    50.0, 118.87542502500003, 30.956978761000073, 0.0,
                    60.0, 118.87473380100005, 30.957024103000037, 0.0

                ]
            }
        }];

        var dataSourcePromise;
        var i = 30.957024;
        var a = 60;
        setInterval(function () {
            i += 0.0001;
            a += 10;
            console.log(a);
            console.log(i);
            czml[1].position.cartographicDegrees.push(a, 118.8747338, i, 0);
            czml[0].clock.currentTime = viewer.clock.currentTime.toString();
            viewer.entities.removeAll();
            viewer.dataSources.add(bmgl.CzmlDataSource.load(czml)).then(function (ds) {
                var s = ds.entities.getById("planeModel");
                s.orientation = new bmgl.VelocityOrientationProperty(s.position);
            });;
        }, 1000);

        dataSourcePromise = bmgl.CzmlDataSource.load(czml);
        viewer.dataSources.add(dataSourcePromise).then(function (ds) {
            var s = ds.entities.getById("planeModel");
            s.orientation = new bmgl.VelocityOrientationProperty(s.position);
        });;
        viewer.zoomTo(dataSourcePromise);
    </script>
</body>

</html>                                                                                            
源码