1 /** 2 * @class 形状クラス 3 */ 4 function Shape() { 5 } 6 7 /** 形状タイプ:不明 @type Number @final */ 8 Shape.TYPE_UNKNOWN = 0; 9 10 /** 形状タイプ:円 @type Number @final */ 11 Shape.TYPE_CIRCLE = 1; 12 13 /** 形状タイプ:長方形 @type Number @final */ 14 Shape.TYPE_RECTANGLE = 2; 15 16 17 /** 18 * 構成点を追加する。 19 * @param {Object} point 点座標を表すオブジェクト 20 * @param {Number} point.x X座標 21 * @param {Number} point.y Y座標 22 */ 23 Shape.prototype.addVertex = function(point) { 24 }; 25 26 /** 27 * 構成点を返す。 28 * @param {Number} index 構成点番号 29 * @returns {Object} 点座標を表すオブジェクト 30 * @returns {Number} .x X座標 31 * @returns {Number} .y Y座標 32 */ 33 Shape.prototype.getVertex = function(index) { 34 }; 35 36 /** 37 * 構成点数を返す。 38 * @returns {Number} 点数 39 */ 40 Shape.prototype.getVertexCount = function() { 41 }; 42 43 44 /** 45 * @class 円形クラス 46 * @extends Shape 47 * @property {Number} type 形状タイプ。{@link Shape.TYPE_CIRCLE}が設定されている。 48 */ 49 function Circle() { 50 this.type = Shape.TYPE_CIRCLE; 51 } 52 53 /** 54 * 半径を返す。 55 * @return {Number} 半径 56 */ 57 Circle.prototype.getRadius = function() { 58 59 }; 60 61 /** 62 * 半径を設定する。 63 * @param {Number} radius 半径 64 */ 65 Circle.prototype.setRadius = function(radius) { 66 67 }; 68 69 /** 70 * @class 長方形クラス 71 * @extends Shape 72 * @property {Number} type 形状タイプ。{@link Shape.TYPE_RECTANGLE}が設定されている。 73 */ 74 function Rectangle() { 75 this.type = Shape.TYPE_RECTANGLE; 76 } 77 78 /** 79 * 幅と高さを返す。 80 * @returns {Object} サイズ情報を持つオブジェクト 81 * @returns {Number} .width 幅 82 * @returns {Number} .height 高さ 83 */ 84 Rectangle.prototype.getSize = function() { 85 86 }; 87 88 /** 89 * 幅と高さを設定する。 90 * @param {Number} width 幅 91 * @param {Number} height 高さ 92 */ 93 Rectangle.prototype.setSize = function(width, height) { 94 95 }; 96