Пример #1
0
        /// <summary>
        /// Pass-through constructor for Raster Math with a scalar operand
        /// </summary>
        /// <param name="otType"></param>
        /// <param name="rInput"></param>
        /// <param name="dOperand"></param>
        /// <param name="sOutputRaster"></param>
        public RasterMultiMath(RasterOperators.MultiMathOpType otType, List <Raster> rasters,
                               Raster rOutputRaster) : base(rasters, new List <Raster> {
            rOutputRaster
        })
        {
            _type = otType;

            if (rasters.Count < 2)
            {
                throw new ArgumentException(String.Format("Must pass in at least 2 rasters ({0} found)", rasters.Count));
            }
        }
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                this.DialogResult = DialogResult.None;
                return;
            }

            RasterOperators.MultiMathOpType eMethod = (RasterOperators.MultiMathOpType)((naru.db.NamedObject)cboMethod.SelectedItem).ID;

            List <Tuple <DEMSurvey, ErrorSurface> > rInputs = new List <Tuple <DEMSurvey, ErrorSurface> >();

            for (int i = 0; i < grdData.Rows.Count; i++)
            {
                DEMItem dem = grdData.Rows[i].DataBoundItem as DEMItem;
                if (!dem.Include)
                {
                    continue;
                }

                DataGridViewComboBoxCell comboCell = grdData.Rows[i].Cells["colError"] as DataGridViewComboBoxCell;
                BindingSource            bs        = comboCell.DataSource as BindingSource;
                ErrorSurface             err       = bs.Current as ErrorSurface;

                rInputs.Add(new Tuple <DEMSurvey, ErrorSurface>(dem._DEM, err));
            }

            Engines.ReferenceSurfaceEngine eng = new Engines.ReferenceSurfaceEngine(txtName.Text, rInputs, eMethod);

            System.IO.FileInfo fiOutput = ProjectManager.Project.GetAbsolutePath(txtPath.Text);
            System.IO.FileInfo fiError  = Surface.ErrorSurfaceRasterPath(fiOutput.Directory, txtName.Text);

            try
            {
                Cursor = Cursors.WaitCursor;

                Surface surf = eng.Run(fiOutput, fiError);
                ProjectManager.AddNewProjectItemToMap(surf);
                Cursor = Cursors.Default;
                MessageBox.Show("Reference surface generated successfully.", Properties.Resources.ApplicationNameLong, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                GCDException.HandleException(ex, "Error generating reference surface from DEM surveys.");
                this.DialogResult = DialogResult.None;
            }
        }