# DistanceDisplayConditionGeometryInstanceAttribute

#### new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(near, far)
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 35

Value and type information for per-instance geometry attribute that determines if the geometry instance has a distance display condition.

Name | Type | Default | Description
--- | --- | --- | ---
`near` | Number | `0.0` | optional The near distance.
`far` | Number | `Number.MAX_VALUE` | optional The far distance.

##### Throws:

- DeveloperError : far must be greater than near.

##### Example:

    var instance = new Cesium.GeometryInstance({
      geometry : new Cesium.BoxGeometry({
        vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL,
        minimum : new Cesium.Cartesian3(-250000.0, -250000.0, -250000.0),
        maximum : new Cesium.Cartesian3(250000.0, 250000.0, 250000.0)
      }),
      modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
        Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),
      id : 'box',
      attributes : {
        distanceDisplayCondition : new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(100.0, 10000.0)
      }
    });

##### See:

- GeometryInstance
- GeometryInstanceAttribute

### Members

#### readonly componentDatatype : ComponentDatatype
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 67

The datatype of each component in the attribute, e.g., individual elements in `DistanceDisplayConditionGeometryInstanceAttribute#value`.

Default Value: ``ComponentDatatype.FLOAT``

#### readonly componentsPerAttribute : Number
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 83

The number of components in the attributes, i.e., `DistanceDisplayConditionGeometryInstanceAttribute#value`.

Default Value: `3`

#### readonly normalize : Boolean
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 101

When `true` and `componentDatatype` is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.

Default Value: `false`

#### value : Float32Array
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 52

The values for the attributes stored in a typed array.

Default Value: `[0.0, 0.0, Number.MAX_VALUE]`

### Methods

#### static Cesium.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition) → DistanceDisplayConditionGeometryInstanceAttribute
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 125

Creates a new `DistanceDisplayConditionGeometryInstanceAttribute` instance given the provided an enabled flag and `DistanceDisplayCondition`.

Name | Type | Description
--- | --- | ---
`distanceDisplayCondition` | DistanceDisplayCondition | The distance display condition.

##### Returns:

The new `DistanceDisplayConditionGeometryInstanceAttribute` instance.

##### Throws:

- DeveloperError : distanceDisplayCondition.far must be greater than distanceDisplayCondition.near

##### Example:

    var distanceDisplayCondition = new Cesium.DistanceDisplayCondition(100.0, 10000.0);
    var instance = new Cesium.GeometryInstance({
      geometry : geometry,
      attributes : {
        distanceDisplayCondition : Cesium.DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition(distanceDisplayCondition)
      }
    });

#### static Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, result) → Float32Array
Core/DistanceDisplayConditionGeometryInstanceAttribute.js 149

Converts a distance display condition to a typed array that can be used to assign a distance display condition attribute.

Name | Type | Description
--- | --- | ---
`distanceDisplayCondition` | DistanceDisplayCondition | The distance display condition value.
`result` | Float32Array | optional The array to store the result in, if undefined a new instance will be created.

##### Returns:

The modified result parameter or a new instance if result was undefined.

##### Example:

    var attributes = primitive.getGeometryInstanceAttributes('an id');
    attributes.distanceDisplayCondition = Cesium.DistanceDisplayConditionGeometryInstanceAttribute.toValue(distanceDisplayCondition, attributes.distanceDisplayCondition);