public override bool Equals(Object other)
        {
            if (other == null || this.GetType() != other.GetType())
            {
                return(false);
            }
            AbstractSvgNodeRenderer oar = (AbstractSvgNodeRenderer)other;
            //Compare attribute and style map
            bool attributesAndStylesEqual = true;

            if (attributesAndStyles != null && oar.attributesAndStyles != null)
            {
                attributesAndStylesEqual &= (attributesAndStyles.Count == oar.attributesAndStyles.Count);
                foreach (KeyValuePair <String, String> kvp in attributesAndStyles)
                {
                    String value = oar.attributesAndStyles.Get(kvp.Key);
                    if (value == null || !kvp.Value.Equals(value))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                attributesAndStylesEqual = (attributesAndStyles == null && oar.attributesAndStyles == null);
            }
            return(attributesAndStylesEqual && doFill == oar.doFill && doStroke == oar.doStroke);
        }
 //context.getCurrentCanvas().concatMatrix(transform);
 /// <summary>Applies a clipping operation based on the view port.</summary>
 /// <param name="context">the svg draw context</param>
 private void ApplyViewport(SvgDrawContext context)
 {
     if (GetParent() != null && GetParent() is AbstractSvgNodeRenderer)
     {
         AbstractSvgNodeRenderer parent = (AbstractSvgNodeRenderer)GetParent();
         PdfCanvas currentCanvas        = context.GetCurrentCanvas();
         currentCanvas.Rectangle(context.GetCurrentViewPort());
         currentCanvas.Clip();
         currentCanvas.NewPath();
         if (parent.CanConstructViewPort())
         {
             currentCanvas.ConcatMatrix(parent.CalculateViewPortTranslation(context));
         }
     }
 }
Пример #3
0
        internal static void DrawMarker(SvgDrawContext context, String moveX, String moveY, MarkerVertexType markerToUse
                                        , AbstractSvgNodeRenderer parent)
        {
            String           elementToReUse = parent.attributesAndStyles.Get(markerToUse.ToString());
            String           normalizedName = SvgTextUtil.FilterReferenceValue(elementToReUse);
            ISvgNodeRenderer template       = context.GetNamedObject(normalizedName);
            //Clone template
            ISvgNodeRenderer namedObject = template == null ? null : template.CreateDeepCopy();

            if (namedObject is MarkerSvgNodeRenderer &&
                // Having markerWidth or markerHeight with negative or zero value disables rendering of the element .
                MarkerWidthHeightAreCorrect((MarkerSvgNodeRenderer)namedObject))
            {
                // setting the parent of the referenced element to this instance
                namedObject.SetParent(parent);
                namedObject.SetAttribute(SvgConstants.Tags.MARKER, markerToUse.ToString());
                namedObject.SetAttribute(SvgConstants.Attributes.X, moveX);
                namedObject.SetAttribute(SvgConstants.Attributes.Y, moveY);
                namedObject.Draw(context);
                // unsetting the parent of the referenced element
                namedObject.SetParent(null);
            }
        }
 public virtual void SetClippedRenderer(AbstractSvgNodeRenderer clippedRenderer)
 {
     this.clippedRenderer = clippedRenderer;
 }
Пример #5
0
 private static bool IsOverflowVisible(AbstractSvgNodeRenderer currentElement)
 {
     return(CommonCssConstants.VISIBLE.Equals(currentElement.attributesAndStyles.Get(CommonCssConstants.OVERFLOW
                                                                                     )) || CommonCssConstants.AUTO.Equals(currentElement.attributesAndStyles.Get(CommonCssConstants.OVERFLOW
                                                                                                                                                                 )));
 }