Summary description for SvgElement.
Inheritance: SharpVectors.Dom.Css.CssXmlElement, ISvgElement
示例#1
0
 public WpfRendering(SvgElement element)
     : base(element)
 {
     _maskUnits        = SvgUnitType.UserSpaceOnUse;
     _clipPathUnits    = SvgUnitType.UserSpaceOnUse;
     _maskContentUnits = SvgUnitType.UserSpaceOnUse;
 }
示例#2
0
        public SvgLengthList(string propertyName, string listString, SvgElement ownerElement, SvgLengthDirection direction)
        {
            this.propertyName = propertyName;
            this.ownerElement = ownerElement;
            this.direction = direction;

            this.FromString(listString);
        }
示例#3
0
 public void InitTest()
 {
     if(!initDone)
     {
         doc = LoadXml("<rect height='1' width='1' />");
         elm = (SvgElement)doc.SelectSingleNode("//*[local-name()='rect']");
         initDone = true;
     }
 }
示例#4
0
 public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal, string defaultValue)
     : this(ownerElement, propertyName, SvgLengthSource.String, direction, defaultValue)
 {
     if(baseVal == null || baseVal.Length == 0)
     {
         baseVal = defaultValue;
     }
     baseVal = SvgNumber.ScientificToDec(baseVal);
     cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
 }
示例#5
0
        public static string GetElementName(SvgElement element)
        {
            if (element == null)
            {
                return String.Empty;
            }
            string elementId = element.Id;
            if (elementId != null)
            {
                elementId = elementId.Trim();
            }
            if (String.IsNullOrEmpty(elementId))
            {
                return String.Empty;
            }
            if (elementId.Contains("&#x"))
            {
                elementId = HttpUtility.HtmlDecode(elementId);
            }
            if (elementId.Contains("レイヤー"))
            {
                elementId = elementId.Replace("レイヤー", "Layer");
            }
            else if (elementId.Equals("イラスト"))
            {
                elementId = "Illustration";
            }
            else if (elementId.Equals("台紙"))
            {
                elementId = "Mount";
            }
            else if (elementId.Equals("キャプション"))
            {
                elementId = "Caption";
            }
            else if (elementId.Equals("細線"))
            {
                elementId = "ThinLine";
            }
            int numberId = 0;
            if (Int32.TryParse(elementId, out numberId))
            {
                return String.Empty;
            }

            elementId = elementId.Replace(':', '_');
            elementId = elementId.Replace(' ', '_');
            elementId = elementId.Replace('.', '_');
            elementId = elementId.Replace('-', '_');

            return elementId;
        }
示例#6
0
        public static Matrix GetTransformMatrix(SvgElement element)
        {
            ISvgTransformable transElm = element as ISvgTransformable;
            if (transElm == null)
                return Matrix.Identity;

            SvgTransformList svgTList = (SvgTransformList)transElm.Transform.AnimVal;
            //SvgTransform svgTransform = (SvgTransform)svgTList.Consolidate();
            SvgMatrix svgMatrix = ((SvgTransformList)transElm.Transform.AnimVal).TotalMatrix;

            return new Matrix(svgMatrix.A, svgMatrix.B, svgMatrix.C,
                svgMatrix.D, svgMatrix.E, svgMatrix.F);
        }
示例#7
0
        public WpfTextRendering(SvgElement element)
            : base(element)
        {
            _textElement = element as SvgTextElement;
            if (_textElement == null)
            {
                throw new InvalidOperationException();
            }

            _horzRenderer = new WpfHorzTextRenderer(_textElement, this);
            _vertRenderer = new WpfVertTextRenderer(_textElement, this);
            _pathRenderer = new WpfPathTextRenderer(_textElement, this);
        }
示例#8
0
        public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthSource source, SvgLengthDirection direction, string defaultValue)
        {
            this.ownerElement = ownerElement;
            this.propertyName = propertyName;
            this.direction = direction;
            this.defaultValue = defaultValue;
            this.source = source;

            if(this.source == SvgLengthSource.Xml || this.source == SvgLengthSource.Css)
            {
                getCssXmlValue();
            }
        }
示例#9
0
        public static string GetElementName(SvgElement element)
        {
            if (element == null)
            {
                return String.Empty;
            }
            string elementId = element.Id;
            if (elementId != null)
            {
                elementId = elementId.Trim();
            }
            if (String.IsNullOrEmpty(elementId))
            {
                return String.Empty;
            }
            elementId = elementId.Replace(':', '_');
            elementId = elementId.Replace(" ", String.Empty);
            elementId = elementId.Replace('.', '_');
            elementId = elementId.Replace('-', '_');

            return elementId;
        }
示例#10
0
 public SvgUriReference(SvgElement ownerElement)
 {
     _ownerElement = ownerElement;
     _ownerElement.attributeChangeHandler += OnAttributeChange;
 }
示例#11
0
 public SvgViewSpec(SvgElement ownerElement)
     : base(ownerElement)
 {
     // only use the base...
 }
 public GdiTextRendering(SvgElement element)
     : base(element)
 {
 }
示例#13
0
 public GdiMarkerRendering(SvgElement element)
     : base(element)
 {
 }
示例#14
0
 public WpfGroupRendering(SvgElement element)
     : base(element)
 {
 }
 public SvgAnimatedPreserveAspectRatio(string attr, SvgElement ownerElement)
 {
     baseVal = new SvgPreserveAspectRatio(attr, ownerElement);
     animVal = baseVal;
 }
示例#16
0
 public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal)
     : this(ownerElement, propertyName, direction, baseVal, string.Empty)
 {
 }
示例#17
0
 public SvgFitToViewBox(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }
示例#18
0
 public SvgZoomAndPan(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
 }
示例#19
0
        public SvgLength(string propertyName, SvgStyleableElement ownerElement, SvgLengthDirection direction, string defaultValue)
        {
            this.ownerElement = ownerElement;
            this.direction = direction;

            string baseVal = ownerElement.GetPropertyValue(propertyName);
            if (baseVal == null || baseVal == "")
            {
                baseVal = defaultValue;
            }

            baseVal = SvgNumber.ScientificToDec(baseVal);

            this.cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
        }
示例#20
0
        public SvgLength(string propertyName, string baseVal, string defaultValue, SvgElement ownerElement, SvgLengthDirection direction)
        {
            this.ownerElement = ownerElement;
            this.direction = direction;

            if (baseVal == null || baseVal.Length == 0)
            {
                baseVal = defaultValue;
            }

            baseVal = SvgNumber.ScientificToDec(baseVal);

            this.cssLength = new CssAbsPrimitiveLengthValue(new CssPrimitiveLengthValue(baseVal, false), propertyName, ownerElement);
        }
示例#21
0
 public SvgTests(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }
示例#22
0
        protected void FitToViewbox(WpfDrawingContext context, SvgElement svgElement, Rect elementBounds)
        {
            if (svgElement == null)
            {
                return;
            }
            ISvgFitToViewBox fitToView = svgElement as ISvgFitToViewBox;
            if (fitToView == null)
            {
                return;
            }

            SvgPreserveAspectRatio spar = (SvgPreserveAspectRatio)fitToView.PreserveAspectRatio.AnimVal;

            double[] transformArray = spar.FitToViewBox((SvgRect)fitToView.ViewBox.AnimVal,
              new SvgRect(elementBounds.X, elementBounds.Y, elementBounds.Width, elementBounds.Height));

            double translateX = transformArray[0];
            double translateY = transformArray[1];
            double scaleX     = transformArray[2];
            double scaleY     = transformArray[3];

            Transform translateMatrix = null;
            Transform scaleMatrix     = null;
            //if (translateX != 0 || translateY != 0)
            {
                translateMatrix = new TranslateTransform(translateX, translateY);
            }
            if ((float)scaleX != 1.0f && (float)scaleY != 1.0f)
            {
                scaleMatrix = new ScaleTransform(scaleX, scaleY);
            }

            if (translateMatrix != null && scaleMatrix != null)
            {
                // Create a TransformGroup to contain the transforms
                // and add the transforms to it.
                TransformGroup transformGroup = new TransformGroup();
                transformGroup.Children.Add(scaleMatrix);
                transformGroup.Children.Add(translateMatrix);

                this.Transform = transformGroup;
            }
            else if (translateMatrix != null)
            {
                this.Transform = translateMatrix;
            }
            else if (scaleMatrix != null)
            {
                this.Transform = scaleMatrix;
            }
        }
示例#23
0
        public SvgExternalResourcesRequired(SvgElement ownerElement)
        {
            this.ownerElement = ownerElement;

            this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
        }
 public SvgAnimatedLength(SvgElement ownerElement, string propertyName, 
     SvgLengthDirection direction, string strValue, string defaultValue)
 {
     baseVal = new SvgLength(ownerElement, propertyName, direction,
         strValue, defaultValue);
 }
示例#25
0
 public SvgFitToViewBox(SvgElement ownerElement)
 {
     _ownerElement = ownerElement;
     _ownerElement.attributeChangeHandler += OnAttributeChange;
 }
示例#26
0
 public SvgAnimatedLength(SvgElement ownerElement, string propertyName,
                          SvgLengthDirection direction, string strValue, string defaultValue)
 {
     _baseVal = new SvgLength(ownerElement, propertyName, direction, strValue, defaultValue);
     _animVal = _baseVal;
 }
 public SvgExternalResourcesRequired(SvgElement ownerElement)
 {
     _ownerElement = ownerElement;
     _ownerElement.attributeChangeHandler += OnAttributeChange;
 }
示例#28
0
 public WpfUseRendering(SvgElement element)
     : base(element)
 {
 }
        public SvgPreserveAspectRatio(string attr, SvgElement ownerElement)
        {
            this.ownerElement = ownerElement;

            Match match = parCheck.Match(attr.Trim());

            if (match.Groups["align"].Success)
            {
                switch (match.Groups["align"].Value)
                {
                case "none":
                    _alignment = SvgPreserveAspectRatioType.None;
                    break;

                case "xMinYMin":
                    _alignment = SvgPreserveAspectRatioType.XMinYMin;
                    break;

                case "xMidYMin":
                    _alignment = SvgPreserveAspectRatioType.XMidYMin;
                    break;

                case "xMaxYMin":
                    _alignment = SvgPreserveAspectRatioType.XMaxYMin;
                    break;

                case "xMinYMid":
                    _alignment = SvgPreserveAspectRatioType.XMinYMid;
                    break;

                case "xMaxYMid":
                    _alignment = SvgPreserveAspectRatioType.XMaxYMid;
                    break;

                case "xMinYMax":
                    _alignment = SvgPreserveAspectRatioType.XMinYMax;
                    break;

                case "xMidYMax":
                    _alignment = SvgPreserveAspectRatioType.XMidYMax;
                    break;

                case "xMaxYMax":
                    _alignment = SvgPreserveAspectRatioType.XMaxYMax;
                    break;

                default:
                    _alignment      = SvgPreserveAspectRatioType.XMidYMid;
                    _isDefaultAlign = true;
                    break;
                }
            }
            else
            {
                _alignment      = SvgPreserveAspectRatioType.XMidYMid;
                _isDefaultAlign = true;
            }

            if (match.Groups["meet"].Success)
            {
                _isDefaultAlign = false;
                switch (match.Groups["meet"].Value)
                {
                case "slice":
                    _meetOrSlice = SvgMeetOrSlice.Slice;
                    break;

                case "meet":
                    _meetOrSlice = SvgMeetOrSlice.Meet;
                    break;

                case "":
                    _meetOrSlice = SvgMeetOrSlice.Meet;
                    break;

                default:
                    _meetOrSlice = SvgMeetOrSlice.Unknown;
                    break;
                }
            }
            else
            {
                _meetOrSlice = SvgMeetOrSlice.Meet;
            }
        }
 public SvgMarkerGraphicsNode(SvgElement element)
     : base(element)
 {
 }
 public SvgUriReference(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }
示例#32
0
 public GdiRendering(SvgElement element)
     : base(element)
 {
     _uniqueColor = Color.Empty;
 }
示例#33
0
 public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal)
     : this(ownerElement, propertyName, direction, baseVal, String.Empty)
 {
 }
 protected GdiRenderingBase(SvgElement element)
 {
     this.element      = element;
     this.screenRegion = SvgRectF.Empty;
 }
示例#35
0
 public SvgZoomAndPan(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
 }
示例#36
0
 public SvgAnimatedLengthList(string propertyName, string str, SvgElement ownerElement, SvgLengthDirection direction)
 {
     baseVal = new SvgLengthList(propertyName, str, ownerElement, direction);
     animVal = baseVal;
 }
示例#37
0
 public SvgAnimatedPreserveAspectRatio(string attr, SvgElement ownerElement)
 {
     _baseVal = new SvgPreserveAspectRatio(attr, ownerElement);
     _animVal = _baseVal;
 }
示例#38
0
 protected WpfRenderingBase(SvgElement element)
 {
     this._svgElement = element;
 }
 /// <summary>
 /// Used for attributes of basic type 'length' which can be animated.
 /// </summary>
 /// <param name="ownerElement">The elements that contains the length</param>
 /// <param name="direction">The direction of the length, 0=x-axis, 1=y-axis, 2=no special axis</param>
 /// <param name="defaultValue">String to parse for the value</param>
 public SvgAnimatedLength(SvgElement ownerElement, string propertyName,
                          SvgLengthDirection direction, string defaultValue)
 {
     _baseVal = new SvgLength(ownerElement, propertyName, SvgLengthSource.Xml, direction, defaultValue);
 }
示例#40
0
 public GdiPathRendering(SvgElement element)
     : base(element)
 {
 }
 public SvgAnimatedLengthList(string propertyName, string str, SvgElement ownerElement, SvgLengthDirection direction)
 {
     baseVal = new SvgLengthList(propertyName, str, ownerElement, direction);
     animVal = baseVal;
 }
示例#42
0
 public GraphicsNode(SvgElement element)
     : base(element)
 {
 }
 public SvgViewSpec(SvgElement ownerElement)
     : base(ownerElement)
 {
     // only use the base...
 }
示例#44
0
 public GdiImageRendering(SvgElement element)
     : base(element)
 {
 }
示例#45
0
 public SvgURIReference(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }