Esempio n. 1
0
        public void ConnectVertex(Vertex a, Vertex b, int weight)
        {
            a.Connect (b, weight);

            if (VertexConnected != null)
                VertexConnected (a, b);
        }
Esempio n. 2
0
 public Edge(Vertex fromv, Vertex tov, int weight)
 {
     From = fromv;
     To = tov;
     Weight = weight;
     _marked = false;
 }
Esempio n. 3
0
        // Messages
        public void AddVertex(Vertex v)
        {
            _vertexes.Add (v);

            if (VertexAdded != null)
                VertexAdded (v);
        }
Esempio n. 4
0
        public void DeleteVertex(Vertex v)
        {
            foreach (Graphite.Core.Edge edge in v.Edges()) {
                DisconnectVertex (v, edge.To);
                DisconnectVertex (edge.To, v);
            }

            if (VertexRemoved != null)
                VertexRemoved (v);

            _vertexes.Remove (v);
        }
Esempio n. 5
0
        // TODO: Refactoring
        private Vertex buildVertexFromXmlNode(XmlElement vertexElt)
        {
            int id;
            string alias;

            if (vertexElt.HasAttribute ("id"))
                id = System.Convert.ToInt32 (vertexElt.Attributes["id"].InnerText);
            else
                throw new Exception ("Vertex node does not have ID attribute!");

            if (vertexElt.HasAttribute ("shape"))
                alias = vertexElt.Attributes ["shape"].InnerText;
            else
                throw new Exception ("Vertex node does not have Shape attribute!");

            System.Xml.XmlNode positionNode = vertexElt.GetElementsByTagName ("position")[0];
            Vertex vertex = new Vertex (id, buildPositionFromXmlNode (positionNode));
            vertex.VertexShape = Graphite.Shapes.Manager.instance().FromAlias (alias);
            return vertex;
        }
Esempio n. 6
0
        public void MoveVertex(Vertex v, Point pt)
        {
            v.Position = pt;

            if (LayoutUpdated != null)
                LayoutUpdated ();
        }
Esempio n. 7
0
        public void DisconnectVertex(Vertex a, Vertex b)
        {
            a.Disconnect (b);

            if (VertexDisconnected != null)
                VertexDisconnected (a, b);
        }
Esempio n. 8
0
 public bool Connected(Vertex v)
 {
     return To == v;
 }
Esempio n. 9
0
 public void Disconnect(Vertex v)
 {
     Edge e = _edges.First (x => x.Connected (v));
     _edges.Remove (e);
 }
Esempio n. 10
0
 public bool Connected(Vertex v)
 {
     return _edges.Any (x => x.Connected (v));
 }
Esempio n. 11
0
 public void Connect(Vertex v, int weight = 0)
 {
     if (!Connected (v))
         _edges.Add (new Edge (this, v, weight));
 }