public FormLogs(IApplicationController controller, StratumModel stratum) : base() { this.Controller = controller; InitializeComponent(); this.KeyPreview = true; if (ViewController.PlatformType == PlatformType.WinCE) { this.WindowState = FormWindowState.Maximized; this._ceControlPanel.Visible = true; this.Menu = null; this.mainMenu1.Dispose(); this.mainMenu1 = null; } else if (ViewController.PlatformType == PlatformType.WM) { this._sip = new Microsoft.WindowsCE.Forms.InputPanel(); this.components.Add(_sip); this._dataGrid.SIP = this._sip; } this._dataGrid.CellValidating += new EditableDataGridCellValidatingEventHandler(_dataGrid_CellValidating); DataGridAdjuster.InitializeGrid(this._dataGrid); DataGridTableStyle tableStyle = DataGridAdjuster.InitializeLogColumns(stratum, _dataGrid); _logNumColumn = tableStyle.GridColumnStyles[CruiseDAL.Schema.LOG.LOGNUMBER] as EditableTextBoxColumn; }
public FormLogs(IApplicationController controller, StratumModel stratum) { this.Controller = controller; InitializeComponent(); this._dataGrid.AutoGenerateColumns = false; this._dataGrid.SuspendLayout(); this._dataGrid.Columns.AddRange( stratum.MakeLogColumns().ToArray()); this._dataGrid.ResumeLayout(); _logNumColumn = _dataGrid.Columns[CruiseDAL.Schema.LOG.LOGNUMBER] as DataGridViewTextBoxColumn; }
public void MakeSampleSelecterTest_100PCT() { var st = new StratumModel() { Method = "100PCT" }; var sg = new SampleGroupModel() { Stratum = st, SampleSelectorState = "something", SampleSelectorType = "something" }; sg.SampleSelectorState = null; Assert.IsNull(sg.MakeSampleSelecter()); Assert.IsNull(sg.Sampler); }
public void MakeSampleSelecterTest_3P() { var st = new StratumModel() { Method = "3P" }; var sg = new SampleGroupModel() { Stratum = st, SampleSelectorState = null, KZ = 100 }; Assert.IsNotNull(sg.MakeSampleSelecter()); Assert.IsNotNull(sg.Sampler); Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.ThreePSelecter)); Assert.AreEqual(100, ((ThreePSelecter)sg.Sampler).KZ); }
public void GetCountByHotKeyTest() { var stratum = new StratumModel(); var counts = new CountTreeVM[] { new CountTreeVM() { Tally = new TallyDO() { Hotkey = "A" } }, new CountTreeVM() {Tally = new TallyDO() { Hotkey = "Banana" } }, new CountTreeVM() {Tally = new TallyDO() { Hotkey = "cat" } }}; var samplegroups = new SampleGroupModel[] { new SampleGroupModel() { Counts = counts } }; stratum.SampleGroups = new List<SampleGroupModel>(samplegroups); Assert.IsTrue(stratum.GetCountByHotKey('A') == counts[0]); Assert.IsTrue(stratum.GetCountByHotKey('B') == counts[1]); Assert.IsTrue(stratum.GetCountByHotKey('C') == counts[2]); Assert.IsNull(stratum.GetCountByHotKey('0')); }
public void TestTreeTally() { var st = new StratumModel(); st.Method = CruiseDAL.Schema.CruiseMethods.STR; var sg = new SampleGroupModel(); sg.Stratum = st; sg.SamplingFrequency = 5; sg.InsuranceFrequency = 0; sg.SampleSelectorType = CruiseDAL.Enums.SampleSelectorType.Block.ToString(); CountTreeVM count = new CountTreeVM(); count.SampleGroup = sg; int numSamples = 10000; for (int i = 0; i < numSamples; i++) { _de.OnTally(count); } System.Diagnostics.Debug.WriteLine("Sample Count = " + _controller.SampleCount.ToString()); System.Diagnostics.Debug.WriteLine("ISample Count = " + _controller.ISampleCount.ToString()); }
public void PopulateHotKeyLookupTest() { var stratum = new StratumModel(); var counts = new CountTreeVM[] { new CountTreeVM() { Tally = new TallyDO() { Hotkey = "A" } }, new CountTreeVM() {Tally = new TallyDO() { Hotkey = "Banana" } }, new CountTreeVM() {Tally = new TallyDO() { Hotkey = "cat" } }}; var samplegroups = new SampleGroupModel[] { new SampleGroupModel() { Counts = counts } }; stratum.SampleGroups = new List<SampleGroupModel>(samplegroups); Assert.IsNotNull(stratum.HotKeyLookup); stratum.PopulateHotKeyLookup(); Assert.IsNotNull(stratum.HotKeyLookup); Assert.IsTrue(stratum.HotKeyLookup.ContainsKey('A')); Assert.IsTrue(stratum.HotKeyLookup.ContainsKey('B')); Assert.IsTrue(stratum.HotKeyLookup.ContainsKey('C')); }
public void ShowLogsView(StratumModel stratum, TreeVM tree) { throw new NotImplementedException(); }
public void ShowLogsView(StratumModel stratum, TreeVM tree) { if (stratum == null) { MessageBox.Show("Invalid Action. Stratum not set."); } this.GetLogsView(stratum).ShowDialog(tree); }
public FormLogs GetLogsView(StratumModel stratum) { if (_logViews.ContainsKey(stratum)) { return _logViews[stratum]; } FormLogs logView = new FormLogs(this.ApplicationController, stratum); _logViews.Add(stratum, logView); return logView; }
internal TreeVM CreateNewTreeEntryInternal(StratumModel stratum , SampleGroupModel sg , TreeDefaultValueDO tdv , bool isMeasure) { TreeVM newTree = new TreeVM(this.DAL); newTree.TreeCount = 0; newTree.CountOrMeasure = (isMeasure) ? "M" : "C"; newTree.CuttingUnit = this; if (sg != null) { newTree.SampleGroup = sg; if (tdv == null) { if (sg.TreeDefaultValues.IsPopulated == false) { sg.TreeDefaultValues.Populate(); } if (sg.TreeDefaultValues.Count == 1) { tdv = sg.TreeDefaultValues[0]; } } } if (stratum != null) { newTree.Stratum = stratum; } if (tdv != null) { newTree.SetTreeTDV(tdv); } newTree.Validate(); //newTree.Save(); return newTree; }
public TreeVM CreateNewTreeEntry(StratumModel stratum , SampleGroupModel sg , TreeDefaultValueDO tdv , bool isMeasure) { var tree = CreateNewTreeEntryInternal(stratum, sg, tdv, isMeasure); tree.TreeNumber = GetNextNonPlotTreeNumber(); return tree; }
void MakeSampleSelecterTest_FCM_PCM_helper(string method) { var st = new StratumModel() { Method = method }; //test: if sampling freq is 0 //then Sampler is null var sg = new SampleGroupModel() { Stratum = st, SamplingFrequency = 0 }; Assert.IsNull(sg.MakeSampleSelecter()); Assert.IsNull(sg.Sampler); //test: if sampling freq is > 0 //AND SampleSelectorType is not defined //THEN Sampler is not null //AND is of type Systematic sg = new SampleGroupModel() { Stratum = st, SamplingFrequency = 1, InsuranceFrequency = 1 }; Assert.IsNotNull(sg.MakeSampleSelecter()); Assert.IsNotNull(sg.Sampler); Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.SystematicSelecter)); var sampler = sg.Sampler as FMSC.Sampling.IFrequencyBasedSelecter; Assert.AreEqual(1, sampler.Frequency); Assert.AreEqual(1, sampler.ITreeFrequency); }
public void MakeSampleSelecterTest_STR() { var st = new StratumModel() { Method = "STR" }; //test: if sampling freq is 0 //then Sampler is null var sg = new SampleGroupModel() { Stratum = st, SamplingFrequency = 0, SampleSelectorState = "something" }; Assert.IsNull(sg.MakeSampleSelecter()); Assert.IsNull(sg.Sampler); //test: if sampling freq is > 0 //AND SampleSelectorType is not defined //THEN Sampler is not null //AND is of type Blocked sg = new SampleGroupModel() { Stratum = st, SamplingFrequency = 1, SampleSelectorState = "something" }; Assert.IsNotNull(sg.MakeSampleSelecter()); Assert.IsNotNull(sg.Sampler); Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.BlockSelecter)); var blockSampler = sg.Sampler as FMSC.Sampling.BlockSelecter; Assert.AreEqual(1, blockSampler.Frequency); //test: if sampling freq is > 0 //AND SampleSelectorType is Systematic //THEN Sampler is not null //AND is of type Systematic sg = new SampleGroupModel() { Stratum = st, SamplingFrequency = 1, SampleSelectorType = "SystematicSelecter", SampleSelectorState = "something" }; Assert.IsNotNull(sg.MakeSampleSelecter()); Assert.IsNotNull(sg.Sampler); Assert.IsInstanceOfType(sg.Sampler, typeof(FMSC.Sampling.SystematicSelecter)); var systmaticSampler = sg.Sampler as FMSC.Sampling.SystematicSelecter; Assert.AreEqual(1, systmaticSampler.Frequency); }
protected void DisplayTallyPanel(StratumModel stratumInfo) { System.Diagnostics.Debug.Assert(StrataViews.ContainsKey(stratumInfo)); if (!StrataViews.ContainsKey(stratumInfo)) { return; } Panel tallyContainer = StrataViews[stratumInfo]; // if strata is already displayed if (_visableTallyPanel != null && _visableTallyPanel == tallyContainer && tallyContainer.Visible == true) { // toggle off visability _visableTallyPanel.Visible = false; this.SelectedStratum = null; _visableTallyPanel = null; return; } else if (_visableTallyPanel != null && _visableTallyPanel != tallyContainer) { // hide current stratum _visableTallyPanel.Visible = false; } this.SelectedStratum = stratumInfo; _visableTallyPanel = tallyContainer; if (_visableTallyPanel != null) { _visableTallyPanel.Visible = true; } }
public bool ShowLimitingDistanceDialog(StratumModel stratum, PlotVM plot) { string logMessage = String.Empty; bool isVariableRadius = Array.IndexOf(CruiseDAL.Schema.CruiseMethods.VARIABLE_RADIUS_METHODS, stratum.Method) > -1; float bafOrFixedPlotSize = (isVariableRadius) ? stratum.BasalAreaFactor : stratum.FixedPlotSize; DialogResult dResult = ViewController.ShowLimitingDistanceDialog(bafOrFixedPlotSize, isVariableRadius, out logMessage); if (dResult == DialogResult.OK) { plot.Remarks += logMessage; return true; } return false; }