Esempio n. 1
0
        void tlVectorControl1_LeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e)
        {
            //SvgElement ele2 = tlVectorControl1.CreateBySymbolID("kbs-8", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
            //ele2 = tlVectorControl1.AddShape(ele2, Point.Empty);
            if (tlVectorControl1.SVGDocument.CurrentElement != null &&
                tlVectorControl1.SVGDocument.CurrentElement.GetAttribute("xlink:href").Contains("XL_GT_1")) {
                sel_start_point = tlVectorControl1.SVGDocument.CurrentElement.ID;
            }

            if (sel_sym == "bt_start") {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_1", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele = tlVectorControl1.AddShape(ele, Point.Empty);
                ele.SetAttribute("order", "0");
                ele.SetAttribute("start_point", ele.ID);
            }
            if (sel_sym == "bt_end") {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_2", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele.SetAttribute("start_point", sel_start_point);
                ele.SetAttribute("order", "999");
                tlVectorControl1.AddShape(ele, Point.Empty);
            }
            if (sel_sym == "bt_must") {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_3", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele.SetAttribute("start_point", sel_start_point);
                tlVectorControl1.AddShape(ele, Point.Empty);
                frmInputNum num = new frmInputNum();
                num.ShowDialog();
                ele.SetAttribute("order", num.InputStrSEL);
            }
            if (sel_sym == "bt_point") {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_4", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele.SetAttribute("start_point", sel_start_point);
                tlVectorControl1.AddShape(ele, Point.Empty);
                frmInputNum num = new frmInputNum();
                num.ShowDialog();
                ele.SetAttribute("order", num.InputStrSEL);
            }
            //if (sel_sym != "" && sel_start_point!="")
            //{
            //    XmlNodeList il= tlVectorControl1.SVGDocument.SelectNodes("svg/use [@start_point='" + sel_start_point + "']");
            //    if (il.Count < 3)
            //    {
            //        return;
            //    }
            //    for (int i = 0; i < il.Count;i++ )
            //    {
            //        Use u = (Use)il[i];
            //        PointF f = u.CenterPoint;

            //    }
            //    //PointF[] pnt = ((Polyline)(tlVectorControl1.SVGDocument.CurrentElement)).Points;
            //    //if (pnt.Length < 3) return;
            //    for (int i = 0; i < il.Count; i++)
            //    {
            //        double ang = TLMath.getLineAngle(((Use)il[i]).CenterPoint, ((Use)il[i + 1]).CenterPoint, ((Use)il[i + 2]).CenterPoint);
            //        if (ang * 57.3 > 60)
            //        {
            //            MessageBox.Show("线路转角不能大于60度。\r\n "+"第" + (i + 1) + "转角:" + Convert.ToDouble(ang * 57.3).ToString("##.##") + "度。\r\n", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //           // tlVectorControl1.Delete();
            //            return;
            //        }

            //        if (i == il.Count - 3)
            //        {
            //            break;
            //        }
            //    }
            //}
            if (csOperation == CustomOperation.OP_MeasureDistance) {
                Polyline pl = tlVectorControl1.SVGDocument.CurrentElement as Polyline;
                if (pl.Points.Length > 1) {
                    double d = 0;
                    for (int i = 1; i < pl.Points.Length; i++) {
                        d += this.mapview.CountLength(pl.Points[i - 1], pl.Points[i]);
                    }
                    label1.Text = d + "公里";

                    Point pt = new Point(e.Mouse.X, e.Mouse.Y);
                    pt = PointToClient(tlVectorControl1.PointToScreen(pt));
                    //tlVectorControl1.SetToolTip(label1.Text);
                    label1.Left = pt.X;
                    label1.Top = pt.Y;

                    label1.Visible = true;
                }
                return;
            }
            //System.IO.FileInfo ff = new System.IO.FileInfo("c:\\1111.txt");
            //System.IO.StreamWriter wt= ff.CreateText();
            //wt.Write(tlVectorControl1.SVGDocument.OuterXml);
            //wt.Close();
            //SortedList l = new SortedList();
            //l.Add("1", "aaa");
            //l.Add("5", "bbb");
            //l.Add("2", "ccc");

            //if (tlVectorControl1.ScaleRatio < 0.1f) {
            //    tlVectorControl1.ScaleRatio = 0.1f;
            //    scaleBox.ComboBoxEx.Text = "";
            //    scaleBox.SelectedText = "10%";
            //}
            tip.Hide();
            fInfo.Hide();

            if (tlVectorControl1.Operation == ToolOperation.Text) {
                frmTextInput ft = new frmTextInput();
                if (ft.ShowDialog() == DialogResult.OK) {
                    string txt = ft.Content;
                    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                    Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("x", point1.X.ToString());
                    n1.SetAttribute("y", point1.Y.ToString());
                    n1.InnerText = txt;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
            }
            if (MapType == "规划统计") {
                try {
                    if (e.SvgElement.ID == "svg") {
                        MapType = "接线图";
                        return;
                    }
                    if (((Polygon)e.SvgElement) == null) return;
                    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("circle") as Circle;
                    Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("cx", point1.X.ToString());
                    n1.SetAttribute("cy", point1.Y.ToString());
                    n1.SetAttribute("r", "42.5");
                    n1.SetAttribute("r", "42.5");
                    //n1.SetAttribute("layer", getlayer("供电区域层", tlVectorControl1.SVGDocument.getLayerList()).ID);
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("style", "fill:#FFFFC0;fill-opacity:0.5;stroke:#000000;stroke-opacity:1;");
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);

                    frmMainProperty fmain = new frmMainProperty();
                    glebeProperty gp = new glebeProperty();
                    gp.EleID = ((XmlElement)e.SvgElement).GetAttribute("id");
                    gp.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    //fmain.InitData(gp); ///////////////////////////////////

                    XmlNodeList nlist = tlVectorControl1.SVGDocument.GetElementsByTagName("use");

                    PointF[] tfArray1 = TLMath.getPolygonPoints((XmlElement)e.SvgElement);
                    string str220 = "";
                    string str110 = "";
                    string str66 = "";
                    GraphicsPath selectAreaPath = new GraphicsPath();
                    selectAreaPath.AddLines(tfArray1);
                    selectAreaPath.CloseFigure();
                    //Matrix x=new Matrix(
                    //Region region1 = new Region(selectAreaPath);
                    for (int i = 0; i < nlist.Count; i++) {
                        float OffX = 0f;
                        float OffY = 0f;
                        Use use = (Use)nlist[i];
                        if (use.GetAttribute("xlink:href").Contains("Substation")) {
                            string strMatrix = use.GetAttribute("transform");
                            if (strMatrix != "") {
                                strMatrix = strMatrix.Replace("matrix(", "");
                                strMatrix = strMatrix.Replace(")", "");
                                string[] mat = strMatrix.Split(',');
                                if (mat.Length > 5) {
                                    OffX = Convert.ToSingle(mat[4]);
                                    OffY = Convert.ToSingle(mat[5]);
                                }
                            }
                            PointF TempPoint = TLMath.getUseOffset(use.GetAttribute("xlink:href"));
                            if (selectAreaPath.IsVisible(use.X + TempPoint.X + OffX, use.Y + TempPoint.Y + OffY)) {
                                if (use.GetAttribute("xlink:href").Contains("220")) {
                                    str220 = str220 + "'" + use.GetAttribute("id") + "',";
                                }
                                if (use.GetAttribute("xlink:href").Contains("110")) {
                                    str110 = str110 + "'" + use.GetAttribute("id") + "',";
                                }
                                if (use.GetAttribute("xlink:href").Contains("66")) {
                                    str66 = str66 + "'" + use.GetAttribute("id") + "',";
                                }
                            }
                        }
                    }
                    if (str220.Length > 1) {
                        str220 = str220.Substring(0, str220.Length - 1);
                    }
                    if (str110.Length > 1) {
                        str110 = str110.Substring(0, str110.Length - 1);
                    }
                    if (str66.Length > 1) {
                        str66 = str66.Substring(0, str66.Length - 1);
                    }
                    fmain.InitData(gp, str220, str110, str66);

                    XmlElement t1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                    Point point2 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    t1.SetAttribute("x", Convert.ToString(point2.X - 20));
                    t1.SetAttribute("y", Convert.ToString(point2.Y - 10));
                    // t1.SetAttribute("layer", getlayer("供电区域层", tlVectorControl1.SVGDocument.getLayerList()).ID);
                    t1.SetAttribute("layer", SvgDocument.currentLayer);
                    t1.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                    t1.SetAttribute("font-famliy", "宋体");
                    t1.SetAttribute("font-size", "14");
                    t1.InnerText = fmain.glebeProp.Area + "\r\n" + fmain.glebeProp.Burthen; //+"\r\n" + fmain.glebeProp.Number;
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(t1);
                    tlVectorControl1.Refresh();
                    fmain.Dispose();
                    MapType = "接线图";
                } catch (Exception e2) { MapType = "接线图"; }
            }
            if (tlVectorControl1.SVGDocument.SelectCollection.Count > 1) {
                return;
            }
            decimal ViewScale = 1;
            string str_Scale = tlVectorControl1.SVGDocument.getViewScale();
            if (str_Scale != "") {
                ViewScale = Convert.ToDecimal(str_Scale);
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polygon") {
                string IsArea = ((XmlElement)e.SvgElement).GetAttribute("IsArea");
                if (IsArea != "") {

                    XmlElement n1 = (XmlElement)e.SvgElement;
                    string str_points = n1.GetAttribute("points");
                    string[] points = str_points.Split(",".ToCharArray());
                    PointF[] pnts = new PointF[points.Length];

                    for (int i = 0; i < points.Length; i++) {
                        string[] pointsXY = points[i].Split(" ".ToCharArray());
                        pnts[i].X = Convert.ToSingle(pointsXY[0]);
                        pnts[i].Y = Convert.ToSingle(pointsXY[1]);
                    }
                    decimal temp1 = TLMath.getPolygonArea(pnts, 1);

                    temp1 = TLMath.getNumber2(temp1, tlVectorControl1.ScaleRatio);
                    SelUseArea = temp1.ToString("#####.####");
                    //tip.Text = "区域面积:" + SelUseArea;
                    if (SelUseArea != "") {
                        if (Convert.ToDecimal(SelUseArea) >= 1) {
                            fInfo.Info = "区域面积:" + SelUseArea + "(KM²)";
                        } else {
                            fInfo.Info = "区域面积: 0" + SelUseArea + "(KM²)";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 12;
                    if (SelUseArea != "") {
                        fInfo.Show();

                    }
                    //tip.ShowToolTip();
                }

            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Line") {
                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");
                if (IsLead != "") {
                    Line line = (Line)e.SvgElement;
                    decimal temp1 = TLMath.getLineLength(line, 1);
                    temp1 = TLMath.getNumber(temp1, tlVectorControl1.ScaleRatio);
                    string len = temp1.ToString("#####.####");
                    LineLen = len;
                    LineInfo lineInfo = new LineInfo();
                    lineInfo.EleID = e.SvgElement.ID;
                    lineInfo.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    LineInfo _lineTemp = (LineInfo)Services.BaseService.GetObject("SelectLineInfoByEleID", lineInfo);

                    if ((len != "") && (_lineTemp != null)) {
                        if (Convert.ToDecimal(len) >= 1) {
                            fInfo.Info = "线路名称:" + _lineTemp.LineName + " 线路长度:" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.Voltage + "kV 投产年限:" + _lineTemp.ObligateField3;
                        } else {
                            fInfo.Info = "线路名称:" + _lineTemp.LineName + " 线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.Voltage + "kV 投产年限:" + _lineTemp.ObligateField3;
                        }
                    } else if (len != "") {
                        if (Convert.ToDecimal(len) >= 1) {
                            fInfo.Info = "线路名称:" + " " + "线路长度:" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        } else {
                            fInfo.Info = "线路名称:" + " " + "线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 7;
                    fInfo.Height = 50;
                    if (len != "") {
                        fInfo.Show();

                    }

                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polyline") {
                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");
                if (IsLead != "") {
                    Polyline polyline = (Polyline)e.SvgElement;
                    decimal temp1 = TLMath.getPolylineLength(polyline, 1);
                    temp1 = TLMath.getNumber(temp1, tlVectorControl1.ScaleRatio);
                    string len = temp1.ToString("#####.####");
                    LineLen = len;
                    LineInfo lineInfo = new LineInfo();
                    lineInfo.EleID = e.SvgElement.ID;
                    lineInfo.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    LineInfo _lineTemp = (LineInfo)Services.BaseService.GetObject("SelectLineInfoByEleID", lineInfo);

                    if ((len != "") && (_lineTemp != null)) {
                        if (Convert.ToDecimal(len) >= 1) {
                            fInfo.Info = "线路名称:" + _lineTemp.LineName + " 线路长度:" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.Voltage + "kV 投产年限:" + _lineTemp.ObligateField3;
                        } else {
                            fInfo.Info = "线路名称:" + _lineTemp.LineName + " 线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.Voltage + "kV 投产年限:" + _lineTemp.ObligateField3;
                        }
                    } else if (len != "") {
                        if (Convert.ToDecimal(len) >= 1) {
                            fInfo.Info = "线路名称:" + " " + "线路长度:" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        } else {
                            fInfo.Info = "线路名称:" + " " + "线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 7;
                    fInfo.Height = 50;
                    //fInfo.Right = fInfo.Left+fInfo.Info.Length*10;
                    if (len != "") {
                        fInfo.Show();
                    }
                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Use") {
                string aaa = ((Use)e.SvgElement).RefElement.ID;
                //if (!aaa.Contains("Substation"))
                //{
                //    return;
                //}

                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");

                if (aaa.Contains("Substation")) {
                    substation sub = new substation();
                    sub.EleID = e.SvgElement.ID;
                    sub.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    substation _subTemp = (substation)Services.BaseService.GetObject("SelectsubstationByEleID", sub);
                    if (_subTemp != null) {
                        fInfo.Info = "变电站名称:" + _subTemp.EleName + " 容量:" + _subTemp.Number + "MVA\r\n" + " 电压等级:" + _subTemp.ObligateField1 + "kV 最大负荷:" + _subTemp.Burthen + "MW \r\n 负荷率:" + _subTemp.ObligateField2 + " 投产年限:" + _subTemp.ObligateField5;
                    } else {
                        fInfo.Info = "变电站名称:" + " " + " 容量:0" + "MVA" + "\r\n 电压等级: 最大负荷: \r\n 负荷率: 投产年限:";
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 5;
                    fInfo.Height = 60;
                    fInfo.Show();
                }
                if (aaa.Contains("kbs") || aaa.Contains("fjx") || aaa.Contains("byq")) {
                    string s_name = "";
                    if (aaa.Contains("kbs")) {
                        s_name = "开闭所";
                    }
                    if (aaa.Contains("fjx")) {
                        s_name = "分接箱";
                    }
                    if (aaa.Contains("byq")) {
                        s_name = "变压器";
                    }
                    PSP_Gra_item sub = new PSP_Gra_item();
                    sub.EleID = e.SvgElement.ID;
                    sub.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    sub.LayerID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                    PSP_Gra_item _subTemp = (PSP_Gra_item)Services.BaseService.GetObject("SelectPSP_Gra_itemByEleIDKey", sub);
                    if (_subTemp != null) {
                        fInfo.Info = s_name + "编号:" + _subTemp.EleKeyID + "\r\n 名称:" + _subTemp.EleName;
                    } else {
                        fInfo.Info = s_name + "编号:   \r\n 名称: ";
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 8;
                    fInfo.Height = 60;
                    fInfo.Show();
                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.ConnectLine") {
                ConnectLine cline = (ConnectLine)tlVectorControl1.SVGDocument.CurrentElement;
                if (cline.StartGraph != null) {
                    string code = ((XmlElement)cline.StartGraph).GetAttribute("devxldm");

                    if (code != "") {
                        xltProcessor.SelectLine(code);
                        tlVectorControl1.CurrentOperation = ToolOperation.Select;
                    }
                }
            }
            /*  if (tlVectorControl1.Operation == ToolOperation.LeadLine)
              {
                  string gt = sgt1.Text;
                  XmlElement u1 = tlVectorControl1.SVGDocument.CreateElement("use") as Use;
                  Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                  u1.SetAttribute("xlink:href", "#" + gt + "0");
                  u1.SetAttribute("x", point1.X.ToString());
                  u1.SetAttribute("y", point1.Y.ToString());
                  u1.SetAttribute("layer", SvgDocument.currentLayer);
                  u1.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                  tlVectorControl1.SVGDocument.RootElement.AppendChild(u1);
              }*/
            //tlVectorControl1.SVGDocument.CurrentElement = null;
        }
Esempio n. 2
0
        void tlVectorControl1_LeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e)
        {
            //SvgElement ele2 = tlVectorControl1.CreateBySymbolID("kbs-8", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
            //ele2 = tlVectorControl1.AddShape(ele2, Point.Empty);
            if (tlVectorControl1.SVGDocument.CurrentElement != null &&
                tlVectorControl1.SVGDocument.CurrentElement.GetAttribute("xlink:href").Contains("XL_GT_1"))
            {
                sel_start_point = tlVectorControl1.SVGDocument.CurrentElement.ID;
            }

            if (sel_sym == "bt_start")
            {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_1", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele = tlVectorControl1.AddShape(ele, Point.Empty);
                ele.SetAttribute("order", "0");
                ele.SetAttribute("start_point", ele.ID);
            }
            if (sel_sym == "bt_end")
            {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_2", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele.SetAttribute("start_point", sel_start_point);
                ele.SetAttribute("order", "999");
                tlVectorControl1.AddShape(ele, Point.Empty);
            }
            if (sel_sym == "bt_must")
            {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_3", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele.SetAttribute("start_point", sel_start_point);
                tlVectorControl1.AddShape(ele, Point.Empty);
                frmInputNum num = new frmInputNum();
                num.ShowDialog();
                ele.SetAttribute("order", num.InputStrSEL);
            }
            if (sel_sym == "bt_point")
            {
                SvgElement ele = tlVectorControl1.CreateBySymbolID("XL_GT_4", (tlVectorControl1.DrawArea.PointToView(e.Mouse.Location)));
                ele.SetAttribute("start_point", sel_start_point);
                tlVectorControl1.AddShape(ele, Point.Empty);
                frmInputNum num = new frmInputNum();
                num.ShowDialog();
                ele.SetAttribute("order", num.InputStrSEL);
            }
            //if (sel_sym != "" && sel_start_point!="")
            //{
            //    XmlNodeList il= tlVectorControl1.SVGDocument.SelectNodes("svg/use [@start_point='" + sel_start_point + "']");
            //    if (il.Count < 3)
            //    {
            //        return;
            //    }
            //    for (int i = 0; i < il.Count;i++ )
            //    {
            //        Use u = (Use)il[i];
            //        PointF f = u.CenterPoint;

            //    }
            //    //PointF[] pnt = ((Polyline)(tlVectorControl1.SVGDocument.CurrentElement)).Points;
            //    //if (pnt.Length < 3) return;
            //    for (int i = 0; i < il.Count; i++)
            //    {
            //        double ang = TLMath.getLineAngle(((Use)il[i]).CenterPoint, ((Use)il[i + 1]).CenterPoint, ((Use)il[i + 2]).CenterPoint);
            //        if (ang * 57.3 > 60)
            //        {
            //            MessageBox.Show("线路转角不能大于60度。\r\n "+"第" + (i + 1) + "转角:" + Convert.ToDouble(ang * 57.3).ToString("##.##") + "度。\r\n", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //           // tlVectorControl1.Delete();
            //            return;
            //        }

            //        if (i == il.Count - 3)
            //        {
            //            break;
            //        }
            //    }
            //}
            if (csOperation == CustomOperation.OP_MeasureDistance)
            {
                Polyline pl = tlVectorControl1.SVGDocument.CurrentElement as Polyline;
                if (pl.Points.Length > 1)
                {
                    double d = 0;
                    for (int i = 1; i < pl.Points.Length; i++)
                    {
                        d += this.mapview.CountLength(pl.Points[i - 1], pl.Points[i]);
                    }
                    label1.Text = Math.Round(d, 3) + "公里";

                    Point pt = new Point(e.Mouse.X, e.Mouse.Y);
                    pt = PointToClient(tlVectorControl1.PointToScreen(pt));
                    //tlVectorControl1.SetToolTip(label1.Text);
                    label1.Left = pt.X;
                    label1.Top = pt.Y;

                    label1.Visible = true;
                }
                return;
            }

            tip.Hide();
            fInfo.Hide();

            if (tlVectorControl1.Operation == ToolOperation.Text)
            {
                frmTextInput ft = new frmTextInput();
                if (ft.ShowDialog() == DialogResult.OK)
                {
                    string txt = ft.Content;
                    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                    Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("x", point1.X.ToString());
                    n1.SetAttribute("y", point1.Y.ToString());
                    n1.InnerText = txt;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
            }
            if (MapType == "规划统计")
            {
                try
                {
                    if (e.SvgElement.ID == "svg")
                    {
                        MapType = "接线图";
                        return;
                    }
                    if (((Polygon)e.SvgElement) == null) return;
                    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("circle") as Circle;
                    Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("cx", point1.X.ToString());
                    n1.SetAttribute("cy", point1.Y.ToString());
                    n1.SetAttribute("r", "42.5");
                    n1.SetAttribute("r", "42.5");
                    //n1.SetAttribute("layer", getlayer("供电区域层", tlVectorControl1.SVGDocument.getLayerList()).ID);
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("style", "fill:#FFFFC0;fill-opacity:0.5;stroke:#000000;stroke-opacity:1;");
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);

                    frmMainProperty fmain = new frmMainProperty();
                    glebeProperty gp = new glebeProperty();
                    gp.EleID = ((XmlElement)e.SvgElement).GetAttribute("id");
                    gp.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    //fmain.InitData(gp); ///////////////////////////////////

                    XmlNodeList nlist = tlVectorControl1.SVGDocument.GetElementsByTagName("use");

                    PointF[] tfArray1 = TLMath.getPolygonPoints((XmlElement)e.SvgElement);
                    string str220 = "";
                    string str110 = "";
                    string str66 = "";
                    GraphicsPath selectAreaPath = new GraphicsPath();
                    selectAreaPath.AddLines(tfArray1);
                    selectAreaPath.CloseFigure();
                    //Matrix x=new Matrix(
                    //Region region1 = new Region(selectAreaPath);
                    for (int i = 0; i < nlist.Count; i++)
                    {
                        float OffX = 0f;
                        float OffY = 0f;
                        Use use = (Use)nlist[i];
                        if (use.GetAttribute("xlink:href").Contains("Substation"))
                        {
                            string strMatrix = use.GetAttribute("transform");
                            if (strMatrix != "")
                            {
                                strMatrix = strMatrix.Replace("matrix(", "");
                                strMatrix = strMatrix.Replace(")", "");
                                string[] mat = strMatrix.Split(',');
                                if (mat.Length > 5)
                                {
                                    OffX = Convert.ToSingle(mat[4]);
                                    OffY = Convert.ToSingle(mat[5]);
                                }
                            }
                            PointF TempPoint = TLMath.getUseOffset(use.GetAttribute("xlink:href"));
                            if (selectAreaPath.IsVisible(use.X + TempPoint.X + OffX, use.Y + TempPoint.Y + OffY))
                            {
                                if (use.GetAttribute("xlink:href").Contains("220"))
                                {
                                    str220 = str220 + "'" + use.GetAttribute("id") + "',";
                                }
                                if (use.GetAttribute("xlink:href").Contains("110"))
                                {
                                    str110 = str110 + "'" + use.GetAttribute("id") + "',";
                                }
                                if (use.GetAttribute("xlink:href").Contains("66"))
                                {
                                    str66 = str66 + "'" + use.GetAttribute("id") + "',";
                                }
                            }
                        }
                    }
                    if (str220.Length > 1)
                    {
                        str220 = str220.Substring(0, str220.Length - 1);
                    }
                    if (str110.Length > 1)
                    {
                        str110 = str110.Substring(0, str110.Length - 1);
                    }
                    if (str66.Length > 1)
                    {
                        str66 = str66.Substring(0, str66.Length - 1);
                    }
                    fmain.InitData(gp, str220, str110, str66);

                    XmlElement t1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                    Point point2 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    t1.SetAttribute("x", Convert.ToString(point2.X - 20));
                    t1.SetAttribute("y", Convert.ToString(point2.Y - 10));
                    // t1.SetAttribute("layer", getlayer("供电区域层", tlVectorControl1.SVGDocument.getLayerList()).ID);
                    t1.SetAttribute("layer", SvgDocument.currentLayer);
                    t1.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                    t1.SetAttribute("font-famliy", "宋体");
                    t1.SetAttribute("font-size", "14");
                    t1.InnerText = fmain.glebeProp.Area + "\r\n" + fmain.glebeProp.Burthen; //+"\r\n" + fmain.glebeProp.Number;
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(t1);
                    tlVectorControl1.Refresh();
                    fmain.Dispose();
                    MapType = "接线图";
                }
                catch (Exception e2) { MapType = "接线图"; }
            }
            if (tlVectorControl1.SVGDocument.SelectCollection.Count > 1)
            {
                return;
            }
            decimal ViewScale = 1;
            string str_Scale = tlVectorControl1.SVGDocument.getViewScale();
            if (str_Scale != "")
            {
                ViewScale = Convert.ToDecimal(str_Scale);
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Text")
            {
                string showlineflag = ((XmlElement)e.SvgElement).GetAttribute("Showline");
                if (showlineflag == "1")
                {
                    XmlElement n1 = (XmlElement)e.SvgElement;
                    string suid = n1.GetAttribute("ParentID");
                    PSPDEV psp = new PSPDEV();
                    psp.SUID = suid;
                    psp = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", psp);
                    if (psp != null)
                    {
                        fInfo.Info = "线路名称:" + psp.Name;
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 20;
                    fInfo.Show();

                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polygon")
            {
                string IsArea = ((XmlElement)e.SvgElement).GetAttribute("IsArea");
                if (IsArea != "")
                {
                    SelUseArea = "";
                    //XmlElement n1 = (XmlElement)e.SvgElement;
                    PointF[] pnts = ((Polygon)e.SvgElement).Points.Clone() as PointF[];
                    ((Polygon)e.SvgElement).Transform.Matrix.TransformPoints(pnts);
                    decimal temp1 = TLMath.getPolygonArea(pnts, 1);

                    temp1 = TLMath.getNumber2(temp1, tlVectorControl1.ScaleRatio) / Convert.ToDecimal(areaoption);
                    SelUseArea = temp1.ToString("#####.####");
                    //tip.Text = "区域面积:" + SelUseArea;
                    if (SelUseArea != "")
                    {
                        if (Convert.ToDecimal(SelUseArea) >= 1)
                        {
                            fInfo.Info = "区域面积:" + SelUseArea + "(KM²)";
                        }
                        else
                        {
                            fInfo.Info = "区域面积: 0" + SelUseArea + "(KM²)";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 12;
                    if (SelUseArea != "")
                    {
                        fInfo.Show();

                    }
                    //tip.ShowToolTip();
                }

            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Line")
            {
                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");
                if (IsLead != "")
                {
                    Line line = (Line)e.SvgElement;
                    decimal temp1 = TLMath.getLineLength(line, 1);
                    temp1 = TLMath.getNumber(temp1, tlVectorControl1.ScaleRatio);
                    string len = temp1.ToString("#####.####");
                    LineLen = len;
                    LineInfo lineInfo = new LineInfo();
                    lineInfo.EleID = e.SvgElement.ID;
                    lineInfo.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    LineInfo _lineTemp = (LineInfo)Services.BaseService.GetObject("SelectLineInfoByEleID", lineInfo);

                    if ((len != "") && (_lineTemp != null))
                    {
                        if (Convert.ToDecimal(len) >= 1)
                        {
                            fInfo.Info = "线路名称:" + _lineTemp.LineName + " 线路长度:" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.Voltage + "kV 投产年限:" + _lineTemp.ObligateField3;
                        }
                        else
                        {
                            fInfo.Info = "线路名称:" + _lineTemp.LineName + " 线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.Voltage + "kV 投产年限:" + _lineTemp.ObligateField3;
                        }
                    }
                    else if (len != "")
                    {
                        if (Convert.ToDecimal(len) >= 1)
                        {
                            fInfo.Info = "线路名称:" + " " + "线路长度:" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        }
                        else
                        {
                            fInfo.Info = "线路名称:" + " " + "线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 7;
                    fInfo.Height = 50;
                    if (len != "")
                    {
                        fInfo.Show();

                    }

                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polyline" && str_outjwd == "1")
            {
                PointF[] pf = ((Polyline)e.SvgElement).Points;
                ((Polyline)e.SvgElement).Transform.Matrix.TransformPoints(pf);

                string strM = "";
                for (int i = 0; i < pf.Length; i++)
                {
                    strM = strM + getJWD(mapview.ParseToLongLat(pf[i].X, pf[i].Y));
                }
                System.IO.FileInfo ff = new System.IO.FileInfo("c:\\temp.txt");
                System.IO.StreamWriter wt = ff.CreateText();
                wt.Write(strM);
                wt.Close();
                System.Diagnostics.Process.Start("c:\\temp.txt");
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polyline" && str_djcl == "1")
            {
                Layer lar = null;
                Layer lar2 = null;
                bool create = true;
                int TempObjRadius = Convert.ToInt32(ConfigurationSettings.AppSettings.Get("TempObjRadius"));
                int TempTextSize = Convert.ToInt32(ConfigurationSettings.AppSettings.Get("TempTextSize"));

                for (int n = 0; n < tlVectorControl1.SVGDocument.Layers.Count; n++)
                {
                    Layer l = tlVectorControl1.SVGDocument.Layers[n] as Layer;
                    if (l.Label == "临时显示层-杆塔号")
                    {
                        lar = l;
                    }
                    if (l.Label == "临时显示层-公里数")
                    {
                        lar2 = l;
                    }
                }
                if (!Layer.CkLayerExist("临时显示层-杆塔号", tlVectorControl1.SVGDocument))
                {
                    lar = Layer.CreateNew("临时显示层-杆塔号", tlVectorControl1.SVGDocument);
                    lar.SetAttribute("layerType", progtype);
                    lar.SetAttribute("ParentID", tlVectorControl1.SVGDocument.CurrentLayer.GetAttribute("ParentID"));
                    this.frmlar.checkedListBox1.SelectedIndex = -1;
                    this.frmlar.checkedListBox1.Items.Add(lar, true);
                    lar2 = Layer.CreateNew("临时显示层-公里数", tlVectorControl1.SVGDocument);
                    lar2.SetAttribute("layerType", progtype);
                    lar2.SetAttribute("ParentID", tlVectorControl1.SVGDocument.CurrentLayer.GetAttribute("ParentID"));
                    this.frmlar.checkedListBox1.SelectedIndex = -1;
                    this.frmlar.checkedListBox1.Items.Add(lar2, true);
                }
                string gt = ((XmlElement)e.SvgElement).GetAttribute("gt-info");
                string _gtxh = ((XmlElement)e.SvgElement).GetAttribute("gtxh-info");

                string[] gtid = gt.Split(",".ToCharArray());
                string[] strgtxh = _gtxh.Split(",".ToCharArray());

                XmlNodeList useList = tlVectorControl1.SVGDocument.SelectNodes("//* [@layer='" + lar.ID + "'] [@parentobj='" + ((Polyline)e.SvgElement).ID + "']");

                for (int kk = 0; kk < useList.Count; kk++)
                {
                    tlVectorControl1.SVGDocument.RootElement.RemoveChild(useList[kk]);
                }

                PointF[] pf = ((Polyline)e.SvgElement).Points;
                ((Polyline)e.SvgElement).Transform.Matrix.TransformPoints(pf);
                if (create)
                {
                    for (int i = 0; i < pf.Length; i++)
                    {

                        if (_gtxh == "")
                        {
                            XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("circle") as Circle;
                            n1.SetAttribute("cx", Convert.ToString(pf[i].X));
                            n1.SetAttribute("cy", Convert.ToString(pf[i].Y));
                            n1.SetAttribute("r", TempObjRadius.ToString());
                            n1.SetAttribute("layer", lar.ID);
                            n1.SetAttribute("parentobj", ((Polyline)e.SvgElement).ID);
                            n1.SetAttribute("style", "fill:#FFFFC0;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                            tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                        }
                        else
                        {
                            if (strgtxh.Length > i)
                            {
                                if (strgtxh[i] == "0")
                                {
                                    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("circle") as Circle;
                                    n1.SetAttribute("cx", Convert.ToString(pf[i].X));
                                    n1.SetAttribute("cy", Convert.ToString(pf[i].Y));
                                    n1.SetAttribute("r", TempObjRadius.ToString());
                                    n1.SetAttribute("layer", lar.ID);
                                    n1.SetAttribute("parentobj", ((Polyline)e.SvgElement).ID);
                                    n1.SetAttribute("style", "fill:#FFFFC0;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                                }
                                else
                                {
                                    XmlElement tk = tlVectorControl1.SVGDocument.CreateElement("rect") as RectangleElement;
                                    tk.SetAttribute("x", Convert.ToString(pf[i].X - 10));
                                    tk.SetAttribute("y", Convert.ToString(pf[i].Y - 10));
                                    tk.SetAttribute("width", Convert.ToString(TempObjRadius * 2));
                                    tk.SetAttribute("height", Convert.ToString(TempObjRadius * 2));
                                    tk.SetAttribute("parentobj", ((Polyline)e.SvgElement).ID);
                                    tk.SetAttribute("style", "fill:#FFFFC0;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                                    tk.SetAttribute("layer", lar.ID);
                                    tlVectorControl1.SVGDocument.RootElement.AppendChild(tk);
                                }
                            }
                        }
                        XmlElement t0 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                        t0.SetAttribute("x", Convert.ToString(pf[i].X));
                        t0.SetAttribute("y", Convert.ToString(pf[i].Y));
                        t0.SetAttribute("layer", lar.ID);
                        t0.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                        t0.SetAttribute("font-famliy", "宋体");
                        t0.SetAttribute("parentobj", ((Polyline)e.SvgElement).ID);
                        t0.SetAttribute("font-size", TempTextSize.ToString());

                        if (gtid.Length > i)
                        {
                            t0.InnerText = gtid[i] + "号";
                        }
                        else
                        {
                            t0.InnerText = Convert.ToString(i + 1) + "号";
                        }
                        tlVectorControl1.SVGDocument.RootElement.AppendChild(t0);
                    }
                    for (int i = 0; i < pf.Length - 1; i++)
                    {
                        double s = this.mapview.CountLength(pf[i], pf[i + 1]);
                        //   TLMath.getLength(pf[i], pf[i + 1], (decimal)tlVectorControl1.ScaleRatio);
                        XmlElement t0 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                        t0.SetAttribute("x", Convert.ToString((pf[i].X + pf[i + 1].X) / 2));
                        t0.SetAttribute("y", Convert.ToString((pf[i].Y + pf[i + 1].Y) / 2));
                        t0.SetAttribute("layer", lar2.ID);
                        t0.SetAttribute("parentobj", ((Polyline)e.SvgElement).ID);
                        t0.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                        t0.SetAttribute("font-famliy", "宋体");
                        t0.SetAttribute("font-size", TempTextSize.ToString());
                        t0.InnerText = s.ToString("0.##") + "km";
                        tlVectorControl1.SVGDocument.RootElement.AppendChild(t0);
                    }
                }
                str_djcl = "";
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polyline")
            {
                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");
                if (IsLead != "")
                {
                    Polyline polyline = (Polyline)e.SvgElement;
                    double temp1 = 0;
                    for (int i = 1; i < polyline.Points.Length; i++)
                    {
                        temp1 += this.mapview.CountLength(polyline.Points[i - 1], polyline.Points[i]);
                    }

                    //decimal temp1 = TLMath.getPolylineLength(polyline, 1);
                    //temp1 = TLMath.getNumber(temp1, tlVectorControl1.ScaleRatio);
                    string len = temp1.ToString("#####.####");
                    LineLen = len;
                    PSPDEV lineInfo = new PSPDEV();
                    lineInfo.SUID = ((XmlElement)e.SvgElement).GetAttribute("Deviceid");
                    // lineInfo.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    PSPDEV _lineTemp = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", lineInfo);

                    if ((len != "") && (_lineTemp != null))
                    {
                        if (Convert.ToDecimal(len) >= 1)
                        {
                            fInfo.Info = "线路名称:" + _lineTemp.Name + " 线路长度:" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.RateVolt.ToString() + "kV 投产年限:" + _lineTemp.OperationYear;
                        }
                        else
                        {
                            fInfo.Info = "线路名称:" + _lineTemp.Name + " 线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + _lineTemp.LineType + " 电压等级:" + _lineTemp.RateVolt.ToString() + "kV 投产年限:" + _lineTemp.OperationYear;
                        }
                    }
                    else if (len != "")
                    {
                        if (Convert.ToDecimal(len) >= 1)
                        {
                            fInfo.Info = "线路名称:" + " " + "线路长度:" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        }
                        else
                        {
                            fInfo.Info = "线路名称:" + " " + "线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + " " + " 投产年限:" + " ";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 7;
                    fInfo.Height = 50;
                    //fInfo.Right = fInfo.Left+fInfo.Info.Length*10;
                    if (len != "")
                    {
                        fInfo.Show();
                    }
                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Use")
            {
                string aaa = ((Use)e.SvgElement).RefElement.ID;
                //if (!aaa.Contains("Substation"))
                //{
                //    return;
                //}

                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");

                if (aaa.Contains("Substation"))
                {
                    PSP_Substation_Info sub = new PSP_Substation_Info();

                    string deviceid = ((XmlElement)e.SvgElement).GetAttribute("Deviceid");
                    //sub.AreaID = tlVectorControl1.SVGDocument.SvgdataUid;
                    PSP_Substation_Info _subTemp = DeviceHelper.GetDevice<PSP_Substation_Info>(deviceid);
                    // PSP_Substation_Info _subTemp = (PSP_Substation_Info)Services.BaseService.GetObject("SelectPSP_Substation_InfoListByEleID", sub);
                    if (_subTemp != null)
                    {
                        fInfo.Info = "变电站名称:" + _subTemp.Title + " 容量:" + _subTemp.L2.ToString("##.##") + "MVA\r\n" + " 电压等级:" + _subTemp.L1.ToString("##.##") + "kV 最大负荷:" + _subTemp.L9.ToString("##.##") + "MW \r\n 投产年限:" + _subTemp.S2;
                    }
                    else
                    {
                        fInfo.Info = "变电站名称:" + " " + " 容量:0" + "MVA" + "\r\n 电压等级: 最大负荷: \r\n 负荷率: 投产年限:";
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 5;
                    fInfo.Height = 60;
                    fInfo.Show();
                }
                if (aaa.Contains("kbs") || aaa.Contains("fjx") || aaa.Contains("pds") || aaa.Contains("byq") || aaa.Contains("hwg") || aaa.Contains("kg"))
                {
                    string deviceid = ((XmlElement)e.SvgElement).GetAttribute("Deviceid");
                    string s_name = "";
                    if (aaa.Contains("kbs"))
                    {
                        s_name = "开闭所";
                    }
                    if (aaa.Contains("fjx"))
                    {
                        s_name = "分接箱";
                    }
                    if (aaa.Contains("byq"))
                    {
                        s_name = "变压器";
                    }
                    if (aaa.Contains("hwg"))
                    {
                        s_name = "环网柜";
                    }
                    if (aaa.Contains("kg"))
                    {
                        s_name = "柱上开关";
                    }
                    if (aaa.Contains("pds"))
                    {
                        s_name = "配电室";
                    }
                    PSPDEV _subTemp = new PSPDEV();
                    _subTemp.SUID = deviceid;
                    _subTemp = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVByKey", _subTemp);
                    //PSP_Gra_item sub = new PSP_Gra_item();
                    //sub.EleID = e.SvgElement.ID;
                    //sub.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid;
                    //sub.LayerID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                    //PSP_Gra_item _subTemp = (PSP_Gra_item)Services.BaseService.GetObject("SelectPSP_Gra_itemByEleIDKey", sub);
                    if (_subTemp != null)
                    {
                        fInfo.Info = s_name + " 编号:" + _subTemp.EleID + " 名称:" + _subTemp.Name + " 电压等级:" + _subTemp.RateVolt + "kV";
                    }
                    else
                    {
                        fInfo.Info = s_name; // +"编号:   \r\n 名称: ";
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    fInfo.Width = (fInfo.Info.Length) * 15;
                    fInfo.Height = 60;
                    fInfo.Show();
                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.ConnectLine")
            {
                ConnectLine cline = (ConnectLine)tlVectorControl1.SVGDocument.CurrentElement;
                if (cline.StartGraph != null)
                {
                    string code = ((XmlElement)cline.StartGraph).GetAttribute("devxldm");

                    if (code != "")
                    {
                        xltProcessor.SelectLine(code);
                        tlVectorControl1.CurrentOperation = ToolOperation.Select;
                    }
                }
            }
            /*  if (tlVectorControl1.Operation == ToolOperation.LeadLine)
              {
                  string gt = sgt1.Text;
                  XmlElement u1 = tlVectorControl1.SVGDocument.CreateElement("use") as Use;
                  Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                  u1.SetAttribute("xlink:href", "#" + gt + "0");
                  u1.SetAttribute("x", point1.X.ToString());
                  u1.SetAttribute("y", point1.Y.ToString());
                  u1.SetAttribute("layer", SvgDocument.currentLayer);
                  u1.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                  tlVectorControl1.SVGDocument.RootElement.AppendChild(u1);
              }*/
            //tlVectorControl1.SVGDocument.CurrentElement = null;
        }
Esempio n. 3
0
        void tlVectorControl1_LeftClick(object sender, SvgElementSelectedEventArgs e)
        {
            if (tlVectorControl1.Operation == ToolOperation.Text)
            {
                frmTextInput ft = new frmTextInput();
                if (ft.ShowDialog() == DialogResult.OK)
                {
                    string txt = ft.Content;
                    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                    System.Drawing.Point point1 = tlVectorControl1.PointToView(new System.Drawing.Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("x", point1.X.ToString());
                    n1.SetAttribute("y", point1.Y.ToString());
                    n1.InnerText = txt;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl1.Operation = ToolOperation.Select;
                }
            }
            else if (tlVectorControl1.Operation == ToolOperation.Symbol)
            {
                XmlElement temp = e.SvgElement as XmlElement;

                if (temp is Use && (temp.GetAttribute("xlink:href").Contains("Substation") || temp.GetAttribute("xlink:href").Contains("Power") || temp.GetAttribute("xlink:href").Contains("motherlinenode")))
                {
                    PSPDEV pspDev23 = new PSPDEV();
                    //pspDev.EleID = element.GetAttribute("id");
                    pspDev23.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                    if (temp.GetAttribute("xlink:href").Contains("Substation"))
                    {
                        pspDev23.Lable = "变电站";
                    }
                    else if (temp.GetAttribute("xlink:href").Contains("motherlinenode"))
                    {
                        pspDev23.Lable = "母线节点";
                    }
                    else if (temp.GetAttribute("xlink:href").Contains("Power"))
                    {
                        pspDev23.Lable = "电厂";
                    }
                    frmSubstation dlg = new frmSubstation(pspDev23);
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {

                        //XmlElement temp = tlVectorControl1.SVGDocument.CurrentElement;
                        if (temp != null)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlg.Name;
                            pspName.Type = "Use";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }
                            if (true)
                            {

                                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                                if (temp is Polyline)
                                {
                                    double x1 = Convert.ToDouble(temp.GetAttribute("x1"));
                                    double y1 = Convert.ToDouble(temp.GetAttribute("y1"));
                                    double x2 = Convert.ToDouble(temp.GetAttribute("x2"));
                                    double y2 = Convert.ToDouble(temp.GetAttribute("y2"));

                                    tlVectorControl1.ChangeLevel(LevelType.Bottom);
                                    n1.SetAttribute("x", Convert.ToString(x1 + (x2 - x1) / 2));
                                    n1.SetAttribute("y", Convert.ToString(y1 + (y2 - y1) / 2));

                                }
                                else
                                {
                                    n1.SetAttribute("x", temp.GetAttribute("x"));
                                    n1.SetAttribute("y", temp.GetAttribute("y"));
                                    RectangleF t = ((IGraph)temp).GetBounds();
                                    n1.SetAttribute("x", t.X.ToString());
                                    n1.SetAttribute("y", t.Y.ToString());
                                }

                                n1.InnerText = dlg.Name;
                                n1.SetAttribute("layer", SvgDocument.currentLayer);
                                n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                                tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                                tlVectorControl1.Operation = ToolOperation.Select;
                            }
                            else
                            {
                                XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                                if (temp is Polyline)
                                {
                                    double x1 = Convert.ToDouble(temp.GetAttribute("x1"));
                                    double y1 = Convert.ToDouble(temp.GetAttribute("y1"));
                                    double x2 = Convert.ToDouble(temp.GetAttribute("x2"));
                                    double y2 = Convert.ToDouble(temp.GetAttribute("y2"));

                                    tlVectorControl1.ChangeLevel(LevelType.Bottom);
                                    n1.SetAttribute("x", Convert.ToString(x1 + (x2 - x1) / 2));
                                    n1.SetAttribute("y", Convert.ToString(y1 + (y2 - y1) / 2));
                                }
                                else
                                {
                                    RectangleF t = ((IGraph)temp).GetBounds();
                                    n1.SetAttribute("x", (t.X - 8).ToString());
                                    n1.SetAttribute("y", (t.Y - 8).ToString());
                                }

                                n1.InnerText = dlg.Name;
                                n1.SetAttribute("layer", SvgDocument.currentLayer);
                                n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                                tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                                tlVectorControl1.Operation = ToolOperation.Select;

                            }
                            PSPDEV pspDev = new PSPDEV();
                            if (temp is Use)
                            {
                                RectangleF t = ((IGraph)temp).GetBounds();
                                pspDev.SUID = Guid.NewGuid().ToString();
                                pspDev.EleID = temp.GetAttribute("id");
                                pspDev.Name = dlg.Name;
                                pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                pspDev.X1 = t.X;
                                pspDev.Y1 = t.Y;
                                pspDev.Number = -1;
                                pspDev.FirstNode = -1;
                                pspDev.LastNode = -1;
                                pspDev.Type = "Use";
                                if (temp.GetAttribute("xlink:href").Contains("Substation"))
                                {
                                    pspDev.Lable = "变电站";
                                }
                                else if (temp.GetAttribute("xlink:href").Contains("motherlinenode"))
                                {
                                    pspDev.Lable = "母线节点";
                                }
                                else if (temp.GetAttribute("xlink:href").Contains("Power"))
                                {
                                    pspDev.Lable = "电厂";
                                }
                                if (dlg.VoltR != "")
                                    pspDev.VoltR = Convert.ToDouble(dlg.VoltR);
                                if (dlg.Burthen != "")
                                    pspDev.Burthen = Convert.ToDecimal(dlg.Burthen);

                                //if (dlg.InPutP!="")
                                //    pspDev.InPutP = Convert.ToDouble(dlg.InPutP);
                                //if (dlg.InPutQ!="")
                                //    pspDev.InPutQ = Convert.ToDouble(dlg.InPutQ);
                                if (dlg.InPutP != "")
                                    pspDev.InPutP = Convert.ToDouble(dlg.InPutP);
                                if (dlg.InPutQ != "")
                                    pspDev.InPutQ = Convert.ToDouble(dlg.InPutQ);
                                if (dlg.OutP != "")
                                    pspDev.OutP = Convert.ToDouble(dlg.OutP);
                                if (dlg.OutQ != "")
                                    pspDev.OutQ = Convert.ToDouble(dlg.OutQ);
                                if (dlg.NodeType == "是")
                                {
                                    pspDev.NodeType = "0";
                                }
                                else
                                {
                                    pspDev.NodeType = "1";
                                }
                                Services.BaseService.Create<PSPDEV>(pspDev);
                            }
                            else if (temp is Polyline)
                            {
                                pspDev.SUID = Guid.NewGuid().ToString();
                                pspDev.EleID = temp.GetAttribute("id");
                                pspDev.Name = dlg.Name;
                                pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                pspDev.X1 = Convert.ToDouble(temp.GetAttribute("x1"));
                                pspDev.Y1 = Convert.ToDouble(temp.GetAttribute("y1"));
                                pspDev.X2 = Convert.ToDouble(temp.GetAttribute("x2"));
                                pspDev.Y2 = Convert.ToDouble(temp.GetAttribute("y2"));
                                pspDev.Number = -1;
                                pspDev.FirstNode = -1;
                                pspDev.LastNode = -1;
                                pspDev.Type = "Polyline";
                                Services.BaseService.Create<PSPDEV>(pspDev);
                            }
                        }

                    }
                    else
                    {
                        tlVectorControl1.Delete();
                    }
                }
                else
                {
                    if (temp is Use && (temp.GetAttribute("xlink:href").Contains("dynamotorline")))//接地支路
                    {
                        frmFadejie dlg = new frmFadejie(tlVectorControl1.SVGDocument.CurrentLayer.ID);
                        dlg.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {

                            //XmlElement temp = tlVectorControl1.SVGDocument.CurrentElement;
                            if (temp != null)
                            {
                                PSPDEV pspDev2 = new PSPDEV();
                                XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                                PSPDEV pspName = new PSPDEV();
                                pspName.Name = dlg.Name;
                                pspName.Type = "dynamotorline";
                                pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                                if (listName.Count >= 1)
                                {
                                    MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    tlVectorControl1.Delete();
                                    return;
                                }
                                if (true)
                                {
                                    tlVectorControl1.Operation = ToolOperation.Select;
                                    PSPDEV pspDev = new PSPDEV();
                                    tlVectorControl1.ChangeLevel(LevelType.Bottom);
                                    RectangleF t = ((IGraph)temp).GetBounds();
                                    pspDev.SUID = Guid.NewGuid().ToString();
                                    pspDev.EleID = temp.GetAttribute("id");
                                    pspDev.Name = dlg.Name;
                                    pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                    pspDev.X1 = t.X;
                                    pspDev.Y1 = t.Y;
                                    pspDev.Number = -1;
                                    pspDev.FirstNode = -1;
                                    pspDev.LastNode = 0;
                                    pspDev.Type = "dynamotorline";
                                    if (temp.GetAttribute("xlink:href").Contains("dynamotorline"))
                                    {
                                        pspDev.Lable = "发电厂支路";
                                    }
                                    else if (temp.GetAttribute("xlink:href").Contains("gndline"))
                                    {
                                        pspDev.Lable = "接地支路";
                                    }

                                    pspDev.HuganLine1 = dlg.FirstNodeName;
                                    pspDev.HuganLine3 = dlg.SwitchStatus;
                                    if (dlg.OutP != "")
                                        pspDev.OutP = Convert.ToDouble(dlg.OutP);
                                    if (dlg.OutQ != "")
                                        pspDev.OutQ = Convert.ToDouble(dlg.OutQ);
                                    if (dlg.VoltR != "")
                                        pspDev.VoltR = Convert.ToDouble(dlg.VoltR);
                                    if (dlg.VoltV != "")
                                        pspDev.VoltV = Convert.ToDouble(dlg.VoltV);
                                    if (dlg.PositiveTQ != "")
                                        pspDev.PositiveTQ = Convert.ToDouble(dlg.PositiveTQ);
                                    if (dlg.NegativeTQ != "")
                                        pspDev.ZeroTQ = Convert.ToDouble(dlg.NegativeTQ);
                                    Services.BaseService.Create<PSPDEV>(pspDev);
                                }
                            }
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("gndline")))//接地支路
                    {
                        frmFadejie dlg = new frmFadejie(tlVectorControl1.SVGDocument.CurrentLayer.ID);
                        dlg.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlg.ShowDialog(this) == DialogResult.OK)
                        {

                            //XmlElement temp = tlVectorControl1.SVGDocument.CurrentElement;
                            if (temp != null)
                            {
                                PSPDEV pspDev2 = new PSPDEV();
                                XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                                PSPDEV pspName = new PSPDEV();
                                pspName.Name = dlg.Name;
                                pspName.Type = "gndline";
                                pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                                if (listName.Count >= 1)
                                {
                                    MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    tlVectorControl1.Delete();
                                    return;
                                }
                                if (true)
                                {
                                    tlVectorControl1.Operation = ToolOperation.Select;
                                    PSPDEV pspDev = new PSPDEV();
                                    tlVectorControl1.ChangeLevel(LevelType.Bottom);
                                    RectangleF t = ((IGraph)temp).GetBounds();
                                    pspDev.SUID = Guid.NewGuid().ToString();
                                    pspDev.EleID = temp.GetAttribute("id");
                                    pspDev.Name = dlg.Name;
                                    pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                    pspDev.X1 = t.X;
                                    pspDev.Y1 = t.Y;
                                    pspDev.Number = -1;
                                    pspDev.FirstNode = -1;
                                    pspDev.LastNode = 0;
                                    pspDev.Type = "gndline";
                                    if (temp.GetAttribute("xlink:href").Contains("dynamotorline"))
                                    {
                                        pspDev.Lable = "发电厂支路";
                                    }
                                    else if (temp.GetAttribute("xlink:href").Contains("gndline"))
                                    {
                                        pspDev.Lable = "接地支路";
                                    }

                                    pspDev.HuganLine1 = dlg.FirstNodeName;
                                    pspDev.HuganLine3 = dlg.SwitchStatus;
                                    if (dlg.OutP != "")
                                        pspDev.OutP = Convert.ToDouble(dlg.OutP);
                                    if (dlg.OutQ != "")
                                        pspDev.OutQ = Convert.ToDouble(dlg.OutQ);
                                    if (dlg.VoltR != "")
                                        pspDev.VoltR = Convert.ToDouble(dlg.VoltR);
                                    if (dlg.VoltV != "")
                                        pspDev.VoltV = Convert.ToDouble(dlg.VoltV);
                                    if (dlg.PositiveTQ != "")
                                        pspDev.PositiveTQ = Convert.ToDouble(dlg.PositiveTQ);
                                    if (dlg.NegativeTQ != "")
                                        pspDev.ZeroTQ = Convert.ToDouble(dlg.NegativeTQ);
                                    Services.BaseService.Create<PSPDEV>(pspDev);
                                }
                            }
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("loadline")))
                    {
                        frmLoad dlgLoad = new frmLoad();
                        dlgLoad.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgLoad.ShowDialog(this) == DialogResult.OK)
                        {
                            if (temp != null)
                            {
                                PSPDEV pspDev2 = new PSPDEV();
                                XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                                PSPDEV pspName = new PSPDEV();
                                pspName.Name = dlgLoad.Name;
                                pspName.Type = "loadline";
                                pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                                if (listName.Count >= 1)
                                {
                                    MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    tlVectorControl1.Delete();
                                    return;
                                }

                                tlVectorControl1.Operation = ToolOperation.Select;
                                PSPDEV pspDev = new PSPDEV();
                                tlVectorControl1.ChangeLevel(LevelType.Bottom);
                                RectangleF t = ((IGraph)temp).GetBounds();
                                pspDev.SUID = Guid.NewGuid().ToString();
                                pspDev.EleID = temp.GetAttribute("id");
                                pspDev.Name = dlgLoad.Name;
                                pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                                pspDev.X1 = t.X;
                                pspDev.Y1 = t.Y;
                                pspDev.Number = -1;
                                pspDev.FirstNode = -1;
                                pspDev.LastNode = 0;
                                pspDev.Type = "loadline";

                                pspDev.Lable = "负荷支路";

                                pspDev.HuganLine1 = dlgLoad.FirstNodeName;
                                if (dlgLoad.InPutP != "")
                                {
                                    pspDev.InPutP = Convert.ToDouble(dlgLoad.InPutP);
                                }
                                if (dlgLoad.InPutQ != "")
                                {
                                    pspDev.InPutQ = Convert.ToDouble(dlgLoad.InPutQ);
                                }
                                if (dlgLoad.VoltR != "")
                                {
                                    pspDev.VoltR = Convert.ToDouble(dlgLoad.VoltR);
                                }

                                pspDev.HuganLine3 = dlgLoad.LoadSwitchState;

                                Services.BaseService.Create<PSPDEV>(pspDev);
                            }
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("transformertwozu")))
                    {
                        frmTwoTra dlgTra = new frmTwoTra(tlVectorControl1.SVGDocument.CurrentLayer.ID);
                        dlgTra.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgTra.ShowDialog(this) == DialogResult.OK)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlgTra.Name;
                            pspName.Type = "transformertwozu";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }

                            tlVectorControl1.Operation = ToolOperation.Select;
                            PSPDEV pspDev = new PSPDEV();
                            tlVectorControl1.ChangeLevel(LevelType.Bottom);
                            RectangleF t = ((IGraph)temp).GetBounds();
                            pspDev.SUID = Guid.NewGuid().ToString();
                            pspDev.EleID = temp.GetAttribute("id");
                            pspDev.Name = dlgTra.Name;
                            pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            pspDev.X1 = t.X;
                            pspDev.Y1 = t.Y;
                            pspDev.Number = -1;
                            pspDev.FirstNode = -1;
                            pspDev.LastNode = 0;
                            pspDev.Type = "transformertwozu";

                            pspDev.Lable = "二绕组变压器";
                            pspDev.HuganLine1 = dlgTra.FirstName;
                            pspDev.HuganLine2 = dlgTra.LastName;
                            pspDev.HuganLine3 = dlgTra.FirstSwitchState;
                            pspDev.HuganLine4 = dlgTra.LastSwitchState;
                            pspDev.LineLevel = dlgTra.FirstType;
                            pspDev.LineType = dlgTra.LastType;

                            if (dlgTra.K != "")
                            {
                                pspDev.K = Convert.ToDouble(dlgTra.K);
                            }
                            if (dlgTra.PositiveR != "")
                            {
                                pspDev.PositiveR = Convert.ToDouble(dlgTra.PositiveR);
                            }
                            if (dlgTra.PositiveTQ != "")
                            {
                                pspDev.PositiveTQ = Convert.ToDouble(dlgTra.PositiveTQ);
                            }
                            if (dlgTra.ZeroR != "")
                            {
                                pspDev.ZeroR = Convert.ToDouble(dlgTra.ZeroR);
                            }
                            if (dlgTra.ZeroTQ != "")
                            {
                                pspDev.ZeroTQ = Convert.ToDouble(dlgTra.ZeroTQ);
                            }
                            if (dlgTra.NeutralNodeTQ != "")
                            {
                                pspDev.BigTQ = Convert.ToDouble(dlgTra.NeutralNodeTQ);
                            }

                            Services.BaseService.Create<PSPDEV>(pspDev);
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("transformerthirdzu")))
                    {
                        frmThridTra dlgThridTra = new frmThridTra(tlVectorControl1.SVGDocument.CurrentLayer.ID);
                        dlgThridTra.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgThridTra.ShowDialog(this) == DialogResult.OK)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlgThridTra.Name;
                            pspName.Type = "transformerthirdzu";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }

                            tlVectorControl1.Operation = ToolOperation.Select;
                            PSPDEV pspDev = new PSPDEV();
                            tlVectorControl1.ChangeLevel(LevelType.Bottom);
                            RectangleF t = ((IGraph)temp).GetBounds();
                            pspDev.SUID = Guid.NewGuid().ToString();
                            pspDev.EleID = temp.GetAttribute("id");
                            pspDev.Name = dlgThridTra.Name;
                            pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            pspDev.X1 = t.X;
                            pspDev.Y1 = t.Y;
                            pspDev.Number = -1;
                            pspDev.FirstNode = -1;
                            pspDev.LastNode = 0;
                            pspDev.Type = "transformerthirdzu";

                            pspDev.Lable = "三绕组变压器";
                            pspDev.HuganLine1 = dlgThridTra.IName;
                            pspDev.HuganLine2 = dlgThridTra.JName;
                            pspDev.HuganLine3 = dlgThridTra.ISwitchState;
                            pspDev.HuganLine4 = dlgThridTra.JSwitchState;
                            pspDev.LineLevel = dlgThridTra.IType;
                            pspDev.LineType = dlgThridTra.JType;
                            pspDev.LineStatus = dlgThridTra.KType;
                            pspDev.KName = dlgThridTra.KName;
                            pspDev.KSwitchStatus = dlgThridTra.KSwitchState;

                            if (dlgThridTra.IK != "")
                            {
                                pspDev.K = Convert.ToDouble(dlgThridTra.IK);
                            }
                            if (dlgThridTra.JK != "")
                            {
                                pspDev.G = Convert.ToDouble(dlgThridTra.JK);
                            }
                            if (dlgThridTra.KK != "")
                            {
                                pspDev.BigP = Convert.ToDouble(dlgThridTra.KK);
                            }
                            if (dlgThridTra.IR != "")
                            {
                                pspDev.HuganTQ1 = Convert.ToDouble(dlgThridTra.IR);
                            }
                            if (dlgThridTra.JR != "")
                            {
                                pspDev.HuganTQ2 = Convert.ToDouble(dlgThridTra.JR);
                            }
                            if (dlgThridTra.KR != "")
                            {
                                pspDev.HuganTQ3 = Convert.ToDouble(dlgThridTra.KR);
                            }
                            if (dlgThridTra.ITQ != "")
                            {
                                pspDev.HuganTQ4 = Convert.ToDouble(dlgThridTra.ITQ);
                            }
                            if (dlgThridTra.JTQ != "")
                            {
                                pspDev.HuganTQ5 = Convert.ToDouble(dlgThridTra.JTQ);
                            }
                            if (dlgThridTra.KTQ != "")
                            {
                                pspDev.SmallTQ = Convert.ToDouble(dlgThridTra.KTQ);
                            }
                            if (dlgThridTra.ZeroTQ != "")
                            {
                                pspDev.ZeroTQ = Convert.ToDouble(dlgThridTra.ZeroTQ);
                            }
                            if (dlgThridTra.NeutralNodeTQ != "")
                            {
                                pspDev.BigTQ = Convert.ToDouble(dlgThridTra.NeutralNodeTQ);
                            }

                            Services.BaseService.Create<PSPDEV>(pspDev);
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("串联电容电抗器")))
                    {
                        frmCapacity dlgCapacity = new frmCapacity(tlVectorControl1.SVGDocument.CurrentLayer.ID);
                        dlgCapacity.SetEnable(true);
                        dlgCapacity.Text = "串联电容电抗器";
                        dlgCapacity.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgCapacity.ShowDialog(this) == DialogResult.OK)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlgCapacity.Name;
                            pspName.Type = "串联电容电抗器";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }

                            tlVectorControl1.Operation = ToolOperation.Select;
                            PSPDEV pspDev = new PSPDEV();
                            tlVectorControl1.ChangeLevel(LevelType.Bottom);
                            RectangleF t = ((IGraph)temp).GetBounds();
                            pspDev.SUID = Guid.NewGuid().ToString();
                            pspDev.EleID = temp.GetAttribute("id");
                            pspDev.Name = dlgCapacity.Name;
                            pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            pspDev.X1 = t.X;
                            pspDev.Y1 = t.Y;
                            pspDev.Number = -1;
                            pspDev.FirstNode = -1;
                            pspDev.LastNode = 0;
                            pspDev.Type = "串联电容电抗器";

                            pspDev.Lable = dlgCapacity.Lable;

                            if (dlgCapacity.PositiveTQ != "")
                            {
                                pspDev.PositiveTQ = Convert.ToDouble(dlgCapacity.PositiveTQ);
                            }
                            pspDev.HuganLine1 = dlgCapacity.FirstNodeName;
                            //pspDev.HuganLine2 = dlgCapacity.LastNodeName;

                            Services.BaseService.Create<PSPDEV>(pspDev);
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }

                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("并联电容电抗器")))
                    {
                        frmCapacity dlgCapacity = new frmCapacity(tlVectorControl1.SVGDocument.CurrentLayer.ID);
                        dlgCapacity.SetEnable(false);
                        dlgCapacity.Text = "并联电容电抗器";
                        dlgCapacity.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgCapacity.ShowDialog(this) == DialogResult.OK)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlgCapacity.Name;
                            pspName.Type = "并联电容电抗器";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }

                            tlVectorControl1.Operation = ToolOperation.Select;
                            PSPDEV pspDev = new PSPDEV();
                            tlVectorControl1.ChangeLevel(LevelType.Bottom);
                            RectangleF t = ((IGraph)temp).GetBounds();
                            pspDev.SUID = Guid.NewGuid().ToString();
                            pspDev.EleID = temp.GetAttribute("id");
                            pspDev.Name = dlgCapacity.Name;
                            pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            pspDev.X1 = t.X;
                            pspDev.Y1 = t.Y;
                            pspDev.Number = -1;
                            pspDev.FirstNode = -1;
                            pspDev.LastNode = 0;
                            pspDev.Type = "并联电容电抗器";

                            pspDev.Lable = dlgCapacity.Lable;

                            if (dlgCapacity.PositiveTQ != "")
                            {
                                pspDev.PositiveTQ = Convert.ToDouble(dlgCapacity.PositiveTQ);
                            }
                            pspDev.HuganLine1 = dlgCapacity.FirstNodeName;
                            //pspDev.HuganLine2 = dlgCapacity.LastNodeName;

                            Services.BaseService.Create<PSPDEV>(pspDev);
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("1/2母联开关")))
                    {
                        frmMuLian dlgmulian = new frmMuLian(tlVectorControl1.SVGDocument.CurrentLayer.ID);

                        dlgmulian.Text = "1/2母联开关";
                        dlgmulian.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgmulian.ShowDialog(this) == DialogResult.OK)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlgmulian.Name;
                            pspName.Type = "1/2母联开关";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }

                            tlVectorControl1.Operation = ToolOperation.Select;
                            PSPDEV pspDev = new PSPDEV();
                            tlVectorControl1.ChangeLevel(LevelType.Bottom);
                            RectangleF t = ((IGraph)temp).GetBounds();
                            pspDev.SUID = Guid.NewGuid().ToString();
                            pspDev.EleID = temp.GetAttribute("id");
                            pspDev.Name = dlgmulian.Name;
                            pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            pspDev.X1 = t.X;
                            pspDev.Y1 = t.Y;
                            pspDev.Number = -1;
                            pspDev.FirstNode = -1;
                            pspDev.LastNode = 0;
                            pspDev.Type = "1/2母联开关";

                            pspDev.Lable = "1/2母联开关";

                            pspDev.HuganLine1 = dlgmulian.FirstNodeName;
                            pspDev.HuganLine2 = dlgmulian.LastNodeName;
                            pspDev.HuganLine3 = dlgmulian.SwitchStatus;

                            Services.BaseService.Create<PSPDEV>(pspDev);
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    else if (temp is Use && (temp.GetAttribute("xlink:href").Contains("2/3母联开关")))
                    {
                        frmMuLian2 dlgmulian = new frmMuLian2(tlVectorControl1.SVGDocument.CurrentLayer.ID);

                        dlgmulian.Text = "2/3母联开关";
                        dlgmulian.svgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                        if (dlgmulian.ShowDialog(this) == DialogResult.OK)
                        {
                            PSPDEV pspDev2 = new PSPDEV();
                            XmlNodeList element = tlVectorControl1.SVGDocument.GetElementsByTagName("text");
                            PSPDEV pspName = new PSPDEV();
                            pspName.Name = dlgmulian.Name;
                            pspName.Type = "2/3母联开关";
                            pspName.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            IList listName = Services.BaseService.GetList("SelectPSPDEVByName", pspName);
                            if (listName.Count >= 1)
                            {
                                MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                tlVectorControl1.Delete();
                                return;
                            }

                            tlVectorControl1.Operation = ToolOperation.Select;
                            PSPDEV pspDev = new PSPDEV();
                            tlVectorControl1.ChangeLevel(LevelType.Bottom);
                            RectangleF t = ((IGraph)temp).GetBounds();
                            pspDev.SUID = Guid.NewGuid().ToString();
                            pspDev.EleID = temp.GetAttribute("id");
                            pspDev.Name = dlgmulian.Name;
                            pspDev.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID;
                            pspDev.X1 = t.X;
                            pspDev.Y1 = t.Y;
                            pspDev.Number = -1;
                            pspDev.FirstNode = -1;
                            pspDev.LastNode = 0;
                            pspDev.Type = "2/3母联开关";

                            pspDev.Lable = "2/3母联开关";

                            pspDev.HuganLine1 = dlgmulian.INodeName;
                            pspDev.HuganLine2 = dlgmulian.JNodeName;
                            pspDev.HuganLine3 = dlgmulian.ILineName;
                            pspDev.HuganLine4 = dlgmulian.JLineName;
                            pspDev.KName = dlgmulian.ILoadName;
                            pspDev.KSwitchStatus = dlgmulian.JLoadName;
                            pspDev.LineLevel = dlgmulian.SwitchStatus1;
                            pspDev.LineType = dlgmulian.SwitchStatus2;
                            pspDev.LineStatus = dlgmulian.SwitchStatus3;

                            Services.BaseService.Create<PSPDEV>(pspDev);
                        }
                        else
                        {
                            tlVectorControl1.Delete();
                        }
                    }
                    //temp.RemoveAll();
                }
            }
        }
Esempio n. 4
0
        void tlVectorControl1_LeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e)
        {
            if (csOperation == CustomOperation.OP_MeasureDistance) {
                Polyline pl = tlVectorControl2.SVGDocument.CurrentElement as Polyline;
                if (pl.Points.Length > 1) {
                    double d = 0;
                    for (int i = 1; i < pl.Points.Length; i++) {
                        d += this.mapview.CountLength(pl.Points[i - 1], pl.Points[i]);
                    }
                    label1.Text = d + "公里";

                    Point pt = new Point(e.Mouse.X, e.Mouse.Y);
                    pt = PointToClient(tlVectorControl2.PointToScreen(pt));
                    //tlVectorControl1.SetToolTip(label1.Text);
                    label1.Left = pt.X;
                    label1.Top = pt.Y;

                    label1.Visible = true;
                }
                return;
            }
            //System.IO.FileInfo ff = new System.IO.FileInfo("c:\\1111.txt");
            //System.IO.StreamWriter wt= ff.CreateText();
            //wt.Write(tlVectorControl1.SVGDocument.OuterXml);
            //wt.Close();
            //SortedList l = new SortedList();
            //l.Add("1", "aaa");
            //l.Add("5", "bbb");
            //l.Add("2", "ccc");

            //if (tlVectorControl1.ScaleRatio < 0.1f) {
            //    tlVectorControl1.ScaleRatio = 0.1f;
            //    scaleBox.ComboBoxEx.Text = "";
            //    scaleBox.SelectedText = "10%";
            //}
            tip.Hide();
            fInfo.Hide();
            if (tlVectorControl2.Operation == ToolOperation.Text) {
                frmTextInput ft = new frmTextInput();
                if (ft.ShowDialog() == DialogResult.OK) {
                    string txt = ft.Content;
                    XmlElement n1 = tlVectorControl2.SVGDocument.CreateElement("text") as Text;
                    Point point1 = tlVectorControl2.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("x", point1.X.ToString());
                    n1.SetAttribute("y", point1.Y.ToString());
                    n1.InnerText = txt;
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    tlVectorControl2.SVGDocument.RootElement.AppendChild(n1);
                    tlVectorControl2.Operation = ToolOperation.Select;
                }
            }
            if (MapType == "规划统计") {
                try {
                    if (e.SvgElement.ID == "svg") {
                        MapType = "接线图";
                        return;
                    }
                    if(((Polygon)e.SvgElement )==null)return;
                    XmlElement n1 = tlVectorControl2.SVGDocument.CreateElement("circle") as Circle;
                    Point point1 = tlVectorControl2.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    n1.SetAttribute("cx", point1.X.ToString());
                    n1.SetAttribute("cy", point1.Y.ToString());
                    n1.SetAttribute("r", "42.5");
                    n1.SetAttribute("r", "42.5");
                    //n1.SetAttribute("layer", getlayer("供电区域层", tlVectorControl1.SVGDocument.getLayerList()).ID);
                    n1.SetAttribute("layer", SvgDocument.currentLayer);
                    n1.SetAttribute("style", "fill:#FFFFC0;fill-opacity:0.5;stroke:#000000;stroke-opacity:1;");
                    tlVectorControl2.SVGDocument.RootElement.AppendChild(n1);

                    frmMainProperty fmain = new frmMainProperty();
                    glebeProperty gp = new glebeProperty();
                    gp.EleID = ((XmlElement)e.SvgElement).GetAttribute("id");
                    gp.SvgUID = tlVectorControl2.SVGDocument.SvgdataUid;
                    //fmain.InitData(gp); ///////////////////////////////////

                    XmlNodeList nlist = tlVectorControl2.SVGDocument.GetElementsByTagName("use");

                    PointF[] tfArray1 = TLMath.getPolygonPoints((XmlElement)e.SvgElement);
                    string str220 = "";
                    string str110 = "";
                    string str66 = "";
                    GraphicsPath selectAreaPath = new GraphicsPath();
                    selectAreaPath.AddLines(tfArray1);
                    selectAreaPath.CloseFigure();
                    //Matrix x=new Matrix(
                    //Region region1 = new Region(selectAreaPath);
                    for (int i = 0; i < nlist.Count; i++) {
                        float OffX = 0f;
                        float OffY = 0f;
                        Use use = (Use)nlist[i];
                        if (use.GetAttribute("xlink:href").Contains("Substation")) {
                            string strMatrix = use.GetAttribute("transform");
                            if (strMatrix != "") {
                                strMatrix = strMatrix.Replace("matrix(", "");
                                strMatrix = strMatrix.Replace(")", "");
                                string[] mat = strMatrix.Split(',');
                                if (mat.Length > 5) {
                                    OffX = Convert.ToSingle(mat[4]);
                                    OffY = Convert.ToSingle(mat[5]);
                                }
                            }
                            PointF TempPoint = TLMath.getUseOffset(use.GetAttribute("xlink:href"));
                            if (selectAreaPath.IsVisible(use.X + TempPoint.X + OffX, use.Y + TempPoint.Y + OffY)) {
                                if (use.GetAttribute("xlink:href").Contains("220")) {
                                    str220 = str220 + "'" + use.GetAttribute("id") + "',";
                                }
                                if (use.GetAttribute("xlink:href").Contains("110")) {
                                    str110 = str110 + "'" + use.GetAttribute("id") + "',";
                                }
                                if (use.GetAttribute("xlink:href").Contains("66"))
                                {
                                    str66 = str66 + "'" + use.GetAttribute("id") + "',";
                                }
                            }
                        }
                    }
                    if (str220.Length > 1) {
                        str220 = str220.Substring(0, str220.Length - 1);
                    }
                    if (str110.Length > 1) {
                        str110 = str110.Substring(0, str110.Length - 1);
                    }
                    if (str66.Length > 1)
                    {
                        str66 = str66.Substring(0, str66.Length - 1);
                    }

                    fmain.InitData(gp, str220, str110,str66);

                    XmlElement t1 = tlVectorControl2.SVGDocument.CreateElement("text") as Text;
                    Point point2 = tlVectorControl2.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                    t1.SetAttribute("x", Convert.ToString(point2.X - 20));
                    t1.SetAttribute("y", Convert.ToString(point2.Y - 10));
                    // t1.SetAttribute("layer", getlayer("供电区域层", tlVectorControl1.SVGDocument.getLayerList()).ID);
                    t1.SetAttribute("layer", SvgDocument.currentLayer);
                    t1.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                    t1.SetAttribute("font-famliy", "宋体");
                    t1.SetAttribute("font-size", "14");
                    t1.InnerText = fmain.glebeProp.Area + "\r\n" + fmain.glebeProp.Burthen; //+"\r\n" + fmain.glebeProp.Number;
                    tlVectorControl2.SVGDocument.RootElement.AppendChild(t1);
                    tlVectorControl2.Refresh();
                    fmain.Dispose();
                    MapType = "接线图";
                } catch (Exception e2) { MapType = "接线图"; }
            }
            if (tlVectorControl2.SVGDocument.SelectCollection.Count > 1) {
                return;
            }
            decimal ViewScale = 1;
            string str_Scale = tlVectorControl2.SVGDocument.getViewScale();
            if (str_Scale != "") {
                ViewScale = Convert.ToDecimal(str_Scale);
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polygon") {
                string IsArea = ((XmlElement)e.SvgElement).GetAttribute("IsArea");
                if (IsArea != "") {

                    XmlElement n1 = (XmlElement)e.SvgElement;
                    string str_points = n1.GetAttribute("points");
                    string[] points = str_points.Split(",".ToCharArray());
                    PointF[] pnts = new PointF[points.Length];

                    for (int i = 0; i < points.Length; i++) {
                        string[] pointsXY = points[i].Split(" ".ToCharArray());
                        pnts[i].X = Convert.ToSingle(pointsXY[0]);
                        pnts[i].Y = Convert.ToSingle(pointsXY[1]);
                    }
                    decimal temp1 = TLMath.getPolygonArea(pnts, 1);

                    temp1 = TLMath.getNumber2(temp1, tlVectorControl2.ScaleRatio);
                    SelUseArea = temp1.ToString("#####.####");
                    //tip.Text = "区域面积:" + SelUseArea;
                    if (SelUseArea != "") {
                        if (Convert.ToDecimal(SelUseArea) >= 1) {
                            fInfo.Info = "区域面积:" + SelUseArea + "(KM²)";
                        } else {
                            fInfo.Info = "区域面积: 0" + SelUseArea + "(KM²)";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    if (SelUseArea != "") {
                        fInfo.Show();

                    }
                    //tip.ShowToolTip();
                }

            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Line") {
                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");
                if (IsLead != "") {
                    Line line = (Line)e.SvgElement;
                    decimal temp1 = TLMath.getLineLength(line, 1);
                    temp1 = TLMath.getNumber(temp1, tlVectorControl2.ScaleRatio);
                    string len = temp1.ToString("#####.####");
                    LineLen = len;
                    if (len != "") {
                        if (Convert.ToDecimal(len) >= 1) {
                            fInfo.Info = "线路长度:" + len + "(KM)";
                        } else {
                            fInfo.Info = "线路长度: 0" + len + "(KM)";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    if (len != "") {
                        fInfo.Show();

                    }

                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.Polyline") {
                string IsLead = ((XmlElement)e.SvgElement).GetAttribute("IsLead");
                if (IsLead != "") {
                    Polyline polyline = (Polyline)e.SvgElement;
                    decimal temp1 = TLMath.getPolylineLength(polyline, 1);
                    temp1 = TLMath.getNumber(temp1, tlVectorControl2.ScaleRatio);
                    string len = temp1.ToString("#####.####");
                    LineLen = len;
                    if (len != "") {
                        if (Convert.ToDecimal(len) >= 1) {
                            fInfo.Info = "线路长度:" + len + "(KM)";
                        } else {
                            fInfo.Info = "线路长度: 0" + len + "(KM)";
                        }
                    }
                    fInfo.Top = e.Mouse.Y;
                    fInfo.Left = e.Mouse.X;
                    if (len != "") {
                        fInfo.Show();
                    }

                }
            }
            if (e.SvgElement.GetType().ToString() == "ItopVector.Core.Figure.ConnectLine") {
                ConnectLine cline = (ConnectLine)tlVectorControl2.SVGDocument.CurrentElement;
                if (cline.StartGraph != null) {
                    string code = ((XmlElement)cline.StartGraph).GetAttribute("devxldm");

                    if (code != "") {
                        xltProcessor.SelectLine(code);
                        tlVectorControl2.CurrentOperation = ToolOperation.Select;
                    }
                }
            }
            /*  if (tlVectorControl1.Operation == ToolOperation.LeadLine)
              {
                  string gt = sgt1.Text;
                  XmlElement u1 = tlVectorControl1.SVGDocument.CreateElement("use") as Use;
                  Point point1 = tlVectorControl1.PointToView(new Point(e.Mouse.X, e.Mouse.Y));
                  u1.SetAttribute("xlink:href", "#" + gt + "0");
                  u1.SetAttribute("x", point1.X.ToString());
                  u1.SetAttribute("y", point1.Y.ToString());
                  u1.SetAttribute("layer", SvgDocument.currentLayer);
                  u1.SetAttribute("style", "fill:#FFFFFF;fill-opacity:1;stroke:#000000;stroke-opacity:1;");
                  tlVectorControl1.SVGDocument.RootElement.AppendChild(u1);
              }*/
            //tlVectorControl1.SVGDocument.CurrentElement = null;
        }