Appearance
KBE3D / KBCore / Cesium / ReferenceProperty
类: ReferenceProperty
A Property which transparently links to another property on a provided object.
示例
ts
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);参数
The entity collection which will be used to resolve the reference.
参数
The id of the entity which is being referenced.
参数
The names of the property on the target entity which we will use.
属性
isConstant
readonlyisConstant:boolean
Gets a value indicating if this property is constant.
definitionChanged
readonlydefinitionChanged: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.
referenceFrame
readonlyreferenceFrame:ReferenceFrame
Gets the reference frame that the position is defined in. This property is only valid if the referenced property is a PositionProperty.
targetId
readonlytargetId:string
Gets the id of the entity being referenced.
targetCollection
readonlytargetCollection:EntityCollection
Gets the collection containing the entity being referenced.
targetPropertyNames
readonlytargetPropertyNames:any
Gets the array of property names used to retrieve the referenced property.
resolvedProperty
readonlyresolvedProperty:Property|undefined
Gets the resolved instance of the underlying referenced property.
方法
fromString()
staticfromString(targetCollection:EntityCollection,referenceString:string):ReferenceProperty
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.
参数
targetCollection
referenceString
string
返回
ReferenceProperty
A new instance of ReferenceProperty.
getValue()
getValue(
time?:JulianDate,result?:any):any
Gets the value of the property at the provided time.
参数
time?
The time for which to retrieve the value. If omitted, the current system time is used.
result?
any
The object to store the value into, if omitted, a new instance is created and returned.
返回
any
The modified result parameter or a new instance if the result parameter was not supplied.
getValueInReferenceFrame()
getValueInReferenceFrame(
time:JulianDate,referenceFrame:ReferenceFrame,result?:Cartesian3):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.
参数
time
The time for which to retrieve the value.
referenceFrame
The desired referenceFrame of the result.
result?
The object to store the value into, if omitted, a new instance is created and returned.
返回
The modified result parameter or a new instance if the result parameter was not supplied.
getType()
getType(
time:JulianDate):string
Gets the Material type at the provided time. This method is only valid if the property being referenced is a MaterialProperty.
参数
time
The time for which to retrieve the type.
返回
string
The type of material.
equals()
equals(
other?:Property):boolean
Compares this property to the provided property and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
other?
The other property.
返回
boolean
true if left and right are equal, false otherwise.
构造函数
构造函数
new ReferenceProperty(
targetCollection:EntityCollection,targetId:string,targetPropertyNames:string[]):ReferenceProperty
参数
targetCollection
targetId
string
targetPropertyNames
string[]
返回
ReferenceProperty
