public virtual void DrawMarker(SvgDrawContext context, MarkerVertexType markerVertexType)
        {
            Point point = null;

            if (MarkerVertexType.MARKER_START.Equals(markerVertexType))
            {
                point = points[0];
            }
            else
            {
                if (MarkerVertexType.MARKER_END.Equals(markerVertexType))
                {
                    point = points[points.Count - 1];
                }
            }
            if (point != null)
            {
                String moveX = SvgCssUtils.ConvertDoubleToString(CssUtils.ConvertPtsToPx(point.x));
                String moveY = SvgCssUtils.ConvertDoubleToString(CssUtils.ConvertPtsToPx(point.y));
                MarkerSvgNodeRenderer.DrawMarker(context, moveX, moveY, markerVertexType, this);
            }
        }
        public virtual void DrawMarker(SvgDrawContext context, MarkerVertexType markerVertexType)
        {
            String moveX = null;
            String moveY = null;

            if (MarkerVertexType.MARKER_START.Equals(markerVertexType))
            {
                moveX = this.attributesAndStyles.Get(SvgConstants.Attributes.X1);
                moveY = this.attributesAndStyles.Get(SvgConstants.Attributes.Y1);
            }
            else
            {
                if (MarkerVertexType.MARKER_END.Equals(markerVertexType))
                {
                    moveX = this.attributesAndStyles.Get(SvgConstants.Attributes.X2);
                    moveY = this.attributesAndStyles.Get(SvgConstants.Attributes.Y2);
                }
            }
            if (moveX != null && moveY != null)
            {
                MarkerSvgNodeRenderer.DrawMarker(context, moveX, moveY, markerVertexType, this);
            }
        }
        public virtual void DrawMarker(SvgDrawContext context, MarkerVertexType markerVertexType)
        {
            Object[] allShapesOrdered = GetShapes().ToArray();
            Point    point            = null;

            if (MarkerVertexType.MARKER_START.Equals(markerVertexType))
            {
                point = ((AbstractPathShape)allShapesOrdered[0]).GetEndingPoint();
            }
            else
            {
                if (MarkerVertexType.MARKER_END.Equals(markerVertexType))
                {
                    point = ((AbstractPathShape)allShapesOrdered[allShapesOrdered.Length - 1]).GetEndingPoint();
                }
            }
            if (point != null)
            {
                String moveX = SvgCssUtils.ConvertDoubleToString(point.x);
                String moveY = SvgCssUtils.ConvertDoubleToString(point.y);
                MarkerSvgNodeRenderer.DrawMarker(context, moveX, moveY, markerVertexType, this);
            }
        }
示例#4
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);
            }
        }