Exemple #1
0
        public void sortPoints()
        {
            eniquePoints = new List <EniquePoint>();
            string splitMeasure = "Time Stamp|SSID|BSSID|Strength|Primary Channel|Primary Frequency|Center Channel|Center Frequency|Width (Range)|Distance|Security";

            string[]      stringmeasurmentsRawSeparators = new string[] { "Time Stamp|SSID|BSSID|Strength|Primary Channel|Primary Frequency|Center Channel|Center Frequency|Width (Range)|Distance|Security" };
            string[]      measurmentsRaw       = rawFile.Split(stringmeasurmentsRawSeparators, StringSplitOptions.None);
            ObserverPoint currentObserverPoint = new ObserverPoint();

            currentObserverPoint.posx     = Int32.Parse(tbPosx.Text);
            currentObserverPoint.posy     = Int32.Parse(tbPosy.Text);
            currentObserverPoint.measures = new List <OneMeasure>();
            int i = 1;

            for (; i < measurmentsRaw.Length; i++)
            {
                OneMeasure oneMeasure = new OneMeasure();
                oneMeasure.points = new List <WiFiPoint>();
                string[] parseinfoRawSeparator = new string[] { "qqqqq" };
                string[] parseinfoRaw          = measurmentsRaw[i].Split(parseinfoRawSeparator, StringSplitOptions.None);
                int      k = 0;
                for (; k < parseinfoRaw.Length - 1; k++)
                {
                    string[] s = parseinfoRaw[k].Split('|');

                    WiFiPoint wifiPoint = new WiFiPoint()
                    {
                        timeStamp        = s[0],
                        SSId             = s[1],
                        BSSID            = s[2],
                        Strength         = s[3],
                        primaryChannel   = s[4],
                        PrimaryFrequency = s[5],
                        centerChannel    = s[6],
                        centerFrequency  = s[7],
                        Range            = s[8],
                        Distance         = s[9],
                        Security         = s[10]
                    };
                    oneMeasure.points.Add(wifiPoint);
                }
                currentObserverPoint.measures.Add(oneMeasure);
            }
            if (area.observerPoints.Count == 0)
            {
                area.minMeasures = currentObserverPoint.measures.Count;
            }
            else
            {
                if (currentObserverPoint.measures.Count < area.minMeasures)
                {
                    area.minMeasures = currentObserverPoint.measures.Count;
                }
            }
            area.observerPoints.Add(currentObserverPoint);
            preparePointsForDraw();
        }
Exemple #2
0
 private void preparePointsForDraw()
 {
     if (area.observerPoints.Count > 1)
     {
         area.pointsForDraw.Clear();
         for (int i = 1; i < area.observerPoints.Count; i++)
         {
             ObserverPoint       observerPointOne     = area.observerPoints[i - 1];
             ObserverPoint       observerPointTwo     = area.observerPoints[i];
             PairedPointsForDraw currentPointsForDraw = new PairedPointsForDraw();
             currentPointsForDraw.measuresOfCommonPoints = new List <List <CommonPoint> >();
             currentPointsForDraw.pointOnePosX           = observerPointOne.posx;
             currentPointsForDraw.pointOnePosY           = observerPointOne.posy;
             currentPointsForDraw.pointTwoPosX           = observerPointTwo.posx;
             currentPointsForDraw.pointTwoPosY           = observerPointTwo.posy;
             for (int measure = 0; measure < area.minMeasures; measure++)
             {
                 List <WiFiPoint>   pointOnePoints = observerPointOne.measures[measure].points;
                 List <WiFiPoint>   pointTwoPoints = observerPointTwo.measures[measure].points;
                 List <CommonPoint> commonPointsForCurrentMeasure = new List <CommonPoint>();
                 for (int pointOneIterator = 0; pointOneIterator < pointOnePoints.Count; pointOneIterator++)
                 {
                     for (int pointTwoIterator = 0; pointTwoIterator < pointTwoPoints.Count; pointTwoIterator++)
                     {
                         if (!pointOnePoints[pointOneIterator].SSId.Equals("", StringComparison.InvariantCultureIgnoreCase))
                         {
                             if (pointOnePoints[pointOneIterator].SSId.Equals(pointTwoPoints[pointTwoIterator].SSId, StringComparison.InvariantCultureIgnoreCase))
                             {
                                 CommonPoint commonPoint = new CommonPoint();
                                 commonPoint.ssid             = pointOnePoints[pointOneIterator].SSId;
                                 commonPoint.metersToPointOne = Int32.Parse(pointOnePoints[pointOneIterator].Distance.Replace("~", "").Split('.')[0]);
                                 commonPoint.metersToPointTwo = Int32.Parse(pointTwoPoints[pointTwoIterator].Distance.Replace("~", "").Split('.')[0]);
                                 commonPointsForCurrentMeasure.Add(commonPoint);
                             }
                         }
                     }
                 }
                 currentPointsForDraw.measuresOfCommonPoints.Add(commonPointsForCurrentMeasure);
             }
             area.pointsForDraw.Add(currentPointsForDraw);
         }
         Console.WriteLine("Points Prepared for draw");
         Console.WriteLine("Points Sorted");
         List <int> cbSelectedMeasureDataSource = new List <int>();
         for (int cbSelectedMeasureDataSourceIndex = 0; cbSelectedMeasureDataSourceIndex < area.minMeasures; cbSelectedMeasureDataSourceIndex++)
         {
             cbSelectedMeasureDataSource.Add(cbSelectedMeasureDataSourceIndex);
         }
         cbSelectedMeasure.DataSource = cbSelectedMeasureDataSource;
     }
 }