[Marble-commits] KDE/kdeedu/marble/src/lib/geodata/data

Torsten Rahn tackat at t-online.de
Sat Jul 17 21:02:34 CEST 2010


On Saturday 17 July 2010 18:40:57 Thibaut Gridel wrote:
> +GeoDataLatLonBox& GeoDataLatLonBox::operator+=( const GeoDataLatLonBox&
> other ) +{
> +    d->m_north = qMax(d->m_north, other.north());
> +    d->m_south = qMin(d->m_south, other.south());
> +    d->m_east = qMax(d->m_east, other.east());
> +    d->m_west = qMin(d->m_west, other.west());
> +    return *this;
> +}

Unfortunately this implementation is totally utterly WRONG. For LatLonBoxes that 
are located near the dateline or that cover the dateline this will result in 
features not being rendered and in some (common) situations a major performance 
drop. For your use case you are just lucky that this works for objects that have 
a latLonAltBox.isNull() == true ("singularities").

Your simplistic implementation doesn't honor the fact that LatLonBoxes can reach 
beyond the dateline. So the whole issue is a lot more tricky. Have a look at the 
GeoDataLatLonBox::intersect() method to see how a better implementation would 
work. 

If it was as simple as that then we could use QRectF instead of 
GeoDataLatLonBox.;-)

So please revert or please correct this or add a big big FIXME.

Torsten



More information about the Marble-commits mailing list