public void NumDecimalsTest() { Assert.AreEqual(DynamicMath.NumDecimals(2.1231m), 4); Assert.AreEqual(DynamicMath.NumDecimals(52352342.1231m), 4); Assert.AreEqual(DynamicMath.NumDecimals(52352342.12310m), 4); Assert.AreEqual(DynamicMath.NumDecimals(10000), 0); Assert.AreEqual(DynamicMath.NumDecimals(3), 0); Assert.AreEqual(DynamicMath.NumDecimals(3.0m), 0); Assert.AreEqual(DynamicMath.NumDecimals(0.00000106103m), 11); Debug.WriteLine("done"); }
/// <summary> /// Secondary constructor for when we want points at regular intervals. /// </summary> /// <param name="vLineShp"></param> /// <param name="rRasters"></param> /// <param name="outCSV"></param> /// <param name="ptsspacing"></param> public LinearExtractor(Vector vLineShp, List <Raster> rRasters, FileInfo outCSV, decimal ptsspacing, string FieldName) : base(rRasters, new List <Raster>()) { _vinput = vLineShp; _csvfile = outCSV; _spacing = (double)ptsspacing; // Write the last point. we need to round it a bit _spacingDecimals = DynamicMath.NumDecimals(ptsspacing); header = new List <ECols>() { ECols.FID, ECols.DISTANCE, ECols.STATION, ECols.X, ECols.Y }; sFieldName = FieldName; // Calling this again after setting the rows will give us a nicer chunk size SetOpExtent(OpExtent); _stream = new StreamWriter(_csvfile.FullName, true); WriteCSVHeaders(); GetFID0XY(); }