/// <summary>
        /// Creates the menu for a GUIpanel.
        /// </summary>
        /// <param name="myGUIpanel">the GUIpanel that this menu is attached to</param>
        /// <param name="dataPanel">a reference to the data view panel</param>
        /// <param name="contourTreePanel">a reference to the contour tree view panel</param>
        /// <param name="joinTreePanel">a reference to the join tree view panel</param>
        /// <param name="splitTreePanel">a reference to the split tree view panel</param>
        /// <param name="uncertaintyPanel">a reference to the uncertainty view panel</param>
        /// <param name="label">the text to display on the "label" ToolStripMenuItem when this is first instantiated</param>
        public GUIpanelMenu(GUIpanel myGUIpanel, Panel dataPanel, Panel contourTreePanel, JoinTreeView joinTreePanel, Panel splitTreePanel, Panel uncertaintyPanel, string label)
            : base()
        {
            // display properties
            this.Anchor = (AnchorStyles)((AnchorStyles.Left | AnchorStyles.Top) | AnchorStyles.Right);

            // panel references
            this.myGUIpanel       = myGUIpanel;
            this.dataPanel        = dataPanel;
            this.contourTreePanel = contourTreePanel;
            this.joinTreePanel    = joinTreePanel;
            this.splitTreePanel   = splitTreePanel;
            this.uncertaintyPanel = uncertaintyPanel;

            // menu items
            ToolStripMenuItem display = new ToolStripMenuItem("Display...");
            this.Items.Add(display);
            display.DropDownItems.Add(new ToolStripMenuItem("Data", null, new EventHandler(displayData)));
            display.DropDownItems.Add(new ToolStripMenuItem("Contour Tree", null, new EventHandler(displayContourTree)));
            display.DropDownItems.Add(new ToolStripMenuItem("Join Tree", null, new EventHandler(displayJoinTree)));
            display.DropDownItems.Add(new ToolStripMenuItem("Split Tree", null, new EventHandler(displaySplitTree)));
            display.DropDownItems.Add(new ToolStripMenuItem("Uncertainty", null, new EventHandler(displayUncertainty)));

            // the label
            this.label = new ToolStripMenuItem(label);
            this.Items.Add(label);
        }
 /// <summary>
 /// Determines the appropriate text to display on the label on the menu.
 /// </summary>
 /// <returns>text indicating which view is being shown</returns>
 private string getLabel(Panel dataPanel, Panel contourTreePanel, JoinTreeView joinTreePanel, Panel splitTreePanel, Panel uncertaintyPanel, Panel defaultPanel)
 {
     if (dataPanel        == defaultPanel) { return "Data View"; }
     if (contourTreePanel == defaultPanel) { return "Contour Tree View"; }
     if (joinTreePanel    == defaultPanel) { return "Join Tree View"; }
     if (splitTreePanel   == defaultPanel) { return "Split Tree View"; }
     if (uncertaintyPanel == defaultPanel) { return "Topology Change View"; }
     return "Unknown View";
 }
        /// <summary>
        /// Create a new GUIpanel.
        /// </summary>
        /// <param name="colSpan">
        /// the number of columns this panel should cover
        /// </param>
        /// <param name="dataPanel">a reference to the data view panel</param>
        /// <param name="contourTreePanel">a reference to the contour tree view panel</param>
        /// <param name="joinTreePanel">a reference to the join tree view panel</param>
        /// <param name="splitTreePanel">a reference to the split tree view panel</param>
        /// <param name="uncertaintyPanel">a reference to the uncertainty view panel</param>
        public GUIpanel(Panel dataPanel, Panel contourTreePanel, JoinTreeView joinTreePanel, Panel splitTreePanel, Panel uncertaintyPanel, Panel defaultPanel)
            : base()
        {
            // display properties
            this.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right)));
            this.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;

            // internal layout stuff
            this.ColumnCount = 1;
            this.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
            this.RowCount = 2;
            this.RowStyles.Add(new RowStyle(SizeType.Absolute, 28));
            this.RowStyles.Add(new RowStyle(SizeType.Percent, 100));

            // determine the appropriate label
            string label = getLabel(dataPanel, contourTreePanel, joinTreePanel, splitTreePanel, uncertaintyPanel, defaultPanel);

            // create menu
            this.Controls.Add(new GUIpanelMenu(this, dataPanel, contourTreePanel, joinTreePanel, splitTreePanel, uncertaintyPanel, label));

            // add default view
            this.Controls.Add(defaultPanel);
        }
Beispiel #4
0
        /// <summary>
        /// Creates a new instance of the GUI.
        /// </summary>
        public GUI()
        {
            // Create the panels that display views.
            this.joinTreeView = new JoinTreeView();
            this.splitTreeView = new SplitTreeView();
            this.contourTreeView = new ContourTreeView();
            this.topology = new TopologyChangeView();

            // Keep track of how many data files have been read.
            this.currentTimeStep = 0;
            this.fileDataList = new List<FileDataAbstract>();

            // Required by C# for GUI stuff.
            InitializeComponent();

            // Create the actual panels and make them display one view each.
            GUIpanel ULpanel = new GUIpanel(new Panel(), contourTreeView, joinTreeView, splitTreeView, topology, joinTreeView);
            GUIpanel URpanel = new GUIpanel(new Panel(), contourTreeView, joinTreeView, splitTreeView, topology, splitTreeView);
            GUIpanel BLpanel = new GUIpanel(new Panel(), contourTreeView, joinTreeView, splitTreeView, topology, contourTreeView);
            GUIpanel BMpanel = new GUIpanel(new Panel(), contourTreeView, joinTreeView, splitTreeView, topology, new Panel());
            GUIpanel BRpanel = new GUIpanel(new Panel(), contourTreeView, joinTreeView, splitTreeView, topology, topology);

            // Add the panels to the GUI.
            this.GUI_layout.Controls.Add(ULpanel);
            this.GUI_layout.Controls.Add(URpanel);
            this.GUI_layout.Controls.Add(BLpanel);
            this.GUI_layout.Controls.Add(BMpanel);
            this.GUI_layout.Controls.Add(BRpanel);

            // Set the spacing to look nice.
            this.GUI_layout.SetColumnSpan(ULpanel, 3);
            this.GUI_layout.SetColumnSpan(URpanel, 3);
            this.GUI_layout.SetColumnSpan(BLpanel, 2);
            this.GUI_layout.SetColumnSpan(BMpanel, 2);
            this.GUI_layout.SetColumnSpan(BRpanel, 2);
        }