示例#1
0
        /// <summary>
        /// Changes the order of the survey items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdMoveUp_Click(object sender, EventArgs e)
        {
            //disable cellenter event and reenable after operation is done to prevent cellenter events from firing
            grdDEMs.CellEnter -= grdDEMs_CellEnter;


            DEMSurveyItem selectedDEM = (DEMSurveyItem)grdDEMs.SelectedRows[0].DataBoundItem;
            int           index       = DEMs.IndexOf(selectedDEM);

            //disable all combobox event handlers
            DataGridViewComboBoxCell comboCell = grdDEMs[2, index] as DataGridViewComboBoxCell;

            if (index > 0)
            {
                DEMs.Remove(selectedDEM);
                DEMs.Insert(index - 1, selectedDEM);

                //populate error surfaces
                UpdateDEMErrorSurface(index - 1);

                grdDEMs.Rows[index - 1].Selected = true;
            }

            //Update list of epochs
            UpdateEpochQueue();

            grdDEMs.CellEnter += grdDEMs_CellEnter;
        }
示例#2
0
        /// <summary>
        /// Handler support for when error surfaces change
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Get selected error surface
            ComboBox     cbo = (ComboBox)sender;
            ErrorSurface selectedDEMErrorSurface = (ErrorSurface)cbo.SelectedItem;

            //set selected error surface on relevant DEMSurveyItem
            DEMSurveyItem selectedDEM = (DEMSurveyItem)grdDEMs.SelectedRows[0].DataBoundItem;

            selectedDEM.SelectedErrorSurface = selectedDEMErrorSurface;

            //Update list of epochs (necessary because we need to make sure the epoch has the correct error surface
            UpdateEpochQueue();
        }
示例#3
0
        /// <summary>
        /// Returns a list of active DEMs
        /// </summary>
        /// <returns></returns>
        private List <DEMSurveyItem> GetActiveDEMs()
        {
            List <DEMSurveyItem> ActiveDEMs = new List <DEMSurveyItem>();

            for (int i = 0; i < DEMs.Count; i++) //loop through all surveys
            {
                DEMSurveyItem CurrentDEM = DEMs[i];
                //if active, add to list of active DEMs
                if (CurrentDEM.IsActive)
                {
                    ActiveDEMs.Add(CurrentDEM);
                }
            }

            return(ActiveDEMs);
        }
示例#4
0
        /// <summary>
        /// Returns list of All DEMs Minus The Previous DEM Epochs
        /// </summary>
        /// <returns></returns>
        private List <Epoch> PopulateAllDEMsMinusThePreviousDEM()
        {
            List <Epoch> AllDEMsMinusThePreviousDEM = new List <Epoch>();

            List <DEMSurveyItem> ActiveDEMs = GetActiveDEMs(); //only use active survey items

            if (ActiveDEMs.Count < 2)                          //check there is more than one active survey item
            {
                return(AllDEMsMinusThePreviousDEM);
            }

            for (int i = 0; i < ActiveDEMs.Count - 1; i++)
            {
                DEMSurveyItem newDEM   = ActiveDEMs[i];
                DEMSurveyItem oldDEM   = ActiveDEMs[i + 1];
                Epoch         NewEpoch = new Epoch(newDEM.DEM, newDEM.SelectedErrorSurface, oldDEM.DEM, oldDEM.SelectedErrorSurface);
                AllDEMsMinusThePreviousDEM.Add(NewEpoch);
            }

            return(AllDEMsMinusThePreviousDEM);
        }
示例#5
0
        /// <summary>
        /// Returns list of All DEMs Minus The Earliest DEM epochs
        /// </summary>
        /// <returns></returns>
        private List <Epoch> PopulateAllDEMsMinusTheEarliestDEMs()
        {
            List <Epoch> AllDEMsMinusTheEarliestDEMs = new List <Epoch>();

            List <DEMSurveyItem> ActiveDEMs = GetActiveDEMs(); //only use active survey items

            if (ActiveDEMs.Count < 2)                          //check there is more than one active survey item
            {
                return(AllDEMsMinusTheEarliestDEMs);
            }

            DEMSurveyItem EarliestDEM = ActiveDEMs[ActiveDEMs.Count - 1];

            for (int i = 0; i < ActiveDEMs.Count - 1; i++)
            {
                DEMSurveyItem OtherDEM = ActiveDEMs[i];
                Epoch         NewEpoch = new Epoch(OtherDEM.DEM, OtherDEM.SelectedErrorSurface, EarliestDEM.DEM, EarliestDEM.SelectedErrorSurface);
                AllDEMsMinusTheEarliestDEMs.Add(NewEpoch);
            }

            return(AllDEMsMinusTheEarliestDEMs);
        }
示例#6
0
        /// <summary>
        /// Returns list of Newest DEM Minus All Other DEMs Epochs
        /// </summary>
        /// <returns></returns>
        private List <Epoch> PopulateNewestDEMMinusAllOtherDEMs()
        {
            List <Epoch> NewestDEMMinusAllOtherDEMs = new List <Epoch>();

            List <DEMSurveyItem> ActiveDEMs = GetActiveDEMs(); //only use active survey items

            if (ActiveDEMs.Count < 2)                          //check there is more than one active survey item
            {
                return(NewestDEMMinusAllOtherDEMs);
            }

            DEMSurveyItem NewestDEM = ActiveDEMs[0];

            for (int i = 1; i < ActiveDEMs.Count; i++)
            {
                DEMSurveyItem OlderDEM   = ActiveDEMs[i];
                Epoch         FirstEpoch = new Epoch(NewestDEM.DEM, NewestDEM.SelectedErrorSurface, OlderDEM.DEM, OlderDEM.SelectedErrorSurface);
                NewestDEMMinusAllOtherDEMs.Add(FirstEpoch);
            }

            return(NewestDEMMinusAllOtherDEMs);
        }
示例#7
0
        /// <summary>
        /// Handles clicking the OK button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdOK_Click(object sender, EventArgs e)
        {
            //validate form
            if (!ValidateForm())
            {
                this.DialogResult = DialogResult.None;
                return;
            }

            try
            {
                //Change state of UI
                this.UseWaitCursor = true;

                cmdOK.Enabled          = false;
                cmdCancel.DialogResult = DialogResult.None;
                DisableForm();

                //set chronological order
                for (int i = 0; i < DEMs.Count; i++)
                {
                    DEMSurveyItem currentSurveyItem = DEMs[i];
                    DEMSurvey     currentDEMSurvey  = currentSurveyItem.DEM;
                    currentDEMSurvey.ChronologicalOrder = i;
                }
                ProjectManager.Project.Save();

                //setup and run batch engine
                ThresholdProps threshold    = ucThresholding1.ThresholdProperties;
                List <Epoch>   ActiveEpochs = Epochs.Where(epoch => epoch.IsActive == true).ToList();
                BatchEngine = new ChangeDetectionMultiEpoch(ActiveEpochs, ucAOI1.AOIMask, threshold);
                bgWorker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                GCDException.HandleException(ex);
            }
        }
示例#8
0
        /// <summary>
        /// Changes the order of the survey items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdMoveDown_Click(object sender, EventArgs e)
        {
            //disable cellenter event and reenable after operation is done to prevent cellenter events from firing
            grdDEMs.CellEnter -= grdDEMs_CellEnter;

            DEMSurveyItem selectedDEM = (DEMSurveyItem)grdDEMs.SelectedRows[0].DataBoundItem;
            int           index       = DEMs.IndexOf(selectedDEM);

            if (index < DEMs.Count - 1)
            {
                DEMs.Remove(selectedDEM);
                DEMs.Insert(index + 1, selectedDEM);

                //populate error surfaces
                UpdateDEMErrorSurface(index + 1);

                grdDEMs.Rows[index + 1].Selected = true;
            }

            //Update list of epochs
            UpdateEpochQueue();

            grdDEMs.CellEnter += grdDEMs_CellEnter;
        }