←Select platform

PhysicalTransform Property

Summary

Returns the current physical transformation System.Drawing.Drawing2D.Matrix of this AnnObject.

Syntax

C#
VB
C++
public virtual Matrix PhysicalTransform {get;} 
  
Public Overridable ReadOnly Property PhysicalTransform As Matrix 
public: 
virtual property Matrix^ PhysicalTransform { 
   Matrix^ get(); 
} 

Property Value

The current physical transformation matrix of this AnnObject.

Remarks

The physical transformation System.Drawing.Drawing2D.Matrix of an AnnObject is the result of multiplying the object Transform matrix by the ContainerTransform matrix.

This matrix can be used to transform points from logical (in the object coordinate) coordinates to physical coordinates. For example, the annotation toolkit uses this matrix during hit-testing.

Example

This example will perform various transformation on an annotation object then shows its transformation matrix.

C#
VB
using Leadtools; 
using Leadtools.Annotations; 
using Leadtools.Codecs; 
using Leadtools.WinForms; 
using Leadtools.Drawing; 
 
private void AnnObject_PhysicalTransform(AnnObject obj) 
{ 
   // this example only works with line objects 
   if (obj is AnnLineObject) 
   { 
      AnnLineObject line = obj as AnnLineObject; 
 
      // show the logical coordinates of this line 
 
      PointF[] pts = 
       { 
          line.StartPoint.ConvertTo(line.Container.UnitConverter, AnnUnit.Pixel).ToPointF(), 
          line.EndPoint.ConvertTo(line.Container.UnitConverter, AnnUnit.Pixel).ToPointF() 
       }; 
 
      Console.WriteLine("Logical coordinates: {0}, {1}", pts[0], pts[1]); 
 
      // show the physical coordinates of this line 
      using (Matrix mat = line.PhysicalTransform) 
      { 
         AnnTransformer transformer = new AnnTransformer(line.Container.UnitConverter, mat); 
         pts = transformer.PointToPhysical(pts); 
         Console.WriteLine("Physical coordinates: {0}, {1}", pts[0], pts[1]); 
      } 
   } 
   else 
      Console.WriteLine("Not an annotation line object!"); 
} 
Imports Leadtools 
Imports Leadtools.Annotations 
Imports Leadtools.Codecs 
Imports Leadtools.WinForms 
Imports Leadtools.Drawing 
 
Private Sub AnnObject_PhysicalTransform(ByVal obj As AnnObject) 
   ' this example only works with line objects 
   If TypeOf obj Is AnnLineObject Then 
      Dim line As AnnLineObject = CType(IIf(TypeOf obj Is AnnLineObject, obj, Nothing), AnnLineObject) 
 
      ' show the logical coordinates of this line 
 
      Dim pts As PointF() = {line.StartPoint.ConvertTo(line.Container.UnitConverter, AnnUnit.Pixel).ToPointF(), line.EndPoint.ConvertTo(line.Container.UnitConverter, AnnUnit.Pixel).ToPointF()} 
 
      Console.WriteLine("Logical coordinates: {0}, {1}", pts(0), pts(1)) 
 
      ' show the physical coordinates of this line 
      Dim mat As Matrix = line.PhysicalTransform 
      Try 
         Dim transformer As AnnTransformer = New AnnTransformer(line.Container.UnitConverter, mat) 
         pts = transformer.PointToPhysical(pts) 
         Console.WriteLine("Physical coordinates: {0}, {1}", pts(0), pts(1)) 
      Finally 
         CType(mat, IDisposable).Dispose() 
      End Try 
   Else 
      Console.WriteLine("Not an annotation line object!") 
   End If 
End Sub 

Requirements

Target Platforms

See Also

Reference

AnnObject Class

AnnObject Members

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Annotations Assembly
Click or drag to resize