예제 #1
0
        public Layer Copy()
        {
            Layer layer = CreateNew(this.Label + " 副本", this.OwnerDocument);

            int num = graphList.Count;

            if (num > 0)
            {
                OwnerDocument.NumberOfUndoOperations = (2 * graphList.Count) + 200;
                SvgElementCollection sc = graphList.Clone();
                for (int i = num - 1; i >= 0; i--)
                {
                    SvgElement element = sc[i] as SvgElement;

                    IGraph graph = (IGraph)AddElement(element.Clone() as SvgElement);

                    graph.Layer = layer;
                }
                this.OwnerDocument.NotifyUndo();
            }

            return(layer);
        }
예제 #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);
        }
예제 #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);
        }
예제 #4
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);
        }
예제 #5
0
        private void button1_click(object sender, EventArgs e)
        {
            this.firstload = false;
            SvgElement facbce1 = null;

            if (this.chkSelection.Checked)
            {            //只包含选区
                if (this.selectionSymbol == null)
                {
                    this.selectionSymbol = this.vectorcontrol.CreateSymbol(false, false, true);
                }
                facbce1 = this.selectionSymbol;
                if (this.chkShape.Checked)
                {                //自定义形状
                    if (this.selectionShape == null)
                    {
                        this.selectionShape = this.vectorcontrol.CreateSymbol(false, true, true);
                    }
                    facbce1 = this.selectionShape;
                }
            }
            else
            {            //全部
                if (this.allSymbol == null)
                {
                    this.allSymbol = this.vectorcontrol.CreateSymbol(true, false, true);
                }
                facbce1 = this.allSymbol;
                if (this.chkShape.Checked)
                {                //自定义形状
                    if (this.allShape == null)
                    {
                        this.allShape = this.vectorcontrol.CreateSymbol(true, true, true);
                    }
                    facbce1 = this.allShape;
                }
            }
            if (facbce1 != null)
            {
                for (int num1 = 0; num1 < facbce1.ChildNodes.Count; num1++)
                {
                    if (facbce1.ChildNodes[num1] is SvgElement)
                    {
                        (facbce1.ChildNodes[num1] as SvgElement).SetAttribute("id", this.txtID.Text.Trim());
                        if (!this.chkDocument.Checked)
                        {
                            facbce1 = facbce1.ChildNodes[num1] as SvgElement;
                        }
                        break;
                    }
                }
            }
            string text1 = string.Empty;

            if (facbce1 != null)
            {
                this.curElement = (SvgElement)facbce1.Clone();
                text1           = facbce1.OuterXml;
                this.pictureBox1.Invalidate();
            }
            if (this.chkDocument.Checked)
            {
                text1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + text1;
            }
            this.richTextBox1.Text = text1;
        }