示例#1
0
        /// <summary>
        /// Gets all arrows and objects
        /// </summary>
        /// <param name="desktop">Desktop</param>
        /// <param name="objects">Objects</param>
        /// <param name="arrows">Arrows</param>
        private void GetAllPrivate(PureDesktop desktop, IList <ICategoryObject> objects, IList <ICategoryArrow> arrows)
        {
            IEnumerable <IObjectLabel> objs = Objects;

            foreach (IObjectLabel l in objs)
            {
                desktop.GetObjects(l.Object as IAssociatedObject, objects, arrows);
            }
            IEnumerable <IArrowLabel> arrs = Arrows;

            foreach (IArrowLabel l in arrs)
            {
                desktop.GetObjects(l.Arrow, objects, arrows);
            }
        }
示例#2
0
 /// <summary>
 /// Gets child named component form root desktop
 /// </summary>
 /// <param name="desktop">Root desktop</param>
 /// <param name="name">Name of object</param>
 /// <returns>The child component</returns>
 static public INamedComponent GetFromRoot(IDesktop desktop, string name)
 {
     if (name.Length >= 3)
     {
         if (name.Substring(0, 3).Equals("../"))
         {
             PureDesktop       d    = desktop as PureDesktop;
             IObjectContainer  cont = d.parent;
             IAssociatedObject ao   = cont as IAssociatedObject;
             INamedComponent   cnc  = ao.Object as INamedComponent;
             INamedComponent   nc   = cnc.Desktop[name.Substring(3)];
             if (nc != null)
             {
                 return(nc);
             }
         }
     }
     return(null);
 }
 /// <summary>
 /// Main constructor
 /// </summary>
 /// <param name="desktop">The parent desktop</param>
 protected ObjectContainerPortable(PureDesktop desktop)
 {
     this.desktop = desktop;
 }
示例#4
0
 /// <summary>
 /// Main constructor
 /// </summary>
 /// <param name="desktop">The parent desktop</param>
 protected ObjectContainerBase(PureDesktop desktop) : base(desktop)
 {
 }
示例#5
0
 /// <summary>
 /// Copies objects and arrows
 /// </summary>
 /// <param name="objects">Objects</param>
 /// <param name="arrows">Arrows</param>
 /// <param name="associated">Copy associated objects sign</param>
 public override void Copy(IEnumerable <IObjectLabel> objects, IEnumerable <IArrowLabel> arrows, bool associated)
 {
     foreach (IObjectLabel l in objects)
     {
         string type = l.Type;
         string st   = l.Object.GetType() + "";
         if (!type.Equals(st))
         {
             //type = st;
         }
         PureObjectLabelPeer lp = new PureObjectLabelPeer(l.Name, l.Kind, type, l.X, l.Y);
         Type     t             = l.GetType();
         object[] o             = t.GetCustomAttributes(typeof(SerializableLabelAttribute), true);
         if (o != null)
         {
             if (o.Length > 0)
             {
                 IObjectLabelHolder lh = lp;
                 lh.Label = l;
             }
         }
         IObjectLabel lab = lp;
         lab.Object  = l.Object;
         lab.Desktop = this;
         this.objects.Add(lab);
         if (associated)
         {
             lab.Object.Object = lab;
         }
         table[l.Name] = lab;
     }
     //PureObjectLabel.Wrappers = false;
     foreach (IArrowLabel l in arrows)
     {
         PureArrowLabelPeer lp = new PureArrowLabelPeer(l.Name, l.Kind, l.Type, l.X, l.Y);
         Type     t            = l.GetType();
         object[] o            = t.GetCustomAttributes(typeof(SerializableLabelAttribute), true);
         if (o != null)
         {
             if (o.Length > 0)
             {
                 IArrowLabelHolder lh = lp;
                 lh.Label = l;
             }
         }
         IArrowLabel lab = new PureArrowLabelPeer(l.Name, l.Kind, l.Type, l.X, l.Y);
         lab.Arrow = l.Arrow;
         if (associated)
         {
             lab.Arrow.Object = lab;
         }
         lab.Desktop = this;
         this.arrows.Add(lab);
         // components.Add(lab);
         table[l.Name] = lab;
         List <IObjectLabel> objs  = objects.ToList <IObjectLabel>();
         List <IObjectLabel> tobjs = this.Objects.ToList <IObjectLabel>();
         lab.Source = PureDesktop.Find(objs, tobjs, l.Source, l.Desktop);
         lab.Target = PureDesktop.Find(objs, tobjs, l.Target, l.Desktop);
     }
     if (!associated)
     {
         return;
     }
     this.SetParents();
     PureObjectLabel.SetLabels(objects);
     PureArrowLabel.SetLabels(arrows);
 }