Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

How do I programatically create a Polygon annotation?
Started by JoeBussell at 08-12-2008 14:19. Topic has 2 replies.

Print Search « Previous Thread Next Thread »
  08-12-2008, 14:19
JoeBussell is not online. Last active: 12/13/2008 12:04:09 AM JoeBussell

Top 50 Posts
Joined on 06-17-2008
Eugene, OR
Posts 62
How do I programatically create a Polygon annotation?
Reply Quote
Greetings Listers,
   I am working with Lead Document Imaging 14.5 under Visual Basic 6.  I am attempting to follow the online examples for creating a polygon, but I am not getting the results that I expect.  The code I am using follows the following pattern:

Public Function DrawFourVertexPolygon( ByVal x1 As Double, ByVal y1 As Double, _
                                        ByVal x2 As Double, ByVal y2 As Double, _
                                        ByVal x3 As Double, ByVal y3 As Double, _
                                        ByVal x4 As Double, ByVal y4 As Double) As Long

    Dim hObjAn As Long

    LEAD1.AnnUserMode = ANNUSER_DESIGN

    hObjAn = LEAD1.AnnCreate(ANNOBJECT_POLYGON, True, True)
    LEAD1.AnnDefine hObjAn, x1, y1, ANNDEFINE_BEGINSET
    LEAD1.AnnDefine hObjAn, x2, y2, ANNDEFINE_APPEND
    LEAD1.AnnDefine hObjAn, x3, y3, ANNDEFINE_APPEND
    LEAD1.AnnDefine hObjAn, x4, y4, ANNDEFINE_END
    LEAD1.AnnUserMode = ANNUSER_RUN
    LEAD1.AnnSetForeColor hObjAn, RGB(20, 90, 20), False

    DrawFourVertexPolygon = hObjAn
End Function

I am only seeing three vertexes.  I tried various combinations of append to no good effect.  I browsed through the annotation examples, but these all depend on mouse clicks, and some assumptions appear to be made by Lead based on the tool mode that I do not understand.

I have already looked through the following posts:
http://support.leadtools.com/SupportPortal/cs/forums/22103/ShowPost.aspx
http://www.leadtools.com/Help/LEADTOOLS/v15/DH/TO/Leadtools.Topics~Leadtools.Topics.AnnPolygonObject.html
And I also did a search of http://support.leadtools.com/SupportPortal/cs/forums/13/ShowForum.aspx and did not see any examples of constructing polygon annotations programatically.  None of the 14 posts related to Polygon provide any insight into this problem.

I appreciate your time.

   Report 
  08-12-2008, 15:01
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: How do I programatically create a Polygon annotation?
Reply Quote
I have reproduced this problem and need to report it to our engineering department.  However, in order to do that I need you to send an email to support@leadtools.com including the following information:

1. The company you work for
2. The LEADTOOLS serial number(s) you own (if you are evaluating, just say so)
3. The name(s) of the developer(s) using the serial number
4. A link to this forum post

As a workaround, you can use the AnnSetPoints method like this:

Public Function DrawFourVertexPolygon2(ByVal x1 As Double, ByVal y1 As Double, _
                                        ByVal x2 As Double, ByVal y2 As Double, _
                                        ByVal x3 As Double, ByVal y3 As Double, _
                                        ByVal x4 As Double, ByVal y4 As Double) As Long

    Dim hObjAn As Long

    LEAD1.AnnUserMode = ANNUSERMODE_DESIGN

    Dim x(4) As Single
    Dim y(4) As Single
    x(1) = x1
    x(2) = x2
    x(3) = x3
    x(4) = x4
    y(1) = y1
    y(2) = y2
    y(3) = y3
    y(4) = y4

    hObjAn = LEAD1.AnnCreate(ANNOBJECT_POLYGON, True, True)
    LEAD1.AnnSetPoints hObjAn, x, y, 4
    LEAD1.AnnUserMode = ANNUSERMODE_RUN
    LEAD1.AnnSetForeColor hObjAn, RGB(20, 90, 20), False

    DrawFourVertexPolygon2 = hObjAn
End Function

Greg Ross
LEADTOOLS Technical Support
   Report 
  08-13-2008, 9:12
GregR is not online. Last active: 1/2/2009 9:03:27 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,816
Re: How do I programatically create a Polygon annotation?
Reply Quote
I have reproduced this problem and have reported it with the incident number 7218IDT.  This incident will be reviewed and prioritized by our engineering department.  I will contact you when I get more information from our developers.

If you have any more questions, please let me know.
Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Annotations » How do I programatically create a Polygon annotation?

Powered by Community Server, by Telligent Systems