Connecting Tech Pros Worldwide Forums | Help | Site Map

array optimizer

=?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=
Guest
 
Posts: n/a
#1: Aug 26 '08
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 AdicionaPontosAImagem(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).bolInicializacao = True Then
ArrayPontos(0).bolInicializacao = False
ArrayPontos(0).strNomePonto = strNomePonto
ArrayPontos(0).lngValorX = ValorX
ArrayPontos(0).lngValorY = ValorY
ArrayPontos(0).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
ArrayPontos(0).Posicoes.intPreenchidas = 0

ArrayPontosImg(0).bolInicializacao = 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 (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso (Not
IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
Else



For lngContador = 0 To UBound(ArrayPontos) - 1
If ArrayPontos(lngContador).strNomePonto = strNomePonto Then
ArrayPontos(lngContador).lngValorX = ValorX
ArrayPontos(lngContador).lngValorY = ValorY
ArrayPontos(lngContador).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)

ArrayPontosImg(lngContador).bolInicializacao = False
ArrayPontosImg(lngContador).lngValorX = ValorX
ArrayPontosImg(lngContador).lngValorY = ValorY
ReDim ArrayPontosImg(lngContador).ptnPontos(5)
ArrayPontosImg(lngContador).ptnPontos(0).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(0).Y = ValorY - 1
ArrayPontosImg(lngContador).ptnPontos(1).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(1).Y = ValorY
ArrayPontosImg(lngContador).ptnPontos(2).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(2).Y = ValorY + 1
ArrayPontosImg(lngContador).ptnPontos(3).X = ValorX - 1
ArrayPontosImg(lngContador).ptnPontos(3).Y = ValorY
ArrayPontosImg(lngContador).ptnPontos(4).X = ValorX + 1
ArrayPontosImg(lngContador).ptnPontos(4).Y = ValorY
bolFlag = True
Exit For
End If
Next

If Not bolFlag Then
ReDim Preserve ArrayPontos(UBound(ArrayPontos) + 1)
ArrayPontos(UBound(ArrayPontos) - 1).bolInicializacao = False
ArrayPontos(UBound(ArrayPontos) - 1).strNomePonto = strNomePonto
ArrayPontos(UBound(ArrayPontos) - 1).lngValorX = ValorX
ArrayPontos(UBound(ArrayPontos) - 1).lngValorY = ValorY
ArrayPontos(UBound(ArrayPontos) - 1).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
ArrayPontos(UBound(ArrayPontos) - 1).Posicoes.intPreenchidas = 0

ReDim Preserve ArrayPontosImg(UBound(ArrayPontosImg) + 1)
ArrayPontosImg(UBound(ArrayPontosImg) - 1).bolInicializacao = False
ArrayPontosImg(UBound(ArrayPontosImg) - 1).lngValorX = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).lngValorY = ValorY
ReDim ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(5)
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(0).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(0).Y = ValorY - 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(1).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(1).Y = ValorY
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(2).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(2).Y = ValorY + 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(3).X = ValorX - 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(3).Y = ValorY
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(4).X = ValorX + 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(4).Y = ValorY
If (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso (Not
IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If

End If
End If
TracaRectas(lngHwnd, strNomeAnalise)
RaiseEvent registaPontoNaListagem(strNomePonto)
End Sub

Patrice
Guest
 
Posts: n/a
#2: Aug 26 '08

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(ByVal 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.FindByName(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.microsoft.coma écrit dans le
message de groupe de discussion :
F444CF53-3B2A-421E-BA89-8938322C60ED@microsoft.com...
Quote:
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 AdicionaPontosAImagem(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).bolInicializacao = True Then
ArrayPontos(0).bolInicializacao = False
ArrayPontos(0).strNomePonto = strNomePonto
ArrayPontos(0).lngValorX = ValorX
ArrayPontos(0).lngValorY = ValorY
ArrayPontos(0).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
ArrayPontos(0).Posicoes.intPreenchidas = 0
>
ArrayPontosImg(0).bolInicializacao = 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 (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso (Not
IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
Else
>
>
>
For lngContador = 0 To UBound(ArrayPontos) - 1
If ArrayPontos(lngContador).strNomePonto = strNomePonto Then
ArrayPontos(lngContador).lngValorX = ValorX
ArrayPontos(lngContador).lngValorY = ValorY
ArrayPontos(lngContador).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
>
ArrayPontosImg(lngContador).bolInicializacao = False
ArrayPontosImg(lngContador).lngValorX = ValorX
ArrayPontosImg(lngContador).lngValorY = ValorY
ReDim ArrayPontosImg(lngContador).ptnPontos(5)
ArrayPontosImg(lngContador).ptnPontos(0).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(0).Y = ValorY - 1
ArrayPontosImg(lngContador).ptnPontos(1).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(1).Y = ValorY
ArrayPontosImg(lngContador).ptnPontos(2).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(2).Y = ValorY + 1
ArrayPontosImg(lngContador).ptnPontos(3).X = ValorX - 1
ArrayPontosImg(lngContador).ptnPontos(3).Y = ValorY
ArrayPontosImg(lngContador).ptnPontos(4).X = ValorX + 1
ArrayPontosImg(lngContador).ptnPontos(4).Y = ValorY
bolFlag = True
Exit For
End If
Next
>
If Not bolFlag Then
ReDim Preserve ArrayPontos(UBound(ArrayPontos) + 1)
ArrayPontos(UBound(ArrayPontos) - 1).bolInicializacao = False
ArrayPontos(UBound(ArrayPontos) - 1).strNomePonto = strNomePonto
ArrayPontos(UBound(ArrayPontos) - 1).lngValorX = ValorX
ArrayPontos(UBound(ArrayPontos) - 1).lngValorY = ValorY
ArrayPontos(UBound(ArrayPontos) - 1).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
ArrayPontos(UBound(ArrayPontos) - 1).Posicoes.intPreenchidas = 0
>
ReDim Preserve ArrayPontosImg(UBound(ArrayPontosImg) + 1)
ArrayPontosImg(UBound(ArrayPontosImg) - 1).bolInicializacao = False
ArrayPontosImg(UBound(ArrayPontosImg) - 1).lngValorX = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).lngValorY = ValorY
ReDim ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(5)
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(0).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(0).Y = ValorY - 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(1).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(1).Y = ValorY
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(2).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(2).Y = ValorY + 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(3).X = ValorX - 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(3).Y = ValorY
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(4).X = ValorX + 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(4).Y = ValorY
If (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso (Not
IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
>
End If
End If
TracaRectas(lngHwnd, strNomeAnalise)
RaiseEvent registaPontoNaListagem(strNomePonto)
End Sub

=?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=
Guest
 
Posts: n/a
#3: Aug 27 '08

re: array optimizer


Thank you for your answer.
What would you suggest instead of the array?
Patrice
Guest
 
Posts: n/a
#4: Aug 27 '08

re: array optimizer


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

http://msdn.microsoft.com/en-us/library/6tc79sx1.aspx
http://weblogs.asp.net/sanjeebsarang...on-object.aspx

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


Hope it helps a bit...

--
Patrice


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

=?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=
Guest
 
Posts: n/a
#5: Aug 27 '08

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


Patrice
Guest
 
Posts: n/a
#6: Aug 27 '08

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.ObjectModel.KeyedCollection(Of String,
MyStruct)
Protected Overrides Function GetKeyForItem(ByVal 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.Dictionary(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(Of 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.microsoft.coma écrit dans le
message de groupe de discussion :
BF0362F8-3AFC-48AE-8D49-2D0BC3B6F003@microsoft.com...
Quote:
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
>
>
=?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?=
Guest
 
Posts: n/a
#7: Aug 27 '08

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 AdicionaPontosAImagem(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.bolInicializacao = False
myPT.strNomePonto = strNomePonto
myPT.lngValorX = ValorX
myPT.lngValorY = ValorY
myPT.strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
myPT.Posicoes.intPreenchidas = 0


defPt.bolInicializacao = 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(strNomePonto, myPT)
ArrImgHash.Add(strNomePonto, defPt)
If (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso
(Not IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
Else
If Not ArrPtHash.ContainsKey(strNomePonto) Then

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

ArrPtHash.Item(strNomePonto) = myPT
ArrPtHash.Item(strNomePonto) = defPt
If (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais)
AndAlso (Not IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
End If
End If

TracaRectas(lngHwnd, strNomeAnalise)
RaiseEvent registaPontoNaListagem(strNomePonto)
End Sub
James Hahn
Guest
 
Posts: n/a
#8: Aug 28 '08

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.FRID_Item(I).ID, I)
Next I


"Ricardo Furtado" <RicardoFurtado@discussions.microsoft.comwrote in
message news:F444CF53-3B2A-421E-BA89-8938322C60ED@microsoft.com...
Quote:
>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 AdicionaPontosAImagem(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).bolInicializacao = True Then
ArrayPontos(0).bolInicializacao = False
ArrayPontos(0).strNomePonto = strNomePonto
ArrayPontos(0).lngValorX = ValorX
ArrayPontos(0).lngValorY = ValorY
ArrayPontos(0).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
ArrayPontos(0).Posicoes.intPreenchidas = 0
>
ArrayPontosImg(0).bolInicializacao = 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 (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso (Not
IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
Else
>
>
>
For lngContador = 0 To UBound(ArrayPontos) - 1
If ArrayPontos(lngContador).strNomePonto = strNomePonto Then
ArrayPontos(lngContador).lngValorX = ValorX
ArrayPontos(lngContador).lngValorY = ValorY
ArrayPontos(lngContador).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
>
ArrayPontosImg(lngContador).bolInicializacao = False
ArrayPontosImg(lngContador).lngValorX = ValorX
ArrayPontosImg(lngContador).lngValorY = ValorY
ReDim ArrayPontosImg(lngContador).ptnPontos(5)
ArrayPontosImg(lngContador).ptnPontos(0).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(0).Y = ValorY - 1
ArrayPontosImg(lngContador).ptnPontos(1).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(1).Y = ValorY
ArrayPontosImg(lngContador).ptnPontos(2).X = ValorX
ArrayPontosImg(lngContador).ptnPontos(2).Y = ValorY + 1
ArrayPontosImg(lngContador).ptnPontos(3).X = ValorX - 1
ArrayPontosImg(lngContador).ptnPontos(3).Y = ValorY
ArrayPontosImg(lngContador).ptnPontos(4).X = ValorX + 1
ArrayPontosImg(lngContador).ptnPontos(4).Y = ValorY
bolFlag = True
Exit For
End If
Next
>
If Not bolFlag Then
ReDim Preserve ArrayPontos(UBound(ArrayPontos) + 1)
ArrayPontos(UBound(ArrayPontos) - 1).bolInicializacao = False
ArrayPontos(UBound(ArrayPontos) - 1).strNomePonto = strNomePonto
ArrayPontos(UBound(ArrayPontos) - 1).lngValorX = ValorX
ArrayPontos(UBound(ArrayPontos) - 1).lngValorY = ValorY
ArrayPontos(UBound(ArrayPontos) - 1).strAbreviatura =
BD.retornaAbreviaturaDeDeterminadoPonto(strNomePon to)
ArrayPontos(UBound(ArrayPontos) - 1).Posicoes.intPreenchidas = 0
>
ReDim Preserve ArrayPontosImg(UBound(ArrayPontosImg) + 1)
ArrayPontosImg(UBound(ArrayPontosImg) - 1).bolInicializacao = False
ArrayPontosImg(UBound(ArrayPontosImg) - 1).lngValorX = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).lngValorY = ValorY
ReDim ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(5)
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(0).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(0).Y = ValorY - 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(1).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(1).Y = ValorY
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(2).X = ValorX
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(2).Y = ValorY + 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(3).X = ValorX - 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(3).Y = ValorY
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(4).X = ValorX + 1
ArrayPontosImg(UBound(ArrayPontosImg) - 1).ptnPontos(4).Y = ValorY
If (defPerfilGlobal = DefinicaoPerfil.pontosFulcrais) AndAlso (Not
IsNothing(myGraphics)) Then
identificaPerfilAutomaticamente(myGraphics)
End If
>
End If
End If
TracaRectas(lngHwnd, strNomeAnalise)
RaiseEvent registaPontoNaListagem(strNomePonto)
End Sub
Closed Thread