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

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

            if (VertexAdded != null)
                VertexAdded (v);
        }
Exemplo 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);
        }
Exemplo 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;
        }
Exemplo n.º 6
0
        public void MoveVertex(Vertex v, Point pt)
        {
            v.Position = pt;

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

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