Exemplo n.º 1
0
        // TODO: This does more than just getting the zorder - it also saves connection information for connectors,
        // which is critical to wire up connectors to shapes after a delete has been undone.
        public List <ZOrderMap> GetZOrderOfSelectedElements()
        {
            List <ZOrderMap> originalZOrder = new List <ZOrderMap>();

            selectedElements.ForEach(el =>
            {
                ZOrderMap zom = new ZOrderMap()
                {
                    Element = el, Index = elements.IndexOf(el)
                };
                zom.GroupChildren = new List <GraphicElement>(el.GroupChildren);
                zom.Connections   = new List <Connection>(el.Connections);

                if (el.IsConnector)
                {
                    zom.StartConnectedShape = ((Connector)el).StartConnectedShape;
                    zom.EndConnectedShape   = ((Connector)el).EndConnectedShape;

                    if (zom.StartConnectedShape != null)
                    {
                        zom.StartConnection = zom.StartConnectedShape.Connections.SingleOrDefault(conn => conn.ToElement == el);
                    }

                    if (zom.EndConnectedShape != null)
                    {
                        zom.EndConnection = zom.EndConnectedShape.Connections.SingleOrDefault(conn => conn.ToElement == el);
                    }
                }

                originalZOrder.Add(zom);
                SaveChildZOrder(el, originalZOrder);
            });

            return(originalZOrder);
        }
Exemplo n.º 2
0
 public void SaveChildZOrder(GraphicElement el, List <ZOrderMap> zorder)
 {
     el.GroupChildren.ForEach(gc =>
     {
         ZOrderMap zom = new ZOrderMap()
         {
             Element = gc, Index = elements.IndexOf(gc)
         };
         zom.GroupChildren = new List <GraphicElement>(gc.GroupChildren);
         zom.Connections   = new List <Connection>(gc.Connections);
         zorder.Add(zom);
         SaveChildZOrder(gc, zorder);
     });
 }
Exemplo n.º 3
0
        // TODO: This does more than just getting the zorder - it also saves connection information for connectors,
        // which is critical to wire up connectors to shapes after a delete has been undone.
        public List <ZOrderMap> GetZOrderOfSelectedElements()
        {
            List <ZOrderMap> originalZOrder = new List <ZOrderMap>();

            selectedElements.ForEach(el =>
            {
                ZOrderMap zom = new ZOrderMap()
                {
                    Element = el, Index = elements.IndexOf(el)
                };
                zom.GroupChildren = new List <GraphicElement>(el.GroupChildren);
                zom.Connections   = new List <Connection>(el.Connections);

                if (el.IsConnector)
                {
                    zom.StartConnectedShape = ((Connector)el).StartConnectedShape;
                    zom.EndConnectedShape   = ((Connector)el).EndConnectedShape;

                    if (zom.StartConnectedShape != null)
                    {
                        // TODO: First or default used because we have a bug, yet to fix, where the shape can have the same connector attached twice!
                        zom.StartConnection = zom.StartConnectedShape.Connections.FirstOrDefault(conn => conn.ToElement == el);
                    }

                    if (zom.EndConnectedShape != null)
                    {
                        // TODO: First or default used because we have a bug, yet to fix, where the shape can have the same connector attached twice!
                        zom.EndConnection = zom.EndConnectedShape.Connections.FirstOrDefault(conn => conn.ToElement == el);
                    }
                }

                originalZOrder.Add(zom);
                SaveChildZOrder(el, originalZOrder);
            });

            return(originalZOrder);
        }