public void ProgramHasNoRuntimeErrors()
        {
            Console.WriteLine("Begin");
            Properties props                      = new Properties();
            string     currentDirectory           = Directory.GetCurrentDirectory();
            string     propertiesFileName         = currentDirectory + "\\properties.txt";
            string     USGSRatingCurveDownloadURL = "https://waterdata.usgs.gov/nwisweb/get_ratings?file_type=exsa&site_no=0";

            props.read(propertiesFileName);
            bool dataExists;

            foreach (Gage gage in props.MyGages)
            {
                gage.DownloadRatingCurve(USGSRatingCurveDownloadURL + gage.gageNumber.ToString(), currentDirectory + "\\" + gage.gageNumber.ToString() + ".txt");
                dataExists = gage.ParseRatingCurveTextfile(currentDirectory + "\\" + gage.gageNumber.ToString() + ".txt");
                if (dataExists)
                {
                    gage.ratingCurveRaw = LineThinner.DouglasPeukerReduction(gage.ratingCurveRaw, .01);
                    gage.ConvertToNAVD88();
                    gage.WriteToCSV(currentDirectory + "\\" + gage.gageNumber.ToString() + ".csv");
                }
                else
                {
                    //do nothing
                }
            }
            Console.WriteLine("Done");
        }
        public void visvaligamWhyattSimplifyShouldHaveSimilarAreaUnderCurve()
        {
            var SimpleLineIntegral = LineThinner.VisvaligamWhyattSimplify(50, yIsXsquared).getIntegratedArea();

            Assert.IsTrue(Math.Abs(SimpleLineIntegral - 323433) < .1 * 323433);
            //comparison number is true integral of y=x^2 from 0 to 99
        }
Exemple #3
0
        public IList <FingerPoint> FindFingerPoints(Contour contour, ConvexHull convexHull)
        {
            this.contourPoints = contour.Points;
            var thinnedHullPoints  = new LineThinner(this.settings.MinimumDistanceBetweenFingerPoints, true).Filter(convexHull.Points);
            var verifiedHullPoints = this.VerifyPointsByContour(thinnedHullPoints);

            return(verifiedHullPoints.Select(r => new FingerPoint(r)).ToList());
        }
Exemple #4
0
        public Palm FindCenter(Contour contour, IList <Point> candidates)
        {
            this.result = null;
            var minimizedContour = new LineThinner(contourReduction, false).Filter(contour.Points);

            this.FindCenterFromCandidates(minimizedContour, candidates);
            this.IncreaseAccuracy(this.result.Location, minimizedContour);
            return(result);
        }
Exemple #5
0
 public Palm FindCenter(ConvexHull hull, Contour contour, IList <Point> candidates)
 {
     this.result = null;
     candidates  = ReduceCandidatePoints(hull, candidates);
     if (candidates.Count > 0)
     {
         var minimizedContour = new LineThinner(contourReduction, false).Filter(contour.Points);
         this.FindCenterFromCandidates(minimizedContour, candidates);
         if (this.result != null)
         {
             this.IncreaseAccuracy(this.result.Location, minimizedContour);
         }
     }
     return(result);
 }
 public void douglasPeukerReductionShouldSaveLastPoint()
 {
     Assert.AreEqual(yIsXsquared.getPoint(yIsXsquared.getVerticesCount() - 1), LineThinner.DouglasPeukerReduction(yIsXsquared, .1).getPoint(27));
 }
 public void douglasPeukerReductionShouldSaveFirstPoint()
 {
     Assert.AreEqual(yIsXsquared.getPoint(0), LineThinner.DouglasPeukerReduction(yIsXsquared, .1).getPoint(0));
 }
 public void douglasPeukerReductionShouldHaveSimilarAreaUnderCurve()
 {
     Assert.IsTrue(Math.Abs((LineThinner.DouglasPeukerReduction(yIsXsquared, .1).getIntegratedArea()) - 323433) < .01 * 323433);
 }
 public void visvaligamWhyattSimplifyShouldKeepSpecifiedNumPoints()
 {
     Assert.AreEqual(LineThinner.VisvaligamWhyattSimplify(50, yIsXsquared).getVerticesCount(), 50);
 }
Exemple #10
0
 public FingerPointDetector(HandDataSourceSettings settings)
 {
     this.settings    = settings;
     this.lineThinner = new LineThinner(this.settings.MinimumDistanceBetweenFingerPoints, true);
 }