public DialogResult ShowDialog(PlotVM plot, PlotStratum stratum, bool allowEdit)
        {
            _plot = plot as Plot3PPNT;
            _BS_plot.DataSource = _plot;
            _stratum = stratum;

            this.DialogResult = DialogResult.OK;

            this._kz3ppnt_lbl.Text = stratum.KZ3PPNT.ToString();

            return this.ShowDialog();
        }
 public void RefreshTreeView(PlotVM currentPlot)
 {
     if (currentPlot != null)
     {
         this._dataGrid.Enabled = true;
         //this._dataGrid.Focus();
     }
     else //no plot is selected
     {
         this._dataGrid.Enabled = false;     //disable data grid
     }
 }
 public System.Windows.Forms.DialogResult ShowPlotInfo(PlotVM plotInfo, PlotStratum stratum, bool allowEdit)
 {
     throw new NotImplementedException();
 }
        //public int? ShowNumericValueInput(int? min, int? max, int? initialValue, bool acceptNullInput)
        //{
        //    this.NumPadDialog.ShowDialog(min, max, initialValue, acceptNullInput);
        //    return this.NumPadDialog.UserEnteredValue;
        //}
        public DialogResult ShowPlotInfo(PlotVM plot, PlotStratum stratum, bool isNewPlot)
        {
            System.Diagnostics.Debug.Assert(plot != null);
            System.Diagnostics.Debug.Assert(stratum != null);

            if (stratum.Is3PPNT && isNewPlot)
            {
                using (var view = new Form3PPNTPlotInfo(this))
                {
            #if !NetCF
                    view.Owner = this._dataEntryView;
                    view.StartPosition = FormStartPosition.CenterParent;
            #endif
                    return view.ShowDialog(plot, stratum, isNewPlot);
                }
            }
            else
            {
                using (var view = new FormPlotInfo())
                {
            #if !NetCF
                    view.Owner = this._dataEntryView;
                    view.StartPosition = FormStartPosition.CenterParent;
            #endif
                    return view.ShowDialog(plot, stratum, isNewPlot);
                }
            }
        }
        protected void OnTally(CountTreeVM count, PlotVM plot)
        {
            System.Diagnostics.Debug.Assert(plot != null);
            TreeVM tree = null;
            if (Stratum.Method == CruiseMethods.FIX
                || Stratum.Method == CruiseMethods.PNT)
            {
                tree = plot.CreateNewTreeEntry(count, true);
                this.Controller.ViewController.ShowCruiserSelection(tree);

                tree.TrySave();
                CurrentPlot.AddTree(tree);

                SelectLastTree();
                return;
            }

            SampleGroupDO sg = count.SampleGroup;
            //if ((sg.TallyMethod & CruiseDAL.Enums.TallyMode.Manual) == CruiseDAL.Enums.TallyMode.Manual)
            //{
            //    TreeVM newTree;
            //    newTree = Controller.CreateNewTreeEntry(count, plot, true);
            //    count.TreeCount += sg.SamplingFrequency;
            //    this.Controller.TrySaveTree(newTree);
            //    Controller.OnTally();
            //    return;
            //}

            SampleSelecter sampler = (SampleSelecter)count.SampleGroup.Sampler;
            if (count.SampleGroup.Stratum.Is3P)
            {
                int kpi = 0;
                int? value = ViewController.AskKPI((int)count.SampleGroup.MinKPI, (int)count.SampleGroup.MaxKPI);
                if (value == null)
                {
                    return;
                }
                else
                {
                    kpi = value.Value;
                }

                //if kpi == -1 then tree is sure to measure
                if (kpi != -1)
                {
                    ThreePItem item = (ThreePItem)((ThreePSelecter)sampler).NextItem();

                    if (item != null && kpi > item.KPI)
                    {
                        //because the three p sample selector doesn't select insurance trees for us
                        //we need to select them our selves
                        if (sampler.IsSelectingITrees)
                        {
                            item.IsInsuranceItem = sampler.InsuranceCounter.Next();
                        }
                        if (item.IsInsuranceItem)
                        {
                            this.ViewController.SignalInsuranceTree();
                            tree = plot.CreateNewTreeEntry(count, true);
                            tree.CountOrMeasure = "I";
                        }
                        else
                        {
                            this.ViewController.SignalMeasureTree(true);
                            tree = plot.CreateNewTreeEntry(count, true);
                            //tree.CountOrMeasure = "M";
                        }
                    }
                    else
                    {
                        tree = plot.CreateNewTreeEntry(count, false);
                        //tree.CountOrMeasure = "C";
                    }
                    tree.KPI = kpi;
                }
                else
                {
                    tree = plot.CreateNewTreeEntry(count, true);
                    tree.STM = "Y";
                }
            }
            else
            {
                //count.TreeCount++; tree count doesn't get incremented for plots

                boolItem item = (sampler != null) ? (boolItem)sampler.NextItem() : (boolItem)null;
                if (item != null && !item.IsInsuranceItem)
                {
                    this.ViewController.SignalMeasureTree(true);
                    tree = plot.CreateNewTreeEntry(count, true);
                    //tree.CountOrMeasure = "M";
                }
                else if (item != null && item.IsInsuranceItem)
                {
                    this.ViewController.SignalInsuranceTree();
                    tree = plot.CreateNewTreeEntry(count, true);
                    tree.CountOrMeasure = "I";
                }
                else
                {
                    tree = plot.CreateNewTreeEntry(count, false);
                }
            }

            tree.TreeCount = 1;
            tree.TrySave();

            plot.AddTree(tree);
        }
 private void _BS_Plots_CurrentChanged(object sender, EventArgs e)
 {
     if (!_disableCheckPlot && _prevPlot != null && _prevPlot != CurrentPlot)
     {
         if (!this.CheckPlot(_prevPlot) && !this.SavePlotTrees(_prevPlot))
         {
             this.CurrentPlot = _prevPlot;
         }
     }
     this.UpdateCurrentPlot();
     _prevPlot = CurrentPlot;
 }
 public bool SavePlotTrees(PlotVM plot)
 {
     bool goOn = true;
     this.EndEdit();
     try
     {
         plot.SaveTrees();
     }
     catch (FMSC.ORM.SQLException)
     {
         if (!this.Controller.ViewController.AskYesNo("Can not save all trees in the plot, Would you like to continue?", "Continue?", MessageBoxIcon.Asterisk, true))
         {
             goOn = false;
         }
     }
     return goOn;
 }
 public bool CheckPlot(PlotVM pInfo)
 {
     if (pInfo != null)
     {
         this.EndEdit();
         if (!pInfo.ValidateTrees())
         {
             return this.View.AskContinueOnCurrnetPlotTreeError();
         }
     }
     return 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;
 }
Пример #10
0
        private void _plotInfo_BTN_Click(object sender, EventArgs e)
        {
            var stratum = new PlotStratum();
            var plot = new PlotVM() { Stratum = stratum };

            using (var view = new FormPlotInfo())
            {
                view.ShowDialog(plot, stratum, false);
            }
        }
Пример #11
0
        public void RefreshTreeView(PlotVM currentPlot)
        {
            if (currentPlot != null)
            {
                this._dataGrid.ReadOnly = !this._isGridExpanded;
                this._dataGrid.Enabled = true;
                //if (this.StratumInfo.Method != "3PPNT")
                //{
                //    this._dataGrid.AllowUserToAddRows = !this.CurrentPlotInfo.IsNull;
                //}
                //else
                //{
                //    this._dataGrid.AllowUserToAddRows = this.CurrentPlotInfo.Trees.Count > 0;
                //}

                this._dataGrid.Focus();
            }
            else //no plot is selected
            {
                this._dataGrid.Enabled = false;     //disable data grid
            }
        }