diff --git a/src/Api/ScoreControllerProvider.php b/src/Api/ScoreControllerProvider.php index df630dd..e7d58ef 100644 --- a/src/Api/ScoreControllerProvider.php +++ b/src/Api/ScoreControllerProvider.php @@ -95,16 +95,16 @@ class ScoreControllerProvider implements ControllerProviderInterface // attributes $hit->setGlasses($data_hit['glasses']); foreach(Models\Hit::$ATTRIBUTES as $attribute) { - $hit->setAttribute($attribute, $data_hit[$attribute]); + $hit->getAttributes()->setAttribute($attribute, $data_hit[$attribute]); } // emotions foreach(Models\Hit::$EMOTIONS as $emotion) { - $hit->setEmotion($emotion, $data_hit['emotions'][$emotion]); + $hit->getEmotions()->setEmotion($emotion, $data_hit['emotions'][$emotion]); } //expressions foreach(Models\Hit::$EXPRESSIONS as $expression) { - $hit->setExpression($expression, $data_hit['expressions'][$expression]); + $hit->getExpressions()->setExpression($expression, $data_hit['expressions'][$expression]); } //points diff --git a/src/Models/Hit.php b/src/Models/Hit.php index e034256..975a27f 100644 --- a/src/Models/Hit.php +++ b/src/Models/Hit.php @@ -14,10 +14,6 @@ use Doctrine\Common\Collections\ArrayCollection; */ class Hit { - public static $EMOTIONS = ['anger','contempt','disgust','fear','joy','sadness','surprise']; - public static $ATTRIBUTES = ['gender','ethnicity','age']; - public static $EXPRESSIONS = ['roll','pitch','yaw','inter_ocular_distance','mouth_open','lip_press','brow_raise','nose_wrinkler','lip_depressor','brow_furrow','attention','smile','inner_brow_raiser','chin_raiser','smirk','lip_suck','upper_lip_raiser','lip_pucker','eye_closure','engagement','valence']; - /** * @var integer * @@ -47,6 +43,590 @@ class Hit */ private $score; + + /** @ORM\Embedded(class="Attributes", columnPrefix=false) */ + private $attributes; + + /** @ORM\Embedded(class="Expressions", columnPrefix=false) */ + private $expressions; + + /** @ORM\Embedded(class = "Emotions", columnPrefix=false) */ + private $emotions; + + /** @ORM\Embedded(class="Point", columnPrefix="point_0") */ + private $point0; + /** @ORM\Embedded(class="Point", columnPrefix="point_1") */ + private $point1; + /** @ORM\Embedded(class="Point", columnPrefix="point_2") */ + private $point2; + /** @ORM\Embedded(class="Point", columnPrefix="point_3") */ + private $point3; + /** @ORM\Embedded(class="Point", columnPrefix="point_4") */ + private $point4; + /** @ORM\Embedded(class="Point", columnPrefix="point_5") */ + private $point5; + /** @ORM\Embedded(class="Point", columnPrefix="point_6") */ + private $point6; + /** @ORM\Embedded(class="Point", columnPrefix="point_7") */ + private $point7; + /** @ORM\Embedded(class="Point", columnPrefix="point_8") */ + private $point8; + /** @ORM\Embedded(class="Point", columnPrefix="point_9") */ + private $point9; + /** @ORM\Embedded(class="Point", columnPrefix="point_10") */ + private $point10; + /** @ORM\Embedded(class="Point", columnPrefix="point_11") */ + private $point11; + /** @ORM\Embedded(class="Point", columnPrefix="point_12") */ + private $point12; + /** @ORM\Embedded(class="Point", columnPrefix="point_13") */ + private $point13; + /** @ORM\Embedded(class="Point", columnPrefix="point_14") */ + private $point14; + /** @ORM\Embedded(class="Point", columnPrefix="point_15") */ + private $point15; + /** @ORM\Embedded(class="Point", columnPrefix="point_16") */ + private $point16; + /** @ORM\Embedded(class="Point", columnPrefix="point_17") */ + private $point17; + /** @ORM\Embedded(class="Point", columnPrefix="point_18") */ + private $point18; + /** @ORM\Embedded(class="Point", columnPrefix="point_19") */ + private $point19; + /** @ORM\Embedded(class="Point", columnPrefix="point_20") */ + private $point20; + /** @ORM\Embedded(class="Point", columnPrefix="point_21") */ + private $point21; + /** @ORM\Embedded(class="Point", columnPrefix="point_22") */ + private $point22; + /** @ORM\Embedded(class="Point", columnPrefix="point_23") */ + private $point23; + /** @ORM\Embedded(class="Point", columnPrefix="point_24") */ + private $point24; + /** @ORM\Embedded(class="Point", columnPrefix="point_25") */ + private $point25; + /** @ORM\Embedded(class="Point", columnPrefix="point_26") */ + private $point26; + /** @ORM\Embedded(class="Point", columnPrefix="point_27") */ + private $point27; + /** @ORM\Embedded(class="Point", columnPrefix="point_28") */ + private $point28; + /** @ORM\Embedded(class="Point", columnPrefix="point_29") */ + private $point29; + /** @ORM\Embedded(class="Point", columnPrefix="point_30") */ + private $point30; + /** @ORM\Embedded(class="Point", columnPrefix="point_31") */ + private $point31; + /** @ORM\Embedded(class="Point", columnPrefix="point_32") */ + private $point32; + /** @ORM\Embedded(class="Point", columnPrefix="point_33") */ + private $point33; + + + + /* + * A full list of facial landmarks from Affectiva docs + * http://developer.affectiva.com/fpi/ + * + * 0 Right Top Jaw + * 1 Right Jaw Angle + * 2 Tip of Chin + * 3 Left Jaw Angle + * 4 Left Top Jaw + * 5 Outer Right Brow Corner + * 6 Right Brow Center + * 7 Inner Right Brow Corner + * 8 Inner Left Brow Corner + * 9 Left Brow Center + * 10 Outer Left Brow Corner + * 11 Nose Root + * 12 Nose Tip + * 13 Nose Lower Right Boundary + * 14 Nose Bottom Boundary + * 15 Nose Lower Left Boundary + * 16 Outer Right Eye + * 17 Inner Right Eye + * 18 Inner Left Eye + * 19 Outer Left Eye + * 20 Right Lip Corner + * 21 Right Apex Upper Lip + * 22 Upper Lip Center + * 23 Left Apex Upper Lip + * 24 Left Lip Corner + * 25 Left Edge Lower Lip + * 26 Lower Lip Center + * 27 Right Edge Lower Lip + * 28 Bottom Upper Lip + * 29 Top Lower Lip + * 30 Upper Corner Right Eye + * 31 Lower Corner Right Eye + * 32 Upper Corner Left Eye + * 33 Lower Corner Left Eye + */ + + + public function __construct() + { + $this->hits = new ArrayCollection(); + $this->emotions = new Emotions(); + $this->attributes = new Attributes(); + $this->expressions = new Expressions(); + } + + /** + * Gets the value of score. + * + * @return float The score this hit resulted in + */ + public function getScore() + { + return $this->score; + } + + /** + * Gets the value of id. + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Gets the value of target. + * + * @return mixed + */ + public function getTarget() + { + return $this->target; + } + + /** + * Gets the value of game. + * @return mixed + */ + public function getGame() + { + return $this->game; + } + + /** + * Gets the value of emotions. + * + * @return mixed + */ + public function getEmotions() + { + return $this->emotions; + } + /** + * Gets the value of attributes. + * + * @return mixed + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Gets the value of expressions. + * + * @return mixed + */ + public function getExpressions() + { + return $this->expressions; + } + + /** + * Gets the value of point_0y. + * + * @return Point Facial landmark + */ + public function getPoint0() + { + return $this->point0; + } + + /** + * Gets the value of point_1y. + * + * @return Point Facial landmark + */ + public function getPoint1() + { + return $this->point1; + } + + /** + * Gets the value of point_2y. + * + * @return Point Facial landmark + */ + public function getPoint2() + { + return $this->point2; + } + + /** + * Gets the value of point_3y. + * + * @return Point Facial landmark + */ + public function getPoint3() + { + return $this->point3; + } + + /** + * Gets the value of point_4y. + * + * @return Point Facial landmark + */ + public function getPoint4() + { + return $this->point4; + } + + /** + * Gets the value of point_5y. + * + * @return Point Facial landmark + */ + public function getPoint5() + { + return $this->point5; + } + + /** + * Gets the value of point_6y. + * + * @return Point Facial landmark + */ + public function getPoint6() + { + return $this->point6; + } + + /** + * Gets the value of point_7y. + * + * @return Point Facial landmark + */ + public function getPoint7() + { + return $this->point7; + } + + /** + * Gets the value of point_8y. + * + * @return Point Facial landmark + */ + public function getPoint8() + { + return $this->point8; + } + + /** + * Gets the value of point_9y. + * + * @return Point Facial landmark + */ + public function getPoint9() + { + return $this->point9; + } + + /** + * Gets the value of point_10y. + * + * @return Point Facial landmark + */ + public function getPoint10() + { + return $this->point10; + } + + /** + * Gets the value of point_11y. + * + * @return Point Facial landmark + */ + public function getPoint11() + { + return $this->point11; + } + + /** + * Gets the value of point_12y. + * + * @return Point Facial landmark + */ + public function getPoint12() + { + return $this->point12; + } + + /** + * Gets the value of point_13y. + * + * @return Point Facial landmark + */ + public function getPoint13() + { + return $this->point13; + } + + /** + * Gets the value of point_14y. + * + * @return Point Facial landmark + */ + public function getPoint14() + { + return $this->point14; + } + + /** + * Gets the value of point_15y. + * + * @return Point Facial landmark + */ + public function getPoint15() + { + return $this->point15; + } + + /** + * Gets the value of point_16y. + * + * @return Point Facial landmark + */ + public function getPoint16() + { + return $this->point16; + } + + /** + * Gets the value of point_17y. + * + * @return Point Facial landmark + */ + public function getPoint17() + { + return $this->point17; + } + + /** + * Gets the value of point_18y. + * + * @return Point Facial landmark + */ + public function getPoint18() + { + return $this->point18; + } + + /** + * Gets the value of point_19y. + * + * @return Point Facial landmark + */ + public function getPoint19() + { + return $this->point19; + } + + /** + * Gets the value of point_20y. + * + * @return Point Facial landmark + */ + public function getPoint20() + { + return $this->point20; + } + + /** + * Gets the value of point_21y. + * + * @return Point Facial landmark + */ + public function getPoint21() + { + return $this->point21; + } + + /** + * Gets the value of point_22y. + * + * @return Point Facial landmark + */ + public function getPoint22() + { + return $this->point22; + } + + /** + * Gets the value of point_23y. + * + * @return Point Facial landmark + */ + public function getPoint23() + { + return $this->point23; + } + + /** + * Gets the value of point_24y. + * + * @return Point Facial landmark + */ + public function getPoint24() + { + return $this->point24; + } + + /** + * Gets the value of point_25y. + * + * @return Point Facial landmark + */ + public function getPoint25() + { + return $this->point25; + } + + /** + * Gets the value of point_26y. + * + * @return Point Facial landmark + */ + public function getPoint26() + { + return $this->point26; + } + + /** + * Gets the value of point_27y. + * + * @return Point Facial landmark + */ + public function getPoint27() + { + return $this->point27; + } + + /** + * Gets the value of point_28y. + * + * @return Point Facial landmark + */ + public function getPoint28() + { + return $this->point28; + } + + /** + * Gets the value of point_29y. + * + * @return Point Facial landmark + */ + public function getPoint29() + { + return $this->point29; + } + + /** + * Gets the value of point_30y. + * + * @return Point Facial landmark + */ + public function getPoint30() + { + return $this->point30; + } + + /** + * Gets the value of point_31y. + * + * @return Point Facial landmark + */ + public function getPoint31() + { + return $this->point31; + } + + /** + * Gets the value of point_32y. + * + * @return Point Facial landmark + */ + public function getPoint32() + { + return $this->point32; + } + + /** + * Gets the value of point_33y. + * + * @return Point Facial landmark + */ + public function getPoint33() + { + return $this->point33; + } + + public function setGame(Game $game) { + $this->game = $game; + $game->addHit($this); + return $this; + } + + public function setTarget(Target $target) { + $this->target = $target; + $target->addHit($this); + return $this; + } + + /** + * Sets the value of score. + * + * @param float The score this hit resulted in $score the score + * + * @return self + */ + public function setScore($score) + { + $this->score = $score; + + return $this; + } + + + public function setPoint(int $nr, float $x, float $y) { + if($nr <= 33 && $nr >= 0) { + $this->{"point".$nr} = new Point($x, $y); + } + return $this; + } + + +} + +/** @ORM\Embeddable */ +class Attributes { + + /** + * @JMS\Exclude + * @var array + */ + public static $ATTRIBUTES = ['gender','ethnicity','age']; + /** * @var string * @ORM\Column(name="gender",columnDefinition="VARCHAR(1)") @@ -71,6 +651,206 @@ class Hit */ private $glasses; + + /** + * Gets the value of gender. + * + * @return string + */ + public function getGender() + { + return $this->gender; + } + + /** + * Gets the value of ethnicity. + * + * @return string + */ + public function getEthnicity() + { + return $this->ethnicity; + } + + /** + * Gets the value of age. + * + * @return string + */ + public function getAge() + { + return $this->age; + } + + /** + * Gets the value of glasses. + * + * @return boolean + */ + public function getGlasses() + { + return $this->glasses; + } + + /** + * Sets the value of glasses. + * + * @param boolean $glasses the glasses + * + * @return self + */ + public function setGlasses(bool $glasses) + { + $this->glasses = $glasses; + + return $this; + } + + public function setAttribute(string $attribute, string $value) { + $attributes = static::$ATTRIBUTES; + if(in_array($attribute, $attributes)) { + $this->$attribute = $value; + } + return $this; + } + +} + +/** @ORM\Embeddable */ +class Emotions{ + + /** + * @JMS\Exclude + * @var array + */ + public static $EMOTIONS = ['anger','contempt','disgust','fear','joy','sadness','surprise']; + + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $anger; + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $contempt; + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $disgust; + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $fear; + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $joy; + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $sadness; + /** + * @var float Emotion parameter + * @ORM\Column(type="float") + */ + private $surprise; + + /** + * Gets the value of anger. + * + * @return float Emotion parameter + */ + public function getAnger() + { + return $this->anger; + } + + /** + * Gets the value of contempt. + * + * @return float Emotion parameter + */ + public function getContempt() + { + return $this->contempt; + } + + /** + * Gets the value of disgust. + * + * @return float Emotion parameter + */ + public function getDisgust() + { + return $this->disgust; + } + + /** + * Gets the value of fear. + * + * @return float Emotion parameter + */ + public function getFear() + { + return $this->fear; + } + + /** + * Gets the value of joy. + * + * @return float Emotion parameter + */ + public function getJoy() + { + return $this->joy; + } + + /** + * Gets the value of sadness. + * + * @return float Emotion parameter + */ + public function getSadness() + { + return $this->sadness; + } + + /** + * Gets the value of surprise. + * + * @return float Emotion parameter + */ + public function getSurprise() + { + return $this->surprise; + } + + + public function setEmotion(string $emotion, float $value) { + $emotions = static::$EMOTIONS; + if(in_array($emotion, $emotions)) { + $this->$emotion = $value > 100 ? 100 : $value; + } + return $this; + } + +} + +/** @ORM\Embeddable */ +class Expressions { + + /** + * @JMS\Exclude + * @var array + */ + public static $EXPRESSIONS = ['roll','pitch','yaw','inter_ocular_distance','mouth_open','lip_press','brow_raise','nose_wrinkler','lip_depressor','brow_furrow','attention','smile','inner_brow_raiser','chin_raiser','smirk','lip_suck','upper_lip_raiser','lip_pucker','eye_closure','engagement','valence']; + /** * @var float Head roll angle * @ORM\Column(type="float") @@ -179,518 +959,6 @@ class Hit */ private $valence; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $anger; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $contempt; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $disgust; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $fear; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $joy; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $sadness; - /** - * @var float Emotion parameter - * @ORM\Column(type="float") - */ - private $surprise; - - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_0x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_0y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_1x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_1y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_2x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_2y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_3x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_3y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_4x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_4y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_5x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_5y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_6x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_6y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_7x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_7y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_8x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_8y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_9x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_9y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_10x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_10y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_11x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_11y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_12x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_12y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_13x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_13y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_14x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_14y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_15x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_15y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_16x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_16y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_17x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_17y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_18x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_18y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_19x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_19y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_20x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_20y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_21x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_21y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_22x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_22y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_23x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_23y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_24x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_24y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_25x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_25y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_26x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_26y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_27x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_27y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_28x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_28y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_29x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_29y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_30x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_30y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_31x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_31y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_32x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_32y; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_33x; - /** - * @var float Facial landmark - * @ORM\Column(type="float") - */ - private $point_33y; - - /* - * A full list of facial landmarks from Affectiva docs - * http://developer.affectiva.com/fpi/ - * - * 0 Right Top Jaw - * 1 Right Jaw Angle - * 2 Tip of Chin - * 3 Left Jaw Angle - * 4 Left Top Jaw - * 5 Outer Right Brow Corner - * 6 Right Brow Center - * 7 Inner Right Brow Corner - * 8 Inner Left Brow Corner - * 9 Left Brow Center - * 10 Outer Left Brow Corner - * 11 Nose Root - * 12 Nose Tip - * 13 Nose Lower Right Boundary - * 14 Nose Bottom Boundary - * 15 Nose Lower Left Boundary - * 16 Outer Right Eye - * 17 Inner Right Eye - * 18 Inner Left Eye - * 19 Outer Left Eye - * 20 Right Lip Corner - * 21 Right Apex Upper Lip - * 22 Upper Lip Center - * 23 Left Apex Upper Lip - * 24 Left Lip Corner - * 25 Left Edge Lower Lip - * 26 Lower Lip Center - * 27 Right Edge Lower Lip - * 28 Bottom Upper Lip - * 29 Top Lower Lip - * 30 Upper Corner Right Eye - * 31 Lower Corner Right Eye - * 32 Upper Corner Left Eye - * 33 Lower Corner Left Eye - */ - - - public function __construct() - { - $this->hits = new ArrayCollection(); - } - - /** - * Gets the value of score. - * - * @return float The score this hit resulted in - */ - public function getScore() - { - return $this->score; - } - - /** - * Gets the value of id. - * - * @return integer - */ - public function getId() - { - return $this->id; - } - - /** - * Gets the value of target. - * - * @return mixed - */ - public function getTarget() - { - return $this->target; - } - - /** - * Gets the value of game. - * @return mixed - */ - public function getGame() - { - return $this->game; - } - - /** - * Gets the value of emotion. - * - * @return mixed - */ - public function getEmotion() - { - return $this->emotion; - } - - /** - * Gets the value of gender. - * - * @return string - */ - public function getGender() - { - return $this->gender; - } - - /** - * Gets the value of ethnicity. - * - * @return string - */ - public function getEthnicity() - { - return $this->ethnicity; - } - - /** - * Gets the value of age. - * - * @return string - */ - public function getAge() - { - return $this->age; - } - - /** - * Gets the value of glasses. - * - * @return boolean - */ - public function getGlasses() - { - return $this->glasses; - } - /** * Gets the value of roll. * @@ -901,799 +1169,6 @@ class Hit return $this->valence; } - /** - * Gets the value of anger. - * - * @return float Emotion parameter - */ - public function getAnger() - { - return $this->anger; - } - - /** - * Gets the value of contempt. - * - * @return float Emotion parameter - */ - public function getContempt() - { - return $this->contempt; - } - - /** - * Gets the value of disgust. - * - * @return float Emotion parameter - */ - public function getDisgust() - { - return $this->disgust; - } - - /** - * Gets the value of fear. - * - * @return float Emotion parameter - */ - public function getFear() - { - return $this->fear; - } - - /** - * Gets the value of joy. - * - * @return float Emotion parameter - */ - public function getJoy() - { - return $this->joy; - } - - /** - * Gets the value of sadness. - * - * @return float Emotion parameter - */ - public function getSadness() - { - return $this->sadness; - } - - /** - * Gets the value of surprise. - * - * @return float Emotion parameter - */ - public function getSurprise() - { - return $this->surprise; - } - - /** - * Gets the value of point_0x. - * - * @return float Facial landmark - */ - public function getPoint0x() - { - return $this->point_0x; - } - - /** - * Gets the value of point_0y. - * - * @return float Facial landmark - */ - public function getPoint0y() - { - return $this->point_0y; - } - - /** - * Gets the value of point_1x. - * - * @return float Facial landmark - */ - public function getPoint1x() - { - return $this->point_1x; - } - - /** - * Gets the value of point_1y. - * - * @return float Facial landmark - */ - public function getPoint1y() - { - return $this->point_1y; - } - - /** - * Gets the value of point_2x. - * - * @return float Facial landmark - */ - public function getPoint2x() - { - return $this->point_2x; - } - - /** - * Gets the value of point_2y. - * - * @return float Facial landmark - */ - public function getPoint2y() - { - return $this->point_2y; - } - - /** - * Gets the value of point_3x. - * - * @return float Facial landmark - */ - public function getPoint3x() - { - return $this->point_3x; - } - - /** - * Gets the value of point_3y. - * - * @return float Facial landmark - */ - public function getPoint3y() - { - return $this->point_3y; - } - - /** - * Gets the value of point_4x. - * - * @return float Facial landmark - */ - public function getPoint4x() - { - return $this->point_4x; - } - - /** - * Gets the value of point_4y. - * - * @return float Facial landmark - */ - public function getPoint4y() - { - return $this->point_4y; - } - - /** - * Gets the value of point_5x. - * - * @return float Facial landmark - */ - public function getPoint5x() - { - return $this->point_5x; - } - - /** - * Gets the value of point_5y. - * - * @return float Facial landmark - */ - public function getPoint5y() - { - return $this->point_5y; - } - - /** - * Gets the value of point_6x. - * - * @return float Facial landmark - */ - public function getPoint6x() - { - return $this->point_6x; - } - - /** - * Gets the value of point_6y. - * - * @return float Facial landmark - */ - public function getPoint6y() - { - return $this->point_6y; - } - - /** - * Gets the value of point_7x. - * - * @return float Facial landmark - */ - public function getPoint7x() - { - return $this->point_7x; - } - - /** - * Gets the value of point_7y. - * - * @return float Facial landmark - */ - public function getPoint7y() - { - return $this->point_7y; - } - - /** - * Gets the value of point_8x. - * - * @return float Facial landmark - */ - public function getPoint8x() - { - return $this->point_8x; - } - - /** - * Gets the value of point_8y. - * - * @return float Facial landmark - */ - public function getPoint8y() - { - return $this->point_8y; - } - - /** - * Gets the value of point_9x. - * - * @return float Facial landmark - */ - public function getPoint9x() - { - return $this->point_9x; - } - - /** - * Gets the value of point_9y. - * - * @return float Facial landmark - */ - public function getPoint9y() - { - return $this->point_9y; - } - - /** - * Gets the value of point_10x. - * - * @return float Facial landmark - */ - public function getPoint10x() - { - return $this->point_10x; - } - - /** - * Gets the value of point_10y. - * - * @return float Facial landmark - */ - public function getPoint10y() - { - return $this->point_10y; - } - - /** - * Gets the value of point_11x. - * - * @return float Facial landmark - */ - public function getPoint11x() - { - return $this->point_11x; - } - - /** - * Gets the value of point_11y. - * - * @return float Facial landmark - */ - public function getPoint11y() - { - return $this->point_11y; - } - - /** - * Gets the value of point_12x. - * - * @return float Facial landmark - */ - public function getPoint12x() - { - return $this->point_12x; - } - - /** - * Gets the value of point_12y. - * - * @return float Facial landmark - */ - public function getPoint12y() - { - return $this->point_12y; - } - - /** - * Gets the value of point_13x. - * - * @return float Facial landmark - */ - public function getPoint13x() - { - return $this->point_13x; - } - - /** - * Gets the value of point_13y. - * - * @return float Facial landmark - */ - public function getPoint13y() - { - return $this->point_13y; - } - - /** - * Gets the value of point_14x. - * - * @return float Facial landmark - */ - public function getPoint14x() - { - return $this->point_14x; - } - - /** - * Gets the value of point_14y. - * - * @return float Facial landmark - */ - public function getPoint14y() - { - return $this->point_14y; - } - - /** - * Gets the value of point_15x. - * - * @return float Facial landmark - */ - public function getPoint15x() - { - return $this->point_15x; - } - - /** - * Gets the value of point_15y. - * - * @return float Facial landmark - */ - public function getPoint15y() - { - return $this->point_15y; - } - - /** - * Gets the value of point_16x. - * - * @return float Facial landmark - */ - public function getPoint16x() - { - return $this->point_16x; - } - - /** - * Gets the value of point_16y. - * - * @return float Facial landmark - */ - public function getPoint16y() - { - return $this->point_16y; - } - - /** - * Gets the value of point_17x. - * - * @return float Facial landmark - */ - public function getPoint17x() - { - return $this->point_17x; - } - - /** - * Gets the value of point_17y. - * - * @return float Facial landmark - */ - public function getPoint17y() - { - return $this->point_17y; - } - - /** - * Gets the value of point_18x. - * - * @return float Facial landmark - */ - public function getPoint18x() - { - return $this->point_18x; - } - - /** - * Gets the value of point_18y. - * - * @return float Facial landmark - */ - public function getPoint18y() - { - return $this->point_18y; - } - - /** - * Gets the value of point_19x. - * - * @return float Facial landmark - */ - public function getPoint19x() - { - return $this->point_19x; - } - - /** - * Gets the value of point_19y. - * - * @return float Facial landmark - */ - public function getPoint19y() - { - return $this->point_19y; - } - - /** - * Gets the value of point_20x. - * - * @return float Facial landmark - */ - public function getPoint20x() - { - return $this->point_20x; - } - - /** - * Gets the value of point_20y. - * - * @return float Facial landmark - */ - public function getPoint20y() - { - return $this->point_20y; - } - - /** - * Gets the value of point_21x. - * - * @return float Facial landmark - */ - public function getPoint21x() - { - return $this->point_21x; - } - - /** - * Gets the value of point_21y. - * - * @return float Facial landmark - */ - public function getPoint21y() - { - return $this->point_21y; - } - - /** - * Gets the value of point_22x. - * - * @return float Facial landmark - */ - public function getPoint22x() - { - return $this->point_22x; - } - - /** - * Gets the value of point_22y. - * - * @return float Facial landmark - */ - public function getPoint22y() - { - return $this->point_22y; - } - - /** - * Gets the value of point_23x. - * - * @return float Facial landmark - */ - public function getPoint23x() - { - return $this->point_23x; - } - - /** - * Gets the value of point_23y. - * - * @return float Facial landmark - */ - public function getPoint23y() - { - return $this->point_23y; - } - - /** - * Gets the value of point_24x. - * - * @return float Facial landmark - */ - public function getPoint24x() - { - return $this->point_24x; - } - - /** - * Gets the value of point_24y. - * - * @return float Facial landmark - */ - public function getPoint24y() - { - return $this->point_24y; - } - - /** - * Gets the value of point_25x. - * - * @return float Facial landmark - */ - public function getPoint25x() - { - return $this->point_25x; - } - - /** - * Gets the value of point_25y. - * - * @return float Facial landmark - */ - public function getPoint25y() - { - return $this->point_25y; - } - - /** - * Gets the value of point_26x. - * - * @return float Facial landmark - */ - public function getPoint26x() - { - return $this->point_26x; - } - - /** - * Gets the value of point_26y. - * - * @return float Facial landmark - */ - public function getPoint26y() - { - return $this->point_26y; - } - - /** - * Gets the value of point_27x. - * - * @return float Facial landmark - */ - public function getPoint27x() - { - return $this->point_27x; - } - - /** - * Gets the value of point_27y. - * - * @return float Facial landmark - */ - public function getPoint27y() - { - return $this->point_27y; - } - - /** - * Gets the value of point_28x. - * - * @return float Facial landmark - */ - public function getPoint28x() - { - return $this->point_28x; - } - - /** - * Gets the value of point_28y. - * - * @return float Facial landmark - */ - public function getPoint28y() - { - return $this->point_28y; - } - - /** - * Gets the value of point_29x. - * - * @return float Facial landmark - */ - public function getPoint29x() - { - return $this->point_29x; - } - - /** - * Gets the value of point_29y. - * - * @return float Facial landmark - */ - public function getPoint29y() - { - return $this->point_29y; - } - - /** - * Gets the value of point_30x. - * - * @return float Facial landmark - */ - public function getPoint30x() - { - return $this->point_30x; - } - - /** - * Gets the value of point_30y. - * - * @return float Facial landmark - */ - public function getPoint30y() - { - return $this->point_30y; - } - - /** - * Gets the value of point_31x. - * - * @return float Facial landmark - */ - public function getPoint31x() - { - return $this->point_31x; - } - - /** - * Gets the value of point_31y. - * - * @return float Facial landmark - */ - public function getPoint31y() - { - return $this->point_31y; - } - - /** - * Gets the value of point_32x. - * - * @return float Facial landmark - */ - public function getPoint32x() - { - return $this->point_32x; - } - - /** - * Gets the value of point_32y. - * - * @return float Facial landmark - */ - public function getPoint32y() - { - return $this->point_32y; - } - - /** - * Gets the value of point_33x. - * - * @return float Facial landmark - */ - public function getPoint33x() - { - return $this->point_33x; - } - - /** - * Gets the value of point_33y. - * - * @return float Facial landmark - */ - public function getPoint33y() - { - return $this->point_33y; - } - - public function setGame(Game $game) { - $this->game = $game; - $game->addHit($this); - return $this; - } - - public function setTarget(Target $target) { - $this->target = $target; - $target->addHit($this); - return $this; - } - - /** - * Sets the value of score. - * - * @param float The score this hit resulted in $score the score - * - * @return self - */ - public function setScore($score) - { - $this->score = $score; - - return $this; - } - - public function setAttribute(string $attribute, string $value) { - $attributes = static::$ATTRIBUTES; - if(in_array($attribute, $attributes)) { - $this->$attribute = $value; - } - return $this; - } - - public function setEmotion(string $emotion, float $value) { - $emotions = static::$EMOTIONS; - if(in_array($emotion, $emotions)) { - $this->$emotion = $value > 100 ? 100 : $value; - } - return $this; - } - - public function setExpression(string $expression, float $value) { $expressions = static::$EXPRESSIONS; if(in_array($expression, $expressions)) { @@ -1701,27 +1176,27 @@ class Hit } return $this; } +} - public function setPoint(int $nr, float $x, float $y) { - if($nr <= 33 && $nr >= 0) { - $this->{"point_".$nr."x"} = $x; - $this->{"point_".$nr."y"} = $y; - } - return $this; - } +/** @ORM\Embeddable */ +class Point{ + /** - * Sets the value of glasses. - * - * @param boolean $glasses the glasses - * - * @return self + * @var float Facial landmark + * @ORM\Column(type="float") */ - public function setGlasses(bool $glasses) - { - $this->glasses = $glasses; + private $x; + /** + * @var float Facial landmark + * @ORM\Column(type="float") + */ + private $y; - return $this; + public function __construct($x, $y) + { + $this->x = $x; + $this->y = $y; } -} +} \ No newline at end of file