new Cesium.ReferenceProperty(targetCollection, targetId, targetPropertyNames)

一个 Property ,它透明地链接到提供对象上的另一个属性.
Name Type Description
targetCollection EntityCollection 用于解决引用的实体集合 .
targetId string 正在引用的实体编号.
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

readonly definitionChanged : Event

当此属性定义发生变化时, 获取该属性被提起的事件 . 每当引用的财产定义被修改时,定义都会被修改.

readonly isConstant : boolean

获得一个表示该属性是否常数的值.

readonly referenceFrame : ReferenceFrame

获得该位置定义的参考框架. 此属性只有在引用的属性为 PositionProperty 时才有效 .

readonly resolvedProperty : Property|undefined

获取已解析的引用属性实例 .

readonly targetCollection : EntityCollection

获取包含被引用实体的收藏.

readonly targetId : string

获取被引用实体的ID.

readonly targetPropertyNames : Object

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

Methods

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

创建给定实体收藏的新实例 用于解析它和一个字符串,表示目标实体 id 和属性. The format of the string is "objectId#foo.bar", where # separates the id from 属性路径和. 分离子属性。 如果参考标识符或 或任何子财产包含一个 # ...或\它们必须逃脱.
Name Type Description
targetCollection EntityCollection
referenceString string
Returns:
参考文献的新实例.
Throws:

equals(other)boolean

将此属性与所提供的属性进行比较并返回 -NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
Name Type Description
other Property optional 其他财产.
Returns:
如果左右对等, 则使用 NT 0 true NT 1 , 否则使用 NT 2 false NT 3 .

getType(time)string

Gets the Material type at the provided time. 此方法只有在引用的属性为 MaterialProperty 时才有效.
Name Type Description
time JulianDate 检索类型的时间 .
Returns:
材料类型.

getValue(time, result)object

在提供的时间获得财产的价值.
Name Type Default Description
time JulianDate JulianDate.now() optional The time for which to retrieve the value. If omitted, the current system time is used.
result object optional 如果省略,则创建并返回将数值存储为新实例的对象.
Returns:
未提供结果参数的修改结果参数或新实例 .

getValueInReferenceFrame(time, referenceFrame, result)Cartesian3

获取提供的时间和参考框架内的财产价值. 此方法只有在引用的属性为 PositionProperty 时才有效.
Name Type Description
time JulianDate 获取值的时间 .
referenceFrame ReferenceFrame 理想的参考结果Frame.
result Cartesian3 optional 如果省略,则创建并返回将数值存储为新实例的对象.
Returns:
未提供结果参数的修改结果参数或新实例 .
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.