Beispiel #1
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            HClusterNode clickNode;

            if (linemode)
            {
                linemode = false;
                if (listNodes.Count > 0)
                {
                    SaveMarkedClusters.Enabled = true;
                    orderVis.Enabled = true;
                }
                pictureBox1.Invalidate();
                return;
            }
            if (markflag)
            {
                clickNode = CheckClick(rootNode, e.X, e.Y);
                if (clickNode != null)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        if (listNodes.ContainsKey(clickNode))
                            listNodes.Remove(clickNode);
                    }
                    else
                    {
                        if (listNodes == null)
                            listNodes = new Dictionary<HClusterNode, Color>();
                        if (!listNodes.ContainsKey(clickNode))
                            listNodes.Add(clickNode,Color.Red);
                    }
                    if (listNodes.Count > 0)
                    {
                        SaveMarkedClusters.Enabled = true;
                        orderVis.Enabled = true;
                    }
                    pictureBox1.Invalidate();
                }


                return;
            }
            clickNode = CheckClick(rootNode, e.X, e.Y);

            if (clickNode != null)
            {
                if (e.Button == MouseButtons.Right)
                {
                    rootNode = clickNode;
                    PrepareGraphNodes(buffer);
                    ClearBuffer();
                    pictureBox1.Invalidate();

                    //this.Invalidate();
                }
                else
                {
                    FormText info = new FormText(clickNode);
                    info.Show();
                }
            }
            string lab = CheckColorRegion(e.X, e.Y);
            if (lab != null)
            {
                DialogResult res;
                colorDialog1 = new ColorDialog();

                res = colorDialog1.ShowDialog();
                if (res == DialogResult.OK)
                {
                    classColor[lab] = Color.FromArgb(colorDialog1.Color.R, colorDialog1.Color.G, colorDialog1.Color.B);
                    buffer = null;
                    pictureBox1.Invalidate();
                    pictureBox1.Refresh();
                }
            }

        }
Beispiel #2
0
        public void SClusters(string item, string measureName, string option)
        {
            Dictionary <string, string> dic = ClusterOutput.ReadLabelsFile(output.GetLabelFile());

            if (output.clusters != null)
            {
                switch (option)
                {
                case "Order Visual":
                    if (active == null || !(active is VisOrder))
                    {
                        VisOrder visOrder;
                        visOrder           = new VisOrder(output.clusters, item, null);
                        visOrder.closeForm = Closing;
                        active             = visOrder;
                        visOrder.Show();
                    }
                    return;

                case "Text List":
                default:
                    if (active == null || !(active is ListVisual))
                    {
                        ListVisual visBaker;
                        visBaker           = new ListVisual(output.clusters, item, dic);
                        visBaker.closeForm = Closing;
                        active             = visBaker;
                        visBaker.Show();
                    }
                    return;
                }
            }
            if (output.hNode != null)
            {
                // win = new visHierar(output.hNode,item,measureName);
                if (option == null)
                {
                    return;
                }
                switch (option)
                {
                case "Dendrogram":
                default:
                    if (active == null || !(active is visHierar))
                    {
                        visHierar winH;
                        winH           = new visHierar(output.hNode, item, measureName, dic);
                        winH.closeForm = Closing;
                        active         = winH;
                        winH.Show();
                    }
                    return;

                case "Sunburst chart":
                    if (active == null || !(active is VisHierarCircle))
                    {
                        VisHierarCircle winC;
                        winC           = new VisHierarCircle(output.hNode, item, measureName);
                        winC.closeForm = Closing;
                        active         = winC;
                        winC.Show();
                    }
                    return;
                }
            }
            if (output.juryLike != null || output.hNNRes != null)
            {
                if (active == null || !(active is FormText))
                {
                    FormText showRes;
                    if (output.juryLike != null)
                    {
                        showRes = new FormText(output.juryLike, item);
                    }
                    else
                    {
                        showRes = new FormText(output.hNNRes, item);
                    }
                    showRes.closeForm = Closing;
                    active            = showRes;
                    showRes.Show();
                }
                return;
            }
            if (output.nodes != null)
            {
                HeatMap heatRes = new HeatMap(output.nodes[1], output.nodes[0], null, output.measure, output.name);
                active = heatRes;
                heatRes.Show();
            }
        }
Beispiel #3
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            HClusterNode clickNode;

            if (linemode)
            {
                linemode = false;
                if (listNodes.Count > 0)
                {
                    SaveMarkedClusters.Enabled = true;
                    orderVis.Enabled           = true;
                }
                pictureBox1.Invalidate();
                return;
            }
            if (markflag)
            {
                clickNode = drawH.CheckClick(drawH.rootNode, e.X, e.Y);
                if (clickNode != null)
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        if (listNodes.ContainsKey(clickNode))
                        {
                            listNodes.Remove(clickNode);
                        }
                    }
                    else
                    {
                        if (listNodes == null)
                        {
                            listNodes = new Dictionary <HClusterNode, Color>();
                        }
                        if (!listNodes.ContainsKey(clickNode))
                        {
                            listNodes.Add(clickNode, Color.Red);
                        }
                    }
                    if (listNodes.Count > 0)
                    {
                        SaveMarkedClusters.Enabled = true;
                        orderVis.Enabled           = true;
                    }
                    pictureBox1.Invalidate();
                }


                return;
            }
            clickNode = drawH.CheckClick(drawH.rootNode, e.X, e.Y);

            if (clickNode != null)
            {
                if (e.Button == MouseButtons.Right)
                {
                    drawH.rootNode = clickNode;
                    drawH.PrepareGraphNodes(buffer);
                    ClearBuffer();
                    pictureBox1.Invalidate();

                    //this.Invalidate();
                }
                else
                {
                    FormText info = new FormText(clickNode);
                    info.Show();
                    if (clickNode.setProfiles != null && clickNode.setProfiles.Count > 0)
                    {
                        DrawPanel pn = new DrawPanel("Leave profile: " + clickNode.refStructure);
                        pn.CreateBMP();
                        pn.drawPic = delegate { double res = DrawNodeProfiles(pn.bmp, clickNode.setProfiles, clickNode.consistency); pn.Text = res.ToString(); };
                        pn.Show();
                        pn.pictureBox1.Invalidate();
                    }
                }
            }
            string lab = drawH.CheckColorRegion(e.X, e.Y);

            if (lab != null)
            {
                DialogResult res;
                colorDialog1 = new ColorDialog();
                int [] colorTab = new int [drawH.classColor.Count];
                int    i        = 0;
                foreach (var item in drawH.classColor)
                {
                    colorTab[i++] = ColorTranslator.ToOle(item.Value);
                }
                colorDialog1.CustomColors = colorTab;

                colorDialog1.Color = drawH.classColor[lab];

                res = colorDialog1.ShowDialog();
                if (res == DialogResult.OK)
                {
                    drawH.classColor[lab] = Color.FromArgb(colorDialog1.Color.R, colorDialog1.Color.G, colorDialog1.Color.B);
                    buffer = null;
                    pictureBox1.Invalidate();
                    pictureBox1.Refresh();
                }
            }
        }
        public void SClusters(string item,string measureName,string option)
        {
            if (output.clusters != null)
            {
                switch(option)
                {
                    case "Order Visual":
                        if (active == null || !(active is VisOrder))
                        {
                            VisOrder visOrder;
                            visOrder = new VisOrder(output.clusters, item, null);
                            visOrder.closeForm = Closing;
                            active = visOrder;
                            visOrder.Show();
                        }
                        return;
                    case "Text List":
                        if (active == null || !(active is ListVisual))
                        {

                            ListVisual visBaker;
                            visBaker = new ListVisual(output.clusters, item);
                            visBaker.closeForm = Closing;
                            active = visBaker;
                            visBaker.Show();
                        }
                        return;
            }
             
            }
            if (output.hNode != null)
            {
               // win = new visHierar(output.hNode,item,measureName);
                if (option == null)
                    return;
                switch (option)
                {
                    case "Dendrogram":
                        if (active == null || !(active is visHierar))
                        {
                            visHierar winH;
                            winH = new visHierar(output.hNode, item, measureName);
                            winH.closeForm = Closing;
                            active = winH;
                            winH.Show();
                        }
                        return;                        
                    case "Circle Visual":
                        if (active == null || !(active is VisHierarCircle))
                        {

                            VisHierarCircle winC;
                            winC = new VisHierarCircle(output.hNode, item, measureName);
                            winC.closeForm = Closing;
                            active = winC;
                            winC.Show();
                        }
                        return;                        
                }


            }
            if (output.juryLike != null)
            {
                if (active == null || !(active is FormText))
                {

                    FormText showRes;
                    showRes = new FormText(output.juryLike, item);
                    showRes.closeForm = Closing;
                    active = showRes;
                    showRes.Show();
                }
                return;
            }

        }