VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Annotation Namespace / RectangleAnnotationData Class
Members Example



In This Topic
    RectangleAnnotationData Class
    In This Topic
    Contains information about the annotation that displays rectangle.
    Object Model
    RectangleAnnotationData ClassAnnotationBrushBase ClassAnnotationPen ClassAnnotationBrushBase Class
    Syntax
    'Declaration
     
    <SerializableAttribute()>
    Public Class RectangleAnnotationData 
       Inherits AnnotationData
    [Serializable()]
    public class RectangleAnnotationData : AnnotationData 
    [Serializable()]
    public __gc class RectangleAnnotationData : public AnnotationData 
    [Serializable()]
    public ref class RectangleAnnotationData : public AnnotationData 
    Remarks
    Square annotation can be constructed from rectangle annotation if the Symmetry property will be set to true.
    Example
    This example shows how to create custom rectangular annotation that holds GPS data as string value.
    ''' <summary>
    ''' Contains information about the annotation that displays rectangle and holds GPS data as string.
    ''' </summary>
    ''' <remarks>
    ''' This class shows how to create annotation data with custom property.
    ''' </remarks>
    Public Class GpsRectangleAnnotationData
    	Inherits Vintasoft.Imaging.Annotation.RectangleAnnotationData
                
    	#Region "Constructors"
                
    	''' <summary>
    	''' Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
    	''' </summary>
    	Public Sub New()
    		MyBase.New()
    	End Sub
                
    	''' <summary>
    	''' Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
    	''' </summary>
    	''' <param name="info">The SerializationInfo to populate with data.</param>
    	''' <param name="context">The destination for this serialization.</param>
    	Public Sub New(info As System.Runtime.Serialization.SerializationInfo, context As System.Runtime.Serialization.StreamingContext)
    		MyBase.New(info, context)
    		GpsData = info.GetString("GpsData")
    	End Sub
                
    	#End Region
                
                
                
    	#Region "Properties"
                
    	Private _gpsData As String = ""
    	''' <summary>
    	''' Gets or sets information about GPS data.
    	''' </summary>
    	''' <value>
    	''' Default value is empty.
    	''' </value>
    	<System.ComponentModel.Description("Information GPS data.")> _
    	<System.ComponentModel.DefaultValue("")> _
    	Public Property GpsData() As String
    		Get
    			Return _gpsData
    		End Get
    		Set
    			If value Is Nothing Then
    				value = ""
    			End If
    			If _gpsData <> value Then
    				Dim changingArgs As New Vintasoft.Imaging.ObjectPropertyChangingEventArgs("GpsData", GpsData, value)
    				' if action is not canceled 
    				If OnPropertyChanging(changingArgs) Then
    					_gpsData = DirectCast(changingArgs.NewValue, String)
    					OnPropertyChanged(changingArgs.ToChangedEventArgs())
    				End If
    			End If
    		End Set
    	End Property
                
    	#End Region
                
                
                
    	#Region "Methods"
                
    	''' <summary>
    	''' Populates a SerializationInfo with the data needed to serialize the target object.
    	''' </summary>
    	''' <param name="info">The SerializationInfo to populate with data.</param>
    	''' <param name="context">The destination for this serialization.</param>
    	Public Overrides Sub GetObjectData(info As System.Runtime.Serialization.SerializationInfo, context As System.Runtime.Serialization.StreamingContext)
    		MyBase.GetObjectData(info, context)
    		info.AddValue("GpsData", GpsData)
    	End Sub
                
    	''' <summary>
    	''' Copies the state of the current object to the target object.
    	''' </summary>
    	''' <param name="target">Object to copy the state of the current object to.</param>
    	Public Overrides Sub CopyTo(target As Vintasoft.Imaging.Annotation.AnnotationData)
    		Dim typedTarget As GpsRectangleAnnotationData = DirectCast(target, GpsRectangleAnnotationData)
                
    		MyBase.CopyTo(typedTarget)
                
    		typedTarget.GpsData = GpsData
    	End Sub
                
    	''' <summary>
    	''' Creates a new object that is a copy of the current
    	''' <see cref="GpsRectangleAnnotationData" /> instance.
    	''' </summary>
    	''' <returns>
    	''' A new object that is a copy of this
    	''' <see cref="GpsRectangleAnnotationData" /> instance.
    	''' </returns>
    	Public Overrides Function Clone() As Object
    		Dim result As New GpsRectangleAnnotationData()
    		Me.CopyTo(result)
    		Return result
    	End Function
                
    	#End Region
                
    End Class
    /// <summary>
    /// Contains information about the annotation that displays rectangle and holds GPS data as string.
    /// </summary>
    /// <remarks>
    /// This class shows how to create annotation data with custom property.
    /// </remarks>
    public class GpsRectangleAnnotationData : Vintasoft.Imaging.Annotation.RectangleAnnotationData
    {
                
        #region Constructors
                
        /// <summary>
        /// Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
        /// </summary>
        public GpsRectangleAnnotationData()
            : base()
        {
        }
                
        /// <summary>
        /// Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
        /// </summary>
        /// <param name="info">The SerializationInfo to populate with data.</param>
        /// <param name="context">The destination for this serialization.</param>
        public GpsRectangleAnnotationData(System.Runtime.Serialization.SerializationInfo info, 
            System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
            GpsData = info.GetString("GpsData");
        }
                
        #endregion
                
                
                
        #region Properties
                
        string _gpsData = "";
        /// <summary>
        /// Gets or sets information about GPS data.
        /// </summary>
        /// <value>
        /// Default value is empty.
        /// </value>
        [System.ComponentModel.Description("Information GPS data.")]
        [System.ComponentModel.DefaultValue("")]
        public string GpsData
        {
            get
            {
                return _gpsData;
            }
            set
            {
                if (value == null)
                    value = "";
                if (_gpsData != value)
                {
                    Vintasoft.Imaging.ObjectPropertyChangingEventArgs changingArgs =
                        new Vintasoft.Imaging.ObjectPropertyChangingEventArgs("GpsData", GpsData, value);
                    // if action is not canceled 
                    if (OnPropertyChanging(changingArgs))
                    {
                        _gpsData = (string)changingArgs.NewValue;
                        OnPropertyChanged(changingArgs.ToChangedEventArgs());
                    }
                }
            }
        }
                
        #endregion
                
                
                
        #region Methods
                
        /// <summary>
        /// Populates a SerializationInfo with the data needed to serialize the target object.
        /// </summary>
        /// <param name="info">The SerializationInfo to populate with data.</param>
        /// <param name="context">The destination for this serialization.</param>
        public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, 
            System.Runtime.Serialization.StreamingContext context)
        {
            base.GetObjectData(info, context);
            info.AddValue("GpsData", GpsData);
        }
                
        /// <summary>
        /// Copies the state of the current object to the target object.
        /// </summary>
        /// <param name="target">Object to copy the state of the current object to.</param>
        public override void CopyTo(Vintasoft.Imaging.Annotation.AnnotationData target)
        {
            GpsRectangleAnnotationData typedTarget = (GpsRectangleAnnotationData)target;
                
            base.CopyTo(typedTarget);
                
            typedTarget.GpsData = GpsData;
        }
                
        /// <summary>
        /// Creates a new object that is a copy of the current
        /// <see cref="GpsRectangleAnnotationData" /> instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this
        /// <see cref="GpsRectangleAnnotationData" /> instance.
        /// </returns>
        public override object Clone()
        {
            GpsRectangleAnnotationData result = new GpsRectangleAnnotationData();
            this.CopyTo(result);
            return result;
        }
                
        #endregion
                
    }
    Inheritance Hierarchy
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also