示例#1
0
 private void ApplyRotation(SvgDrawContext context)
 {
     if (this.attributesAndStyles.ContainsKey(SvgConstants.Attributes.ORIENT))
     {
         String orient   = this.attributesAndStyles.Get(SvgConstants.Attributes.ORIENT);
         double rotAngle = double.NaN;
         // If placed by marker-start, the marker is oriented 180° different from
         // the orientation that would be used if auto was specified.
         // For all other markers, auto-start-reverse means the same as auto.
         if (SvgConstants.Values.AUTO.Equals(orient) || (SvgConstants.Values.AUTO_START_REVERSE.Equals(orient) && !
                                                         SvgConstants.Attributes.MARKER_START.Equals(this.attributesAndStyles.Get(SvgConstants.Tags.MARKER))))
         {
             rotAngle = ((IMarkerCapable)GetParent()).GetAutoOrientAngle(this, false);
         }
         else
         {
             if (SvgConstants.Values.AUTO_START_REVERSE.Equals(orient) && SvgConstants.Attributes.MARKER_START.Equals(this
                                                                                                                      .attributesAndStyles.Get(SvgConstants.Tags.MARKER)))
             {
                 rotAngle = ((IMarkerCapable)GetParent()).GetAutoOrientAngle(this, true);
             }
             else
             {
                 if (CssUtils.IsAngleValue(orient) || CssUtils.IsNumericValue(orient))
                 {
                     rotAngle = CssUtils.ParseAngle(this.attributesAndStyles.Get(SvgConstants.Attributes.ORIENT));
                 }
             }
         }
         if (!double.IsNaN(rotAngle))
         {
             context.GetCurrentCanvas().ConcatMatrix(AffineTransform.GetRotateInstance(rotAngle));
         }
     }
 }