Defines an annotation point object.
functionlt.Annotations.Engine.AnnPointObject
extendslt.Annotations.Engine.AnnObject
implementsIAnnObjectCloneable
classlt.Annotations.Engine.AnnPointObject()
extendsAnnObject
implementsIAnnObjectCloneable
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:
This example creates a point object and adds it to the automation container.
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 object
constpointObj: lt.Annotations.Engine.AnnPointObject =newlt.Annotations.Engine.AnnPointObject ();
// Set the point for the pointer
pointObj.centerPoint = lt.LeadPointD.create(1 * inch, 1 * inch);
// Set the radius
pointObj.radius = lt.LeadLengthD.create(75);
// Hide the picture
pointObj.showPicture =false;
// Add the object to the automation container
automation.container.children.add(pointObj);
// Select the object
automation.selectObject(pointObj);
}
}
exportclassEngineHelper {
// Automation object
protected_automation: lt.Annotations.Automation.AnnAutomation =null;
// Image viewer
protected_viewer: lt.Controls.ImageViewer =null;
constructor() {
// Set the LEADTOOLS license. Replace this with your actual license file
lt.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 viewer
constimageViewerDiv = 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 mode
constpanZoom: lt.Controls.ImageViewerPanZoomInteractiveMode =newlt.Controls.ImageViewerPanZoomInteractiveMode();
// Create an instance of the Automation control object that works with LEADTOOLS ImageViewer
constimageViewerAutomationControl: lt.Demos.Annotations.ImageViewerAutomationControl =newlt.Demos.Annotations.ImageViewerAutomationControl();
// Attach our image viewer
imageViewerAutomationControl.imageViewer = viewer;
// Set the image viewer interactive mode
constautomationInteractiveMode: lt.Demos.Annotations.AutomationInteractiveMode =newlt.Demos.Annotations.AutomationInteractiveMode();
automationInteractiveMode.automationControl = imageViewerAutomationControl;
// Set the image URL
viewer.imageUrl ="http://demo.leadtools.com/images/png/pngimage.png";
// Create and set up the automation manager using the HTML5 rendering engine
constrenderingEngine: lt.Annotations.Rendering.AnnHtml5RenderingEngine =newlt.Annotations.Rendering.AnnHtml5RenderingEngine();
constmanager: lt.Annotations.Automation.AnnAutomationManager = lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);
// Create default automation objects
manager.createDefaultObjects();
// Add the objects to the objects select element
constcurrentObjectIdSelect = document.getElementById("currentObjectIdSelect") as HTMLSelectElement;
// Add the PanZoom option
currentObjectIdSelect.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 object
constautomationObj: lt.Annotations.Automation.AnnAutomationObject = manager.objects.item(i);
// Add its name to the select element
constname:string= automationObj.name;
constid:string= automationObj.id.toString();
currentObjectIdSelect.options[currentObjectIdSelect.options.length] =newOption(name, id);
}
// Hook to its change event
currentObjectIdSelect.addEventListener("change", () => {
// Get the object ID
constid:number= parseInt(currentObjectIdSelect.options[currentObjectIdSelect.selectedIndex].value);
// Set it as the current object in the manager
manager.currentObjectId = id;
// If this is the "Pan/Zoom" option, then back to pan zoom, otherwise, set our automation control
if(id == lt.Annotations.Engine.AnnObject.none) {
viewer.defaultInteractiveMode = panZoom;
}
else{
viewer.defaultInteractiveMode = automationInteractiveMode;
}
});
// When the current object ID changes, we need to update our select
manager.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 default
viewer.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 changes
viewer.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 image
constcanvasDataProvider: lt.Demos.Annotations.CanvasDataProvider =newlt.Demos.Annotations.CanvasDataProvider(viewer.activeItem.canvas);
imageViewerAutomationControl.automationDataProvider = canvasDataProvider;
});
// set up this automation as the active one
this._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 object
constpointObj =newlt.Annotations.Engine.AnnPointObject ();
// Set the point for the pointer
pointObj.centerPoint = lt.LeadPointD.create(1 * inch, 1 * inch);
// Set the radius
pointObj.radius = lt.LeadLengthD.create(75);
// Hide the picture
pointObj.showPicture =false;
// Add the object to the automation container
automation.container.children.add(pointObj);
// Select the object
automation.selectObject(pointObj);
}
}
exportclassEngineHelper {
// Automation object
_automation =null;
// Image viewer
_viewer =null;
constructor() {
// Set the LEADTOOLS license. Replace this with your actual license file
lt.RasterSupport.setLicenseUri("https://demo.leadtools.com/licenses/v200/LEADTOOLSEVAL.txt","EVAL",null);
}
run(callback) {
// Create the viewer
constimageViewerDiv = document.getElementById("imageViewerDiv");
constcreateOptions =newlt.Controls.ImageViewerCreateOptions(imageViewerDiv);
constviewer =newlt.Controls.ImageViewer(createOptions);
viewer.autoCreateCanvas =true;
this._viewer = viewer;
// PanZoom interactive mode
constpanZoom =newlt.Controls.ImageViewerPanZoomInteractiveMode();
// Create an instance of the Automation control object that works with LEADTOOLS ImageViewer
constimageViewerAutomationControl =newlt.Demos.Annotations.ImageViewerAutomationControl();
// Attach our image viewer
imageViewerAutomationControl.imageViewer = viewer;
// Set the image viewer interactive mode
constautomationInteractiveMode =newlt.Demos.Annotations.AutomationInteractiveMode();
automationInteractiveMode.automationControl = imageViewerAutomationControl;
// Set the image URL
viewer.imageUrl ="http://demo.leadtools.com/images/png/pngimage.png";
// Create and set up the automation manager using the HTML5 rendering engine
constrenderingEngine =newlt.Annotations.Rendering.AnnHtml5RenderingEngine();
constmanager = lt.Annotations.Automation.AnnAutomationManager.create(renderingEngine);
// Create default automation objects
manager.createDefaultObjects();
// Add the objects to the objects select element
constcurrentObjectIdSelect = document.getElementById("currentObjectIdSelect");
// Add the PanZoom option
currentObjectIdSelect.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 object
constautomationObj = manager.objects.item(i);
// Add its name to the select element
constname = automationObj.name;
constid = automationObj.id.toString();
currentObjectIdSelect.options[currentObjectIdSelect.options.length] =newOption(name, id);
}
// Hook to its change event
currentObjectIdSelect.addEventListener("change", () => {
// Get the object ID
constid = parseInt(currentObjectIdSelect.options[currentObjectIdSelect.selectedIndex].value);
// Set it as the current object in the manager
manager.currentObjectId = id;
// If this is the "Pan/Zoom" option, then back to pan zoom, otherwise, set our automation control
if(id == lt.Annotations.Engine.AnnObject.none) {
viewer.defaultInteractiveMode = panZoom;
}
else{
viewer.defaultInteractiveMode = automationInteractiveMode;
}
});
// When the current object ID changes, we need to update our select
manager.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 default
viewer.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 changes
viewer.itemChanged.add((sender, e) => {
constcontainer = automation.container;
container.size = container.mapper.sizeToContainerCoordinates(viewer.imageSize);
//Create new canvas data provider for the new image
constcanvasDataProvider =newlt.Demos.Annotations.CanvasDataProvider(viewer.activeItem.canvas);
imageViewerAutomationControl.automationDataProvider = canvasDataProvider;
});
// set up this automation as the active one
this._automation.active =true;
constexampleButton = document.getElementById("exampleButton");
exampleButton.onclick = () => {
if(callback)
callback(this._automation,this._viewer);
}
}
}
"en">
AnnObject Example | AnnPoint #imageViewerDiv {
border: 1px solid #000000;
width: 800px;
height: 800px;
background-color: #7F7F7F;
}
Either Pan/Zoom or Annotations mode. In annotations mode, drawnewobjects or edit them.
"button"id="exampleButton"value="Example"/>
"imageViewerDiv"/>window.onload = () =>newwindow.examples.AnnObjects.AnnPoint();
Help Collections
Raster.NET|C API|C++ Class Library|HTML5 JavaScript
Document.NET|C API|C++ Class Library|HTML5 JavaScript
Medical.NET|C API|C++ Class Library|HTML5 JavaScript
Medical Web Viewer.NET
188宝金博怎么下载
Media Foundation.NET|C API|Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.