Return to Homepage...
           
 

Welcome Guest Register Login Search The Forum Display List of Forum Members
 All Forums
  User Functions
 
Subject Topic: Pictures on top of the map Post Reply Post New Topic
Message posted by AJAM on 25 April 2003 at 8:43pm - IP Logged
View AJAM's Profile Search for other posts by AJAM Quote AJAM
AJAM
Avatar
Standard Member
Standard Member
Mexico
07 April 2003
21 Posts

It seems being the first owes more to the diff. time zones, so I take advantage while you guys sleep!

Here goes the first one.

Since we need to paint vehicles over the map and move them as data is received, there's a Public vehicle array to hold vehicle's data -besides being saved to a database.

Since speed of redraw is paramount I did not use de loadbitmap, letting inovagis do it's map thing and take care of bitmaps an other way.

1) First, have an picture control OVER the picture that'll show the maps, create copies of it like veh(1), veh(2) and so.
Upper limit of vehicles is limited by this, but we'll change it in due time. This is a lot easier and faster to implement.

2) Then on another VB form with an image control holding a lot of 32x32 bitmaps (made with IconArt*, excellent freeware), like iclib(0), iclib(1), and so. Thus, at runtime you can do something like:

                               veh(i).picture = frmImages.iclib(1).picture

...or change it whenever is desirable to do so, like showing different vehicle states.

What is important is to make sure that the vehicles are shown on the correct geo. location, so we have that info on the vehicles array (pseudo-VB code):

lat=mts(numero).vLat       ' updated when new data for vehicle number numero arrives
lon=mts(numero).vLon      ' same as above
veh(numero).visible=false ' turn it off for a moment
locate_mt(numero)            ' this sub converts from lat&lon to y&x into screen coord.
veh(numero).picture=frmImages.iclib(18).picture    ' i.e. a "normal" state icon
If (veh(numero).left>PosX1 and veh(numero).left<PosX2 and veh(numero).top>PosY1 and veh(numero).top<PosY2) then
     veh(numero).visible=true    ' turn it on again
Else
     ' do not turn it on if it is "outside" the shown area; we could zoom into it
     ' with a change of coordinates, or do nothing...

End If

 


'
' This sub converts from Lat & Lon to Y & X (screen coord)
'
Sub locate_mt(numero, lat, lon)

Dim PosGeoX, PosGeoY, angulo As Double 'remember option explicit!
Dim X, Y As Double
Dim Res As Double

PosGeoX = lon
PosGeoY = lat

If GeoX1 <> Empty Then
    Res = (GeoX2 - GeoX1) / (PosX2 - PosX1)
'caution here when PosX1->PosX2

    X = Screen.TwipsPerPixelX * (((PosGeoX - GeoX1) / Res) + PosX1)
    Y = Screen.TwipsPerPixelY * (((PosGeoY - GeoY2) / (-1 * Res)) + PosY1)
    veh(numero).Left = X
    veh(numero).Top = Y
End If

End Sub

Note the -1 in the lon calcule; all maps have intrinsic lat & lon signs, so we have to take care of result's signs to avoid crashing poor VB.
A screenshot of the result. veh(i)'s are the small trucks over the map and the one with red border is one that's no longer transmitting (caused by an error in the cellular number, not the app ;-)):

http://www.bcrux.com/docs/avl-gis.jpg

 

* Link: Icon Art


Message posted by riyaz_r on 26 May 2003 at 5:18pm - IP Logged
View riyaz_r's Profile Search for other posts by riyaz_r Quote riyaz_r
riyaz_r
Avatar
Standard Member
Standard Member
India
28 January 2003
19 Posts

Dear AJAM,

your mails have been very educative and informative for me. But still I have to learn lot more from you. I am very curuios to know how to identify a particular vehicle in a multi-vehicle tarcking system. How should I know that data (what if it is an SMS) is coming from a vehicle X should not be assigned to another Vehicle Y in the vehicle array.

I am also more interested to know how to convert the GPS NMEA output to into SMS before sending it to GSM modem. I have a GSM terminal but it cannot make the sms on its own. I have to directly connect to that GSM modem (Which is connected to GSP reciever via RS232) with hyper terminal program. I know that is a bad solution. I know all stuff of sending and receiving of SMS using GSM terminal, but my main worry is how to get GPS NMEA out as an SMS. please advise me a solution for this problem.

let me also know about using GPRS and radio modem (VHF) for tracking.

regards

Riyaz

 


If you wish to post a reply to this thread you must first Login
If you are not already registered you must first register

Forum Jump Post Reply Post New Topic
Printable version Printable version

Powered by Web Wiz Forums version 6.25
Copyright ©2001-2002 Web Wiz Guide


Banner Exchange by Exchange-it