qd-changjing/public/static/Build/Documentation/Cesium3DTileFeature.html

1441 lines
68 KiB
HTML
Raw Normal View History

2022-07-05 16:56:29 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cesium3DTileFeature - Cesium Documentation</title>
<!--[if lt IE 9]>
<script src="javascript/html5.js"></script>
<![endif]-->
<link href="styles/jsdoc-default.css" rel="stylesheet">
<link href="styles/prism.css" rel="stylesheet">
</head>
<body>
<div id="main">
<h1 class="page-title">
<a href="index.html"><img src="Images/CesiumLogo.png" class="cesiumLogo"></a>
Cesium3DTileFeature
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="Cesium3DTileFeature">
<a href="#Cesium3DTileFeature" class="doc-link"></a>
new Cesium.Cesium3DTileFeature<span class="signature">()</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L39">Scene/Cesium3DTileFeature.js 39</a>
</div>
</h4>
</div>
<div class="description">
A feature of a <a href="Cesium3DTileset.html"><code>Cesium3DTileset</code></a>.
<p>
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
<a href="Cesium3DTileFeature.html#show"><code>Cesium3DTileFeature#show</code></a> and <a href="Cesium3DTileFeature.html#color"><code>Cesium3DTileFeature#color</code></a>, respectively.
</p>
<p>
Modifications to a <code>Cesium3DTileFeature</code> 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 <a href="Cesium3DTileset.html#tileUnload"><code>Cesium3DTileset#tileUnload</code></a> event to save any
modifications. Also listen to the <a href="Cesium3DTileset.html#tileVisible"><code>Cesium3DTileset#tileVisible</code></a> event to reapply any modifications.
</p>
<p>
Do not construct this directly. Access it through <a href="Cesium3DTileContent.html#getFeature"><code>Cesium3DTileContent#getFeature</code></a>
or picking using <a href="Scene.html#pick"><code>Scene#pick</code></a>.
</p>
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">// On mouse over, display all the properties for a feature in the console log.
handler.setInputAction(function(movement) {
const feature = scene.pick(movement.endPosition);
if (feature instanceof Cesium.Cesium3DTileFeature) {
const propertyNames = feature.getPropertyNames();
const length = propertyNames.length;
for (let i = 0; i &lt; length; ++i) {
const propertyName = propertyNames[i];
console.log(propertyName + ': ' + feature.getProperty(propertyName));
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);</code></pre>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<div class="nameContainer">
<h4 class="name" id="color">
<a href="#color" class="doc-link"></a>
color<span class="type-signature"> : <a href="Color.html">Color</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L76">Scene/Cesium3DTileFeature.js 76</a>
</div>
</h4>
</div>
<div class="description">
Gets or sets the highlight color multiplied with the feature's color. When
this is white, the feature's color is not changed. This is set for all features
when a style's color is evaluated.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript"><a href="Color.html#.WHITE"><code>Color.WHITE</code></a></code>
</dl>
<div class="nameContainer">
<h4 class="name" id="featureId">
<a href="#featureId" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> featureId<span class="type-signature"> : Number</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L168">Scene/Cesium3DTileFeature.js 168</a>
</div>
</h4>
</div>
<div class="description">
Get the feature ID associated with this feature. For 3D Tiles 1.0, the
batch ID is returned. For EXT_mesh_features, this is the feature ID from
the selected feature ID set.
</div>
<dl class="details">
<div class="tag-experimental">
<h5>Experimental</h5>
<p>This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.</p>
</div>
</dl>
<div class="nameContainer">
<h4 class="name" id="polylinePositions">
<a href="#polylinePositions" class="doc-link"></a>
polylinePositions<span class="type-signature"> : Float64Array</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L99">Scene/Cesium3DTileFeature.js 99</a>
</div>
</h4>
</div>
<div class="description">
Gets a typed array containing the ECEF positions of the polyline.
Returns undefined if <a href="Cesium3DTileset.html#vectorKeepDecodedPositions"><code>Cesium3DTileset#vectorKeepDecodedPositions</code></a> is false
or the feature is not a polyline in a vector tile.
</div>
<dl class="details">
<div class="tag-experimental">
<h5>Experimental</h5>
<p>This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.</p>
</div>
</dl>
<div class="nameContainer">
<h4 class="name" id="primitive">
<a href="#primitive" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> primitive<span class="type-signature"> : <a href="Cesium3DTileset.html">Cesium3DTileset</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L150">Scene/Cesium3DTileFeature.js 150</a>
</div>
</h4>
</div>
<div class="description">
All objects returned by <a href="Scene.html#pick"><code>Scene#pick</code></a> have a <code>primitive</code> property. This returns
the tileset containing the feature.
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="show">
<a href="#show" class="doc-link"></a>
show<span class="type-signature"> : Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L56">Scene/Cesium3DTileFeature.js 56</a>
</div>
</h4>
</div>
<div class="description">
Gets or sets if the feature will be shown. This is set for all features
when a style's show is evaluated.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">true</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="tileset">
<a href="#tileset" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span> tileset<span class="type-signature"> : <a href="Cesium3DTileset.html">Cesium3DTileset</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L134">Scene/Cesium3DTileFeature.js 134</a>
</div>
</h4>
</div>
<div class="description">
Gets the tileset containing the feature.
</div>
<dl class="details">
</dl>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id=".getPropertyInherited">
<a href="#.getPropertyInherited" class="doc-link"></a>
<span class="type-signature attribute-static">static</span> Cesium.Cesium3DTileFeature.getPropertyInherited<span class="signature">(content, batchId, name)</span> &rarr; <span class="type-signature returnType">*</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L263">Scene/Cesium3DTileFeature.js 263</a>
</div>
</h4>
</div>
<div class="description">
Returns a copy of the feature's property with the given name, examining all
the metadata from 3D Tiles 1.0 formats, the EXT_mesh_features and legacy
EXT_feature_metadata glTF extensions, and the 3DTILES_metadata 3D Tiles
extension. Metadata is checked against name from most specific to most
general and the first match is returned. Metadata is checked in this order:
<ol>
<li>Batch table (feature metadata) property by semantic</li>
<li>Batch table (feature metadata) property by property ID</li>
<li>Tile metadata property by semantic</li>
<li>Tile metadata property by property ID</li>
<li>Group metadata property by semantic</li>
<li>Group metadata property by property ID</li>
<li>Tileset metadata property by semantic</li>
<li>Tileset metadata property by property ID</li>
<li>Otherwise, return undefined</li>
</ol>
<p>
For 3D Tiles Next details, see the <a href="https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_metadata">3DTILES_metadata Extension</a>
for 3D Tiles, as well as the <a href="https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features">EXT_mesh_features Extension</a>
for glTF. For the legacy glTF extension, see <a href="https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata">EXT_feature_metadata Extension</a>
</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>content</code></td>
<td class="type">
<span class="param-type"><a href="Cesium3DTileContent.html">Cesium3DTileContent</a></span>
</td>
<td class="description last">
The content for accessing the metadata</td>
</tr>
<tr>
<td class="name"><code>batchId</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The batch ID (or feature ID) of the feature to get a property for</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The value of the property or <code>undefined</code> if the feature does not have this property.
</div>
<dl class="details">
<div class="tag-experimental">
<h5>Experimental</h5>
<p>This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.</p>
</div>
</dl>
<div class="nameContainer">
<h4 class="name" id="getProperty">
<a href="#getProperty" class="doc-link"></a>
getProperty<span class="signature">(name)</span> &rarr; <span class="type-signature returnType">*</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L228">Scene/Cesium3DTileFeature.js 228</a>
</div>
</h4>
</div>
<div class="description">
Returns a copy of the value of the feature's property with the given name. This includes properties from this feature's
class and inherited classes when using a batch table hierarchy.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
The case-sensitive name of the property.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The value of the property or <code>undefined</code> if the feature does not have this property.
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">// Display all the properties for a feature in the console log.
const propertyNames = feature.getPropertyNames();
const length = propertyNames.length;
for (let i = 0; i &lt; length; ++i) {
const propertyName = propertyNames[i];
console.log(propertyName + ': ' + feature.getProperty(propertyName));
}</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_batch_table_hierarchy">https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_batch_table_hierarchy</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="getPropertyNames">
<a href="#getPropertyNames" class="doc-link"></a>
getPropertyNames<span class="signature">(<span class="optional">results</span>)</span> &rarr; <span class="type-signature returnType">Array.&lt;String></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L206">Scene/Cesium3DTileFeature.js 206</a>
</div>
</h4>
</div>
<div class="description">
Returns an array of property names for the feature. This includes properties from this feature's
class and inherited classes when using a batch table hierarchy.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>results</code></td>
<td class="type">
<span class="param-type">Array.&lt;String></span>
</td>
<td class="description last">
<span class="optional">optional</span>
An array into which to store the results.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The names of the feature's properties.
</div>
<dl class="details">
<h5>See:</h5>
<ul class="see-list">
<li><a href="https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_batch_table_hierarchy">https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_batch_table_hierarchy</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="hasProperty">
<a href="#hasProperty" class="doc-link"></a>
hasProperty<span class="signature">(name)</span> &rarr; <span class="type-signature returnType">Boolean</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L193">Scene/Cesium3DTileFeature.js 193</a>
</div>
</h4>
</div>
<div class="description">
Returns whether the feature contains this property. This includes properties from this feature's
class and inherited classes when using a batch table hierarchy.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
The case-sensitive name of the property.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Whether the feature contains this property.
</div>
<dl class="details">
<h5>See:</h5>
<ul class="see-list">
<li><a href="https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_batch_table_hierarchy">https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_batch_table_hierarchy</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="setProperty">
<a href="#setProperty" class="doc-link"></a>
setProperty<span class="signature">(name, value)</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/Cesium3DTileFeature.js#L367">Scene/Cesium3DTileFeature.js 367</a>
</div>
</h4>
</div>
<div class="description">
Sets the value of the feature's property with the given name.
<p>
If a property with the given name doesn't exist, it is created.
</p>
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">
The case-sensitive name of the property.</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">
The value of the property that will be copied.</td>
</tr>
</tbody>
</table>
<h5>Throws:</h5>
<ul>
<li>
<div class="param-desc">
<span class="param-type"><a href="DeveloperError.html">DeveloperError</a></span>
: Inherited batch table hierarchy property is read only.
</div>
</li>
</ul>
<dl class="details">
<h5>Examples:</h5>
<pre><code class="language-javascript">const height = feature.getProperty('Height'); // e.g., the height of a building</code></pre>
<pre><code class="language-javascript">const name = 'clicked';
if (feature.getProperty(name)) {
console.log('already clicked');
} else {
feature.setProperty(name, true);
console.log('first click');
}</code></pre>
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a>
</footer>
</div>
<div class="nav">
<div class="menu">
<input type="text" class="classFilter" id="ClassFilter" placeholder="Search">
<ul id="ClassList"><li data-name="Animation"><a href="Animation.html">Animation</a></li><li data-name="AnimationViewModel"><a href="AnimationViewModel.html">AnimationViewModel</a></li><li data-name="Appearance"><a href="Appearance.html">Appearance</a></li><li data-name="ArcGisMapServerImageryProvider"><a href="ArcGisMapServerImageryProvider.html">ArcGisMapServerImageryProvider</a></li><li data-name="ArcGISTiledElevationTerrainProvider"><a href="ArcGISTiledElevationTerrainProvider.html">ArcGISTiledElevationTerrainProvider</a></li><li data-name="ArcType"><a href="global.html#ArcType">ArcType</a></li><li data-name="AssociativeArray"><a href="AssociativeArray.html">AssociativeArray</a></li><li data-name="Axis"><a href="global.html#Axis">Axis</a></li><li data-name="AxisAlignedBoundingBox"><a href="AxisAlignedBoundingBox.html">AxisAlignedBoundingBox</a></li><li data-name="backFaceCulling"><a href="global.html#backFaceCulling">backFaceCulling</a></li><li data-name="barycentricCoordinates"><a href="global.html#barycentricCoordinates">barycentricCoordinates</a></li><li data-name="BaseLayerPicker"><a href="BaseLayerPicker.html">BaseLayerPicker</a></li><li data-name="BaseLayerPickerViewModel"><a href="BaseLayerPickerViewModel.html">BaseLayerPickerViewModel</a></li><li data-name="Billboard"><a href="Billboard.html">Billboard</a></li><li data-name="BillboardCollection"><a href="BillboardCollection.html">BillboardCollection</a></li><li data-name="BillboardGraphics"><a href="BillboardGraphics.html">BillboardGraphics</a></li><li data-name="BillboardVisualizer"><a href="BillboardVisualizer.html">BillboardVisualizer</a></li><li data-name="binarySearch"><a href="global.html#binarySearch">binarySearch</a></li><li data-name="binarySearchComparator"><a href="global.html#binarySearchComparator">binarySearchComparator</a></li><li data-name="BingMapsGeocoderService"><a href="BingMapsGeocoderService.html">BingMapsGeocoderService</a></li><li data-name="BingMapsImageryProvider"><a href="BingMapsImageryProvider.html">BingMapsImageryProvider</a></li><li data-name="BingMapsStyle"><a href="global.html#BingMapsStyle">BingMapsStyle</a></li><li data-name="BlendEquation"><a href="global.html#BlendEquation">BlendEquation</a></li><li data-name="BlendFunction"><a href="global.html#BlendFunction">BlendFunction</a></li><li data-name="BlendingState"><a href="BlendingState.html">BlendingState</a></li><li data-name="BlendOption"><a href="global.html#BlendOption">BlendOption</a></li><li data-name="BoundingRectangle"><a href="BoundingRectangle.html">BoundingRectangle</a></li><li data-name="BoundingSphere"><a href="BoundingSphere.html">BoundingSphere</a></li><li data-name="boundingSphere"><a href="global.html#boundingSphere">boundingSphere</a></li><li data-name="BoxEmitter"><a href="BoxEmitter.html">BoxEmitter</a></li><li data-name="BoxGeometry"><a href="BoxGeometry.html">BoxGeometry</a></li><li data-name="BoxGeometryUpdater"><a href="BoxGeometryUpdater.html">BoxGeometryUpdater</a></li><li data-name="BoxGraphics"><a href="BoxGraphics.html">BoxGraphics</a></li><li data-name="BoxOutlineGeometry"><a href="BoxOutlineGeometry.html">BoxOutlineGeometry</a></li><li data-name="buildModuleUrl"><a href="global.html#buildModuleUrl">buildModuleUrl</a></li><li data-name="CallbackProperty"><a href="CallbackProperty.html">CallbackProperty</a></li><li data-name="Camera"><a href="Camera.html">Camera</a></li><li data-name="CameraEventAggregator"><a href="CameraEventAggregator.html">CameraEventAggregator</a></li><li data-name="CameraEventType"><a href="global.html#CameraEventType">CameraEventType</a></li><li data-name="cancelAnimationFrame"><a href="global.html#cancelAnimationFrame">cancelAnimationFrame</a></li><li data-name="Cartesian2"><a href="Cartesian2.html">Cartesian2</a></li><li data-name="Cartesian3"><a href="Cartesian3.html">Cartesian3</a></li><li data-name="Cartesian4"><a href="Cartesian4.html">Cartesian4</a></li><li data-name="Cartographic"><a href="Cartographic.html">Cartographic</a></li><li data-name="CartographicGeocoderService"><a href="CartographicGeocoderServic
</div>
</div>
<script>
if (window.frameElement) {
document.body.className = 'embedded';
var ele = document.createElement('a');
ele.className = 'popout';
ele.target = '_blank';
ele.href = window.location.href;
ele.title = 'Pop out';
document.getElementById('main').appendChild(ele);
}
// Set targets on external links. Sandcastle and GitHub shouldn't be embedded in any iframe.
Array.prototype.forEach.call(document.getElementsByTagName('a'), function(a) {
if (/^https?:/i.test(a.getAttribute('href'))) {
a.target='_blank';
}
});
</script>
<script src="javascript/prism.js"></script>
<script src="javascript/cesiumDoc.js"></script>
</body>
</html>