当前位置 : 主页 > 网络编程 > JavaScript >

cesium polygon+callbackproperty

来源:互联网 收集:自由互联 发布时间:2021-06-30
callbackproperty.js var viewer = new Cesium.Viewer('cesiumContainer');function callback(time, result) { var txf = Math.floor(time.secondsOfDay); if (txf %2 === 1) { result = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -115.0, 32.0, -1
callbackproperty.js
var viewer = new Cesium.Viewer('cesiumContainer');

function callback(time, result) {
    
    var txf = Math.floor(time.secondsOfDay);
    if (txf %2 === 1) {
        
    result = Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0,
                                                        -115.0, 32.0,
                                                        -107.0, 33.0,
                                                        -102.0, 31.0,
                                                        -102.0, 35.0]);
    } else {
    result = Cesium.Cartesian3.fromDegreesArray([-116, 37.0,
                                                        -115.0, 32.0,
                                                        -107.0, 33.0,
                                                        -102.0, 31.0,
                                                        -102.0, 35.0]);
    }
    
    return result;
}

var hp = new Cesium.CallbackProperty(callback, false);

var redPolygon = viewer.entities.add({
    name : 'Red polygon on surface',
    polygon : {
        hierarchy : hp,
        material : Cesium.Color.RED
    }
});


viewer.zoomTo(viewer.entities);
网友评论