Beispiel #1
0
        private List <List <Vertex <Node> > > GetLoops(Graph <Node> net)
        {
            List <List <Vertex <Node> > > res = new List <List <Vertex <Node> > >();

            int[][] data = net.AsListOfEdges();
            akCyclesInUndirectedGraphs.CyclesHelper.SetGraph(data);
            List <string> ret = akCyclesInUndirectedGraphs.CyclesHelper.demo();
            StringBuilder sb  = new StringBuilder();

            for (int i = 0; i < ret.Count(); i++)
            {
                List <Vertex <Node> > currentVertices = new List <Vertex <Node> >();
                string   cycle    = ret[i];
                string[] vertices = cycle.Split(',');
                foreach (string v in vertices)
                {
                    int num = 0;
                    if (Int32.TryParse(v, out num))
                    {
                        Vertex <Node> vertex = net.Vertices.Where(x => x.Index == num).First();
                        currentVertices.Add(vertex);
                    }
                }
                res.Add(currentVertices);
                //string line = "Loop " + (i + 1) + ": " + ret[i];
                //sb.AppendLine(line);
            }
            //MessageBox.Show(sb.ToString());
            res = PipeModel.GetFaces(net, res);
            return(res);
        }
Beispiel #2
0
        public bool ShowProperties(MouseEventArgs args, PipeModel model)
        {
            bool ret = false;

            switch (this.type)
            {
            //case Tools.None: this.Cursor = Cursors.Default; break;
            //case Tools.AddNode: model.AddNode(args); break;
            //case Tools.DeleteNode: model.DeleteNode(args); break;
            case Tools.Select: ret = model.ShowProps(args);
                break;
                //case Tools.AddPipe: model.AddPipe(args); break;
                //case Tools.DeletePipe: model.DeletePipe(args); break;
            }
            return(ret);
        }
Beispiel #3
0
        public bool Process(MouseEventArgs args, PipeModel model)
        {
            bool bRet = false;

            switch (this.type)
            {
            case Tools.None: this.Cursor = Cursors.Default; break;

            case Tools.AddNode: bRet = model.AddNode(args); break;

            case Tools.DeleteNode: bRet = model.DeleteNode(args); break;

            case Tools.Select:
                break;

            case Tools.AddPipe: bRet = model.AddPipe(args); break;

            case Tools.DeletePipe: bRet = model.DeletePipe(args); break;
            }
            return(bRet);
        }