コード例 #1
0
ファイル: GCDArcMapManager.cs プロジェクト: tarinishukla/gcd
        private IGroupLayer AddSurveyGroupLayer(DEMSurvey dem)
        {
            IGroupLayer pInputsGrpLyr  = AddInputsGroupLayer();
            IGroupLayer pSurveysGrpLyr = ArcMapUtilities.GetGroupLayer(SurveysGroupLayer, pInputsGrpLyr);

            return(ArcMapUtilities.GetGroupLayer(dem.Name, pSurveysGrpLyr));
        }
コード例 #2
0
 public frmAssociatedSurface(DEMSurvey dem, AssocSurface assoc)
 {
     InitializeComponent();
     DEM       = dem;
     Assoc     = assoc;
     AssocType = assoc.AssocSurfaceType;
 }
コード例 #3
0
        private void PerformDoD(Epoch DoDEpoch, ThresholdProps tProps)
        {
            DEMSurvey NewDEM  = DoDEpoch.NewDEM;
            DEMSurvey OldDEM  = DoDEpoch.OldDEM;
            string    aoiName = AOIMask is Project.Masks.AOIMask ? AOIMask.Name : string.Empty;

            string dodName = frmDoDProperties.GetUniqueAnalysisName(NewDEM.Name, OldDEM.Name, tProps.ThresholdString, aoiName);

            System.IO.DirectoryInfo dFolder = ProjectManager.Project.GetDoDFolder();

            ChangeDetectionEngineBase cdEngine = null;

            switch (tProps.Method)
            {
            case ThresholdProps.ThresholdMethods.MinLoD:
                cdEngine = new ChangeDetectionEngineMinLoD(NewDEM, OldDEM, AOIMask, tProps.Threshold, true);
                break;

            case ThresholdProps.ThresholdMethods.Propagated:
                cdEngine = new ChangeDetectionEnginePropProb(NewDEM, OldDEM, DoDEpoch.NewDEMErrorSurface, DoDEpoch.OldDEMErrorSurface, AOIMask, true);
                break;

            case ThresholdProps.ThresholdMethods.Probabilistic:
                cdEngine = new ChangeDetectionEngineProbabilistic(NewDEM, OldDEM, AOIMask, DoDEpoch.NewDEMErrorSurface, DoDEpoch.OldDEMErrorSurface, tProps.Threshold, tProps.SpatialCoherenceProps, true);
                break;
            }

            DoDBase dod = cdEngine.Calculate(dodName, dFolder, true, ProjectManager.Project.Units);

            ProjectManager.Project.DoDs.Add(dod);
        }
コード例 #4
0
ファイル: GCDArcMapManager.cs プロジェクト: tarinishukla/gcd
        private IGroupLayer AddErrorSurfacesGroupLayer(DEMSurvey dem)
        {
            IGroupLayer pSurveyGrpLyr = AddSurveyGroupLayer(dem);
            IGroupLayer pErrGrpLyr    = ArcMapUtilities.GetGroupLayer(ErrorSurfacesGroupLayer, pSurveyGrpLyr);

            return(pErrGrpLyr);
        }
コード例 #5
0
ファイル: Epoch.cs プロジェクト: tarinishukla/gcd
 public Epoch(DEMSurvey newDEM, ErrorSurface newDEMErrorSurface, DEMSurvey oldDEM, ErrorSurface oldDEMErrorSurface)
 {
     NewDEM             = newDEM;
     NewDEMErrorSurface = newDEMErrorSurface;
     OldDEM             = oldDEM;
     OldDEMErrorSurface = oldDEMErrorSurface;
     IsActive           = true;
 }
コード例 #6
0
        public frmMultiMethodError(DEMSurvey dem)
        {
            InitializeComponent();
            DEM      = dem;
            ErrProps = new naru.ui.SortableBindingList <ErrorSurfaceProperty>();
            ucName.InitializeNewRaster("Error Surface", dem.ErrorSurfaces.Select(x => x.Name).ToList <string>(), DEM.ErrorSurfacesFolder, "Err");

            // Don't show the raster properties when creating a new raster
            tabControl1.TabPages.Remove(tabPage2);
        }
コード例 #7
0
        public frmSingleMethodError(DEMSurvey parentDEM)
        {
            InitializeComponent();
            DEM = parentDEM;

            ucErrProps.InitializeNew(m_sEntireDEMExtent, DEM.AssocSurfaces.ToList());
            ucName.InitializeNewRaster("Error Surface", DEM.ErrorSurfaces.Select(x => x.Name).ToList <string>(), DEM.ErrorSurfacesFolder, "Err");

            // Hide raster properties
            ucRasterProperties1.Visible = false;
            Height -= cmdOK.Top - ucRasterProperties1.Top;
        }
コード例 #8
0
        public DEMSurveyItem(DEMSurvey dem, ErrorSurface err)
        {
            DEM       = dem;
            ErrorSurf = err;

            ErrorSurfaces = new naru.ui.SortableBindingList <ErrorSurface>();
            foreach (ErrorSurface es in dem.ErrorSurfaces)
            {
                ErrorSurfaces.Add(es);
            }
            //IsActive = false;
        }
コード例 #9
0
ファイル: frmPointDensity.cs プロジェクト: tarinishukla/gcd
        public frmPointDensity(DEMSurvey dem)
        {
            InitializeComponent();

            DEM = dem;

            foreach (RasterOperators.KernelShapes shape in Enum.GetValues(typeof(RasterOperators.KernelShapes)))
            {
                int index = cboNeighbourhood.Items.Add(shape);
            }
            cboNeighbourhood.SelectedIndex = 0;

            ucPointCloud.InitializeBrowseNew("Point Cloud", GCDConsoleLib.GDalGeometryType.SimpleTypes.Point);
        }
コード例 #10
0
        public AssocGroup(TreeNodeCollection parentNodes, IContainer container, DEMSurvey dem)
            : base(parentNodes, "Associated Surfaces", "Associated Surface", "Associated Surfaces", dem.AssocSurfacesFolder, container)
        {
            DEM = dem;

            // Associated surface uses the same form for browsing to existing as well as calculating new
            // ContextMenuStrip.Items[0].Text = "Add Associated Surface";

            ContextMenuStrip.Items.Insert(1, new ToolStripMenuItem("Calculate New Percent Slope Associated Surface", Properties.Resources.sigma, OnCalculateSlopePercent));
            ContextMenuStrip.Items.Insert(1, new ToolStripMenuItem("Calculate New Slope Degrees Associated Surface", Properties.Resources.sigma, OnCalculateSlopeDegrees));
            ContextMenuStrip.Items.Insert(1, new ToolStripMenuItem("Calculate New Point Density Associated Surface", Properties.Resources.sigma, OnCalculatePointDensity));

            LoadChildNodes();
        }
コード例 #11
0
        public frmSingleMethodError(ErrorSurface errSurface)
        {
            InitializeComponent();
            DEM          = errSurface.Surf as DEMSurvey;
            ErrorSurface = errSurface;

            // Need to exclude the current item from this list
            List <string> existingNames = DEM.ErrorSurfaces.Where(x => !x.Equals(errSurface)).Select(x => x.Name).ToList();

            ucErrProps.InitializeExisting(errSurface.ErrorProperties.Values.First(), DEM.AssocSurfaces.ToList(), errSurface == null);
            ucName.InitializeExisting("Error Surface", existingNames, ErrorSurface.Name, ErrorSurface.Raster.GISFileInfo);

            // Initialize raster properties
            ucRasterProperties1.Initialize(errSurface.Noun, errSurface.Raster);
        }
コード例 #12
0
        public frmMultiMethodError(ErrorSurface errSurf)
        {
            InitializeComponent();
            DEM          = errSurf.Surf as DEMSurvey;
            ErrorSurface = errSurf;
            ErrProps     = new naru.ui.SortableBindingList <ErrorSurfaceProperty>(errSurf.ErrorProperties.Values.ToList());

            // Need to exclude the current item from this list
            List <string> existingNames = DEM.ErrorSurfaces.Where(x => !x.Equals(errSurf)).Select(x => x.Name).ToList();

            ucName.InitializeExisting("Error Surface", existingNames, ErrorSurface.Name, ErrorSurface.Raster.GISFileInfo);

            // Populate the raster statistics
            ucRasterProperties1.Initialize(errSurf.Noun, errSurf.Raster);
        }
コード例 #13
0
ファイル: GCDArcMapManager.cs プロジェクト: tarinishukla/gcd
        /// <summary>
        ///
        /// </summary>
        /// <param name="demRow"></param>
        /// <returns></returns>
        /// <remarks>Note: Add the hillshade first so that it appear UNDER the DEM in the TOC</remarks>
        public void AddDEM(DEMSurvey dem)
        {
            short       fDEMTransparency = (short)-1;
            IGroupLayer pSurveyLyr       = AddSurveyGroupLayer(dem);

            if (dem.Hillshade != null && dem.Hillshade.Raster.GISFileInfo.Exists)
            {
                AddRasterLayer(dem.Hillshade.Raster, null, dem.Name + " Hillshade", pSurveyLyr, "Aspect", -1, ExpandLegend: false);
                fDEMTransparency = DefaultTransparency;
            }

            IRasterRenderer demRenderer = RasterSymbolization.CreateDEMColorRamp(dem.Raster);

            AddRasterLayer(dem.Raster, demRenderer, dem.Name, pSurveyLyr, dem.LayerHeader, fDEMTransparency);
        }
コード例 #14
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");
            }
        }
コード例 #15
0
        public frmSingleMethodError(DEMSurvey parentDEM)
        {
            InitializeComponent();
            DEM = parentDEM;

            ucErrProps.InitializeNew(m_sEntireDEMExtent, DEM.AssocSurfaces.ToList());
            ucName.InitializeNewRaster("Error Surface", DEM.ErrorSurfaces.Select(x => x.Name).ToList <string>(), DEM.ErrorSurfacesFolder, "Err");

            // Hide raster properties
            ucRasterProperties1.Visible = false;
            int newHeight = Height + (ucRasterProperties1.Top - cmdOK.Top);

            MinimumSize       = new System.Drawing.Size(Width, newHeight);
            Height            = newHeight;
            ucErrProps.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;
        }
コード例 #16
0
        private void frmReferenceSurfaceFromDEMs_Load(object sender, EventArgs e)
        {
            cmdOK.Text = Properties.Resources.CreateButtonText;

            // Add all the project DEM surveys to the list and then bind to checked listbox
            List <DEMItem> items = new List <DEMItem>(ProjectManager.Project.DEMSurveys.Select(x => new DEMItem(x)));

            DEMSurveys         = new naru.ui.SortableBindingList <DEMItem>(items);
            grdData.DataSource = DEMSurveys;

            //Setup error surfaces for DEM grid
            for (int i = 0; i < grdData.Rows.Count; i++)
            {
                DataGridViewComboBoxCell comboCell = grdData.Rows[i].Cells["colError"] as DataGridViewComboBoxCell;

                DEMSurvey dem = ((DEMItem)grdData.Rows[i].DataBoundItem)._DEM;

                comboCell.DataSource    = new BindingSource(dem.ErrorSurfaces, null);
                comboCell.DisplayMember = "NameWithDefault";

                //select any error surfaces have default flat
                if (dem.ErrorSurfaces.Any(x => x.IsDefault))
                {
                    comboCell.Value = dem.ErrorSurfaces.First(x => x.IsDefault).NameWithDefault;
                }
                else
                {
                    // No default error surface. Simply select the first.
                    if (comboCell.Items.Count == 1)
                    {
                        comboCell.Value = dem.ErrorSurfaces.First().NameWithDefault;
                    }
                }
            }

            cboMethod.Items.Add(new naru.db.NamedObject((long)RasterOperators.MultiMathOpType.Maximum, "Maximum"));
            cboMethod.Items.Add(new naru.db.NamedObject((long)RasterOperators.MultiMathOpType.Mean, "Mean"));
            cboMethod.Items.Add(new naru.db.NamedObject((long)RasterOperators.MultiMathOpType.Minimum, "Minimum"));
            cboMethod.Items.Add(new naru.db.NamedObject((long)RasterOperators.MultiMathOpType.StandardDeviation, "Standard Deviation"));
            cboMethod.SelectedIndex = 0;

            tTip.SetToolTip(txtName, "The name that defines this reference surface within this GCD project. It cannot be empty and must be unique among all reference surfaces within this project.");
            tTip.SetToolTip(cboMethod, "The statistical method used to extract values from the selected DEM surveys.");
            tTip.SetToolTip(txtPath, "The relative file path within this GCD project where this reference surface will be generated.");
            tTip.SetToolTip(grdData, "Check the box beside each DEM survey that should be included in this calculation. Unchecked DEM surveys will be ignored.");
        }
コード例 #17
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");
            }
        }
コード例 #18
0
ファイル: GCDArcMapManager.cs プロジェクト: tarinishukla/gcd
        public IGroupLayer AddSurvey(DEMSurvey dem)
        {
            IGroupLayer pSurveyLyr = AddSurveyGroupLayer(dem);

            AddDEM(dem);

            foreach (AssocSurface assoc in dem.AssocSurfaces)
            {
                AddAssociatedSurface(assoc);
            }

            foreach (ErrorSurface err in dem.ErrorSurfaces)
            {
                AddErrSurface(err);
            }

            return(pSurveyLyr);
        }
コード例 #19
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);
            }
        }
コード例 #20
0
 /// <summary>
 /// Constructor for new type
 /// </summary>
 /// <param name="dem"></param>
 /// <param name="eType"></param>
 public frmAssociatedSurface(DEMSurvey dem, AssocSurface.AssociatedSurfaceTypes eType)
 {
     InitializeComponent();
     DEM       = dem;
     AssocType = eType;
 }
コード例 #21
0
 public LinearExtractionFromDEM(XmlNode nodItem, DEMSurvey dem)
     : base(nodItem, dem)
 {
 }
コード例 #22
0
 public LinearExtractionFromDEM(string name, ProfileRoutes.ProfileRoute route, FileInfo db, decimal sampleDistance, DEMSurvey dem, ErrorSurface err)
     : base(name, route, db, sampleDistance, dem, err)
 {
 }
コード例 #23
0
 public DEMItem(DEMSurvey dem)
 {
     _DEM    = dem;
     Include = true;
 }
コード例 #24
0
ファイル: GCDArcMapManager.cs プロジェクト: tarinishukla/gcd
        private IGroupLayer AddAssociatedSurfaceGroupLayer(DEMSurvey dem)
        {
            IGroupLayer pSurveyGrpLyr = AddSurveyGroupLayer(dem);

            return(ArcMapUtilities.GetGroupLayer(AssociatedSurfacesGroupLayer, pSurveyGrpLyr));
        }