Example #1
0
 public bool Remove(Shape s)
 {
     if (s is RelationshipShape)
     {
         s.RaiseOnDelete();
         G.RelationshipShapes.Remove(s);
         return true;
     }
     else if (s is BlockShape)
     {
         ArrayList toRemove = new ArrayList(); // needed because we can't remove during iteration
         foreach (RelationshipShape r in G.RelationshipShapes)
             if(r.StartObject==s||r.EndObject==s)
                 toRemove.Add(r);
         foreach (RelationshipShape r in toRemove)
             Remove(r);
         s.RaiseOnDelete();
         G.BlockShapes.Remove(s);
         return true;
     }
     else
         return false;
 }
Example #2
0
 public bool Add(Shape s)
 {
     if (s is RelationshipShape)
     {
         G.RelationshipShapes.Add(s);
         return true;
     }
     else if (s is BlockShape)
     {
         G.BlockShapes.Add(s);
         return true;
     }
     else
         return false;
 }