截屏批注
<h1>截屏批注</h1>
<h2>类说明</h2>
<ul>
<li><code>Annotation</code> 截屏批注工具类</li>
<li><code>AnnotationConfig</code> 截屏批注工具类的配置类</li>
</ul>
<h2>BCore2DFast.Extension2D.AnnotationConfig</h2>
<h3>构造</h3>
<pre><code class="language-javascript">new BCore2DFast.Extension2D.AnnotationConfig(viewer2D)</code></pre>
<h3>成员</h3>
<ul>
<li><strong>viewer2D</strong>: <code>BCore2DFast.Viewer.Viewer2D</code> - viewer 实例</li>
</ul>
<h2>BCore2DFast.Extension2D.Annotation</h2>
<h3>构造</h3>
<pre><code class="language-javascript">new BCore2DFast.Extension2D.Annotation(config)</code></pre>
<h3>参数</h3>
<ul>
<li><strong>config</strong>: <code>BCore2DFast.Extension2D.AnnotationConfig</code> — 截屏批注工具类配置参数</li>
<li><strong>isAutoSavePostilScreenShot</strong>: 点击保存按钮时,是否自动下载图片</li>
<li><strong>isShowMessage</strong>: 是否显示提示语</li>
</ul>
<h3>方法示例</h3>
<h4>1.开启/关闭批注</h4>
<ul>
<li><strong>接口</strong>:
<code>beginPostil()</code> 开启批注
<code>endPostil()</code> 关闭批注</li>
<li><strong>示例</strong>:
<pre><code class="language-javascript">var annotation = new BCore2DFast.Extension2D.Annotation(new BCore2DFast.Extension2D.AnnotationConfig(viewer2D));
annotation.beginPostil(); //开启批注
...
annotation.endPostil(); 关闭批注</code></pre></li>
</ul>
<h4>2.生成批注截图</h4>
<ul>
<li>
<p><strong>接口</strong>:
<code>getPostilScreenShot()</code></p>
<ul>
<li>返回值:
<strong>shotImage</strong>: <code>String</code> — 截图的 Base64 字符串</li>
</ul>
</li>
<li><strong>示例</strong>:
<pre><code class="language-javascript">var annotationConfig = new BCore2DFast.Extension2D.AnnotationConfig(viewer2D);
var annotation = new BCore2DFast.Extension2D.Annotation(annotationConfig);
annotation.beginPostil();
let shotImage = annotation.getPostilScreenShot();</code></pre>
<h4>3.获取/设置批注配置信息</h4></li>
<li>
<p><strong>接口</strong>:
<code>getPostilConfig()</code> 获取批注配置信息
<code>setPostilConfig(config)</code> 设置批注配置信息</p>
<ul>
<li>返回值:
<strong>config</strong>: <code>object</code> — 配置信息</li>
</ul>
</li>
<li><strong>示例</strong>:
<pre><code class="language-javascript">let annotationConfig = new BCore2DFast.Extension2D.AnnotationConfig(viewer2D);
let annotation = new BCore2DFast.Extension2D.Annotation(annotationConfig);
let config = annotation.getPostilConfig(); //获取批注配置信息
//设置批注信息
config = { isAutoSavePostilScreenShot: false, isShowMessage: false }
annotation.setPostilConfig(config);</code></pre></li>
</ul>
<h4>4.获取批注步骤记录</h4>
<ul>
<li>
<p><strong>接口</strong>:
<code>getPostilRecord()</code> 获取批注步骤记录
<code>setPostilRecord(jsonstring)</code> 恢复批注步骤记录</p>
<ul>
<li>返回值:</li>
<li><strong>jsonStr</strong>: <code>string</code> — 步骤 Json 字符串</li>
</ul>
</li>
<li><strong>示例</strong>:
<pre><code class="language-javascript">let annotationConfig = new BCore2DFast.Extension2D.AnnotationConfig(viewer2D);
let annotation = new BCore2DFast.Extension2D.Annotation(annotationConfig);
annotation.beginPostil();
let str = annotation.getPostilRecord(); //获取批注步骤记录
//draw something
annotation.setPostilRecord(str); //恢复批注步骤记录</code></pre>
<hr /></li>
</ul>
<p>可以根据需要,按照上述示例进行调用和配置,使得批注功能更贴合实际应用场景</p>