Page 1 of 1

array of GpsToolsNET.Position

Posted: Thu Feb 12, 2009 10:43 am
by devprog_nc
Hi,

I would like to show on the map, some points.
All data of points (latitude, longitude, speed, etc.) are in a array.

Here is the code

Code: Select all

 For ee As Integer = 0 To 3 'ee = car
            dbl_longitude_test = tablo_lat(ee + 1, ee + 1, 1)
            dbl_latitude_test = tablo_lat(ee + 1, ee + 1, 2)
            If dbl_latitude_test <> 0.0 And dbl_latitude_test <> 0.0 Then
                objPosition_temps_reel(ee) = New GpsToolsNET.Position

                objpos_timer(ee) = New GpsToolsNET.Position
                objpos_timer(ee).Datum = GpsToolsNET.Datum.WGS_84
                objpos_timer(ee).Grid = GpsToolsNET.Grid.UTM_SOUTH
                objpos_timer(ee).Zone = "58k"
                objpos_timer(ee).Latitude = dbl_latitude_test
                objpos_timer(ee).Longitude = dbl_longitude_test

                obj_pdv_brush(ee) = New GpsViewNET.Brush()
                obj_pdv_brush(ee).Red = Col_primaire_rouge(ee)
                obj_pdv_brush(ee).Green = Col_primaire_vert(ee)
                obj_pdv_brush(ee).Blue = Col_primaire_bleu(ee)
                obj_pdv_brush(ee).Transparent = False

                obj_pdv_ellipse(ee) = Map1.NewEllipse
                obj_pdv_ellipse(ee).Width = diametre_ellipse
                obj_pdv_ellipse(ee).Height = diametre_ellipse
                obj_pdv_ellipse(ee).Brush = obj_pdv_brush(ee)
                obj_pdv_ellipse(ee).ID = boitier_client_ellipseID(ee + 1)
                obj_pdv_ellipse(ee).Position = objpos_timer(ee)

                label_um_tps_reel(ee) = Map1.NewLabel
                label_um_tps_reel(ee).Position = objpos_timer(ee)
                label_um_tps_reel(ee).OffsetY = 0
                label_um_tps_reel(ee).OffsetX = 80
                label_um_tps_reel(ee).TextFont.Face = "arial"
                label_um_tps_reel(ee).TextFont.Bold = True
                label_um_tps_reel(ee).TextFont.Size = 15
                label_um_tps_reel(ee).TextFont.Color.Blue = 0
                label_um_tps_reel(ee).TextFont.Color.Red = 0
                label_um_tps_reel(ee).TextFont.Color.Green = 0
                label_um_tps_reel(ee).Text = nom_boitier_client(ee + 1)

                Map1.Position = Nothing

                'Center the map on the point if checkbox of the car is checked
                If TXT_Suivi_valeur.Text <> "" Then
                    If (CInt(TXT_Suivi_valeur.Text)) = ee Then
                        objPosition_temps_reel(ee) = New GpsToolsNET.Position
                        objPosition_temps_reel(ee).Datum = GpsToolsNET.Datum.WGS_84
                        objPosition_temps_reel(ee).Grid = GpsToolsNET.Grid.UTM_SOUTH
                        objPosition_temps_reel(ee).Latitude = dbl_latitude_test
                        objPosition_temps_reel(ee).Longitude = dbl_longitude_test
                        Map1.Position = objPosition_temps_reel(ee)
                        Map1.Update()
                    End If
                End If
                Map1.Update()
                Map1.Refresh()
            End If
        Next ee
With this code, each point on the map is not deleted. I have some same point for one car.

If I don't use array objPosition_temps_reel, it does match.

I don't understand exactly where is the problem.

Could you help me ?

Thank you

Tems
New Caledonia

RE: array of GpsToolsNET.Position

Posted: Thu Feb 12, 2009 5:18 pm
by bbulla
Well it looks as if each time you go through the loop you create a new Position, Ellipse, and Label object each time. Have you tried creating these objects before the loop, and then in the loop just change the values to whatever the new coordinates are?

Brian

RE: array of GpsToolsNET.Position

Posted: Fri Feb 13, 2009 2:36 am
by devprog_nc
Hi Brian,

Thank for your help. Now it does match perfectly.


Tems.