// Methods internal TextUndoOperation(TextAction action, int index, CharInfo[] infos, ItopVector.DrawArea.TextOperation textoperation) { this.Action = action; this.CharIndex = index; this.CharInfos = infos; this.TextOperation = textoperation; }
public RatHatchBrush(Color backcolor,ItopVector.PatternType patterntype ,Color forecolor,float fillopacity) { pattern=new ItopVector.Struct.Pattern(backcolor,patterntype,forecolor); this.opacity = fillopacity; this.pen = null; this.color = forecolor; this.opacity = ((float) this.color.A) / 255f; }
public PrintSetupDialog(ItopVector.DrawArea.DrawArea vcontrol) { this.vectorcontrol = vcontrol; InitializeComponent(); this.printerSetup1.PageSettings = vcontrol.PageSettings.Clone() as PageSettings; this.paperSetup1.PageSettings = this.printerSetup1.PageSettings; }
// Methods internal Symbol(ItopVector.Core.Figure.Symbol element) { this.symbolElement = null; this.graphPath = null; if ((element == null) || (element.Name.ToLower() != "symbol")) { throw new Exception("ԭʼ�ڵ㲻��Symbol�ڵ�"); } this.symbolElement = element; this.Id = this.symbolElement.GetAttribute("id"); this.graphPath =(GraphicsPath)this.symbolElement.GPath.Clone(); }
// Methods public ExportImageDialog(ItopVector.DrawArea.DrawArea vectorcontrol) { this.components = null; this.savefiledlg1 = new SaveFileDialog(); this.vectorcontrol = null; this.startPoint = Point.Empty; this.pos = Point.Empty; this.contectBounds = RectangleF.Empty; this.oriPoint = Point.Empty; this.InitializeComponent(); base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true); this.vectorcontrol = vectorcontrol; this.comboFormat.SelectedIndex = 0; this.panel1.Cursor = ItopVector.SpecialCursors.handCurosr; }
// Methods internal PrintDialog(ItopVector.DrawArea.DrawArea vcontrol) { this.components = null; this.vectorControl = vcontrol; this.pageSetting = vcontrol.PageSettings; this.pageSetupdlg=new PageSetupDialog(); this.pageSetupdlg.PageSettings=this.pageSetting; this.margin = 10; this.printdoc = new PrintDocument(); this.pos = Point.Empty; this.scalex = 1f; this.scaley = 1f; this.startPoint = Point.Empty; this.oriPoint = Point.Empty; this.InitializeComponent(); this.printdoc.PrintPage += new PrintPageEventHandler(this.printdoc_PrintPage); this.label8.Cursor = SpecialCursors.handCurosr; this.CalculateScale(); }
// Methods public ExportSymbolDialog(ItopVector.DrawArea.DrawArea vectorcontrol, string filefilter) { this.firstload = true; this.components = null; this.vectorcontrol = null; this.allSymbol = null; this.allShape = null; this.selectionSymbol = null; this.selectionShape = null; this.document = null; this.InitializeComponent(); this.saveFileDialog1.Filter = "SVG�ļ�(*.svg)|*.svg"; if (filefilter.Trim().Length > 0) { this.saveFileDialog1.Filter = this.saveFileDialog1.Filter + "|" + filefilter; } this.vectorcontrol = vectorcontrol; this.symbolSelector = vectorcontrol.SymbolSelector; if(this.symbolSelector!=null) { this.document = vectorcontrol.SymbolSelector.SymbolDoc; } }
void tlVectorControl1_RightClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { sel_sym = ""; sel_start_point = ""; try { if (csOperation == CustomOperation.OP_MeasureDistance) { tlVectorControl1.Operation = ToolOperation.Select; contextMenuStrip1.Hide(); return; } //tlVectorControl1.DocumentSize = new SizeF(3170f, 2540f); //MessageBox.Show(MapType); tmLineConnect.Visible = false; SvgElementCollection elements = tlVectorControl1.SVGDocument.SelectCollection; if (elements.Count == 2) { Polyline pl1 = elements[0] as Polyline; Polyline pl2 = elements[1] as Polyline; if (pl1 != null && pl2 != null && pl1.GetAttribute("IsLead") != "" && pl2.GetAttribute("IsLead") != "") { tmLineConnect.Visible = true; } } if (MapType == "接线图") { tip.Hide(); if (getlayer(SvgDocument.currentLayer, "背景层", tlVectorControl1.SVGDocument.getLayerList())) { contextMenuStrip1.Enabled = false; } else { contextMenuStrip1.Enabled = true; } if (tlVectorControl1.SVGDocument.CurrentElement == null || tlVectorControl1.SVGDocument.CurrentElement.GetType().ToString() != "ItopVector.Core.Figure.Use") { moveMenuItem.Visible = false; jxtToolStripMenuItem.Visible = false; w3MenuItem.Visible = false; } else { if (tlVectorControl1.SVGDocument.CurrentElement.GetAttribute("xlink:href").Contains("Substation")) { moveMenuItem.Visible = true; jxtToolStripMenuItem.Visible = true; w3MenuItem.Visible = true; } } if (show3d == 0) { w3MenuItem.Visible = false; } if (tlVectorControl1.SVGDocument.CurrentElement == null && tlVectorControl1.SVGDocument.CurrentElement.GetType().ToString() != "ItopVector.Core.Figure.RectangleElement" && tlVectorControl1.SVGDocument.CurrentElement.GetType().ToString() != "ItopVector.Core.Figure.Polygon") { printToolStripMenuItem.Visible = false; toolDel.Visible = false; SubToolStripMenuItem.Visible = false; } else { printToolStripMenuItem.Visible = true; toolDel.Visible = true; SubToolStripMenuItem.Visible = false; saveImg.Visible=true; } if (tlVectorControl1.SVGDocument.CurrentElement != null && tlVectorControl1.SVGDocument.CurrentElement.GetType().ToString() == "ItopVector.Core.Figure.Polyline") { mUpdateMenuItem.Visible = true; } else { mUpdateMenuItem.Visible = false; } string guid = Guid.NewGuid().ToString(); if (tlVectorControl1.Operation == ToolOperation.LeadLine && linekey != "") { string str = ""; LineList1 line1 = new LineList1(); line1.UID = Guid.NewGuid().ToString(); line1.LineEleID = tlVectorControl1.SVGDocument.CurrentElement.ID; line1.PointNum = ((Polyline)(tlVectorControl1.SVGDocument.CurrentElement)).Points.Length - 2; line1.Coefficient = (decimal)(1.02); line1.Length = TLMath.getPolylineLength(((Polyline)(tlVectorControl1.SVGDocument.CurrentElement)), Convert.ToDecimal(tlVectorControl1.ScaleRatio)); line1.Length2 = TLMath.getPolylineLength(((Polyline)(tlVectorControl1.SVGDocument.CurrentElement)), Convert.ToDecimal(tlVectorControl1.ScaleRatio)) * Convert.ToDecimal(1.02); PointF[] pnt = ((Polyline)(tlVectorControl1.SVGDocument.CurrentElement)).Points; if (pnt.Length < 3) return; for (int i = 0; i < pnt.Length; i++) { double ang = TLMath.getLineAngle(pnt[i], pnt[i + 1], pnt[i + 2]); if (ang * 57.3 > 60) { MessageBox.Show("线路转角不能大于60度。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); tlVectorControl1.Delete(); return; } str = str + "第" + (i + 1) + "转角:" + Convert.ToDouble(ang * 57.3).ToString("##.##") + "度。\r\n"; if (i == pnt.Length - 3) { break; } } line1.TurnAngle = str; line1.col1 = linekey; frmInputDialog input = new frmInputDialog(); if (input.ShowDialog() == DialogResult.OK) { line1.LineName = input.InputStr; Services.BaseService.Create<LineList1>(line1); } else { tlVectorControl1.Delete(); } linekey = ""; } if (tlVectorControl1.Operation == ToolOperation.InterEnclosure && !SubPrint) { System.Collections.SortedList list = new SortedList(); decimal s = 0; ItopVector.Core.SvgElementCollection selCol = tlVectorControl1.SVGDocument.SelectCollection; if (selCol.Count > 1) { decimal ViewScale = 1; string str_Scale = tlVectorControl1.SVGDocument.getViewScale(); if (str_Scale != "") { ViewScale = Convert.ToDecimal(str_Scale); } string str_remark = ""; string str_selArea = ""; //string Elements = ""; Hashtable SelAreaCol = new Hashtable(); this.Cursor = Cursors.WaitCursor; int t = 0; Lab001: t = t + 1; XmlElement poly1 = (XmlElement)selCol[selCol.Count - t]; if (poly1.GetType().FullName != "ItopVector.Core.Figure.Polygon") { // selCol.Remove(selCol[selCol.Count-1]); goto Lab001; } frmWaiting wait = new frmWaiting(); wait.Show(this); wait.Refresh(); GraphicsPath gr1 = new GraphicsPath(); //gr1.AddRectangle(TLMath.getRectangle(poly1)); gr1.AddPolygon(TLMath.getPolygonPoints(poly1)); gr1.CloseFigure(); for (int i = 0; i < selCol.Count - 1; i++) { if (selCol[i].GetType().FullName == "ItopVector.Core.Figure.Polygon") { string IsArea = ((XmlElement)selCol[i]).GetAttribute("IsArea"); if (IsArea != "") { XmlElement polyn = (XmlElement)selCol[i]; GraphicsPath gr2 = new GraphicsPath(); //gr2.AddRectangle(TLMath.getRectangle(polyn)); gr2.AddPolygon(TLMath.getPolygonPoints(polyn)); gr2.CloseFigure(); Region region = new Region(gr1); region.Intersect(gr2); RectangleF rect = new RectangleF(); rect = tlVectorControl1.SelectedRectangle(region); decimal sub_s = TLMath.getInterPolygonArea(region, rect, ViewScale); sub_s = TLMath.getNumber2(sub_s, tlVectorControl1.ScaleRatio); SelAreaCol.Add(polyn.GetAttribute("id"), sub_s); glebeProperty _gleProp = new glebeProperty(); _gleProp.EleID = polyn.GetAttribute("id"); _gleProp.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; IList gList = Services.BaseService.GetList("SelectglebePropertyByEleID", _gleProp); if (gList.Count > 0) { _gleProp = (glebeProperty)gList[0]; list.Add(_gleProp.UseID, sub_s.ToString("#####.####")); str_selArea = str_selArea + _gleProp.EleID + "," + sub_s.ToString("#####.####") + ";"; //str_remark = str_remark + "地块" + _gleProp.UseID + "选中面积为:" + sub_s.ToString() + "\r\n"; s += sub_s; } } } if (selCol[i].GetType().FullName == "ItopVector.Core.Figure.Use") { XmlElement e1 = (XmlElement)selCol[i]; string str_id = e1.GetAttribute("id"); substation _sub1 = new substation(); _sub1.EleID = str_id; _sub1.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; _sub1 = (substation)Services.BaseService.GetObject("SelectsubstationByEleID", _sub1); if (_sub1 != null) { _sub1.glebeEleID = guid; Services.BaseService.Update("Updatesubstation", _sub1); } } } decimal nullpoly = TLMath.getNumber2(TLMath.getPolygonArea(TLMath.getPolygonPoints(poly1), 1), tlVectorControl1.ScaleRatio) - s; for (int j = 0; j < list.Count; j++) { if (Convert.ToString(list.GetByIndex(j)) != "") { if (Convert.ToDecimal(list.GetByIndex(j)) < 1) { str_remark = str_remark + "地块" + list.GetKey(j).ToString() + "选中面积为:" + "0" + list.GetByIndex(j).ToString() + "(KM²)\r\n"; } else { str_remark = str_remark + "地块" + list.GetKey(j).ToString() + "选中面积为:" + list.GetByIndex(j).ToString() + "(KM²)\r\n"; } } } XmlElement x1 = poly1;// (XmlElement)selCol[selCol.Count - 1]; gPro.UID = guid; gPro.EleID = x1.GetAttribute("id"); gPro.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; gPro.ParentEleID = "0"; if (s != 0) { gPro.Area = Convert.ToDecimal(s.ToString("#####.####")); } else { gPro.Area = 0; } gPro.SelSonArea = str_selArea; if (nullpoly < 1) { gPro.ObligateField10 = "0" + nullpoly.ToString("#####.####"); } else { gPro.ObligateField10 = nullpoly.ToString("#####.####"); } str_remark = str_remark + "\r\n 空白区域面积" + gPro.ObligateField10 + "(KM²)\r\n"; if (str_remark != "") { str_remark = str_remark.Substring(0, str_remark.Length - 2); } gPro.Remark = str_remark; wait.Close(); this.Cursor = Cursors.Default; if (s < 1) { MessageBox.Show("选中区域面积:" + "0" + s.ToString("#####.####") + "(KM²)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("选中区域面积:" + s.ToString("#####.####") + "(KM²)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } Services.BaseService.Create<glebeProperty>(gPro); IDictionaryEnumerator ISelList = SelAreaCol.GetEnumerator(); while (ISelList.MoveNext()) { glebeProperty sub_gle = new glebeProperty(); sub_gle.EleID = ISelList.Key.ToString(); sub_gle.ParentEleID = gPro.EleID; sub_gle.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; Services.BaseService.Update("UpdateglebePropertySelArea", sub_gle); } tlVectorControl1.SVGDocument.SelectCollection.Clear(); tlVectorControl1.SVGDocument.CurrentElement = (SvgElement)x1; } SubPrint = false; } if (tlVectorControl1.CurrentOperation == ToolOperation.InterEnclosure && SubPrint) { //ItopVector.Core.SvgElementCollection selCol = tlVectorControl1.SVGDocument.SelectCollection; //if(selCol.Count>2){ // XmlElement selArea = (SvgElement)selCol[selCol.Count - 1]; // GraphicsPath gr1 = new GraphicsPath(); // gr1.AddPolygon(TLMath.getPolygonPoints(selArea)); // gr1.CloseFigure(); // RectangleF rect= gr1.GetBounds(); // SvgDocument _doc = new SvgDocument(); // string svgtxt = "<?xml version=\"1.0\" encoding=\"utf-8\"?><svg id=\"svg\" width=\""+rect.Width+"\" height=\""+rect.Height+"\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:itop=\"http://www.Itop.com/itop\">"; // for (int n = 0; n < selCol.Count-1;n++ ) // { // //_doc.AppendChild((XmlNode)selCol[n]); // svgtxt=svgtxt+((XmlElement)selCol[n]).OuterXml+"\r\n"; // } // svgtxt = svgtxt + "</svg>"; // _doc.LoadXml(svgtxt); // frmSubPrint s = new frmSubPrint(); // s.Show(); // s.Open(_doc, rect); ItopVector.Core.SvgElementCollection selCol = tlVectorControl1.SVGDocument.SelectCollection; XmlElement x1 = (XmlElement)selCol[selCol.Count - 1]; tlVectorControl1.SVGDocument.SelectCollection.Clear(); tlVectorControl1.SVGDocument.CurrentElement = (SvgElement)x1; SubPrint = false; //} } if (tlVectorControl1.Operation == ToolOperation.Enclosure) { string Elements = ""; ItopVector.Core.SvgElementCollection selCol = tlVectorControl1.SVGDocument.SelectCollection; for (int i = 0; i < selCol.Count - 1; i++) { XmlElement e1 = (XmlElement)selCol[i]; Elements = Elements + "'" + e1.GetAttribute("id") + "',"; } if (Elements.Length > 0) { Elements = Elements.Substring(0, Elements.Length - 1); } XmlElement x1 = (XmlElement)selCol[selCol.Count - 1]; gPro.UID = Guid.NewGuid().ToString(); gPro.EleID = x1.GetAttribute("id"); gPro.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; gPro.SonUid = Elements; Services.BaseService.Create<glebeProperty>(gPro); tlVectorControl1.SVGDocument.SelectCollection.Clear(); tlVectorControl1.SVGDocument.CurrentElement = (SvgElement)x1; } if (tlVectorControl1.CurrentOperation == ToolOperation.LeadLine) { sgt1.Visible = false; } } } catch (Exception e1) { MessageBox.Show(e1.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); tlVectorControl1.SVGDocument.SelectCollection.Clear(); } finally { tlVectorControl1.Operation = ToolOperation.Select; tlVectorControl1.Operation = ToolOperation.FreeTransform; } }
void ItopVector.Core.Interface.Figure.ILayer.Remove(ItopVector.Core.Interface.ISvgElement graph) { graphList.Remove(graph); }
void tlVectorControl1_MoveIn(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { //try //{ // gPro.UID = e.SvgElement.ID; // if (MapType == "接线图") // { // int ViewScale = 1; // string str_Scale = tlVectorControl1.SVGDocument.getViewScale(); // if (str_Scale != "") // { // ViewScale = Convert.ToInt32(str_Scale); // } // } //} //catch (Exception e1) //{ // MessageBox.Show(e1.Message); //} }
void tlVectorControl1_MoveOut(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { //fInfo.Hide(); //tip.Hide(); //tlVectorControl1.Refresh(); }
void DrawArea_BeforeAddSvgElement(object sender, ItopVector.DrawArea.AddSvgElementEventArgs e) { symbolElement = e.SvgElement as Use; if (symbolElement == null) { return; } isNewElementBranch = false; currentElement = xltDocument.CurrentElement; if (symbolElement.GraphId.IndexOf(BDZTag) < 0 && !CheckCanInsert()) { xltVectorCtrl.CurrentOperation = ToolOperation.Select; xltVectorCtrl.DrawArea.PreGraph = null; e.Cancel = true; return; } if (currentElement != null) { newElementXLDM = currentElement.GetAttribute(NodeXLDMTag); } newElementGuid = Guid.NewGuid().ToString(); //要插入的为变电站 if (symbolElement.GraphId.IndexOf(BDZTag) > -1) { newElementName = "变电站"; newElementXLDM = ""; } else//要插入的为其它设备 { newElementName = "节点"; if (IsBDZElement(currentElement) && OnNewLine != null) { List<string> listLineCode = GetBDZConnectLines(currentElement); newElementXLDM = OnNewLine(listLineCode); } } if (IsBDZElement(currentElement)) { List<string> listLineCode = GetBDZConnectLines(currentElement); string strEleID="'m0y4'"; for(int i=0;i<listLineCode.Count;i++){ strEleID = strEleID + ",'" + listLineCode[i]+"'"; } if (listLineCode.Count > 0) { LineInfo l = new LineInfo(); l.SvgUID = xltVectorCtrl.SVGDocument.SvgdataUid; l.EleID=strEleID; IList lineList= Services.BaseService.GetList("SelectLineInfoByEleIDList",l); frmAddLineSel f = new frmAddLineSel(); f.StrList = listLineCode; f.LineList = lineList; if (f.ShowDialog() == DialogResult.OK) { if (f.newLine) { newElementXLDM = OnNewLine(listLineCode); } else { newElementXLDM = f.LineCode; } } else { e.Cancel = true; return; } } } }
public RatHatchBrush(Color backcolor,ItopVector.PatternType patterntype ,Color forecolor) : this(Color.White,ItopVector.PatternType.None,Color.Black,1f) { }
void tlVectorControl1_LeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { //if (tlVectorControl1.ScaleRatio < 0.1f) //{ // tlVectorControl1.ScaleRatio = 0.01f; // scaleBox.ComboBoxEx.Text = "1%"; // //scaleBox.SelectedText = "10%"; //} //SvgElement e1 = null; //if (tlVectorControl1.SVGDocument.CurrentElement != null) //{ // e1 = (SvgElement)tlVectorControl1.SVGDocument.CurrentElement.Clone(); //} ////tlVectorControl1.SVGDocument.CurrentElement = null; //tlVectorControl1.SVGDocument.SelectCollection.Clear(); //tip.Hide(); fInfo.Hide(); //tlVectorControl1.SVGDocument.CurrentElement =(SvgElement) e.Elements[0]; 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 != "") { 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(4.2); SelUseArea = temp1.ToString("#####.####"); 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.Show(); } //tip.Text = "区域面积:" + SelUseArea; //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" + "导线型号:" + " " + " 电压等级:" + _lineTemp.Voltage + " 投运时间:" + _lineTemp.ObligateField3; } else { fInfo.Info = "线路名称:" + " " + "线路长度: 0" + len + "(KM)\r\n" + "导线型号:" + " " + " 电压等级:" + _lineTemp.Voltage + " 投运时间:" + _lineTemp.ObligateField3; } } 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; double temp1 = 0; for (int i = 1; i < polyline.Points.Length; i++) { temp1 += this.mapview.CountLength(polyline.Points[i - 1], polyline.Points[i]); } 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("byq") || aaa.Contains("hwg")) { 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 = "环网柜"; } 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.Name; } 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(e1!=null){ // tlVectorControl1.SVGDocument.CurrentElement = e1; //} }
private void DrawArea_ViewChanged(object sender, ItopVector.DrawArea.ViewChangedEventArgs e) { view = e.View; viewBounds =oldViewBounds= e.Bounds; this.viewPic.Invalidate(); }
void DrawArea_ViewChanged(object sender, ItopVector.DrawArea.ViewChangedEventArgs e) { }
internal MouseArea(ItopVector.DrawArea.DrawArea pl) { this.components = null; this.picturePanel = null; this.startPoint = PointF.Empty; this.defaultCursor = Cursors.Default; this.shiftDown = false; // this.filename = string.Empty; // this.selectPath = new GraphicsPath(); this.graphCenterPoint = PointF.Empty; this.currentOperation = ToolOperation.None; // this.undostack = new UndoStack(); this.oldPoint = Point.Empty; this.hori = false; this.oldindex = 0; this.mousedown = false; this.win32 = new Win32(); this.lineOperation = null; this.SelectOperation = null; this.DrawOperation = null; this.ViewOperation = null; this.ColorOperation = null; this.BezierOperation = null; this.IsDrawing = false; this.TextOperation = null; this.editingOperation = null; this.polyOperation = null; this.FlipOperation = null; this.SubOperation = null; this.InitializeComponent(); this.picturePanel = pl; base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint)), true); // base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | (ControlStyles.Selectable | ControlStyles.UserPaint))), true); this.CreateMenus(); }
public void Add(ItopVector.Core.Interface.ISvgElement graph) { graphList.Add(graph); }
// Methods public ElementExpandChangedEventArgs(SvgElement changeelemnt, SvgElementCollection list, ItopVector.Core.ExpandAction action) { this.ChangeElement = changeelemnt; this.ChangeElements = list; this.ExpandAction = action; }
public void AddAnim(ItopVector.Core.Animate.Animate anim) { this.AppendChild(anim); }
public void UnGroup2(ItopVector.Core.Figure.Group group) { if (group.ParentNode is ItopVector.Core.Figure.Group) { string LayerID=group.GetAttribute("layer"); XmlNode node1 = group.PreviousSibling; while (!(node1 is SvgElement) && (node1 != null)) { node1 = node1.PreviousSibling; } SvgElementCollection collection1 = group.GraphList; SvgDocument document1 = this.SVGDocument; document1.NumberOfUndoOperations += ((2*collection1.Count) + 500); ItopVector.Core.Figure.Group group1 = (ItopVector.Core.Figure.Group) group.ParentNode; Matrix matrix1 = group.Transform.Matrix.Clone(); for (int num1 = collection1.Count - 1; num1 >= 0; num1--) { SvgElement element1 = (SvgElement) collection1[num1]; if (element1 is IGraph) { Matrix matrix2 = new Matrix(); if (element1.SvgAttributes.ContainsKey("transform")) { matrix2 = ((Matrix) element1.SvgAttributes["transform"]).Clone(); } matrix2.Multiply(matrix1, MatrixOrder.Append); Transf transf1 = new Transf(); transf1.setMatrix(matrix2); string text1 = transf1.ToString(); AttributeFunc.SetAttributeValue(element1, "transform", text1); // AttributeFunc.SetAttributeValue(element1, "layer", LayerID); } element1.AllowRename =false; if (node1 != null) { group1.InsertAfter(element1, node1); } else { group1.PrependChild(element1); } element1.AllowRename =true; } group1.RemoveChild(group); this.SVGDocument.NotifyUndo(); } }
private void tlVectorControl1_AfterPaintPage(object sender, ItopVector.Core.PaintMapEventArgs e) { int nScale=0; switch((int)(this.tlVectorControl1.DrawArea.ScaleUnit *1000)) { case 100: nScale =8; break; case 200: nScale =9; break; case 400: nScale =10; break; case 1000: nScale =11; break; case 2000: nScale =12; break; case 4000: nScale =13; break; default: return; } LongLat longlat=LongLat.Empty; //�������ĵ㾭γ�� int offsetY = (nScale-10 )*25; longlat = mapview.OffSet(mapview.ZeroLongLat, nScale, -(int)(e.CenterPoint.X), -(int)(e.CenterPoint.Y)); //������ͼ System.Drawing.Image image = mapview.CreateMap(e.Bounds.Width,e.Bounds.Height ,nScale,longlat.Longitude,longlat.Latitude); ImageAttributes imageAttributes=new ImageAttributes(); ColorMatrix matrix1 = new ColorMatrix(); matrix1.Matrix00 = 1f; matrix1.Matrix11 = 1f; matrix1.Matrix22 = 1f; matrix1.Matrix33 = 0.9f;//��ͼ���� matrix1.Matrix44 = 1f; //���õ�ͼ���� imageAttributes.SetColorMatrix(matrix1, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); //���Ƶ�ͼ e.G.DrawImage((Bitmap)image, e.Bounds, 0f, 0f, (float) image.Width, (float) image.Height, GraphicsUnit.Pixel,imageAttributes); //�������ĵ� e.G.DrawEllipse(Pens.Red,e.Bounds.Width/2 -2 ,e.Bounds.Height/2 -2 ,4,4); e.G.DrawEllipse(Pens.Red,e.Bounds.Width/2 -1 ,e.Bounds.Height/2 -1 ,2,2); {//���Ʊ����� Point p1=new Point(20,e.Bounds.Height -30); Point p2= new Point(20,e.Bounds.Height -20); Point p3=new Point(80,e.Bounds.Height -20); Point p4=new Point(80,e.Bounds.Height -30); e.G.DrawLines(new Pen(Color.Black,2),new Point[4]{p1,p2,p3,p4}); string str1 = string.Format("{0}����", mapview.GetMiles(nScale)); e.G.DrawString(str1, new Font("����", 10), Brushes.Black, 30,e.Bounds.Height -40); } // string s = string.Format("{0}��{1}��", nRows, nCols); string s = string.Format("��{0}��γ{1}", longlat.Longitude, longlat.Latitude); // //��ʾ���ĵ㾭γ�� e.G.DrawString(s, new Font("����", 10), Brushes.Red, 20, 40); }
void tlVectorControl1_DoubleLeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { XmlElement xml1 = ((XmlElement)(e.Elements[0])); string str_name = xml1.GetAttribute("xlink:href"); if (MapType == "接线图") { SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; if (str_name.Contains("Substation")) { pid = tlVectorControl1.SVGDocument.SvgdataUid; SVGFILE svg_temp = new SVGFILE(); svg_temp.SUID = xml1.GetAttribute("id"); IList svglist = Services.BaseService.GetList("SelectSVGFILEByKey", svg_temp); if (svglist.Count > 0) { svg_temp = (SVGFILE)svglist[0]; SvgDocument sdoc = new SvgDocument(); sdoc.LoadXml(svg_temp.SVGDATA); tlVectorControl1.SVGDocument = sdoc; tlVectorControl1.SVGDocument.SvgdataUid = svg_temp.SUID; MapType = "所内接线图"; } else { tlVectorControl1.NewFile(); tlVectorControl1.IsPasteGrid = false; tlVectorControl1.IsShowGrid = false; tlVectorControl1.IsShowRule = false; tlVectorControl1.IsShowTip = false; tlVectorControl1.SVGDocument.SvgdataUid = svg_temp.SUID; MapType = "所内接线图"; } if (tlVectorControl1.SVGDocument.getLayerList().Count == 0) { Layer _lar = ItopVector.Core.Figure.Layer.CreateNew("接线图", tlVectorControl1.SVGDocument); _lar.SetAttribute("layerType", "所内接线图"); _lar.Visible = true; SvgDocument.currentLayer = ((Layer)tlVectorControl1.SVGDocument.getLayerList()[0]).ID; } CreateComboBox(); ButtonEnb(true); LoadImage = false; bk1.Visible = false; selLar = ""; tlVectorControl1.ScaleRatio = 1f; tlVectorControl1.Refresh(); } } }
void DrawArea_ViewChanged(object sender, ItopVector.DrawArea.ViewChangedEventArgs e) { //throw new Exception("The method or operation is not implemented."); float a = e.Bounds.Bottom; }
void tlVectorControl1_RightClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { if (MapType == "接线图") { tip.Hide(); contextMenuStrip1.Show(e.Mouse.X, e.Mouse.Y); if (getlayer(SvgDocument.currentLayer, "背景层", tlVectorControl1.SVGDocument.getLayerList())) { contextMenuStrip1.Enabled = false; } else { contextMenuStrip1.Enabled = true; } if (tlVectorControl1.SVGDocument.CurrentElement == null || tlVectorControl1.SVGDocument.CurrentElement.GetType().ToString() != "ItopVector.Core.Figure.Use") { jxtMenuItem.Visible = false; } else { if (tlVectorControl1.SVGDocument.CurrentElement.GetAttribute("xlink:href").Contains("Substation")) { jxtMenuItem.Visible = true; } } if (tlVectorControl1.Operation == ToolOperation.InterEnclosure) { System.Collections.SortedList list = new SortedList(); glebeProperty gPro = new glebeProperty(); decimal s = 0; ItopVector.Core.SvgElementCollection selCol = tlVectorControl1.SVGDocument.SelectCollection; if (selCol.Count > 1) { decimal ViewScale = 1; string str_Scale = tlVectorControl1.SVGDocument.getViewScale(); if (str_Scale != "") { ViewScale = Convert.ToDecimal(str_Scale); } string str_remark = ""; string str_selArea = ""; //string Elements = ""; Hashtable SelAreaCol = new Hashtable(); this.Cursor = Cursors.WaitCursor; int t = 0; Lab001: t = t + 1; XmlElement poly1 = (XmlElement)selCol[selCol.Count - t]; if (poly1.GetType().FullName != "ItopVector.Core.Figure.Polygon") { // selCol.Remove(selCol[selCol.Count-1]); goto Lab001; } frmWaiting wait = new frmWaiting(); wait.Show(this); wait.Refresh(); GraphicsPath gr1 = new GraphicsPath(); //gr1.AddRectangle(TLMath.getRectangle(poly1)); gr1.AddPolygon(TLMath.getPolygonPoints(poly1)); gr1.CloseFigure(); for (int i = 0; i < selCol.Count - 1; i++) { if (selCol[i].GetType().FullName == "ItopVector.Core.Figure.Polygon") { string IsArea = ((XmlElement)selCol[i]).GetAttribute("IsArea"); if (IsArea != "") { XmlElement polyn = (XmlElement)selCol[i]; GraphicsPath gr2 = new GraphicsPath(); //gr2.AddRectangle(TLMath.getRectangle(polyn)); gr2.AddPolygon(TLMath.getPolygonPoints(polyn)); gr2.CloseFigure(); Region region = new Region(gr1); region.Intersect(gr2); RectangleF rect = new RectangleF(); rect = tlVectorControl1.SelectedRectangle(region); decimal sub_s = TLMath.getInterPolygonArea(region, rect, ViewScale); sub_s = TLMath.getNumber2(sub_s, tlVectorControl1.ScaleRatio); SelAreaCol.Add(polyn.GetAttribute("id"), sub_s); glebeProperty _gleProp = new glebeProperty(); _gleProp.EleID = polyn.GetAttribute("id"); _gleProp.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; IList gList = Services.BaseService.GetList("SelectglebePropertyByEleID", _gleProp); if (gList.Count > 0) { _gleProp = (glebeProperty)gList[0]; list.Add(_gleProp.UseID, sub_s.ToString("#####.####")); str_selArea = str_selArea + _gleProp.EleID + "," + sub_s.ToString("#####.####") + ";"; //str_remark = str_remark + "地块" + _gleProp.UseID + "选中面积为:" + sub_s.ToString() + "\r\n"; s += sub_s; } } } //if (selCol[i].GetType().FullName == "ItopVector.Core.Figure.Use") //{ // XmlElement e1 = (XmlElement)selCol[i]; // string str_id = e1.GetAttribute("id"); // substation _sub1 = new substation(); // _sub1.EleID = str_id; // _sub1.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; // _sub1 = (substation)Services.BaseService.GetObject("SelectsubstationByEleID", _sub1); // if (_sub1 != null) // { // _sub1.glebeEleID = guid; // Services.BaseService.Update("Updatesubstation", _sub1); // } //} } decimal nullpoly = TLMath.getNumber2(TLMath.getPolygonArea(TLMath.getPolygonPoints(poly1), 1), tlVectorControl1.ScaleRatio) - s; for (int j = 0; j < list.Count; j++) { if (Convert.ToString(list.GetByIndex(j)) != "") { if (Convert.ToDecimal(list.GetByIndex(j)) < 1) { str_remark = str_remark + "地块" + list.GetKey(j).ToString() + "选中面积为:" + "0" + list.GetByIndex(j).ToString() + "(KM²)\r\n"; } else { str_remark = str_remark + "地块" + list.GetKey(j).ToString() + "选中面积为:" + list.GetByIndex(j).ToString() + "(KM²)\r\n"; } } } XmlElement x1 = poly1;// (XmlElement)selCol[selCol.Count - 1]; gPro.UID = Guid.NewGuid().ToString(); gPro.EleID = x1.GetAttribute("id"); gPro.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; gPro.ParentEleID = "0"; if (s != 0) { gPro.Area = Convert.ToDecimal(s.ToString("#####.####")); } else { gPro.Area = 0; } gPro.SelSonArea = str_selArea; if (nullpoly < 1) { gPro.ObligateField10 = "0" + nullpoly.ToString("#####.####"); } else { gPro.ObligateField10 = nullpoly.ToString("#####.####"); } str_remark = str_remark + "\r\n 空白区域面积" + gPro.ObligateField10 + "(KM²)\r\n"; if (str_remark != "") { str_remark = str_remark.Substring(0, str_remark.Length - 2); } gPro.Remark = str_remark; wait.Close(); this.Cursor = Cursors.Default; if (s < 1) { MessageBox.Show("选中区域面积:" + "0" + s.ToString("#####.####") + "(KM²)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("选中区域面积:" + s.ToString("#####.####") + "(KM²)", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } Services.BaseService.Create<glebeProperty>(gPro); IDictionaryEnumerator ISelList = SelAreaCol.GetEnumerator(); while (ISelList.MoveNext()) { glebeProperty sub_gle = new glebeProperty(); sub_gle.EleID = ISelList.Key.ToString(); sub_gle.ParentEleID = gPro.EleID; sub_gle.SvgUID = tlVectorControl1.SVGDocument.SvgdataUid; Services.BaseService.Update("UpdateglebePropertySelArea", sub_gle); } tlVectorControl1.SVGDocument.SelectCollection.Clear(); tlVectorControl1.SVGDocument.CurrentElement = (SvgElement)x1; } // SubPrint = false; } } else { contextMenuStrip1.Enabled = false; } }
void tlVectorControl1_DoubleLeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { XmlElement xml1 = ((XmlElement)(e.Elements[0])); string str_name = xml1.GetAttribute("xlink:href"); if (MapType == "接线图") { if (str_name.Contains("Substation")) { string infoname = xml1.GetAttribute("info-name"); ParentUID = tlVectorControl1.SVGDocument.SvgdataUid; Save(); ParentUID = tlVectorControl1.SVGDocument.SvgdataUid; SVGFILE svg_temp = new SVGFILE(); svg_temp.SUID = xml1.GetAttribute("id"); svg_temp.FILENAME = getBdzName(svg_temp.SUID);// infoname; //svg_temp.FILENAME = ((XmlElement)tlVectorControl1.SVGDocument.CurrentElement).GetAttribute("info-name"); string strWhere = string.Format("suid='{0}' or filename='{1}' ", svg_temp.SUID, svg_temp.FILENAME); IList svglist = Services.BaseService.GetList("SelectSVGFILEByWhere", strWhere); OpenJXT(svglist, svg_temp); //this.Text = infoname; //tlVectorControl1.SVGDocument.FileName = infoname; //frmlar.SymbolDoc = tlVectorControl1.SVGDocument; //frmlar.Progtype = MapType; //frmlar.InitData(); //JxtBar(); tlVectorControl1.SVGDocument.SelectCollection.Clear(); //tlVectorControl1.Delete(); tlVectorControl1.Refresh(); if (tlVectorControl1.SVGDocument.CurrentElement == null || tlVectorControl1.SVGDocument.CurrentElement.ID == "svg") { return; } ParentUID = tlVectorControl1.SVGDocument.SvgdataUid; Save(); ParentUID = tlVectorControl1.SVGDocument.SvgdataUid; //SVGFILE svg_temp = new SVGFILE(); svg_temp.SUID = ((XmlElement)tlVectorControl1.SVGDocument.CurrentElement).GetAttribute("id"); svg_temp.FILENAME = getBdzName(svg_temp.SUID);// ((XmlElement)tlVectorControl1.SVGDocument.CurrentElement).GetAttribute("info-name"); string strWhere2 = string.Format("suid='{0}' or filename='{1}' ", svg_temp.SUID, svg_temp.FILENAME); IList svglist2 = Services.BaseService.GetList("SelectSVGFILEByWhere", strWhere2); OpenJXT(svglist2, svg_temp); } } }
void xltVectorCtrl_DoubleLeftClick(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { //currentElement = xltDocument.CurrentElement; //if (IsNodeElement(currentElement)) //{ // SelectWholeLine(currentElement.GetAttribute(NodeXLDMTag)); // //Delete(); // //MessageBox.Show(GetWholeLineLength(currentElement.GetAttribute(NodeXLDMTag)).ToString(), ""); // //DeleteWholeLine(currentElement.GetAttribute(NodeXLDMTag)); // //SetWholeLineAttribute(currentElement.GetAttribute(NodeXLDMTag), "stroke", "#FF0000"); //} }
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; }
public Rule(bool visible, ItopVector.Enums.UnitType type) { this.isVisible = visible; this.unitType = type; }
/// <summary> /// 测距 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void tlVectorControl1_LeftClick2(object sender, ItopVector.DrawArea.SvgElementSelectedEventArgs e) { }