ReferenceProperty

new Cesium.ReferenceProperty(targetCollection, targetId, targetPropertyNames)

一个 Property,用于透明地链接到提供对象上的另一个属性。
Name Type Description
targetCollection EntityCollection 将用于解析引用的实体集合。
targetId string 正被引用的实体的 ID。
targetPropertyNames Array.<string> 我们将使用的目标实体上属性的名称。
Example:
const collection = new Cesium.EntityCollection();

//Create a new entity and assign a billboard scale.
const object1 = new Cesium.Entity({id:'object1'});
object1.billboard = new Cesium.BillboardGraphics();
object1.billboard.scale = new Cesium.ConstantProperty(2.0);
collection.add(object1);

//Create a second entity and reference the scale from the first one.
const object2 = new Cesium.Entity({id:'object2'});
object2.model = new Cesium.ModelGraphics();
object2.model.scale = new Cesium.ReferenceProperty(collection, 'object1', ['billboard', 'scale']);
collection.add(object2);

//Create a third object, but use the fromString helper function.
const object3 = new Cesium.Entity({id:'object3'});
object3.billboard = new Cesium.BillboardGraphics();
object3.billboard.scale = Cesium.ReferenceProperty.fromString(collection, 'object1#billboard.scale');
collection.add(object3);

//You can refer to an entity with a # or . in id and property names by escaping them.
const object4 = new Cesium.Entity({id:'#object.4'});
object4.billboard = new Cesium.BillboardGraphics();
object4.billboard.scale = new Cesium.ConstantProperty(2.0);
collection.add(object4);

const object5 = new Cesium.Entity({id:'object5'});
object5.billboard = new Cesium.BillboardGraphics();
object5.billboard.scale = Cesium.ReferenceProperty.fromString(collection, '\\#object\\.4#billboard.scale');
collection.add(object5);

Members

获取每当该属性的定义发生变化时所触发的事件。 每当被引用属性的定义发生变化时,定义就会被更改。
获取一个值,指示该属性是否为常量。
获取位置所定义的参考框架。 该属性仅在被引用的属性是 PositionProperty 时有效。

readonly resolvedProperty : Property|undefined

获取底层被引用属性的已解析实例。
获取包含被引用实体的集合。
获取被引用实体的 ID。

readonly targetPropertyNames : Object

获取用于检索被引用属性的属性名称数组。

Methods

static Cesium.ReferenceProperty.fromString(targetCollection, referenceString)ReferenceProperty

根据将用于解析的实体集合和一个指示目标实体 ID 及其属性的字符串创建一个新实例。 字符串的格式为 "objectId#foo.bar",其中 # 用于分隔 ID 和属性路径,. 用于分隔子属性。 如果引用标识符或任何子属性包含 #、. 或 \,则必须进行转义。
Name Type Description
targetCollection EntityCollection 实体集合。
referenceString string 引用字符串。
Returns:
ReferenceProperty 的新实例。
Throws:
将此属性与提供的属性进行比较,并返回 如果相等则为 true,否则为 false
Name Type Description
other Property optional 另一个属性。
Returns:
如果两个属性相等,则 true,否则 false
获取在提供时间的 Material 类型。 此方法仅在被引用的属性是 MaterialProperty 时有效。
Name Type Description
time JulianDate 要检索类型的时间。
Returns:
材质的类型。

getValue(time, result)object

获取在提供时间的属性值。
Name Type Default Description
time JulianDate JulianDate.now() optional 要检索值的时间。如果省略,则使用当前系统时间。
result object optional 用于存储值的对象,如果省略,则创建并返回一个新实例。
Returns:
修改后的结果参数,如果未提供结果参数,则返回一个新实例。

getValueInReferenceFrame(time, referenceFrame, result)Cartesian3

获取在提供时间和提供的参考框架下的属性值。 此方法仅在被引用的属性是 PositionProperty 时有效。
Name Type Description
time JulianDate 要检索值的时间。
referenceFrame ReferenceFrame 结果所需的参考框架。
result Cartesian3 optional 用于存储值的对象,如果省略,则创建并返回一个新实例。
Returns:
修改后的结果参数,如果未提供结果参数,则返回一个新实例。
需要帮助?获得答案的最快方法是来自社区和团队 Cesium Forum.