示例#1
0
        public frmMorpProperties(GCDCore.Project.BudgetSegregation bs)
        {
            InitializeComponent();

            // Load all budget segregations that are part of the same DoD
            cboBS.DataSource   = new BindingList <GCDCore.Project.BudgetSegregation>(bs.DoD.BudgetSegregations.Where(x => x.IsMaskDirectional).ToList <GCDCore.Project.BudgetSegregation>());
            cboBS.SelectedItem = bs;
        }
示例#2
0
        private void cboBS_SelectedIndexChanged(object sender, EventArgs e)
        {
            GCDCore.Project.BudgetSegregation bs = cboBS.SelectedItem as GCDCore.Project.BudgetSegregation;
            txtMask.Text        = bs.Mask.Name;
            txtDoD.Text         = bs.DoD.Name;
            txtUncertainty.Text = bs.DoD.UncertaintyAnalysisLabel;

            txtPath.Text = ProjectManager.Project.GetRelativePath(ProjectManager.GetIndexedSubDirectory(bs.MorphologicalFolder, "MA").FullName);
        }
示例#3
0
        public BudgetSegGroup(TreeNodeCollection parentNodes, GCDCore.Project.BudgetSegregation bs, IContainer container)
            : base(parentNodes, bs.Name, "Budget Segregation", "Budget Segregations", bs.Folder, container, true, bs.IsMaskDirectional ? 17 : 9)
        {
            BudgetSeg = bs;

            ContextMenuStrip.Items[0].Text    = "Add Morphological Analysis";
            ContextMenuStrip.Items[0].Enabled = BudgetSeg.IsMaskDirectional;

            ContextMenuStrip.Items.Insert(0, new ToolStripMenuItem("View Budget Segregation Results", Properties.Resources.GCD, OnViewResults));
            ContextMenuStrip.Items.Insert(3, new ToolStripMenuItem("Delete Budget Segregation", Properties.Resources.Delete, OnDelete));
            ContextMenuStrip.Items.Insert(4, new ToolStripSeparator());

            LoadChildNodes();
        }
示例#4
0
        public frmBudgetSegResults(GCDCore.Project.BudgetSegregation BS)
        {
            // This call is required by the designer.
            InitializeComponent();

            BudgetSeg = BS;

            System.Drawing.Bitmap formImage = BudgetSeg.IsMaskDirectional ? Properties.Resources.DirectionalBudgetSeg : Properties.Resources.BudgetSeg;
            Icon = System.Drawing.Icon.FromHandle(formImage.GetHicon());

            ucProperties.Initialize(BudgetSeg.DoD);
            m_Options = new DoDSummaryDisplayOptions(ProjectManager.Project.Units);

            PieChartViewer = new Visualization.BudgetSegPieChartViewer(BudgetSeg.FilteredClasses.ToList(), chtPieCharts);
            cmsChart       = new UtilityForms.ChartContextMenu(BudgetSeg.Folder, "budget_seg");
        }
示例#5
0
        public static bool ValidateName(TextBox txtName, GCDCore.Project.BudgetSegregation bs, GCDCore.Project.Morphological.MorphologicalAnalysis ma)
        {
            if (string.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("The morphological analysis name cannot be blank.", "Missing Name", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Select();
                return(false);
            }

            if (!bs.IsMorphologicalAnalysisNameUnique(txtName.Text, ma))
            {
                MessageBox.Show(string.Format("The {0} budget segregation already possesses a morphological analysis called \"{1}\"." +
                                              " Please enter a unique name for the analysis.", bs.Name, txtName.Text), "Duplicate Name", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Select();
                return(false);
            }

            return(true);
        }
示例#6
0
        protected DoDBase(XmlNode nodDoD)
            : base(nodDoD.SelectSingleNode("Name").InnerText)
        {
            Folder     = ProjectManager.Project.GetAbsoluteDir(nodDoD.SelectSingleNode("Folder").InnerText);
            NewSurface = DeserializeSurface(nodDoD, "NewSurface");
            OldSurface = DeserializeSurface(nodDoD, "OldSurface");

            XmlNode nodAOI = nodDoD.SelectSingleNode("AOI");

            if (nodAOI is XmlNode)
            {
                AOIMask = ProjectManager.Project.Masks.First(x => string.Compare(x.Name, nodAOI.InnerText, true) == 0) as Masks.AOIMask;
            }

            RawDoD     = new DoDRaster(string.Format(Name + " - Raw"), ProjectManager.Project.GetAbsolutePath(nodDoD.SelectSingleNode("RawDoD").InnerText));
            ThrDoD     = new DoDRaster(string.Format(Name + " - Thresholded"), ProjectManager.Project.GetAbsolutePath(nodDoD.SelectSingleNode("ThrDoD").InnerText));
            ThrErr     = new DoDRaster(string.Format(Name + " - Thresholded Error"), ProjectManager.Project.GetAbsolutePath(nodDoD.SelectSingleNode("ThrErr").InnerText));
            Histograms = new HistogramPair(ProjectManager.Project.GetAbsolutePath(nodDoD.SelectSingleNode("RawHistogram").InnerText),
                                           ProjectManager.Project.GetAbsolutePath(nodDoD.SelectSingleNode("ThrHistogram").InnerText));
            SummaryXML = ProjectManager.Project.GetAbsolutePath(nodDoD.SelectSingleNode("SummaryXML").InnerText);
            Statistics = DeserializeStatistics(nodDoD.SelectSingleNode("Statistics"), ProjectManager.Project.CellArea, ProjectManager.Project.Units);

            BudgetSegregations = new List <BudgetSegregation>();
            XmlNode nodBSes = nodDoD.SelectSingleNode("BudgetSegregations");

            if (nodBSes is XmlNode)
            {
                foreach (XmlNode nodBS in nodBSes.SelectNodes("BudgetSegregation"))
                {
                    BudgetSegregation bs = new BudgetSegregation(nodBS, this);
                    BudgetSegregations.Add(bs);
                }
            }

            LinearExtractions = new List <LinearExtraction.LinearExtraction>();
            foreach (XmlNode nodLE in nodDoD.SelectNodes("LinearExtractions/LinearExtraction"))
            {
                LinearExtraction.LinearExtraction le = new LinearExtraction.LinearExtractionFromDoD(nodLE, this);
                LinearExtractions.Add(le);
            }
        }
示例#7
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                DialogResult = DialogResult.None;
                return;
            }

            try
            {
                // Create the morphological analysis
                Analysis = new MorphologicalAnalysis(txtName.Text, ProjectManager.Project.GetAbsoluteDir(txtPath.Text), cboBS.SelectedItem as GCDCore.Project.BudgetSegregation);

                try
                {
                    // Save the morphological spreadsheet to file
                    Analysis.OutputFolder.Create();
                    Analysis.SaveExcelSpreadsheet();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                    // We can live without the spreadsheet
                    Console.Write("Morphological analysis spreadsheet error saving to " + Analysis.Spreadsheet.FullName);
                }

                GCDCore.Project.BudgetSegregation bs = cboBS.SelectedItem as GCDCore.Project.BudgetSegregation;
                bs.MorphologicalAnalyses.Add(Analysis);
                ProjectManager.Project.Save();
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                DialogResult = DialogResult.None;
                GCDException.HandleException(ex, "Error generating morphological analysis.");
            }
        }
示例#8
0
 public bool IsBudgetSegNameUnique(string name, BudgetSegregation ignore)
 {
     return(!BudgetSegregations.Any(x => x != ignore && string.Compare(name, x.Name, true) == 0));
 }