示例#1
0
        /* Checks to see if the uid has a layer associated with it
         * If it does, then add this cot message to that uid's list of time, lat, lon
         * If it doesn't, then create a new item in the list
         * After items are added to list, then call FP_drawer
         */
        public void AddCordsToList_andDraw(string _cotID, double _lat, double _lon, DateTime time, DateTime staleTime)
        {
            bool cotID_alreadyExists = false;
            bool isDataStale = false;
            DateTime timeWithStaleTimeAdded = time.AddSeconds(FalconPoint4.Properties.Settings.Default.HowLongForStale);

            // Determine if time is stale
            if ((time.AddSeconds(FalconPoint4.Properties.Settings.Default.HowLongForStale) <= staleTime))
                isDataStale = true;

            for(int i=0; i<FP_layerList.Count; i++) // itterate through list to see if the current cotID has already been added to list
            {
                if (FP_layerList[i].cotID == _cotID) // if we already have this cotID in our list
                {
                    FPdrawer drawPT_instance = new FPdrawer(); // create a new instance of the drawer class

                    // draw point
                    // if cot uid already exists in list, then use it's layer
                    drawPT_instance.CreatePoint(FP_point,FP_layerList[i].Layer, FP_layerList[i], _cotID, _lat, _lon, time, isDataStale);

                    LayerList.LatLongList temp_latLonList = new LayerList.LatLongList(); // temp list used to add lat and lon to our sub list... basically one main list holds LAYER and COTid and that list conists of another list that stores multiple lat, lon and times
                    temp_latLonList.lat = _lat;
                    temp_latLonList.lon = _lon;
                    temp_latLonList.time = time;

                    FP_layerList[i].FP_LatLonlist.Add(temp_latLonList); // add the temp data to the main list
                    temp_latLonList = new LayerList.LatLongList(); // create a new temp list

                    cotID_alreadyExists = true; // used to keep us from jumping into the next if... prob could use else
                }
            }

            if(cotID_alreadyExists == false) // if we don't have this cotID in our list
            {
                CreateLayer(_cotID); // if we don't have this cotID, then we need to create a new layer
                FPdrawer drawPT_instance = new FPdrawer(); // create a new instance of the drawer class
                drawPT_instance.CreatePoint(FP_point, currentLayerHandle,new LayerList(), _cotID, _lat, _lon, time, isDataStale); // use the newly created layer
            }
        }
        /* Checks to see if the uid has a layer associated with it
         * If it does, then add this cot message to that uid's list of time, lat, lon
         * If it doesn't, then create a new item in the list
         * After items are added to list, then call FP_drawer
         */
        public void AddCordsToList_andDraw(string _cotID, double _lat, double _lon, DateTime time, DateTime staleTime)
        {
            //Haversine newDistance = new Haversine();

            //double distance = newDistance.Distance();

            bool cotID_alreadyExists = false;
            bool isDataStale = false;

            displayChoice = (int)(_FPmainAddr.DisplayChoice); // get the users display choice

            if (staleTime <= time)
                isDataStale = true;

            for(int i=0; i<FP_layerList.Count; i++) // itterate through list to see if the current cotID has already been added to list
            {
                if (FP_layerList[i].cotID == _cotID) // if we already have this cotID in our list
                {
                    FPdrawer drawPT_instance = new FPdrawer(); // create a new instance of the drawer class

                    drawPT_instance.CreatePoint(FP_point,FP_layerList[i].Layer, FP_layerList[i], _cotID, _lat, _lon, time, isDataStale, displayChoice); // if cot uid already exists in list, then use it's layer

                    LayerList.LatLongList temp_latLonList = new LayerList.LatLongList(); // temp list used to add lat and lon to our sub list... basically one main list holds LAYER and COTid and that list conists of another list that stores multiple lat, lon and times
                    temp_latLonList.lat = _lat;
                    temp_latLonList.lon = _lon;
                    temp_latLonList.time = time;

                    FP_layerList[i].FP_LatLonlist.Add(temp_latLonList); // add the temp data to the main list
                    temp_latLonList = new LayerList.LatLongList(); // create a new temp list

                    cotID_alreadyExists = true; // used to keep us from jumping into the next if... prob could use else
                }
            }

            if(cotID_alreadyExists == false) // if we don't have this cotID in our list
            {
                CreateLayer(_cotID); // if we don't have this cotID, then we need to create a new layer
                FPdrawer drawPT_instance = new FPdrawer(); // create a new instance of the drawer class
                drawPT_instance.CreatePoint(FP_point, currentLayerHandle,new LayerList(), _cotID, _lat, _lon, time, isDataStale, displayChoice); // use the newly created layer
            }
        }