public AnnContainerMapper Mapper { get; set; }
@property (nonatomic) LTAnnContainerMapper* mapper;
public AnnContainerMapper getMapper()
public void setMapper(AnnContainerMapper mapper)
public:
property AnnContainerMapper^ Mapper
{
AnnContainerMapper^ get()
void set(AnnContainerMapper^ value)
}
Mapper # get and set (AnnObject)
The mapper for this AnnObject. The default value is the object created by AnnContainerMapper.CreateDefault.
The mapper is used by this AnnObject when converting display, container and image coordinates. For more information, refer to AnnContainerMapper.
If you set the value of this property to null, then this container will use an object created from AnnContainerMapper.CreateDefault instead. Therefore, you will always get a valid object when querying the value of this property.
This example will use the mapper to convert a rectangle value from annotation to image units and back.
using Leadtools.Annotations.Automation;
using Leadtools.Annotations.Engine;
using Leadtools.Codecs;
using Leadtools.Annotations.WinForms;
public void AnnContainer_Mapper()
{
double inch = 720.0;
// Create a new annotation container, 8.5 by 11 inches
AnnContainer container = new AnnContainer();
// Size must be in annotation units (1/720 of an inch)
container.Size = LeadSizeD.Create(8.5 * inch, 11 * inch);
// Set its mapper, assuming the screen DPI is 96 and the image DPI is 300
container.Mapper = new AnnContainerMapper(96, 96, 300, 300);
// Add a blue on yellow rectangle from 3in 3in to 4in 4in
AnnRectangleObject rectObj = new AnnRectangleObject();
rectObj.Rect = LeadRectD.Create(3 * inch, 3 * inch, 1 * inch, 1 * inch);
rectObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(1));
rectObj.Fill = AnnSolidColorBrush.Create("Yellow");
container.Children.Add(rectObj);
// Get the rectangle in annotations units
LeadRectD rc = rectObj.Rect;
Debug.WriteLine("Annotations units: " + rc.X + "," + rc.Y + "," + rc.Width + "," + rc.Height);
// Convert it to image coordinates
rc = container.Mapper.RectFromContainerCoordinates(rc, AnnFixedStateOperations.None);
Debug.WriteLine("Image units (pixels): " + rc.X + "," + rc.Y + "," + rc.Width + "," + rc.Height);
// If this container is used with an image, you can use the pixels values above to find the exact value on the image
// Convert it to back to annotations units
rc = container.Mapper.RectToContainerCoordinates(rc);
Debug.WriteLine("Original units: " + rc.X + "," + rc.Y + "," + rc.Width + "," + rc.Height);
}
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.annotations.engine.*;
public void annContainerMapperExample() {
double inch = 720.0;
// create a new annotation container, 8.5 by 11 inches
AnnContainer container = new AnnContainer();
// Size must be in annotation units (1/720 of an inch)
container.setSize(LeadSizeD.create(8.5 * inch, 11 * inch));
// Set its mapper, assuming the screen DPI is 96 and the image DPI is 300
container.setMapper(new AnnContainerMapper(96, 96, 300, 300));
// Add a blue on yellow rectangle from 3in 3in to 4in 4in
AnnRectangleObject rectObj = new AnnRectangleObject();
rectObj.setRect(LeadRectD.create(3 * inch, 3 * inch, 1 * inch, 1 * inch));
rectObj.setStroke(AnnStroke.create(AnnSolidColorBrush.create("Blue"), LeadLengthD.create(1)));
rectObj.setFill(AnnSolidColorBrush.create("Yellow"));
container.getChildren().add(rectObj);
// Get the rectangle in annotations units
LeadRectD rc = rectObj.getRect();
System.out
.println("Annotations units: " + rc.getX() + "," + rc.getY() + "," + rc.getWidth() + "," + rc.getHeight());
// Convert it to image coordinates
rc = container.getMapper().rectToContainerCoordinates(rc);
System.out.println(
"Image units (pixels): " + rc.getX() + "," + rc.getY() + "," + rc.getWidth() + "," + rc.getHeight());
// If this container is used with an image, you can use the pixels values above
// to find the exact value on the image
// Convert it to back to annotations units
rc = container.getMapper().rectToContainerCoordinates(rc);
System.out.println("Original units: " + rc.getX() + "," + rc.getY() + "," + rc.getWidth() + "," + rc.getHeight());
}
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
Multimedia
Direct Show .NET | C API | Filters
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
Imaging, Medical, and Document