在本主题▼< / div >< div id ="inThisTopicDialog" class="hide">

AnnFreehandHotspotObject对象

总结< / div >

定义注释徒手热点对象。

语法< / div >< div id ="mainSourceContainerSyntax">
打印稿< / div >
JavaScript< / div >< / div >
函数lt.Annotations.Engine.AnnFreehandHotspotObject扩展lt.Annotations.Engine.AnnPolylineObject实现了IAnnObjectCloneable
lt.Annotations.Engine.AnnFreehandHotspotObject ()扩展AnnPolylineObject实现了IAnnObjectCloneable
讲话< / div >

徒手热点注释对象被设计为在点集合中绘制的缩放图像,这些点集合创建了连接线序列。如果所有者容器处于设计模式,徒手热点对象将绘制图片。如果容器处于运行模式,徒手热点对象将不会绘制图片。

在运行模式下,对象是透明的,但鼠标指针在对象上时变为手形。属性可以更改写意对象的点集合属性。

通过编程,可以使用以下属性控制写意热点对象的边界和位置:

每个对象都可以通过以下方法进行转换:

AnnFreehandHotspotObject类继承了许多属性AnnObject类,为字体、笔画和填充特性提供支持。下面列出了这些属性:

徒手热点对象的名称可以使用标签属性继承的AnnObject类。对象可以是组注释对象的一部分,也可以是容器对象的一部分。它不能同时是组和容器的一部分。属性的特性也可用于以编程方式设置AnnFreehandHotspotObject

例子< / div >

此示例创建一个徒手热点对象,并将其添加到自动化容器中。

AnnFreehandHotspot.ts< / div >
EngineHelper.ts< / div >
AnnFreehandHotspot.js< / div >
EngineHelper.js< / div >
AnnFreehandHotspot.html< / div >< / div >< div id ="GenericContainerEntry4201" class="GenericContainerEntry">
进口{EngineHelper}来自“. . / . . /工具/ EngineHelper”出口AnnObjects_FreehandHotspot {构造函数() {常量辅助=EngineHelper ();helper.run (共创);create = (automation: lt.Annotations.Automation.AnnAutomation) => {//创建一个新的AnnResources实例,如果自动化管理器还没有let resources: lt.Annotations.Engine.AnnResources = automation.manager.resources;如果(资源= =) {资源=lt.Annotations.Engine.AnnResources ();Automation.manager.resources =资源;//获取图像集合常量imagesResources: lt.Annotations.Engine。AnnPicture[] = resources.images;//添加我们的图片imagesResources.push (lt.Annotations.Engine.AnnPicture (“资源/对象/ Hotspot.png”));常量pictureIndex:数量= imagesResources。长度- 1;常量英寸:数量= 720.0;//添加一个手绘热点对象常量hotspotObj: lt.Annotations.Engine.AnnFreehandHotspotObject =lt.Annotations.Engine.AnnFreehandHotspotObject ();//设置手绘热点点hotspotObj.points.add (lt.LeadPointD。创建(1 * inch, 1 * inch));hotspotObj.points.add (lt.LeadPointD。创建(2 * inch, 2 * inch));hotspotObj.points.add (lt.LeadPointD。创建(1 * inch, 5 * inch));hotspotObj.points.add (lt.LeadPointD。创建(5 * inch, 5 * inch));hotspotObj.points.add (lt.LeadPointD。创建(4 * inch, 2 * inch));hotspotObj.points.add (lt.LeadPointD。创建(5 * inch, 1 * inch));//设置图片hotspotObj.set_defaultPicture (pictureIndex);//设置超链接hotspotObj。超链接=“//m.ahtuanjie.com”//添加对象到自动化容器automation.container.children.add (hotspotObj);//选择对象automation.selectObject (hotspotObj);//与渲染引擎loadPicture事件挂钩,在资源加载后立即渲染容器automation.manager.renderingEngine。add_loadPicture((sender, e) => {automation.invalidate (lt.LeadRectD.empty);});
出口EngineHelper {//自动化对象受保护的_automation: lt.Annotations.Automation.AnnAutomation =//图像查看器受保护的_viewer: lt.Controls.ImageViewer =构造函数() {//设置LEADTOOLS license。用实际的许可证文件替换此文件lt.RasterSupport.setLicenseUri (“https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt”“EVAL”);公共运行(回调?:(automation: lt.Annotations.Automation.AnnAutomation, viewer: lt.Controls.ImageViewer) =>无效):无效//创建查看器常量imageViewerDiv = document.getElementById(“imageViewerDiv”);常量createOptions: lt.Controls.ImageViewerCreateOptions =lt.Controls.ImageViewerCreateOptions (imageViewerDiv);常量查看器:lt.Controls.ImageViewer =lt.Controls.ImageViewer (createOptions);查看器。autoCreateCanvas =真正的._viewer =查看器;// PanZoom交互模式常量panZoom: lt.Controls.ImageViewerPanZoomInteractiveMode =lt.Controls.ImageViewerPanZoomInteractiveMode ();//创建一个使用LEADTOOLS ImageViewer的自动化控制对象实例常量imageViewerAutomationControl: lt.188金宝搏beat体育官网 demo . annotations . imageViewerAutomationControl =lt.188金宝搏beat体育官网Demos.Annotations.ImageViewerAutomationControl ();//附加图像查看器imageViewerAutomationControl。imageViewer =查看器;//设置图像查看器交互模式常量automationInteractiveMode: lt.188金宝搏beat体育官网 demo . annotations . automationInteractiveMode =lt.188金宝搏beat体育官网Demos.Annotations.AutomationInteractiveMode ();automationInteractiveMode。automationControl = imageViewerAutomationControl;//设置图像URL查看器。imageUrl =“http://demo.leadtools.com/images/png/pngimage.png”//使用HTML5渲染引擎创建并设置自动化管理器常量renderingEngine: lt.Annotations.Rendering。AnnHtml5RenderingEngine =lt.Annotations.Rendering.AnnHtml5RenderingEngine ();常量manager: lt.Annotations.Automation.AnnAutomationManager = lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);//创建默认的自动化对象manager.createDefaultObjects ();//添加对象到对象选择元素常量currentobectidselect = document.getElementById(“currentObjectIdSelect”) HTMLSelectElement;//添加PanZoom选项currentObjectIdSelect.options [currentObjectIdSelect.options。长度]=选项(“锅/缩放”lt.Annotations.Engine.AnnObject.none.toString ());常量automationObjCount:数量= manager.objects.count;(设I = 0;i < automationObjCount;我+ +){//获取对象常量automationObj: lt.Annotations.Automation.AnnAutomationObject = manager.objects.item(i);//添加它的名字到选择元素常量名称:字符串= automationObj.name;常量id:字符串= automationObj.id.toString ();currentObjectIdSelect.options [currentObjectIdSelect.options。长度]=选项(名称、id);//钩子到它的变化事件currentObjectIdSelect.addEventListener (“改变”, () => {//获取对象ID常量id:数量=方法(currentObjectIdSelect.options [currentObjectIdSelect.selectedIndex] value);//设置为管理器中的当前对象经理。currentobectid = id;//如果这是“平移/缩放”选项,那么回到平移缩放,否则,设置我们的自动控制如果(id == lt.Annotations.Engine.AnnObject.none) {viewer.defaultInteractiveMode = panZoom;其他的viewer.defaultInteractiveMode = automationInteractiveMode;});//当当前对象ID改变时,我们需要更新我们的select经理。add_currentobectidchanged ((sender, e) => {常量currentObjectId:数量= manager.currentObjectId;(设I = 0;i < currentobectidselect .options.length;我+ +){常量id:数量[我]=方法(currentObjectIdSelect.options value);如果(id === currentobectid) {currentObjectIdSelect。selectedIndex = i;打破});//默认缩放viewer.defaultInteractiveMode = panZoom;//设置自动化(同时创建容器)常量automation: lt.Annotations.Automation.AnnAutomation =lt.Annotations.Automation。AnnAutomation(经理,imageViewerAutomationControl);._automation =自动化;//添加处理程序,当图像大小改变时更新容器大小viewer.itemChanged。Add ((sender, e) => {常量container: lt.Annotations.Engine.AnnContainer = automation.container;容器。size = container.mapper.sizeToContainerCoordinates(viewer.imageSize);//为新图像创建新的canvas数据提供程序常量canvasDataProvider: lt.188金宝搏beat体育官网 demo . annotations . canvasDataProvider =lt.188金宝搏beat体育官网Demos.Annotations.CanvasDataProvider (viewer.activeItem.canvas);imageViewerAutomationControl。automationDataProvider = canvasDataProvider;});//将此自动化设置为活动的自动化._automation。活跃的=真正的常量exampleButton = document.getElementById(“exampleButton”);exampleButton。Onclick = () => {如果(回调)回调(._automation,._viewer);
进口{EngineHelper}来自“. . / . . /工具/ EngineHelper”出口AnnObjects_FreehandHotspot {构造函数(){常量辅助=EngineHelper ();helper.run (共创);Create = (automation) => {//创建一个新的AnnResources实例,如果自动化管理器还没有Let resources = automation.manager.resources;如果(资源= =) {资源=lt.Annotations.Engine.AnnResources ();Automation.manager.resources =资源;//获取图像集合常量imagesResources = resources.images;//添加我们的图片imagesResources.push (lt.Annotations.Engine.AnnPicture (“资源/对象/ Hotspot.png”));常量pictureIndex = imagesResources。长度- 1;常量英寸= 720.0;//添加一个手绘热点对象常量hotspotObj =lt.Annotations.Engine.AnnFreehandHotspotObject ();//设置手绘热点点hotspotObj.points.add (lt.LeadPointD。创建(1 * inch, 1 * inch));hotspotObj.points.add (lt.LeadPointD。创建(2 * inch, 2 * inch));hotspotObj.points.add (lt.LeadPointD。创建(1 * inch, 5 * inch));hotspotObj.points.add (lt.LeadPointD。创建(5 * inch, 5 * inch));hotspotObj.points.add (lt.LeadPointD。创建(4 * inch, 2 * inch));hotspotObj.points.add (lt.LeadPointD。创建(5 * inch, 1 * inch));//设置图片hotspotObj.set_defaultPicture (pictureIndex);//设置超链接hotspotObj。超链接=“//m.ahtuanjie.com”//添加对象到自动化容器automation.container.children.add (hotspotObj);//选择对象automation.selectObject (hotspotObj);//与渲染引擎loadPicture事件挂钩,在资源加载后立即渲染容器automation.manager.renderingEngine。add_loadPicture((sender, e) => {automation.invalidate (lt.LeadRectD.empty);});
出口EngineHelper {//自动化对象_automation =//图像查看器_view =构造函数(){//设置LEADTOOLS license。用实际的许可证文件替换此文件lt.RasterSupport.setLicenseUri (“https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt”“EVAL”);运行(回调){//创建查看器常量imageViewerDiv = document.getElementById(“imageViewerDiv”);常量createOptions =lt.Controls.ImageViewerCreateOptions (imageViewerDiv);常量观众=lt.Controls.ImageViewer (createOptions);查看器。autoCreateCanvas =真正的._viewer =查看器;// PanZoom交互模式常量panZoom =lt.Controls.ImageViewerPanZoomInteractiveMode ();//创建一个使用LEADTOOLS ImageViewer的自动化控制对象实例常量imageViewerAutomationControl =lt.188金宝搏beat体育官网Demos.Annotations.ImageViewerAutomationControl ();//附加图像查看器imageViewerAutomationControl。imageViewer =查看器;//设置图像查看器交互模式常量automationInteractiveMode =lt.188金宝搏beat体育官网Demos.Annotations.AutomationInteractiveMode ();automationInteractiveMode。automationControl = imageViewerAutomationControl;//设置图像URL查看器。imageUrl =“http://demo.leadtools.com/images/png/pngimage.png”//使用HTML5渲染引擎创建并设置自动化管理器常量renderingEngine =lt.Annotations.Rendering.AnnHtml5RenderingEngine ();常量manager = lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);//创建默认的自动化对象manager.createDefaultObjects ();//添加对象到对象选择元素常量currentobectidselect = document.getElementById(“currentObjectIdSelect”);//添加PanZoom选项currentObjectIdSelect.options [currentObjectIdSelect.options。长度]=选项(“锅/缩放”lt.Annotations.Engine.AnnObject.none.toString ());常量automationObjCount = manager.objects.count;(设I = 0;i < automationObjCount;我+ +){//获取对象常量automationObj = manager.objects.item(i);//添加它的名字到选择元素常量name = automationObj.name;常量id = automationObj.id.toString();currentObjectIdSelect.options [currentObjectIdSelect.options。长度]=选项(名称、id);//钩子到它的变化事件currentObjectIdSelect.addEventListener (“改变”, () => {//获取对象ID常量id = parseInt(currentobectidselect .options[currentobectidselect . selectedindex].value);//设置为管理器中的当前对象经理。currentobectid = id;//如果这是“平移/缩放”选项,那么回到平移缩放,否则,设置我们的自动控制如果(id == lt.Annotations.Engine.AnnObject.none) {viewer.defaultInteractiveMode = panZoom;其他的viewer.defaultInteractiveMode = automationInteractiveMode;});//当当前对象ID改变时,我们需要更新我们的select经理。add_currentobectidchanged ((sender, e) => {常量currentobectid = manager. currentobectid;(设I = 0;i < currentobectidselect .options.length;我+ +){常量id = parseInt(currentobectidselect .options[i].value);如果(id === currentobectid) {currentObjectIdSelect。selectedIndex = i;打破});//默认缩放viewer.defaultInteractiveMode = panZoom;//设置自动化(同时创建容器)常量自动化=lt.Annotations.Automation。AnnAutomation(经理,imageViewerAutomationControl);._automation =自动化;//添加处理程序,当图像大小改变时更新容器大小viewer.itemChanged。Add ((sender, e) => {常量Container = automation.container;容器。size = container.mapper.sizeToContainerCoordinates(viewer.imageSize);//为新图像创建新的canvas数据提供程序常量canvasDataProvider =lt.188金宝搏beat体育官网Demos.Annotations.CanvasDataProvider (viewer.activeItem.canvas);imageViewerAutomationControl。automationDataProvider = canvasDataProvider;});//将此自动化设置为活动的自动化._automation。活跃的=真正的常量exampleButton = document.getElementById(“exampleButton”);exampleButton。Onclick = () => {如果(回调)回调(._automation,._viewer);
<!doctype html >< html lang =“en”>AnnObject示例| AnnFreehandHotspot




 AnnFreehandHotspot< >头< script src =“https://code.jquery.com/jquery-2.2.4.min.js”诚信=“sha256-BbhdlvQf / xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44 = "crossorigin =“匿名”> < /脚本>< script src =“. . / . . / LT / Leadtools.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Controls.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Engine.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Designers.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Rendering.Javascript.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.Automation.js”> < /脚本>< script src =“. . / . . / LT / Leadtools.Annotations.BatesStamp.js”> < /脚本>< script src =“. . / . . / LT / Le188金宝搏beat体育官网adtools.Demos.js”> < /脚本>< script src =“. . / . . / LT / Le188金宝搏beat体育官网adtools.Demos.Annotations.js”> < /脚本><时尚># imageViewerDiv {边框:1px实体#000000;宽度:800 px;身高:800 px;background - color: # 7 f7f7f;> < /风格<!——所有的演示文件都被捆绑并附加到窗口——>< script src =“. . / . . / bundle.js”类型=“text / javascript”> < /脚本>> < /头身体< >

任意缩放或注释模式。在注释模式下,绘制

< div ><选择id =“currentObjectIdSelect”> < /选择>< / div >< div >< input type =“按钮”id =“exampleButton”值=“例子”/><标签id =“exampleLabel”/>< / div >< div id =“imageViewerDiv”/>身体< / >< >脚本窗口。Onload = () =>window.examples.AnnObjects.AnnFreehandHotspot ();> < /脚本< / html >
需求< / div >目标平台
帮助版本21.0.2021.6.30< / div ><!--BEGIN Copyright notice--> 188金宝搏的网址客服|支持|联系我们|知识产权公告
©1991 - 2021领德科技有限公司版权所有。<!--END Copyright notice-->
Leadtools.Annotations.Engine组装< / div >