A
new ReferenceProperty(targetCollection, targetId, targetPropertyNames)
Property
透明地鏈接到所提供對象上的另一個屬性。
Parameters:
targetId
(String)
正在引用的實體的ID。
targetPropertyNames
(Array.<String>)
目標實體上要使用的屬性的名稱。
Example
var collection = new bmgl.EntityCollection();
//Create a new entity and assign a billboard scale.
var object1 = new bmgl.Entity({id:'object1'});
object1.billboard = new bmgl.BillboardGraphics();
object1.billboard.scale = new bmgl.ConstantProperty(2.0);
collection.add(object1);
//Create a second entity and reference the scale from the first one.
var object2 = new bmgl.Entity({id:'object2'});
object2.model = new bmgl.ModelGraphics();
object2.model.scale = new bmgl.ReferenceProperty(collection, 'object1', ['billboard', 'scale']);
collection.add(object2);
//Create a third object, but use the fromString helper function.
var object3 = new bmgl.Entity({id:'object3'});
object3.billboard = new bmgl.BillboardGraphics();
object3.billboard.scale = bmgl.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.
var object4 = new bmgl.Entity({id:'#object.4'});
object4.billboard = new bmgl.BillboardGraphics();
object4.billboard.scale = new bmgl.ConstantProperty(2.0);
collection.add(object4);
var object5 = new bmgl.Entity({id:'object5'});
object5.billboard = new bmgl.BillboardGraphics();
object5.billboard.scale = bmgl.ReferenceProperty.fromString(collection, '\\#object\\.4#billboard.scale');
collection.add(object5);
Members
(readonly) definitionChanged : Event
獲取每當此屬性的定義更改時引發的事件。只要被引用屬性的定義被更改,定義就會被更改。
(readonly) isConstant : Boolean
獲取一個值,該值指示此屬性是否為常量。
(readonly) referenceFrame : ReferenceFrame
獲取在其中定義位置的引用框架。僅當引用的屬性為
PositionProperty
時,此屬性才有效。
(readonly) resolvedProperty : Property
獲取基礎引用屬性的已解析實例。
(readonly) targetCollection : EntityCollection
獲取包含正在引用的實體的集合。
(readonly) targetId : String
獲取被引用實體的ID。
(readonly) targetPropertyNames : Array.<String>
獲取用于檢索引用屬性的屬性名數組。
Methods
(static) fromString(targetCollection, referenceString) → {ReferenceProperty}
為將用于解析的實體集合和指示目標實體ID和屬性的字符串創建一個新實例。字符串的格式是“objectid#foo.bar”,其中#將ID與屬性路徑和分隔開。分離子屬性。如果引用標識符或任何子屬性包含#。或者他們必須逃跑。
Parameters:
targetCollection
(EntityCollection)
referenceString
(String)
Throws
-
DeveloperError : 引用字符串無效。
將此屬性與提供的屬性進行比較,如果相等,則返回
true
,否則返回false
。
Parameters:
在提供的時間獲取
Material
類型。只有被引用的屬性是aMaterialProperty
時,此方法才有效。
Parameters:
獲取所提供時間的屬性值。
Parameters:
result
(Object)
將值存儲到的對象(如果省略),將創建并返回新實例。
在提供的時間和提供的引用框架中獲取屬性的值。只有被引用的屬性是a
PositionProperty
時,此方法才有效。
Parameters:
referenceFrame
(ReferenceFrame)
所需的結果參考框架。