# ReferenceProperty

#### new Cesium.ReferenceProperty(targetCollection, targetId, targetPropertyNames)
DataSources/ReferenceProperty.js 106

  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 | 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:

      var collection = new Cesium.EntityCollection();

      //Create a new entity and assign a billboard scale.
      var 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.
      var 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.
      var 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.
      var object4 = new Cesium.Entity({id:'#object.4'});
      object4.billboard = new Cesium.BillboardGraphics();
      object4.billboard.scale = new Cesium.ConstantProperty(2.0);
      collection.add(object4);

      var 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

#### readonlydefinitionChanged : Event
DataSources/ReferenceProperty.js 156

  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.

#### readonlyisConstant : Boolean
DataSources/ReferenceProperty.js 144

  Gets a value indicating if this property is constant.

#### readonlyreferenceFrame : ReferenceFrame
DataSources/ReferenceProperty.js 168

  Gets the reference frame that the position is defined in. This property is only valid if the referenced property is a `PositionProperty`.

#### readonlyresolvedProperty : Property
DataSources/ReferenceProperty.js 212

  Gets the resolved instance of the underlying referenced property.

#### readonlytargetCollection : EntityCollection
DataSources/ReferenceProperty.js 190

  Gets the collection containing the entity being referenced.

#### readonlytargetId : String
DataSources/ReferenceProperty.js 179

  Gets the id of the entity being referenced.

#### readonlytargetPropertyNames : Array.<String>
DataSources/ReferenceProperty.js 201

  Gets the array of property names used to retrieve the referenced property.

### Methods

#### staticCesium.ReferenceProperty.fromString(targetCollection, referenceString) → ReferenceProperty
DataSources/ReferenceProperty.js 232

  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:

  A new instance of ReferenceProperty.

  ##### Throws:

  - DeveloperError : invalid referenceString.

#### equals(other) → Boolean
DataSources/ReferenceProperty.js 314

  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.

#### getType(time) → String
DataSources/ReferenceProperty.js 303

  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.

#### getValue(time, result) → Object
DataSources/ReferenceProperty.js 279

  Gets the value of the property at the provided time.

  Name | Type | Description
  --- | --- | ---
  `time` | JulianDate | The time for which to retrieve the value.
  `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
DataSources/ReferenceProperty.js 292

  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.