+ changed operator* and operator/ behaviour as per #206
This commit is contained in:
parent
5f0385b80a
commit
fbb102b975
1 changed files with 17 additions and 11 deletions
|
@ -307,21 +307,27 @@ namespace mapnik
|
|||
template <typename T>
|
||||
Envelope<T>& Envelope<T>::operator*=(T t)
|
||||
{
|
||||
minx_ *= t;
|
||||
miny_ *= t;
|
||||
maxx_ *= t;
|
||||
maxy_ *= t;
|
||||
return *this;
|
||||
coord<T,2> c = center();
|
||||
T sx = 0.5 * width() * t;
|
||||
T sy = 0.5 * height() * t;
|
||||
minx_ = static_cast<T>(c.x - sx);
|
||||
maxx_ = static_cast<T>(c.x + sx);
|
||||
miny_ = static_cast<T>(c.y - sy);
|
||||
maxy_ = static_cast<T>(c.y + sy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
Envelope<T>& Envelope<T>::operator/=(T t)
|
||||
{
|
||||
minx_ /= t;
|
||||
miny_ /= t;
|
||||
maxx_ /= t;
|
||||
maxy_ /= t;
|
||||
return *this;
|
||||
coord<T,2> c = center();
|
||||
T sx = 0.5 * width() / t;
|
||||
T sy = 0.5 * height() / t;
|
||||
minx_ = static_cast<T>(c.x - sx);
|
||||
maxx_ = static_cast<T>(c.x + sx);
|
||||
miny_ = static_cast<T>(c.y - sy);
|
||||
maxy_ = static_cast<T>(c.y + sy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template class Envelope<int>;
|
||||
|
|
Loading…
Add table
Reference in a new issue