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

            this.FromString(listString);
        }
Exemplo n.º 3
0
 public void InitTest()
 {
     if(!initDone)
     {
         doc = LoadXml("<rect height='1' width='1' />");
         elm = (SvgElement)doc.SelectSingleNode("//*[local-name()='rect']");
         initDone = true;
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 10
0
 public SvgUriReference(SvgElement ownerElement)
 {
     _ownerElement = ownerElement;
     _ownerElement.attributeChangeHandler += OnAttributeChange;
 }
Exemplo n.º 11
0
 public SvgViewSpec(SvgElement ownerElement)
     : base(ownerElement)
 {
     // only use the base...
 }
Exemplo n.º 12
0
 public GdiTextRendering(SvgElement element)
     : base(element)
 {
 }
Exemplo n.º 13
0
 public GdiMarkerRendering(SvgElement element)
     : base(element)
 {
 }
Exemplo n.º 14
0
 public WpfGroupRendering(SvgElement element)
     : base(element)
 {
 }
 public SvgAnimatedPreserveAspectRatio(string attr, SvgElement ownerElement)
 {
     baseVal = new SvgPreserveAspectRatio(attr, ownerElement);
     animVal = baseVal;
 }
Exemplo n.º 16
0
 public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal)
     : this(ownerElement, propertyName, direction, baseVal, string.Empty)
 {
 }
Exemplo n.º 17
0
 public SvgFitToViewBox(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }
Exemplo n.º 18
0
 public SvgZoomAndPan(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 21
0
 public SvgTests(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 23
0
        public SvgExternalResourcesRequired(SvgElement ownerElement)
        {
            this.ownerElement = ownerElement;

            this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
        }
Exemplo n.º 24
0
 public SvgAnimatedLength(SvgElement ownerElement, string propertyName, 
     SvgLengthDirection direction, string strValue, string defaultValue)
 {
     baseVal = new SvgLength(ownerElement, propertyName, direction,
         strValue, defaultValue);
 }
Exemplo n.º 25
0
 public SvgFitToViewBox(SvgElement ownerElement)
 {
     _ownerElement = ownerElement;
     _ownerElement.attributeChangeHandler += OnAttributeChange;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 30
0
 public SvgMarkerGraphicsNode(SvgElement element)
     : base(element)
 {
 }
Exemplo n.º 31
0
 public SvgUriReference(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }
Exemplo n.º 32
0
 public GdiRendering(SvgElement element)
     : base(element)
 {
     _uniqueColor = Color.Empty;
 }
Exemplo n.º 33
0
 public SvgLength(SvgElement ownerElement, string propertyName, SvgLengthDirection direction, string baseVal)
     : this(ownerElement, propertyName, direction, baseVal, String.Empty)
 {
 }
Exemplo n.º 34
0
 protected GdiRenderingBase(SvgElement element)
 {
     this.element      = element;
     this.screenRegion = SvgRectF.Empty;
 }
Exemplo n.º 35
0
 public SvgZoomAndPan(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
 }
Exemplo n.º 36
0
 public SvgAnimatedLengthList(string propertyName, string str, SvgElement ownerElement, SvgLengthDirection direction)
 {
     baseVal = new SvgLengthList(propertyName, str, ownerElement, direction);
     animVal = baseVal;
 }
Exemplo n.º 37
0
 public SvgAnimatedPreserveAspectRatio(string attr, SvgElement ownerElement)
 {
     _baseVal = new SvgPreserveAspectRatio(attr, ownerElement);
     _animVal = _baseVal;
 }
Exemplo n.º 38
0
 protected WpfRenderingBase(SvgElement element)
 {
     this._svgElement = element;
 }
Exemplo n.º 39
0
 /// <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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 42
0
 public GraphicsNode(SvgElement element)
     : base(element)
 {
 }
 public SvgViewSpec(SvgElement ownerElement)
     : base(ownerElement)
 {
     // only use the base...
 }
Exemplo n.º 44
0
 public GdiImageRendering(SvgElement element)
     : base(element)
 {
 }
Exemplo n.º 45
0
 public SvgURIReference(SvgElement ownerElement)
 {
     this.ownerElement = ownerElement;
     this.ownerElement.attributeChangeHandler += new NodeChangeHandler(AttributeChange);
 }