private void AddMarker(Marker svgElement, string attributeName, bool isendarrow) { if (svgElement != null) { SvgDocument fadde1 = base.svgElement.OwnerDocument; bool flag1 = fadde1.AcceptChanges; string text1 = svgElement.GetAttribute("id").Trim(); string text2 = string.Empty; if (text1.Length > 0) { if (isendarrow) { text1 = "end" + text1; } else { text1 = "start" + text1; } } text2 = "url(#" + text1 + ")"; if (text1.Length == 0) { text2 = string.Empty; } string text3 = (base.svgElement as SvgElement).GetAttribute(attributeName); if (text2 != text3) { string[] textArray1 = new string[] { "marker" }; Marker cfb1 = NodeFunc.GetRefNode(text1, fadde1) as Marker; if (cfb1 == null) { cfb1 = svgElement; if (isendarrow) { //fadde1.AcceptChanges = false; for (int num1 = 0; num1 < cfb1.GraphList.Count; num1++) { SvgElement facbce1 = cfb1.GraphList[num1] as SvgElement; if (facbce1 != null) { string text4 = facbce1.GetAttribute("transform"); text4 = "matrix(-1,0,0,1,0,0) " + text4; facbce1.SetAttribute("transform", text4); text4 = null; } } } cfb1.SetAttribute("id", text1); fadde1.AddDefsElement(cfb1); } AttributeFunc.SetAttributeValue(base.svgElement, attributeName, text2); } fadde1.AcceptChanges = flag1; } }
protected void PaintMarkers(Graphics g) { string markerStartUrl = extractMarkerUrl(this.GetAttribute("marker-start")); string markerEndUrl = extractMarkerUrl(this.GetAttribute("marker-end")); PointF[] points1 = this.Points.Clone() as PointF[]; int num1 = 0; int num11 = 1; int num3 = 0; int num33 = 1; if (points1.Length > 3) { num33 = points1.Length - 1; num3 = num33 - 1; } base.GraphTransform.Matrix.TransformPoints(points1); float angle = 0f;//(float)(180*Math.Atan2(points1[1].Y - points1[0].Y,points1[1].X-points1[0].X)/Math.PI); GraphicsContainer container1 = g.BeginContainer(); Marker element1; if (markerStartUrl.Length > 0) { angle = (float)(180 * Math.Atan2(points1[num11].Y - points1[num1].Y, points1[num11].X - points1[num1].X) / Math.PI); element1 = (Marker)NodeFunc.GetRefNode(markerStartUrl, this.OwnerDocument); if (element1 is Marker) { ((Marker)element1).GraphTransform.Matrix = new Matrix(); Matrix matrix1 = ((Marker)element1).MarkerTransForm; matrix1.Rotate(angle); matrix1.Translate(points1[num1].X, points1[num1].Y, MatrixOrder.Append); element1.GraphStroke = this.GraphStroke; element1.IsMarkerChild = true; ((Marker)element1).Draw(g, 0); } } if (markerEndUrl.Length > 0) { angle = (float)(180 * Math.Atan2(points1[num33].Y - points1[num3].Y, points1[num33].X - points1[num3].X) / Math.PI); element1 = (Marker)NodeFunc.GetRefNode(markerEndUrl, this.OwnerDocument); if (element1 is Marker) { ((Marker)element1).GraphTransform.Matrix = new Matrix(); Matrix matrix1 = ((Marker)element1).MarkerTransForm; matrix1.Rotate(angle); matrix1.Translate(points1[num33].X, points1[num33].Y, MatrixOrder.Append); element1.GraphStroke = this.GraphStroke; element1.IsMarkerChild = true; ((Marker)element1).Draw(g, 0); } } g.EndContainer(container1); }
protected void PaintMarkers(Graphics g) { string markerStartUrl = extractMarkerUrl(this.GetAttribute("marker-start")); string markerMiddleUrl = extractMarkerUrl(this.GetAttribute("marker-mid")); string markerEndUrl = extractMarkerUrl(this.GetAttribute("marker-end")); PointF pt0 = new PointF(this.X1, this.Y1); PointF pt1 = new PointF(this.X2, this.Y2); PointF pt2 = new PointF((this.X1 + this.X2) / 2, (this.Y1 + this.Y2) / 2); PointF[] points1 = new PointF[] { pt0, pt1, pt2 }; int num1 = 0; int num11 = 1; // int num2 = 2; // int num22 = 1; int num3 = 0; int num33 = 1; if (this is ConnectLine) { PointF[] points2 = this.GPath.PathPoints.Clone() as PointF[]; points1 = points2; if (points2.Length > 3) { // points1 = points2; num33 = points1.Length - 1; num3 = num33 - 1; } } base.GraphTransform.Matrix.TransformPoints(points1); float angle = 0f; //(float)(180*Math.Atan2(points1[1].Y - points1[0].Y,points1[1].X-points1[0].X)/Math.PI); GraphicsContainer container1 = g.BeginContainer(); Marker element1; if (markerStartUrl.Length > 0) { angle = (float)(180 * Math.Atan2(points1[num11].Y - points1[num1].Y, points1[num11].X - points1[num1].X) / Math.PI); element1 = (Marker)NodeFunc.GetRefNode(markerStartUrl, this.OwnerDocument); if (element1 is Marker) { ((Marker)element1).GraphTransform.Matrix = new Matrix(); Matrix matrix1 = ((Marker)element1).MarkerTransForm; matrix1.Rotate(angle); matrix1.Translate(points1[num1].X, points1[num1].Y, MatrixOrder.Append); element1.GraphStroke = this.GraphStroke; element1.IsMarkerChild = true; ((Marker)element1).Draw(g, 0); } } if (markerMiddleUrl.Length > 0) { element1 = (Marker)NodeFunc.GetRefNode(markerMiddleUrl, this.OwnerDocument); if (element1 is IGraph) { ((Marker)element1).GraphTransform.Matrix = new Matrix(); Matrix matrix1 = ((Marker)element1).MarkerTransForm; matrix1.Rotate(angle); matrix1.Translate(points1[2].X, points1[2].Y, MatrixOrder.Append); element1.GraphStroke = this.GraphStroke; element1.IsMarkerChild = true; ((IGraph)element1).Draw(g, 0); } } if (markerEndUrl.Length > 0) { angle = (float)(180 * Math.Atan2(points1[num33].Y - points1[num3].Y, points1[num33].X - points1[num3].X) / Math.PI); element1 = (Marker)NodeFunc.GetRefNode(markerEndUrl, this.OwnerDocument); if (element1 is IGraph) { ((Marker)element1).GraphTransform.Matrix = new Matrix(); Matrix matrix1 = ((Marker)element1).MarkerTransForm; matrix1.Rotate(angle); matrix1.Translate(points1[num33].X, points1[num33].Y, MatrixOrder.Append); element1.GraphStroke = this.GraphStroke; element1.IsMarkerChild = true; ((IGraph)element1).Draw(g, 0); } } g.EndContainer(container1); }