Appearance
KBE3D / KBCore / Cesium / Cesium3DTilePointFeature
类: Cesium3DTilePointFeature
A point feature of a Cesium3DTileset. <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 point properties </p> <p> Modifications to a <code>Cesium3DTilePointFeature</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 Cesium3DTileset#tileUnload event to save any modifications. Also listen to the Cesium3DTileset#tileVisible event to reapply any modifications. </p> <p> Do not construct this directly. Access it through Cesium3DTileContent#getFeature or picking using Scene#pick and Scene#pickPosition. </p>
示例
ts
// 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.Cesium3DTilePointFeature) {
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
const propertyId = propertyIds[i];
console.log(`{propertyId}: ${feature.getProperty(propertyId)}`);
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);属性
show
show:
boolean
Gets or sets if the feature will be shown. This is set for all features when a style's show is evaluated.
color
color:
Color
Gets or sets the color of the point of this feature. <p> Only applied when <code>image</code> is <code>undefined</code>. </p>
pointSize
pointSize:
number
Gets or sets the point size of this feature. <p> Only applied when <code>image</code> is <code>undefined</code>. </p>
pointOutlineColor
pointOutlineColor:
Color
Gets or sets the point outline color of this feature. <p> Only applied when <code>image</code> is <code>undefined</code>. </p>
pointOutlineWidth
pointOutlineWidth:
number
Gets or sets the point outline width in pixels of this feature. <p> Only applied when <code>image</code> is <code>undefined</code>. </p>
labelColor
labelColor:
Color
Gets or sets the label color of this feature. <p> The color will be applied to the label if <code>labelText</code> is defined. </p>
labelOutlineColor
labelOutlineColor:
Color
Gets or sets the label outline color of this feature. <p> The outline color will be applied to the label if <code>labelText</code> is defined. </p>
labelOutlineWidth
labelOutlineWidth:
number
Gets or sets the outline width in pixels of this feature. <p> The outline width will be applied to the point if <code>labelText</code> is defined. </p>
font
font:
string
Gets or sets the font of this feature. <p> Only applied when the <code>labelText</code> is defined. </p>
labelStyle
labelStyle:
LabelStyle
Gets or sets the fill and outline style of this feature. <p> Only applied when <code>labelText</code> is defined. </p>
labelText
labelText:
string
Gets or sets the text for this feature.
backgroundColor
backgroundColor:
Color
Gets or sets the background color of the text for this feature. <p> Only applied when <code>labelText</code> is defined. </p>
backgroundPadding
backgroundPadding:
Cartesian2
Gets or sets the background padding of the text for this feature. <p> Only applied when <code>labelText</code> is defined. </p>
backgroundEnabled
backgroundEnabled:
boolean
Gets or sets whether to display the background of the text for this feature. <p> Only applied when <code>labelText</code> is defined. </p>
scaleByDistance
scaleByDistance:
NearFarScalar
Gets or sets the near and far scaling properties for this feature.
translucencyByDistance
translucencyByDistance:
NearFarScalar
Gets or sets the near and far translucency properties for this feature.
distanceDisplayCondition
distanceDisplayCondition:
DistanceDisplayCondition
Gets or sets the condition specifying at what distance from the camera that this feature will be displayed.
heightOffset
heightOffset:
number
Gets or sets the height offset in meters of this feature.
anchorLineEnabled
anchorLineEnabled:
boolean
Gets or sets whether the anchor line is displayed. <p> Only applied when <code>heightOffset</code> is defined. </p>
anchorLineColor
anchorLineColor:
Color
Gets or sets the color for the anchor line. <p> Only applied when <code>heightOffset</code> is defined. </p>
image
image:
string
Gets or sets the image of this feature.
disableDepthTestDistance
disableDepthTestDistance:
number
Gets or sets the distance where depth testing will be disabled.
horizontalOrigin
horizontalOrigin:
HorizontalOrigin
Gets or sets the horizontal origin of this point, which determines if the point is to the left, center, or right of its anchor position.
verticalOrigin
verticalOrigin:
VerticalOrigin
Gets or sets the vertical origin of this point, which determines if the point is to the bottom, center, or top of its anchor position.
labelHorizontalOrigin
labelHorizontalOrigin:
HorizontalOrigin
Gets or sets the horizontal origin of this point's text, which determines if the point's text is to the left, center, or right of its anchor position.
labelVerticalOrigin
labelVerticalOrigin:
VerticalOrigin
Get or sets the vertical origin of this point's text, which determines if the point's text is to the bottom, center, top, or baseline of it's anchor point.
tileset
readonlytileset:Cesium3DTileset
Gets the tileset containing the feature.
primitive
readonlyprimitive:Cesium3DTileset
All objects returned by Scene#pick have a <code>primitive</code> property. This returns the tileset containing the feature.
方法
hasProperty()
hasProperty(
name:string):boolean
Returns whether the feature contains this property. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.
参数
name
string
The case-sensitive name of the property.
返回
boolean
Whether the feature contains this property.
getPropertyIds()
getPropertyIds(
results?:string[]):string[]
Returns an array of property IDs for the feature. This includes properties from this feature's class and inherited classes when using a batch table hierarchy.
参数
results?
string[]
An array into which to store the results.
返回
string[]
The IDs of the feature's properties.
getProperty()
getProperty(
name:string):any
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.
参数
name
string
The case-sensitive name of the property.
返回
any
The value of the property or undefined if the feature does not have this property.
示例
ts
// Display all the properties for a feature in the console log.
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
const propertyId = propertyIds[i];
console.log(`{propertyId} : ${feature.getProperty(propertyId)}`);
}setProperty()
setProperty(
name:string,value:any):void
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>
参数
name
string
The case-sensitive name of the property.
value
any
The value of the property that will be copied.
返回
void
Examples
ts
const height = feature.getProperty('Height'); // e.g., the height of a buildingts
const name = 'clicked';
if (feature.getProperty(name)) {
console.log('already clicked');
} else {
feature.setProperty(name, true);
console.log('first click');
}构造函数
构造函数
new Cesium3DTilePointFeature():
Cesium3DTilePointFeature
返回
Cesium3DTilePointFeature
