Exemple #1
0
        private void GetDisplayValues(bool bArea)
        {
            // Note that the key to this dictionary is the histogram elevation values in their ORIGINAL units
            // while the elevation properties of the HistogramDisplayDataPoint should be in the display units
            histoData = new Dictionary <decimal, HistogramDisplayData>();

            for (int bid = 0; bid < _thrHist.Count; bid++)
            {
                // Make a dictionary entry if we don't already have one
                decimal bincentre = (decimal)_thrHist.BinCentre(bid, DataUnits).As(DisplayUnits.VertUnit);
                if (!histoData.ContainsKey(bincentre))
                {
                    histoData[bincentre] = new HistogramDisplayData(bincentre);
                }

                if (bArea)
                {
                    histoData[bincentre].Threshold = (decimal)(_thrHist.BinArea(bid, Project.ProjectManager.Project.CellArea).As(DisplayUnits.ArUnit));
                }
                else
                {
                    histoData[bincentre].Threshold = Math.Abs((decimal)_thrHist.BinVolume(bid, Project.ProjectManager.Project.CellArea, DataUnits).As(DisplayUnits.VolUnit));
                }
            }

            if ((_rawHist != null))
            {
                for (int bid = 0; bid < _rawHist.Count; bid++)
                {
                    // Make a dictionary entry if we don't already have one
                    decimal bincentre = (decimal)_rawHist.BinCentre(bid, DataUnits).As(DisplayUnits.VertUnit);
                    if (!histoData.ContainsKey(bincentre))
                    {
                        histoData[bincentre] = new HistogramDisplayData(bincentre);
                    }

                    if (bArea)
                    {
                        histoData[bincentre].Raw = (decimal)(_rawHist.BinArea(bid, Project.ProjectManager.Project.CellArea).As(DisplayUnits.ArUnit)) - histoData[bincentre].Threshold;
                    }
                    else
                    {
                        histoData[bincentre].Raw = Math.Abs((decimal)_rawHist.BinVolume(bid, Project.ProjectManager.Project.CellArea, DataUnits).As(DisplayUnits.VolUnit)) - histoData[bincentre].Threshold;
                    }
                }
            }
        }
Exemple #2
0
        public void BinVolumeTest()
        {
            Histogram rTest1 = new Histogram(20, 1);

            //Add some fake values into the mix
            for (int i = 0; i < 20; i++)
            {
                rTest1.AddBinVal((double)i - 9.9);
            }

            // Make sure our unit conversions are working
            decimal cH = -0.2m; //Foots
            decimal cW = 0.3m;  //Foots

            UnitGroup ug       = new UnitGroup(VolumeUnit.ImperialBeerBarrel, AreaUnit.SquareInch, LengthUnit.Foot, LengthUnit.Meter);
            Area      cellArea = Area.From((double)Math.Abs(cH * cW), AreaUnit.SquareFoot);

            for (int i = 0; i < 20; i++)
            {
                // Length(m) X Width(m) X Height(ft)
                double manualvolume = Volume.From(cellArea.SquareMeters * Length.FromFeet(i - 9.9).Meters, VolumeUnit.CubicMeter).ImperialBeerBarrels;
                Assert.AreEqual(rTest1.BinVolume(i, cellArea, ug).As(ug.VolUnit), manualvolume, 0.0000001);
            }
        }