Commit a8a427ab authored by Torsten Rahn's avatar Torsten Rahn Committed by Torsten Rahn
Browse files

Decide early to not render stuff that is too small

to be relevant.
parent 7967d9c4
......@@ -352,17 +352,16 @@ qreal ViewportParams::angularResolution() const
return d->m_angularResolution;
}
bool ViewportParams::resolves ( const GeoDataLatLonBox &latLonBox ) const
bool ViewportParams::resolves ( const GeoDataLatLonBox &latLonBox, qreal pixel ) const
{
return latLonBox.width() + latLonBox.height() > 2.0 * angularResolution();
return latLonBox.width() + latLonBox.height() > pixel * angularResolution();
}
bool ViewportParams::resolves ( const GeoDataLatLonAltBox &latLonAltBox ) const
bool ViewportParams::resolves ( const GeoDataLatLonAltBox &latLonAltBox, qreal pixel, qreal altitude ) const
{
return latLonAltBox.width() + latLonAltBox.height() > 2.0 * angularResolution()
|| latLonAltBox.maxAltitude() - latLonAltBox.minAltitude() > 10000;
return latLonAltBox.width() + latLonAltBox.height() > pixel * angularResolution()
|| latLonAltBox.maxAltitude() - latLonAltBox.minAltitude() > altitude;
}
bool ViewportParams::resolves ( const GeoDataCoordinates &coord1,
......
......@@ -76,9 +76,9 @@ class MARBLE_EXPORT ViewportParams
// represent a single point on the screen already.
// See angularResolution()
bool resolves ( const GeoDataLatLonBox &latLonBox ) const;
bool resolves ( const GeoDataLatLonBox &latLonBox, qreal pixel = 2.0 ) const;
bool resolves ( const GeoDataLatLonAltBox &latLonAltBox ) const;
bool resolves ( const GeoDataLatLonAltBox &latLonAltBox, qreal pixel = 2.0, qreal altitude = 10000.0 ) const;
// Determines whether two points are located enough apart so that it makes
// sense to display them as distinct points. If this is not the case
......
......@@ -54,6 +54,10 @@ const GeoDataLatLonAltBox& GeoLineStringGraphicsItem::latLonAltBox() const
void GeoLineStringGraphicsItem::paint( GeoPainter* painter, const ViewportParams* viewport )
{
if ( ( !viewport->resolves( m_lineString->latLonAltBox(), 2) ) ) {
return;
}
LabelPositionFlags labelPositionFlags = NoLabel;
painter->save();
......
......@@ -249,6 +249,12 @@ void GeoPolygonGraphicsItem::paint( GeoPainter* painter, const ViewportParams* v
if ( isBuildingFrame || isBuildingRoof ) {
if ((m_polygon && !viewport->resolves(m_polygon->outerBoundary().latLonAltBox(), 4))
|| (m_ring && !viewport->resolves(m_ring->latLonAltBox(), 4))) {
painter->restore();
return;
}
bool drawAccurate3D = false;
bool isCameraAboveBuilding = false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment