public virtual void Draw(Graphics g, int time) { if (this.DrawVisible) { // int num1 = 0; // int num2 = 0; // if (this.pretime != time) // { // AnimFunc.CreateAnimateValues(this, time, out num1, out num2); // } GraphicsContainer container1 = g.BeginContainer(); g.SmoothingMode = base.OwnerDocument.SmoothingMode; if (!this.Visible) { g.SetClip(Rectangle.Empty); } Matrix matrix1 = this.Transform.Matrix.Clone(); this.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend); //g.Transform = matrix1; ClipAndMask.ClipPath.Clip(g, time, this); this.TempFillOpacity = Math.Min(1f, this.FillOpacity); this.TempOpacity = Math.Min(1f, this.Opacity); this.TempStrokeOpacity = Math.Min(1f, this.StrokeOpacity); Matrix matrix2 = this.GraphTransform.Matrix.Clone(); if (this.pretime != time) { this.graphPath.Reset(); foreach (IGraph childgraph in this.graphList) { childgraph.ShowConnectPoints = false; } } SvgElementCollection.ISvgElementEnumerator enumerator1 = this.graphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.GraphTransform.Matrix = matrix2.Clone(); graph1.Draw(g, time); if ((this.pretime != time)) { GraphicsPath path1 = (GraphicsPath)graph1.GPath.Clone(); path1.Transform(graph1.Transform.Matrix); this.graphPath.StartFigure(); if (path1.PointCount > 0) { this.graphPath.AddPath(path1, false); } } } if (this.pretime != time) { this.CreateConnectPoint(); } this.DrawConnect(g); ClipAndMask.ClipPath.DrawClip(g, time, this); g.EndContainer(container1); this.pretime = time; } }
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); } } } }
public static GraphicsPath GetPathFromGraph(IGraph graph) { GraphicsPath path1 = new GraphicsPath(); if (graph is ItopVector.Core.Figure.Group) { SvgElementCollection.ISvgElementEnumerator enumerator1 = ((ItopVector.Core.Figure.Group)graph).GraphList.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; if (element1 is IGraph) { GraphicsPath path2 = PathFunc.GetPathFromGraph((IGraph)element1); if (path2.PointCount > 0) { path1.StartFigure(); path1.AddPath(path2, false); } } } return(path1); } path1 = (GraphicsPath)graph.GPath.Clone(); path1.Transform(graph.Transform.Matrix); return(path1); }
public void AddElement(SvgElement element) { if (!this.flowChilds.Contains(element)) { this.flowChilds.Add(element); } if (element.ShowParticular) { this.flowChilds.AddRange(element.AnimateList); } if (element is IGraph) { ClipPath path1 = ((IGraph)element).ClipPath; if (path1 != null) { this.AddElement(path1); } } if ((element is IContainer) && element.ShowChilds) { SvgElementCollection.ISvgElementEnumerator enumerator1 = ((IContainer)element).ChildList.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; this.AddElement(element1); } } }
public void RemoveElement(SvgElement element) { if (this.flowChilds.Contains(element)) { this.flowChilds.Remove(element); } if (element is IContainer) { SvgElementCollection.ISvgElementEnumerator enumerator1 = ((IContainer)element).ChildList.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; this.RemoveElement(element1); } } if ((element is IGraph) && (((IGraph)element).ClipPath != null)) { this.RemoveElement(((IGraph)element).ClipPath); } SvgElementCollection.ISvgElementEnumerator enumerator2 = element.AnimateList.GetEnumerator(); while (enumerator2.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator2.Current; if (this.flowChilds.Contains(animate1)) { this.flowChilds.Remove(animate1); } } }
public override void Draw(Graphics g, int time) { // this.GPath.Reset(); GraphicsContainer container1 = g.BeginContainer(); g.SmoothingMode = base.OwnerDocument.SmoothingMode; Matrix matrix1 = base.Transform.Matrix.Clone(); if (!base.Visible) { g.SetClip(Rectangle.Empty); } markerTransForm.Multiply(matrix1, MatrixOrder.Prepend); base.GraphTransform.Matrix.Multiply(markerTransForm, MatrixOrder.Prepend); SvgElementCollection.ISvgElementEnumerator enumerator1 = base.GraphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.GraphTransform.Matrix = base.GraphTransform.Matrix.Clone(); graph1.IsMarkerChild = IsMarkerChild; graph1.Draw(g, time); } this.pretime = time; g.EndContainer(container1); }
private void ChangeRecordAnim(object sender, EventArgs e) { SvgElementCollection.ISvgElementEnumerator enumerator1 = this.svgDocument.SelectCollection.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; this.InvalidateElement(element1); } }
private void NotifyChange(object sender, EventArgs e) { SvgElementCollection.ISvgElementEnumerator enumerator1 = this.changeelements.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; this.InvalidateElement(element1); } this.changeelements.Clear(); }
public override void Draw(Graphics g, int time) { Matrix matrix1 = base.GraphTransform.Matrix.Clone(); matrix1.Multiply(base.Transform.Matrix, MatrixOrder.Prepend); XmlNode node1 = this.ParentNode; if (this.UseElement != null) { node1 = this.UseElement; } if (node1 is IGraphPath && !(node1 is SVG)) { base.TempFillOpacity = ((IGraphPath)node1).TempFillOpacity; base.TempOpacity = ((IGraphPath)node1).TempOpacity; base.TempStrokeOpacity = ((IGraphPath)node1).TempStrokeOpacity; } this.graphPath.Reset(); SvgElementCollection.ISvgElementEnumerator enumerator1 = base.GraphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.GraphTransform.Matrix = matrix1.Clone(); graph1.Draw(g, time); // if ((this.pretime != time)) // { // GraphicsPath path1 = (GraphicsPath) graph1.GPath.Clone(); // path1.Transform(graph1.Transform.Matrix); // if(graph1 is Text) // { // this.graphPath.AddRectangle(path1.GetBounds()); // }else if (path1.PointCount > 0) // { // this.graphPath.StartFigure(); // this.graphPath.AddPath(path1, false); // } // } } this.pretime = time; }
public void Insert(int index, SvgElement element) { if (!this.flowChilds.Contains(element)) { this.flowChilds.Insert(index, element); } index++; if (element.ShowParticular) { SvgElementCollection.ISvgElementEnumerator enumerator1 = element.AnimateList.GetEnumerator(); while (enumerator1.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current; if (!this.flowChilds.Contains(animate1)) { this.flowChilds.Insert(index, animate1); index++; } } } if (element is IGraph) { ClipPath path1 = ((IGraph)element).ClipPath; if (path1 != null) { this.Insert(index, path1); } } if (element is IContainer) { SvgElementCollection.ISvgElementEnumerator enumerator2 = ((IContainer)element).ChildList.GetEnumerator(); while (enumerator2.MoveNext()) { SvgElement element1 = (SvgElement)enumerator2.Current; this.Insert(index, element1); } } }
public override void Draw(Graphics g, int time) { Matrix matrix1 = base.GraphTransform.Matrix.Clone(); if (this.pretime != time) { this.graphPath.Reset(); } SvgElementCollection.ISvgElementEnumerator enumerator1 = base.GraphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.GraphTransform.Matrix = matrix1.Clone(); graph1.Draw(g, time); if ((this.pretime != time) && !base.OwnerDocument.PlayAnim) { GraphicsPath path1 = (GraphicsPath)graph1.GPath.Clone(); path1.Transform(graph1.Transform.Matrix); this.graphPath.AddPath(path1, false); } } this.pretime = time; }
public void DrawInBox(Graphics g, RectangleF box, GraphicsUnit gu) { if (box.IsEmpty) { return; } GraphicsContainer gc = g.BeginContainer(box, this.GPath.GetBounds(), gu); SvgElementCollection.ISvgElementEnumerator enumerator1 = base.GraphList.GetEnumerator(); Matrix matrix1 = base.GraphTransform.Matrix.Clone(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; Matrix matrix2 = graph1.GraphTransform.Matrix; graph1.GraphTransform.Matrix = new Matrix(); graph1.Draw(g, 0); } g.EndContainer(gc); }
public static float[] GetKeys(SvgElement element) { ArrayList list1 = new ArrayList(0x10); list1.Add(0f); SvgElementCollection.ISvgElementEnumerator enumerator1 = element.AnimateList.GetEnumerator(); while (enumerator1.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current; foreach (string text1 in animate1.VirtualTimes) { float single1 = (float)Math.Round((double)ItopVector.Core.Func.Number.ParseFloatStr(text1), 5); single1 = (float)Math.Round((double)(animate1.Begin + (single1 * animate1.Duration)), 1); if (!list1.Contains(single1)) { list1.Add(single1); } } } float[] singleArray1 = new float[list1.Count]; list1.CopyTo(singleArray1, 0); Array.Sort(singleArray1, (Array)null, (IComparer)null); return(singleArray1); }
public void Paint(GraphicsPath path, Graphics g, int time, float opacity) { int num1 = 0; int num2 = 0; GraphicsContainer container1 = g.BeginContainer(); AnimFunc.CreateAnimateValues(this, time, out num1, out num2); g.SmoothingMode = base.OwnerDocument.SmoothingMode; bool flag1 = this.Units == Units.UserSpaceOnUse; float single1 = this.X; float single2 = this.Y; float single3 = this.Width; float single4 = this.Height; ItopVector.Core.Types.ViewBox box1 = TypeFunc.ParseViewBox(this); Matrix matrix1 = new Matrix(); if (box1 != null) { matrix1 = box1.GetViewMatrix(this); } RectangleF ef1 = path.GetBounds(); if (!flag1) { single1 *= ef1.Width; single2 *= ef1.Height; single3 = (int)Math.Min((float)(single3 * ef1.Width), ef1.Width); single4 = (int)Math.Min((float)(single4 * ef1.Height), ef1.Height); } this.coord = matrix1.Clone(); PointF[] tfArray1 = new PointF[7] { new PointF(single1 + (single3 / 2f), single2 + (single4 / 2f)), new PointF(single1, single2 + (single4 / 2f)), new PointF(single1 + single3, single2), new PointF(single1 + (single3 / 2f), single2), new PointF(single1 + single3, single2 + (single4 / 2f)), new PointF(single1 + (single3 / 2f), single2 + single4), new PointF(single1, single2 + single4) }; this.boundsPoints = tfArray1; this.graidentPath = new GraphicsPath(); this.graidentPath.AddRectangle(new RectangleF(single1, single2, single3, single4)); Bitmap bitmap1 = new Bitmap((int)single3, (int)single4); Graphics graphics1 = Graphics.FromImage(bitmap1); Matrix matrix2 = matrix1.Clone(); graphics1.Transform = matrix2; SvgElementCollection.ISvgElementEnumerator enumerator1 = this.graphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.Draw(graphics1, time); } TextureBrush brush1 = new TextureBrush(bitmap1, new RectangleF(single1, single2, single3, single4)); brush1.WrapMode = WrapMode.Tile; brush1.Transform = this.Transform.Matrix; Matrix matrix3 = new Matrix(1f, 0f, 0f, 1f, ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)); this.graidentPath.Transform(matrix3); matrix3.TransformPoints(this.boundsPoints); g.FillPath(brush1, path); bitmap1.Dispose(); brush1.Dispose(); g.EndContainer(container1); }
public override void Draw(Graphics g, int time) { float single5; float single6; float single7; float single8; float single11; float single12; float single13; Matrix matrix1; ItopVector.Core.Types.ViewBox box1 = null; if (this.pretime != base.OwnerDocument.ControlTime) { box1 = TypeFunc.ParseViewBox(this); this.ViewBox = box1; } box1 = this.ViewBox; parAlign align1 = parAlign.none; parMeetOrSlice slice1 = parMeetOrSlice.slice; float single1 = this.Width; float single2 = this.Height; float single3 = 0f; float single4 = 0f; if (box1 != null) { single1 = box1.width; single2 = box1.height; single3 = box1.min_x; single4 = box1.min_y; PreserveAspectRatio ratio1 = box1.psr; align1 = ratio1.Align; slice1 = ratio1.Mos; } float single9 = this.width / single1; float single10 = this.height / single2; GraphicsContainer container1 = g.BeginContainer(); g.SmoothingMode = base.OwnerDocument.SmoothingMode; if (single9 >= single10) { single12 = single9; single13 = single10; } else { single12 = single10; single13 = single9; } if (slice1 == parMeetOrSlice.meet) { single11 = single13; single7 = single1 * single11; single8 = single2 * single11; switch (align1) { case parAlign.xMinYMin: { single5 = this.X - single3; single6 = this.Y - single4; goto Label_03D1; } case parAlign.xMidYMin: { single5 = ((this.Width - single7) / 2f) - single3; single6 = this.Y - single4; goto Label_03D1; } case parAlign.xMaxYMin: { single5 = (this.Width - single7) - single3; single6 = this.Y - single4; goto Label_03D1; } case parAlign.xMinYMid: { single5 = this.X - single3; single6 = ((this.Height - single8) / 2f) - single4; goto Label_03D1; } case parAlign.xMidYMid: { single5 = ((this.Width - single7) / 2f) - single3; single6 = ((this.Height - single8) / 2f) - single4; goto Label_03D1; } case parAlign.xMaxYMid: { single5 = (this.Width - single7) - single3; single6 = ((this.Height - single8) / 2f) - single4; goto Label_03D1; } case parAlign.xMinYMax: { single5 = this.X - single3; single6 = (this.Height - single8) - single4; goto Label_03D1; } case parAlign.xMidYMax: { single5 = ((this.Width - single7) / 2f) - single3; single6 = (this.Height - single8) - single4; goto Label_03D1; } case parAlign.xMaxYMax: { single5 = (this.Width - single7) - single3; single6 = (this.Height - single8) - single4; goto Label_03D1; } } single5 = this.X - single3; single6 = this.Y - single4; single7 = single1; single8 = single2; } else { single11 = single12; single7 = this.Width / single11; single8 = this.Height / single11; switch (align1) { case parAlign.xMinYMin: { single5 = this.X + single3; single6 = this.Y + single4; goto Label_03D1; } case parAlign.xMidYMin: { single5 = ((single1 - single7) / 2f) + single3; single6 = this.Y + single4; goto Label_03D1; } case parAlign.xMaxYMin: { single5 = (single1 - single7) + single3; single6 = this.Y + single4; goto Label_03D1; } case parAlign.xMinYMid: { single5 = this.X + single3; single6 = ((single2 - single8) / 2f) + single4; goto Label_03D1; } case parAlign.xMidYMid: { single5 = ((single1 - single7) / 2f) + single3; single6 = ((single2 - single8) / 2f) + single4; goto Label_03D1; } case parAlign.xMaxYMid: { single5 = (single1 - single7) + single3; single6 = ((single2 - single8) / 2f) + single4; goto Label_03D1; } case parAlign.xMinYMax: { single5 = this.X + single3; single6 = (single2 - single8) + single4; goto Label_03D1; } case parAlign.xMidYMax: { single5 = ((single1 - single7) / 2f) + single3; single6 = (single2 - single8) + single4; goto Label_03D1; } case parAlign.xMaxYMax: { single5 = (single1 - single7) + single3; single6 = (single2 - single8) + single4; goto Label_03D1; } } single5 = this.X + single3; single6 = this.Y + single4; single7 = single1; single8 = single2; } Label_03D1: matrix1 = base.GraphTransform.Matrix; if ((this.Width != 0f) && (this.Height != 0f)) { float single14 = this.width / single7; float single15 = this.height / single8; // g.ScaleTransform(single14, single15); matrix1.Scale(single14, single15); } if (base.OwnerDocument.DocumentElement == this) { // g.TranslateTransform(single5, single6); matrix1.Translate(single5, single6); } else { // g.TranslateTransform(single5 - this.x, single6 - this.y); matrix1.Translate(single5 - this.x, single6 - this.y); } foreach (Layer layer in OwnerDocument.Layers) { if (!layer.Visible) { continue; } SvgElementCollection.ISvgElementEnumerator enumerator1 = layer.GraphList.GetEnumerator(); contectbounds = RectangleF.Empty; while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.ShowConnectPoints = base.OwnerDocument.ShowConnectPoints; try { // if(graph1.LimitSize) // { // PointF [] points = {new PointF( matrix1.OffsetX,matrix1.OffsetY)}; // matrix1.TransformVectors(points); // graph1.GraphTransform.Matrix = new Matrix(1,0,0,1,points[0].X,points[0].Y); // } // else graph1.GraphTransform.Matrix = matrix1.Clone(); using (Matrix matrix2 = new Matrix()) { if (graph1 is ConnectLine) { graph1.Draw(g, time); continue; } matrix2.Multiply(matrix1, MatrixOrder.Prepend); matrix2.Multiply(graph1.Transform.Matrix, MatrixOrder.Prepend); //(graph1 as ConnectLine).UpatePath(g); RectangleF rtf1 = graph1.GPath.GetBounds(matrix2); if (!(graph1 is Text)) { rtf1.Width++; rtf1.Height++; } if (g.IsVisible(rtf1) || (rtf1 == RectangleF.Empty) || (graph1 is ConnectLine && graph1.GPath.PointCount == 0)) { graph1.Draw(g, time); } else { graph1.GraphTransform.Matrix.Multiply(graph1.Transform.Matrix, MatrixOrder.Prepend); #if debug int i = 0; i++; #endif } } } catch (Exception e) { } finally { graph1 = null; } } } this.pretime = time; g.EndContainer(container1); }
public static void CreateAnimateValues(ISvgElement svgelement, int time, int maxbegin) { if (svgelement is SvgElement) { SvgElement element1 = (SvgElement)svgelement; element1.AnimateNameValues.Clear(); Hashtable hashtable1 = new Hashtable(0x10); int num1 = 0; int num2 = 0; int num3 = 0; SvgElementCollection.ISvgElementEnumerator enumerator1 = element1.AnimateList.GetEnumerator(); while (enumerator1.MoveNext()) { ItopVector.Core.Animate.Animate animate1 = (ItopVector.Core.Animate.Animate)enumerator1.Current; if (animate1.Begin < maxbegin) { string text1 = animate1.GetAttribute("additive").Trim(); if (((text1 == null) || (text1 == string.Empty)) && (animate1 is MotionAnimate)) { text1 = "sum"; } bool flag1 = text1 == "sum"; string text2 = animate1.AttributeName; int num4 = animate1.Begin; DomType type1 = DomTypeFunc.GetTypeOfAttributeName(text2); object obj1 = animate1.GetAnimateResult((float)time, type1); if ((obj1 != null) && (obj1.ToString() != string.Empty)) { if (element1.AnimateNameValues.ContainsKey(text2)) { AnimateInfo info1 = (AnimateInfo)element1.AnimateNameValues[text2]; info1.Add(obj1, num4, flag1); } else { AnimateInfo info2 = new AnimateInfo(); info2.Add(obj1, num4, flag1); element1.AnimateNameValues.Add(text2, info2); } } if (num1 == 0) { num2 = num4; num3 = num4 + animate1.Duration; continue; } num2 = Math.Min(animate1.Begin, num2); num3 = Math.Max((int)(num4 + animate1.Duration), num3); } } foreach (string text3 in element1.AnimateNameValues.Keys) { DomType type2 = DomTypeFunc.GetTypeOfAttributeName(text3); if (element1.SvgAttributes.ContainsKey(text3)) { object obj2 = element1.SvgAttributes[text3]; object obj3 = AnimFunc.GetAnimateValue(element1, text3, type2, obj2); if (element1.SvgAnimAttributes.ContainsKey(text3)) { element1.SvgAnimAttributes[text3] = obj3; } else { element1.SvgAnimAttributes.Add(text3, obj3); } continue; } object obj4 = null; object obj5 = AnimFunc.GetAnimateValue(element1, text3, type2, obj4); if (element1.SvgAnimAttributes.ContainsKey(text3)) { element1.SvgAnimAttributes[text3] = obj5; continue; } element1.SvgAnimAttributes.Add(text3, obj5); } } }
public void OnMouseDown(MouseEventArgs e) { bool flag2; bool flag3; PointF tf1; if (e.Button == MouseButtons.Left) { //wlwl this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF(e.X, e.Y)); if (this.mouseAreaControl.CurrentOperation == ToolOperation.XPolyLine) { if (points.Length > 0) { this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, points[0].Y)); } else { this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, (float)e.Y)); } } if (this.mouseAreaControl.CurrentOperation == ToolOperation.YPolyLine) { if (points.Length > 0) { this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF(points[0].X, (float)e.Y)); } else { this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, (float)e.Y)); } } if (this.mouseAreaControl.CurrentOperation == ToolOperation.PolyLine || this.mouseAreaControl.CurrentOperation == ToolOperation.Polygon || this.mouseAreaControl.CurrentOperation == ToolOperation.InterEnclosure || this.mouseAreaControl.CurrentOperation == ToolOperation.Enclosure || this.mouseAreaControl.CurrentOperation == ToolOperation.LeadLine || this.mouseAreaControl.CurrentOperation == ToolOperation.AreaPolygon) { this.startpoint = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, (float)e.Y)); } if (this.mouseAreaControl.CurrentOperation == ToolOperation.Enclosure || this.mouseAreaControl.CurrentOperation == ToolOperation.InterEnclosure) { this.AreaPoints.Add(new PointF((float)e.X, (float)e.Y)); } SizeF ef1 = this.mouseAreaControl.PicturePanel.GridSize; float single1 = ef1.Height; float single2 = ef1.Width; if (this.mouseAreaControl.PicturePanel.SnapToGrid) { int num1 = (int)((this.startpoint.X + (single2 / 2f)) / single2); int num2 = (int)((this.startpoint.Y + (single1 / 2f)) / single1); this.startpoint = (PointF) new Point((int)(num1 * single2), (int)(num2 * single1)); } SvgDocument document1 = this.mouseAreaControl.SVGDocument; bool flag1 = document1.AcceptChanges; document1.NumberOfUndoOperations = 200; this.mousedown = true; switch (this.operate) { case PolyOperate.Draw: { document1.AcceptChanges = false; flag2 = false; if (this.graph != null) { if (!(this.graph is Polygon) && !(this.graph is Polyline)) { flag2 = true; } break; } flag2 = true; break; } case PolyOperate.MovePath: { goto Label_05F5; } case PolyOperate.MovePoint: { PointF tf3; this.nextPoint = tf3 = PointF.Empty; this.prePoint = tf3; if ((this.moveindex < 0) || (this.moveindex >= this.points.Length)) { goto Label_05F5; } flag3 = this.graph is Polygon; if ((this.moveindex - 1) < 0) { if ((this.points.Length >= 3) && flag3) { this.prePoint = this.points[this.points.Length - 1]; } goto Label_042C; } this.prePoint = this.points[this.moveindex - 1]; goto Label_042C; } case PolyOperate.Del: { if ((this.moveindex >= 0) && (this.moveindex < this.points.Length)) { ArrayList list1 = new ArrayList(this.points); list1.RemoveAt(this.moveindex); this.points = new PointF[list1.Count]; list1.CopyTo(this.points); Matrix matrix1 = this.graph.GraphTransform.Matrix.Clone(); matrix1.Invert(); if (this.points.Length > 0) { matrix1.TransformPoints(this.points); } } goto Label_05F5; } case PolyOperate.Break: //线路断开 { if ((this.moveindex > 0) && (this.moveindex < this.points.Length - 1)) { ArrayList list1 = new ArrayList(this.points); PointF[] points2 = new PointF[this.points.Length - moveindex]; this.points = new PointF[moveindex + 1]; list1.CopyTo(0, this.points, 0, this.moveindex + 1); list1.CopyTo(moveindex, points2, 0, list1.Count - moveindex); Matrix matrix1 = this.graph.GraphTransform.Matrix.Clone(); matrix1.Invert(); if (points2.Length > 0) { matrix1.TransformPoints(points2); SvgElement copyEelement = (this.graph as XmlNode).CloneNode(true) as SvgElement; IGraph graph1 = this.graph; copyEelement.SetAttribute("info-name", ((SvgElement)graph1).GetAttribute("info-name") + "-2"); ((SvgElement)graph).SetAttribute("info-name", ((SvgElement)graph1).GetAttribute("info-name") + "-1"); copyEelement = this.mouseAreaControl.PicturePanel.AddElement(copyEelement); this.mouseAreaControl.SVGDocument.CurrentElement = graph1 as SvgElement; copyEelement.RemoveAttribute("points"); UpdateGraph(copyEelement, points2); this.mouseAreaControl.PicturePanel.InvalidateElement(copyEelement); BreakElementEventArgs copy = new BreakElementEventArgs(copyEelement); if (OnPolyLineBreak != null && copyEelement != null) { OnPolyLineBreak(this.mouseAreaControl.SVGDocument.CurrentElement, copy); } } if (this.points.Length > 0) { matrix1.TransformPoints(this.points); } } else { return; } goto Label_05F5; } case PolyOperate.Add: { if ((this.insertindex < 0) || (this.insertindex >= this.points.Length)) { goto Label_05F5; } this.points = new PointF[0]; if (!(this.graph is Polygon)) { if (this.graph is Polyline) { this.points = ((Polyline)this.graph).Points; } goto Label_058D; } this.points = ((Polygon)this.graph).Points; goto Label_058D; } default: { goto Label_05F5; } } if (flag2) { IGraph graph1 = this.mouseAreaControl.PicturePanel.PreGraph; if (graph1 == null) { return; } this.graph = (Graph)((SvgElement)graph1).Clone(); this.mouseAreaControl.SVGDocument.AcceptChanges = false; if (this.graph != null) { ((SvgElement)this.graph).RemoveAttribute("points"); } if (((SvgElement)this.graph) is IGraphPath) { if ((((SvgElement)graph1).GetAttribute("style") != string.Empty) && (((SvgElement)graph1).GetAttribute("style") != null)) { this.mouseAreaControl.SVGDocument.AcceptChanges = false; AttributeFunc.SetAttributeValue((SvgElement)this.graph, "style", ((SvgElement)this.graph).GetAttribute("style")); } ISvgBrush brush1 = ((IGraphPath)graph1).GraphBrush; if (brush1 is SvgElement) { ISvgBrush brush2 = (ISvgBrush)((SvgElement)brush1).Clone(); ((IGraphPath)this.graph).GraphBrush = brush2; ((SvgElement)brush2).pretime = -1; } else { ((IGraphPath)this.graph).GraphBrush = brush1; } brush1 = ((IGraphPath)graph1).GraphStroke.Brush; if (brush1 is SvgElement) { ISvgBrush brush3 = (ISvgBrush)((SvgElement)brush1).Clone(); ((IGraphPath)this.graph).GraphStroke = new Stroke(brush3); ((SvgElement)brush3).pretime = -1; } else { ((IGraphPath)this.graph).GraphStroke.Brush = brush1; } } } PointF[] tfArray1 = new PointF[0]; if (this.graph is Polygon) { tfArray1 = ((Polygon)this.graph).Points; } else if (this.graph is Polyline) { tfArray1 = ((Polyline)this.graph).Points; } this.points = new PointF[1]; int insertIndex = 0; if (tfArray1 != null) { ; this.points = new PointF[tfArray1.Length + 1]; if (addBegin) { tfArray1.CopyTo(this.points, 1); } else { tfArray1.CopyTo(this.points, 0); insertIndex = tfArray1.Length; } } if (addBegin || addEnd) { Matrix matrix1 = this.graph.GraphTransform.Matrix.Clone(); matrix1.Invert(); PointF[] points2 = new PointF[1] { new PointF(e.X, e.Y) }; matrix1.TransformPoints(points2); this.startpoint = points2[0]; } this.points[insertIndex] = this.startpoint; goto Label_05F5; Label_042C: if ((this.moveindex + 1) < this.points.Length) { this.nextPoint = this.points[this.moveindex + 1]; goto Label_05F5; } if ((this.points.Length >= 3) && flag3) { this.nextPoint = this.points[0]; } goto Label_05F5; Label_058D: Matrix matrix2 = this.graph.GraphTransform.Matrix.Clone(); matrix2.Invert(); //tf1 = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, (float)e.Y));//new PointF((float) e.X, (float) e.Y) PointF[] tfTemp = new PointF[1] { new PointF(e.X, e.Y) }; matrix2.TransformPoints(tfTemp); ArrayList list2 = new ArrayList(this.points); list2.Insert(this.insertindex, tfTemp[0]); this.points = new PointF[list2.Count]; list2.CopyTo(this.points); Label_05F5: //2006-10-23 设置围栏初始颜色 // if(this.mouseAreaControl.CurrentOperation == ToolOperation.Enclosure || this.mouseAreaControl.CurrentOperation == ToolOperation.InterEnclosure) // { // ((XmlElement) this.graph).SetAttribute("style","fill:#C0C0FF;fill-opacity:0.3;stroke:#000000;stroke-opacity:1;"); // } if (((this.operate == PolyOperate.Del) || (this.operate == PolyOperate.Draw)) || (this.operate == PolyOperate.Add) || (this.operate == PolyOperate.Break)) { StringBuilder text1 = new StringBuilder(); int num3 = 0; PointF[] tfArray2 = this.points; for (int num4 = 0; num4 < tfArray2.Length; num4++) { PointF tf2 = tfArray2[num4]; text1.Append(tf2.X.ToString() + " " + tf2.Y.ToString()); if (num3 < (this.points.Length - 1)) { text1.Append(","); } num3++; } this.mouseAreaControl.PicturePanel.InvalidateElement((SvgElement)this.graph); if (((SvgElement)this.graph).ParentNode == null) { this.UpdateGraph(text1.ToString()); document1.AcceptChanges = true; IGraph graph2 = this.graph; this.mouseAreaControl.PicturePanel.AddElement(this.graph); this.graph = graph2; } else { document1.AcceptChanges = true; this.UpdateGraph(text1.ToString()); } document1.AcceptChanges = flag1; this.mouseAreaControl.Invalidate(); if (this.graph != null) { ((SvgElement)this.graph).pretime = -1; this.mouseAreaControl.PicturePanel.InvalidateElement((SvgElement)this.graph); } } document1.NotifyUndo(); this.reversePath.Reset(); } else if (e.Button == MouseButtons.Right) //任务1 { if (this.mouseAreaControl.CurrentOperation == ToolOperation.Enclosure || this.mouseAreaControl.CurrentOperation == ToolOperation.InterEnclosure) { //this.AreaPoints.Add(new PointF((float) e.X, (float) e.Y)); // this.mouseAreaControl.GoBottom((SvgElement)this.graph); // ((SvgElement)this.graph).Clone(); PointF[] tfArray1 = new PointF[this.AreaPoints.Count]; this.AreaPoints.CopyTo(tfArray1, 0); this.AreaPoints.Clear(); Matrix matrix1 = new Matrix(); if (tfArray1.Length < 3) { this.mouseAreaControl.CurrentOperation = ToolOperation.Select; return; } this.selectAreaPath = new GraphicsPath(); this.selectAreaPath.AddLines(tfArray1); this.selectAreaPath.CloseFigure(); Region region1 = new Region(this.selectAreaPath); RectangleF r1 = selectAreaPath.GetBounds(); /* 2005环境 当前区域需要手动添加进集合*/ XmlNode node1 = ((SvgElement)this.graph).Clone(); SvgElement svgele = (SvgElement)node1; this.mouseAreaControl.SVGDocument.ClearSelects(); using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) { foreach (ILayer layer1 in mouseAreaControl.SVGDocument.Layers) { if (!layer1.Visible) { continue; } SvgElementCollection.ISvgElementEnumerator enumerator1 = layer1.GraphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; if (!graph1.Visible || !graph1.DrawVisible || this.graph == graph1) { continue; } GraphicsPath path1 = (GraphicsPath)graph1.GPath.Clone(); path1.Transform(graph1.GraphTransform.Matrix); Region ef1 = null; if (graph1 is Use) { ef1 = new Region(PathFunc.GetBounds(path1)); } else if (graph1 is Line) { ef1 = new Region(PathFunc.GetBounds(path1)); } else { ef1 = new Region(path1); } // 设置围栏选择方式为完全包含才能选中 if (this.mouseAreaControl.CurrentOperation == ToolOperation.Enclosure) { RectangleF rt1 = ef1.GetBounds(g); ef1.Intersect(region1); if (ef1.GetBounds(g) == rt1) { this.mouseAreaControl.SVGDocument.AddSelectElement(graph1); } continue; } // 设置围栏选择方式为搭边即选中 if (this.mouseAreaControl.CurrentOperation == ToolOperation.InterEnclosure) { ef1.Intersect(region1); if (!ef1.GetBounds(g).IsEmpty) //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); } } } } this.mouseAreaControl.SVGDocument.AddSelectElement(graph); } GraphicsPath path2 = new GraphicsPath(); path2.AddLines(tfArray1); RectangleF ef2 = path2.GetBounds(); /* 2005 环境下使用,2003环境下需删除否则出现重复.原因不明.*/ if (this.mouseAreaControl.CurrentOperation == ToolOperation.Enclosure) { this.mouseAreaControl.SVGDocument.AddSelectElement(svgele); } this.mouseAreaControl.Invalidate(new System.Drawing.Rectangle(((int)ef2.X) - 10, ((int)ef2.Y) - 10, ((int)ef2.Width) + 20, ((int)ef2.Height) + 20)); return; } } //鼠标右键抬起 }