예제 #1
0
 public void Remove(Shapes.DiagramShape obj)
 {
     if (obj != null)
     {
         DiagramLayer layer1 = obj.Layer;
         if (layer1 != null)
         {
             if (layer1 != this)
             {
                 throw new ArgumentException("Cannot remove an object from a layer if it does not belong to that layer.");
             }
             Shapes.GroupShape group1 = obj.Parent;
             if (group1 != null)
             {
                 group1.Remove(obj);
             }
             else
             {
                 this.removeFromLayer(obj, false);
             }
         }
     }
     if (this.ShapeRemoved != null)
     {
         this.ShapeRemoved(this, new SelectionEventArgs(obj));
     }
 }
예제 #2
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     base.CopyChildren(newgroup, env);
     CommentShape comment1 = (CommentShape)newgroup;
     comment1.myPartID = -1;
     comment1.myBack = (DiagramShape)env[this.myBack];
     comment1.myLabel = (DiagramText)env[this.myLabel];
 }
예제 #3
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     base.CopyChildren(newgroup, env);
     BasicNode node1 = (BasicNode)newgroup;
     node1.myShape = (DiagramGraph)env[this.myShape];
     node1.myPort = (DiagramPort)env[this.myPort];
     node1.myLabel = (DiagramText)env[this.myLabel];
 }
예제 #4
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     base.CopyChildren(newgroup, env);
     IconicNode node1 = (IconicNode)newgroup;
     node1.myIcon = (DiagramShape)env[this.myIcon];
     node1.myLabel = (DiagramText)env[this.myLabel];
     node1.myPort = (DiagramPort)env[this.myPort];
 }
예제 #5
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     base.CopyChildren(newgroup, env);
     TextLine link1 = (TextLine)newgroup;
     link1.myRealLink = (Shapes.LineGraph)env[this.myRealLink];
     link1.myFromLabel = (DiagramShape)env[this.myFromLabel];
     link1.myMidLabel = (DiagramShape)env[this.myMidLabel];
     link1.myToLabel = (DiagramShape)env[this.myToLabel];
 }
예제 #6
0
 private Shapes.IDiagramPort pickNearestPort1(Shapes.DiagramShape obj, PointF dc, Shapes.IDiagramPort bestPort, ref float bestDist)
 {
     Shapes.IDiagramPort port1 = obj as Shapes.IDiagramPort;
     if (port1 != null)
     {
         PointF tf1     = this.PortPoint(port1, dc);
         float  single1 = dc.X - tf1.X;
         float  single2 = dc.Y - tf1.Y;
         float  single3 = (single1 * single1) + (single2 * single2);
         if (single3 <= bestDist)
         {
             object obj1 = null;
             if (this.ValidPortsCache != null)
             {
                 obj1 = this.ValidPortsCache[port1];
             }
             if (obj1 == ToolLinking.Valid)
             {
                 bestPort = port1;
                 bestDist = single3;
             }
             else if (obj1 != ToolLinking.Invalid)
             {
                 if ((this.Forwards && this.IsValidLink(this.OriginalStartPort, port1)) || (!this.Forwards && this.IsValidLink(port1, this.OriginalStartPort)))
                 {
                     if (this.ValidPortsCache != null)
                     {
                         this.ValidPortsCache[port1] = ToolLinking.Valid;
                     }
                     bestPort = port1;
                     bestDist = single3;
                 }
                 else if (this.ValidPortsCache != null)
                 {
                     this.ValidPortsCache[port1] = ToolLinking.Invalid;
                 }
             }
         }
     }
     Shapes.GroupShape group1 = obj as Shapes.GroupShape;
     if (group1 != null)
     {
         Shapes.GroupEnumerator enumerator2 = group1.GetEnumerator();
         Shapes.GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             Shapes.DiagramShape obj2 = enumerator1.Current;
             bestPort = this.pickNearestPort1(obj2, dc, bestPort, ref bestDist);
         }
     }
     return(bestPort);
 }
예제 #7
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     base.CopyChildren(newgroup, env);
     TextNode node1 = (TextNode)newgroup;
     node1.myBack = (DiagramShape)env[this.myBack];
     node1.myLabel = (DiagramText)env[this.myLabel];
     node1.myTopPort = (DiagramPort)env[this.myTopPort];
     node1.myRightPort = (DiagramPort)env[this.myRightPort];
     node1.myBottomPort = (DiagramPort)env[this.myBottomPort];
     node1.myLeftPort = (DiagramPort)env[this.myLeftPort];
 }
예제 #8
0
 protected virtual void OnParentChanged(GroupShape oldgroup, GroupShape newgroup)
 {
 }
예제 #9
0
 internal void SetParent(GroupShape value, bool undoing)
 {
     GroupShape group1 = this.myParent;
     GroupShape group2 = value;
     if (group1 != group2)
     {
         if (group2 == null)
         {
             if (!undoing)
             {
                 this.OnParentChanged(group1, null);
             }
             this.SetLayer(null, this, undoing);
             this.myParent = null;
         }
         else
         {
             this.myParent = group2;
             this.SetLayer(group2.Layer, this, undoing);
             if (!undoing)
             {
                 this.OnParentChanged(group1, group2);
             }
         }
     }
 }
예제 #10
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     GeneralNode node1 = (GeneralNode)newgroup;
     base.CopyChildren(newgroup, env);
     node1.myLeftPorts = new ArrayList();
     node1.myRightPorts = new ArrayList();
     node1.myIcon = (DiagramShape)env[this.myIcon];
     node1.myTopLabel = (DiagramText)env[this.myTopLabel];
     node1.myBottomLabel = (DiagramText)env[this.myBottomLabel];
     for (int num1 = 0; num1 < this.myLeftPorts.Count; num1++)
     {
         GeneralNodePort port1 = (GeneralNodePort)this.myLeftPorts[num1];
         if (port1 != null)
         {
             GeneralNodePort port2 = (GeneralNodePort)env[port1];
             if (port2 != null)
             {
                 node1.myLeftPorts.Add(port2);
                 port2.SideIndex = node1.myLeftPorts.Count - 1;
                 port2.LeftSide = true;
             }
         }
     }
     for (int num2 = 0; num2 < this.myRightPorts.Count; num2++)
     {
         GeneralNodePort port3 = (GeneralNodePort)this.myRightPorts[num2];
         if (port3 != null)
         {
             GeneralNodePort port4 = (GeneralNodePort)env[port3];
             if (port4 != null)
             {
                 node1.myRightPorts.Add(port4);
                 port4.SideIndex = node1.myRightPorts.Count - 1;
                 port4.LeftSide = false;
             }
         }
     }
 }
예제 #11
0
 public Shapes.IDiagramShapeCollection PickObjects(PointF p, bool selectableOnly, Shapes.IDiagramShapeCollection coll, int max)
 {
     if (coll == null)
     {
         coll = new Shapes.DiagramShapeCollection();
     }
     if (coll.Count < max)
     {
         if (!this.CanViewObjects())
         {
             return(coll);
         }
         if (selectableOnly && !this.CanSelectObjects())
         {
             return(coll);
         }
         GoLayerCache cache1 = this.FindCache(p);
         if (cache1 != null)
         {
             ArrayList list1 = cache1.Objects;
             for (int num2 = list1.Count - 1; num2 >= 0; num2--)
             {
                 Shapes.DiagramShape obj1   = (Shapes.DiagramShape)list1[num2];
                 Shapes.GroupShape   group1 = obj1 as Shapes.GroupShape;
                 if (group1 != null)
                 {
                     group1.PickObjects(p, selectableOnly, coll, max);
                 }
                 else
                 {
                     Shapes.DiagramShape obj2 = obj1.Pick(p, selectableOnly);
                     if (obj2 != null)
                     {
                         coll.Add(obj2);
                         if (coll.Count >= max)
                         {
                             return(coll);
                         }
                     }
                 }
             }
             return(coll);
         }
         LayerEnumerator enumerator1 = this.Backwards.GetEnumerator();
         while (enumerator1.MoveNext())
         {
             Shapes.DiagramShape obj3   = enumerator1.Current;
             Shapes.GroupShape   group2 = obj3 as Shapes.GroupShape;
             if (group2 != null)
             {
                 group2.PickObjects(p, selectableOnly, coll, max);
                 continue;
             }
             Shapes.DiagramShape obj4 = obj3.Pick(p, selectableOnly);
             if (obj4 != null)
             {
                 coll.Add(obj4);
                 if (coll.Count >= max)
                 {
                     return(coll);
                 }
             }
         }
     }
     return(coll);
 }
예제 #12
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     MultiTextNode node1 = (MultiTextNode)newgroup;
     base.CopyChildren(newgroup, env);
     node1.myLeftPorts = new ArrayList();
     node1.myRightPorts = new ArrayList();
     node1.myListGroup = (ListGroup)env[this.myListGroup];
     node1.myTopPort = (DiagramShape)env[this.myTopPort];
     node1.myBottomPort = (DiagramShape)env[this.myBottomPort];
     for (int num1 = 0; num1 < this.myLeftPorts.Count; num1++)
     {
         DiagramShape obj1 = (DiagramShape)this.myLeftPorts[num1];
         DiagramShape obj2 = (DiagramShape)env[obj1];
         node1.myLeftPorts.Add(obj2);
     }
     for (int num2 = 0; num2 < this.myRightPorts.Count; num2++)
     {
         DiagramShape obj3 = (DiagramShape)this.myRightPorts[num2];
         DiagramShape obj4 = (DiagramShape)env[obj3];
         node1.myRightPorts.Add(obj4);
     }
 }
예제 #13
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     SubGraphNode graph1 = (SubGraphNode)newgroup;
     graph1.myHandle = null;
     graph1.myLabel = null;
     graph1.myPort = null;
     graph1.myCollapsedObject = null;
     GroupEnumerator enumerator2 = base.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         DiagramShape obj1 = enumerator2.Current;
         env.Copy(obj1);
     }
     enumerator2 = base.GetEnumerator();
     while (enumerator2.MoveNext())
     {
         DiagramShape obj2 = enumerator2.Current;
         DiagramShape obj3 = (DiagramShape)env[obj2];
         graph1.Add(obj3);
         if (obj2 == this.myHandle)
         {
             graph1.myHandle = (SubGraphHandle)obj3;
             continue;
         }
         if (obj2 == this.myLabel)
         {
             graph1.myLabel = (DiagramText)obj3;
             continue;
         }
         if (obj2 == this.myPort)
         {
             graph1.myPort = (DiagramPort)obj3;
             continue;
         }
         if (obj2 == this.myCollapsedObject)
         {
             graph1.myCollapsedObject = obj3;
         }
     }
     graph1.myBoundsHashtable = new Hashtable();
     IDictionaryEnumerator enumerator1 = this.myBoundsHashtable.GetEnumerator();
     while (enumerator1.MoveNext())
     {
         DiagramShape obj4 = (DiagramShape)enumerator1.Key;
         DiagramShape obj5 = (DiagramShape)env[obj4];
         if (obj5 != null)
         {
             RectangleF ef1 = (RectangleF)enumerator1.Value;
             graph1.myBoundsHashtable[obj5] = ef1;
         }
     }
     graph1.myPathsHashtable = new Hashtable();
     enumerator1 = this.myPathsHashtable.GetEnumerator();
     while (enumerator1.MoveNext())
     {
         StrokeGraph stroke1 = (StrokeGraph)enumerator1.Key;
         StrokeGraph stroke2 = (StrokeGraph)env[stroke1];
         if (stroke2 != null)
         {
             PointF[] tfArray1 = (PointF[])enumerator1.Value;
             graph1.myPathsHashtable[stroke2] = tfArray1.Clone();
         }
     }
 }
예제 #14
0
 protected virtual void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     GroupEnumerator enumerator2 = this.GetEnumerator();
     GroupEnumerator enumerator1 = enumerator2.GetEnumerator();
     while (enumerator1.MoveNext())
     {
         DiagramShape obj1 = enumerator1.Current;
         DiagramShape obj2 = env.Copy(obj1);
         newgroup.Add(obj2);
     }
 }
예제 #15
0
        protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
        {
            base.CopyChildren(newgroup, env);

            BoxIconNode node = (BoxIconNode)newgroup;

            if (this._LeftPorts != null)
            {
                node._LeftPorts = new DiagramPort[DefaultYPortCount];
                for (int count = 0; count < this._LeftPorts.Length; count++)
                {
                    node._LeftPorts[count] = (DiagramPort)env[this._LeftPorts[count]];
                }
            }

            if (this._RightPorts != null)
            {
                node._RightPorts = new DiagramPort[DefaultYPortCount];
                for (int count = 0; count < this._RightPorts.Length; count++)
                {
                    node._RightPorts[count] = (DiagramPort)env[this._RightPorts[count]];
                }
            }

            if (this._TopPorts != null)
            {
                node._TopPorts = new DiagramPort[DefaultXPortCount];
                for (int count = 0; count < this._TopPorts.Length; count++)
                {
                    node._TopPorts[count] = (DiagramPort)env[this._TopPorts[count]];
                }
            }

            if (this._BottomPorts != null)
            {
                node._BottomPorts = new DiagramPort[DefaultXPortCount];
                for (int count = 0; count < this._BottomPorts.Length; count++)
                {
                    node._BottomPorts[count] = (DiagramPort)env[this._BottomPorts[count]];
                }
            }

            node.myBack = (DiagramShape)env[this.myBack];
            node.myLabel = (DiagramText)env[this.myLabel];
        }
예제 #16
0
 protected override void CopyChildren(GroupShape newgroup, CopyDictionary env)
 {
     ListGroup group1 = (ListGroup)newgroup;
     if (group1 != null)
     {
         group1.myPath = null;
     }
     base.CopyChildren(newgroup, env);
 }