Appearance
KBE3D / KBCore / Cesium / GroundPolylinePrimitive
类: GroundPolylinePrimitive
A GroundPolylinePrimitive represents a polyline draped over the terrain or 3D Tiles in the Scene. <p> Only to be used with GeometryInstances containing GroundPolylineGeometry. </p>
示例
ts
// 1. Draw a polyline on terrain with a basic color material
const instance = new Cesium.GeometryInstance({
geometry : new Cesium.GroundPolylineGeometry({
positions : Cesium.Cartesian3.fromDegreesArray([
-112.1340164450331, 36.05494287836128,
-112.08821010582645, 36.097804071380715
]),
width : 4.0
}),
id : 'object returned when this instance is picked and to get/set per-instance attributes'
});
scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
geometryInstances : instance,
appearance : new Cesium.PolylineMaterialAppearance()
}));
// 2. Draw a looped polyline on terrain with per-instance color and a distance display condition.
// Distance display conditions for polylines on terrain are based on an approximate terrain height
// instead of true terrain height.
const instance2 = new Cesium.GeometryInstance({
geometry : new Cesium.GroundPolylineGeometry({
positions : Cesium.Cartesian3.fromDegreesArray([
-112.1340164450331, 36.05494287836128,
-112.08821010582645, 36.097804071380715,
-112.13296079730024, 36.168769146801104
]),
loop : true,
width : 4.0
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString('green').withAlpha(0.7)),
distanceDisplayCondition : new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(1000, 30000)
},
id : 'object returned when this instance is picked and to get/set per-instance attributes'
});
scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
geometryInstances : instance2,
appearance : new Cesium.PolylineColorAppearance()
}));参数
Object with the following properties:
参数
GeometryInstances containing GroundPolylineGeometry
参数
The Appearance used to render the polyline. Defaults to a white color Material on a PolylineMaterialAppearance.
参数
Determines if this primitive will be shown.
参数
When <code>true</code>, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.
参数
When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.
参数
When <code>true</code>, each geometry instance will only be pickable with Scene#pick. When <code>false</code>, GPU memory is saved.
参数
Determines if the primitive will be created asynchronously or block until ready. If false initializeTerrainHeights() must be called first.
参数
Determines whether terrain, 3D Tiles or both will be classified.
参数
For debugging only. Determines if this primitive's commands' bounding spheres are shown.
参数
For debugging only. Determines if the shadow volume for each geometry in the primitive is drawn. Must be <code>true</code> on creation to have effect.
属性
geometryInstances
readonlygeometryInstances:any[] |GeometryInstance
The geometry instances rendered with this primitive. This may be <code>undefined</code> if <code>options.releaseGeometryInstances</code> is <code>true</code> when the primitive is constructed. <p> Changing this property after the primitive is rendered has no effect. </p>
appearance
appearance:
Appearance
The Appearance used to shade this primitive. Each geometry instance is shaded with the same appearance. Some appearances, like PolylineColorAppearance allow giving each instance unique properties.
show
show:
boolean
Determines if the primitive will be shown. This affects all geometry instances in the primitive.
classificationType
classificationType:
ClassificationType
Determines whether terrain, 3D Tiles or both will be classified.
debugShowBoundingVolume
debugShowBoundingVolume:
boolean
This property is for debugging only; it is not for production use nor is it optimized. <p> Draws the bounding sphere for each draw command in the primitive. </p>
interleave
readonlyinterleave:boolean
Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
releaseGeometryInstances
readonlyreleaseGeometryInstances:boolean
When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.
allowPicking
readonlyallowPicking:boolean
When <code>true</code>, each geometry instance will only be pickable with Scene#pick. When <code>false</code>, GPU memory is saved.
asynchronous
readonlyasynchronous:boolean
Determines if the geometry instances will be created and batched on a web worker.
ready
readonlyready:boolean
Determines if the primitive is complete and ready to render. If this property is true, the primitive will be rendered the next time that GroundPolylinePrimitive#update is called.
debugShowShadowVolume
readonlydebugShowShadowVolume:boolean
This property is for debugging only; it is not for production use nor is it optimized. <p> If true, draws the shadow volume for each geometry in the primitive. </p>
方法
initializeTerrainHeights()
staticinitializeTerrainHeights():Promise<void>
Initializes the minimum and maximum terrain heights. This only needs to be called if you are creating the GroundPolylinePrimitive synchronously.
返回
Promise<void>
A promise that will resolve once the terrain heights have been loaded.
isSupported()
staticisSupported(scene:Scene):boolean
Checks if the given Scene supports GroundPolylinePrimitives. GroundPolylinePrimitives require support for the WEBGL_depth_texture extension.
参数
scene
The current scene.
返回
boolean
Whether or not the current scene supports GroundPolylinePrimitives.
update()
update():
void
Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive. <p> Do not call this function directly. This is documented just to list the exceptions that may be propagated when the scene is rendered: </p>
返回
void
getGeometryInstanceAttributes()
getGeometryInstanceAttributes(
id:any):any
Returns the modifiable per-instance attributes for a GeometryInstance.
参数
id
any
The id of the GeometryInstance.
返回
any
The typed array in the attribute's format or undefined if the is no instance with id.
示例
ts
const attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);isDestroyed()
isDestroyed():
boolean
Returns true if this object was destroyed; otherwise, false. <p> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. </p>
返回
boolean
true if this object was destroyed; otherwise, false.
destroy()
destroy():
void
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object. <p> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example. </p>
返回
void
示例
ts
e = e && e.destroy();构造函数
构造函数
new GroundPolylinePrimitive(
options?: {geometryInstances?:any[] |GeometryInstance;appearance?:Appearance;show?:boolean;interleave?:boolean;releaseGeometryInstances?:boolean;allowPicking?:boolean;asynchronous?:boolean;classificationType?:ClassificationType;debugShowBoundingVolume?:boolean;debugShowShadowVolume?:boolean; }):GroundPolylinePrimitive
参数
options?
geometryInstances?
any[] | GeometryInstance
appearance?
show?
boolean
interleave?
boolean
releaseGeometryInstances?
boolean
allowPicking?
boolean
asynchronous?
boolean
classificationType?
debugShowBoundingVolume?
boolean
debugShowShadowVolume?
boolean
返回
GroundPolylinePrimitive
