数字孪生Web 后台dt( digital twin)2.0版本 统一命名格式
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

3412 lines
54 KiB

<!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>CustomPrimitive - XbsjEarth 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> -->
<a href="index.html">EarthSDK</a>
CustomPrimitive
<div class="titleCenterer"></div>
</h1>
<section>
<header>
<div class="class-description">自定义图元</div>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="CustomPrimitive">
<a href="#CustomPrimitive" class="doc-link"></a>
new CustomPrimitive<span class="signature">()</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="XbsjCzmObj.html">XbsjCzmObj</a></li>
</ul>
<h3 class="subsection-title">Namespaces</h3>
<dl>
<dt><a href="namespaces.html#Obj.CustomPrimitive.Geometry"><a href="Obj.CustomPrimitive.Geometry.html">Geometry</a></a></dt>
<dd></dd>
</dl>
<h3 class="subsection-title">Members</h3>
<div class="nameContainer">
<h4 class="name" id="autoRegisterEditing">
<a href="#autoRegisterEditing" class="doc-link"></a>
autoRegisterEditing<span class="type-signature"> : boolean</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
是否自动注册编辑功能
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">false</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="canvasHeight">
<a href="#canvasHeight" class="doc-link"></a>
canvasHeight<span class="type-signature"> : number</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
画布高度,单位像素,为0时表示没有画布
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">0</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="canvasWidth">
<a href="#canvasWidth" class="doc-link"></a>
canvasWidth<span class="type-signature"> : number</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
画布宽度,单位像素,为0时表示没有画布
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">0</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="color">
<a href="#color" class="doc-link"></a>
color<span class="type-signature"> : Array.&lt;number></span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
颜色叠加
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[1, 1, 1, 1]</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="colors">
<a href="#colors" class="doc-link"></a>
colors<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
颜色数组,可选
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="customParams">
<a href="#customParams" class="doc-link"></a>
customParams<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
自定义参数
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[0, 0, 0, 0]</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="customProp">
<a href="#customProp" class="doc-link"></a>
customProp<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
用来临时存储客户需要的一些信息,方便使用<br/>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjCzmObj.html#customProp">XbsjCzmObj#customProp</a>
</li></dd>
<span class="details-header">Default Value:</span>
<code class="language-javascript">''</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="destroyEvalString">
<a href="#destroyEvalString" class="doc-link"></a>
destroyEvalString<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
销毁时的执行语句,只有在对象销毁时才会执行,方便用来清理随该对象创建时附带创建的资源<br/>
有一个内置变量p,表示当前对象。
注意对象的销毁除了使用destroyEvalString,还可以使用 <a href="XbsjBase.html#disposers"><code>disposers</code></a> 属性来销毁。
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjCzmObj.html#destroyEvalString">XbsjCzmObj#destroyEvalString</a>
</li></dd>
<span class="details-header">Default Value:</span>
<code class="language-javascript">''</code>
<h5>See:</h5>
<ul class="see-list">
<li><a href="XbsjCzmObj.html#evalString">XbsjCzmObj#evalString</a></li>
<li><a href="XbsjCzmObj.html#preUpdateEvalString">XbsjCzmObj#preUpdateEvalString</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="disposers">
<a href="#disposers" class="doc-link"></a>
disposers<span class="type-signature"></span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
用来收集资源销毁函数,并在析构时自动调用!
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#disposers">XbsjBase#disposers</a>
</li></dd>
<h5>Example:</h5>
<pre><code class="language-javascript">// 示例1:
myObject.disposers.push(() => {
// 此处执行需要销毁的资源
});
// 示例2:
// XE.MVVM.bind的返回值是一个函数,作用是用来解除双向绑定,
// 把它的返回值放到disposer中,那么对象销毁时就会执行解绑操作。
myObject.disposers.push(XE.MVVM.bind(xxx));
// 示例3:
// XE.MVVM.watch的返回值是一个函数,作用是用来取消监视,
// 把它的返回值放到disposer中,那么对象销毁时就会执行取消监视的操作。
myObject.disposers.push(XE.MVVM.watch(xxx));</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id="earth">
<a href="#earth" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span>earth<span class="type-signature"> : <a href="Earth.html">Earth</a></span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
返回该对象的所属earth实例
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjObject.html#earth">XbsjObject#earth</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="enabled">
<a href="#enabled" class="doc-link"></a>
enabled<span class="type-signature"> : boolean</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
是否启用
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjObject.html#enabled">XbsjObject#enabled</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="evalString">
<a href="#evalString" class="doc-link"></a>
evalString<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
设置执行语句,<br/>
内部有一个内置的变量p,用来指示当前对象。<br/>
注意evalString每次进行属性设置都会执行一遍,如果evalString中有创建资源,资源需要记录,避免再次执行后销毁不了。<br/>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjCzmObj.html#evalString">XbsjCzmObj#evalString</a>
</li></dd>
<span class="details-header">Default Value:</span>
<code class="language-javascript">''</code>
<h5>Example:</h5>
<pre><code class="language-javascript">myObject.evalString = `
// 技巧1:p是一个内置变量,可以直接使用
if (p._div) { // 技巧2:evalString有可能执行多次,这个地方的判断是避免div重复创建!
return;
}
// 创建div
const div = document.createElement('div');
p._div = div;
// 技巧3:可以通过p.earth来获取earth变量
const earth = p.earth;
`;</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="XbsjCzmObj.html#preUpdateEvalString">XbsjCzmObj#preUpdateEvalString</a></li>
<li><a href="XbsjCzmObj.html#destroyEvalString">XbsjCzmObj#destroyEvalString</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="fragmentShaderSource">
<a href="#fragmentShaderSource" class="doc-link"></a>
fragmentShaderSource<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
片元shader
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="guid">
<a href="#guid" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span>guid<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
对象的唯一标识符<br/>
注意,对象一旦创建,guid不可更改!
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjObject.html#guid">XbsjObject#guid</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="imageUrl">
<a href="#imageUrl" class="doc-link"></a>
imageUrl<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
纹理对应的图像url, 可以是jpg/png/mp4/m3u8格式 <br/>
警告:一旦imageUrl有值,会导致drawCanvas调用失效!因此使用imageUrl之后,就不要再调用drawCanvas了!<br/>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">''</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="indices">
<a href="#indices" class="doc-link"></a>
indices<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
索引数组,必选
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[0, 1, 2]</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="modelMatrix">
<a href="#modelMatrix" class="doc-link"></a>
modelMatrix<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
姿态矩阵,可选,如果modelMatrix有值的话,将忽略position和rotation的设置
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="normals">
<a href="#normals" class="doc-link"></a>
normals<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
法向数组,可选
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="objUrl">
<a href="#objUrl" class="doc-link"></a>
objUrl<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
obj文件url,用来直接载入一个obj文件 <br/>
警告:一旦赋值,positions/normals/sts等属性将不起作用!<br/>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">''</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="pass">
<a href="#pass" class="doc-link"></a>
pass<span class="type-signature"> : number</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
渲染顺次(Cesium.Pass.OPAQUE(7)) <br/>
目前Cesium的渲染顺序有: <br/>
ENVIRONMENT : 0, <br/>
COMPUTE : 1, <br/>
GLOBE : 2, <br/>
TERRAIN_CLASSIFICATION : 3, <br/>
CESIUM_3D_TILE : 4, <br/>
CESIUM_3D_TILE_CLASSIFICATION : 5, <br/>
CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW : 6, <br/>
OPAQUE : 7, <br/>
TRANSLUCENT : 8, <br/>
OVERLAY : 9, <br/>
NUMBER_OF_PASSES : 10 <br/>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">7</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="position">
<a href="#position" class="doc-link"></a>
position<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
位置数组 [经度、纬度、高度] <br/>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[0, 0, 0]</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="positions">
<a href="#positions" class="doc-link"></a>
positions<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
位置数组,必选
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[0, 0, 0, 1, 0, 0, 0, 0.5, 0]</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="preUpdateEvalString">
<a href="#preUpdateEvalString" class="doc-link"></a>
preUpdateEvalString<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
设置每帧执行语句,和evalString的作用类似 <br/>
它有三个内置变量,分别是p, scene, time,分别表示当前对象,Cesium的场景对象scene,Cesium的当前帧的时间time
需要注意的是它会每帧执行一次。
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjCzmObj.html#preUpdateEvalString">XbsjCzmObj#preUpdateEvalString</a>
</li></dd>
<span class="details-header">Default Value:</span>
<code class="language-javascript">‘’</code>
<h5>Example:</h5>
<pre><code class="language-javascript">myObject.preUpdateEvalString = `
// 技巧1:p是一个内置变量,可以直接使用,还有scene,time都可以直接使用
p._angle += 1;
if (p._angle > 360.0) {
p._angle = 0.0;
}
const angle = p._angle;
// drawCanvas时使用angle来改变图像内容
// ...
`;</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="XbsjCzmObj.html#preUpdateEvalString">XbsjCzmObj#preUpdateEvalString</a></li>
<li><a href="XbsjCzmObj.html#destroyEvalString">XbsjCzmObj#destroyEvalString</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="primitiveType">
<a href="#primitiveType" class="doc-link"></a>
primitiveType<span class="type-signature"> : number</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
绘制图元类型 <br/>
WebGLRenderingContext.POINTS 0 <br/>
WebGLRenderingContext.LINES 1 <br/>
WebGLRenderingContext.LINE_LOOP 2 <br/>
WebGLRenderingContext.LINE_STRIP 3 <br/>
WebGLRenderingContext.TRIANGLES 4 <br/>
WebGLRenderingContext.TRIANGLE_STRIP 5 <br/>
WebGLRenderingContext.TRIANGLE_FAN 6 <br/>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">4</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="renderState">
<a href="#renderState" class="doc-link"></a>
renderState<span class="type-signature"> : object</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
WebGL渲染状态 <br />
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">defaultRenderState</code>
<h5>Example:</h5>
<pre><code class="language-javascript">// 默认的WebGL渲染状态如下:
var defaults = {
frontFace : WebGL2RenderingContext.CCW, // WindingOrder.COUNTER_CLOCKWISE,
cull : {
enabled : false,
face : WebGL2RenderingContext.BACK, // CullFace.BACK
},
lineWidth : 1,
polygonOffset : {
enabled : false,
factor : 0,
units : 0
},
scissorTest : {
enabled : false,
rectangle : {
x : 0,
y : 0,
width : 0,
height : 0
}
},
depthRange : {
near : 0,
far : 1
},
depthTest : {
enabled : false,
func : WebGL2RenderingContext.LESS, // DepthFunction.LESS
},
colorMask : {
red : true,
green : true,
blue : true,
alpha : true
},
depthMask : true,
stencilMask : ~0,
blending : {
enabled : false,
color : {
red : 0.0,
green : 0.0,
blue : 0.0,
alpha : 0.0
},
equationRgb : WebGL2RenderingContext.ADD, // BlendEquation.ADD,
equationAlpha : WebGL2RenderingContext.ADD, // BlendEquation.ADD,
functionSourceRgb : WebGL2RenderingContext.ONE, // BlendFunction.ONE,
functionSourceAlpha : WebGL2RenderingContext.ONE, // BlendFunction.ONE,
functionDestinationRgb : WebGL2RenderingContext.ZERO, // BlendFunction.ZERO,
functionDestinationAlpha : WebGL2RenderingContext.ZERO, // BlendFunction.ZERO,
},
stencilTest : {
enabled : false,
frontFunction : WebGL2RenderingContext.ALWAYS, // StencilFunction.ALWAYS,
backFunction : WebGL2RenderingContext.ALWAYS, // StencilFunction.ALWAYS,
reference : 0,
mask : ~0,
frontOperation : {
fail : WebGL2RenderingContext.KEEP, // StencilOperation.KEEP,
zFail : WebGL2RenderingContext.KEEP, // StencilOperation.KEEP,
zPass : WebGL2RenderingContext.KEEP, // StencilOperation.KEEP
},
backOperation : {
fail : WebGL2RenderingContext.KEEP, // StencilOperation.KEEP,
zFail : WebGL2RenderingContext.KEEP, // StencilOperation.KEEP,
zPass : WebGL2RenderingContext.KEEP, // StencilOperation.KEEP
}
},
sampleCoverage : {
enabled : false,
value : 1.0,
invert : false
}
};</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id="rotation">
<a href="#rotation" class="doc-link"></a>
rotation<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
姿态数组 [偏航角、俯仰角、翻转角]
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[0, 0, 0]</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="scale">
<a href="#scale" class="doc-link"></a>
scale<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
缩放数组 [x向缩放、y向缩放、z向缩放]
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">[1, 1, 1]</code>
</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">
</div>
</h4>
</div>
<div class="description">
是否在三维窗口中显示
</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="sts">
<a href="#sts" class="doc-link"></a>
sts<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
纹理坐标数组,可选
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="vertexShaderSource">
<a href="#vertexShaderSource" class="doc-link"></a>
vertexShaderSource<span class="type-signature"> : array</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
顶点shader
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="xbsjGuid">
<a href="#xbsjGuid" class="doc-link"></a>
xbsjGuid<span class="type-signature"> : string|undefined</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
对象的唯一标识符 <br/>
警告:该属性已废弃,请不要使用属性,且禁止修改此属性。<br/>
如果需要获取guid,请通过<a href="XbsjObject.html#guid"><code>guid</code></a>属性来获取。<br/>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjObject.html#xbsjGuid">XbsjObject#xbsjGuid</a>
</li></dd>
<p>
<span class="details-header important">Deprecated:</span>
<span>true</span>
</p>
</dl>
<div class="nameContainer">
<h4 class="name" id="xbsjType">
<a href="#xbsjType" class="doc-link"></a>
<span class="type-signature attribute-readonly">readonly</span>xbsjType<span class="type-signature"> : string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
获取对象的类型信息
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjObject.html#xbsjType">XbsjObject#xbsjType</a>
</li></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id=".getRenderState">
<a href="#.getRenderState" class="doc-link"></a>
<span class="type-signature attribute-static">static</span>Obj.CustomPrimitive.getRenderState<span class="signature">(translucent, closed)</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
用来获得一个renderState
</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>translucent</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">
是否透明(是否开启融合)</td>
</tr>
<tr>
<td class="name"><code>closed</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">
是否封闭(是否不绘制背面)</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="destroy">
<a href="#destroy" class="doc-link"></a>
destroy<span class="signature">()</span> &rarr; <span class="type-signature returnType">undefined</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
销毁对象<br/>
警告:对象一旦销毁不可再次使用!<br/>
警告:挂在场景树上的对象禁止调用destroy方法,只要通过数组函数将其从场景树中移除,就会自动销毁!<br/>
</div>
<h5>Returns:</h5>
<div class="param-desc">
返回undefined
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#destroy">XbsjBase#destroy</a>
</li></dd>
<h5>Example:</h5>
<pre><code class="language-javascript">// 使用范例
// 这样写的好处是,一旦对象销毁,会同时将引用该对象的变量同时置为undefined,防止再次使用。
this._myObject = this._myObject &amp;&amp; this._myObject.destroy();</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id="drawCanvas">
<a href="#drawCanvas" class="doc-link"></a>
drawCanvas<span class="signature">(drawFun)</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
自定义图元会自带一张画布(Canvas),如果需要使用纹理,则可以在这张画布上进行绘制 <br/>
画布的绘制方法参见:https://developer.mozilla.org/zh-CN/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes
</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>drawFun</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">
这是一个回调函数,只有一个参数ctx,指示画布的2DContext</td>
</tr>
</tbody>
</table>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">// 示例1:在画布上绘制几何图形
p.canvasWidth = 512;
p.canvasHeight = 512;
p.drawCanvas(ctx => {
var gradient = ctx.createRadialGradient(256, 256, 0, 256, 256, 256);
gradient.addColorStop(0.1, "rgba(255, 255, 255, 1.0)");
gradient.addColorStop(0.2, "rgba(255, 255, 255, 0.0)");
gradient.addColorStop(0.3, "rgba(255, 255, 255, 0.9)");
gradient.addColorStop(0.5, "rgba(255, 255, 255, 0.0)");
gradient.addColorStop(0.9, "rgba(255, 255, 255, 0.2)");
gradient.addColorStop(1.0, "rgba(255, 255, 255, 1.0)");
ctx.clearRect(0, 0, 512, 512);
ctx.beginPath();
ctx.arc(256, 256, 256, 0, Math.PI * 2, true);
// ctx.fillStyle = "rgb(0, 155, 255)";
ctx.fillStyle = gradient;
ctx.fill();
ctx.restore();
});
// 示例2:加载图像,并绘制到Canvas上
Cesium.Resource.createIfNeeded('./images/city/billboard.png').fetchImage().then(function(image) {
console.log('image loaded!');
p.canvasWidth = image.naturalWidth;
p.canvasHeight = image.naturalHeight;
p.drawCanvas(ctx => {
ctx.clearRect(0, 0, 512, 256);
ctx.drawImage(image, 0, 0);
});
});</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id="flyTo">
<a href="#flyTo" class="doc-link"></a>
flyTo<span class="signature">()</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
飞入该对象
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjCzmObj.html#flyTo">XbsjCzmObj#flyTo</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="isDestroyed">
<a href="#isDestroyed" class="doc-link"></a>
isDestroyed<span class="signature">()</span> &rarr; <span class="type-signature returnType">boolean</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
检查对象是否已被销毁<br/>
警告:对象一旦销毁不可再次使用!仅此函数可以调用!<br/>
</div>
<h5>Returns:</h5>
<div class="param-desc">
对象是否已销毁
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#isDestroyed">XbsjBase#isDestroyed</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="registerEditing">
<a href="#registerEditing" class="doc-link"></a>
registerEditing<span class="signature">()</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
注册编辑状态,自定义图元初始创建时,不具有creating/positionEditing/rotationEditing属性,不能进行交互操作。如果需要此功能,则需要在创建之后调用此方法。
注意:registerEditing调用之前,对象本身不能有creating/positionEditing/rotationEditing属性,如果之前进行了 xxx.positionEditing = true 等操作,需要先删掉!
</div>
<dl class="details">
</dl>
<div class="nameContainer">
<h4 class="name" id="toAllJSON">
<a href="#toAllJSON" class="doc-link"></a>
toAllJSON<span class="signature">()</span> &rarr; <span class="type-signature returnType">object</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
数据整个JSOn对象,包括默认值
</div>
<h5>Returns:</h5>
<div class="param-desc">
创建的JSON数据对象
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#toAllJSON">XbsjBase#toAllJSON</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="toAllJSONStr">
<a href="#toAllJSONStr" class="doc-link"></a>
toAllJSONStr<span class="signature">()</span> &rarr; <span class="type-signature returnType">string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
转化成JSON字符串,输出全部元素
</div>
<h5>Returns:</h5>
<div class="param-desc">
JSON格式化好的字符串
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#toAllJSONStr">XbsjBase#toAllJSONStr</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="toJSON">
<a href="#toJSON" class="doc-link"></a>
toJSON<span class="signature">()</span> &rarr; <span class="type-signature returnType">object</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
转化成一个JSON数据对象 <br/>
注意:每次都会创建一个新对象!
</div>
<h5>Returns:</h5>
<div class="param-desc">
创建的JSON数据对象
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#toJSON">XbsjBase#toJSON</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="toJSONStr">
<a href="#toJSONStr" class="doc-link"></a>
toJSONStr<span class="signature">()</span> &rarr; <span class="type-signature returnType">string</span>
<div class="source-link rightLinks">
</div>
</h4>
</div>
<div class="description">
转化成JSON字符串,默认元素不输出
</div>
<h5>Returns:</h5>
<div class="param-desc">
JSON格式化好的字符串
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a href="XbsjBase.html#toJSONStr">XbsjBase#toJSONStr</a>
</li></dd>
</dl>
<div class="nameContainer">
<h4 class="name" id="xbsjFromJSON">
<a href="#xbsjFromJSON" class="doc-link"></a>
xbsjFromJSON<span class="signature">(jsonObject)</span>
<div class="source-link rightLinks">
</div>
</h4> </div> <div class="description"> 通过JSON数据对象来设置属性 </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>jsonObject</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"> </td> </tr> </tbody> </table> <dl class="details"> <dt class="inherited-from">Inherited From:</dt> <dd class="inherited-from"><ul class="dummy"><li> <a href="XbsjBase.html#xbsjFromJSON">XbsjBase#xbsjFromJSON</a> </li></dd> <h5>Example:</h5> <pre><code class="language-javascript">// 创建一个pin对象 const objConfig = { "name": 'Pin1', "xbsjType": "Pin", "position": [1.9017005694855162, 0.5972477268978722, 488.7695178987821], "near": 300, "show": false, evalString, }; const pin = new XE.Obj.Pin(earth); pin.xbsjFromJSON(objConfig);</code></pre> </dl> </article> </section> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.2</a> </footer> </div> <div class="nav"> <div class="menu"> <input type="text" class="classFilter" id="ClassFilter" placeholder="Search"> <ul id="ClassList"><li data-name="AmbientOcclusionStage"><a href="AmbientOcclusionStage.html">AmbientOcclusionStage</a></li><li data-name="Analyzation"><a href="Analyzation.html">Analyzation</a></li><li data-name="CutFillComputing"><a href="Analyzation.CutFillComputing.html">CutFillComputing</a></li><li data-name="Measurement"><a href="Analyzation.Measurement.html">Measurement</a></li><li data-name="BlackAndWhiteStage"><a href="BlackAndWhiteStage.html">BlackAndWhiteStage</a></li><li data-name="BloomStage"><a href="BloomStage.html">BloomStage</a></li><li data-name="BrightnessStage"><a href="BrightnessStage.html">BrightnessStage</a></li><li data-name="Camera"><a href="Camera.html">Camera</a></li><li data-name="Immersion"><a href="Camera.Immersion.html">Immersion</a></li><li data-name="Interaction"><a href="Camera.Interaction.html">Interaction</a></li><li data-name="Navigator"><a href="Camera.Navigator.html">Navigator</a></li><li data-name="Viewport"><a href="Camera.Viewport.html">Viewport</a></li><li data-name="CameraFlight"><a href="CameraFlight.html">CameraFlight</a></li><li data-name="CameraTrack"><a href="CameraFlight.CameraTrack.html">CameraTrack</a></li><li data-name="CameraView"><a href="CameraView.html">CameraView</a></li><li data-name="Manager"><a href="CameraView.Manager.html">Manager</a></li><li data-name="Status"><a href="CameraView.Status.html">Status</a></li><li data-name="View"><a href="CameraView.View.html">View</a></li><li data-name="DepthOfFieldStage"><a href="DepthOfFieldStage.html">DepthOfFieldStage</a></li><li data-name="Earth"><a href="Earth.html">Earth</a></li><li data-name="Effect"><a href="Effect.html">Effect</a></li><li data-name="ForceSunPos"><a href="Effect.ForceSunPos.html">ForceSunPos</a></li><li data-name="Shadow"><a href="Effect.Shadow.html">Shadow</a></li><li data-name="HTML"><a href="HTML.html">HTML</a></li><li data-name="LensFlareStage"><a href="LensFlareStage.html">LensFlareStage</a></li><li data-name="MapVLayer"><a href="MapVLayer.MapVLayer.html">MapVLayer</a></li><li data-name="MapVRenderer"><a href="MapVRenderer.MapVRenderer.html">MapVRenderer</a></li><li data-name="Misc"><a href="Misc.html">Misc</a></li><li data-name="Debug"><a href="Misc.Debug.html">Debug</a></li><li data-name="MosaicStage"><a href="MosaicStage.html">MosaicStage</a></li><li data-name="MVVM"><a href="MVVM.html">MVVM</a></li><li data-name="NightVisionStage"><a href="NightVisionStage.html">NightVisionStage</a></li><li data-name="Obj"><a href="Obj.html">Obj</a></li><li data-name="CameraVideo"><a href="Obj.CameraVideo.html">CameraVideo</a></li><li data-name="ClassificationPolygon"><a href="Obj.ClassificationPolygon.html">ClassificationPolygon</a></li><li data-name="Outline"><a href="Obj.ClassificationPolygon.Outline.html">Outline</a></li><li data-name="ClippingPlane"><a href="Obj.ClippingPlane.html">ClippingPlane</a></li><li data-name="CustomGroundRectangle"><a href="Obj.CustomGroundRectangle.html">CustomGroundRectangle</a></li><li data-name="CustomPrimitive"><a href="Obj.CustomPrimitive.html">CustomPrimitive</a></li><li data-name="Geometry"><a href="Obj.CustomPrimitive.Geometry.html">Geometry</a></li><li data-name="CutSurface"><a href="Obj.CutSurface.html">CutSurface</a></li><li data-name="FlattenedPolygonCollection"><a href="Obj.FlattenedPolygonCollection.html">FlattenedPolygonCollection</a></li><li data-name="FlattenedPolygon"><a href="Obj.FlattenedPolygonCollection.FlattenedPolygon.html">FlattenedPolygon</a></li><li data-name="Forest"><a href="Obj.Forest.html">Forest</a></li><li data-name="GroundImage"><a href="Obj.GroundImage.html">GroundImage</a></li><li data-name="HeatMap"><a href="Obj.HeatMap.html">HeatMap</a></li><li data-name="Imagery"><a href="Obj.Imagery.html">Imagery</a></li><li data-name="ImageryProvider"><a href="Obj.Imagery.ImageryProvider.html">ImageryProvider</a></li><li data-name="ArcGisMapServerImageryProvider"><a href="Obj.Imagery.ImageryProvider.ArcGisMapServerImageryProvider.html">ArcGisMapServerImageryProvider</a></li><li data-name="GoogleEarthEnterpriseImageryProvider"><a href="Obj.Imagery.ImageryProvider.GoogleEarthEnterpriseImageryProvider.html">GoogleEarthEnterpriseImageryProvider</a></li><li data-name="TileMapServiceImageryProvider"><a href="Obj.Imagery.ImageryProvider.TileMapServiceImageryProvider.html">TileMapServiceImageryProvider</a></li><li data-name="UrlTemplateImageryProvider"><a href="Obj.Imagery.ImageryProvider.UrlTemplateImageryProvider.html">UrlTemplateImageryProvider</a></li><li data-name="WebMapServiceImageryProvider"><a href="Obj.Imagery.ImageryProvider.WebMapServiceImageryProvider.html">WebMapServiceImageryProvider</a></li><li data-name="WebMapTileServiceImageryProvider"><a href="Obj.Imagery.ImageryProvider.WebMapTileServiceImageryProvider.html">WebMapTileServiceImageryProvider</a></li><li data-name="XbsjImageryProvider"><a href="Obj.Imagery.ImageryProvider.XbsjImageryProvider.html">XbsjImageryProvider</a></li><li data-name="Model"><a href="Obj.Model.html">Model</a></li><li data-name="ODLines"><a href="Obj.ODLines.html">ODLines</a></li><li data-name="Path"><a href="Obj.Path.html">Path</a></li><li data-name="Pin"><a href="Obj.Pin.html">Pin</a></li><li data-name="PinBuilder"><a href="Obj.Pin.PinBuilder.html">PinBuilder</a></li><li data-name="PlotBase"><a href="Obj.PlotBase.html">PlotBase</a></li><li data-name="Polygon"><a href="Obj.Polygon.html">Polygon</a></li><li data-name="Outline"><a href="Obj.Polygon.Outline.html">Outline</a></li><li data-name="Polyline"><a href="Obj.Polyline.html">Polyline</a></li><li data-name="Material"><a href="Obj.Polyline.Material.html">Material</a></li><li data-name="Color"><a href="Obj.Polyline.Material.Color.html">Color</a></li><li data-name="PolylineArrow"><a href="Obj.Polyline.Material.PolylineArrow.html">PolylineArrow</a></li><li data-name="PolylineDash"><a href="Obj.Polyline.Material.PolylineDash.html">PolylineDash</a></li><li data-name="PolylineGlow"><a href="Obj.Polyline.Material.PolylineGlow.html">PolylineGlow</a></li><li data-name="PolylineOutline"><a href="Obj.Polyline.Material.PolylineOutline.html">PolylineOutline</a></li><li data-name="XbsjODLine"><a href="Obj.Polyline.Material.XbsjODLine.html">XbsjODLine</a></li><li data-name="Road"><a href="Obj.Road.html">Road</a></li><li data-name="Scanline"><a href="Obj.Scanline.html">Scanline</a></li><li data-name="Surface"><a href="Obj.Surface.html">Surface</a></li><li data-name="Terrain"><a href="Obj.Terrain.html">Terrain</a></li><li data-name="TerrainProvider"><a href="Obj.Terrain.TerrainProvider.html">TerrainProvider</a></li><li data-name="GoogleEarthEnterpriseTerrainProvider"><a href="Obj.Terrain.TerrainProvider.GoogleEarthEnterpriseTerrainProvider.html">GoogleEarthEnterpriseTerrainProvider</a></li><li data-name="XbsjCesiumTerrainProvider"><a href="Obj.Terrain.TerrainProvider.XbsjCesiumTerrainProvider.html">XbsjCesiumTerrainProvider</a></li><li data-name="XbsjEllipsoidTerrainProvider"><a href="Obj.Terrain.TerrainProvider.XbsjEllipsoidTerrainProvider.html">XbsjEllipsoidTerrainProvider</a></li><li data-name="Tileset"><a href="Obj.Tileset.html">Tileset</a></li><li data-name="Viewshed"><a href="Obj.Viewshed.html">Viewshed</a></li><li data-name="Wall"><a href="Obj.Wall.html">Wall</a></li><li data-name="Water"><a href="Obj.Water.html">Water</a></li><li data-name="Picking"><a href="Picking.html">Picking</a></li><li data-name="PolylineVolumeGeometry"><a href="PolylineVolumeGeometry.html">PolylineVolumeGeometry</a></li><li data-name="PostProcess"><a href="PostProcess.html">PostProcess</a></li><li data-name="RotateCenter"><a href="RotateCenter.html">RotateCenter</a></li><li data-name="SceneTree"><a href="SceneTree.html">SceneTree</a></li><li data-name="Group"><a href="SceneTree.Group.html">Group</a></li><li data-name="Leaf"><a href="SceneTree.Leaf.html">Leaf</a></li><li data-name="Node"><a href="SceneTree.Node.html">Node</a></li><li data-name="Tree"><a href="SceneTree.Tree.html">Tree</a></li><li data-name="TerrainEffect"><a href="TerrainEffect.html">TerrainEffect</a></li><li data-name="AspectRamp"><a href="TerrainEffect.AspectRamp.html">AspectRamp</a></li><li data-name="Contour"><a href="TerrainEffect.Contour.html">Contour</a></li><li data-name="ElevationRamp"><a href="TerrainEffect.ElevationRamp.html">ElevationRamp</a></li><li data-name="GlobeTranslucency"><a href="TerrainEffect.GlobeTranslucency.html">GlobeTranslucency</a></li><li data-name="Restrict"><a href="TerrainEffect.Restrict.html">Restrict</a></li><li data-name="SlopeRamp"><a href="TerrainEffect.SlopeRamp.html">SlopeRamp</a></li><li data-name="Weather"><a href="Weather.html">Weather</a></li><li data-name="Atmosphere"><a href="Weather.Atmosphere.html">Atmosphere</a></li><li data-name="Fog"><a href="Weather.Fog.html">Fog</a></li><li data-name="FogPostProcess"><a href="Weather.FogPostProcess.html">FogPostProcess</a></li><li data-name="Moon"><a href="Weather.Moon.html">Moon</a></li><li data-name="Rain"><a href="Weather.Rain.html">Rain</a></li><li data-name="RainPostProcess"><a href="Weather.RainPostProcess.html">RainPostProcess</a></li><li data-name="SkyBox"><a href="Weather.SkyBox.html">SkyBox</a></li><li data-name="Snow"><a href="Weather.Snow.html">Snow</a></li><li data-name="SnowPostProcess"><a href="Weather.SnowPostProcess.html">SnowPostProcess</a></li><li data-name="Sun"><a href="Weather.Sun.html">Sun</a></li><li data-name="WorldCloud"><a href="Weather.WorldCloud.html">WorldCloud</a></li><li data-name="XbsjBase"><a href="XbsjBase.html">XbsjBase</a></li><li data-name="XbsjCzmObj"><a href="XbsjCzmObj.html">XbsjCzmObj</a></li><li data-name="XbsjInteraction"><a href="XbsjInteraction.html">XbsjInteraction</a></li><li data-name="XbsjObject"><a href="XbsjObject.html">XbsjObject</a></li><li data-name="XbsSilhouetteStage"><a href="XbsSilhouetteStage.html">XbsSilhouetteStage</a></li><li data-name="XE"><a href="XE.html">XE</a></li></ul> </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>