| 202 | | |
| 203 | | |
| | 203 | // (-7 0) -> (-2 -5) -> (-2 -1) -> (7 -1) => (7 1) -> (-2 1) -> (-2 5) (-7 0) |
| | 204 | |
| | 205 | function drawArrow($image, $x1, $y1, $angle, $color) { |
| | 206 | $deg = round(fmod($angle, 360.0)); |
| | 207 | switch (intval($angle)) { |
| | 208 | case 0: |
| | 209 | $poly = array( $x1-7, $y1, $x1-2, $y1-5, $x1-2, $y1-1, $x1+7, $y1-1, $x1+7, $y1+1, $x1-2, $y1+1, $x1-2, $y1+5); |
| | 210 | break; |
| | 211 | case 90: |
| | 212 | $poly = array( $x1, $y1-7, $x1-5, $y1-2, $x1-1, $y1-2, $x1-1, $y1+7, $x1+1, $y1+7, $x1+1, $y1-2, $x1+5, $y1-2); |
| | 213 | break; |
| | 214 | case 180: |
| | 215 | $poly = array( $x1+7, $y1, $x1+2, $y1-5, $x1+2, $y1-1, $x1-7, $y1-1, $x1-7, $y1+1, $x1+2, $y1+1, $x1+2, $y1+5); |
| | 216 | break; |
| | 217 | case 270: |
| | 218 | $poly = array( $x1, $y1+7, $x1-5, $y1+2, $x1-1, $y1+2, $x1-1, $y1-7, $x1+1, $y1-7, $x1+1, $y1+2, $x1+5, $y1+2); |
| | 219 | break; |
| | 220 | default: |
| | 221 | $poly = array(); |
| | 222 | // (-7 0) -> (-2 -5) -> (-2 -1) -> (7 -1) => (7 1) -> (-2 1) -> (-2 5) (-7 0) |
| | 223 | array_push($poly, $x1+7*cos((180-$deg)*M_PI/180.0), $y1-7*sin((180-$deg)*M_PI/180.0)); |
| | 224 | array_push($poly, $x1+5.385164807134504*cos((111.8014094863518-$deg)*M_PI/180.0), $y1-5.385164807134504*sin((111.8014094863518-$deg)*M_PI/180.0)); |
| | 225 | array_push($poly, $x1+2.23606797749979*cos((153.434948822922-$deg)*M_PI/180.0), $y1-2.23606797749979*sin((153.434948822922-$deg)*M_PI/180.0)); |
| | 226 | array_push($poly, $x1+7.071067811865476*cos((8.130102354156051-$deg)*M_PI/180.0), $y1-7.071067811865476*sin((8.130102354156051-$deg)*M_PI/180.0)); |
| | 227 | array_push($poly, $x1+7.071067811865476*cos((-8.130102354156051-$deg)*M_PI/180.0), $y1-7.071067811865476*sin((-8.130102354156051-$deg)*M_PI/180.0)); |
| | 228 | array_push($poly, $x1+2.23606797749979*cos((-153.434948822922-$deg)*M_PI/180.0), $y1-2.23606797749979*sin((-153.434948822922-$deg)*M_PI/180.0)); |
| | 229 | array_push($poly, $x1+5.385164807134504*cos((-111.8014094863518-$deg)*M_PI/180.0), $y1-5.385164807134504*sin((-111.8014094863518-$deg)*M_PI/180.0)); |
| | 230 | break; |
| | 231 | } |
| | 232 | imagefilledpolygon( $image, $poly, 7, $color); |
| | 233 | } |
| | 234 | |
| | 773 | if ($waypoint['wpformat'] & WP_CROSS_CLOCKWISE) { |
| | 774 | $this->drawArrow($this->mapImage, ($wp1ProjLong+$wp2ProjLong)/2.0, |
| | 775 | ($wp1ProjLat+$wp2ProjLat)/2.0, |
| | 776 | atan2(($wp2ProjLat-$wp1ProjLat),($wp1ProjLong-$wp2ProjLong)), $this->colorWaypointsIndication); |
| | 777 | } else if ($waypoint['wpformat'] & WP_CROSS_ANTI_CLOCKWISE) { |
| | 778 | $this->drawArrow($this->mapImage, ($wp1ProjLong+$wp2ProjLong)/2.0, |
| | 779 | ($wp1ProjLat+$wp2ProjLat)/2.0, |
| | 780 | atan2(($wp2ProjLat-$wp1ProjLat),($wp1ProjLong-$wp2ProjLong))+180, $this->colorWaypointsIndication); |
| | 781 | } |
| 770 | | |
| | 810 | // FIXME more arrows ? |
| | 811 | if ($waypoint['wpformat'] & WP_CROSS_CLOCKWISE) { |
| | 812 | $this->drawArrow($this->mapImage, $wp1ProjLong+20*cos(deg2rad(90-$waypoint['laisser_au'])), |
| | 813 | $wp1ProjLat+20*sin(deg2rad(90-$waypoint['laisser_au'])), |
| | 814 | $waypoint['laisser_au'], $this->colorWaypointsIndication); |
| | 815 | } else if ($waypoint['wpformat'] & WP_CROSS_ANTI_CLOCKWISE) { |
| | 816 | $this->drawArrow($this->mapImage, $wp1ProjLong+20*cos(deg2rad(90-$waypoint['laisser_au'])), |
| | 817 | $wp1ProjLat+20*sin(deg2rad(90-$waypoint['laisser_au'])), |
| | 818 | $waypoint['laisser_au']+180, $this->colorWaypointsIndication); |
| | 819 | } |
| | 820 | |