Entry 1958

test

   

Submitted by anonymous on June 26, 2009 at 3:58 a.m.
Language: C#. Code size: 2.8 KB.

public partial class GPSForm : Form
    {
        private MapPoint.Map map = null;
        private MapPoint.Location initial = null;
        private MapPoint.Shape oval = null;
        private MapPoint.Pushpin pushpin = null;
        private MapPoint.Shape textbox = null;
        private DataSet DS = null;
        private DataSet EVDS = null;
        public double currentLat;
        public double currentLong;
        public double currentAlt;


        public void gpsTick(float currentFrame, int GPSRow, double firstframe,
        	double additional)
        {
            //int PointOffset = (int)(GPSoffset);
            int currentgpspoint = GPSRow + (int)((double)((currentFrame 
            	- firstframe) * 0.0333333));
            if (currentgpspoint < (DS.Tables[0].Rows.Count - 1))
            {
                // get current GPS position for video frame
                double clatr = (double)(DS.Tables[0].Rows[currentgpspoint][2]);
                double clongr = (double)(DS.Tables[0].Rows[currentgpspoint][3]);
                double calt = (double)(DS.Tables[0].Rows[currentgpspoint][4]);
                MapPoint.Location curPOs=map.GetLocation(clatr, clongr, calt);

                //display a red oval for the current position of the car
                if (pushpin != null)
                {
                    pushpin.Delete();
                    pushpin = map.AddPushpin(curPOs, "Car's current position");
                    pushpin.Symbol = 9;
                }
                else
                {
                    pushpin = map.AddPushpin(curPOs, "Car's current position");
                    pushpin.Symbol = 9;
                }
                currentAlt = calt;
                currentLat = clatr;
                currentLong = clongr;
            }
            else
            {
                int lastPos = (DS.Tables[0].Rows.Count - 1);
                double clatr = (double)(DS.Tables[0].Rows[lastPos][2]);
                double clongr = (double)(DS.Tables[0].Rows[lastPos][3]);
                double calt = (double)(DS.Tables[0].Rows[lastPos][4]);
                MapPoint.Location curPOs = map.GetLocation(clatr, clongr, calt);

                //display a red oval for the current position of the car
                if (pushpin != null)
                {
                    pushpin.Delete();
                    pushpin = map.AddPushpin(curPOs, "Car's current position");
                    pushpin.Symbol = 9;
                }
                else
                {
                    pushpin = map.AddPushpin(curPOs, "Car's current position");
                    pushpin.Symbol = 9;
                }
                currentAlt = calt;
                currentLat = clatr;
                currentLong = clongr;
            }
        }

    }

This snippet took 0.02 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).