コード例 #1
0
ファイル: TestMoveTo.cs プロジェクト: usbr/Pisces
        public void SimpleMoveTo()
        {
            Series ts = TestData.Simple2Day;
              Series original = TestData.Simple2Day;
              Selection sel = new Selection(ts[0].DateTime,ts[ts.Count-1].DateTime,0,50);
              Reclamation.TimeSeries.Math.MoveTo(ts,sel,123.456);

              Console.WriteLine("after move to");
              ts.WriteToConsole(true);
              Console.WriteLine("original");
              original.WriteToConsole(true);
              for(int i=0; i<ts.Count; i++)
              {
            if(original[i].Value >=0 && original[i].Value <=50)
            {
            Assert.AreEqual(123.456,ts[i].Value,0.0001);
              Assert.AreEqual("Edited",ts[i].Flag);
            }
            else
            {
             Assert.AreEqual("",ts[i].Flag);
             Assert.AreEqual(original[i].Value,ts[i].Value,0.0001);
            }
              }
        }
コード例 #2
0
ファイル: Math.cs プロジェクト: usbr/Pisces
 /// <summary>
 /// Applies vertical offset to data in selection
 /// </summary>
 public static void Offset(Series s, Selection selected, double verticalOffset)
 {
     if (s.ReadOnly)
     {
         return;
     }
     for (int i = 0; i < s.Count; i++)
     {
         if (s[i].BoundedBy(selected))
         {
             Point pt = s[i];
             pt.Value = pt.Value + verticalOffset;
             pt.Flag = "Edited";
             s[i] = pt;
         }
     }
 }
コード例 #3
0
ファイル: Point.cs プロジェクト: usbr/Pisces
 public bool BoundedBy(Selection select)
 {
     return BoundedBy(select.t1,select.t2,select.ymin,select.ymax);
 }
コード例 #4
0
ファイル: Math.cs プロジェクト: usbr/Pisces
        /// <summary>
        /// moves all values in selection to specified value.
        /// can be useful in two part editing.
        /// first: move many outliers to a known datum (using MoveTo)
        /// second: manually move points one by one (using point move feature of Series Graph)
        /// </summary>
        public static void MoveTo(Series s, Selection selected, double newValue)
        {
            if (s.ReadOnly)
            {
                return;
            }
            for (int i = 0; i < s.Count; i++)
            {
                if (s[i].BoundedBy(selected))
                {
                    Console.WriteLine("moving ");

                    Point pt = s[i];
                    Console.WriteLine(pt);
                    pt.Value = newValue;
                    pt.Flag = "Edited";
                    Console.WriteLine("to ");
                    Console.WriteLine(pt);
                    s[i] = pt;
                }
            }
        }