Refactor Hit POints

This commit is contained in:
Ruben 2016-09-04 15:48:23 +01:00
parent c720e0465c
commit 3d1cf59cdb
2 changed files with 470 additions and 451 deletions

View File

@ -109,7 +109,7 @@ class ScoreControllerProvider implements ControllerProviderInterface
//points //points
foreach(range(0, 33) as $i) { foreach(range(0, 33) as $i) {
$hit->setPoint($i, $data_hit['points']["$i"]['x'], $data_hit['points']["$i"]['y']); $hit->getPoints()->setPoint($i, $data_hit['points']["$i"]['x'], $data_hit['points']["$i"]['y']);
} }

View File

@ -53,117 +53,11 @@ class Hit
/** @ORM\Embedded(class = "Emotions", columnPrefix=false) */ /** @ORM\Embedded(class = "Emotions", columnPrefix=false) */
private $emotions; private $emotions;
/** @ORM\Embedded(class="Point", columnPrefix="point_0") */ /** @ORM\Embedded(class = "Points", columnPrefix=false) */
private $point0; private $points;
/** @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() public function __construct()
{ {
@ -171,6 +65,7 @@ class Hit
$this->emotions = new Emotions(); $this->emotions = new Emotions();
$this->attributes = new Attributes(); $this->attributes = new Attributes();
$this->expressions = new Expressions(); $this->expressions = new Expressions();
$this->points = new Points();
} }
/** /**
@ -242,344 +137,15 @@ class Hit
} }
/** /**
* Gets the value of point_0y. * Gets the value of points.
* *
* @return Point Facial landmark * @return mixed
*/ */
public function getPoint0() public function getPoints()
{ {
return $this->point0; return $this->points;
} }
/**
* 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) { public function setGame(Game $game) {
$this->game = $game; $this->game = $game;
@ -603,15 +169,6 @@ class Hit
public function setScore($score) public function setScore($score)
{ {
$this->score = $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; return $this;
} }
@ -1178,6 +735,468 @@ class Expressions {
} }
} }
/** @ORM\Embeddable */
class Points{
/** @ORM\Embedded(class="Point", columnPrefix="point_0") @JMS\SerializedName("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
*/
/**
* 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 setPoint(int $nr, float $x, float $y) {
if($nr <= 33 && $nr >= 0) {
$this->{"point".$nr} = new Point($x, $y);
}
return $this;
}
}
/** @ORM\Embeddable */ /** @ORM\Embeddable */