OSDN Git Service

Path Typeのマジックナンバーをコメントに変換
authordhrname <dhrname@users.sourceforge.jp>
Mon, 25 Jun 2012 14:01:02 +0000 (23:01 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Mon, 25 Jun 2012 14:01:02 +0000 (23:01 +0900)
org/w3c/dom/svg.js

index 0a77548..e4ebfb1 100644 (file)
@@ -2338,34 +2338,34 @@ function SVGAnimatedPreserveAspectRatio() {
 };
 
 function SVGPathSeg() { 
-  /*readonly unsigned short*/ this.pathSegType = SVGPathSeg.PATHSEG_UNKNOWN;
+  /*readonly unsigned short*/ this.pathSegType = /*SVGPathSeg.PATHSEG_UNKNOWN*/ 0;
   /*readonly DOMString*/      this.pathSegTypeAsLetter = null;
   return this;
 };
 
-(function(t) {
+/*(function(t) {
     // Path Segment Types
-  /*unsigned short*/ t.PATHSEG_UNKNOWN                      = 0;
-  /*unsigned short*/ t.PATHSEG_CLOSEPATH                    = 1;
-  /*unsigned short*/ t.PATHSEG_MOVETO_ABS                   = 2;
-  /*unsigned short*/ t.PATHSEG_MOVETO_REL                   = 3;
-  /*unsigned short*/ t.PATHSEG_LINETO_ABS                   = 4;
-  /*unsigned short*/ t.PATHSEG_LINETO_REL                   = 5;
-  /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_ABS            = 6;
-  /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_REL            = 7;
-  /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_ABS        = 8;
-  /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_REL        = 9;
-  /*unsigned short*/ t.PATHSEG_ARC_ABS                      = 10;
-  /*unsigned short*/ t.PATHSEG_ARC_REL                      = 11;
-  /*unsigned short*/ t.PATHSEG_LINETO_HORIZONTAL_ABS        = 12;
-  /*unsigned short*/ t.PATHSEG_LINETO_HORIZONTAL_REL        = 13;
-  /*unsigned short*/ t.PATHSEG_LINETO_VERTICAL_ABS          = 14;
-  /*unsigned short*/ t.PATHSEG_LINETO_VERTICAL_REL          = 15;
-  /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS     = 16;
-  /*unsigned short*/ t.PATHSEG_CURVETO_CUBIC_SMOOTH_REL     = 17;
-  /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
-  /*unsigned short*/ t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
-})(SVGPathSeg);
+  /*unsigned short t.PATHSEG_UNKNOWN                      = 0;
+  /*unsigned short t.PATHSEG_CLOSEPATH                    = 1;
+  /*unsigned short t.PATHSEG_MOVETO_ABS                   = 2;
+  /*unsigned short t.PATHSEG_MOVETO_REL                   = 3;
+  /*unsigned short t.PATHSEG_LINETO_ABS                   = 4;
+  /*unsigned short t.PATHSEG_LINETO_REL                   = 5;
+  /*unsigned short t.PATHSEG_CURVETO_CUBIC_ABS            = 6;
+  /*unsigned short t.PATHSEG_CURVETO_CUBIC_REL            = 7;
+  /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_ABS        = 8;
+  /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_REL        = 9;
+  /*unsigned short t.PATHSEG_ARC_ABS                      = 10;
+  /*unsigned short t.PATHSEG_ARC_REL                      = 11;
+  /*unsigned short t.PATHSEG_LINETO_HORIZONTAL_ABS        = 12;
+  /*unsigned short t.PATHSEG_LINETO_HORIZONTAL_REL        = 13;
+  /*unsigned short t.PATHSEG_LINETO_VERTICAL_ABS          = 14;
+  /*unsigned short t.PATHSEG_LINETO_VERTICAL_REL          = 15;
+  /*unsigned short t.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS     = 16;
+  /*unsigned short t.PATHSEG_CURVETO_CUBIC_SMOOTH_REL     = 17;
+  /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18;
+  /*unsigned short t.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19;
+})(SVGPathSeg);*/
 /*SVGPathSegxx
  *軽量化のために、SVGPathSegの継承をしない。また、{}オブジェクトで代用する予定
  */
@@ -2373,7 +2373,7 @@ function SVGPathSegClosePath() {
   return this;
 };
 SVGPathSegClosePath.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_CLOSEPATH,
+  pathSegType : /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1,
   pathSegTypeAsLetter : "z"
 };
 function SVGPathSegMovetoAbs() { 
@@ -2382,7 +2382,7 @@ function SVGPathSegMovetoAbs() {
   return this;
 };
 SVGPathSegMovetoAbs.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_MOVETO_ABS,
+  pathSegType : /*SVGPathSeg.PATHSEG_MOVETO_ABS*/ 2,
   pathSegTypeAsLetter : "M"
 };
 function SVGPathSegMovetoRel() { 
@@ -2391,7 +2391,7 @@ function SVGPathSegMovetoRel() {
   return this;
 };
 SVGPathSegMovetoRel.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_MOVETO_REL,
+  pathSegType : /*SVGPathSeg.PATHSEG_MOVETO_REL*/ 3,
   pathSegTypeAsLetter : "m"
 };
 function SVGPathSegLinetoAbs() { 
@@ -2400,7 +2400,7 @@ function SVGPathSegLinetoAbs() {
   return this;
 };
 SVGPathSegLinetoAbs.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_LINETO_ABS,
+  pathSegType : /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4,
   pathSegTypeAsLetter : "L"
 };
 function SVGPathSegLinetoRel() { 
@@ -2409,7 +2409,7 @@ function SVGPathSegLinetoRel() {
   return this;
 };
 SVGPathSegLinetoRel.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_LINETO_REL,
+  pathSegType : /*SVGPathSeg.PATHSEG_LINETO_REL*/ 5,
   pathSegTypeAsLetter : "l"
 };
 function SVGPathSegCurvetoCubicAbs() { 
@@ -2422,7 +2422,7 @@ function SVGPathSegCurvetoCubicAbs() {
   return this;
 };
 SVGPathSegCurvetoCubicAbs.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS,
+  pathSegType : /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6,
   pathSegTypeAsLetter : "C"
 };
 function SVGPathSegCurvetoCubicRel() { 
@@ -2435,7 +2435,7 @@ function SVGPathSegCurvetoCubicRel() {
   return this;
 };
 SVGPathSegCurvetoCubicRel.prototype = {
-  pathSegType : SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL,
+  pathSegType : /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL*/ 7,
   pathSegTypeAsLetter : "c"
 };
 function SVGPathSegCurvetoQuadraticAbs() { 
@@ -2443,7 +2443,7 @@ function SVGPathSegCurvetoQuadraticAbs() {
   /*float*/ this.y;
   /*float*/ this.x1;
   /*float*/ this.y1;
-  this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS*/ 8;
   this.pathSegTypeAsLetter = "Q";
   return this;
 };
@@ -2452,7 +2452,7 @@ function SVGPathSegCurvetoQuadraticRel() {
   /*float*/ this.y;
   /*float*/ this.x1;
   /*float*/ this.y1;
-  this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL*/ 9;
   this.pathSegTypeAsLetter = "q";
   return this;
 };
@@ -2468,7 +2468,7 @@ function SVGPathSegArcAbs() {
 SVGPathSegArcAbs.prototype = {
   /*boolean*/ largeArcFlag : true,
   /*boolean*/ sweepFlag : true,
-  pathSegType : SVGPathSeg.PATHSEG_ARC_ABS,
+  pathSegType : /*SVGPathSeg.PATHSEG_ARC_ABS*/ 10,
   pathSegTypeAsLetter : "A"
 };
 function SVGPathSegArcRel() { 
@@ -2482,30 +2482,30 @@ function SVGPathSegArcRel() {
 SVGPathSegArcRel.prototype = {
   /*boolean*/ largeArcFlag : true,
   /*boolean*/ sweepFlag : true,
-  pathSegType : SVGPathSeg.PATHSEG_ARC_REL,
+  pathSegType : /*SVGPathSeg.PATHSEG_ARC_REL*/ 11,
   pathSegTypeAsLetter : "a"
 };
 function SVGPathSegLinetoHorizontalAbs() { 
   /*float*/ this.x;
-  this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS*/ 12;
   this.pathSegTypeAsLetter = "H";
   return this;
 };
 function SVGPathSegLinetoHorizontalRel() { 
   /*float*/ this.x;
-  this.pathSegType = SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL*/ 13;
   this.pathSegTypeAsLetter = "h";
   return this;
 };
 function SVGPathSegLinetoVerticalAbs() { 
   /*float*/ this.y;
-  this.pathSegType = SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS*/ 14;
   this.pathSegTypeAsLetter = "V";
   return this;
 };
 function SVGPathSegLinetoVerticalRel() { 
   /*float*/ this.y;
-  this.pathSegType = SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL*/ 15;
   this.pathSegTypeAsLetter = "v";
   return this;
 };
@@ -2514,7 +2514,7 @@ function SVGPathSegCurvetoCubicSmoothAbs() {
   /*float*/ this.y;
   /*float*/ this.x2;
   /*float*/ this.y2;
-  this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS*/ 16;
   this.pathSegTypeAsLetter = "S";
   return this;
 };
@@ -2523,21 +2523,21 @@ function SVGPathSegCurvetoCubicSmoothRel() {
   /*float*/ this.y;
   /*float*/ this.x2;
   /*float*/ this.y2;
-  this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL*/ 17;
   this.pathSegTypeAsLetter = "s";
   return this;
 };
 function SVGPathSegCurvetoQuadraticSmoothAbs() {
   /*float*/ this.x;
   /*float*/ this.y;
-  this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS*/ 18;
   this.pathSegTypeAsLetter = "T";
   return this;
 };
 function SVGPathSegCurvetoQuadraticSmoothRel() {
   /*float*/ this.x;
   /*float*/ this.y;
-  this.pathSegType = SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;
+  this.pathSegType = /*SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL*/ 19;
   this.pathSegTypeAsLetter = "t";
   return this;
 };
@@ -3107,10 +3107,10 @@ _sproto._com = {
         nl = this.normalizedPathSegList;
     for (var i=1,nln=nl.numberOfItems,ms=null;i<nln;++i) {
       var seg = nl.getItem(i);
-      if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
+      if (seg.pathSegType === /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4) {
         var ps = nl.getItem(i-1);
         s += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
-      } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
+      } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6) {
         var ps = nl.getItem(i-1), dd = 0;
         /*2点のハンドルを結んだ線分の3辺と、
          *セグメントの始点と終点を結んだ1辺を足して2で割ったものを、ベジェ曲線の距離の近似値とする
@@ -3124,7 +3124,7 @@ _sproto._com = {
         dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
         dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
         s += dd / 2;
-      } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
+      } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1) {
         var ps = nl.getItem(i-1), ms = nl.getItem(0);
         s += _math.sqrt(_math.pow((ps.x-ms.x), 2) + _math.pow((ps.y-ms.y), 2));
       }
@@ -3146,12 +3146,12 @@ _sproto._com = {
       return s;
     }
     var ps = nl.getItem(segn-1);
-    if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
+    if (seg.pathSegType === /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4) {
       var segl = _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
       var t = (segl + this._dis) / segl;
       s.x = ps.x + t * (seg.x-ps.x);
       s.y = ps.y + t * (seg.y-ps.y);
-    } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
+    } else if (seg.pathSegType === /*VGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6) {
       var dd = 0;
       dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
       dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
@@ -3170,10 +3170,10 @@ _sproto._com = {
            +3*(ps.y - 2*seg.y1 + seg.y2) * _math.pow(t, 2)
            +3*(seg.y1 - ps.y) * t
            +ps.y;
-    } else if (seg.pathSegType === SVGPathSeg.MOVETO_ABS) {
+    } else if (seg.pathSegType === /*SVGPathSeg.MOVETO_ABS*/ 2) {
       s.x = seg.x;
       s.y = seg.y;
-    } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
+    } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1) {
       var ms = nl.getItem(0), segl = _math.sqrt(_math.pow((seg.x-mx.x), 2) + _math.pow((seg.y-ms.y), 2));
       var t = (segl + this._dis) / segl;
       s.x = ms.x + t * (seg.x-ms.x);
@@ -3185,10 +3185,10 @@ _sproto._com = {
     var nl = this.normalizedPathSegList; //仕様ではpathSegList
     for (var i=0,nln=nl.numberOfItems,ms=null;i<nln;++i) {
       var seg = nl.getItem(i);
-      if (seg.pathSegType === SVGPathSeg.PATHSEG_LINETO_ABS) {
+      if (seg.pathSegType === /*SVGPathSeg.PATHSEG_LINETO_ABS*/ 4) {
         var ps = nl.getItem(i-1);
         distance -= _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
-      } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS) {
+      } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS*/ 6) {
         var ps = nl.getItem(i-1), dd = 0;
         dd += _math.sqrt(_math.pow((seg.x1-ps.x), 2) + _math.pow((seg.y1-ps.y), 2));
         dd += _math.sqrt(_math.pow((seg.x2-seg.x1), 2) + _math.pow((seg.y2-seg.y1), 2));
@@ -3196,7 +3196,7 @@ _sproto._com = {
         dd += _math.sqrt(_math.pow((seg.x-ps.x), 2) + _math.pow((seg.y-ps.y), 2));
         distance -= dd / 2;
         dd = void 0;
-      } else if (seg.pathSegType === SVGPathSeg.PATHSEG_CLOSEPATH) {
+      } else if (seg.pathSegType === /*SVGPathSeg.PATHSEG_CLOSEPATH*/ 1) {
         var ps = nl.getItem(i-1), ms = nl.getItem(0);
         distance -= _math.sqrt(_math.pow((ps.x-ms.x), 2) + _math.pow((ps.y-ms.y), 2));
       }