Ejemplo n.º 1
0
        /// <summary>
        /// 이 Layer를 복제한 오브젝트를 만들어낸다.
        /// 현재 스냅샷의 다음 스냅샷을 만들 시, 계승되는 오브젝트에 관한 관리를 하기 위해 필요함
        /// NOTE : 추가 데이터 (CustomData) 는 복제하지 않음.
        /// </summary>
        /// <returns></returns>
        public Layer Clone()
        {
            Layer newLayer = new Layer();

            foreach (IElement elem in m_elements.Values)                                                        // 가지고 있는 Element 를 모두 복제한다. (UniqueID까지 복사)
            {
                newLayer.AddElement(elem.GenericClone());
            }

            return(newLayer);
        }
Ejemplo n.º 2
0
        private Layer CopyLayer(Layer layer)
        {
            Layer layer2 = Layer.CreateNew(layer.Label + " 副本", this.SymbolDoc);

            //foreach (SvgElement g in layer.GraphList)
            //{
            //    layer2.GraphList.Add(g);
            //}

            this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200;
            SvgElementCollection sc = layer.GraphList;

            for (int i = layer.GraphList.Count - 1; i >= 0; i--)
            {
                SvgElement element = sc[i] as SvgElement;
                SvgElement temp    = element.Clone() as SvgElement;
                //if (temp.Name=="use"){
                if (temp.GetAttribute("CopyOf") == "")
                {
                    temp.SetAttribute("CopyOf", temp.ID);
                }
                IGraph graph = (IGraph)layer2.AddElement(temp);
                graph.Layer = layer2;

                LineInfo _line = new LineInfo();
                _line.EleID  = element.ID;
                _line.SvgUID = this.SymbolDoc.SvgdataUid;
                IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line);
                foreach (LineInfo line in lineInfoList)
                {
                    line.UID     = Guid.NewGuid().ToString();
                    line.LayerID = layer2.ID;
                    line.EleID   = temp.ID;
                    Services.BaseService.Create <LineInfo>(line);
                }
                glebeProperty gle = new glebeProperty();
                gle.EleID  = element.ID;
                gle.SvgUID = this.SymbolDoc.SvgdataUid;
                IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle);
                foreach (glebeProperty gleP in gleProList)
                {
                    gleP.UID     = Guid.NewGuid().ToString();
                    gleP.LayerID = layer2.ID;
                    gleP.EleID   = temp.ID;
                    Services.BaseService.Create <glebeProperty>(gleP);
                }
                substation _sub = new substation();
                _sub.EleID  = element.ID;
                _sub.SvgUID = this.SymbolDoc.SvgdataUid;
                IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub);
                foreach (substation sub in substationList)
                {
                    sub.UID     = Guid.NewGuid().ToString();
                    sub.LayerID = layer2.ID;
                    sub.EleID   = temp.ID;
                    Services.BaseService.Create <substation>(sub);
                }
            }
            this.SymbolDoc.NotifyUndo();
            return(layer2);
        }
Ejemplo n.º 3
0
        private Layer CopyLayer2(Layer layer, string textname)
        {
            string layerlabelf = layer.Label.Substring(4);
            string layer2name  = textname + layerlabelf;
            int    j           = 0;

            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                if (checkedListBox1.Items[i].ToString() == layer2name)
                {
                    j = 1;
                }
                //else
                //    j = 0;
            }
            Layer layer2 = null;

            if (j == 0)
            {
                layer2 = Layer.CreateNew(textname + layerlabelf, this.SymbolDoc);
                this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200;
                SvgElementCollection sc = layer.GraphList;
                for (int i = layer.GraphList.Count - 1; i >= 0; i--)
                {
                    SvgElement element = sc[i] as SvgElement;
                    SvgElement temp    = element.Clone() as SvgElement;
                    if (temp.GetAttribute("CopyOf") == "")
                    {
                        temp.SetAttribute("CopyOf", temp.ID);
                    }
                    IGraph graph = (IGraph)layer2.AddElement(temp);
                    graph.Layer = layer2;

                    //LineInfo _line = new LineInfo();
                    //_line.EleID = element.ID;
                    //_line.SvgUID = this.SymbolDoc.SvgdataUid;
                    //IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line);
                    PSPDEV _line = new PSPDEV();
                    _line.EleID  = element.ID;
                    _line.SvgUID = this.SymbolDoc.SvgdataUid;
                    IList lineInfoList = Services.BaseService.GetList("SelectPSPDEVBySvgUIDandEleID", _line);

                    foreach (PSPDEV line in lineInfoList)
                    {
                        line.SUID    = Guid.NewGuid().ToString();
                        line.LayerID = layer2.ID;
                        line.EleID   = temp.ID;
                        Services.BaseService.Create <PSPDEV>(line);
                    }
                    glebeProperty gle = new glebeProperty();
                    gle.EleID  = element.ID;
                    gle.SvgUID = this.SymbolDoc.SvgdataUid;
                    IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle);
                    foreach (glebeProperty gleP in gleProList)
                    {
                        gleP.UID     = Guid.NewGuid().ToString();
                        gleP.LayerID = layer2.ID;
                        gleP.EleID   = temp.ID;
                        Services.BaseService.Create <glebeProperty>(gleP);
                    }
                    substation _sub = new substation();
                    _sub.EleID  = element.ID;
                    _sub.SvgUID = this.SymbolDoc.SvgdataUid;
                    IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub);
                    foreach (substation sub in substationList)
                    {
                        sub.UID     = Guid.NewGuid().ToString();
                        sub.LayerID = layer2.ID;
                        sub.EleID   = temp.ID;
                        Services.BaseService.Create <substation>(sub);
                    }
                }
            }
            this.SymbolDoc.NotifyUndo();
            return(layer2);
        }
Ejemplo n.º 4
0
 public static void ReadFrame(Region frame, XmlNode node,
                              Region uiParent, Layer layer)
 {
     frame.UiParent = uiParent;
     frame.ReadNode(node);
     if (frame.Name == null)
         frame.GenerateName(null);
     if (!frame.Name.StartsWith("$parent")) {
         if (frame.IsVirtual)
             UiSystem.VirtualFrameMap[frame.Name] = frame;
         else {
             Debug.Assert(!UiSystem.FrameMap.ContainsKey(frame.Name),
                          string.Format("Newly generated frame '{0}' conflicts with existing frame", frame.Name));
             log.InfoFormat("Adding to FrameMap: {0}", frame.Name);
             UiSystem.FrameMap[frame.Name] = frame;
         }
     }
     if (frame == null)
         return;
     if (layer != null) {
         layer.AddElement(frame);
         return;
     }
     if (frame.UiParent != null) {
         Debug.Assert(frame.UiParent is Frame);
         ((Frame)frame.UiParent).AddElement(frame);
     }
 }
Ejemplo n.º 5
0
        private Layer CopyLayer(Layer layer)
        {
            Layer layer2 = Layer.CreateNew(layer.Label + " 副本", this.SymbolDoc);

            layer2.SetAttribute("ParentID", layer.GetAttribute("ParentID"));
            //foreach (SvgElement g in layer.GraphList)
            //{
            //    layer2.GraphList.Add(g);
            //}
            SVG_LAYER la = new SVG_LAYER();

            la.SUID  = layer.ID;
            la.svgID = symbolDoc.SvgdataUid;
            la       = (SVG_LAYER)Services.BaseService.GetObject("SelectSVG_LAYERByKey", la);
            if (la != null)
            {
                la.SUID = layer2.ID;
                la.NAME = layer2.Label;
                Services.BaseService.Create <SVG_LAYER>(la);
            }
            this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200;
            SvgElementCollection sc = layer.GraphList;

            for (int i = layer.GraphList.Count - 1; i >= 0; i--)
            {
                SvgElement element = sc[i] as SvgElement;
                SvgElement temp    = element.Clone() as SvgElement;
                //if (temp.Name=="use"){
                if (temp.GetAttribute("CopyOf") == "")
                {
                    temp.SetAttribute("CopyOf", temp.ID);
                }
                //else
                //{
                //    temp.SetAttribute("CopyOf", temp.ID);
                //}
                //}
                IGraph graph = (IGraph)layer2.AddElement(temp);
                graph.Layer = layer2;

                /* LineInfo _line = new LineInfo();
                 * _line.EleID = element.ID;
                 * _line.SvgUID = this.SymbolDoc.SvgdataUid;
                 * IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line);
                 * foreach (LineInfo line in lineInfoList)
                 * {
                 *   line.UID = Guid.NewGuid().ToString();
                 *   line.LayerID = layer2.ID;
                 *   line.EleID = temp.ID;
                 *   Services.BaseService.Create<LineInfo>(line);
                 * }
                 * glebeProperty gle = new glebeProperty();
                 * gle.EleID = element.ID;
                 * gle.SvgUID = this.SymbolDoc.SvgdataUid;
                 * IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle);
                 * foreach (glebeProperty gleP in gleProList)
                 * {
                 *   gleP.UID = Guid.NewGuid().ToString();
                 *   gleP.LayerID = layer2.ID;
                 *   gleP.EleID = temp.ID;
                 *   Services.BaseService.Create<glebeProperty>(gleP);
                 * }
                 * substation _sub = new substation();
                 * _sub.EleID = element.ID;
                 * _sub.SvgUID = this.SymbolDoc.SvgdataUid;
                 * IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub);
                 * foreach (substation sub in substationList)
                 * {
                 *   sub.UID = Guid.NewGuid().ToString();
                 *   sub.LayerID = layer2.ID;
                 *   sub.EleID = temp.ID;
                 *   Services.BaseService.Create<substation>(sub);
                 * }*/
            }
            this.SymbolDoc.NotifyUndo();
            return(layer2);
        }