Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: FtMan/ES
 void reset_graphic_editor()
 {
     node_views.Clear();
     width             = 0;
     current_edge_view = null;
     current_node_view = null;
 }
Exemplo n.º 2
0
        public Edge_view(Node_view Source, Node_view Destination)
        {
            source_node      = Source;
            destination_node = Destination;

            update_points();
            fact = new Fact();

            text = "new answer";
        }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: FtMan/ES
        void reset_exper_system()
        {
            current_node_view = null;
            current_edge_view = null;


            questions.Clear();
            facts.Clear();
            nodes.Clear();
        }
Exemplo n.º 4
0
        public Edge_view(Node_view Source, Node_view Destination, Edge ed, List <Fact> facts)
        {
            edge             = ed;
            source_node      = Source;
            destination_node = Destination;

            update_points();
            fact = new Fact();

            fact = facts.Find(x => x.id == edge.fact_id);
            text = fact.text;
        }
Exemplo n.º 5
0
Arquivo: Form1.cs Projeto: FtMan/ES
        void pictureBox_mouseDown(object sender, MouseEventArgs e)
        {
            if (isCreationNode)
            {
                return;
            }

            Point downPoint = e.Location;

            if (current_node_view != null)
            {
                if (current_node_view.isClickedOnEllipse(downPoint))
                {
                    isCreationEdge = true;
                    isMovingEdge   = true; // добавил Радмир
                    start_cur_edge = new Point(e.Location.X, e.Location.Y);
                    return;
                }

                if (current_node_view.isClickedOnRectangle(downPoint))
                {
                    isMovingNode = true;
                    return;
                }
            }

            foreach (Node_view nv in node_views)
            {
                if (nv.isClickedOnRectangle(downPoint))
                {
                    down_node_veiw = nv;
                    return;
                }
            }
            foreach (Node_view nv in node_views)
            {
                foreach (Edge_view ev in nv.edge_views)
                {
                    if (ev.isClickedOnEdge(downPoint))
                    {
                        down_edge_view = ev;
                        return;
                    }
                }
            }


            current_node_view = null;
            current_edge_view = null;
            change_edit_pannels();
            editor_workspace.Refresh();
        }
Exemplo n.º 6
0
Arquivo: Form1.cs Projeto: FtMan/ES
        void create_hierarchy(Node node, int depth)
        {
            Point     location  = new Point(startPoint.X + offset_X * depth, startPoint.Y + offset_Y * width);
            Node_view node_View = new Node_view(location, node, questions);

            node_views.Add(node_View);
            width += 1;

            foreach (Edge e in node.edges_collection.edges)
            {
                Node nd = nodes.Find(x => x.id == e.node_id);
                create_hierarchy(nd, depth + 1);
            }
        }
Exemplo n.º 7
0
Arquivo: Form1.cs Projeto: FtMan/ES
 void editor_node_delete_button_click(object sender, EventArgs e)
 {
     node_views.Remove(current_node_view);
     if (current_node_view.parent_edge != null)
     {//bad
         current_node_view.parent_edge.remove_self();
     }
     foreach (Edge_view i in current_node_view.edge_views)
     {
         i.destination_node.parent_edge = null;
         i.destination_node.parent_node = null;
     }
     current_node_view = null;
     editor_workspace.Refresh();
     change_edit_pannels();
 }
Exemplo n.º 8
0
Arquivo: Form1.cs Projeto: FtMan/ES
        void print_productions_hierarchy(Node_view node, string production)
        {
            if (node.edge_views.Count != 0)
            {
                production += ", и " + node.question_text + " - ";
            }
            else
            {
                production += ", то " + node.question_text;
                productions_print.AppendText(production + Environment.NewLine);
            }

            foreach (Edge_view edge in node.edge_views)
            {
                //string str = production + edge.text;
                print_productions_hierarchy(edge.destination_node, production);
            }
        }
Exemplo n.º 9
0
Arquivo: Form1.cs Projeto: FtMan/ES
        void create_edge_views_list()
        {
            foreach (Node_view nv in node_views)
            {
                foreach (Edge e in nv.node.edges_collection.edges)
                {
                    int       dest_node_id = e.node_id;
                    Node_view dest_nv      = node_views.Find(x => x.node.id == dest_node_id);


                    Edge_view ev = new Edge_view(nv, dest_nv, e, facts);
                    nv.edge_views.Add(ev);
                    dest_nv.parent_edge = ev;
                    dest_nv.parent_node = nv;

                    edge_views.Add(ev);
                }
            }
        }
Exemplo n.º 10
0
Arquivo: Form1.cs Projeto: FtMan/ES
        void pictureBox_mouseUp(object sender, MouseEventArgs e)
        {
            Point upPoint = e.Location;

            isMovingNode = false;
            isMovingEdge = false; //Добавил Радмир
            if (isCreationNode)
            {
                Node_view nv = new Node_view(upPoint);
                node_views.Add(nv);
                current_node_view = nv;
                current_edge_view = null;

                node_view_selected();
                change_edit_pannels();
                editor_workspace.Refresh();

                isCreationNode = false;
            }
            else
            {
                if (isCreationEdge)
                {
                    foreach (Node_view nv in node_views)
                    {
                        if (nv.isClickedOnRectangle(upPoint) && nv != current_node_view && nv.parent_edge == null)
                        {
                            Edge_view ev = new Edge_view(current_node_view, nv);
                            current_node_view.edge_views.Add(ev);
                            nv.parent_edge = ev;
                            nv.parent_node = current_node_view;
                            isCreationEdge = false;

                            current_node_view = null;
                            current_edge_view = ev;

                            edge_view_selected();
                            change_edit_pannels();
                            editor_workspace.Refresh();

                            return;
                        }
                    }
                    isCreationEdge = false;
                }
                foreach (Node_view nv in node_views)
                {
                    if (nv.isClickedOnRectangle(upPoint))
                    {
                        if (nv == down_node_veiw)
                        {
                            current_node_view = nv;
                            current_edge_view = null;
                            editor_workspace.Refresh();
                            node_view_selected();//<-here
                            change_edit_pannels();
                            return;
                        }
                    }
                }
                foreach (Node_view nv in node_views)
                {
                    foreach (Edge_view ev in nv.edge_views)
                    {
                        if (ev.isClickedOnEdge(upPoint))
                        {
                            if (ev == down_edge_view)
                            {
                                current_node_view = null;
                                current_edge_view = ev;
                                editor_workspace.Refresh();
                                edge_view_selected();
                                change_edit_pannels();
                                return;
                            }
                        }
                    }
                }


                current_node_view = null;
                current_edge_view = null;
                change_edit_pannels();
                editor_workspace.Refresh();
            }
        }