Provides methods for converting values between display, annotations and image coordinates.
function lt.Annotations.Core.AnnContainerMapper
class lt.Annotations.Core.AnnContainerMapper()
AnnContainerMapper is used for converting values between display, annotations and image coordinates.
In LEADTOOLS Annotations, all the values are stored in annotations units (1/720 of an inch). For example, when you create a new container and you must set its size; you may write code like this:
var inch = 720.0;
// Create a new annotation container
var container = new Leadtools.Annotations.Core.AnnContainer();
// Set its size to 8.5 by 11 inches. Size must be in annotation units (1/720 of an inch)
container.set_size(Leadtools.LeadSizeD.create(8.5 * inch, 11 * inch));
Similarly, when you create an annotation object and set its location and size, these values must be in annotation coordinates as well:
// Create a line object from 1, 1 to 2, 2 inches:
var lineObj = new Leadtools.Annotations.Core.AnnPolylineObject();
lineObj.get_points().add(Leadtools.LeadPointD.create(1 * inch, 1 * inch));
lineObj.get_points().add(Leadtools.LeadPointD.create(2 * inch, 2 * inch));
In automation mode, the user typically draws an annotation object with the mouse or touches the screen using physical screen coordinates. These coordinates must then be transformed to annotation units. To perform this, the mapper needs to know the values of the screen DPI (Dots per Inch). The user must set these values in SourceDpiX and SourceDpiY.
Similarly, when an object is rendered to a target context, the container mapper needs to know the values for the context (or image, during a burn operation) DPI. You must set these values in TargetDpiX and TargetDpiY.
When converting between font size and fixed length and size values between annotation and display coordinates, the mapper will use the values of DeviceDpiX and DeviceDpiY.
To set the DPI values, use MapResolutions. For example, if the current screen resolution is 96 and the container is associated with an image at 300 DPI then you can use the following code:
container.mapResolutions(96, 96, 300, 300);
In cases when the target DPI value is unknown or must be calculated at runtime, such as in the case of medical applications, you can use the Calibrate method to adjust the ratio between the source and target resolution based on a provided known value. The resulting calibration value is stored in CalibrationScale and used by this container throughout.
To render the container to a destination context, a transformation matrix might also be required to perform such operations as scroll and zoom. You can set the value of this matrix in Transform, using the UpdateTransform method.
The mapper can now use all the values above to perform the following:
Convert values from display to container coordinates using PointToContainerCoordinates, PointsToContainerCoordinates, LengthToContainerCoordinates, RectToContainerCoordinates, SizeToContainerCoordinates and FontToContainerCoordinates
Convert values from container to display coordinates using PointFromContainerCoordinates, PointsFromContainerCoordinates, LengthFromContainerCoordinates, RectFromContainerCoordinates, SizeFromContainerCoordinates and FontFromContainerCoordinates
For an example, refer to AnnContainer.Mapper.
Products |
Support |
Feedback: AnnContainerMapper Object - Leadtools.Annotations.Core |
Introduction |
Help Version 19.0.2017.3.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
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.