public virtual double GetAutoOrientAngle(MarkerSvgNodeRenderer marker, bool reverse)
 {
     Object[] pathShapes = GetShapes().ToArray();
     if (pathShapes.Length > 1)
     {
         Vector v = new Vector(0, 0, 0);
         if (SvgConstants.Attributes.MARKER_END.Equals(marker.attributesAndStyles.Get(SvgConstants.Tags.MARKER)))
         {
             // Create vector from the last two shapes
             IPathShape lastShape         = (IPathShape)pathShapes[pathShapes.Length - 1];
             IPathShape secondToLastShape = (IPathShape)pathShapes[pathShapes.Length - 2];
             v = new Vector((float)(lastShape.GetEndingPoint().GetX() - secondToLastShape.GetEndingPoint().GetX()), (float
                                                                                                                     )(lastShape.GetEndingPoint().GetY() - secondToLastShape.GetEndingPoint().GetY()), 0f);
         }
         else
         {
             if (SvgConstants.Attributes.MARKER_START.Equals(marker.attributesAndStyles.Get(SvgConstants.Tags.MARKER)))
             {
                 // Create vector from the first two shapes
                 IPathShape firstShape  = (IPathShape)pathShapes[0];
                 IPathShape secondShape = (IPathShape)pathShapes[1];
                 v = new Vector((float)(secondShape.GetEndingPoint().GetX() - firstShape.GetEndingPoint().GetX()), (float)(
                                    secondShape.GetEndingPoint().GetY() - firstShape.GetEndingPoint().GetY()), 0f);
             }
         }
         // Get angle from this vector and the horizontal axis
         Vector xAxis    = new Vector(1, 0, 0);
         double rotAngle = SvgCoordinateUtils.CalculateAngleBetweenTwoVectors(xAxis, v);
         return(v.Get(1) >= 0 && !reverse ? rotAngle : rotAngle * -1f);
     }
     return(0);
 }
 public virtual double GetAutoOrientAngle(MarkerSvgNodeRenderer marker, bool reverse)
 {
     if (points.Count > 1)
     {
         Vector v = new Vector(0, 0, 0);
         if (SvgConstants.Attributes.MARKER_END.Equals(marker.attributesAndStyles.Get(SvgConstants.Tags.MARKER)))
         {
             Point lastPoint         = points[points.Count - 1];
             Point secondToLastPoint = points[points.Count - 2];
             v = new Vector((float)(lastPoint.GetX() - secondToLastPoint.GetX()), (float)(lastPoint.GetY() - secondToLastPoint
                                                                                          .GetY()), 0f);
         }
         else
         {
             if (SvgConstants.Attributes.MARKER_START.Equals(marker.attributesAndStyles.Get(SvgConstants.Tags.MARKER)))
             {
                 Point firstPoint  = points[0];
                 Point secondPoint = points[1];
                 v = new Vector((float)(secondPoint.GetX() - firstPoint.GetX()), (float)(secondPoint.GetY() - firstPoint.GetY
                                                                                             ()), 0f);
             }
         }
         Vector xAxis    = new Vector(1, 0, 0);
         double rotAngle = SvgCoordinateUtils.CalculateAngleBetweenTwoVectors(xAxis, v);
         return(v.Get(1) >= 0 && !reverse ? rotAngle : rotAngle * -1f);
     }
     return(0);
 }
        public virtual double GetAutoOrientAngle(MarkerSvgNodeRenderer marker, bool reverse)
        {
            Vector v = new Vector(GetAttribute(this.attributesAndStyles, SvgConstants.Attributes.X2) - GetAttribute(this
                                                                                                                    .attributesAndStyles, SvgConstants.Attributes.X1), GetAttribute(this.attributesAndStyles, SvgConstants.Attributes
                                                                                                                                                                                    .Y2) - GetAttribute(this.attributesAndStyles, SvgConstants.Attributes.Y1), 0f);
            Vector xAxis    = new Vector(1, 0, 0);
            double rotAngle = SvgCoordinateUtils.CalculateAngleBetweenTwoVectors(xAxis, v);

            return(v.Get(1) >= 0 && !reverse ? rotAngle : rotAngle * -1f);
        }