473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 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
Aug 26 '08 #1
7 1115
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" <Ri************@discussions.microsoft.coma écrit dans le
message de groupe de discussion :
F4**********************************@microsoft.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 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

Aug 26 '08 #2
Thank you for your answer.
What would you suggest instead of the array?
Aug 27 '08 #3
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" <Ri************@discussions.microsoft.coma écrit dans le
message de groupe de discussion :
7B**********************************@microsoft.com...
Thank you for your answer.
What would you suggest instead of the array?

Aug 27 '08 #4
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
Aug 27 '08 #5
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" <Ri************@discussions.microsoft.coma écrit dans le
message de groupe de discussion :
BF**********************************@microsoft.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

Aug 27 '08 #6
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
Aug 27 '08 #7
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" <Ri************@discussions.microsoft.comwrote in
message news:F4**********************************@microsof t.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 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
Aug 28 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: hemal | last post by:
I came across a very strange situation at work. There is an order of magnitude difference in execution time for the following two queries (10 v/s ~130 msec): select count(*) from table_name...
8
by: Hagen | last post by:
Hi, I have a question that you probably shouldn´t worry about since the compiler cares for it, but anyways: When you run your compiler with optimization turned on (eg. g++ with -Ox flag) and...
3
by: Peter Arrenbrecht | last post by:
Hi all We ran into a very annoying optimizer problem recently. We had added a new key and self-join relation to a large production table. That key will be filled very rarely and having just...
9
by: Andrea | last post by:
Hi, I've read the former postings but was not able to solve my problem: I have a Summary Table (or MQT as you like it) and the query optimizer does not seem to use the summary table. I run...
20
by: John Mark Howell | last post by:
I had a customer call about some C# code they had put together that was handling some large arrays. The performance was rather poor. The C# code runs in about 22 seconds and the equivalent...
14
by: romayankin | last post by:
Hello All, I'm writing cross-platform code so i'm bound to standards. Here is the code I have: ~~~~~~~~~~~~~~~~~~ double **mx = new double*; for(int i = 0; i < col - 1; i++) { mx = new...
2
by: boa sema | last post by:
Way back when, and at least in version 7 IIRC, the query optimizer gave up when the where clause in a statement contained more than 4 search conditions. Does anyone know if such a limitation...
3
by: aj | last post by:
DB2 LUW v8.2 FP 14 RHAS 2.1 Sorry if these are newbie questions. Optimizer stuff is black magic to me. For both of these, assume stats are current and an even distribution of data....
152
by: vippstar | last post by:
The subject might be misleading. Regardless, is this code valid: #include <stdio.h> void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); } int main(void) { double array = { {...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.