AnnPointObject Object

总结

Defines an annotation point object.

Syntax
TypeScript
JavaScript
functionlt.Annotations.Engine.AnnPointObjectextendslt.Annotations.Engine.AnnObjectimplementsIAnnObjectCloneable
classlt.Annotations.Engine.AnnPointObject()extendsAnnObjectimplementsIAnnObjectCloneable
Remarks

The point object is a single point. This object works in two ways: If the value ofShowPictureis true; this object draws the picture inPicturewithCenterPointas the center point.AnnObject.Fill,AnnObject.StrokeandRadiuswill be ignored. IfShowPictureis false; this object will draw an ellipse usingStrokeandRadiusaroundCenterPoint.

With the automated functions, in design mode, each point is formed with a click or tap event.

Programmatically, the boundaries and location of the point object can be controlled using the following properties:

Each object can be transformed with the following methods:

TheAnnPointObjectclass inherits a number of properties from theAnnObjectclass, providing support for font, stroke and fill characteristics. These properties are listed below:

The name of the point object can be controlled usingLabelsproperty, inherited from theAnnObjectclass. An object can be part of a group annotation object or part of a container object. It cannot be part of both a group and a container at the same time. The following properties can also be used to programmatically set characteristics of anAnnPointObject:

Example

This example creates a point object and adds it to the automation container.

AnnPoint.ts
EngineHelper.ts
AnnPoint.js
EngineHelper.js
AnnPoint.html
import{ EngineHelper } from"../../utilities/EngineHelper";exportclassAnnObjects_Point {constructor() {consthelper =newEngineHelper();helper.run(this.create);}create = (automation: lt.Annotations.Automation.AnnAutomation) => {constinch:number= 720.0;// Add a point objectconstpointObj: lt.Annotations.Engine.AnnPointObject =newlt.Annotations.Engine.AnnPointObject ();// Set the point for the pointerpointObj.centerPoint = lt.LeadPointD.create(1 * inch, 1 * inch);// Set the radiuspointObj.radius = lt.LeadLengthD.create(75);// Hide the picturepointObj.showPicture =false;// Add the object to the automation containerautomation.container.children.add(pointObj);// Select the objectautomation.selectObject(pointObj);}}
exportclassEngineHelper {// Automation objectprotected_automation: lt.Annotations.Automation.AnnAutomation =null;// Image viewerprotected_viewer: lt.Controls.ImageViewer =null;constructor() {// Set the LEADTOOLS license. Replace this with your actual license filelt.RasterSupport.setLicenseUri("https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt","EVAL",null);}publicrun(callback?: (automation: lt.Annotations.Automation.AnnAutomation, viewer: lt.Controls.ImageViewer) =>void):void{// Create the viewerconstimageViewerDiv = document.getElementById("imageViewerDiv");constcreateOptions: lt.Controls.ImageViewerCreateOptions =newlt.Controls.ImageViewerCreateOptions(imageViewerDiv);constviewer: lt.Controls.ImageViewer =newlt.Controls.ImageViewer(createOptions);viewer.autoCreateCanvas =true;this._viewer = viewer;// PanZoom interactive modeconstpanZoom: lt.Controls.ImageViewerPanZoomInteractiveMode =newlt.Controls.ImageViewerPanZoomInteractiveMode();// Create an instance of the Automation control object that works with LEADTOOLS ImageViewerconstimageViewerAutomationControl: lt.Demos.Annotations.ImageViewerAutomationControl =newlt.Demos.Annotations.ImageViewerAutomationControl();// Attach our image viewerimageViewerAutomationControl.imageViewer = viewer;// Set the image viewer interactive modeconstautomationInteractiveMode: lt.Demos.Annotations.AutomationInteractiveMode =newlt.Demos.Annotations.AutomationInteractiveMode();automationInteractiveMode.automationControl = imageViewerAutomationControl;// Set the image URLviewer.imageUrl ="http://demo.leadtools.com/images/png/pngimage.png";// Create and set up the automation manager using the HTML5 rendering engineconstrenderingEngine: lt.Annotations.Rendering.AnnHtml5RenderingEngine =newlt.Annotations.Rendering.AnnHtml5RenderingEngine();constmanager: lt.Annotations.Automation.AnnAutomationManager = lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);// Create default automation objectsmanager.createDefaultObjects();// Add the objects to the objects select elementconstcurrentObjectIdSelect = document.getElementById("currentObjectIdSelect") as HTMLSelectElement;// Add the PanZoom optioncurrentObjectIdSelect.options[currentObjectIdSelect.options.length] =newOption("Pan/Zoom", lt.Annotations.Engine.AnnObject.none.toString());constautomationObjCount:number= manager.objects.count;for(let i = 0; i < automationObjCount; i++) {// Get the objectconstautomationObj: lt.Annotations.Automation.AnnAutomationObject = manager.objects.item(i);// Add its name to the select elementconstname:string= automationObj.name;constid:string= automationObj.id.toString();currentObjectIdSelect.options[currentObjectIdSelect.options.length] =newOption(name, id);}// Hook to its change eventcurrentObjectIdSelect.addEventListener("change", () => {// Get the object IDconstid:number= parseInt(currentObjectIdSelect.options[currentObjectIdSelect.selectedIndex].value);// Set it as the current object in the managermanager.currentObjectId = id;// If this is the "Pan/Zoom" option, then back to pan zoom, otherwise, set our automation controlif(id == lt.Annotations.Engine.AnnObject.none) {viewer.defaultInteractiveMode = panZoom;}else{viewer.defaultInteractiveMode = automationInteractiveMode;}});// When the current object ID changes, we need to update our selectmanager.add_currentObjectIdChanged((sender, e) => {constcurrentObjectId:number= manager.currentObjectId;for(let i = 0; i < currentObjectIdSelect.options.length; i++) {constid:number= parseInt(currentObjectIdSelect.options[i].value);if(id === currentObjectId) {currentObjectIdSelect.selectedIndex = i;break;}}});// Pan zoom by defaultviewer.defaultInteractiveMode = panZoom;// set up the automation (will create the container as well)constautomation: lt.Annotations.Automation.AnnAutomation =newlt.Annotations.Automation.AnnAutomation(manager, imageViewerAutomationControl);this._automation = automation;// Add handler to update the container size when the image size changesviewer.itemChanged.add((sender, e) => {constcontainer: lt.Annotations.Engine.AnnContainer = automation.container;container.size = container.mapper.sizeToContainerCoordinates(viewer.imageSize);//Create new canvas data provider for the new imageconstcanvasDataProvider: lt.Demos.Annotations.CanvasDataProvider =newlt.Demos.Annotations.CanvasDataProvider(viewer.activeItem.canvas);imageViewerAutomationControl.automationDataProvider = canvasDataProvider;});// set up this automation as the active onethis._automation.active =true;constexampleButton = document.getElementById("exampleButton");exampleButton.onclick = () => {if(callback)callback(this._automation,this._viewer);}}}
import{ EngineHelper } from"../../utilities/EngineHelper";exportclassAnnObjects_Point {constructor() {consthelper =newEngineHelper();helper.run(this.create);}create = (automation) => {constinch = 720.0;// Add a point objectconstpointObj =newlt.Annotations.Engine.AnnPointObject ();// Set the point for the pointerpointObj.centerPoint = lt.LeadPointD.create(1 * inch, 1 * inch);// Set the radiuspointObj.radius = lt.LeadLengthD.create(75);// Hide the picturepointObj.showPicture =false;// Add the object to the automation containerautomation.container.children.add(pointObj);// Select the objectautomation.selectObject(pointObj);}}
exportclassEngineHelper {// Automation object_automation =null;// Image viewer_viewer =null;constructor() {// Set the LEADTOOLS license. Replace this with your actual license filelt.RasterSupport.setLicenseUri("https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt","EVAL",null);}run(callback) {// Create the viewerconstimageViewerDiv = document.getElementById("imageViewerDiv");constcreateOptions =newlt.Controls.ImageViewerCreateOptions(imageViewerDiv);constviewer =newlt.Controls.ImageViewer(createOptions);viewer.autoCreateCanvas =true;this._viewer = viewer;// PanZoom interactive modeconstpanZoom =newlt.Controls.ImageViewerPanZoomInteractiveMode();// Create an instance of the Automation control object that works with LEADTOOLS ImageViewerconstimageViewerAutomationControl =newlt.Demos.Annotations.ImageViewerAutomationControl();// Attach our image viewerimageViewerAutomationControl.imageViewer = viewer;// Set the image viewer interactive modeconstautomationInteractiveMode =newlt.Demos.Annotations.AutomationInteractiveMode();automationInteractiveMode.automationControl = imageViewerAutomationControl;// Set the image URLviewer.imageUrl ="http://demo.leadtools.com/images/png/pngimage.png";// Create and set up the automation manager using the HTML5 rendering engineconstrenderingEngine =newlt.Annotations.Rendering.AnnHtml5RenderingEngine();constmanager = lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);// Create default automation objectsmanager.createDefaultObjects();// Add the objects to the objects select elementconstcurrentObjectIdSelect = document.getElementById("currentObjectIdSelect");// Add the PanZoom optioncurrentObjectIdSelect.options[currentObjectIdSelect.options.length] =newOption("Pan/Zoom", lt.Annotations.Engine.AnnObject.none.toString());constautomationObjCount = manager.objects.count;for(let i = 0; i < automationObjCount; i++) {// Get the objectconstautomationObj = manager.objects.item(i);// Add its name to the select elementconstname = automationObj.name;constid = automationObj.id.toString();currentObjectIdSelect.options[currentObjectIdSelect.options.length] =newOption(name, id);}// Hook to its change eventcurrentObjectIdSelect.addEventListener("change", () => {// Get the object IDconstid = parseInt(currentObjectIdSelect.options[currentObjectIdSelect.selectedIndex].value);// Set it as the current object in the managermanager.currentObjectId = id;// If this is the "Pan/Zoom" option, then back to pan zoom, otherwise, set our automation controlif(id == lt.Annotations.Engine.AnnObject.none) {viewer.defaultInteractiveMode = panZoom;}else{viewer.defaultInteractiveMode = automationInteractiveMode;}});// When the current object ID changes, we need to update our selectmanager.add_currentObjectIdChanged((sender, e) => {constcurrentObjectId = manager.currentObjectId;for(let i = 0; i < currentObjectIdSelect.options.length; i++) {constid = parseInt(currentObjectIdSelect.options[i].value);if(id === currentObjectId) {currentObjectIdSelect.selectedIndex = i;break;}}});// Pan zoom by defaultviewer.defaultInteractiveMode = panZoom;// set up the automation (will create the container as well)constautomation =newlt.Annotations.Automation.AnnAutomation(manager, imageViewerAutomationControl);this._automation = automation;// Add handler to update the container size when the image size changesviewer.itemChanged.add((sender, e) => {constcontainer = automation.container;container.size = container.mapper.sizeToContainerCoordinates(viewer.imageSize);//Create new canvas data provider for the new imageconstcanvasDataProvider =newlt.Demos.Annotations.CanvasDataProvider(viewer.activeItem.canvas);imageViewerAutomationControl.automationDataProvider = canvasDataProvider;});// set up this automation as the active onethis._automation.active =true;constexampleButton = document.getElementById("exampleButton");exampleButton.onclick = () => {if(callback)callback(this._automation,this._viewer);}}}
"en">AnnObject Example | AnnPoint




Either Pan/Zoom or Annotations mode. In annotations mode, drawnewobjects or edit them.

"button"id="exampleButton"value="Example"/>
"imageViewerDiv"/>
Requirements
Target Platforms
Leadtools.Annotations.Engine Assembly
188金宝搏的网址客服|Support|Contact Us|Intellectual Property Notices
© 1991-2021LEAD Technologies, Inc.All Rights Reserved.