コード例 #1
0
 void Tree_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if(e.Status == ModificationStatus.Successful)
     {
         this.VertexWrappers.Remove(this.VertexWrappers.Last());
         this.VertexWrappers.Add(new MarkingTreeNodeWrapper(this, e.Vertex as MarkingTreeNode));
     }
 }
コード例 #2
0
 void graph_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         Random r = new Random();
         WFVertexWrapper last = VertexWrappers.Last() as WFVertexWrapper;
         if (e.Vertex is MarkedPlace)
         {
             VertexWrappers.Add(new MarkedPlaceWrapper(this, e.Vertex as MarkedPlace) { Coords = last.Coords, SizeF = last.SizeF });
             VertexWrappers.Remove(last);
         }
         if (e.Vertex is Transition)
         {
             (last as TransitionWrapper).Angle = r.Next(360);
         }
     }
 }
コード例 #3
0
ファイル: BiGraph.cs プロジェクト: THROYAN/MagicLibrary
 void graph_OnVertexRemoved(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         firstPart.Remove(e.Vertex);
         secondPart.Remove(e.Vertex);
     }
 }
コード例 #4
0
ファイル: BiGraph.cs プロジェクト: THROYAN/MagicLibrary
 void graph_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         if (addToSecond)
             secondPart.Add(e.Vertex);
         else
             firstPart.Add(e.Vertex);
     }
 }
コード例 #5
0
 void sGraph_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         var last = this.VertexWrappers.Last();
         this.VertexWrappers.Remove(last);
         this.VertexWrappers.Add(new ConceptVertexWrapper(this, e.Vertex as ConceptVertex) { Coords = this.currentCoords });
     }
 }
コード例 #6
0
ファイル: MarkingTree.cs プロジェクト: THROYAN/MagicLibrary
 void tree_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         if(!(e.Vertex as MarkingTreeNode).IsRoot())
             (e.Vertex as MarkingTreeNode).RecalculateMarking();
     }
 }
コード例 #7
0
ファイル: WFGraphWrapper.cs プロジェクト: THROYAN/GraphEditor
 void graph_OnVertexRemoved(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         VertexWrappers.RemoveAll(v => v.EqualsVetices(e.Vertex));
     }
 }
コード例 #8
0
ファイル: WFGraphWrapper.cs プロジェクト: THROYAN/GraphEditor
 void graph_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         VertexWrappers.Add(new WFVertexWrapper(this, e.Vertex) { Size = DefaultVertexSize, Center = currentCoords });
     }
     if (e.Status == ModificationStatus.AlreadyExist)
     {
         this.counter++;
     }
 }
コード例 #9
0
 void Tree_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         var last = this.VertexWrappers.Last();
         this.VertexWrappers.Remove(last);
         this.VertexWrappers.Add(new TreeNodeWrapper(this, e.Vertex as TreeGraphNode));
     }
 }
コード例 #10
0
 private void Graph_OnVertexAdded(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         WFVertexWrapper last = VertexWrappers.Last() as WFVertexWrapper;
         if (e.Vertex is ColouredTransition)
         {
             VertexWrappers.Add(new ColouredTransitionWrapper(this, e.Vertex as ColouredTransition) { Coords = last.Coords, SizeF = DefaultTransitionSize });
         }
         if (e.Vertex is ColouredPlace)
         {
             VertexWrappers.Add(new ColouredPlaceWrapper(this, e.Vertex as ColouredPlace) { Coords = last.Coords, SizeF = DefaultPlaceSize });
         }
         VertexWrappers.Remove(last);
     }
 }
コード例 #11
0
ファイル: SemanticGraph.cs プロジェクト: THROYAN/MagicLibrary
 void graph_OnAddVertex(object sender, VerticesModifiedEventArgs e)
 {
     if (e.Status == ModificationStatus.Successful)
     {
         // check exists ids
         if (this.GetVertices(v => (v as ConceptVertex).Id == this._currentId).Count != 0)
         {
             e.Status = ModificationStatus.AlreadyExist;
             return;
         }
     }
 }
コード例 #12
0
        public void RemoveVertex(object vertexValue)
        {
            ModificationStatus status = vertices.Exists(v => v.Value.Equals(vertexValue)) ? ModificationStatus.Successful : ModificationStatus.NotExist;

            VerticesModifiedEventArgs e = new VerticesModifiedEventArgs(status, this[vertexValue],vertexValue);
            if (OnRemoveVertex != null)
                OnRemoveVertex(this, e);

            if (e.Status == ModificationStatus.Successful)
            {
                RemoveEdges(e.Vertex.Value);
                vertices.Remove(e.Vertex as Vertex);
            }

            if (OnVertexRemoved != null)
                OnVertexRemoved(this, e);
        }
コード例 #13
0
        public void AddVertex(object vertexValue)
        {
            ModificationStatus status = !vertices.Exists(v => v.Value.Equals(vertexValue)) ? ModificationStatus.Successful : ModificationStatus.AlreadyExist;

            VerticesModifiedEventArgs e = new VerticesModifiedEventArgs(status, this.CreateVertex(vertexValue),vertexValue);
            if (OnAddVertex != null)
                OnAddVertex(this, e);

            if (e.Status == ModificationStatus.Successful)
                vertices.Add(e.Vertex);

            if (OnVertexAdded != null)
                OnVertexAdded(this, e);
        }