Profile | Register | Active Topics | Search | FAQ

Advanced Search
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 GpsTools
 GpsTools
 Show GpsGate.com positions in real time on map
 New Topic  Reply to Topic
 Printer Friendly
Digg this
Author Previous Topic Topic Next Topic  

johan
Forum Admin

Sweden
15389 Posts

Posted - 01/29/2007 :  14:26:58  Show Profile  Visit johan's Homepage  Reply with Quote

GpsTools + GpsGate.com

If you don't use GpsTools, but still want to integrate your application to GpsGate.com, please read this protocol specifications here.

Show position data from GpsGate.com in your GpsTools application

This guide will show you how to display a set of user (buddies) from GpsGate.com in real time on your GpsTools map.

1. Introduction

Using GpsGate.com SDK + GpsTools you can easily show positions fetched from GpsGate.com on a GpsTools map. You can only get positions from users that are in your buddy list.



2. Getting everything in place

1. Create an account by GpsGate.com
2. Download and install GpsTools SDK
3. Download and install GpsGate.com SDK
4. Open the "SimpleMap" or "MultiMap" sample and make the changes you find below. You need to make a reference to "GpsGate.Client.dll" found in GpsGate.com SDK

3. The code

	   using GpsGate.Client;
		
       private GpsGateClient m_client = null;
       private ListDictionary m_listPosition = new ListDictionary();
       
       public delegate void UpdateDelegate();

       void ConnectToGpsGateCom()
       {
            // GpsGate.com server
            m_client = new GpsGateClient("online.gpsgate.com", 30175);

            // Events
            m_client.TrackPointReceived += new GpsGateClient.TrackPointReceivedHandle(m_client_TrackPointReceived);
            m_client.Disconnected += new GpsGateClient.DisconnectdHandle(m_client_Disconnected); 

            // Connect (create account on GpsGate.com)
            m_client.Connect("username", "password");

            // Start receiving data for buddy list. Max speed of 5 second intervals
            m_client.RequestBuddyListTrackPoints(5);
		}
            
        void m_client_TrackPointReceived(GpsGateClient client, Franson.Geo.TrackPoint trackPoint, string strUsername)
        {
            // Will be called when any user in your buddy list updates his position

            // NOTE! This method is called in a new thread!
            // If shared data is used Invoike() or lock() must be used to make
            // sure we don't get any threading errors!

            // See if we have a position stored for this username
            GpsToolsNET.Position posTools = (GpsToolsNET.Position) m_listPosition[strUsername];

            if (posTools == null)
            {
                posTools = new GpsToolsNET.Position();
                // Keep it in list. Updating those positions will later move objects on map
                m_listPosition.Add(strUsername, posTools);

                // Create a label which we position 
                GpsViewNET.Label labelUser = map1.NewLabel();

                labelUser.Text = strUsername;
                labelUser.Brush.Transparent = false;
                labelUser.Position = posTools;
            }

            // GpsGate.Client.Position are not the same as GpsToolsNET.Position
            // We need to copy the lon/lat info
            posTools.Longitude = trackPoint.Position.Longitude;
            posTools.Latitude = trackPoint.Position.Latitude;

            // Map.Update() must be called in GUI thread.
            Invoke(new UpdateDelegate(m_Update));
        }

        void m_Update()
        {
            // Called in GUI thread
            map1.Update();
        }
       

totoro_lp
New Member

4 Posts

Posted - 09/17/2007 :  00:57:05  Show Profile  Reply with Quote
Hi,

I am having some problems with the codes. I have added "GpsGate.Client". But I still have errors like "GpsViewNET.Map" is not defined" etc.

Can someone advise me?
Go to Top of Page

johan
Forum Admin

Sweden
15389 Posts

Posted - 09/17/2007 :  03:17:35  Show Profile  Visit johan's Homepage  Reply with Quote
The sample above requires GpsTools SDK as well:
http://franson.com/gpstools

Note that you don't need GpsTools SDK to send data, it is only used to display the map in the sample above.

Regards,
Johan

Franson Support
Go to Top of Page

totoro_lp
New Member

4 Posts

Posted - 09/17/2007 :  05:23:36  Show Profile  Reply with Quote
Hi,

I have successful run "SimpleMap" on my desktop which has no GPS receiver. Now I would like to test "SimpleMap" in my PPC. How can I do it?

Regards,
Go to Top of Page

johan
Forum Admin

Sweden
15389 Posts

Posted - 09/17/2007 :  05:42:52  Show Profile  Visit johan's Homepage  Reply with Quote
Well, you create a project for Pocket PC, include the assemblies for Pocket PC and so on. It is the exact same thing, only that you do a Pocket PC project.

Regards,
Johan

Franson Support
Go to Top of Page

totoro_lp
New Member

4 Posts

Posted - 09/18/2007 :  04:11:23  Show Profile  Reply with Quote
Where do i add the given codes?

Go to Top of Page

zeeshanprojects
Average Member

Pakistan
38 Posts

Posted - 03/12/2008 :  04:55:43  Show Profile  Reply with Quote
this line gives an error "private ListDictionary m_listPosition = new ListDictionary();"
"ListDictionary" doest not contain any object under any class/library.
Go to Top of Page

zeeshanprojects
Average Member

Pakistan
38 Posts

Posted - 03/12/2008 :  07:23:01  Show Profile  Reply with Quote
Can U send this whole C sharp code in VB.NET. some of the things difficult to convert
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
GpsGate Forum © 2014 GpsGate AB Go To Top Of Page