Ensure that farm_map_set_bcscale() will always be followed by farm_map_reset_bcscale() (without a returning prematurely).

This commit is contained in:
Michael Stenta 2020-11-10 20:56:21 -05:00
parent d6ed1f0e3e
commit 8fc2a36b4e
1 changed files with 6 additions and 6 deletions

View File

@ -391,14 +391,14 @@ function farm_area_generate_form_submit(&$form, &$form_state) {
*/
function farm_area_generate_geometries($polygon, $count, $orientation = 0) {
// Set BCMath scale.
farm_map_set_bcscale();
// If the orientation isn't within an acceptable range, bail.
if ($orientation < 0 || $orientation > 360) {
return array();
}
// Set BCMath scale.
farm_map_set_bcscale();
// If the orientation is 360, reset to 0.
if ($orientation == 360) {
$orientation = 0;
@ -543,15 +543,15 @@ function farm_area_generate_rotate_point($point, $origin, $angle) {
// Load GeoPHP.
geophp_load();
// Set BCMath scale.
farm_map_set_bcscale();
// If $point and $origin are not points, or $angle is not an integer between
// 0 and 359, bail.
if ($point->geometryType() != 'Point' || $origin->geometryType() != 'Point' || $angle < 0 || $angle > 359) {
return $point;
}
// Set BCMath scale.
farm_map_set_bcscale();
// Convert the angle to radians.
$angle = deg2rad($angle);