svnno****@sourc*****
svnno****@sourc*****
2010年 10月 10日 (日) 21:29:16 JST
Revision: 2050 http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2050 Author: dhrname Date: 2010-10-10 21:29:16 +0900 (Sun, 10 Oct 2010) Log Message: ----------- SVGAngleとSVGAnimatedAngleオブジェクトを実装 Modified Paths: -------------- branches/06x/061/org/w3c/dom/svg.js Modified: branches/06x/061/org/w3c/dom/svg.js =================================================================== --- branches/06x/061/org/w3c/dom/svg.js 2010-10-10 11:00:48 UTC (rev 2049) +++ branches/06x/061/org/w3c/dom/svg.js 2010-10-10 12:29:16 UTC (rev 2050) @@ -566,6 +566,51 @@ /*readonly SVGNumberList*/ this.animVal = this.baseVal = new SVGLengthList(); return this; }; +function SVGAngle() { + /*readonly attribute unsigned short*/ this.unitType = 0; + /*attribute float*/ this.value = 0; + // raises DOMException on setting + /*attribute float*/ this.valueInSpecifiedUnits; + // raises DOMException on setting + /*attribute DOMString*/ this.valueAsString; + // raises DOMException on setting + return this; +}; +SVGAngle.prototype = { + /*void*/ newValueSpecifiedUnits : function(/*in unsigned short*/ unitType, /*in float*/ valueInSpecifiedUnits ) { + var n = 1, _s = ""; //nは各単位から利用単位への変換数値。_sは単位の文字列を表す + if (unitType === SVGAngle.SVG_ANGLETYPE_DEG) { + _s = "deg" + } else if (unitType === SVGAngle.SVG_ANGLETYPE_RAD) { + n = Math.PI / 180; + _s = "rad"; + } else if (unitType === SVGAngle.SVG_ANGLETYPE_GRAD) { + n = 9 / 10; + _s = "grad"; + } + this.unitType = unitType; + this.value = valueInSpecifiedUnits * n; + this.valueInSpecifiedUnits = valueInSpecifiedUnits; + this.valuAsString = valueInSpecifiedUnits + _s; + n = _s = null; + //raises( DOMException ); + }, + /*void*/ convertToSpecifiedUnits : function/*in unsigned short*/ unitType ) { + this.newValueSpecifiedUnits(unitType, this.valueInSpecifiedUnits); + //raises( DOMException ); + } +} +// Angle Unit Types +/*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_UNKNOWN = 0; +/*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_UNSPECIFIED = 1; +/*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_DEG = 2; +/*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_RAD = 3; +/*const unsigned short*/ SVGAngle.SVG_ANGLETYPE_GRAD = 4; +function SVGAnimatedAngle() { + /*readonly attribute SVGAngle*/ this.baseVal = new SVGAngle(); + /*readonly attribute SVGAngle*/ this.animVal = this.baseVal; + return this; +}; function SVGColor() { CSSValue.call(this, arguments); /*readonly unsigned short*/ this.colorType = SVGColor.SVG_COLORTYPE_UNKNOWN;