Пример #1
0
 public GraphConstructorForm(WFGraphWrapper graphWrapper)
 {
     InitializeComponent();
     this.Succesful = false;
     GraphWrapper = graphWrapper.Clone() as WFGraphWrapper;
     //graphWrapper.CopyTo(GraphWrapper);
     verticesCounter.Value = graphWrapper.Graph.Order;
 }
 public ColouredPetriGraphConstructorForm(WFGraphWrapper graphWrapper)
 {
     InitializeComponent();
     this._isModified = false;
     this.Succesful = false;
     GraphWrapper = graphWrapper.Clone() as WFGraphWrapper;
     firstPartVerticesCounter.Value = (graphWrapper.Graph as BiGraph).FirstPartOrder;
     secondPartVerticesCount.Value = (graphWrapper.Graph as BiGraph).SecondPartOrder;
 }
 public MarkedPetriNetGraphCounstructor(WFGraphWrapper graphWrapper)
 {
     InitializeComponent();
     this.Succesful = false;
     GraphWrapper = graphWrapper.Clone() as WFGraphWrapper;
     //graphWrapper.CopyTo(GraphWrapper);
     firstPartVerticesCounter.Value = (graphWrapper.Graph as BiGraph).FirstPartOrder;
     secondPartVerticesCount.Value = (graphWrapper.Graph as BiGraph).SecondPartOrder;
 }
Пример #4
0
        public virtual object Clone()
        {
            var gw = new WFGraphWrapper();

            this.CopyTo(gw);
            WFGraphWrapper.SetDefaultEventHandlers(this);

            gw.Graph = this.Graph.Clone() as IGraph;
            WFGraphWrapper.SetDefaultEventHandlers(gw);

            return gw;
        }
Пример #5
0
 public static void SetDefaultEventHandlers( WFGraphWrapper graphWrapper )
 {
     var graph = graphWrapper.Graph;
     graphWrapper.ClearMyEventHandlers();
     //graph.OnAddEdge += new EventHandler<EdgesModifiedEventArgs>(graphWrapper.Graph_OnAddEdge);
     //graph.OnAddVertex += new EventHandler<VerticesModifiedEventArgs>(graphWrapper.Graph_OnAddVertex);
     //graph.OnRemoveEdge += new EventHandler<EdgesModifiedEventArgs>(graphWrapper.Graph_OnRemoveEdge);
     //graph.OnRemoveVertex += new EventHandler<VerticesModifiedEventArgs>(graphWrapper.Graph_OnRemoveVertex);
     graph.OnVertexAdded += new EventHandler<VerticesModifiedEventArgs>(graphWrapper.graph_OnVertexAdded);
     graph.OnVertexRemoved+=new EventHandler<VerticesModifiedEventArgs>(graphWrapper.graph_OnVertexRemoved);
     graph.OnEdgeRemoved+=new EventHandler<EdgesModifiedEventArgs>(graphWrapper.graph_OnEdgeRemoved);
     graph.OnEdgeAdded+=new EventHandler<EdgesModifiedEventArgs>(graphWrapper.graph_OnEdgeAdded);
 }
Пример #6
0
 //public static void DrawEdge(this Graphics g, Pen p, Edge e, List<PointF> a.Points)
 //{
 //    //if (a.Points != null && a.Points.Length > 0)
 //    //{
 //    //    g.DrawLines(p, a.Points.ToArray());
 //    //}
 //    //else
 //    //{
 //    //    double angle = -Math.Atan2(e.Tail.Coords.Y - a.Head.Coords.Y, a.Head.Coords.X - a.Tail.Coords.X);
 //    //    PointF popravka = new PointF((float)Math.Cos(angle) * a.Head.Size.Width / 2,
 //    //                             (float)Math.Sin(angle) * a.Head.Size.Height / 2);
 //    //    g.DrawLine(p, MGraphic.T(popravka.X, popravka.Y) * a.Tail.Coords, MGraphic.T(-popravka.X, -popravka.Y) * a.Head.Coords);
 //    //    dM =
 //    //               MGraphic.T(a.Head.Coords.X - popravka.X, a.Head.Coords.Y - popravka.Y)
 //    //             * MGraphic.R(angle * 180 / Math.PI)
 //    //     ;
 //    //    g.DrawLines(p, dM * arrow);
 //    //}
 //}
 public static void DrawGraph(this Graphics g, Pen p, WFGraphWrapper graphManager)
 {
     graphManager.Graph.GetEdges(e => true).ForEach(edge => g.DrawArc(p, edge as WFArcWrapper));
     graphManager.Graph.GetVertices(v => true).ForEach(vertex => g.DrawVertex(p, vertex as WFVertexWrapper));
 }