VintaSoft Annotation .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft Annotation .NET Plug-in Discussions
<SymbolAnnotation assembly="ctlAnnotation" namespace="ctlAnnotation"> <Guid type="System.Guid"> <![CDATA[ ab0441f9-cf6c-4d31-963e-0ce57d2ca2af]]> </Guid> <CreationTime type="System.String"> <![CDATA[ 2011-04-14T15:10:29]]> </CreationTime> <ModifiedTime type="System.String"> <![CDATA[ 2011-04-14T15:10:29]]> </ModifiedTime> <Location type="System.String"> <![CDATA[ 112,69.5]]> </Location> <Rotation type="System.Single">0</Rotation> <Size type="System.String"> <![CDATA[ 24,24]]> </Size> <Visible type="System.Boolean">True</Visible> <HorizontalMirrored type="System.Boolean">False</HorizontalMirrored> <VerticalMirrored type="System.Boolean">False</VerticalMirrored> <Border type="System.Boolean">False</Border> <ZOrder type="System.Int32">0</ZOrder> <BackColor type="System.Int32">-1</BackColor> <Outline type="Vintasoft.Annotation.AnnotationPen"> <Width type="System.Single">1</Width> <Color type="System.Drawing.Color">-16777216</Color> <DashOffset type="System.Single">0</DashOffset> <MiterLimit type="System.Single">10</MiterLimit> <Brush type="System.Drawing.Brush">Solid FF000000</Brush> </Outline> <Symmetry type="System.Boolean">False</Symmetry> <Brush type="System.String">Solid FFFFFFFF</Brush> <ImageData type="System.String"> <![CDATA[89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000206348524D00007A26000080840000FA00000080E8000075300000EA6000003A98000017709CBA513C00000083494441545847ED96510AC03008437BFF4B77F4A32065BA48043BC8605F95E4F1987463E8910119700DCCE9CB5967DE5BA67417D8C0A8F83CA3416CE00A430A9019188C517CC2C3A55FBA334134046360835210155F3A0590D11DCDBE6D535536942300196835D0BA86D79447D73AB4C7D9A1D21BF157E5F69F210BAE7919908146030F66CDC7395BCE56450000000049454E44AE426082]]> </ImageData> </SymbolAnnotation>M. Zuidhoek
Imports Vintasoft.Annotation
Public Class SymbolAnnotation
Inherits EmbeddedImageAnnotation
Public File As Bitmap
Private ColorChanger As ColorManager
Public Sub New(ByVal Image As Bitmap)
ColorChanger = ColorManager.GetInstance()
ColorChanger.File = Image
Me.Image = Image
File = Image
End Sub
Public Overrides Function Clone() As Object
Dim Result As New SymbolAnnotation(File)
CopyTo(Result)
Return Result
End Function
'Executes actions that must be done before the user starts building the annotation (like setting color)
Protected Overrides Sub OnStartBuilding(ByVal point As System.Drawing.PointF)
point = New PointF(point.X + 24, point.Y)
MyBase.OnStartBuilding(point)
Me.Border = False
Me.Image = ColorChanger.ChangeColor()
End Sub
'The actual building
Protected Overrides Sub OnBuilding(ByVal mouse As System.Windows.Forms.MouseEventArgs, ByVal action As Vintasoft.Annotation.MouseActions)
MyBase.OnBuilding(mouse, action)
End Sub
'Actions that will be executed when building is complete (like checking if the annotation isn't so small it will become invisible when unselected)
Protected Overrides Sub OnFinishBuilding(ByVal point As System.Drawing.PointF)
MyBase.OnFinishBuilding(point)
CheckAndSetHeight()
CheckAndSetWidth()
End Sub
Private Sub CheckAndSetHeight()
If (Me.Size.Height < 24) Then
Me.Size = New SizeF(Me.Size.Width, 24)
End If
End Sub
Private Sub CheckAndSetWidth()
If (Me.Size.Width < 24) Then
Me.Size = New SizeF(24, Me.Size.Height)
End If
End Sub
End Class
Most alterations on the basic EmbeddedImageAnnotation have to do with setting properties such as border and size. I don't think it's anything out of the ordinary.<?xpacket begin='п»ї' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:CreatorTool>Vintasoft Annotation Library 3.1</xmp:CreatorTool>
<xmp:CreateDate><![CDATA[2011-04-14T15:10:31]]></xmp:CreateDate>
</rdf:Description>
<rdf:Description rdf:about="Vintasoft Annotations" xmlns:xmp="http://ns.adobe.com/xap/4.0/">
<Annotations>
<SymbolAnnotation assembly="ctlAnnotation" namespace="ctlAnnotation">
<Guid type="System.Guid"><![CDATA[ab0441f9-cf6c-4d31-963e-0ce57d2ca2af]]></Guid>
<CreationTime type="System.String"><![CDATA[2011-04-14T15:10:29]]></CreationTime>
<ModifiedTime type="System.String"><![CDATA[2011-04-14T15:10:29]]></ModifiedTime>
<Location type="System.String"><![CDATA[112,69.5]]></Location>
<Rotation type="System.Single">0</Rotation>
<Size type="System.String"><![CDATA[24,24]]></Size>
<Visible type="System.Boolean">True</Visible>
<HorizontalMirrored type="System.Boolean">False</HorizontalMirrored>
<VerticalMirrored type="System.Boolean">False</VerticalMirrored>
<Border type="System.Boolean">False</Border>
<ZOrder type="System.Int32">0</ZOrder>
<BackColor type="System.Int32">-1</BackColor>
<Outline type="Vintasoft.Annotation.AnnotationPen">
<Width type="System.Single">1</Width>
<Color type="System.Drawing.Color">-16777216</Color>
<DashOffset type="System.Single">0</DashOffset>
<MiterLimit type="System.Single">10</MiterLimit>
<Brush type="System.Drawing.Brush">Solid FF000000</Brush>
</Outline>
<Symmetry type="System.Boolean">False</Symmetry>
<Brush type="System.String">Solid FFFFFFFF</Brush>
<ImageData type="System.String"><![CDATA[89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000206348524D00007A26000080840000FA00000080E8000075300000EA6000003A98000017709CBA513C00000083494441545847ED96510AC03008437BFF4B77F4A32065BA48043BC8605F95E4F1987463E8910119700DCCE9CB5967DE5BA67417D8C0A8F83CA3416CE00A430A9019188C517CC2C3A55FBA334134046360835210155F3A0590D11DCDBE6D535536942300196835D0BA86D79447D73AB4C7D9A1D21BF157E5F69F210BAE7919908146030F66CDC7395BCE56450000000049454E44AE426082]]></ImageData>
</SymbolAnnotation>
<SymbolAnnotation assembly="ctlAnnotation" namespace="ctlAnnotation">
<Guid type="System.Guid"><![CDATA[7132164a-bf9e-44de-b2c2-d8707c933782]]></Guid>
<CreationTime type="System.String"><![CDATA[2011-04-14T15:10:29]]></CreationTime>
<ModifiedTime type="System.String"><![CDATA[2011-04-14T15:10:30]]></ModifiedTime>
<Location type="System.String"><![CDATA[93,29]]></Location>
<Rotation type="System.Single">0</Rotation>
<Size type="System.String"><![CDATA[28,24]]></Size>
<Visible type="System.Boolean">True</Visible>
<HorizontalMirrored type="System.Boolean">False</HorizontalMirrored>
<VerticalMirrored type="System.Boolean">False</VerticalMirrored>
<Border type="System.Boolean">False</Border>
<ZOrder type="System.Int32">0</ZOrder>
<BackColor type="System.Int32">-1</BackColor>
<Outline type="Vintasoft.Annotation.AnnotationPen">
<Width type="System.Single">1</Width>
<Color type="System.Drawing.Color">-16777216</Color>
<DashOffset type="System.Single">0</DashOffset>
<MiterLimit type="System.Single">10</MiterLimit>
<Brush type="System.Drawing.Brush">Solid FF000000</Brush>
</Outline>
<Symmetry type="System.Boolean">False</Symmetry>
<Brush type="System.String">Solid FFFFFFFF</Brush>
<ImageData type="System.String"><![CDATA[89504E470D0A1A0A0000000D4948445200000020000000200806000000737A7AF4000000017352474200AECE1CE90000000467414D410000B18F0BFC6105000000206348524D00007A26000080840000FA00000080E8000075300000EA6000003A98000017709CBA513C00000083494441545847ED96510AC03008437BFF4B77F4A32065BA48043BC8605F95E4F1987463E8910119700DCCE9CB5967DE5BA67417D8C0A8F83CA3416CE00A430A9019188C517CC2C3A55FBA334134046360835210155F3A0590D11DCDBE6D535536942300196835D0BA86D79447D73AB4C7D9A1D21BF157E5F69F210BAE7919908146030F66CDC7395BCE56450000000049454E44AE426082]]></ImageData>
</SymbolAnnotation>
</Annotations>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='r'?>
Public Class SymbolAnnotation
Inherits EmbeddedImageAnnotation
...
Public Sub New()
End Sub
...
So we've a bit modificated your code and now you'll be able to deserialize the annotation.Imports Vintasoft.Annotation
Public Class SymbolAnnotation
Inherits EmbeddedImageAnnotation
Public File As Bitmap
Private ColorChanger As ColorManager
Public Sub New()
'...
End Sub
Public Sub New(ByVal Image As Bitmap)
ColorChanger = ColorManager.GetInstance()
ColorChanger.File = Image
Me.Image = Image
File = Image
End Sub
Public Overrides Function Clone() As Object
Dim Result As New SymbolAnnotation(File)
CopyTo(Result)
Return Result
End Function
'Executes actions that must be done before the user starts building the annotation (like setting color)
Protected Overrides Sub OnStartBuilding(ByVal point As System.Drawing.PointF)
point = New PointF(point.X + 24, point.Y)
MyBase.OnStartBuilding(point)
Me.Border = False
Me.Image = ColorChanger.ChangeColor()
End Sub
'The actual building
Protected Overrides Sub OnBuilding(ByVal mouse As System.Windows.Forms.MouseEventArgs, ByVal action As Vintasoft.Annotation.MouseActions)
MyBase.OnBuilding(mouse, action)
End Sub
'Actions that will be executed when building is complete (like checking if the annotation isn't so small it will become invisible when unselected)
Protected Overrides Sub OnFinishBuilding(ByVal point As System.Drawing.PointF)
MyBase.OnFinishBuilding(point)
CheckAndSetHeight()
CheckAndSetWidth()
End Sub
Private Sub CheckAndSetHeight()
If (Me.Size.Height < 24) Then
Me.Size = New SizeF(Me.Size.Width, 24)
End If
End Sub
Private Sub CheckAndSetWidth()
If (Me.Size.Width < 24) Then
Me.Size = New SizeF(24, Me.Size.Height)
End If
End Sub
End Class