Beispiel #1
0
        public override void OnAdd(object sender, EventArgs e)
        {
            SurveyLibrary.frmImportRaster frm = SurveyLibrary.frmImportRaster.PrepareToImportRaster(DEM, SurveyLibrary.frmImportRaster.Purposes.AssociatedSurface, "Associated Surface", new IntPtr(0));

            if (EditTreeItem(frm) == DialogResult.OK)
            {
                GCDConsoleLib.Raster rAssoc = frm.ProcessRaster();
                AssocSurface         assoc  = new AssocSurface(frm.txtName.Text, rAssoc.GISFileInfo, DEM, AssocSurface.AssociatedSurfaceTypes.Other);
                DEM.AssocSurfaces.Add(assoc);
                ProjectManager.Project.Save();
                ProjectManager.AddNewProjectItemToMap(assoc);
                LoadChildNodes();

                // Loop through the child nodes and select the item that was just added
                foreach (TreeNode childNode in Nodes)
                {
                    if (childNode is TreeNodeItem)
                    {
                        if (((TreeNodeItem)childNode).Item.Equals(assoc))
                        {
                            TreeView.SelectedNode = childNode;
                            break;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public override void OnAdd(object sender, EventArgs e)
        {
            // Determine if this is the first DEM in the project or use the first existing DEM as a reference surface
            DEMSurvey referenceDEM = null;

            SurveyLibrary.frmImportRaster.Purposes ePurpose = SurveyLibrary.frmImportRaster.Purposes.FirstDEM;
            if (ProjectManager.Project.DEMSurveys.Count > 0)
            {
                referenceDEM = ProjectManager.Project.DEMSurveys.First();
                ePurpose     = SurveyLibrary.frmImportRaster.Purposes.SubsequentDEM;
            }

            try
            {
                SurveyLibrary.frmImportRaster frm = SurveyLibrary.frmImportRaster.PrepareToImportRaster(referenceDEM, ePurpose, "DEM Survey", new IntPtr(0));

                if (EditTreeItem(frm, false) == DialogResult.OK)
                {
                    GCDConsoleLib.Raster rDEM = frm.ProcessRaster();
                    DEMSurvey            dem  = new DEMSurvey(frm.txtName.Text, null, rDEM.GISFileInfo, Surface.HillShadeRasterPath(rDEM.GISFileInfo));
                    ProjectManager.Project.DEMSurveys.Add(dem);

                    // If this was the first raster then we need to store the cell resolution on the project
                    if (ePurpose == SurveyLibrary.frmImportRaster.Purposes.FirstDEM)
                    {
                        ProjectManager.Project.CellArea = dem.Raster.Extent.CellArea(ProjectManager.Project.Units);
                    }

                    ProjectManager.Project.Save();
                    ProjectManager.AddNewProjectItemToMap(dem);
                    LoadChildNodes();

                    // Loop through the child nodes and select the item that was just added
                    foreach (TreeNodeItem childNode in Nodes)
                    {
                        if (childNode.Item.Equals(dem))
                        {
                            TreeView.SelectedNode = childNode;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GCDException.HandleException(ex, "Error Importing DEM Survey");
            }
        }
Beispiel #3
0
        public override void OnAdd(object sender, EventArgs e)
        {
            DEMSurvey referenceDEM = null;

            if (ProjectManager.Project.DEMSurveys.Count > 0)
            {
                referenceDEM = ProjectManager.Project.DEMSurveys.First();
            }
            else
            {
                MessageBox.Show("You must have at least one DEM survey in your GCD project before you can generate a constant reference surface.", "DEM Surveys Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                SurveyLibrary.frmImportRaster frm = SurveyLibrary.frmImportRaster.PrepareToImportRaster(referenceDEM, SurveyLibrary.frmImportRaster.Purposes.ReferenceSurface, "Reference Surface", new IntPtr(0));

                if (EditTreeItem(frm, false) == DialogResult.OK)
                {
                    GCDConsoleLib.Raster    rDEM = frm.ProcessRaster();
                    GCDCore.Project.Surface surf = new Surface(frm.txtName.Text, rDEM.GISFileInfo, Surface.HillShadeRasterPath(rDEM.GISFileInfo));
                    ProjectManager.Project.ReferenceSurfaces.Add(surf);

                    ProjectManager.Project.Save();
                    LoadChildNodes();

                    ProjectManager.AddNewProjectItemToMap(surf);

                    // Loop through the child nodes and select the item that was just added
                    foreach (TreeNodeItem childNode in Nodes)
                    {
                        if (childNode.Item.Equals(surf))
                        {
                            TreeView.SelectedNode = childNode;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GCDException.HandleException(ex, "Error Importing DEM Survey");
            }
        }
Beispiel #4
0
        public override void OnAdd(object sender, EventArgs e)
        {
            string noun = "Reference Error Surface";

            SurveyLibrary.frmImportRaster.Purposes ePurpose = SurveyLibrary.frmImportRaster.Purposes.ReferenceErrorSurface;
            if (Surface is DEMSurvey)
            {
                ePurpose = SurveyLibrary.frmImportRaster.Purposes.ErrorSurface;
                noun     = "Error Surface";
            }

            SurveyLibrary.frmImportRaster frm = SurveyLibrary.frmImportRaster.PrepareToImportRaster(Surface, ePurpose, noun, new IntPtr(0));

            if (EditTreeItem(frm) == DialogResult.OK)
            {
                GCDConsoleLib.Raster raster = frm.ProcessRaster();
                ErrorSurface         err    = new ErrorSurface(frm.txtName.Text, raster.GISFileInfo, Surface, Surface.ErrorSurfaces.Count == 0, null);
                Surface.ErrorSurfaces.Add(err);
                ProjectManager.Project.Save();
                ProjectManager.AddNewProjectItemToMap(err);
                LoadChildNodes();

                // Loop through the child nodes and select the item that was just added
                foreach (TreeNode childNode in Nodes)
                {
                    if (childNode is TreeNodeItem)
                    {
                        if (((TreeNodeItem)childNode).Item.Equals(err))
                        {
                            TreeView.SelectedNode = childNode;
                            break;
                        }
                    }
                }
            }
        }