Defines an annotation sticky note object.
functionlt.Annotations.Engine.AnnStickyNoteObject
extendslt.Annotations.Engine.AnnObject
implementsIAnnObjectCloneable
classlt.Annotations.Engine.AnnStickyNoteObject()
extendsAnnObject
implementsIAnnObjectCloneable
The sticky note object is aPicturerendered around single point (the center). This point is the first entry in thePointscollection and all others are ignored. This object does not support fill, stroke nor font.
This object supports using theSelectionStrokeand by default when the value ofIsSelectedistrue, it will use the stroke to draw a rectangle around the image instead of using a selection thumb.
With the automated functions, in design mode, the sticky point object is formed with a click or tap event.
Programmatically, the boundaries and location of the sticky note object can be controlled using the following properties: Each object can be transformed with the following methods:
TheAnnStickyNoteObjectclass inherits a number of properties from theAnnObjectclass, it does not support fill, stroke or font by overridesSupportsSelectionStroketo returntrue. The name of the sticky note 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 anAnnStickyNoteObject:
This example creates a sticky note object and adds it to the automation container.
import{EngineHelper } from"../../utilities/EngineHelper";
exportclassAnnObjects_StickyNote {
constructor() {
consthelper =newEngineHelper();
helper.run(this.create);
}
create = (automation: lt.Annotations.Automation.AnnAutomation) => {
// Create a new instance of AnnResources if the automation manager does not already have one
let resources: lt.Annotations.Engine.AnnResources = automation.manager.resources;
if(resources ==null) {
resources =newlt.Annotations.Engine.AnnResources();
automation.manager.resources = resources;
}
// Get the images collection
constimagesResources: lt.Annotations.Engine.AnnPicture[] = resources.images;
// Add our picture to it
imagesResources.push(newlt.Annotations.Engine.AnnPicture("Resources/Objects/StickyNote.png"));
constpictureIndex:number= imagesResources.length - 1;
// assumes _automation is valid
constinch:number= 720.0;
// Add a sticky note object
constannObj: lt.Annotations.Engine.AnnStickyNoteObject =newlt.Annotations.Engine.AnnStickyNoteObject();
// Set the points for the hotspot
annObj.points.add(lt.LeadPointD.create(1 * inch, 1 * inch));
annObj.points.add(lt.LeadPointD.create(2 * inch, 1 * inch));
annObj.points.add(lt.LeadPointD.create(2 * inch, 2 * inch));
annObj.points.add(lt.LeadPointD.create(1 * inch, 2 * inch));
// Set the picture
annObj.defaultPicture = pictureIndex;
// Add the object to the automation container
automation.container.children.add(annObj);
// Select the object
automation.selectObject(annObj);
// Hook to rendering engine loadPicture event to render the container immediately after resources get loaded
automation.manager.renderingEngine.add_loadPicture((sender, e) => {
automation.invalidate(lt.LeadRectD.empty);
});
}
}
exportclassEngineHelper {
// Automation object
protected_automation: lt.Annotations.Automation.AnnAutomation =null;
// Image viewer
protected_viewer: lt.Controls.ImageViewer =null;
constructor() {
/ /设置LEADTOOLS许可证。用你替换这个ur 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_StickyNote {
constructor() {
consthelper =newEngineHelper();
helper.run(this.create);
}
create = (automation) => {
// Create a new instance of AnnResources if the automation manager does not already have one
let resources = automation.manager.resources;
if(resources ==null) {
resources =newlt.Annotations.Engine.AnnResources();
automation.manager.resources = resources;
}
// Get the images collection
constimagesResources = resources.images;
// Add our picture to it
imagesResources.push(newlt.Annotations.Engine.AnnPicture("Resources/Objects/StickyNote.png"));
constpictureIndex = imagesResources.length - 1;
// assumes _automation is valid
constinch = 720.0;
// Add a sticky note object
constannObj =newlt.Annotations.Engine.AnnStickyNoteObject();
// Set the points for the hotspot
annObj.points.add(lt.LeadPointD.create(1 * inch, 1 * inch));
annObj.points.add(lt.LeadPointD.create(2 * inch, 1 * inch));
annObj.points.add(lt.LeadPointD.create(2 * inch, 2 * inch));
annObj.points.add(lt.LeadPointD.create(1 * inch, 2 * inch));
// Set the picture
annObj.defaultPicture = pictureIndex;
// Add the object to the automation container
automation.container.children.add(annObj);
// Select the object
automation.selectObject(annObj);
// Hook to rendering engine loadPicture event to render the container immediately after resources get loaded
automation.manager.renderingEngine.add_loadPicture((sender, e) => {
automation.invalidate(lt.LeadRectD.empty);
});
}
}
exportclassEngineHelper {
// Automation object
_automation =null;
// Image viewer
_viewer =null;
constructor() {
/ /设置LEADTOOLS许可证。用你替换这个ur 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 | AnnStickyNote #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.AnnStickyNote();
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.