void tlVectorControl1_AddElement(object sender, AddSvgElementEventArgs e)
        {
            XmlElement temp = e.SvgElement as XmlElement;
            intdata(tlVectorControl1.SVGDocument.SvgdataUid);
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("motherlinenode")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("01", tlVectorControl1.SVGDocument.SvgdataUid,this.ProjectUID,buscol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "01");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in buscol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag==true)
                    {
                        MessageBox.Show("已经选择此母线,请重新选择其他的母线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        buscol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        buscol.Add(ele1);
                        AddLine(temp, ((PSPDEV)subID).SUID);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("transformertwozu")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("02", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,trans2col);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "02");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in trans2col)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此变压器,请重新选择其他的变压器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        trans2col.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        trans2col.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("transformerthirdzu")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("03", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,trans3col);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "03");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in trans3col)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此两绕组变压器,请重新选择其他的两绕组变压器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        trans3col.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        trans3col.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("loadline")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("12", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,loadcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "12");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in loadcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此负荷,请重新选择其他的负荷!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        loadcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        loadcol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("dynamotorline")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("04", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,gencol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "04");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in gencol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此发电厂,请重新选择其他的发电厂!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        gencol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        gencol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("串联电抗器")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("10", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,cldkcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "10");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in cldkcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此串联电抗器,请重新选择其他的串联电抗器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        cldkcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        cldkcol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("串联电容器")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("08", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,cldrcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "08");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in cldrcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此串联电容器,请重新选择其他的串联电容器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        cldrcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        cldrcol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("并联电容器")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("09", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,bldrcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "09");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in bldrcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此并联电容器,请重新选择其他的并联电容器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        bldrcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        bldrcol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("并联电抗器")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("11", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,bldkcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "11");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in bldkcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此并联电抗器,请重新选择其他的并联电抗器!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        bldkcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        bldkcol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("1/2母联开关")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("13", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,MLcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "13");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in MLcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此1/2母联开关,请重新选择其他的1/2母联!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        MLcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        MLcol.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("2/3母联开关")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("14", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,ML2col);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "14");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in ML2col)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此3/2母联开关,请重新选择其他的3/2母联开关!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        ML2col.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        ML2col.Add(ele1);
                    }

                }
            }
            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("线路互感")))
            {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                object subID = DeviceHelper.SelectProjectDevice("15", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID,HGcol);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null)
                {

                    temp.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                    temp.SetAttribute("Type", "15");
                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X - 10).ToString());
                    n1.SetAttribute("y", (t.Y - 10).ToString());
                    n1.InnerText = ((PSPDEV)subID).Name;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
                else
                {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }

                foreach (eleclass ele in HGcol)
                {
                    if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                    {
                        MessageBox.Show("已经选择此线路互感,请重新选择其他的线路互感!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    }
                    else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                    {
                        HGcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                        HGcol.Add(ele1);
                    }

                }
            }
        }
        private void intdata(string filesuid)
        {
            buscol.Clear();
            linecol.Clear();
            trans2col.Clear();
            trans3col.Clear();
            gencol.Clear();
            cldrcol.Clear();
            bldrcol.Clear();
            bldkcol.Clear();
            cldkcol.Clear();
            loadcol.Clear();
            ML2col.Clear();
            MLcol.Clear();
            HGcol.Clear();
            string strCon1 = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + filesuid + "'";
            string strCon2 = null;
            string strCon = null;
            {
                strCon2 = "AND PSPDEV.Type = '01' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listMX = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '05' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '02' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listBYQ2 = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '03' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listBYQ3 = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '04' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listGen = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '08' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listCLDR = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '09' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listBlDR = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '10' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listCLDK = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '11' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listBLDK = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '12' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listFH = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '13' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listML = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '14' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listML2 = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                strCon2 = "AND PSPDEV.Type = '15' ORDER BY PSPDEV.Number";
                strCon = strCon1 + strCon2;
                listHG = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
            }
            foreach (PSPDEV dev in listMX)
            {
                if (dev.KSwitchStatus=="0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element!=null)
                    {
                        selectflag=true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    buscol.Add(li);
                }
            }
            foreach (PSPDEV dev in listXL)
            {
                if (dev.KSwitchStatus == "0")
                {
                      XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                      bool selectflag = false;
                      if (element != null)
                      {
                          selectflag = true;
                      }
                      eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    linecol.Add(li);
                }
            }
            foreach (PSPDEV dev in listBYQ2)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    trans2col.Add(li);
                }
            }
            foreach (PSPDEV dev in listBYQ3)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    trans3col.Add(li);
                }
            }
            foreach (PSPDEV dev in listCLDR)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    cldrcol.Add(li);
                }
            }
            foreach (PSPDEV dev in listBlDR)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    bldrcol.Add(li);
                }
            }
            foreach (PSPDEV dev in listCLDK)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    cldkcol.Add(li);
                }
            }
            foreach (PSPDEV dev in listBLDK)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    bldkcol.Add(li);
                }
            }
            foreach (PSPDEV dev in listGen)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    gencol.Add(li);
                }
            }
            foreach (PSPDEV dev in listFH)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    loadcol.Add(li);
                }
            }
            foreach (PSPDEV dev in listML)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    MLcol.Add(li);
                }
            }
            foreach (PSPDEV dev in listML2)
            {
                if (dev.KSwitchStatus == "0")
                {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null)
                    {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    ML2col.Add(li);
                }
            }
            foreach (PSPDEV dev in listHG)
            {

                XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                bool selectflag = false;
                if (element != null)
                {
                    selectflag = true;
                }
                eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    HGcol.Add(li);

            }
        }
Example #3
0
        void tlVectorControl1_AddElement(object sender, AddSvgElementEventArgs e)
        {
            XmlElement temp = e.SvgElement as XmlElement;
            intdata(tlVectorControl1.SVGDocument.SvgdataUid);

            if (temp is Use && (temp.GetAttribute("xlink:href").Contains("Substation"))) {
                //frmSubstation dlgSubstation = new frmSubstation();
                //dlgSubstation.ProjectID = this.ProjectUID;
                //dlgSubstation.InitData();
                XmlNodeList listUSE = tlVectorControl1.SVGDocument.GetElementsByTagName("use");
                IList<object> listID = new List<object>();
                foreach (XmlNode node in listUSE) {
                    string str = ((XmlElement)node).GetAttribute("Deviceid");
                    PSP_Substation_Info obj = DeviceHelper.GetDevice<PSP_Substation_Info>(str);
                    if (obj != null) {
                        listID.Add((object)obj);
                    }
                }
                DeviceHelper.pspflag = true;
                object subID = DeviceHelper.SelectDevice("20", tlVectorControl1.SVGDocument.SvgdataUid, listID);

                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null) {

                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X + t.Width + 10).ToString());
                    n1.SetAttribute("y", (t.Y + t.Height / 2).ToString());
                    n1.InnerText = ((PSP_Substation_Info)subID).Title;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("Deviceid", ((PSP_Substation_Info)subID).UID);
                    temp.SetAttribute("Deviceid", ((PSP_Substation_Info)subID).UID);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                    //PSP_ElcDevice elcDEV = new PSP_ElcDevice();
                    //elcDEV.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    //elcDEV.DeviceSUID = ((PSP_Substation_Info)subID).UID;
                    //Services.BaseService.Create<PSP_ElcDevice>(elcDEV);
                    //AddLine(temp, elcDEV.DeviceSUID);
                } else {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    return;
                }
                bool projectexitflag = false;               //检验此变电站是否在项目中
                foreach (eleclass ele in Subcol) {
                    if (ele.suid == ((PSP_Substation_Info)subID).UID && ele.selectflag == true) {
                        projectexitflag = true;
                        MessageBox.Show("已经选择此变电站,请重新选择其他的变电站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    } else if (ele.suid == ((PSP_Substation_Info)subID).UID && ele.selectflag == false) {
                        projectexitflag = true;
                        Subcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSP_Substation_Info)subID).Title, ((PSP_Substation_Info)subID).UID, "20", true);
                        Subcol.Add(ele1);
                        PSP_ElcDevice elcDEV = new PSP_ElcDevice();
                        elcDEV.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                        elcDEV.DeviceSUID = ((PSP_Substation_Info)subID).UID;
                        Services.BaseService.Create<PSP_ElcDevice>(elcDEV);
                        AddLine(temp, elcDEV.DeviceSUID);
                    }

                }
                if (!projectexitflag) {
                    MessageBox.Show("你所选择的项目中不包括此变电站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }
            } else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("Power"))) {
                XmlNodeList listUSE = tlVectorControl1.SVGDocument.GetElementsByTagName("use");
                IList<object> listID = new List<object>();
                foreach (XmlNode node in listUSE) {
                    string str = ((XmlElement)node).GetAttribute("Deviceid");
                    PSP_PowerSubstation_Info obj = DeviceHelper.GetDevice<PSP_PowerSubstation_Info>(str);
                    if (obj != null) {
                        listID.Add((object)obj);
                    }
                }
                DeviceHelper.pspflag = true;
                object subID = DeviceHelper.SelectDevice("30", tlVectorControl1.SVGDocument.SvgdataUid, listID);
                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                if (subID != null) {

                    RectangleF t = ((IGraph)temp).GetBounds();
                    n1.SetAttribute("x", (t.X + t.Width + 10).ToString());
                    n1.SetAttribute("y", (t.Y + t.Height / 2).ToString());
                    n1.InnerText = ((PSP_PowerSubstation_Info)subID).Title;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("Deviceid", ((PSP_PowerSubstation_Info)subID).UID);
                    temp.SetAttribute("Deviceid", ((PSP_PowerSubstation_Info)subID).UID);
                    n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                    //PSP_ElcDevice elcDEV = new PSP_ElcDevice();
                    //elcDEV.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    //elcDEV.DeviceSUID = ((PSP_PowerSubstation_Info)subID).UID;
                    //Services.BaseService.Create<PSP_ElcDevice>(elcDEV);
                    //AddLine(temp, elcDEV.DeviceSUID);
                } else {
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    return;
                }
                bool projectexitflag = false;               //检验此变电站是否在项目中
                foreach (eleclass ele in Powcol) {
                    if (ele.suid == ((PSP_PowerSubstation_Info)subID).UID && ele.selectflag == true) {
                        projectexitflag = true;
                        MessageBox.Show("已经选择此发电厂,请重新选择其他的发电厂!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                        tlVectorControl1.Delete();
                        tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                        tlVectorControl1.Delete();
                    } else if (ele.suid == ((PSP_PowerSubstation_Info)subID).UID && ele.selectflag == false) {
                        projectexitflag = true;
                        Subcol.Remove(ele);
                        eleclass ele1 = new eleclass(((PSP_PowerSubstation_Info)subID).Title, ((PSP_PowerSubstation_Info)subID).UID, "30", true);
                        Subcol.Add(ele1);
                        PSP_ElcDevice elcDEV = new PSP_ElcDevice();
                        elcDEV.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                        elcDEV.DeviceSUID = ((PSP_PowerSubstation_Info)subID).UID;
                        Services.BaseService.Create<PSP_ElcDevice>(elcDEV);
                        AddLine(temp, elcDEV.DeviceSUID);
                    }

                }
                if (!projectexitflag) {
                    MessageBox.Show("你所选择的项目中不包括此发电厂!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tlVectorControl1.SVGDocument.CurrentElement = temp as SvgElement;
                    tlVectorControl1.Delete();
                    tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                    tlVectorControl1.Delete();
                }
            }
        }
Example #4
0
        private void intdata(string filesuid)
        {
            Subcol.Clear();
            Powcol.Clear();
            linecol.Clear();
            string con = " AreaID = '" + Itop.Client.MIS.ProgUID + "' AND UID IN (SELECT PSPDEV.SVGUID FROM PSPDEV, PSP_ELCDEVICE WHERE  PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + filesuid + "')";

            listSub = Services.BaseService.GetList("SelectPSP_Substation_InfoListByWhere", con);
            foreach (PSP_Substation_Info dev in listSub) {

                XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.UID + "']");
                bool selectflag = false;
                if (element != null) {
                    selectflag = true;
                }
                eleclass li = new eleclass(dev.Title, dev.UID, "20", selectflag);
                Subcol.Add(li);
                if (!selectflag) {
                    PSP_ElcDevice pg = new PSP_ElcDevice();
                    pg.DeviceSUID = dev.UID;
                    pg.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    // pg = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByKey", pg);
                    Services.BaseService.Delete<PSP_ElcDevice>(pg);
                }

            }
            con = " AreaID = '" + Itop.Client.MIS.ProgUID + "' AND UID IN (SELECT PSPDEV.SVGUID FROM PSPDEV, PSP_ELCDEVICE WHERE  PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + filesuid + "')";

            listPow = Services.BaseService.GetList("SelectPSP_PowerSubstation_InfoListByWhere", con);
            foreach (PSP_PowerSubstation_Info dev in listPow) {

                XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.UID + "']");
                bool selectflag = false;
                if (element != null) {
                    selectflag = true;
                }
                eleclass li = new eleclass(dev.Title, dev.UID, "30", selectflag);
                Powcol.Add(li);
                if (!selectflag) {
                    PSP_ElcDevice pg = new PSP_ElcDevice();
                    pg.DeviceSUID = dev.UID;
                    pg.ProjectSUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    // pg = (PSP_GprogElevice)Services.BaseService.GetObject("SelectPSP_GprogEleviceByKey", pg);
                    Services.BaseService.Delete<PSP_ElcDevice>(pg);
                }
            }
            con = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + filesuid + "' AND PSPDEV.Type = '05' ORDER BY PSPDEV.Number";
            listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", con);
            foreach (PSPDEV dev in listXL) {
                if (dev.KSwitchStatus == "0") {
                    XmlNode element = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@Deviceid='" + dev.SUID + "']");
                    bool selectflag = false;
                    if (element != null) {
                        selectflag = true;
                    }
                    eleclass li = new eleclass(dev.Name, dev.SUID, dev.Type, selectflag);
                    linecol.Add(li);
                }
            }
        }
Example #5
0
        private void checkwjghelement()
        {
            //判断图元有没有

            wjghelement.Clear();
            XmlNodeList useList = tlVectorControl1.SVGDocument.SelectNodes("svg/use");
            XmlNodeList linelist = tlVectorControl1.SVGDocument.SelectNodes("svg/polyline [@IsLead='1']");
            string con = "GprogUID='" + ff.Key + "'";
            IList list = Services.BaseService.GetList("SelectPSP_GprogEleviceByCondition", con);
            try
            {
                foreach (PSP_GprogElevice pg in list)
                {
                    bool flag = false;
                    if (pg.Type == "变电站" || pg.Type == "电源")
                    {
                        foreach (XmlNode element in useList)
                        {
                            if (!string.IsNullOrEmpty((element as XmlElement).GetAttribute("Deviceid")))
                            {
                                if ((element as XmlElement).GetAttribute("Deviceid") == pg.DeviceSUID)
                                {
                                    flag = true;
                                    if (pg.L2 == "0")
                                    {
                                        pg.L2 = "1";
                                        Services.BaseService.Update<PSP_GprogElevice>(pg);
                                    }
                                    break;
                                }
                            }

                        }
                    }
                    else
                    {
                        foreach (XmlNode element in linelist)
                        {
                            if (!string.IsNullOrEmpty((element as XmlElement).GetAttribute("Deviceid")))
                            {
                                if ((element as XmlElement).GetAttribute("Deviceid") == pg.DeviceSUID)
                                {
                                    //显示隐藏的图元

                                    (element as XmlElement).SetAttribute("visibility", "show");
                                    flag = true;
                                    if (pg.L2 == "0")
                                    {
                                        pg.L2 = "1";
                                        Services.BaseService.Update<PSP_GprogElevice>(pg);
                                    }

                                    break;
                                }
                            }

                        }
                    }
                    if (!flag)
                    {
                        if (pg.L2 == "1")
                        {
                            pg.L2 = "0";
                            Services.BaseService.Update<PSP_GprogElevice>(pg);
                        }

                    }
                    if (pg.Type == "变电站")
                    {
                        PSP_Substation_Info sb = new PSP_Substation_Info();
                        sb.UID = pg.DeviceSUID;
                        sb = (PSP_Substation_Info)Services.BaseService.GetObject("SelectPSP_Substation_InfoByKey", sb);
                        eleclass el = new eleclass(sb.Title, sb.UID, "20", flag);
                        wjghelement.Add(el);
                    }
                    if (pg.Type == "电源")
                    {
                        PSP_PowerSubstation_Info sb = new PSP_PowerSubstation_Info();
                        sb.UID = pg.DeviceSUID;
                        sb = (PSP_PowerSubstation_Info)Services.BaseService.GetObject("SelectPSP_PowerSubstation_InfoByKey", sb);
                        eleclass el = new eleclass(sb.Title, sb.UID, "30", flag);
                        wjghelement.Add(el);
                    }
                    if (pg.Type == "线路")
                    {
                        PSPDEV sb = new PSPDEV();
                        sb.SUID = pg.DeviceSUID;
                        sb = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", sb);
                        eleclass el = new eleclass(sb.Name, sb.SUID, "05", flag);
                        wjghelement.Add(el);
                    }
                }

            }
            catch (System.Exception ex)
            {

            }
        }
Example #6
0
        public void JDlinecheck(string GprogUID,int Type)
        {
            JDlinecol.Clear();
                if (Type == 2)
                {
                    string strCon = "WHERE Type='01' AND SvgUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and Type in ('���վ','��Դ') and L1 in('����','����')) ";
                    string strCon2 = "WHERE Type='05' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·'and ZTstatus in('����','��ѡ')) ";
                        IList listMX = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                        IList listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon2);
                        foreach (PSPDEV dev in listXL)
                        {
                            if (dev.KSwitchStatus == "0")
                            {
                                bool fistflag = false;
                                bool lastflag = false;
                                foreach (PSPDEV pspdev in listMX)
                                {
                                    if (dev.IName == pspdev.Name)
                                    {
                                        fistflag = true;
                                    }
                                    if (dev.JName == pspdev.Name)
                                    {
                                        lastflag = true;
                                    }
                                }
                                if (lastflag && fistflag)
                                {
                                    eleclass el = new eleclass(dev.Name, dev.SUID, dev.Type, true);
                                    JDlinecol.Add(el);
                                }

                            }
                        }
                }
              if (Type == 3)
                {
                 string strCon = "WHERE Type='01' AND SvgUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and Type in ('���վ','��Դ') and L1 in('����','����','����')) ";
                 string strCon2 = "WHERE Type='05' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·' and JQstatus in('����','Ͷ��','��ѡ')) ";
                    IList listMX = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                    IList listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon2);
                    foreach (PSPDEV dev in listXL)
                    {
                        if (dev.KSwitchStatus == "0")
                        {
                            bool fistflag=false;
                            bool lastflag=false;
                            foreach (PSPDEV pspdev in listMX)
                            {
                                if (dev.IName == pspdev.Name)
                                {
                                    fistflag = true;
                                }
                                if (dev.JName == pspdev.Name)
                                {
                                    lastflag = true;
                                }
                            }
                            if (lastflag&&fistflag)
                            {
                                if (dev.LineStatus=="�ȴ�")
                                {
                                    dev.LineStatus = "��ѡ";
                                    Services.BaseService.Update<PSPDEV>(dev);
                                }
                                eleclass el = new eleclass(dev.Name, dev.SUID, dev.Type, true);
                                JDlinecol.Add(el);
                            }

                        }
                    }

               }
               if (Type == 4)
               {
                 string strCon = "WHERE Type='01' AND SvgUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and Type in ('���վ','��Դ') ) ";
                 string strCon2 = "WHERE Type='05' AND SUID in (select DeviceSUID from PSP_GprogElevice where GprogUID='" + GprogUID + "'and type='��·' and ZQstatus in('����','Ͷ��','��ѡ')) ";

                    IList listMX = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                    IList listXL = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon2);
                    foreach (PSPDEV dev in listXL)
                    {
                        if (dev.KSwitchStatus == "0")
                        {
                            bool fistflag=false;
                            bool lastflag=false;
                            foreach (PSPDEV pspdev in listMX)
                            {
                              if (dev.IName==pspdev.Name)
                              {
                                  fistflag=true;
                              }
                                if (dev.JName==pspdev.Name)
                                {
                                    lastflag=true;
                                }
                            }
                            if (lastflag&&fistflag)
                            {
                                if (dev.LineStatus == "�ȴ�")
                                {
                                    dev.LineStatus = "��ѡ";
                                    Services.BaseService.Update<PSPDEV>(dev);
                                }
                                eleclass el = new eleclass(dev.Name, dev.SUID, dev.Type, true);
                                JDlinecol.Add(el);
                            }

                        }
                    }

                 }
        }