Skip to content

Commit

Permalink
Reverse to old getScaleRecursive-function in WmsLayerSource because o…
Browse files Browse the repository at this point in the history
…f regression bug. Now correct scale and scale hint for sublayer are set
  • Loading branch information
DavidPatzke committed Jul 17, 2017
1 parent 6dc2fbc commit b07820a
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/Mapbender/WmsBundle/Entity/WmsLayerSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public function getMinScale($recursive = true)
}

if ($recursive && $value === null && $this->getParent()) {
$value = $this->getParent()->getMinScale($recursive);
$value = $this->getScaleRecursive()->getMin();
}

$value === null ? null : floatval($value);
Expand All @@ -667,7 +667,7 @@ public function getMaxScale($recursive = true)
}

if ($recursive && $value === null && $this->getParent()) {
$value = $this->getParent()->getMinScale($recursive);
$value = $this->getScaleRecursive()->getMax();
}

$value === null ? null : floatval($value);
Expand All @@ -682,7 +682,32 @@ public function getMaxScale($recursive = true)
*/
public function getScaleRecursive()
{
return new MinMax($this->getMinScale(), $this->getMaxScale());
$scale = $this->getScale();
$parent = $this->getParent();

if (!$scale && !$parent) {
return new MinMax();
} elseif (!$scale && $parent) {
$scale = $parent->getScale();
} else {
$hasMin = $scale->getMin() !== null;
$hasMax = $scale->getMax() !== null;
if ((!$hasMin || !$hasMax) && $parent) {
$parentScale = $parent->getScale();
if (!$parentScale) {
return new MinMax(
$hasMin ? $scale->getMin() : null,
$hasMax ? $scale->getMax() : null
);
}
$scale = new MinMax(
$hasMin ? $scale->getMin() : $parentScale->getMin(),
$hasMax ? $scale->getMax() : $parentScale->getMax()
);
}
}
//var_dump($scale->getMin() );
return $scale;
}

/**
Expand Down

0 comments on commit b07820a

Please sign in to comment.