A
Property 它透明地链接到所提供对象上的另一个属性。 which transparently links to another property on a provided object.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
targetCollection |
EntityCollection | 将用于解析引用的实体集合。 The entity collection which will be used to resolve the reference. |
targetId |
string | 正在引用的实体的 ID。 The id of the entity which is being referenced. |
targetPropertyNames |
Array.<string> | 我们将使用的目标实体的属性名称。 The names of the property on the target entity which we will use. |
示例: 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
获取每当此属性的定义更改时引发的事件。只要引用的属性的定义发生更改,定义就会更改。 Gets the event that is raised whenever the definition of this property changes. The definition is changed whenever the referenced property's definition is changed.
获取一个值,该值指示该属性是否为常量。 Gets a value indicating if this property is constant.
readonly referenceFrame : ReferenceFrame
获取定义位置的参考系。仅当引用的属性是 Gets the reference frame that the position is defined in. This property is only valid if the referenced property is a
PositionProperty.
readonly resolvedProperty : Property|undefined
获取基础引用属性的已解析实例。 Gets the resolved instance of the underlying referenced property.
readonly targetCollection : EntityCollection
获取包含所引用实体的集合。 Gets the collection containing the entity being referenced.
获取被引用的实体的 id。 Gets the id of the entity being referenced.
获取用于检索引用的属性的属性名称数组。 Gets the array of property names used to retrieve the referenced property.
方法 Methods
static Cesium.ReferenceProperty.fromString(targetCollection, referenceString) → ReferenceProperty
创建一个新实例,给定将用于解析它的实体集合以及指示目标实体 ID 和属性的字符串。字符串的格式为“objectId#foo.bar”,其中 # 分隔 id 和属性路径,.分隔子属性。如果引用标识符或任何子属性包含 # 。或 \ 它们必须被转义。 Creates a new instance given the entity collection that will be used to resolve it and a string indicating the target entity id and property. The format of the string is "objectId#foo.bar", where # separates the id from property path and . separates sub-properties. If the reference identifier or or any sub-properties contains a # . or \ they must be escaped.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
targetCollection |
EntityCollection | |
referenceString |
string |
返回: Returns:
ReferenceProperty 的新实例。 A new instance of ReferenceProperty.
抛出: Throws:
-
DeveloperError : invalid referenceString.
将此属性与提供的属性进行比较并返回 Compares this property to the provided property and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
other |
Property | 可选 optional 其他财产。 The other property. |
返回: Returns:
true 如果左和右相等, if left and right are equal, false otherwise.
得到 Gets the
Material 在规定的时间输入。此方法仅在引用的属性是 type at the provided time. This method is only valid if the property being referenced is a MaterialProperty.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
time |
JulianDate | 检索类型的时间。 The time for which to retrieve the type. |
返回: Returns:
材料的类型。 The type of material.
获取指定时间的属性值。 Gets the value of the property at the provided time.
| 名称 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 用于存储值的对象,如果省略,则会创建并返回一个新实例。 The object to store the value into, if omitted, a new instance is created and returned. |
返回: Returns:
修改后的结果参数或新实例(如果未提供结果参数)。 The modified result parameter or a new instance if the result parameter was not supplied.
getValueInReferenceFrame(time, referenceFrame, result) → Cartesian3
获取属性在提供的时间和提供的参考系中的值。此方法仅在引用的属性是 Gets the value of the property at the provided time and in the provided reference frame. This method is only valid if the property being referenced is a
PositionProperty.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
time |
JulianDate | 检索值的时间。 The time for which to retrieve the value. |
referenceFrame |
ReferenceFrame | 结果所需的参考框架。 The desired referenceFrame of the result. |
result |
Cartesian3 | 可选 optional 用于存储值的对象,如果省略,则会创建并返回一个新实例。 The object to store the value into, if omitted, a new instance is created and returned. |
返回: Returns:
修改后的结果参数或新实例(如果未提供结果参数)。 The modified result parameter or a new instance if the result parameter was not supplied.
