internal ConnectLine(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.startGraph = null; this.endGraph = null; this.strEndGraph = string.Empty; this.strStartGraph = string.Empty; this.type = Enums.ConnectType.none; this.linepoints = new PointF[0]; }
internal ConnectLine(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.startGraph=null; this.endGraph=null; this.strEndGraph=string.Empty; this.strStartGraph=string.Empty; this.type=Enums.ConnectType.none; this.linepoints=new PointF[0]; }
internal void UpatePath(Graphics g) { if ((base.pretime != base.OwnerDocument.ControlTime) || (base.graphPath == null) || (base.IsChanged)) { PointF[] tfArray3; if (base.graphPath == null) { base.graphPath = new GraphicsPath(); } base.graphPath.Reset(); PointF tf1 = new PointF(this.X1, this.Y1); PointF tf2 = new PointF(this.X2, this.Y2); using (Matrix matrix1 = new Matrix()) { using (Matrix matrix2 = new Matrix()) { bool flag1 = false; bool flag2 = false; if (this.StartGraph != null) { flag1 = true; matrix1.Multiply(this.startGraph.Transform.Matrix); RectangleF ef1 = this.GetBounds(this.startGraph, matrix1); PointF tf3 = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)); PointF[] tfArray1 = (this.startGraph as IGraph).ConnectPoints.Clone() as PointF[]; if ((this.startGraphPointIndex >= 0) && (this.startGraphPointIndex < tfArray1.Length)) { flag1 = false; using (Matrix matrix3 = this.startGraph.Transform.Matrix.Clone()) { matrix3.TransformPoints(tfArray1); tf3 = tfArray1[this.startGraphPointIndex]; } using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5 = new PointF[] { tf3 }; matrix5.TransformPoints(tfArray5); tf3 = tfArray5[0]; } } tf1 = tf3; } if (this.EndGraph != null) { flag2 = true; matrix2.Multiply(this.endGraph.Transform.Matrix); RectangleF ef2 = this.GetBounds(this.endGraph, matrix2); PointF tf4 = new PointF(ef2.X + (ef2.Width / 2f), ef2.Y + (ef2.Height / 2f)); PointF[] tfArray2 = (this.endGraph as IGraph).ConnectPoints.Clone() as PointF[]; if ((this.endGraphPointIndex >= 0) && (this.endGraphPointIndex < tfArray2.Length)) { flag2 = false; using (Matrix matrix4 = this.endGraph.Transform.Matrix.Clone()) { matrix4.TransformPoints(tfArray2); tf4 = tfArray2[this.endGraphPointIndex]; } using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5 = new PointF[] { tf4 }; matrix5.TransformPoints(tfArray5); tf4 = tfArray5[0]; } } tf2 = tf4; } if ((flag1 || flag2) && (this.startGraph != this.endGraph)) { PointF tf5 = tf1; PointF tf6 = tf2; using (GraphicsPath path1 = new GraphicsPath()) { path1.AddLine(tf1, tf2); path1.Widen(new Pen(Color.White, 0.1f)); if (flag1) { using (Region region1 = new Region(this.startGraph.GPath)) { region1.Transform(matrix1); region1.Intersect(path1); if (!region1.IsEmpty(g)) { tf5 = this.Intersect(region1.GetBounds(g), tf5); using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5 = new PointF[] { tf5 }; matrix5.TransformPoints(tfArray5); tf5 = tfArray5[0]; } } } } if (flag2) { using (Region region2 = new Region(this.endGraph.GPath)) { region2.Transform(matrix2); region2.Intersect(path1); if (!region2.IsEmpty(g)) { tf6 = this.Intersect(region2.GetBounds(g), tf6); using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5 = new PointF[] { tf6 }; matrix5.TransformPoints(tfArray5); tf6 = tfArray5[0]; } } } } tf1 = tf5; tf2 = tf6; } } } } bool flag3 = Math.Abs((tf2.Y - tf1.Y)) > Math.Abs((tf2.X - tf1.X)); string text1 = base.SvgAttributes["type"].ToString().Trim(); this.type = (Enums.ConnectType)Enum.Parse(typeof(Enums.ConnectType), text1, true); switch (this.type) { case Enums.ConnectType.Line: { base.graphPath.AddLine(tf1, tf2); break; } case Enums.ConnectType.Polyline: { if (!flag3) { bool flag5 = tf1.X < tf2.X; tfArray3 = new PointF[] { tf1, new PointF(tf1.X + ((flag5 ? 1 : -1) * 30), tf1.Y), new PointF(tf2.X - ((flag5 ? 1 : -1) * 30), tf2.Y), tf2 }; base.graphPath.AddLines(tfArray3); break; } bool flag4 = tf1.Y < tf2.Y; tfArray3 = new PointF[] { tf1, new PointF(tf1.X, tf1.Y + ((flag4 ? 1 : -1) * 30)), new PointF(tf2.X, tf2.Y - ((flag4 ? 1 : -1) * 30)), tf2 }; base.graphPath.AddLines(tfArray3); break; } case Enums.ConnectType.RightAngle: { if (!flag3) { float single2 = (tf1.X + tf2.X) / 2f; tfArray3 = new PointF[] { tf1, new PointF(single2, tf1.Y), new PointF(single2, tf2.Y), tf2 }; base.graphPath.AddLines(tfArray3); break; } float single1 = (tf1.Y + tf2.Y) / 2f; tfArray3 = new PointF[] { tf1, new PointF(tf1.X, single1), new PointF(tf2.X, single1), tf2 }; base.graphPath.AddLines(tfArray3); break; } case Enums.ConnectType.Spline: { if (!flag3) { bool flag7 = tf1.X < tf2.X; base.graphPath.AddBezier(tf1, new PointF(tf1.X + ((flag7 ? 1 : -1) * 70), tf1.Y), new PointF(tf2.X - ((flag7 ? 1 : -1) * 70), tf2.Y), tf2); break; } bool flag6 = tf1.Y < tf2.Y; base.graphPath.AddBezier(tf1, new PointF(tf1.X, tf1.Y + ((flag6 ? 1 : -1) * 70)), new PointF(tf2.X, tf2.Y - ((flag6 ? 1 : -1) * 70)), tf2); break; } } tfArray3 = new PointF[] { tf1, tf2 }; this.linepoints = tfArray3; // IsChanged=false; //base.pretime =this.OwnerDocument.ControlTime; } }
internal GraphicsPath ConnectPath() { PointF[] tfArray1; GraphicsPath path1 = new GraphicsPath(); PointF tf1 = new PointF(this.X1, this.Y1); PointF tf2 = new PointF(this.X2, this.Y2); bool flag1 = Math.Abs((tf2.Y - tf1.Y)) > Math.Abs((tf2.X - tf1.X)); string text1 = base.SvgAttributes["type"].ToString().Trim(); this.type = (Enums.ConnectType)Enum.Parse(typeof(Enums.ConnectType), text1, true); switch (this.type) { case Enums.ConnectType.Line: { path1.AddLine(tf1, tf2); return(path1); } case Enums.ConnectType.Polyline: { if (!flag1) { bool flag3 = tf1.X < tf2.X; tfArray1 = new PointF[] { tf1, new PointF(tf1.X + ((flag3 ? 1 : -1) * 30), tf1.Y), new PointF(tf2.X - ((flag3 ? 1 : -1) * 30), tf2.Y), tf2 }; path1.AddLines(tfArray1); return(path1); } bool flag2 = tf1.Y < tf2.Y; tfArray1 = new PointF[] { tf1, new PointF(tf1.X, tf1.Y + ((flag2 ? 1 : -1) * 30)), new PointF(tf2.X, tf2.Y - ((flag2 ? 1 : -1) * 30)), tf2 }; path1.AddLines(tfArray1); return(path1); } case Enums.ConnectType.RightAngle: { if (!flag1) { float single2 = (tf1.X + tf2.X) / 2f; tfArray1 = new PointF[] { tf1, new PointF(single2, tf1.Y), new PointF(single2, tf2.Y), tf2 }; path1.AddLines(tfArray1); return(path1); } float single1 = (tf1.Y + tf2.Y) / 2f; tfArray1 = new PointF[] { tf1, new PointF(tf1.X, single1), new PointF(tf2.X, single1), tf2 }; path1.AddLines(tfArray1); return(path1); } case Enums.ConnectType.Spline: { if (!flag1) { bool flag5 = tf1.X < tf2.X; path1.AddBezier(tf1, new PointF(tf1.X + ((flag5 ? 1 : -1) * 70), tf1.Y), new PointF(tf2.X - ((flag5 ? 1 : -1) * 70), tf2.Y), tf2); return(path1); } bool flag4 = tf1.Y < tf2.Y; path1.AddBezier(tf1, new PointF(tf1.X, tf1.Y + ((flag4 ? 1 : -1) * 70)), new PointF(tf2.X, tf2.Y - ((flag4 ? 1 : -1) * 70)), tf2); return(path1); } } return(path1); }
internal void UpatePath(Graphics g) { if ((base.pretime != base.OwnerDocument.ControlTime) || (base.graphPath == null)||(base.IsChanged)) { PointF[] tfArray3; if (base.graphPath == null) { base.graphPath = new GraphicsPath(); } base.graphPath.Reset(); PointF tf1 = new PointF(this.X1, this.Y1); PointF tf2 = new PointF(this.X2, this.Y2); using (Matrix matrix1 = new Matrix()) { using (Matrix matrix2 = new Matrix()) { bool flag1 = false; bool flag2 = false; if (this.StartGraph != null) { flag1 = true; matrix1.Multiply(this.startGraph.Transform.Matrix); RectangleF ef1 = this.GetBounds(this.startGraph, matrix1); PointF tf3 = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)); PointF[] tfArray1 = (this.startGraph as IGraph).ConnectPoints.Clone() as PointF[]; if ((this.startGraphPointIndex >= 0) && (this.startGraphPointIndex < tfArray1.Length)) { flag1 = false; using (Matrix matrix3 = this.startGraph.Transform.Matrix.Clone()) { matrix3.TransformPoints(tfArray1); tf3 = tfArray1[this.startGraphPointIndex]; } using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf3}; matrix5.TransformPoints(tfArray5); tf3=tfArray5[0]; } } tf1 = tf3; } if (this.EndGraph != null) { flag2 = true; matrix2.Multiply(this.endGraph.Transform.Matrix); RectangleF ef2 = this.GetBounds(this.endGraph, matrix2); PointF tf4 = new PointF(ef2.X + (ef2.Width / 2f), ef2.Y + (ef2.Height / 2f)); PointF[] tfArray2 =(this.endGraph as IGraph).ConnectPoints.Clone() as PointF[]; if ((this.endGraphPointIndex >= 0) && (this.endGraphPointIndex < tfArray2.Length)) { flag2 = false; using (Matrix matrix4 = this.endGraph.Transform.Matrix.Clone()) { matrix4.TransformPoints(tfArray2); tf4 = tfArray2[this.endGraphPointIndex]; } using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf4}; matrix5.TransformPoints(tfArray5); tf4=tfArray5[0]; } } tf2 = tf4; } if ((flag1 || flag2) && (this.startGraph != this.endGraph)) { PointF tf5 = tf1; PointF tf6 = tf2; using (GraphicsPath path1 = new GraphicsPath()) { path1.AddLine(tf1, tf2); path1.Widen(new Pen(Color.White, 0.1f)); if (flag1) { using (Region region1 = new Region(this.startGraph.GPath)) { region1.Transform(matrix1); region1.Intersect(path1); if (!region1.IsEmpty(g)) { tf5 = this.Intersect(region1.GetBounds(g), tf5); using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf5}; matrix5.TransformPoints(tfArray5); tf5=tfArray5[0]; } } } } if (flag2) { using (Region region2 = new Region(this.endGraph.GPath)) { region2.Transform(matrix2); region2.Intersect(path1); if (!region2.IsEmpty(g)) { tf6 = this.Intersect(region2.GetBounds(g), tf6); using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf6}; matrix5.TransformPoints(tfArray5); tf6=tfArray5[0]; } } } } tf1 = tf5; tf2 = tf6; } } } } bool flag3 = Math.Abs( (tf2.Y - tf1.Y)) > Math.Abs((tf2.X - tf1.X)); string text1= base.SvgAttributes["type"].ToString().Trim(); this.type = (Enums.ConnectType)Enum.Parse(typeof(Enums.ConnectType),text1,true); switch (this.type) { case Enums.ConnectType.Line: { base.graphPath.AddLine(tf1, tf2); break; } case Enums.ConnectType.Polyline: { if (!flag3) { bool flag5 = tf1.X < tf2.X; tfArray3 = new PointF[] { tf1, new PointF(tf1.X + ((flag5 ? 1 : -1) * 30), tf1.Y), new PointF(tf2.X - ((flag5 ? 1 : -1) * 30), tf2.Y), tf2 }; base.graphPath.AddLines(tfArray3); break; } bool flag4 = tf1.Y < tf2.Y; tfArray3 = new PointF[] { tf1, new PointF(tf1.X, tf1.Y + ((flag4 ? 1 : -1) * 30)), new PointF(tf2.X, tf2.Y - ((flag4 ? 1 : -1) * 30)), tf2 } ; base.graphPath.AddLines(tfArray3); break; } case Enums.ConnectType.RightAngle: { if (!flag3) { float single2 = (tf1.X + tf2.X) / 2f; tfArray3 = new PointF[] { tf1, new PointF(single2, tf1.Y), new PointF(single2, tf2.Y), tf2 } ; base.graphPath.AddLines(tfArray3); break; } float single1 = (tf1.Y + tf2.Y) / 2f; tfArray3 = new PointF[] { tf1, new PointF(tf1.X, single1), new PointF(tf2.X, single1), tf2 } ; base.graphPath.AddLines(tfArray3); break; } case Enums.ConnectType.Spline: { if (!flag3) { bool flag7 = tf1.X < tf2.X; base.graphPath.AddBezier(tf1, new PointF(tf1.X + ((flag7 ? 1 : -1) * 70), tf1.Y), new PointF(tf2.X - ((flag7 ? 1 : -1) * 70), tf2.Y), tf2); break; } bool flag6 = tf1.Y < tf2.Y; base.graphPath.AddBezier(tf1, new PointF(tf1.X, tf1.Y + ((flag6 ? 1 : -1) * 70)), new PointF(tf2.X, tf2.Y - ((flag6 ? 1 : -1) * 70)), tf2); break; } } tfArray3 = new PointF[] { tf1, tf2 } ; this.linepoints = tfArray3; // IsChanged=false; //base.pretime =this.OwnerDocument.ControlTime; } }
internal GraphicsPath ConnectPath() { PointF[] tfArray1; GraphicsPath path1 = new GraphicsPath(); PointF tf1 = new PointF(this.X1, this.Y1); PointF tf2 = new PointF(this.X2, this.Y2); bool flag1 = Math.Abs((tf2.Y - tf1.Y)) > Math.Abs((tf2.X - tf1.X)); string text1= base.SvgAttributes["type"].ToString().Trim(); this.type = (Enums.ConnectType)Enum.Parse(typeof(Enums.ConnectType),text1,true); switch (this.type) { case Enums.ConnectType.Line: { path1.AddLine(tf1, tf2); return path1; } case Enums.ConnectType.Polyline: { if (!flag1) { bool flag3 = tf1.X < tf2.X; tfArray1 = new PointF[] { tf1, new PointF(tf1.X + ((flag3 ? 1 : -1) * 30), tf1.Y), new PointF(tf2.X - ((flag3 ? 1 : -1) * 30), tf2.Y), tf2 } ; path1.AddLines(tfArray1); return path1; } bool flag2 = tf1.Y < tf2.Y; tfArray1 = new PointF[] { tf1, new PointF(tf1.X, tf1.Y + ((flag2 ? 1 : -1) * 30)), new PointF(tf2.X, tf2.Y - ((flag2 ? 1 : -1) * 30)), tf2 } ; path1.AddLines(tfArray1); return path1; } case Enums.ConnectType.RightAngle: { if (!flag1) { float single2 = (tf1.X + tf2.X) / 2f; tfArray1 = new PointF[] { tf1, new PointF(single2, tf1.Y), new PointF(single2, tf2.Y), tf2 } ; path1.AddLines(tfArray1); return path1; } float single1 = (tf1.Y + tf2.Y) / 2f; tfArray1 = new PointF[] { tf1, new PointF(tf1.X, single1), new PointF(tf2.X, single1), tf2 } ; path1.AddLines(tfArray1); return path1; } case Enums.ConnectType.Spline: { if (!flag1) { bool flag5 = tf1.X < tf2.X; path1.AddBezier(tf1, new PointF(tf1.X + ((flag5 ? 1 : -1) * 70), tf1.Y), new PointF(tf2.X - ((flag5 ? 1 : -1) * 70), tf2.Y), tf2); return path1; } bool flag4 = tf1.Y < tf2.Y; path1.AddBezier(tf1, new PointF(tf1.X, tf1.Y + ((flag4 ? 1 : -1) * 70)), new PointF(tf2.X, tf2.Y - ((flag4 ? 1 : -1) * 70)), tf2); return path1; } } return path1; }