Пример #1
0
        private void UpdateStatistics()
        {
            var trkDump = trkLIFO.ToArray();

            if ((trkDump == null) || (trkDump.Length <= 0))
            {
                return;
            }

            float latSum = 0.0f, lonSum = 0.0f;
            float minLat = float.MaxValue, maxLat = float.MinValue;
            float minLon = float.MaxValue, maxLon = float.MinValue;

            for (int i = 0; i < trkDump.Length; i++)
            {
                lonSum += trkDump[i].X; latSum += trkDump[i].Y;

                if (trkDump[i].X < minLon)
                {
                    minLon = trkDump[i].X;
                }

                if (trkDump[i].X > maxLon)
                {
                    maxLon = trkDump[i].X;
                }

                if (trkDump[i].Y < minLat)
                {
                    minLat = trkDump[i].Y;
                }

                if (trkDump[i].Y > maxLat)
                {
                    maxLat = trkDump[i].Y;
                }
            }

            centroid.X = lonSum / trkDump.Length;
            centroid.Y = latSum / trkDump.Length;

            latRange.X = minLat;
            latRange.Y = maxLat;

            lonRange.X = minLon;
            lonRange.Y = maxLon;
        }
Пример #2
0
 public void AppendHistory(string text)
 {
     history.Add(text.Replace("\r\n", " "));
     historyLines = history.ToArray();
 }