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

1292 lines
64 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>ModelFeature - 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>
ModelFeature
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="ModelFeature">
<a href="#ModelFeature" class="doc-link"></a>
new Cesium.ModelFeature<span class="signature">(options)</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Scene/ModelExperimental/ModelFeature.js#L34">Scene/ModelExperimental/ModelFeature.js 34</a>
</div>
</h4>
</div>
<div class="description">
A feature of a <a href="ModelExperimental.html"><code>ModelExperimental</code></a>.
<p>
Provides access to a feature's properties stored in the model's feature table.
</p>
<p>
Modifications to a <code>ModelFeature</code> object have the lifetime of the model.
</p>
<p>
Do not construct this directly. Access it through picking using <a href="Scene.html#pick"><code>Scene#pick</code></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>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
Object with the following properties:
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>model</code></td>
<td class="type">
<span class="param-type"><a href="ModelExperimental.html">ModelExperimental</a></span>
</td>
<td class="description last">
The model the feature belongs to.</td>
</tr>
<tr>
<td class="name"><code>featureId</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The unique integral identifier for this feature.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<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.ModelFeature) {
console.log(feature);
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);</code></pre>
<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>
<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/ModelExperimental/ModelFeature.js#L76">Scene/ModelExperimental/ModelFeature.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/ModelExperimental/ModelFeature.js#L132">Scene/ModelExperimental/ModelFeature.js 132</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="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/ModelExperimental/ModelFeature.js#L56">Scene/ModelExperimental/ModelFeature.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>
<h3 class="subsection-title">Methods</h3>
<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/ModelExperimental/ModelFeature.js#L164">Scene/ModelExperimental/ModelFeature.js 164</a>
</div>
</h4>
</div>
<div class="description">
Returns a copy of the value of the feature's property with the given name.
</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>
</dl>
<div class="nameContainer">
<h4 class="name" id="getPropertyInherited">
<a href="#getPropertyInherited" class="doc-link"></a>
getPropertyInherited<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/ModelExperimental/ModelFeature.js#L187">Scene/ModelExperimental/ModelFeature.js 187</a>
</div>
</h4>
</div>
<div class="description">
Returns a copy of the feature's property with the given name, examining all
the metadata from the EXT_mesh_features and legacy EXT_feature_metadata glTF
extensions. 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>Feature metadata property by semantic</li>
<li>Feature metadata property by property ID</li>
</ol>
<p>
See the <a href="https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features">EXT_mesh_features Extension</a> as well as the
previous <a href="https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata">EXT_feature_metadata Extension</a> for glTF.
</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 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="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/ModelExperimental/ModelFeature.js#L202">Scene/ModelExperimental/ModelFeature.js 202</a>
</div>
</h4>
</div>
<div class="description">
Returns an array of property names for the feature.
</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">
</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/ModelExperimental/ModelFeature.js#L145">Scene/ModelExperimental/ModelFeature.js 145</a>
</div>
</h4>
</div>
<div class="description">
Returns whether the feature contains this property.
</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">
</dl>
<div class="nameContainer">
<h4 class="name" id="setProperty">
<a href="#setProperty" class="doc-link"></a>
setProperty<span class="signature">(name, value)</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/ModelExperimental/ModelFeature.js#L227">Scene/ModelExperimental/ModelFeature.js 227</a>
</div>
</h4>
</div>
<div class="description">
Sets the value of the feature's property with the given name.
</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>Returns:</h5>
<div class="param-desc">
<code>true</code> if the property was set, <code>false</code> otherwise.
</div>
<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>