示例#1
0
 public static PointPairList ToSlice(this PointPairList list, double min, double max)
 {
     if (max <= min) { min = 0; max = 1; }
     PointPairList temp = new PointPairList();
     int minindex = list.IndexOf(list.FirstOrDefault(a => a.X >= min));
     minindex = minindex < 0 ? 0 : minindex;
     int maxindex = list.FindLastIndex(delegate(PointPair pp) { return pp.X <= max; });
     temp.AddRange(list.GetRange(minindex, maxindex - minindex));
     return temp;
 }
 private PointPairList getPoints(Type t, string field, int channel)
 {
     PointPairList p = new PointPairList();
     lock (uavobjectData)
     {
         p.AddRange(
             uavobjectData.Where(j => j.type == t && j.fieldName == field && j.channel == channel)
             .Select(h =>
                 new PointPair(
                     (double)h.timestamp,
                     h.value
                     )
                 ));
     }
     return p;
 }