Cesium3DTileset.
Provides access to a feature's properties stored in the tile's batch table, as well
as the ability to show/hide a feature and change its highlight color via
Cesium3DTileFeature#show and Cesium3DTileFeature#color, respectively.
Modifications to a Cesium3DTileFeature object have the lifetime of the tile's
content. If the tile's content is unloaded, e.g., due to it going out of view and needing
to free space in the cache for visible tiles, listen to the Cesium3DTileset#tileUnload event to save any
modifications. Also listen to the Cesium3DTileset#tileVisible event to reapply any modifications.
Do not construct this directly. Access it through Cesium3DTileContent#getFeature
or picking using Scene#pick and Scene#pickPosition.
Example:
// On mouse over, display all the properties for a feature in the console log.
handler.setInputAction(function(movement) {
var feature = scene.pick(movement.endPosition);
if (feature instanceof Cesium.Cesium3DTileFeature) {
var propertyNames = feature.getPropertyNames();
var length = propertyNames.length;
for (var i = 0; i < length; ++i) {
var propertyName = propertyNames[i];
console.log(propertyName + ': ' + feature.getProperty(propertyName));
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
Members
color : Color
-
Default Value:
Color.WHITE
readonlyprimitive : Cesium3DTileset
Scene#pick have a primitive property. This returns
the tileset containing the feature.
-
Default Value:
true
readonlytileset : Cesium3DTileset
Methods
| Name | Type | Description |
|---|---|---|
name |
String | The case-sensitive name of the property. |
Returns:
undefined if the property does not exist.
Example:
// Display all the properties for a feature in the console log.
var propertyNames = feature.getPropertyNames();
var length = propertyNames.length;
for (var i = 0; i < length; ++i) {
var propertyName = propertyNames[i];
console.log(propertyName + ': ' + feature.getProperty(propertyName));
}
See:
| Name | Type | Description |
|---|---|---|
results |
Array.<String> | An array into which to store the results. |
Returns:
| Name | Type | Description |
|---|---|---|
name |
String | The case-sensitive name of the property. |
Returns:
If a property with the given name doesn't exist, it is created.
| Name | Type | Description |
|---|---|---|
name |
String | The case-sensitive name of the property. |
value |
* | The value of the property that will be copied. |
Throws:
-
DeveloperError : Inherited batch table hierarchy property is read only.
Examples:
var height = feature.getProperty('Height'); // e.g., the height of a building
var name = 'clicked';
if (feature.getProperty(name)) {
console.log('already clicked');
} else {
feature.setProperty(name, true);
console.log('first click');
}
