array optimizer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=

    array optimizer

    I have a big problem concerning arrays.
    I have an array of structs that is deply implemented in the code. If i
    change this implementation then i have to change everything, so after
    searching google and a lot of newsgroups i came up with this question:
    With the following array, how can i make a search without having to use a
    loop to seek for a certain "thing" in the array of structs?
    (i've tryed to use array.find(), but because its an array of structs i just
    wasn't able to make it work)




    Friend Sub AdicionaPontosA Imagem(ByVal ValorX As Long, ByVal ValorY As Long,
    ByVal strNomePonto As String, _
    ByVal lngHwnd As Long, ByVal strNomeAnalise As String, _
    Optional ByRef myGraphics As System.Drawing. Graphics = Nothing)
    Dim lngContador As Long
    Dim bolFlag As Boolean


    bolFlag = False
    If ArrayPontos(0). bolInicializaca o = True Then
    ArrayPontos(0). bolInicializaca o = False
    ArrayPontos(0). strNomePonto = strNomePonto
    ArrayPontos(0). lngValorX = ValorX
    ArrayPontos(0). lngValorY = ValorY
    ArrayPontos(0). strAbreviatura =
    BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
    ArrayPontos(0). Posicoes.intPre enchidas = 0

    ArrayPontosImg( 0).bolInicializ acao = False
    ArrayPontosImg( 0).lngValorX = ValorX
    ArrayPontosImg( 0).lngValorY = ValorY
    ReDim ArrayPontosImg( 0).ptnPontos(5)
    ArrayPontosImg( 0).ptnPontos(0) .X = ValorX
    ArrayPontosImg( 0).ptnPontos(0) .Y = ValorY - 1
    ArrayPontosImg( 0).ptnPontos(1) .X = ValorX
    ArrayPontosImg( 0).ptnPontos(1) .Y = ValorY
    ArrayPontosImg( 0).ptnPontos(2) .X = ValorX
    ArrayPontosImg( 0).ptnPontos(2) .Y = ValorY + 1
    ArrayPontosImg( 0).ptnPontos(3) .X = ValorX - 1
    ArrayPontosImg( 0).ptnPontos(3) .Y = ValorY
    ArrayPontosImg( 0).ptnPontos(4) .X = ValorX + 1
    ArrayPontosImg( 0).ptnPontos(4) .Y = ValorY

    If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso (Not
    IsNothing(myGra phics)) Then
    identificaPerfi lAutomaticament e(myGraphics)
    End If
    Else



    For lngContador = 0 To UBound(ArrayPon tos) - 1
    If ArrayPontos(lng Contador).strNo mePonto = strNomePonto Then
    ArrayPontos(lng Contador).lngVa lorX = ValorX
    ArrayPontos(lng Contador).lngVa lorY = ValorY
    ArrayPontos(lng Contador).strAb reviatura =
    BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)

    ArrayPontosImg( lngContador).bo lInicializacao = False
    ArrayPontosImg( lngContador).ln gValorX = ValorX
    ArrayPontosImg( lngContador).ln gValorY = ValorY
    ReDim ArrayPontosImg( lngContador).pt nPontos(5)
    ArrayPontosImg( lngContador).pt nPontos(0).X = ValorX
    ArrayPontosImg( lngContador).pt nPontos(0).Y = ValorY - 1
    ArrayPontosImg( lngContador).pt nPontos(1).X = ValorX
    ArrayPontosImg( lngContador).pt nPontos(1).Y = ValorY
    ArrayPontosImg( lngContador).pt nPontos(2).X = ValorX
    ArrayPontosImg( lngContador).pt nPontos(2).Y = ValorY + 1
    ArrayPontosImg( lngContador).pt nPontos(3).X = ValorX - 1
    ArrayPontosImg( lngContador).pt nPontos(3).Y = ValorY
    ArrayPontosImg( lngContador).pt nPontos(4).X = ValorX + 1
    ArrayPontosImg( lngContador).pt nPontos(4).Y = ValorY
    bolFlag = True
    Exit For
    End If
    Next

    If Not bolFlag Then
    ReDim Preserve ArrayPontos(UBo und(ArrayPontos ) + 1)
    ArrayPontos(UBo und(ArrayPontos ) - 1).bolInicializ acao = False
    ArrayPontos(UBo und(ArrayPontos ) - 1).strNomePonto = strNomePonto
    ArrayPontos(UBo und(ArrayPontos ) - 1).lngValorX = ValorX
    ArrayPontos(UBo und(ArrayPontos ) - 1).lngValorY = ValorY
    ArrayPontos(UBo und(ArrayPontos ) - 1).strAbreviatu ra =
    BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
    ArrayPontos(UBo und(ArrayPontos ) - 1).Posicoes.int Preenchidas = 0

    ReDim Preserve ArrayPontosImg( UBound(ArrayPon tosImg) + 1)
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).bolInicializ acao = False
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).lngValorX = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).lngValorY = ValorY
    ReDim ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(5)
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(0) .X = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(0) .Y = ValorY - 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(1) .X = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(1) .Y = ValorY
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(2) .X = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(2) .Y = ValorY + 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(3) .X = ValorX - 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(3) .Y = ValorY
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(4) .X = ValorX + 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(4) .Y = ValorY
    If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso (Not
    IsNothing(myGra phics)) Then
    identificaPerfi lAutomaticament e(myGraphics)
    End If

    End If
    End If
    TracaRectas(lng Hwnd, strNomeAnalise)
    RaiseEvent registaPontoNaL istagem(strNome Ponto)
    End Sub
  • Patrice

    #2
    Re: array optimizer

    Even with Array.Find it will loop. An array is accessible from an index
    (giving the memory location of the cell array to address) so you'll have to
    loop either implicitely or explicitely.

    Plus Redim preserve will copy the whole array so an array looks quite a bad
    choice in your case.

    An array is not that different from most other colltions so it's perhaps not
    that complicated to change your code to take advantage of a better sutiable
    and it could be beneficial.

    If for now you want to keep an array using Find with a structure seems to
    works fine...

    I would expose this from the structure. For example inside the structure
    definition :
    Private Shared _Name As String
    Private Shared Function IsName(ByVal item As s) As Boolean
    Return item.Name = _Name
    End Function
    Public Shared Function FindByName(ByVa l arr() As s, ByVal Name As
    String) As s
    _Name = Name
    Return Array.Find(Of s)(arr, AddressOf IsName)
    End Function

    Then in your code you can use something such as :

    MyStructure.Fin dByName(MyArray ,"Hello world")

    Also it will find the first occurence only though the array could use
    multiple time the same name. One more reason IMO to consider upgrading soon
    even if it could be a bit more work.... An array doesn't look a good fit for
    your needs...

    --
    Patrice


    "Ricardo Furtado" <RicardoFurtado @discussions.mi crosoft.coma écrit dans le
    message de groupe de discussion :
    F444CF53-3B2A-421E-BA89-8938322C60ED@mi crosoft.com...
    I have a big problem concerning arrays.
    I have an array of structs that is deply implemented in the code. If i
    change this implementation then i have to change everything, so after
    searching google and a lot of newsgroups i came up with this question:
    With the following array, how can i make a search without having to use a
    loop to seek for a certain "thing" in the array of structs?
    (i've tryed to use array.find(), but because its an array of structs i
    just
    wasn't able to make it work)
    >
    >
    >
    >
    Friend Sub AdicionaPontosA Imagem(ByVal ValorX As Long, ByVal ValorY As
    Long,
    ByVal strNomePonto As String, _
    ByVal lngHwnd As Long, ByVal strNomeAnalise As String, _
    Optional ByRef myGraphics As System.Drawing. Graphics = Nothing)
    Dim lngContador As Long
    Dim bolFlag As Boolean
    >
    >
    bolFlag = False
    If ArrayPontos(0). bolInicializaca o = True Then
    ArrayPontos(0). bolInicializaca o = False
    ArrayPontos(0). strNomePonto = strNomePonto
    ArrayPontos(0). lngValorX = ValorX
    ArrayPontos(0). lngValorY = ValorY
    ArrayPontos(0). strAbreviatura =
    BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
    ArrayPontos(0). Posicoes.intPre enchidas = 0
    >
    ArrayPontosImg( 0).bolInicializ acao = False
    ArrayPontosImg( 0).lngValorX = ValorX
    ArrayPontosImg( 0).lngValorY = ValorY
    ReDim ArrayPontosImg( 0).ptnPontos(5)
    ArrayPontosImg( 0).ptnPontos(0) .X = ValorX
    ArrayPontosImg( 0).ptnPontos(0) .Y = ValorY - 1
    ArrayPontosImg( 0).ptnPontos(1) .X = ValorX
    ArrayPontosImg( 0).ptnPontos(1) .Y = ValorY
    ArrayPontosImg( 0).ptnPontos(2) .X = ValorX
    ArrayPontosImg( 0).ptnPontos(2) .Y = ValorY + 1
    ArrayPontosImg( 0).ptnPontos(3) .X = ValorX - 1
    ArrayPontosImg( 0).ptnPontos(3) .Y = ValorY
    ArrayPontosImg( 0).ptnPontos(4) .X = ValorX + 1
    ArrayPontosImg( 0).ptnPontos(4) .Y = ValorY
    >
    If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso (Not
    IsNothing(myGra phics)) Then
    identificaPerfi lAutomaticament e(myGraphics)
    End If
    Else
    >
    >
    >
    For lngContador = 0 To UBound(ArrayPon tos) - 1
    If ArrayPontos(lng Contador).strNo mePonto = strNomePonto Then
    ArrayPontos(lng Contador).lngVa lorX = ValorX
    ArrayPontos(lng Contador).lngVa lorY = ValorY
    ArrayPontos(lng Contador).strAb reviatura =
    BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
    >
    ArrayPontosImg( lngContador).bo lInicializacao = False
    ArrayPontosImg( lngContador).ln gValorX = ValorX
    ArrayPontosImg( lngContador).ln gValorY = ValorY
    ReDim ArrayPontosImg( lngContador).pt nPontos(5)
    ArrayPontosImg( lngContador).pt nPontos(0).X = ValorX
    ArrayPontosImg( lngContador).pt nPontos(0).Y = ValorY - 1
    ArrayPontosImg( lngContador).pt nPontos(1).X = ValorX
    ArrayPontosImg( lngContador).pt nPontos(1).Y = ValorY
    ArrayPontosImg( lngContador).pt nPontos(2).X = ValorX
    ArrayPontosImg( lngContador).pt nPontos(2).Y = ValorY + 1
    ArrayPontosImg( lngContador).pt nPontos(3).X = ValorX - 1
    ArrayPontosImg( lngContador).pt nPontos(3).Y = ValorY
    ArrayPontosImg( lngContador).pt nPontos(4).X = ValorX + 1
    ArrayPontosImg( lngContador).pt nPontos(4).Y = ValorY
    bolFlag = True
    Exit For
    End If
    Next
    >
    If Not bolFlag Then
    ReDim Preserve ArrayPontos(UBo und(ArrayPontos ) + 1)
    ArrayPontos(UBo und(ArrayPontos ) - 1).bolInicializ acao = False
    ArrayPontos(UBo und(ArrayPontos ) - 1).strNomePonto = strNomePonto
    ArrayPontos(UBo und(ArrayPontos ) - 1).lngValorX = ValorX
    ArrayPontos(UBo und(ArrayPontos ) - 1).lngValorY = ValorY
    ArrayPontos(UBo und(ArrayPontos ) - 1).strAbreviatu ra =
    BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
    ArrayPontos(UBo und(ArrayPontos ) - 1).Posicoes.int Preenchidas = 0
    >
    ReDim Preserve ArrayPontosImg( UBound(ArrayPon tosImg) + 1)
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).bolInicializ acao = False
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).lngValorX = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).lngValorY = ValorY
    ReDim ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(5)
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(0) .X = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(0) .Y = ValorY - 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(1) .X = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(1) .Y = ValorY
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(2) .X = ValorX
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(2) .Y = ValorY + 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(3) .X = ValorX - 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(3) .Y = ValorY
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(4) .X = ValorX + 1
    ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(4) .Y = ValorY
    If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso (Not
    IsNothing(myGra phics)) Then
    identificaPerfi lAutomaticament e(myGraphics)
    End If
    >
    End If
    End If
    TracaRectas(lng Hwnd, strNomeAnalise)
    RaiseEvent registaPontoNaL istagem(strNome Ponto)
    End Sub

    Comment

    • =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=

      #3
      Re: array optimizer

      Thank you for your answer.
      What would you suggest instead of the array?

      Comment

      • Patrice

        #4
        Re: array optimizer

        Hard to say without knowing your overall requirements but you may find some
        articles about this. Try :

        Learn how to decide which collection class in .NET to choose. Using the wrong type can restrict your use of the collection.



        (found using
        http://www.google.com/search?hl=fr&q...+generic&meta=)


        Hope it helps a bit...

        --
        Patrice


        "Ricardo Furtado" <RicardoFurtado @discussions.mi crosoft.coma écrit dans le
        message de groupe de discussion :
        7BB4412D-AEE9-4800-8FCF-E68C019B937F@mi crosoft.com...
        Thank you for your answer.
        What would you suggest instead of the array?

        Comment

        • =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=

          #5
          Re: array optimizer

          The great problem, for me, in this case, with collections is that a
          collection only acepts an index and a name.
          In my case, i need an index, a name, the mouse.X value, the mouse.Y value
          and the tag value


          Comment

          • Patrice

            #6
            Re: array optimizer

            Humm. Which type are you talking about ? Unless you are suing a very
            specialized collection this is not the general behavior...


            For example from the list I choosed the collection that allows the key to be
            part of my structure. Then it gives something such as :

            Class Program
            Structure MyStruct
            Public Key As String
            Public x As Integer
            Public y As Integer
            End Structure
            Public Class MyCollection
            Inherits Collections.Obj ectModel.KeyedC ollection(Of String,
            MyStruct)
            Protected Overrides Function GetKeyForItem(B yVal item As MyStruct)
            As String
            Return item.Key
            End Function
            End Class
            Shared Sub Main()
            Dim c As New MyCollection
            c.Add(New MyStruct With {.Key = "A", .x = 10, .y = 11})
            c.Add(New MyStruct With {.Key = "B", .x = 20, .y = 21})
            c.Add(New MyStruct With {.Key = "C", .x = 30, .y = 31})
            MsgBox(c.Item(" B").x)
            End Sub
            End Class

            If you choose a dictionary it could be :

            Class Program
            Structure MyStruct
            Public Key As String
            Public x As Integer
            Public y As Integer
            End Structure
            Shared Sub Main()
            Dim c As New Generic.Diction ary(Of String, MyStruct)
            c.Add("A", New MyStruct With {.Key = "A", .x = 10, .y = 11})
            c.Add("B", New MyStruct With {.Key = "B", .x = 20, .y = 21})
            c.Add("C", New MyStruct With {.Key = "C", .x = 30, .y = 31})
            MsgBox(c.Item(" B").x)
            End Sub
            End Class

            See Generics for details...

            Also as a side note an advice I've seen and that could be usefull is to
            program against an interface. If you are using a variable such as c As
            Generic.IList(O f MyStruct) then you'll be able to use whatever collections
            you want as long as it provides this same interface at least for most code
            portions (if you don't see what I'm talking about left this aside from
            now)...

            --
            Patrice

            "Ricardo Furtado" <RicardoFurtado @discussions.mi crosoft.coma écrit dans le
            message de groupe de discussion :
            BF0362F8-3AFC-48AE-8D49-2D0BC3B6F003@mi crosoft.com...
            The great problem, for me, in this case, with collections is that a
            collection only acepts an index and a name.
            In my case, i need an index, a name, the mouse.X value, the mouse.Y value
            and the tag value
            >
            >

            Comment

            • =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=

              #7
              Re: array optimizer

              thanks

              i've implemented the code in the following way (it might work after changing
              all the other references in the project):

              Friend Sub AdicionaPontosA Imagem(ByVal ValorX As Long, ByVal ValorY As
              Long, ByVal strNomePonto As String, _
              ByVal lngHwnd As Long, ByVal
              strNomeAnalise As String, _
              Optional ByRef myGraphics As
              System.Drawing. Graphics = Nothing)
              Dim lngContador As Long
              Dim bolFlag As Boolean
              bolFlag = False
              Dim myPT As Pontos
              Dim defPt As DefinePonto

              myPT.bolInicial izacao = False
              myPT.strNomePon to = strNomePonto
              myPT.lngValorX = ValorX
              myPT.lngValorY = ValorY
              myPT.strAbrevia tura =
              BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
              myPT.Posicoes.i ntPreenchidas = 0


              defPt.bolInicia lizacao = False
              defPt.lngValorX = ValorX
              defPt.lngValorY = ValorY
              defPt.ptnPontos = New Hashtable
              defPt.ptnPontos .Add("X0", ValorX)
              defPt.ptnPontos .Add("Y0", ValorY - 1)
              defPt.ptnPontos .Add("X1", ValorX)
              defPt.ptnPontos .Add("Y1", ValorY)
              defPt.ptnPontos .Add("X2", ValorX)
              defPt.ptnPontos .Add("Y2", ValorY + 1)
              defPt.ptnPontos .Add("X3", ValorX - 1)
              defPt.ptnPontos .Add("Y3", ValorY)
              defPt.ptnPontos (3).Y = ValorY
              defPt.ptnPontos .Add("X4", ValorX + 1)
              defPt.ptnPontos .Add("Y4", ValorY)




              If ArrPtHash.Count < 1 Then

              ArrPtHash.Add(s trNomePonto, myPT)
              ArrImgHash.Add( strNomePonto, defPt)
              If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso
              (Not IsNothing(myGra phics)) Then
              identificaPerfi lAutomaticament e(myGraphics)
              End If
              Else
              If Not ArrPtHash.Conta insKey(strNomeP onto) Then

              ArrPtHash.Add(s trNomePonto, myPT)
              ArrImgHash.Add( strNomePonto, defPt)
              Else

              ArrPtHash.Item( strNomePonto) = myPT
              ArrPtHash.Item( strNomePonto) = defPt
              If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais )
              AndAlso (Not IsNothing(myGra phics)) Then
              identificaPerfi lAutomaticament e(myGraphics)
              End If
              End If
              End If

              TracaRectas(lng Hwnd, strNomeAnalise)
              RaiseEvent registaPontoNaL istagem(strNome Ponto)
              End Sub

              Comment

              • James Hahn

                #8
                Re: array optimizer

                If the find is only ever going to use one item of the struct, you could
                build a hashtable when you populate the array and use that to look up the
                value and get an index into the array.

                A hashtable lookup seems to be quite fast, but any of the collections that
                implement find would do.

                This is some code from a recent project. ID is what I need to access the
                array. In this case I am creating the hashtable as soon as the array is
                fully populated, but it might be easier for you to do it as the array is
                being built. The ID is the key and the array position is the data.

                Public fht As Hashtable

                fht = New Hashtable(1000)
                For I = 0 To FRIDs.Count - 1
                fht.Add(FRIDs.F RID_Item(I).ID, I)
                Next I


                "Ricardo Furtado" <RicardoFurtado @discussions.mi crosoft.comwrot e in
                message news:F444CF53-3B2A-421E-BA89-8938322C60ED@mi crosoft.com...
                >I have a big problem concerning arrays.
                I have an array of structs that is deply implemented in the code. If i
                change this implementation then i have to change everything, so after
                searching google and a lot of newsgroups i came up with this question:
                With the following array, how can i make a search without having to use a
                loop to seek for a certain "thing" in the array of structs?
                (i've tryed to use array.find(), but because its an array of structs i
                just
                wasn't able to make it work)
                >
                >
                >
                >
                Friend Sub AdicionaPontosA Imagem(ByVal ValorX As Long, ByVal ValorY As
                Long,
                ByVal strNomePonto As String, _
                ByVal lngHwnd As Long, ByVal strNomeAnalise As String, _
                Optional ByRef myGraphics As System.Drawing. Graphics = Nothing)
                Dim lngContador As Long
                Dim bolFlag As Boolean
                >
                >
                bolFlag = False
                If ArrayPontos(0). bolInicializaca o = True Then
                ArrayPontos(0). bolInicializaca o = False
                ArrayPontos(0). strNomePonto = strNomePonto
                ArrayPontos(0). lngValorX = ValorX
                ArrayPontos(0). lngValorY = ValorY
                ArrayPontos(0). strAbreviatura =
                BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
                ArrayPontos(0). Posicoes.intPre enchidas = 0
                >
                ArrayPontosImg( 0).bolInicializ acao = False
                ArrayPontosImg( 0).lngValorX = ValorX
                ArrayPontosImg( 0).lngValorY = ValorY
                ReDim ArrayPontosImg( 0).ptnPontos(5)
                ArrayPontosImg( 0).ptnPontos(0) .X = ValorX
                ArrayPontosImg( 0).ptnPontos(0) .Y = ValorY - 1
                ArrayPontosImg( 0).ptnPontos(1) .X = ValorX
                ArrayPontosImg( 0).ptnPontos(1) .Y = ValorY
                ArrayPontosImg( 0).ptnPontos(2) .X = ValorX
                ArrayPontosImg( 0).ptnPontos(2) .Y = ValorY + 1
                ArrayPontosImg( 0).ptnPontos(3) .X = ValorX - 1
                ArrayPontosImg( 0).ptnPontos(3) .Y = ValorY
                ArrayPontosImg( 0).ptnPontos(4) .X = ValorX + 1
                ArrayPontosImg( 0).ptnPontos(4) .Y = ValorY
                >
                If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso (Not
                IsNothing(myGra phics)) Then
                identificaPerfi lAutomaticament e(myGraphics)
                End If
                Else
                >
                >
                >
                For lngContador = 0 To UBound(ArrayPon tos) - 1
                If ArrayPontos(lng Contador).strNo mePonto = strNomePonto Then
                ArrayPontos(lng Contador).lngVa lorX = ValorX
                ArrayPontos(lng Contador).lngVa lorY = ValorY
                ArrayPontos(lng Contador).strAb reviatura =
                BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
                >
                ArrayPontosImg( lngContador).bo lInicializacao = False
                ArrayPontosImg( lngContador).ln gValorX = ValorX
                ArrayPontosImg( lngContador).ln gValorY = ValorY
                ReDim ArrayPontosImg( lngContador).pt nPontos(5)
                ArrayPontosImg( lngContador).pt nPontos(0).X = ValorX
                ArrayPontosImg( lngContador).pt nPontos(0).Y = ValorY - 1
                ArrayPontosImg( lngContador).pt nPontos(1).X = ValorX
                ArrayPontosImg( lngContador).pt nPontos(1).Y = ValorY
                ArrayPontosImg( lngContador).pt nPontos(2).X = ValorX
                ArrayPontosImg( lngContador).pt nPontos(2).Y = ValorY + 1
                ArrayPontosImg( lngContador).pt nPontos(3).X = ValorX - 1
                ArrayPontosImg( lngContador).pt nPontos(3).Y = ValorY
                ArrayPontosImg( lngContador).pt nPontos(4).X = ValorX + 1
                ArrayPontosImg( lngContador).pt nPontos(4).Y = ValorY
                bolFlag = True
                Exit For
                End If
                Next
                >
                If Not bolFlag Then
                ReDim Preserve ArrayPontos(UBo und(ArrayPontos ) + 1)
                ArrayPontos(UBo und(ArrayPontos ) - 1).bolInicializ acao = False
                ArrayPontos(UBo und(ArrayPontos ) - 1).strNomePonto = strNomePonto
                ArrayPontos(UBo und(ArrayPontos ) - 1).lngValorX = ValorX
                ArrayPontos(UBo und(ArrayPontos ) - 1).lngValorY = ValorY
                ArrayPontos(UBo und(ArrayPontos ) - 1).strAbreviatu ra =
                BD.retornaAbrev iaturaDeDetermi nadoPonto(strNo mePonto)
                ArrayPontos(UBo und(ArrayPontos ) - 1).Posicoes.int Preenchidas = 0
                >
                ReDim Preserve ArrayPontosImg( UBound(ArrayPon tosImg) + 1)
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).bolInicializ acao = False
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).lngValorX = ValorX
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).lngValorY = ValorY
                ReDim ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(5)
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(0) .X = ValorX
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(0) .Y = ValorY - 1
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(1) .X = ValorX
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(1) .Y = ValorY
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(2) .X = ValorX
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(2) .Y = ValorY + 1
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(3) .X = ValorX - 1
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(3) .Y = ValorY
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(4) .X = ValorX + 1
                ArrayPontosImg( UBound(ArrayPon tosImg) - 1).ptnPontos(4) .Y = ValorY
                If (defPerfilGloba l = DefinicaoPerfil .pontosFulcrais ) AndAlso (Not
                IsNothing(myGra phics)) Then
                identificaPerfi lAutomaticament e(myGraphics)
                End If
                >
                End If
                End If
                TracaRectas(lng Hwnd, strNomeAnalise)
                RaiseEvent registaPontoNaL istagem(strNome Ponto)
                End Sub

                Comment

                Working...