cesium中每一个entity属性都是一个property实例,实例提供了基本的属性方法getValue,setValue以及equals。基于property基类提供positionProperty,materialProperty等拓展类,实现了更多效果和衍生。

Entity封装属性示例 :
Cesium中提供了defineProperties方法,继承Object.defineProperties新版cesium改成使用Object。
function Entity(options) {
    var id = options.id;
    if (!defined(id)) {
        id = createGuid();
    }
    this._id = id;
    this._name = options.name;
    this._description = undefined;
    this._position = undefined;
    this._rectangle = undefined;
}
// Key 1:defineProperties
defineProperties(Entity.prototype, {
    id : {
        get : function() {
            return this._id;
        }
    },
    // Key 2:createRawPropertyDescriptor
    name : createRawPropertyDescriptor('name'),
    // Key 3:createPropertyDescriptor
    description : createPropertyDescriptor('description'),
    // Key 4:createPositionPropertyDescriptor
    position : create