public SvgElementCollection Clone() { SvgElementCollection collection1 = new SvgElementCollection(); collection1.AddRange(this); return(collection1); }
// Methods public SerializeDocument(SvgDocument doc) { this.svgDocument = null; this.flowChilds = new SvgElementCollection(); this.filterType = typeof(SvgElement); this.svgDocument = doc; }
// Methods internal LinearGradient(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.x1 = 0f; this.y1 = 0f; this.x2 = 1f; this.y2 = 0f; this.gradientTransform = new Transf(); this.gradientUnit = Units.ObjectBoundingBox; this.spreadMethod = SpreadMethods.Pad; this.boundsPath = new GraphicsPath(); this.boundrect = RectangleF.Empty; this.stops = new SvgElementCollection(); this.gradientstart = PointF.Empty; this.gradientend = PointF.Empty; this.rotatepoint = PointF.Empty; this.translatepoint = PointF.Empty; this.scalePoint = PointF.Empty; this.boundsPoints = new PointF[0]; this.ratiomatrix = new Matrix(); this.brush = null; this.coord = new Matrix(); this.gradientpath = new GraphicsPath(); this.pen = null; this.GraphMatrix = new Matrix(); }
public CollectionChangedEventArgs(SvgElementCollection list) { if (list != null) { this.ChangeElements = new ISvgElement[list.Count]; list.CopyTo(this.ChangeElements, 0); } }
public SvgElementSelectedEventArgs(SvgElementCollection list) { if (list != null) { this.Elements = new ISvgElement[list.Count]; list.CopyTo(this.Elements, 0); } }
public CollectionChangedEventArgs(SvgElementCollection list) { if (list != null) { this.ChangeElements = new ISvgElement[list.Count]; list.CopyTo(this.ChangeElements, 0); } }
// Methods internal Pattern(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.graphList = new SvgElementCollection(); this.viewBox = null; this.boundsPoints = new PointF[0]; this.ratiomatrix = new Matrix(); this.coord = new Matrix(); this.graidentPath = new GraphicsPath(); this.pen = null; }
// Methods internal RadialGradients(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.cx = 0.5f; this.cy = 0.5f; this.r = 0.5f; this.gradientpath = new GraphicsPath(); this.gradientTransform = new Transf(); this.bounds = RectangleF.Empty; this.gradientUnit = Units.ObjectBoundingBox; this.spreadMethod = SpreadMethods.Pad; this.stops = new SvgElementCollection(); this.boundsPoints = new PointF[0]; this.coord = new Matrix(); this.pen = null; }
public void AddRange(SvgElementCollection value) { bool flag1 = this.NotifyEvent; this.NotifyEvent = false; for (int num1 = 0; num1 < value.Count; num1++) { if (!this.Contains(value[num1])) { this.Add(value[num1]); } } this.NotifyEvent = flag1; if ((this.OnCollectionChangedEvent != null) && this.NotifyEvent) { this.OnCollectionChangedEvent(this, new CollectionChangedEventArgs(value)); } }
// Methods public SelectOperation() { this.mouseAreaControl = null; this.toBeSelectedGraph = null; this.toBeSelectedPath = null; this.currentMousePoint = MousePoint.None; this.reversePath = new GraphicsPath(); this.oriPath = new GraphicsPath(); this.startpoint = PointF.Empty; this.movePoint = PointF.Empty; this.selectMatrix = new Matrix(); this.totalmatrix = new Matrix(); this.controlPoint = PointF.Empty; this.selectAreaPath = new GraphicsPath(); this.win32 = new Win32(); this.AreaPoints = new ArrayList(0x10); this.ps = new PointF[8]; this.rotateindex = 0; this.selectCollection = new SvgElementCollection(); this.tooltips = new Hashtable(0x10); this.rotatepath = new GraphicsPath(); }
// Methods public Viewer() { this.components = null; this.svgDocument = null; this.onlyDrawCurrent = false; this.margin = new SizeF(500f, 500f); this.virtualTop = 0f; this.virtualLeft = 0f; this.scale = 1f; this.selectpath = new GraphicsPath(); this.selectMatrix = new Matrix(); this.elementList = new SvgElementCollection(); this.selectChanged = false; this.changeelements = new SvgElementCollection(); this.drawArea = null; this.oldselectPoint = PointF.Empty; this.Bouns = new PointF[8]; this.InitializeComponent(); // base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true); base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint)), true); // this.BackColor = Color.Red; }
// Methods internal SvgElement(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.timeLineVisible = true; KeyInfo[] infoArray1 = new KeyInfo[1] { new KeyInfo(0, 0) } ; this.infoList = new ArrayList(infoArray1); this.showParticular = false; this.inKey = false; this.animatelist = new SvgElementCollection(); this.svgAttributes = new Hashtable(0x10); this.svgAnimAttributes = new Hashtable(0x10); this.svgStyleAttributes = new Hashtable(0x10); this.beforeChangeValueStr = string.Empty; this.showchild = true; this.pretime = -1; this.AnimateNameValues = new Hashtable(0x10); this.AttributePos = new Hashtable(); this.FormatOutXml = true; this.UseElement = null; this.CreateParse = true; this.ownerDocument = doc; this.FormatElement = false; this.AllowRename = true; }
public SvgElementCollection(SvgElementCollection value) { this.NotifyEvent = false; this.AddRange(value); }
// Methods public DrawArea() { this.components = null; this.mouseAreaControl = null; this.pageSetting = new PageSettings(); this.drawMode = DrawModeType.ScreenImage; this.virtualLeft = 0f; this.virtualTop = 0f; this.scale = 1f; this.coordTransform = new Matrix(); this.viewSize = new SizeF(500f, 500f); this.showGrid = true; this.showRule = true; this.showGuides = false; this.lockGuides = false; this.gridSize = new SizeF(10f, 10f); this.firstload = true; this.operation = ToolOperation.None; this.centerPoint = PointF.Empty; this.oldpoint = Point.Empty; this.prepathchanged = false; this.preGraph = null; this.UpdateRule = true; this.RefLines = new ArrayList(0x10); this.SnapToGrid = false; this.SnapToGuides = false; this.PreTextSelect = new SvgElementCollection(); this.InitializeComponent(); this.viewer.drawArea = this; this.margin = Size.Round(this.viewer.margin); this.mouseAreaControl.Focus(); this.mouseAreaControl.PicturePanel = this; this.mouseAreaControl.DragAndDrop+=new DragEventHandler(mouseAreaControl_DragDrop); this.FillBrush = new SolidColor(Color.White); this.stroke = new Stroke(new SolidColor(Color.Black)); this.backColor = new SolidBrush(Color.White); this.RatTextStyle = new ItopVector.Struct.TextStyle("����", 12, false, false, false); base.MouseWheel += new MouseEventHandler(this.DealMouseWheel); addedElements=new SvgElementCollection(); this.viewer.ViewChanged +=new ViewChangedEventHandler(viewer_ViewChanged); this.mouseAreaControl.BeforeDragDrop+=new DragEventHandler(DrawArea_BeforeDragDrop); this.mouseAreaControl.OnPolyLineBreak += new PolyLineBreakEventHandler(mouseAreaControl_OnPolyLineBreak); this.mouseAreaControl.OnAddElement += new AddSvgElementEventHandler(mouseAreaControl_OnAddElement); this.mouseAreaControl.MouseMove += new MouseEventHandler(mouseAreaControl_MouseMove); this.mouseAreaControl.MouseDown += new MouseEventHandler(mouseAreaControl_MouseDown); this.mouseAreaControl.MouseUp += new MouseEventHandler(mouseAreaControl_MouseUp); this.mouseAreaControl.OnElementMove += new ElementMoveEventHandler(mouseAreaControl_OnElementMove); // base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint), true); }
public void Group(SvgElementCollection collection) { if (collection.Count >= 2) { SvgDocument document1 = this.SVGDocument; // bool flag1 = document1.AcceptChanges; document1.AcceptChanges = false; ItopVector.Core.Figure.Group group1 = (ItopVector.Core.Figure.Group) document1.CreateElement(document1.Prefix, "g", document1.NamespaceURI); SvgElement element1 = null; SvgElementCollection.ISvgElementEnumerator enumerator1 = collection.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element2 = (SvgElement) enumerator1.Current; if (element1 == null) { element1 = (SvgElement) element2.ParentNode; continue; } if (element1 != element2.ParentNode) { MessageBox.Show(DrawAreaConfig.GetLabelForName("notinsamelayer")); return; } } if (element1 is ItopVector.Core.Figure.Group) { document1.AcceptChanges = true; document1.NumberOfUndoOperations = 200 + (2*collection.Count); element1.InsertBefore(group1, (SvgElement) collection[0]); for (int num1 = collection.Count - 1; num1 >= 0; num1--) { SvgElement element3 = (SvgElement) collection[num1]; element3.AllowRename =false; group1.PrependChild(element3); element3.AllowRename =true; } ((XmlElement)group1).SetAttribute("layer",SvgDocument.currentLayer); this.SVGDocument.ClearSelects(); this.SVGDocument.CurrentElement = group1; this.SVGDocument.NotifyUndo(); } } }
// Methods public ElementExpandChangedEventArgs(SvgElement changeelemnt, SvgElementCollection list, ItopVector.Core.ExpandAction action) { this.ChangeElement = changeelemnt; this.ChangeElements = list; this.ExpandAction = action; }
public void CallCAD(SvgElementCollection _col, string lab, int count, AcadApplication cad) { int errid = 0; AcadEntity[] en = new AcadEntity[2]; AcadHatch wt = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); wt.color = ACAD_COLOR.acWhite; AcadHatch h; AcadHatch h2; AcadHatch h3; AcadHatch h4; AcadHatch h5; //h = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid",/* "JIS_LC_20",*/ true, 0); if (CadFullType == "1") { h = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); h2 = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); h3 = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); h4 = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); h5 = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); } else { h = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0);//JIS_LC_20 //JIS_LC_20 h2 = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); h3 = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); h4 = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); h5 = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); } if (CadFullType == "2") { h.PatternScale = 0.25; h.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; } Color c_500 = ColorTranslator.FromHtml(str500kv); AcadAcCmColor color500 = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); //2006 -"AutoCAD.AcCmColor.16" color500.SetRGB(c_500.R, c_500.G, c_500.B); h.TrueColor = color500; if (CadFullType == "2") { h2.PatternScale = 0.25; h2.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; } Color c_220 = ColorTranslator.FromHtml(str220kv); AcadAcCmColor color220 = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color220.SetRGB(c_220.R, c_220.G, c_220.B); h2.TrueColor = color220; if (CadFullType == "2") { h3.PatternScale = 0.25; h3.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; } Color c_110 = ColorTranslator.FromHtml(str110kv); AcadAcCmColor color110 = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color110.SetRGB(c_110.R, c_110.G, c_110.B); h3.TrueColor = color110; if (CadFullType == "2") { h4.PatternScale = 0.25; h4.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; } Color c_66 = ColorTranslator.FromHtml(str66kv); AcadAcCmColor color66 = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color66.SetRGB(c_66.R, c_66.G, c_66.B); h4.TrueColor = color66; if (CadFullType == "2") { h5.PatternScale = 0.25; h5.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; } Color c_33 = ColorTranslator.FromHtml(str33kv); AcadAcCmColor color33 = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color33.SetRGB(c_33.R, c_33.G, c_33.B); h5.TrueColor = color33; for (int i = 0; i < _col.Count; i++) { SvgElement ele = (SvgElement)_col[i]; f.SetText("共有" + count + "个图层。正在处理" + lab + "图层。\r\n 此图层共" + _col.Count + "个图元,正在处理第" + i + "个,请等待......"); if (ele.Name == "rect") { try { RectangleElement rect = ele as RectangleElement; PointF[] points = new PointF[1]; points[0].X = rect.X; points[0].Y = rect.Y; rect.Transform.Matrix.TransformPoints(points); double[] col = new double[15]; col[0] = points[0].X; col[1] = -points[0].Y; col[2] = 0; col[3] = rect.X; col[4] = -(rect.Y + rect.Height); col[5] = 0; col[6] = rect.X + rect.Width; col[7] = -(rect.Y + rect.Height); col[8] = 0; col[9] = rect.X + rect.Width; col[10] = -rect.Y; col[11] = 0; col[12] = rect.X; col[13] = -rect.Y; col[14] = 0; AcadPolyline pl = cad.ActiveDocument.ModelSpace.AddPolyline(col); string color_str = rect.GetAttribute("style"); int sub_i = color_str.IndexOf("stroke:"); if (sub_i == -1) { color_str = "#000000"; } else { color_str = color_str.Substring(sub_i + 7, 7); // color_str = color_str.Replace("000000", "FFFFFF"); } Color c1 = ColorTranslator.FromHtml(color_str); AcadAcCmColor color = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color.SetRGB(c1.R, c1.G, c1.B); pl.TrueColor = color; pl.Layer = lab; cad.Application.Update(); } catch { } } if (ele.Name == "ellipse") { //Ellips eli = ele as Ellips; //DxfEllipse eli = new DxfEllipse(new Point3D(eli.RX, eli.RY, 0), new Vector3D(1, 1, 0), 1); //model.Entities.Add(eli); } if (ele.Name == "polyline") { try { Polyline p1 = ele as Polyline; PointF[] points = p1.Points; if (points.Length > 1) { p1.Transform.Matrix.TransformPoints(points); double[] col = new double[points.Length * 3]; int k = 0; for (int n = 0; n < points.Length; n++) { col[k] = points[n].X; col[k + 1] = -points[n].Y; col[k + 2] = 0; k = k + 3; } string color_str = p1.GetAttribute("style"); int gh_line = color_str.IndexOf("stroke-dasharray:"); int sub_i = color_str.IndexOf("stroke:"); if (sub_i == -1) { //color_str = "#FFFFF"; color_str = "#000000"; } else { color_str = color_str.Substring(sub_i + 7, 7); //color_str = color_str.Replace("000000", "FFFFFF"); } Color c1 = ColorTranslator.FromHtml(color_str); AcadPolyline ple = cad.ActiveDocument.ModelSpace.AddPolyline(col); Layer temp_l = tlVectorControl1.SVGDocument.GetLayerByID(ele.GetAttribute("layer"),false); if (temp_l != null) { if (temp_l.Label.ToLower().Contains("500kv")) { ple.ConstantWidth = w_500; } if (temp_l.Label.ToLower().Contains("220kv")) { ple.ConstantWidth = w_220; } if (temp_l.Label.ToLower().Contains("110kv")) { ple.ConstantWidth = w_110; } if (temp_l.Label.ToLower().Contains("66kv")) { ple.ConstantWidth = w_66; } if (temp_l.Label.ToLower().Contains("35kv")) { ple.ConstantWidth = w_35; } } if (gh_line != -1) { ple.Linetype = "DASHEDX2"; } ple.Layer = lab; AcadAcCmColor color = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color.SetRGB(c1.R, c1.G, c1.B); ple.TrueColor = color;//ACAD_COLOR.acMagenta; cad.Application.Update(); } } catch { } } if (ele.Name == "polygon") { try { Polygon p1 = ele as Polygon; PointF[] points = p1.Points; if (points.Length < 2) return; p1.Transform.Matrix.TransformPoints(points); double[] col = new double[points.Length * 3 + 3]; int k = 0; for (int n = 0; n < points.Length; n++) { col[k] = points[n].X; col[k + 1] = -points[n].Y; col[k + 2] = 0; k = k + 3; } col[points.Length * 3 + 2] = 0; col[points.Length * 3 + 1] = col[1]; col[points.Length * 3] = col[0]; AcadPolyline poly = cad.ActiveDocument.ModelSpace.AddPolyline(col); string IsArea = p1.GetAttribute("IsArea"); string color_str = p1.GetAttribute("style"); int sub_i = color_str.IndexOf("stroke:"); int sub_fill = color_str.IndexOf("fill:#"); if (sub_i == -1 && sub_fill == -1) { //color_str = "#FFFFF"; color_str = "#000000"; } else { if (IsArea == "1") { if (sub_fill == -1) { color_str = color_str.Substring(sub_i + 7, 7); // color_str = color_str.Replace("000000", "FFFFFF"); } else { color_str = color_str.Substring(sub_fill + 5, 7); //color_str = color_str.Replace("000000", "FFFFFF"); } } else { color_str = color_str.Substring(sub_i + 7, 7); //color_str = color_str.Replace("000000", "FFFFFF"); } } Color c1 = ColorTranslator.FromHtml(color_str); AcadAcCmColor color = (AcadAcCmColor)cad.ActiveDocument.Application.GetInterfaceObject("AutoCAD.AcCmColor.18"); color.SetRGB(c1.R, c1.G, c1.B); if (IsArea == "1") { AcadHatch solid = cad.ActiveDocument.ModelSpace.AddHatch(0, "solid", true, 0); solid.TrueColor = color; AcadEntity[] obj = new AcadEntity[1]; obj[0] = (AcadEntity)poly; solid.AppendOuterLoop(obj); solid.Evaluate(); solid.Layer = lab; } poly.TrueColor = color; poly.Layer = lab; cad.Application.Update(); } catch { } } if (ele.Name == "text") { try { ItopVector.Core.Figure.Text t1 = ele as ItopVector.Core.Figure.Text; PointF[] points = new PointF[1]; points[0].X = t1.X; points[0].Y = t1.Y; t1.Transform.Matrix.TransformPoints(points); double[] ins = new double[3]; ins[0] = points[0].X+offX; ins[1] =- points[0].Y+offY; ins[2] = 0; AcadMText text = cad.ActiveDocument.ModelSpace.AddMText(ins, TextLength, t1.TextString); text.Height = TextSize; text.Layer = lab; cad.Application.Update(); } catch { } } if (ele.Name == "use") { try { PointF[] cirp = new PointF[1]; Use u = ele as Use; PointF[] points = new PointF[1]; points[0].X = u.X; points[0].Y = u.Y; XmlNodeList list = tlVectorControl1.SVGDocument.SelectNodes("svg/defs/symbol [@id='" + u.GraphId + "']"); XmlElement e = (XmlElement)list[0]; XmlNodeList sonlist = e.ChildNodes; for (int k = 0; k < sonlist.Count; k++) { string str1 = sonlist[k].GetType().ToString(); if (str1 == "ItopVector.Core.Figure.Circle") { Circle cir = (Circle)sonlist[k]; cirp[0].X = cir.CX; cirp[0].Y = cir.CY; cir.Transform.Matrix.TransformPoints(cirp); break; } if (str1 == "ItopVector.Core.Figure.RectangleElement") { RectangleElement cir = (RectangleElement)sonlist[k]; cirp[0].X = cir.X; cirp[0].Y = cir.Y; cir.Transform.Matrix.TransformPoints(cirp); break; } } PointF p = cirp[0]; points[0].X = points[0].X + p.X; points[0].Y = points[0].Y + p.Y; u.Transform.Matrix.TransformPoints(points); if (u.GraphId.Contains("Substation500")) { double[] pnt = new double[3]; pnt[0] = points[0].X; pnt[1] = -points[0].Y; pnt[2] = 0; AcadCircle cirz = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir1); cirz.Layer = lab; cirz.TrueColor = color500; if (CadFullType == "2") { AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)cirz; wt.AppendOuterLoop(otw); wt.Layer = lab; } AcadCircle cir = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir2); cir.Layer = lab; cir.TrueColor = color500; AcadCircle cir1 = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir3); cir1.TrueColor = color500; cir1.Layer = lab; if (CadFullType == "2") { AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h.AppendOuterLoop(ot); if (u.GraphId.Contains("gh")) { cir.Linetype = "ACAD_ISO03W100"; cir1.Linetype = "ACAD_ISO03W100"; } } if(CadFullType=="1"){ if (!u.GraphId.Contains("gh") && !u.GraphId.Contains("user")) { AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h.AppendOuterLoop(ot); } } } if (u.GraphId.Contains("Substation220")) { double[] pnt = new double[3]; pnt[0] = points[0].X; pnt[1] = -points[0].Y; pnt[2] = 0; AcadCircle cir = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir2); cir.TrueColor = color220; cir.Layer = lab; if (CadFullType == "2") { AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)cir; wt.AppendOuterLoop(otw); wt.Layer = lab; } AcadCircle cir1 = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir3); cir1.Layer = lab; cir1.TrueColor = color220; if (CadFullType == "2") { if (u.GraphId.Contains("gh")) { cir.Linetype = "ACAD_ISO03W100"; cir1.Linetype = "ACAD_ISO03W100"; } AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h2.AppendOuterLoop(ot); } if (CadFullType == "1") { if (!u.GraphId.Contains("gh") && !u.GraphId.Contains("user")) { AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h2.AppendOuterLoop(ot); } if (u.GraphId.Contains("gh-user")) { double[] stat1 = new double[3]; stat1[0] = pnt[0] - int_cir3 / 2 - int_cir3 / 10; stat1[1] = pnt[1] - int_cir3 / 2 - int_cir3 / 10; stat1[2] = 0; double[] end1 = new double[3]; end1[0] = pnt[0] + int_cir3 / 2 + int_cir3 / 10; end1[1] = pnt[1] + int_cir3 / 2 + int_cir3 / 10; end1[2] = 0; AcadLine line1 = cad.ActiveDocument.ModelSpace.AddLine(stat1, end1); line1.Layer = lab; line1.TrueColor = color220; double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir3 / 2 - int_cir3 / 10; stat2[1] = pnt[1] + int_cir3 / 2 + int_cir3 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir3 / 2 + int_cir3 / 10; end2[1] = pnt[1] - int_cir3 / 2 - int_cir3 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color220; } if (u.GraphId.Contains("user")) { double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir3 / 2 - int_cir3 / 10; stat2[1] = pnt[1] + int_cir3 / 2 + int_cir3 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir3 / 2 + int_cir3 / 10; end2[1] = pnt[1] - int_cir3 / 2 - int_cir3 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color220; } } } if (u.GraphId.Contains("Substation110")) { double[] pnt = new double[3]; pnt[0] = points[0].X; pnt[1] = -points[0].Y; pnt[2] = 0; AcadCircle cir = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir3); cir.Layer = lab; cir.TrueColor = color110; if (CadFullType == "2") { AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)cir; wt.AppendOuterLoop(otw); wt.Layer = lab; } AcadCircle cir1 = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir4); cir1.Layer = lab; cir1.TrueColor = color110; if (CadFullType == "2") { if (u.GraphId.Contains("gh")) { cir.Linetype = "ACAD_ISO03W100"; cir1.Linetype = "ACAD_ISO03W100"; } AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h3.AppendOuterLoop(ot); } if (CadFullType == "1") { if (!u.GraphId.Contains("gh") && !u.GraphId.Contains("user")) { AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h3.AppendOuterLoop(ot); } if (u.GraphId.Contains("gh-user")) { double[] stat1 = new double[3]; stat1[0] = pnt[0] - int_cir4 / 2 - int_cir4 / 10; stat1[1] = pnt[1] - int_cir4 / 2 - int_cir4 / 10; stat1[2] = 0; double[] end1 = new double[3]; end1[0] = pnt[0] + int_cir4 / 2 + int_cir4 / 10; end1[1] = pnt[1] + int_cir4 / 2 + int_cir4 / 10; end1[2] = 0; AcadLine line1 = cad.ActiveDocument.ModelSpace.AddLine(stat1, end1); line1.Layer = lab; line1.TrueColor = color110; double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir4 / 2 - int_cir4 / 10; stat2[1] = pnt[1] + int_cir4 / 2 + int_cir4 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir4 / 2 + int_cir4 / 10; end2[1] = pnt[1] - int_cir4 / 2 - int_cir4 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color110; } if (u.GraphId.Contains("user")) { double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir4 / 2 - int_cir4 / 10; stat2[1] = pnt[1] + int_cir4 / 2 + int_cir4 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir4 / 2 + int_cir4 / 10; end2[1] = pnt[1] - int_cir4 / 2 - int_cir4 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color110; } } } if (u.GraphId.Contains("Substation66")) { double[] pnt = new double[3]; pnt[0] = points[0].X; pnt[1] = -points[0].Y; pnt[2] = 0; AcadCircle cir = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir4); cir.Layer = lab; cir.TrueColor = color66; if (CadFullType == "2") { AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)cir; wt.AppendOuterLoop(otw); wt.Layer = lab; } AcadCircle cir1 = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir5); cir1.Layer = lab; cir1.TrueColor = color66; if (CadFullType == "2") { if (u.GraphId.Contains("gh")) { cir.Linetype = "ACAD_ISO03W100"; cir1.Linetype = "ACAD_ISO03W100"; } AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h4.AppendOuterLoop(ot); h4.Evaluate(); } if (CadFullType == "1") { if (!u.GraphId.Contains("gh") && !u.GraphId.Contains("user")) { AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h4.AppendOuterLoop(ot); } if (u.GraphId.Contains("gh-user")) { double[] stat1 = new double[3]; stat1[0] = pnt[0] - int_cir5 / 2 - int_cir5/10; stat1[1] = pnt[1] - int_cir5 / 2 - int_cir5 / 10; stat1[2] = 0; double[] end1 = new double[3]; end1[0] = pnt[0] + int_cir5 / 2 + int_cir5 / 10; end1[1] = pnt[1] + int_cir5 / 2 + int_cir5 / 10; end1[2] = 0; AcadLine line1 = cad.ActiveDocument.ModelSpace.AddLine(stat1, end1); line1.Layer = lab; line1.TrueColor = color66; double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir5 / 2 - int_cir5 / 10; stat2[1] = pnt[1] + int_cir5 / 2 + int_cir5 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir5 / 2 + int_cir5 / 10; end2[1] = pnt[1] - int_cir5 / 2 - int_cir5 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color66; } if (u.GraphId.Contains("user")) { double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir5 / 2 - int_cir5 / 10; stat2[1] = pnt[1] + int_cir5 / 2 + int_cir5 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir5 / 2 + int_cir5 / 10; end2[1] = pnt[1] - int_cir5 / 2 - int_cir5 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color66; } } } if (u.GraphId.Contains("Substation35")) { double[] pnt = new double[3]; pnt[0] = points[0].X; pnt[1] = -points[0].Y; pnt[2] = 0; AcadCircle cir = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir4); cir.Layer = lab; cir.TrueColor = color33; if (CadFullType == "2") { AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)cir; wt.AppendOuterLoop(otw); wt.Layer = lab; } AcadCircle cir1 = cad.ActiveDocument.ModelSpace.AddCircle(pnt, int_cir5); cir1.Layer = lab; cir1.TrueColor = color33; if (CadFullType == "2") { if (u.GraphId.Contains("gh")) { cir.Linetype = "ACAD_ISO03W100"; cir1.Linetype = "ACAD_ISO03W100"; } AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h5.AppendOuterLoop(ot); } if (CadFullType == "1") { if (!u.GraphId.Contains("gh") && !u.GraphId.Contains("user")) { AcadEntity[] ot = new AcadEntity[1]; ot[0] = (AcadEntity)cir1; h5.AppendOuterLoop(ot); } if (u.GraphId.Contains("gh-user")) { double[] stat1 = new double[3]; stat1[0] = pnt[0] - int_cir5 / 2 - int_cir5 / 10; stat1[1] = pnt[1] - int_cir5 / 2 - int_cir5 / 10; stat1[2] = 0; double[] end1 = new double[3]; end1[0] = pnt[0] + int_cir5 / 2 + int_cir5 / 10; end1[1] = pnt[1] + int_cir5 / 2 + int_cir5 / 10; end1[2] = 0; AcadLine line1 = cad.ActiveDocument.ModelSpace.AddLine(stat1, end1); line1.Layer = lab; line1.TrueColor = color33; double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir5 / 2 - int_cir5 / 10; stat2[1] = pnt[1] + int_cir5 / 2 + int_cir5 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir5 / 2 + int_cir5 / 10; end2[1] = pnt[1] - int_cir5 / 2 - int_cir5 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color33; } if (u.GraphId.Contains("user")) { double[] stat2 = new double[3]; stat2[0] = pnt[0] - int_cir5 / 2 - int_cir5 / 10; stat2[1] = pnt[1] + int_cir5 / 2 + int_cir5 / 10; stat2[2] = 0; double[] end2 = new double[3]; end2[0] = pnt[0] + int_cir5 / 2 + int_cir5 / 10; end2[1] = pnt[1] - int_cir5 / 2 - int_cir5 / 10; end2[2] = 0; AcadLine line2 = cad.ActiveDocument.ModelSpace.AddLine(stat2, end2); line2.Layer = lab; line2.TrueColor = color33; } } //h3.Evaluate(); } if (u.GraphId.Contains("Substation-hdc") ) { double[] col = new double[15]; col[0] = points[0].X; col[1] = -points[0].Y; col[2] = 0; col[3] = points[0].X; col[4] = -(points[0].Y + 60); col[5] = 0; col[6] = points[0].X + 180; col[7] = -(points[0].Y + 60); col[8] = 0; col[9] = points[0].X + 180; col[10] = -points[0].Y; col[11] = 0; col[12] = points[0].X; col[13] = -points[0].Y; col[14] = 0; AcadPolyline pl = cad.ActiveDocument.ModelSpace.AddPolyline(col); if (u.GraphId.Contains("gh")) { } else { AcadHatch solid = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); //JIS_LC_20//JIS_LC_20 solid.PatternScale = 0.25; solid.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; solid.color = ACAD_COLOR.acRed; AcadEntity[] obj = new AcadEntity[1]; obj[0] = (AcadEntity)pl; solid.AppendOuterLoop(obj); solid.Evaluate(); solid.Layer = lab; } pl.Layer = lab; pl.color = ACAD_COLOR.acRed; double[] col2 = new double[15]; col2[0] = points[0].X; col2[1] = -points[0].Y+60; col2[2] = 0; col2[3] = points[0].X; col2[4] = -points[0].Y ; col2[5] = 0; col2[6] = points[0].X + 180; col2[7] = -points[0].Y; col2[8] = 0; col2[9] = points[0].X + 180; col2[10] = -points[0].Y+60; col2[11] = 0; col2[12] = points[0].X; col2[13] = -points[0].Y+60; col2[14] = 0; AcadPolyline pl2 = cad.ActiveDocument.ModelSpace.AddPolyline(col2); pl2.Layer = lab; pl2.color = ACAD_COLOR.acRed; //AcadEntity[] otw = new AcadEntity[1]; //otw[0] = (AcadEntity)pl2; //wt.AppendOuterLoop(otw); //wt.Layer = lab; } if ( u.GraphId.Contains("Substation-rdc")) { double[] col = new double[15]; col[0] = points[0].X; col[1] = -points[0].Y; col[2] = 0; col[3] = points[0].X; col[4] = -(points[0].Y + 120); col[5] = 0; col[6] = points[0].X + 90; col[7] = -(points[0].Y + 120); col[8] = 0; col[9] = points[0].X + 90; col[10] = -points[0].Y; col[11] = 0; col[12] = points[0].X; col[13] = -points[0].Y; col[14] = 0; AcadPolyline pl = cad.ActiveDocument.ModelSpace.AddPolyline(col); if (u.GraphId.Contains("gh")) { } else { AcadHatch solid = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); solid.PatternScale = 0.25; solid.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; solid.color = ACAD_COLOR.acWhite; AcadEntity[] obj = new AcadEntity[1]; obj[0] = (AcadEntity)pl; solid.AppendOuterLoop(obj); solid.Evaluate(); solid.Layer = lab; } pl.Layer = lab; double[] col2 = new double[15]; col2[0] = points[0].X+90; col2[1] = -points[0].Y; col2[2] = 0; col2[3] = points[0].X+90; col2[4] = -(points[0].Y + 120); col2[5] = 0; col2[6] = points[0].X + 90+90; col2[7] = -(points[0].Y + 120); col2[8] = 0; col2[9] = points[0].X + 90+90; col2[10] = -points[0].Y; col2[11] = 0; col2[12] = points[0].X+90; col2[13] = -points[0].Y; col2[14] = 0; AcadPolyline pl2 = cad.ActiveDocument.ModelSpace.AddPolyline(col2); pl2.Layer = lab; AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)pl2; wt.AppendOuterLoop(otw); wt.Layer = lab; } if (u.GraphId.Contains("水电站")) { double[] col2 = new double[12]; col2[0] = points[0].X; col2[1] = -points[0].Y; col2[2] = 0; col2[3] = points[0].X; col2[4] = -points[0].Y + 120; col2[5] = 0; col2[6] = points[0].X + 180; col2[7] = -(points[0].Y) + 120; col2[8] = 0; col2[9] = points[0].X; col2[10] = -points[0].Y; col2[11] = 0; AcadPolyline pl = cad.ActiveDocument.ModelSpace.AddPolyline(col2); AcadHatch solid = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); solid.PatternScale = 0.25; solid.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; solid.color = ACAD_COLOR.acWhite; AcadEntity[] obj = new AcadEntity[1]; obj[0] = (AcadEntity)pl; solid.AppendOuterLoop(obj); solid.Evaluate(); solid.Layer = lab; pl.Layer = lab; double[] col = new double[12]; col[0] = points[0].X; col[1] = -points[0].Y; col[2] = 0; col[3] = points[0].X + 180; col[4] = -points[0].Y; col[5] = 0; col[6] = points[0].X + 180; col[7] = -(points[0].Y) + 120; col[8] = 0; col[9] = points[0].X; col[10] = -points[0].Y; col[11] = 0; AcadPolyline pl2 = cad.ActiveDocument.ModelSpace.AddPolyline(col); pl2.Layer = lab; AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)pl2; wt.AppendOuterLoop(otw); wt.Layer = lab; } if (u.GraphId.Contains("gh-Substation-sdz")) { double[] col2 = new double[12]; col2[0] = points[0].X; col2[1] = -points[0].Y; col2[2] = 0; col2[3] = points[0].X; col2[4] = -points[0].Y + 120; col2[5] = 0; col2[6] = points[0].X + 180; col2[7] = -(points[0].Y) + 120; col2[8] = 0; col2[9] = points[0].X; col2[10] = -points[0].Y; col2[11] = 0; AcadPolyline pl = cad.ActiveDocument.ModelSpace.AddPolyline(col2); pl.Layer = lab; double[] col = new double[12]; col[0] = points[0].X; col[1] = -points[0].Y; col[2] = 0; col[3] = points[0].X + 180; col[4] = -points[0].Y; col[5] = 0; col[6] = points[0].X + 180; col[7] = -(points[0].Y) + 120; col[8] = 0; col[9] = points[0].X; col[10] = -points[0].Y; col[11] = 0; AcadPolyline pl2 = cad.ActiveDocument.ModelSpace.AddPolyline(col); pl2.Layer = lab; AcadEntity[] otw = new AcadEntity[1]; otw[0] = (AcadEntity)pl2; wt.AppendOuterLoop(otw); wt.Layer = lab; } if (u.GraphId.Contains("Substation-csxn")) { double[] col = new double[15]; col[0] = points[0].X; col[1] = -points[0].Y; col[2] = 0; col[3] = points[0].X; col[4] = -(points[0].Y + 120); col[5] = 0; col[6] = points[0].X + 180; col[7] = -(points[0].Y + 120); col[8] = 0; col[9] = points[0].X + 180; col[10] = -points[0].Y; col[11] = 0; col[12] = points[0].X; col[13] = -points[0].Y; col[14] = 0; AcadPolyline pl = cad.ActiveDocument.ModelSpace.AddPolyline(col); //AcadEntity[] otw = new AcadEntity[1]; //otw[0] = (AcadEntity)pl; //wt.AppendOuterLoop(otw); //wt.Layer = lab; double[] col2 = new double[15]; col2[0] = points[0].X; col2[1] = -points[0].Y-30; col2[2] = 0; col2[3] = points[0].X; col2[4] = -(points[0].Y)- 120; col2[5] = 0; col2[6] = points[0].X + 90; col2[7] = -(points[0].Y)- 120; col2[8] = 0; col2[9] = points[0].X + 90; col2[10] = -points[0].Y-30; col2[11] = 0; col2[12] = points[0].X; col2[13] = -points[0].Y-30; col2[14] = 0; AcadPolyline pl2 = cad.ActiveDocument.ModelSpace.AddPolyline(col2); double[] col3 = new double[15]; col3[0] = points[0].X+90; col3[1] = -points[0].Y-60; col3[2] = 0; col3[3] = points[0].X+90; col3[4] = -(points[0].Y )- 120; col3[5] = 0; col3[6] = points[0].X + 180; col3[7] = -(points[0].Y) - 120; col3[8] = 0; col3[9] = points[0].X + 180; col3[10] = -points[0].Y-60; col3[11] = 0; col3[12] = points[0].X+90; col3[13] = -points[0].Y-60; col3[14] = 0; AcadPolyline pl3 = cad.ActiveDocument.ModelSpace.AddPolyline(col3); if (u.GraphId.Contains("gh")) { } else { AcadHatch solid = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); solid.PatternScale = 0.25; solid.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; solid.color = ACAD_COLOR.acWhite; AcadEntity[] obj = new AcadEntity[1]; obj[0] = (AcadEntity)pl2; solid.AppendOuterLoop(obj); solid.Evaluate(); solid.Layer = lab; AcadHatch solid2 = cad.ActiveDocument.ModelSpace.AddHatch(0, "JIS_LC_20", true, 0); solid2.PatternScale = 0.25; solid2.Lineweight = ACAD_LWEIGHT.acLnWtByLwDefault; solid2.color = ACAD_COLOR.acWhite; AcadEntity[] obj2 = new AcadEntity[1]; obj2[0] = (AcadEntity)pl3; solid2.AppendOuterLoop(obj2); solid2.Evaluate(); solid2.Layer = lab; } pl.Layer = lab; pl2.Layer = lab; pl3.Layer = lab; } } catch { } } } //wt.color = ACAD_COLOR.acWhite; try { wt.Evaluate(); h.Evaluate(); h.Layer = lab; } catch(Exception e2) { } try { h2.Evaluate(); h2.Layer = lab; } catch(Exception e3) { } try { h3.Evaluate(); h3.Layer = lab; } catch { } try { h4.Evaluate(); h4.Layer = lab; } catch { } try { h5.Evaluate(); h5.Layer = lab; } catch { } cad.Application.Update(); //cad.ActiveDocument.SendCommand("Z e "); }
public void OnMouseMove(MouseEventArgs e) { SvgElementCollection collection1; PointF tf1 = this.mouseAreaControl.PicturePanel.PointToView(this.mouseAreaControl.CenterPoint); PointF tf2 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y)); ToolOperation operation1 = this.mouseAreaControl.CurrentOperation; if (this.mouseAreaControl.CurrentOperation == ToolOperation.AreaSelect && !OperationFunc.IsConnectLineOperation(operation1)) { if (!this.tooltips.ContainsKey("select")) { this.tooltips.Add("select", DrawAreaConfig.GetLabelForName("select").Trim()); } this.mouseAreaControl.PicturePanel.ToolTip((string) this.tooltips["select"], 1); } if(OperationFunc.IsConnectLineOperation(operation1) && MouseArea.ConnectLinePoints==0) { if (!this.tooltips.ContainsKey("connlinestart")) { this.tooltips.Add("connlinestart", DrawAreaConfig.GetLabelForName("connlinestart").Trim()); } this.mouseAreaControl.PicturePanel.ToolTip((string) this.tooltips["connlinestart"], 1); } if(OperationFunc.IsConnectLineOperation(operation1) && MouseArea.ConnectLinePoints==1) { if (!this.tooltips.ContainsKey("connlineend")) { this.tooltips.Add("connlineend", DrawAreaConfig.GetLabelForName("connlineend").Trim()); } this.mouseAreaControl.PicturePanel.ToolTip((string) this.tooltips["connlineend"], 1); } if (e.Button != MouseButtons.None) { if (e.Button == MouseButtons.Left) { // string aaa=((XmlElement)selectCollection[0]).GetAttribute("layer").ToString(); if(this.mouseAreaControl.CanEdit==false ) { goto Lable_CanMove; } if (operation1 == ToolOperation.AreaSelect) { this.AreaPoints.Add(new PointF((float) e.X, (float) e.Y)); this.mouseAreaControl.Invalidate(); } else if (operation1 != ToolOperation.ColorSelect) { SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize; float single1 = ef1.Height; float single2 = ef1.Width; if (this.currentMousePoint == MousePoint.CenterPoint) { this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle); this.win32.W32SetROP2(7); this.win32.W32PolyDraw(this.reversePath); this.reversePath.Reset(); PointF tf5 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y)); if (this.mouseAreaControl.PicturePanel.SnapToGrid) { int num2 = (int) ((tf5.X + (single2 / 2f)) / single2); int num3 = (int) ((tf5.Y + (single1 / 2f)) / single1); tf5 = (PointF) new Point((int) (num2 * single2), (int) (single1 * num3)); } PointF tf6 = this.mouseAreaControl.PicturePanel.PointToSystem(tf5); this.reversePath.AddEllipse((float) (tf6.X - 3f), (float) (tf6.Y - 3f), (float) 8f, (float) 8f); this.win32.W32PolyDraw(this.reversePath); this.win32.ReleaseDC(); } else if ((this.currentMousePoint != MousePoint.None) && (this.toBeSelectedPath != null)&&(this.toBeSelectedGraph==null||(this.toBeSelectedGraph!=null && !this.toBeSelectedGraph.IsLock)) && (((IGraph)selectCollection[0]).Layer.ID==SvgDocument.currentLayer || freeSelect)) {//�϶���ѡͼ�� if(operation1==ToolOperation.WindowZoom) { this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle); this.win32.W32SetROP2(7); this.win32.W32PolyDraw(this.reversePath); this.reversePath.Reset(); PointF tf12 = new PointF((float) e.X, (float) e.Y); PointF tf13 = this.mouseAreaControl.PicturePanel.PointToSystem(startpoint); float single9 = Math.Min(tf13.X, tf12.X); float single10 = Math.Min(tf13.Y, tf12.Y); float single11 = Math.Max(tf13.X, tf12.X); float single12 = Math.Max(tf13.Y, tf12.Y); this.reversePath.AddRectangle(new RectangleF(single9, single10, single11 - single9, single12 - single10)); this.win32.W32PolyDraw(this.reversePath); this.win32.ReleaseDC(); goto Lable_CanMove; } this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle); this.win32.W32SetROP2(7); this.win32.W32PolyDraw(this.reversePath); //this.win32.ReleaseDC(); float single3 = 0f; float single4 = 0f; PointF tf7 = this.startpoint;// this.mouseAreaControl.PicturePanel.PointToView(this.startpoint); PointF tf8 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y)); if (this.mouseAreaControl.PicturePanel.SnapToGrid) { int num4 = (int) ((tf7.X + (single2 / 2f)) / single2); int num5 = (int) ((tf7.Y + (single1 / 2f)) / single1); tf7 = (PointF) new Point((int) (num4 * single2), (int) (num5 * single1)); num4 = (int) ((tf8.X + (single2 / 2f)) / single2); num5 = (int) ((tf8.Y + (single1 / 2f)) / single1); tf8 = (PointF) new Point((int) (num4 * single2), (int) (single1 * num5)); } tf7 = this.mouseAreaControl.PicturePanel.PointToSystem(tf7); tf8 = this.mouseAreaControl.PicturePanel.PointToSystem(tf8); PointF tf9 = tf7; PointF tf10 = tf8; this.reversePath.Reset(); int num6 = 0; SvgElementCollection clines=new SvgElementCollection(); SvgElementCollection.ISvgElementEnumerator enumerator1 = this.selectCollection.GetEnumerator(); while (enumerator1.MoveNext()) { float single5; float single6; GraphicsPath path7; SvgElement element2 = (SvgElement) enumerator1.Current; if (!(element2 is IGraph) ) { continue; } if (element2 is Use && (element2 as Use).LimitSize && currentMousePoint!=MousePoint.Translate)continue; this.reversePath.StartFigure(); Matrix matrix6 = ((IGraph) element2).GraphTransform.Matrix.Clone(); PointF tf11 = PointF.Empty; GraphicsPath path6 = (GraphicsPath) ((IGraph) element2).GPath.Clone(); RectangleF ef2 = PathFunc.GetBounds(path6); PointF[] tfArray3 = new PointF[9] { new PointF(ef2.X, ef2.Y), new PointF(ef2.X, ef2.Y + (ef2.Height / 2f)), new PointF(ef2.X, ef2.Bottom), new PointF(ef2.X + (ef2.Width / 2f), ef2.Y), new PointF(ef2.Right, ef2.Y), new PointF(ef2.Right, ef2.Y + (ef2.Height / 2f)), new PointF(ef2.Right, ef2.Bottom), new PointF(ef2.X + (ef2.Width / 2f), ef2.Bottom), new PointF(ef2.X + (ef2.Width / 2f), ef2.Y + (ef2.Height / 2f)) } ; PointF[] tfArray1 = tfArray3; Matrix matrix7 = matrix6.Clone(); if(matrix7.IsInvertible) matrix7.Invert(); PointF[] tfArray4 = new PointF[3] { tf9, tf10, this.mouseAreaControl.CenterPoint } ; PointF[] tfArray2 = tfArray4; if(this.currentMousePoint!=MousePoint.Rotate) { matrix7.TransformPoints(tfArray2); } tf7 = tfArray2[0]; tf8 = tfArray2[1]; tf1 = tfArray2[2]; matrix6.Reset(); single3 = tf8.X - tf7.X; single4 = tf8.Y - tf7.Y; switch (this.currentMousePoint) { case MousePoint.ScaleTopLeft: case MousePoint.ScaleTopMiddle: case MousePoint.ScaleTopRight: case MousePoint.ScaleMiddleLeft: case MousePoint.ScaleMiddleRight: case MousePoint.ScaleBottomLeft: case MousePoint.ScaleBottomMiddle: case MousePoint.ScaleBottomRight: { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { goto Label_0D82; } if (this.currentMousePoint != MousePoint.ScaleTopLeft) { goto Label_0CC6; } tf11 = tfArray1[6]; goto Label_0D85; } case MousePoint.ScaleFromCenter: case MousePoint.SkewXFromCenter: case MousePoint.SkewYFromCenter: case MousePoint.RotateFromCenter: { goto Label_MOVE; } case MousePoint.SkewXTop: case MousePoint.SkewXBottom: case MousePoint.SkewYLeft: case MousePoint.SkewYRight: { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { goto Label_0ED9; } if (this.currentMousePoint != MousePoint.SkewXBottom) { goto Label_0E88; } tf11 = tfArray1[0]; goto Label_0EDC; } case MousePoint.Rotate://��ת { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { goto Label_103D; } tf11 = tfArray1[this.rotateindex]; goto Label_ROTATE; } case MousePoint.Translate: { // if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)//�ƶ���ΧΪ45�ǵı��� // { // single5 = (((float) Math.Atan2((double) single4, (double) single3)) * 180f) / 3.141593f; // single5 = ((int) Math.Round((double) (single5 / 45f), 0)) * 0x2d; // if ((single5 != 90f) && (single5 != -90f)) // { // break; // } // single3 = 0f; // } if (element2 is IGraph) { foreach(ConnectLine cline in (element2 as IGraph).ConnectLines) { if(!this.selectCollection.Contains(cline) && cline.Visible ) { if(selectCollection.Contains(cline.StartGraph) && selectCollection.Contains(cline.EndGraph)) { if(!clines.Contains(cline)) { clines.Add(cline); GraphicsPath path11 =cline.GetTempPath2(element2 as IGraph,new PointF(single3,single4)); if(path11.PointCount>0) this.reversePath.AddPath(path11,false); } } else { GraphicsPath path11 =cline.GetTempPath(element2 as IGraph,new PointF(single3,single4)); if(path11.PointCount>0) this.reversePath.AddPath(path11,false); } } } } goto Label_0C84; } default: { goto Label_MOVE; } } single5 = (float) Math.Tan((single5 / 180f) * 3.1415926535897931); single4 = single3 * single5; Label_0C84: matrix6.Translate(single3, single4, MatrixOrder.Prepend); goto Label_MOVE; Label_0CC6: if (this.currentMousePoint == MousePoint.ScaleTopRight) { tf11 = tfArray1[2]; goto Label_0D85; } if (this.currentMousePoint == MousePoint.ScaleBottomLeft) { tf11 = tfArray1[4]; goto Label_0D85; } if (this.currentMousePoint == MousePoint.ScaleBottomRight) { tf11 = tfArray1[0]; goto Label_0D85; } if (this.currentMousePoint == MousePoint.ScaleMiddleLeft) { tf11 = tfArray1[5]; goto Label_0D85; } if (this.currentMousePoint == MousePoint.ScaleMiddleRight) { tf11 = tfArray1[1]; goto Label_0D85; } if (this.currentMousePoint == MousePoint.ScaleTopMiddle) { tf11 = tfArray1[7]; goto Label_0D85; } if (this.currentMousePoint == MousePoint.ScaleBottomMiddle) { tf11 = tfArray1[3]; } goto Label_0D85; Label_0D82: tf11 = tf1; Label_0D85: single3 = (tf8.X - tf11.X) / (tf7.X - tf11.X); single4 = (tf8.Y - tf11.Y) / (tf7.Y - tf11.Y); if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { single3 = single4 = Math.Min(single3, single4); } if ((this.currentMousePoint == MousePoint.ScaleMiddleLeft) || (this.currentMousePoint == MousePoint.ScaleMiddleRight)) { single4 = 1f; } else if ((this.currentMousePoint == MousePoint.ScaleTopMiddle) || (this.currentMousePoint == MousePoint.ScaleBottomMiddle)) { single3 = 1f; } matrix6.Translate(tf11.X, tf11.Y, MatrixOrder.Prepend); matrix6.Scale(single3, single4, MatrixOrder.Prepend); matrix6.Translate(-tf11.X, -tf11.Y, MatrixOrder.Prepend); goto Label_MOVE; Label_0E88: if (this.currentMousePoint == MousePoint.SkewXTop) { tf11 = tfArray1[6]; goto Label_0EDC; } if (this.currentMousePoint == MousePoint.SkewYLeft) { tf11 = tfArray1[4]; goto Label_0EDC; } if (this.currentMousePoint == MousePoint.SkewYRight) { tf11 = tfArray1[0]; } goto Label_0EDC; Label_0ED9: tf11 = tf1; Label_0EDC: single3 /= (tfArray1[6].Y - tfArray1[4].Y); single4 /= (tfArray1[6].X - tfArray1[2].X); if ((this.currentMousePoint == MousePoint.SkewXTop) || (this.currentMousePoint == MousePoint.SkewXBottom)) { single4 = 0f; if (this.currentMousePoint == MousePoint.SkewXTop) { single3 = -single3; } } else if ((this.currentMousePoint == MousePoint.SkewYLeft) || (this.currentMousePoint == MousePoint.SkewYRight)) { if (this.currentMousePoint == MousePoint.SkewYLeft) { single4 = -single4; } single3 = 0f; } single3 = (single3 == 0f) ? 0f : ((single3 / Math.Abs(single3)) * Math.Min(Math.Abs(single3), (float) 3f)); single4 = (single4 == 0f) ? 0f : ((single4 / Math.Abs(single4)) * Math.Min(Math.Abs(single4), (float) 3f)); matrix6.Translate(tf11.X, tf11.Y, MatrixOrder.Prepend); matrix6.Shear(single3, single4, MatrixOrder.Prepend); matrix6.Translate(-tf11.X, -tf11.Y, MatrixOrder.Prepend); goto Label_MOVE; Label_103D: tf11 = tf1; Label_ROTATE://��ת single6 = 0f; float single7=0f; if(tf7.X==tf11.X) { single7 = 1.570796f; } else { single7 = (float) Math.Atan((double) ((tf7.Y - tf11.Y) / (tf7.X - tf11.X))); } float single8 = 0f; if(tf8.X==tf11.X) { single8 = 1.570796f; } else { single8 = (float) Math.Atan((double) ((tf8.Y - tf11.Y) / (tf8.X - tf11.X))); } single6 = ((float) (((double) (single8 - single7)) / 3.1415926535897931)) * 180f; if (((tf8.X - tf11.X) * (tf7.X - tf11.X)) < 0f) { single6 += 180f; } if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift) && (single6 != 0f)) { single6 = (single6 / Math.Abs(single6)) * ((((int) (Math.Abs(single6) + 23f)) / 0x2d) * 0x2d); } matrix6.RotateAt(single6,tf11); Label_MOVE://�ƶ� path7 = new GraphicsPath(); if (element2 is Text) { RectangleF ef3 = ((IGraph) element2).GPath.GetBounds(); path7.AddRectangle(ef3); } else { path7 = (GraphicsPath) ((IGraph) element2).GPath.Clone(); if ((path7.PointCount > 0xbb8) || (element2 is Group)) { RectangleF ef4 = path7.GetBounds(); path7.Reset(); path7.AddRectangle(ef4); } } using (Matrix matrix8 = ((IGraph) element2).GraphTransform.Matrix.Clone()) { if(this.currentMousePoint==MousePoint.Rotate) { matrix8.Multiply(matrix6,MatrixOrder.Append); } else { matrix8.Multiply(matrix6, MatrixOrder.Prepend); } path7.Transform(matrix8); } if (path7.PointCount > 0) { this.reversePath.AddPath(path7, false); } num6++; } if (this.reversePath.PointCount > 0xbb8) { RectangleF ef5 = this.reversePath.GetBounds(); this.reversePath.Reset(); this.reversePath.AddRectangle(ef5); } this.win32.W32PolyDraw(this.reversePath); this.win32.ReleaseDC(); } else if ((this.currentMousePoint == MousePoint.None) && (OperationFunc.IsSelectOperation(operation1) || OperationFunc.IsTransformOperation(operation1))) {//ѡ�� this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle); this.win32.W32SetROP2(7); this.win32.W32PolyDraw(this.reversePath); this.reversePath.Reset(); PointF tf12 = new PointF((float) e.X, (float) e.Y); PointF tf13 = this.mouseAreaControl.PicturePanel.PointToSystem(startpoint); float single9 = Math.Min(tf13.X, tf12.X); float single10 = Math.Min(tf13.Y, tf12.Y); float single11 = Math.Max(tf13.X, tf12.X); float single12 = Math.Max(tf13.Y, tf12.Y); this.reversePath.AddRectangle(new RectangleF(single9, single10, single11 - single9, single12 - single10)); this.win32.W32PolyDraw(this.reversePath); this.win32.ReleaseDC(); } } }// ���������� return; } Lable_CanMove: this.selectMatrix.Reset(); this.toBeSelectedGraph = null; this.toBeSelectedPath = null; Matrix matrix1 = this.mouseAreaControl.PicturePanel.CoordTransform.Clone(); matrix1.Invert(); Pen pen2 = new Pen(Color.Blue,3/this.mouseAreaControl.PicturePanel.ScaleUnit); pen2.Alignment = PenAlignment.Center; if ((!OperationFunc.IsSelectOperation(operation1)) /*&& (operation1 != ToolOperation.ShapeTransform))*/ && !OperationFunc.IsTransformOperation(operation1) && !OperationFunc.IsConnectLineOperation(operation1)) { goto Label_05AD; } if (this.mouseAreaControl.SVGDocument.SelectCollection.Count > 0) { if ((operation1 == ToolOperation.Select) ||(operation1 == ToolOperation.Exceptant)|| (operation1 == ToolOperation.ShapeTransform)) {//��ͼԪ���ƶ� GraphicsPath path1 = new GraphicsPath(); path1.AddEllipse((float) (this.mouseAreaControl.CenterPoint.X - 4f), (float) (this.mouseAreaControl.CenterPoint.Y - 4f), (float) 8f, (float) 8f); // if (path1.IsVisible(new PointF(e.X + this.mouseAreaControl.PicturePanel.VirtualLeft, e.Y + this.mouseAreaControl.PicturePanel.VirtualTop))) // { // // this.CurrentMousePoint = MousePoint.CenterPoint; // return; // } this.selectMatrix = this.mouseAreaControl.PicturePanel.SelectMatrix.Clone(); GraphicsPath path2 = (GraphicsPath) this.mouseAreaControl.PicturePanel.SelectPath.Clone(); PointF tf3 = tf2; Matrix matrix2 = this.selectMatrix.Clone(); matrix2.Multiply(matrix1, MatrixOrder.Append); this.CurrentMousePoint = this.GetMousePoint(path2, tf3, matrix2, operation1); // // if(selectCollection.Count>0) // { // if(((XmlElement)selectCollection[0]).GetAttribute("layer").ToString()!=SvgDocument.currentLayer) // { // this.CurrentMousePoint = MousePoint.None; // return; // } // } if (this.currentMousePoint == MousePoint.None) //��ѡ�е�ͼԪ�Ƴ� { if(graphTemp2!=null) //graphTemp2 ѡ�е�ͼԪ { this.mouseAreaControl.PicturePanel.OnMoveOut(mouseAreaControl.SVGDocument.SelectCollection[0] as SvgElement,e); graphTemp2=null; } goto Label_044B; } this.toBeSelectedPath = (GraphicsPath) this.mouseAreaControl.PicturePanel.SelectPath.Clone(); this.selectMatrix = this.mouseAreaControl.PicturePanel.SelectMatrix.Clone(); // if(this.currentMousePoint==MousePoint.Translate) //�ƽ�ѡ�е�ͼԪ { if(graphTemp2==null) { bool flag1=false; foreach(IGraph graph11 in mouseAreaControl.SVGDocument.SelectCollection) { using (Matrix matrix5 = graph11.GraphTransform.Matrix.Clone()) { matrix5.Multiply(matrix1, MatrixOrder.Append); using(GraphicsPath path5 =graph11.GPath.Clone() as GraphicsPath) { path5.Transform(matrix5); if(graph11 is Line || graph11 is Polyline )//�� { // using(Pen pen2 = new Pen(Color.Blue, ((GraphPath)graph11).GraphStroke.StrokePen.Width + 2f)) // { // pen2.Alignment = PenAlignment.Center; flag1=path5.IsOutlineVisible(tf2,pen2); // } } else if (graph11 is Use || graph11 is Text) { flag1 = path5.GetBounds().Contains(tf2); } else { flag1=path5.IsVisible(tf2)||path5.IsOutlineVisible(tf2,pen2);//.GetBounds().Contains(tf2); } } } if (flag1) { graphTemp2=graph11; break; } } // graphTemp2=mouseAreaControl.SVGDocument.SelectCollection[0] as IGraph; if (graphTemp2!=null) { this.mouseAreaControl.PicturePanel.OnMoveIn(graphTemp2 as SvgElement,e); } return; } } //�¼� if(this.currentMousePoint == MousePoint.Translate) //��ѡ�е�ͼԪ���ƶ� { this.mouseAreaControl.PicturePanel.OnMoveOver(this.mouseAreaControl.SVGDocument.SelectCollection[0],e); } // return; test } if (((operation1 == ToolOperation.FreeTransform) || (operation1 == ToolOperation.Scale)) || ((operation1 == ToolOperation.Rotate) || (operation1 == ToolOperation.Skew))) { //this.mouseAreaControl.PicturePanel.OnMoveOver(this.mouseAreaControl.SVGDocument.SelectCollection[0],e); // if ((Math.Abs((float) (e.X - this.mouseAreaControl.CenterPoint.X)) < 2f) && (Math.Abs((float) (e.Y - this.mouseAreaControl.CenterPoint.Y)) < 2f)) // { // //���ĵ� // this.CurrentMousePoint = MousePoint.CenterPoint; // return; // } GraphicsPath path3 = (GraphicsPath) this.mouseAreaControl.PicturePanel.SelectPath.Clone(); this.selectMatrix = this.mouseAreaControl.PicturePanel.SelectMatrix.Clone(); Matrix matrix3 = this.selectMatrix.Clone(); matrix3.Multiply(matrix1, MatrixOrder.Append); PointF tf4 = tf2; bool flag1 = true; if ((this.mouseAreaControl.SVGDocument.SelectCollection.Count == 1) && (this.mouseAreaControl.SVGDocument.SelectCollection[0] is IGraph)) { SvgElement element1 = (SvgElement) this.mouseAreaControl.SVGDocument.SelectCollection[0]; if (!flag1) { GraphicsPath path4 = (GraphicsPath) ((IGraph) element1).GPath.Clone(); Matrix matrix4 = ((IGraph) element1).GraphTransform.Matrix.Clone(); matrix4.Multiply(matrix1, MatrixOrder.Append); path4.Transform(matrix4); Pen pen1 = new Pen(Color.Blue, 3f); pen1.Alignment = PenAlignment.Center; if (path4.IsVisible(tf2)) { this.CurrentMousePoint = MousePoint.Translate; } else { this.CurrentMousePoint = MousePoint.None; } } } if (flag1) { this.CurrentMousePoint = this.GetMousePoint(path3, new PointF((float) e.X, (float) e.Y), this.selectMatrix.Clone(), operation1); } //�¼� if(this.currentMousePoint == MousePoint.Translate) //��ѡ��ͼԪ���ƶ� { this.mouseAreaControl.PicturePanel.OnMoveOver(this.mouseAreaControl.SVGDocument.SelectCollection[0],e); } if (this.currentMousePoint != MousePoint.None) { this.toBeSelectedPath = (GraphicsPath) this.mouseAreaControl.PicturePanel.SelectPath.Clone(); this.selectMatrix = this.mouseAreaControl.PicturePanel.SelectMatrix.Clone(); return; } } } Label_044B://û��ѡ��ͼԪʱ ILayer layer1 = this.mouseAreaControl.SVGDocument.Layers[SvgDocument.currentLayer] as ILayer; if (layer1 == null) return; collection1 = layer1.GraphList; // this.mouseAreaControl.PicturePanel.ElementList; if (collection1 == null) { return; } for (int num1 = collection1.Count - 1; num1 >= 0; num1--) { IGraph graph1 = (IGraph)collection1[num1]; if (graph1.CanSelect && graph1.DrawVisible && graph1.Visible) { bool flag1 = false; using (GraphicsPath path5 = (GraphicsPath)graph1.GPath.Clone()) { using (Matrix matrix5 = graph1.GraphTransform.Matrix.Clone()) { matrix5.Multiply(matrix1, MatrixOrder.Append); path5.Transform(matrix5); if (graph1 is Line || graph1 is Polyline)//�? { // using(Pen pen2 = new Pen(Color.Blue, ((GraphPath)graph1).GraphStroke.StrokePen.Width + 2f)) // { // pen2.Alignment = PenAlignment.Center; flag1 = path5.IsOutlineVisible(tf2, pen2); // } } else if (graph1 is Use || graph1 is Text) { flag1 = path5.GetBounds().Contains(tf2); } else { flag1 = (path5.IsVisible(tf2) || path5.IsOutlineVisible(tf2, pen2));//.GetBounds().Contains(tf2); } } if (flag1)// && ((XmlElement)graph1).GetAttribute("layer").ToString()==SvgDocument.currentLayer) { //if(this.mouseAreaControl.Cursor != SpecialCursors.DragInfoCursor) // path5.Transform((this.mouseAreaControl.SVGDocument.RootElement as SVG).GraphTransform.Matrix); // System.Windows.Forms.ControlPaint.DrawBorder3D(this.mouseAreaControl.CreateGraphics(),Rectangle.Ceiling(path5.GetBounds()),Border3DStyle.Raised); this.toBeSelectedGraph = graph1; this.toBeSelectedPath = (GraphicsPath)graph1.GPath.Clone(); this.selectMatrix = graph1.GraphTransform.Matrix.Clone(); // if (!this.tooltips.ContainsKey("select")) // { // this.tooltips.Add("select", DrawAreaConfig.GetLabelForName("select")); // } // this.mouseAreaControl.PicturePanel.ToolTip((string) this.tooltips["select"], 1); //没有选中图元时,鼠标移入图元区域 this.mouseAreaControl.Cursor = SpecialCursors.DragInfoCursor; if (this.mouseAreaControl.CurrentOperation == ToolOperation.WindowZoom) { this.mouseAreaControl.Cursor = SpecialCursors.WindowZoom; } //if (this.currentMousePoint == MousePoint.None && graphTemp == null) { if (this.currentMousePoint == MousePoint.None && graphTemp == null) { graphTemp = graph1; this.mouseAreaControl.PicturePanel.OnMoveIn(graph1 as SvgElement, e); return; } else if (graphTemp!=null && graphTemp != graph1) { this.mouseAreaControl.PicturePanel.OnMoveOut(graphTemp as SvgElement, e); graphTemp = graph1; this.mouseAreaControl.PicturePanel.OnMoveIn(graph1 as SvgElement, e); return; } } //没有选中图元时,鼠标在图元区域移�? this.mouseAreaControl.PicturePanel.OnMoveOver(graph1 as SvgElement, e); return; } } } } Label_05AD: if(graphTemp!=null) //û��ѡ��ͼԪʱ������Ƴ�ͼԪ���� { //if(this.mouseAreaControl.Cursor == SpecialCursors.DragInfoCursor) this.mouseAreaControl.PicturePanel.OnMoveOut(graphTemp as SvgElement,e); graphTemp=null; // graphTemp2=null; } this.CurrentMousePoint = MousePoint.None; }
public SvgElementCollection(SvgElementCollection value) { this.NotifyEvent = false; this.AddRange(value); }
private void Break(SvgElementCollection list) { bool flag1 = this.svgDocument.AcceptChanges; this.svgDocument.AcceptChanges = true; SvgElementCollection collection1 = new SvgElementCollection(); SvgElementCollection.ISvgElementEnumerator enumerator1 = list.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement) enumerator1.Current; if ((element1 is Group) && (element1 != this.svgDocument.DocumentElement)) { collection1.Add(element1); } } this.svgDocument.NumberOfUndoOperations += (collection1.Count + 0x7d0); SvgElementCollection.ISvgElementEnumerator enumerator2 = collection1.GetEnumerator(); while (enumerator2.MoveNext()) { SvgElement element2 = (SvgElement) enumerator2.Current; XmlNode node1 = element2.NextSibling; goto Label_009B; Label_009B: if (!(node1 is SvgElement) && (node1 != null)) { node1 = node1.NextSibling; goto Label_009B; } this.Break(element2, (SvgElement) element2.ParentNode, node1); } this.svgDocument.NotifyUndo(); this.svgDocument.AcceptChanges = flag1; }
public void ChangeElementExpand(SvgElement changeelement, bool oldexpand, bool animate) { if ((changeelement is IContainer) && !animate) { SvgElementCollection collection1 = new SvgElementCollection(); if ((changeelement is IGraph) && !(changeelement is ClipPath)) { SvgElement element1 = ((IGraph) changeelement).ClipPath; if (element1 != null) { collection1.Add(element1); } } collection1.AddRange(((IContainer) changeelement).ChildList); if (this.serialize != null) { this.serialize.UpdateElementChilds(changeelement, oldexpand, collection1); } } else if (animate) { SvgElementCollection collection2 = new SvgElementCollection(); collection2.AddRange(changeelement.AnimateList); if (this.serialize != null) { this.serialize.UpdateElementChilds(changeelement, oldexpand, collection2); } } if (this.OnDocumentChanged != null) { DocumentChangedEventArgs args1 = new DocumentChangedEventArgs(); SvgElement[] elementArray1 = new SvgElement[1] { changeelement } ; args1.ChangeElements = elementArray1; this.OnDocumentChanged(this, args1); } }
private string getOuterXml(Graph graph1,Point offset,IList connectLines ,StringBuilder sb,SvgElementCollection selectCollection) { XmlElement node = graph1.Clone() as XmlElement; if(graph1 is ConnectLine) { ConnectLine cline = graph1 as ConnectLine; if(connectLines.Contains(graph1.ID) ||(cline.StartGraph==null||cline.EndGraph==null)||(!selectCollection.Contains(cline.StartGraph)||!selectCollection.Contains(cline.EndGraph))) return string.Empty; connectLines.Add(graph1.ID); }else { Matrix matrix1 =new Matrix(); if (graph1.SvgAttributes.ContainsKey("transform")) { matrix1 = (graph1.SvgAttributes["transform"] as Matrix).Clone(); } matrix1.Translate(-offset.X,-offset.Y,MatrixOrder.Append); node.SetAttribute("transform", new ItopVector.Core.Types.Transf(matrix1).ToString()); } sb.Append(node.OuterXml); foreach(Graph graph2 in graph1.ConnectLines) { getOuterXml(graph2,Point.Empty,connectLines, sb,selectCollection); } return sb.ToString(); }
public SvgDocument() { this.styleElements = new ArrayList(); this.recordanim = true; this.playAnim = false; this.controltime = 0; this.filename = "���"; this.update = true; this.undoStack = new UndoStack(); this.xmlreader = null; this.preelement = null; this.elements = new ArrayList(0x10); this.infos = new Hashtable(0x10); this.groups = new ArrayList(0x10); this.undoGroup = new ArrayList(0x10); this.errorinfos = new ArrayList(0x10); this.selectCollection = new SvgElementCollection(); this.oldSelect = new SvgElementCollection(); this.root = null; this.serialize = null; this.editRoots = new SvgElementCollection(); //this.styleSheetList = null; this.ChangeElements = new SvgElementCollection(); this.NumberOfUndoOperations = 1; this.ValidPath = new GraphicsPath(); this.firstload = false; this.FilePath = string.Empty; this.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; this.Changed = false; this.SelectChanged = false; this.OnlyShowCurrent = false; this.DefsChanged = true; this.OldControlTime = 0; this.PlayAnimChanged = false; this.AutoShowAnim = false; this.XmlParserContext = null; XmlNamespaceManager manager1 = new XmlNamespaceManager(base.NameTable); manager1.PushScope(); manager1.AddNamespace("svg", SvgDocument.SvgNamespace); manager1.AddNamespace("xlink", SvgDocument.XLinkNamespace); manager1.AddNamespace("a", SvgDocument.AudioNamespace); manager1.AddNamespace("tonli", SvgDocument.TonliNamespace); base.NodeChanged += new XmlNodeChangedEventHandler(this.ChangeNode); base.NodeInserted += new XmlNodeChangedEventHandler(this.ChangeNode); base.NodeRemoved += new XmlNodeChangedEventHandler(this.ChangeNode); this.XmlParserContext = new System.Xml.XmlParserContext(base.NameTable, manager1, "", "svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", this.BaseURI, "zh", XmlSpace.None, Encoding.UTF8); this.selectCollection.NotifyEvent = true; this.selectCollection.OnCollectionChangedEvent += new OnCollectionChangedEventHandler(this.ChangeSelect); this.serialize = new SerializeDocument(this); this.AddStyleElement(SvgDocument.SvgNamespace, "style"); this.SvgdataUid=string.Empty; layers =new SvgElementCollection(); }
// Methods public ElementExpandChangedEventArgs(SvgElement changeelemnt, SvgElementCollection list, ItopVector.Core.ExpandAction action) { this.ChangeElement = changeelemnt; this.ChangeElements = list; this.ExpandAction = action; }
protected override void OnPaint(PaintEventArgs e) { if (this.DesignMode) return; if (this.drawArea.DrawMode== DrawModeType.Normal)image=null; if (this.drawArea.CurrentOperation == ToolOperation.Roam && image!=null && beginMove) { e.Graphics.DrawImage(image,offx,offy); return; } else { Graphics g = e.Graphics; if (this.drawArea.DrawMode==DrawModeType.MemoryImage) { if(image ==null) { image = new Bitmap(Width,Height); MG = Graphics.FromImage(image); } g = MG; g.Clip = new Region(new Rectangle(0, 0, Width, Height)); } //�ϷŽ���ִ�� if (image!=null&&(Math.Abs(offx) > 0 || Math.Abs(offy) > 0) ) { if(drawArea.DrawMode == DrawModeType.ScreenImage) { g.DrawImage(image, offx, offy); Rectangle rt1 = new Rectangle(nRule, nRule, image.Width-nRule, image.Height-nRule); Rectangle rt2 = rt1; Rectangle rt3 = rt1; rt3.Offset(offx, offy); rt2.Intersect(rt3); Region rg = new Region(rt1); rg.Xor(rt2); g.Clip = rg; offx = offy = 0; image = null; } else { System.Drawing.Image image2 = new Bitmap(image.Width, image.Height); g = Graphics.FromImage(image2); g.DrawImage(image, offx, offy); Rectangle rt1 = new Rectangle(0, 0, image.Width, image.Height); Rectangle rt2 = rt1; Rectangle rt3 = rt1; rt3.Offset(offx, offy); rt2.Intersect(rt3); g.SetClip(rt2, CombineMode.Exclude); offx = offy = 0; image = image2; MG=g; } } else if (this.drawArea.DrawMode==DrawModeType.MemoryImage){g.Clear(Color.Transparent); } DateTime time1=DateTime.Now; if (this.svgDocument != null) { Matrix matrix1 = new Matrix(); matrix1.Translate(-this.virtualLeft, -this.virtualTop); matrix1.Translate(this.margin.Width, this.margin.Height); matrix1.Scale(this.scale, this.scale); GraphicsContainer container1 = g.BeginContainer(); g.SmoothingMode = this.svgDocument.SmoothingMode; if (this.svgDocument.RootElement is Group) { Group group2 = (Group) this.svgDocument.RootElement; group2.GraphTransform.Matrix = matrix1.Clone(); try { group2.Draw(g, this.svgDocument.ControlTime); } catch {} this.elementList = group2.GraphList; } g.EndContainer(container1); DateTime time2=DateTime.Now; this.DrawSelection(g); if (this.selectChanged) { RectangleF ef1 = this.selectpath.GetBounds(); this.oldselectPoint = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)); this.selectChanged = false; } if ( !this.oldselectPoint.IsEmpty ) { PointF[] tfArray1 = new PointF[1] { this.oldselectPoint } ; this.selectMatrix.TransformPoints(tfArray1); this.drawArea.CenterPoint = tfArray1[0]; if(this.drawArea.Operation==ToolOperation.FreeTransform) { g.SmoothingMode =SmoothingMode.HighQuality; PointF tf1 = this.drawArea.CenterPoint; GraphicsPath path2 = new GraphicsPath(); path2.AddEllipse(tf1.X - 2.5f, tf1.Y - 2.5f, 5f, 5f); g.FillPath(Brushes.White, path2); g.DrawPath(Pens.Blue, path2); path2.Dispose(); } } if (this.drawArea.ShowGuides) { foreach (RefLine line1 in this.drawArea.RefLines) { PointF tf2 = PointF.Empty; // int num2 = base.Width; if (line1.Hori) { tf2 = new PointF(0f, (float) line1.Pos); } else { tf2 = new PointF((float) line1.Pos, 0f); // num2 = base.Height; } tf2 = this.drawArea.PointToSystem(tf2); Pen pen1=new Pen(Color.Blue); pen1.DashStyle=DashStyle.Dash; if (line1.Hori) { g.DrawLine(pen1, 0f, tf2.Y, (float) base.Width, tf2.Y); continue; } g.DrawLine(pen1, tf2.X, 0f, tf2.X, (float) base.Height); pen1.Dispose(); } } matrix1.Dispose(); if(drawArea.DrawMode == DrawModeType.MemoryImage) { e.Graphics.DrawImage(image,0,0); } } PointF pf= this.drawArea.GetCenterPoint(); this.drawArea.ToolTip(string.Format("x:{0},y:{1}",pf.X,pf.Y),2); // drawCount++; // time2=DateTime.Now; // TimeSpan ts=time2-time1; // this.drawArea.ToolTip(this.svgDocument.SelectCollection.Count+","+this.ElementList.Count+","+ drawCount+","+ts.Seconds+":"+ts.Milliseconds+","+this.virtualLeft+":"+this.virtualTop,2); } }
// Methods public ISvgElementEnumerator(SvgElementCollection mappings) { this.temp = mappings; this.baseEnumerator = this.temp.GetEnumerator(); }
public void Jiaxian() { //if (Operateflag && tlVectorControl1.CurrentOperation == ToolOperation.AreaSelect) //{ //contextMenuStrip1.Visible = false; SvgElementCollection svgelcollect = new SvgElementCollection(); PSPDEV spsp = new PSPDEV(); spsp.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID; spsp.Type = "Polyline"; spsp.LineStatus = "待选"; IList<PSPDEV> plist = Services.BaseService.GetList<PSPDEV>("SelectPSPDEVBySvgUIDAndLineStatus", spsp); for (int i = 0; i < plist.Count; i++) { PSPDEV _p = plist[i]; SvgElement e1 = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@id='" + _p.EleID + "']") as SvgElement; if (e1 != null) { svgelcollect.Add(e1); } } // SvgElementCollection svgelcollect = tlVectorControl1.SVGDocument.SelectCollection; if (svgelcollect.Count == 0) { MessageBox.Show("当前层未发现待选线路!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } PSPDEV psp = new PSPDEV(); psp.Type = "Polyline"; psp.SvgUID = tlVectorControl1.SVGDocument.CurrentLayer.ID; int n = 0; for (int j = 0; j < svgelcollect.Count; j++) //记录要进行断开的线路 { if (svgelcollect[j].GetType().FullName == "ItopVector.Core.Figure.Polyline") { XmlElement e1 = (XmlElement)svgelcollect[j]; string str_id = e1.GetAttribute("id"); psp.EleID = str_id; PSPDEV dlg11 = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVBySvgUIDandEleID", psp); if (dlg11.LineStatus == "运行" || dlg11.LineStatus == "待选") { DelLinenum.Add(dlg11.Number); } n++; } if (svgelcollect[j].GetType().FullName == "ItopVector.Core.Figure.TransformLine") { XmlElement e1 = (XmlElement)svgelcollect[j]; string str_id = e1.GetAttribute("id"); psp.EleID = str_id; PSPDEV dlg11 = (PSPDEV)Services.BaseService.GetObject("SelectPSPDEVBySvgUIDandEleID", psp); DelTransnum.Add(dlg11.Number); n++; } } if (n == 0) { MessageBox.Show("你所选择的区域没有你要断开的线路", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); tlVectorControl1.CurrentOperation = ToolOperation.Select; return; } else { DelLinenum.Sort(); DelTransnum.Sort(); //进行区域N-1检验 QyRelanalyst(); tlVectorControl1.CurrentOperation = ToolOperation.Select; return; } //} }
public void OnMouseDown(MouseEventArgs e) { ToolOperation operation1 = this.mouseAreaControl.CurrentOperation; this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF( e.X, e.Y)); if ((OperationFunc.IsSelectOperation(operation1) || OperationFunc.IsTransformOperation(operation1)) && (e.Button == MouseButtons.Left)) { this.selectCollection = this.mouseAreaControl.SVGDocument.SelectCollection.Clone(); if ((this.currentMousePoint == MousePoint.None) && (this.toBeSelectedGraph != null)) { this.currentMousePoint = MousePoint.Translate; this.toBeSelectedPath = (GraphicsPath) this.toBeSelectedGraph.GPath.Clone(); this.toBeSelectedPath.Transform(this.toBeSelectedGraph.GraphTransform.Matrix); if (((Control.ModifierKeys != Keys.Control) && !this.selectCollection.Contains(this.toBeSelectedGraph)) && (/*!this.toBeSelectedGraph.IsLock &&*/ this.toBeSelectedGraph.DrawVisible)) { this.selectCollection.Clear(); this.selectCollection.Add(this.toBeSelectedGraph); } } if ((this.toBeSelectedGraph != null) && (Control.ModifierKeys == Keys.Shift)) { if ((!this.mouseAreaControl.SVGDocument.SelectCollection.Contains(this.toBeSelectedGraph) && !this.toBeSelectedGraph.IsLock) && this.toBeSelectedGraph.DrawVisible) { this.mouseAreaControl.SVGDocument.SelectCollection.Add(this.toBeSelectedGraph); } else if (this.mouseAreaControl.SVGDocument.SelectCollection.Contains(this.toBeSelectedGraph)) { this.mouseAreaControl.SVGDocument.SelectCollection.Remove(this.toBeSelectedGraph); } } // this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF( e.X, e.Y)); if (operation1 == ToolOperation.AreaSelect) { this.AreaPoints.Clear(); this.AreaPoints.Add(new PointF(e.X,e.Y)); } this.reversePath.Reset(); } if(OperationFunc.IsConnectLineOperation(operation1) && this.toBeSelectedGraph!=null) { //this.startpoint = new PointF((float) e.X, (float) e.Y); if(MouseArea.ConnectLinePoints==0) { MouseArea.ConLineStartPoint.X=e.X; MouseArea.ConLineStartPoint.Y=e.Y; MouseArea.SvgStartObj=this.toBeSelectedGraph; } if(MouseArea.ConnectLinePoints==1) { MouseArea.ConLineEndPoint.X=e.X; MouseArea.ConLineEndPoint.Y=e.Y; MouseArea.SvgEndObj=this.toBeSelectedGraph; } MouseArea.ConnectLinePoints+=1; } }
public void WriteDwg(string larlist) { try { AcadApplication cad; f.SetText("处理中请等待......"); f.Show(); string[] strlar = larlist.Split(','); cad=AutoCADConnector(); if (cad!=null) { //cad.ActiveDocument.Linetypes.Load("DASHEDX2", "acadiso.lin"); //cad.ActiveDocument.Linetypes.Load("ACAD_ISO03W100", "acadiso.lin"); SvgElementCollection col = new SvgElementCollection(); if (larlist == "ALL") { ArrayList Layerlist = tlVectorControl1.SVGDocument.getLayerList(); try { for (int i = 0; i < Layerlist.Count; i++) { string str = ((Layer)Layerlist[i]).Label.Replace(",", ""); str = str.Replace("(", ""); str = str.Replace(")", ""); str = str.Replace(" ", ""); str = str.Replace("-", ""); str = str.Replace(",", ""); str = str.Replace("/", ""); str = str.Replace("\\", ""); if (str == "") { str = ((Layer)Layerlist[i]).ID; } AcadLayer layer = cad.ActiveDocument.Layers.Add(str); } } catch (Exception e1) { } foreach (Layer lar in tlVectorControl1.SVGDocument.Layers) { string str = lar.Label.Replace(",", ""); str = str.Replace("(", ""); str = str.Replace(")", ""); str = str.Replace(" ", ""); str = str.Replace("-", ""); str = str.Replace(",", ""); str = str.Replace("/", ""); str = str.Replace("\\", ""); if (str == "") { str = lar.ID; } col.AddRange(lar.GraphList); f.SetText("正在处理" + str + "层,请等待......"); CallCAD(col, str, Layerlist.Count,cad); col.Clear(); } } else { ArrayList Layerlist = tlVectorControl1.SVGDocument.getLayerList(); int temp = 0; try { for (int i = 0; i < Layerlist.Count; i++) { for (int j = 0; j < strlar.Length; j++) { if (strlar[j] == ((Layer)Layerlist[i]).ID) { temp = temp + 1; string str = ((Layer)Layerlist[i]).Label.Replace(",", ""); str = str.Replace("(", ""); str = str.Replace(")", ""); str = str.Replace(" ", ""); str = str.Replace("-", ""); str = str.Replace(",", ""); str = str.Replace("/", ""); str = str.Replace("\\", ""); if (str == "") { str = ((Layer)Layerlist[i]).ID; } AcadLayer layer = cad.ActiveDocument.Layers.Add(str); continue; } } } } catch (Exception e1) { } foreach (Layer lar in tlVectorControl1.SVGDocument.Layers) { for (int n = 0; n < strlar.Length; n++) { if (strlar[n] == lar.ID) { string str = lar.Label.Replace(",", ""); str = str.Replace("(", ""); str = str.Replace(")", ""); str = str.Replace(" ", ""); str = str.Replace("-", ""); str = str.Replace(",", ""); str = str.Replace("/", ""); str = str.Replace("\\", ""); if (str == "") { str = lar.ID; } col.AddRange(lar.GraphList); f.SetText("正在处理" + str + "层,请等待......"); CallCAD(col, str, temp,cad); col.Clear(); continue; } } } } short[] filtertype = new short[4]; filtertype[0] = -4; filtertype[1] = 0; filtertype[2] = 62; filtertype[3] = -4; object[] filterDate = new object[4]; filterDate[0] = "<AND"; filterDate[1] = "HATCH"; filterDate[2] = "7"; filterDate[3] = "AND>"; cad.Visible = true; cad.ActiveDocument.SendCommand("Z e "); cad.ActiveDocument.SendCommand("audit y "); //AcadSelectionSet s = cad.ActiveDocument.SelectionSets.Add("HatchSel"); //s.SelectOnScreen((object)filtertype, (object)filterDate); //cad.Application.ActiveDocument. //int kk = s.Count; //cad.ActiveDocument.SendCommand("all "); //cad.ActiveDocument.SendCommand("draworder b "); f.Close(); } else { f.Close(); } } catch(Exception e2) { MessageBox.Show("请安装AutoCAD2006或以上版本。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
internal SelectOperation(MouseArea mousecontrol) { this.mouseAreaControl = null; this.toBeSelectedGraph = null; this.toBeSelectedPath = null; this.currentMousePoint = MousePoint.None; this.reversePath = new GraphicsPath(); this.oriPath = new GraphicsPath(); this.startpoint = PointF.Empty; this.movePoint = PointF.Empty; this.selectMatrix = new Matrix(); this.totalmatrix = new Matrix(); this.controlPoint = PointF.Empty; this.selectAreaPath = new GraphicsPath(); this.AreaPoints = new ArrayList(0x10); this.ps = new PointF[8]; this.rotateindex = 0; this.selectCollection = new SvgElementCollection(); this.tooltips = new Hashtable(0x10); this.rotatepath = new GraphicsPath(); this.mouseAreaControl = mousecontrol; this.win32 = this.mouseAreaControl.win32; this.mouseAreaControl.DefaultCursor = SpecialCursors.selectCursor; this.freeSelect = mouseAreaControl.PicturePanel.FreeSelect; }
public void AddRange(SvgElementCollection value) { bool flag1 = this.NotifyEvent; this.NotifyEvent = false; for (int num1 = 0; num1 < value.Count; num1++) { if(!this.Contains(value[num1])) this.Add(value[num1]); } this.NotifyEvent = flag1; if ((this.OnCollectionChangedEvent != null) && this.NotifyEvent) { this.OnCollectionChangedEvent(this, new CollectionChangedEventArgs(value)); } }
public SvgElementCollection Clone() { SvgElementCollection collection1 = new SvgElementCollection(); collection1.AddRange(this); return collection1; }
public void SelectAll() { this.SVGDocument.ClearSelects(); SvgElementCollection collection1=new SvgElementCollection(); foreach(Layer layer in SVGDocument.Layers) { if (!layer.Visible)continue; foreach(IGraph graph1 in layer.GraphList) { if (!graph1.IsLock) { collection1.Add(graph1); } } } if(collection1.Count>0) { this.SVGDocument.SelectCollection.AddRange(collection1); } else { this.SVGDocument.CurrentElement = this.SVGDocument.RootElement; } }
// Methods public ISvgElementEnumerator(SvgElementCollection mappings) { this.temp = mappings; this.baseEnumerator = this.temp.GetEnumerator(); }
public void OnMouseUp(MouseEventArgs e) { ToolOperation operation1 = this.mouseAreaControl.CurrentOperation; if (e.Button != MouseButtons.None) { if (e.Button == MouseButtons.Left ) { if(operation1 ==ToolOperation.WindowZoom) { ItopVector.DrawArea.DrawArea area1 = this.mouseAreaControl.PicturePanel; PointF tf13 = this.mouseAreaControl.PicturePanel.PointToSystem(startpoint); if((int)tf13.X==e.X && (int)tf13.Y==e.Y){return;} PointF Vstartpoint=this.startpoint;//this.mouseAreaControl.PicturePanel.PointToView(startpoint); PointF Vendpoint=this.mouseAreaControl.PicturePanel.PointToView(new PointF(e.X,e.Y)); float a1=820/Math.Abs(tf13.X-e.X); float a2=570/Math.Abs(tf13.Y-e.Y); //float a1=(area1.DocumentSizeEx.Width/Math.Abs(Vstartpoint.X-Vendpoint.X)); // float a2=(area1.DocumentSizeEx.Height/Math.Abs(Vstartpoint.Y-Vendpoint.Y)); // area1.VirtualLeft=(startpoint.X+e.X)/2; // area1.VirtualTop=(startpoint.Y+e.Y)/2; area1.VirtualLeft=(Vstartpoint.X+Vendpoint.X)/2; area1.VirtualTop=(Vstartpoint.Y+Vendpoint.Y)/2; float scale=area1.ScaleUnit; float vLeft=area1.VirtualLeft; float vTop=area1.VirtualTop; float XMove=vLeft-(tf13.X+e.X)/2; float YMove=vTop-(tf13.Y+e.Y)/2; float mx=((tf13.X+e.X)/2)/(area1.hScrollBar1.Maximum); float my=((tf13.Y+e.Y)/2)/(area1.vScrollBar1.Maximum); if(a1<a2) { area1.ScaleUnit *= a1; area1.VirtualLeft=area1.hScrollBar1.Maximum*mx;// +20*(area1.ScaleUnit-1);//+Math.Abs(Math.Abs(Vstartpoint.X)-Math.Abs(Vendpoint.X))/2; area1.VirtualTop=area1.vScrollBar1.Maximum*my+330;//+330*(area1.ScaleUnit-1);//+Math.Abs(Math.Abs(Vstartpoint.Y)-Math.Abs(Vendpoint.Y))/2; } else { area1.ScaleUnit *= a2; area1.VirtualLeft=area1.hScrollBar1.Maximum*mx;// +20*(area1.ScaleUnit-1);//+Math.Abs(Math.Abs(Vstartpoint.X)-Math.Abs(Vendpoint.X))/2; area1.VirtualTop=area1.vScrollBar1.Maximum*my+330;//+330*(area1.ScaleUnit-1);//+Math.Abs(Math.Abs(Vstartpoint.Y)-Math.Abs(Vendpoint.Y))/2; } goto Lable_MoveIn; } if (operation1 == ToolOperation.AreaSelect) { this.AreaPoints.Add(new PointF((float) e.X, (float) e.Y)); PointF[] tfArray1 = new PointF[this.AreaPoints.Count]; this.AreaPoints.CopyTo(tfArray1, 0); this.AreaPoints.Clear(); Matrix matrix1 = new Matrix(); this.selectAreaPath = new GraphicsPath(); this.selectAreaPath.AddLines(tfArray1); this.selectAreaPath.CloseFigure(); Region region1 = new Region(this.selectAreaPath); this.mouseAreaControl.SVGDocument.ClearSelects(); SvgElementCollection collection1 =new SvgElementCollection(); if (freeSelect) { foreach(Layer layer in this.mouseAreaControl.SVGDocument.Layers) { if(layer.Visible) { collection1.AddRange(layer.GraphList); } } } else { collection1 = this.mouseAreaControl.SVGDocument.CurrentLayer.GraphList; } SvgElementCollection.ISvgElementEnumerator enumerator1 = collection1.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph) enumerator1.Current; GraphicsPath path1 = (GraphicsPath) graph1.GPath.Clone(); path1.Transform(graph1.GraphTransform.Matrix); RectangleF ef1 = PathFunc.GetBounds(path1); if ((region1.IsVisible(ef1/*new System.Drawing.Rectangle((int) ef1.X, (int) ef1.Y, (int) ef1.Width, (int) ef1.Height)*/) && !graph1.IsLock) && (graph1.DrawVisible /*&& (AnimFunc.GetKeyIndex((SvgElement) graph1, this.mouseAreaControl.SVGDocument.ControlTime, true) >= 0)*/)) { this.mouseAreaControl.SVGDocument.AddSelectElement(graph1); } } GraphicsPath path2 = new GraphicsPath(); path2.AddLines(tfArray1); RectangleF ef2 = path2.GetBounds(); this.mouseAreaControl.Invalidate(new System.Drawing.Rectangle(((int) ef2.X) - 10, ((int) ef2.Y) - 10, ((int) ef2.Width) + 20, ((int) ef2.Height) + 20)); return; } if (this.currentMousePoint == MousePoint.CenterPoint && (((XmlElement)selectCollection[0]).GetAttribute("layer").ToString()==SvgDocument.currentLayer||freeSelect)) { PointF tf1 = this.mouseAreaControl.PicturePanel.PointToView(this.mouseAreaControl.CenterPoint); PointF tf2 = this.mouseAreaControl.CenterPoint; this.mouseAreaControl.PicturePanel.Invalidate(new System.Drawing.Rectangle(((int) tf2.X) - 6, ((int) tf2.Y) - 6, 12, 12)); SizeF ef3 = this.mouseAreaControl.PicturePanel.GridSize; float single1 = ef3.Height; float single2 = ef3.Width; PointF tf3 = startpoint;//this.mouseAreaControl.PicturePanel.PointToView(this.); PointF tf4 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y)); if (this.mouseAreaControl.PicturePanel.SnapToGrid) { int num1 = (int) ((tf3.X + (single2 / 2f)) / single2); int num2 = (int) ((tf3.Y + (single1 / 2f)) / single1); tf3 = (PointF) new Point((int) (num1 * single2), (int) (num2 * single1)); num1 = (int) ((tf4.X + (single2 / 2f)) / single2); num2 = (int) ((tf4.Y + (single1 / 2f)) / single1); tf4 = (PointF) new Point((int) (num1 * single2), (int) (single1 * num2)); } tf3 = this.mouseAreaControl.PicturePanel.PointToSystem(tf3); tf4 = this.mouseAreaControl.PicturePanel.PointToSystem(tf4); this.mouseAreaControl.PicturePanel.CenterPoint = tf4; } else if ((this.currentMousePoint != MousePoint.None) && (this.toBeSelectedPath != null)) { if ((((Control.ModifierKeys != Keys.Control) && (Control.ModifierKeys != Keys.Shift) && (this.toBeSelectedGraph != null)) && (!this.mouseAreaControl.SVGDocument.SelectCollection.Contains(this.toBeSelectedGraph) /*&& !this.toBeSelectedGraph.IsLock*/)) && this.toBeSelectedGraph.DrawVisible)// && ((XmlElement)selectCollection[0]).GetAttribute("layer").ToString()==SvgDocument.currentLayer) { this.mouseAreaControl.SVGDocument.ClearSelects(); this.mouseAreaControl.SVGDocument.AddSelectElement(this.toBeSelectedGraph); } if(mouseAreaControl.CanEdit==false || (((XmlElement)selectCollection[0]).GetAttribute("layer").ToString()!=SvgDocument.currentLayer&&!freeSelect)||(this.toBeSelectedGraph!=null && this.toBeSelectedGraph.IsLock)) { goto Lable_MoveIn; } this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle); this.win32.W32SetROP2(7); this.win32.W32PolyDraw(this.reversePath); this.win32.ReleaseDC(); PointF tf5 = this.mouseAreaControl.PicturePanel.PointToView(this.mouseAreaControl.CenterPoint); float single3 = 0f; float single4 = 0f; PointF tf6 =startpoint;// this.mouseAreaControl.PicturePanel.PointToView(this.); PointF tf7 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float) e.X, (float) e.Y)); SizeF ef4 = this.mouseAreaControl.PicturePanel.GridSize; float single5 = ef4.Height; float single6 = ef4.Width; if (this.mouseAreaControl.PicturePanel.SnapToGrid) { int num3 = (int) ((tf6.X + (single6 / 2f)) / single6); int num4 = (int) ((tf6.Y + (single5 / 2f)) / single5); tf6 = (PointF) new Point((int) (num3 * single6), (int) (num4 * single5)); num3 = (int) ((tf7.X + (single6 / 2f)) / single6); num4 = (int) ((tf7.Y + (single5 / 2f)) / single5); tf7 = (PointF) new Point((int) (num3 * single6), (int) (single5 * num4)); } PointF tf8 = this.mouseAreaControl.PicturePanel.PointToSystem(tf6); PointF tf9 = this.mouseAreaControl.PicturePanel.PointToSystem(tf7); PointF tf10 = tf6; PointF tf11 = tf7; PointF tf12 = tf5; SvgDocument document1 = this.mouseAreaControl.SVGDocument; bool flag1 = this.mouseAreaControl.PicturePanel.SVGDocument.AcceptChanges; this.mouseAreaControl.PicturePanel.SVGDocument.AcceptChanges = true; SvgDocument document2 = this.mouseAreaControl.SVGDocument; document2.NumberOfUndoOperations += (this.mouseAreaControl.SVGDocument.SelectCollection.Count + 0x7d0); SvgElementCollection.ISvgElementEnumerator enumerator2 = this.mouseAreaControl.SVGDocument.SelectCollection.GetEnumerator(); while (enumerator2.MoveNext()) { float single10; SvgElement element1 = (SvgElement) enumerator2.Current; if (!(element1 is IGraph)) { continue; } if (element1 is Use && (element1 as Use).LimitSize && currentMousePoint!=MousePoint.Translate)continue; Matrix matrix2 = ((IGraph) element1).GraphTransform.Matrix.Clone(); Matrix matrix3 = this.mouseAreaControl.PicturePanel.CoordTransform.Clone(); matrix3.Invert(); matrix2.Multiply(matrix3, MatrixOrder.Append); PointF tf13 = PointF.Empty; GraphicsPath path3 = (GraphicsPath) ((IGraph) element1).GPath.Clone(); RectangleF ef5 = PathFunc.GetBounds(path3); PointF[] tfArray6 = new PointF[9] { new PointF(ef5.X, ef5.Y), new PointF(ef5.X, ef5.Y + (ef5.Height / 2f)), new PointF(ef5.X, ef5.Bottom), new PointF(ef5.X + (ef5.Width / 2f), ef5.Y), new PointF(ef5.Right, ef5.Y), new PointF(ef5.Right, ef5.Y + (ef5.Height / 2f)), new PointF(ef5.Right, ef5.Bottom), new PointF(ef5.X + (ef5.Width / 2f), ef5.Bottom), new PointF(ef5.X + (ef5.Width / 2f), ef5.Y + (ef5.Height / 2f)) } ; PointF[] tfArray2 = tfArray6; Matrix matrix4 = matrix2.Clone(); if(matrix4.IsInvertible) matrix4.Invert(); PointF[] tfArray7 = new PointF[3] { tf10, tf11, tf12 } ; PointF[] tfArray3 = tfArray7; if(this.currentMousePoint!=MousePoint.Rotate) { matrix4.TransformPoints(tfArray3); } tf6 = tfArray3[0]; tf7 = tfArray3[1]; tf5 = tfArray3[2]; single3 = tf7.X - tf6.X; single4 = tf7.Y - tf6.Y; Matrix matrix5 = new Matrix(); PointF tf23 = this.mouseAreaControl.PicturePanel.PointToSystem(startpoint); if ((Math.Abs((float) (e.X - tf23.X)) <= 1f) && (Math.Abs((float) (e.Y - tf23.Y)) <= 1f)) { return; } switch (this.currentMousePoint) { case MousePoint.ScaleTopLeft: case MousePoint.ScaleTopMiddle: case MousePoint.ScaleTopRight: case MousePoint.ScaleMiddleLeft: case MousePoint.ScaleMiddleRight: case MousePoint.ScaleBottomLeft: case MousePoint.ScaleBottomMiddle: case MousePoint.ScaleBottomRight: { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { goto Label_101C; } if (this.currentMousePoint != MousePoint.ScaleTopLeft) { goto Label_0F60; } tf13 = tfArray2[6]; goto Label_1020; } case MousePoint.ScaleFromCenter: case MousePoint.SkewXFromCenter: case MousePoint.SkewYFromCenter: case MousePoint.RotateFromCenter: { continue; } case MousePoint.SkewXTop: case MousePoint.SkewXBottom: case MousePoint.SkewYLeft: case MousePoint.SkewYRight: { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { goto Label_16F2; } if (this.currentMousePoint != MousePoint.SkewXBottom) { goto Label_16A1; } tf13 = tfArray2[0]; goto Label_16F6; } case MousePoint.Rotate: { if ((Control.ModifierKeys & Keys.Control) != Keys.Control) { goto Label_1EAB; } tf13 = tfArray2[this.rotateindex]; goto Label_1EAF; } case MousePoint.Translate: { goto Label_09B7; } default: { continue; } } Label_09B7: if (((element1.InfoList.Count == 1) && (document1.ControlTime == 0)) || !document1.RecordAnim) { Matrix matrix6 = ((IGraph) element1).Transform.Matrix.Clone(); if (element1.SvgAttributes.ContainsKey("transform")) { Matrix matrix7 = ((Matrix) element1.SvgAttributes["transform"]).Clone(); matrix7.Invert(); matrix6.Multiply(matrix7, MatrixOrder.Append); } matrix5.Reset(); matrix5.Translate(single3, single4); Matrix matrix8 = ((IGraph) element1).Transform.Matrix.Clone(); matrix8.Multiply(matrix5); matrix6.Invert(); matrix6.Multiply(matrix8, MatrixOrder.Append); // string[] textArray1 = new string[13]; // textArray1[0] = "matrix("; // double num13 = Math.Round((double) matrix6.Elements[0], 4); // textArray1[1] = num13.ToString(); // textArray1[2] = ","; // double num14 = Math.Round((double) matrix6.Elements[1], 4); // textArray1[3] = num14.ToString(); // textArray1[4] = ","; // double num15 = Math.Round((double) matrix6.Elements[2], 4); // textArray1[5] = num15.ToString(); // textArray1[6] = ","; // double num16 = Math.Round((double) matrix6.Elements[3], 4); // textArray1[7] = num16.ToString(); // textArray1[8] = ","; // double num17 = Math.Round((double) matrix6.Elements[4], 4); // textArray1[9] = num17.ToString(); // textArray1[10] = ","; // double num18 = Math.Round((double) matrix6.Elements[5], 4); // textArray1[11] = num18.ToString(); // textArray1[12] = ")"; // string text1 = string.Concat(textArray1); // AttributeFunc.SetAttributeValue(element1, "transform", text1); (element1 as IGraph).Transform= new ItopVector.Core.Types.Transf(matrix6); this.mouseAreaControl.PicturePanel.InvalidateElement(element1); if (element1 is Use) { MoveEventArgs moveElement = new MoveEventArgs(element1, tf6, tf7); if (OnElementMove != null) { OnElementMove(element1, moveElement); } } } continue; Label_0F60: if (this.currentMousePoint == MousePoint.ScaleTopRight) { tf13 = tfArray2[2]; goto Label_1020; } if (this.currentMousePoint == MousePoint.ScaleBottomLeft) { tf13 = tfArray2[4]; goto Label_1020; } if (this.currentMousePoint == MousePoint.ScaleBottomRight) { tf13 = tfArray2[0]; goto Label_1020; } if (this.currentMousePoint == MousePoint.ScaleMiddleLeft) { tf13 = tfArray2[5]; goto Label_1020; } if (this.currentMousePoint == MousePoint.ScaleMiddleRight) { tf13 = tfArray2[1]; goto Label_1020; } if (this.currentMousePoint == MousePoint.ScaleTopMiddle) { tf13 = tfArray2[7]; goto Label_1020; } if (this.currentMousePoint == MousePoint.ScaleBottomMiddle) { tf13 = tfArray2[3]; } goto Label_1020; Label_101C: tf13 = tf5; Label_1020: single3 = (tf7.X - tf13.X) / (tf6.X - tf13.X); single4 = (tf7.Y - tf13.Y) / (tf6.Y - tf13.Y); if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { single3 = single4 = Math.Min(single3, single4); } if ((this.currentMousePoint == MousePoint.ScaleMiddleLeft) || (this.currentMousePoint == MousePoint.ScaleMiddleRight)) { single4 = 1f; } else if ((this.currentMousePoint == MousePoint.ScaleTopMiddle) || (this.currentMousePoint == MousePoint.ScaleBottomMiddle)) { single3 = 1f; } if (((element1.InfoList.Count == 1) && (document1.ControlTime == 0)) ) { Matrix matrix12 = ((IGraph) element1).Transform.Matrix.Clone(); if (element1.SvgAttributes.ContainsKey("transform")) { Matrix matrix13 = ((Matrix) element1.SvgAttributes["transform"]).Clone(); if(matrix13.IsInvertible) matrix13.Invert(); matrix12.Multiply(matrix13, MatrixOrder.Append); } matrix5.Reset(); matrix5.Translate(tf13.X, tf13.Y, MatrixOrder.Prepend); matrix5.Scale(single3, single4, MatrixOrder.Prepend); matrix5.Translate(-tf13.X, -tf13.Y, MatrixOrder.Prepend); Matrix matrix14 = ((IGraph) element1).Transform.Matrix.Clone(); matrix14.Multiply(matrix5); if(matrix12.IsInvertible) matrix12.Invert(); matrix12.Multiply(matrix14, MatrixOrder.Append); string[] textArray2 = new string[13]; textArray2[0] = "matrix("; double num19 = Math.Round((double) matrix12.Elements[0], 2); textArray2[1] = num19.ToString(); textArray2[2] = ","; double num20 = Math.Round((double) matrix12.Elements[1], 2); textArray2[3] = num20.ToString(); textArray2[4] = ","; double num21 = Math.Round((double) matrix12.Elements[2], 2); textArray2[5] = num21.ToString(); textArray2[6] = ","; double num22 = Math.Round((double) matrix12.Elements[3], 2); textArray2[7] = num22.ToString(); textArray2[8] = ","; double num23 = Math.Round((double) matrix12.Elements[4], 2); textArray2[9] = num23.ToString(); textArray2[10] = ","; double num24 = Math.Round((double) matrix12.Elements[5], 2); textArray2[11] = num24.ToString(); textArray2[12] = ")"; string text2 = string.Concat(textArray2); AttributeFunc.SetAttributeValue(element1, "transform", text2); this.mouseAreaControl.PicturePanel.InvalidateElement(element1); } continue; Label_16A1: if (this.currentMousePoint == MousePoint.SkewXTop) { tf13 = tfArray2[6]; goto Label_16F6; } if (this.currentMousePoint == MousePoint.SkewYLeft) { tf13 = tfArray2[4]; goto Label_16F6; } if (this.currentMousePoint == MousePoint.SkewYRight) { tf13 = tfArray2[0]; } goto Label_16F6; Label_16F2: tf13 = tf5; Label_16F6: single3 /= (tfArray2[6].Y - tfArray2[4].Y); single4 /= (tfArray2[6].X - tfArray2[2].X); if ((this.currentMousePoint == MousePoint.SkewXTop) || (this.currentMousePoint == MousePoint.SkewXBottom)) { single4 = 0f; if (this.currentMousePoint == MousePoint.SkewXTop) { single3 = -single3; } } else if ((this.currentMousePoint == MousePoint.SkewYLeft) || (this.currentMousePoint == MousePoint.SkewYRight)) { single3 = 0f; if (this.currentMousePoint == MousePoint.SkewYLeft) { single4 = -single4; } } single3 = (single3 == 0f) ? 0f : ((single3 / Math.Abs(single3)) * Math.Min(Math.Abs(single3), (float) 3f)); single4 = (single4 == 0f) ? 0f : ((single4 / Math.Abs(single4)) * Math.Min(Math.Abs(single4), (float) 3f)); float single8 = (float) ((Math.Atan((double) single3) / 3.1415926535897931) * 180); float single9 = (float) ((Math.Atan((double) single4) / 3.1415926535897931) * 180); matrix5.Translate(tf13.X, tf13.Y, MatrixOrder.Prepend); matrix5.Shear(single3, single4, MatrixOrder.Prepend); matrix5.Translate(-tf13.X, -tf13.Y, MatrixOrder.Prepend); if (((element1.InfoList.Count == 1) && (document1.ControlTime == 0))) { Matrix matrix15 = ((IGraph) element1).Transform.Matrix.Clone(); if (element1.SvgAttributes.ContainsKey("transform")) { Matrix matrix16 = ((Matrix) element1.SvgAttributes["transform"]).Clone(); matrix16.Invert(); matrix15.Multiply(matrix16, MatrixOrder.Append); } matrix5.Reset(); single8 = (float) ((Math.Atan((double) single3) / 3.1415926535897931) * 180); single9 = (float) ((Math.Atan((double) single4) / 3.1415926535897931) * 180); matrix5.Translate(tf13.X, tf13.Y, MatrixOrder.Prepend); matrix5.Shear(single3, single4, MatrixOrder.Prepend); matrix5.Translate(-tf13.X, -tf13.Y, MatrixOrder.Prepend); Matrix matrix17 = ((IGraph) element1).Transform.Matrix.Clone(); matrix17.Multiply(matrix5); matrix15.Invert(); matrix15.Multiply(matrix17, MatrixOrder.Append); string[] textArray3 = new string[13]; textArray3[0] = "matrix("; double num25 = Math.Round((double) matrix15.Elements[0], 2); textArray3[1] = num25.ToString(); textArray3[2] = ","; double num26 = Math.Round((double) matrix15.Elements[1], 2); textArray3[3] = num26.ToString(); textArray3[4] = ","; double num27 = Math.Round((double) matrix15.Elements[2], 2); textArray3[5] = num27.ToString(); textArray3[6] = ","; double num28 = Math.Round((double) matrix15.Elements[3], 2); textArray3[7] = num28.ToString(); textArray3[8] = ","; double num29 = Math.Round((double) matrix15.Elements[4], 2); textArray3[9] = num29.ToString(); textArray3[10] = ","; double num30 = Math.Round((double) matrix15.Elements[5], 2); textArray3[11] = num30.ToString(); textArray3[12] = ")"; string text3 = string.Concat(textArray3); AttributeFunc.SetAttributeValue(element1, "transform", text3); this.mouseAreaControl.PicturePanel.InvalidateElement(element1); } continue; Label_1EAB: tf13 = tf5; Label_1EAF: single10 = 0f; float single11 = (float) Math.Atan((double) ((tf6.Y - tf13.Y) / (tf6.X - tf13.X))); float single12 = (float) Math.Atan((double) ((tf7.Y - tf13.Y) / (tf7.X - tf13.X))); single10 = ((float) (((double) (single12 - single11)) / 3.1415926535897931)) * 180f; if (((tf7.X - tf13.X) * (tf6.X - tf13.X)) < 0f) { single10 += 180f; } if (((Control.ModifierKeys & Keys.Shift) == Keys.Shift) && (single10 != 0f)) { single10 = (single10 / Math.Abs(single10)) * ((((int) (Math.Abs(single10) + 23f)) / 0x2d) * 0x2d); } if (single10 < 0f) { single10 += 360f; } if (((element1.InfoList.Count == 1) && (document1.ControlTime == 0)) || !document1.RecordAnim) { using(Matrix matrix18 = ((IGraph) element1).Transform.Matrix.Clone()) { if (element1.SvgAttributes.ContainsKey("transform")) { using(Matrix matrix19 = ((Matrix) element1.SvgAttributes["transform"]).Clone()) { matrix19.Invert(); matrix18.Multiply(matrix19, MatrixOrder.Append); } } matrix5.Reset(); matrix5.RotateAt(single10, tf13); using(Matrix matrix20 = ((IGraph) element1).Transform.Matrix.Clone()) { if(this.currentMousePoint==MousePoint.Rotate) { matrix20.Multiply(matrix5,MatrixOrder.Append); } else { matrix20.Multiply(matrix5); } matrix18.Invert(); matrix18.Multiply(matrix20, MatrixOrder.Append); } string[] textArray4 = new string[13]; textArray4[0] = "matrix("; double num31 = Math.Round((double) matrix18.Elements[0], 2); textArray4[1] = num31.ToString(); textArray4[2] = ","; double num32 = Math.Round((double) matrix18.Elements[1], 2); textArray4[3] = num32.ToString(); textArray4[4] = ","; double num33 = Math.Round((double) matrix18.Elements[2], 2); textArray4[5] = num33.ToString(); textArray4[6] = ","; double num34 = Math.Round((double) matrix18.Elements[3], 2); textArray4[7] = num34.ToString(); textArray4[8] = ","; double num35 = Math.Round((double) matrix18.Elements[4], 2); textArray4[9] = num35.ToString(); textArray4[10] = ","; double num36 = Math.Round((double) matrix18.Elements[5], 2); textArray4[11] = num36.ToString(); textArray4[12] = ")"; string text4 = string.Concat(textArray4); AttributeFunc.SetAttributeValue(element1, "transform", text4); this.mouseAreaControl.PicturePanel.InvalidateElement(element1); } } } this.mouseAreaControl.SVGDocument.NotifyUndo(); this.mouseAreaControl.SVGDocument.AcceptChanges = flag1; if (this.currentMousePoint == MousePoint.Translate) { Matrix matrix21 = new Matrix(); matrix21.Translate(tf9.X - tf8.X, tf9.Y - tf8.Y); PointF[] tfArray10 = new PointF[1] { this.mouseAreaControl.CenterPoint } ; PointF[] tfArray5 = tfArray10; matrix21.TransformPoints(tfArray5); this.mouseAreaControl.CenterPoint = tfArray5[0]; } } else if (this.mouseAreaControl.CanEdit&&(this.currentMousePoint == MousePoint.None) && (OperationFunc.IsSelectOperation(operation1) || OperationFunc.IsTransformOperation(operation1))) { //��ѡ�� this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle); this.win32.W32SetROP2(7); this.win32.W32PolyDraw(this.reversePath); this.win32.ReleaseDC(); PointF tf14 = new PointF((float) e.X, (float) e.Y); PointF tf15 =startpoint;// this.mouseAreaControl.PicturePanel.PointToView(this.); PointF tf16 = this.mouseAreaControl.PicturePanel.PointToView(tf14); float single13 = this.mouseAreaControl.PicturePanel.ScaleUnit; float single14 = Math.Min(tf15.X, tf16.X); float single15 = Math.Min(tf15.Y, tf16.Y); float single16 = Math.Max(tf15.X, tf16.X); float single17 = Math.Max(tf15.Y, tf16.Y); this.selectAreaPath = new GraphicsPath(); this.selectAreaPath.AddRectangle(new RectangleF(single14, single15, single16 - single14, single17 - single15)); Matrix matrix22 = this.mouseAreaControl.PicturePanel.CoordTransform.Clone(); this.selectAreaPath.Transform(matrix22); RectangleF ef6 = PathFunc.GetBounds(this.selectAreaPath); this.mouseAreaControl.SVGDocument.ClearSelects(); SvgElementCollection collection1 =null;// this.mouseAreaControl.PicturePanel.ElementList; if ( !freeSelect) { ILayer layer1 = this.mouseAreaControl.SVGDocument.Layers[SvgDocument.currentLayer] as ILayer; if(layer1 ==null)return; collection1 = layer1.GraphList; // } else { collection1 =this.mouseAreaControl.PicturePanel.ElementList; } if (collection1 == null) { return; } int num11 = 0; SvgElementCollection collection2 = new SvgElementCollection(); SvgElementCollection.ISvgElementEnumerator enumerator3 = collection1.GetEnumerator(); while (enumerator3.MoveNext()) { IGraph graph2 = (IGraph) enumerator3.Current; if ((graph2.CanSelect&&!graph2.IsLock && graph2.DrawVisible) && graph2.Visible ) { GraphicsPath path4 = (GraphicsPath) graph2.GPath.Clone(); path4.Transform(graph2.GraphTransform.Matrix); RectangleF ef7 = PathFunc.GetBounds(path4); if (ef6.Contains(ef7)) { //int num12 = AnimFunc.GetKeyIndex((SvgElement) graph2, this.mouseAreaControl.SVGDocument.ControlTime, true); collection2.Add((SvgElement) graph2); num11++; } } } if (collection2.Count > 0) { this.mouseAreaControl.SVGDocument.SelectCollection.AddRange(collection2); } else { this.mouseAreaControl.SVGDocument.CurrentElement = (SvgElement) this.mouseAreaControl.SVGDocument.DocumentElement; } } else if(OperationFunc.IsConnectLineOperation(operation1) ) { string type=""; if(MouseArea.ConnectLinePoints==2) { switch (operation1) { case ToolOperation.ConnectLine_Line: type="line"; break; case ToolOperation.ConnectLine_Polyline: type="polyline"; break; case ToolOperation.ConnectLine_Rightangle: type="rightangle"; break; case ToolOperation.ConnectLine_Spline: type="spline"; break; } XmlElement n1=this.mouseAreaControl.SVGDocument.CreateElement("tonli","connectline","http://www.tonli.com/tonli"); n1.SetAttribute("x1",MouseArea.ConLineStartPoint.X.ToString()); n1.SetAttribute("y1",MouseArea.ConLineStartPoint.Y.ToString()); n1.SetAttribute("x2",MouseArea.ConLineEndPoint.X.ToString()); n1.SetAttribute("y2",MouseArea.ConLineEndPoint.Y.ToString()); n1.SetAttribute("start","#"+MouseArea.SvgStartObj.ID); n1.SetAttribute("end","#"+MouseArea.SvgEndObj.ID); n1.SetAttribute("type",type); n1.SetAttribute("layer",SvgDocument.currentLayer); this.mouseAreaControl.SVGDocument.RootElement.AppendChild(n1); MouseArea.ConnectLinePoints=0; ToolOperation oper=this.mouseAreaControl.CurrentOperation; this.mouseAreaControl.CurrentOperation=ToolOperation.Select; this.mouseAreaControl.CurrentOperation=oper; } } }//������̧�� Lable_MoveIn: this.toBeSelectedGraph = null; this.toBeSelectedPath = null; this.reversePath.Reset(); this.CurrentMousePoint = this.currentMousePoint; } }
public void UpdateElementChilds(SvgElement element, bool oldexpand, SvgElementCollection list) { if (oldexpand) { SvgElementCollection.ISvgElementEnumerator enumerator1 = list.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement) enumerator1.Current; this.RemoveElement(element1); } } else { int num1 = this.flowChilds.IndexOf(element); if ((num1 + 1) < this.flowChilds.Count) { for (int num2 = list.Count - 1; num2 >= 0; num2--) { this.Insert(num1 + 1, (SvgElement) list[num2]); } } else { SvgElementCollection.ISvgElementEnumerator enumerator2 = list.GetEnumerator(); while (enumerator2.MoveNext()) { SvgElement element2 = (SvgElement) enumerator2.Current; this.AddElement(element2); } } } }