Пример #1
0
 /// <summary>
 /// Copy Constructor (NOTE: Creates an EMPTY COPY!!!!)
 /// </summary>
 /// <param name="oldStats"></param>
 public DoDStats(DoDStats oldStats)
 {
     StatsUnits    = oldStats.StatsUnits;
     CellArea      = oldStats.CellArea;
     ErosionRaw    = new GCDAreaVolume();
     DepositionRaw = new GCDAreaVolume();
     ErosionThr    = new GCDAreaVolume();
     DepositionThr = new GCDAreaVolume();
     ErosionErr    = new GCDAreaVolume();
     DepositionErr = new GCDAreaVolume();
 }
Пример #2
0
 /// <summary>
 /// Initialize a fresh, new obejct with zeros
 /// </summary>
 /// <param name="cellArea"></param>
 /// <param name="vUnit"></param>
 public DoDStats(Area cellArea, UnitGroup sUnits)
 {
     StatsUnits    = sUnits;
     CellArea      = cellArea;
     ErosionRaw    = new GCDAreaVolume();
     DepositionRaw = new GCDAreaVolume();
     ErosionThr    = new GCDAreaVolume();
     DepositionThr = new GCDAreaVolume();
     ErosionErr    = new GCDAreaVolume();
     DepositionErr = new GCDAreaVolume();
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>PGB - 5 May 2011
        /// Change this so that the XML file is created when the file is created. This is needed because
        /// the XML file stores the name of the project, which is required now for the toolbar.</remarks>
        private void btnOK_Click(System.Object sender, System.EventArgs e)
        {
            if (!ValidateForm())
            {
                this.DialogResult = DialogResult.None;
                return;
            }

            try
            {
                Properties.Settings.Default.LastUsedProjectFolder = Path.GetDirectoryName(txtGCDPath.Text);
                Properties.Settings.Default.Save();

                if (CreateMode)
                {
                    // Creating a new project
                    Directory.CreateDirectory(Path.GetDirectoryName(txtGCDPath.Text));
                    System.IO.FileInfo          projectFile = new System.IO.FileInfo(txtGCDPath.Text);
                    GCDConsoleLib.GCD.UnitGroup units       = GetSelectedUnits();

                    GCDProject project = new GCDProject(txtName.Text, txtDescription.Text, projectFile, DateTime.Now, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), UnitsNet.Area.From(0, units.ArUnit), units);

                    UpdateProjectMetdata(project);

                    ProjectManager.CreateProject(project);
                }
                else
                {
                    // Editing properties of existing project
                    ProjectManager.Project.Name        = txtName.Text;
                    ProjectManager.Project.Description = txtDescription.Text;

                    // only allowed to change the units if there are no DEMs
                    if (ProjectManager.Project.DEMSurveys.Count < 1)
                    {
                        ProjectManager.Project.Units = GetSelectedUnits();
                    }

                    UpdateProjectMetdata(ProjectManager.Project);
                    ProjectManager.Project.Save();
                }
            }
            catch (Exception ex)
            {
                DialogResult            = DialogResult.None;
                ex.Data["Project Name"] = txtName.Text;
                ex.Data["XML File"]     = txtGCDPath.Text;
                ex.Data["Directory"]    = txtDirectory.Text;
                GCDException.HandleException(ex, "An error occured while trying to save the information");
            }
        }
Пример #4
0
        /// <summary>
        /// Create this object from nothing more than numbers and units. There are a lot of each.
        /// </summary>
        /// <param name="AreaErosion_Raw"></param>
        /// <param name="AreaDeposition_Raw"></param>
        /// <param name="AreaErosion_Thresholded"></param>
        /// <param name="AreaDeposition_Thresholded"></param>
        /// <param name="VolumeErosion_Raw"></param>
        /// <param name="VolumeDeposition_Raw"></param>
        /// <param name="VolumeErosion_Thresholded"></param>
        /// <param name="VolumeDeposition_Thresholded"></param>
        /// <param name="VolumeErosion_Error"></param>
        /// <param name="VolumeDeposition_Error"></param>
        /// <param name="cellArea"></param>
        /// <param name="sUnits"></param>
        public DoDStats(Area AreaErosion_Raw, Area AreaDeposition_Raw, Area AreaErosion_Thresholded, Area AreaDeposition_Thresholded,
                        Volume VolumeErosion_Raw, Volume VolumeDeposition_Raw, Volume VolumeErosion_Thresholded, Volume VolumeDeposition_Thresholded,
                        Volume VolumeErosion_Error, Volume VolumeDeposition_Error,
                        Area cellArea, UnitGroup sUnits)
        {
            StatsUnits = sUnits;
            CellArea   = cellArea;

            ErosionRaw    = new GCDAreaVolume(AreaErosion_Raw, VolumeErosion_Raw, cellArea, sUnits);
            DepositionRaw = new GCDAreaVolume(AreaDeposition_Raw, VolumeDeposition_Raw, cellArea, sUnits);

            ErosionThr    = new GCDAreaVolume(AreaErosion_Thresholded, VolumeErosion_Thresholded, cellArea, sUnits);
            DepositionThr = new GCDAreaVolume(AreaDeposition_Thresholded, VolumeDeposition_Thresholded, cellArea, sUnits);

            // Note that we don't store Area for the error so let's just set it to 0
            ErosionErr    = new GCDAreaVolume(Area.FromSquareMeters(0), VolumeErosion_Error, cellArea, sUnits);
            DepositionErr = new GCDAreaVolume(Area.FromSquareMeters(0), VolumeDeposition_Error, cellArea, sUnits);
        }
Пример #5
0
 /// <summary>
 /// Initialize using area / vol and cell area
 /// </summary>
 /// <param name="ar"></param>
 /// <param name="vol"></param>
 /// <param name="cellArea"></param>
 /// <param name="projectUnits">WARNING: Must always pass in the GCD project units.</param>
 /// <returns></returns>
 /// <remarks>Never pass in display units or any other units than the project units because
 /// _sum member variable is stored in the project vertical units.</remarks>
 public GCDAreaVolume(Area ar, Volume vol, Area cellArea, UnitGroup projectUnits)
 {
     SetArea(ar, cellArea);
     SetVolume(vol, cellArea, projectUnits);
 }