[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/marble
From: Inge Wallin <inge () lysator ! liu ! se>
Date: 2008-06-01 0:08:10
Message-ID: 1212278890.170170.23909.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 815035 by ingwa:
Fix paintBase and setActiveArea for the mercator projection
M +7 -0 ChangeLog
M +2 -2 src/lib/Projections/EquirectProjectionHelper.cpp
M +39 -20 src/lib/Projections/MercatorProjectionHelper.cpp
--- trunk/KDE/kdeedu/marble/ChangeLog #815034:815035
@@ -1,5 +1,12 @@
2008-06-01 Inge Wallin <inge@lysator.liu.se>
+ Fix paintBase and setActiveArea for the Mercator projection.
+ * src/lib/Projections/MercatorProjectionHelper.cpp (paintBase):
+ Make it look like Equirect...:paintBase
+ (setActiveRegion): same here
+ * src/lib/Projections/EquirectProjectionHelper.cpp (paintBase):
+ Fix comments
+
Fix issue with paintBase
* src/lib/Projections/EquirectProjectionHelper.cpp (paintBase):
Bound the top and bottom values of the rectangle.
--- trunk/KDE/kdeedu/marble/src/lib/Projections/EquirectProjectionHelper.cpp #815034:815035
@@ -53,8 +53,7 @@
int yTop = height / 2 - radius + yCenterOffset;
int yBottom = yTop + 2 * radius;
- // Don't let the active area be outside the image, and also let a
- // thin strip 25 pixels wide be outside it.
+ // Bound the values to the viewport.
if ( yTop < 0 )
yTop = 0;
if ( yBottom > height )
@@ -86,6 +85,7 @@
yTop = 25;
if ( yBottom > height - 25 )
yBottom = height - 25;
+
d->activeRegion = QRegion( 25, yTop, width - 50, yBottom - yTop,
QRegion::Rectangle );
}
--- trunk/KDE/kdeedu/marble/src/lib/Projections/MercatorProjectionHelper.cpp #815034:815035
@@ -35,46 +35,65 @@
QBrush &brush,
bool antialiasing )
{
- int radius = viewport->radius();
+ // Convenience variables
+ //int radius = viewport->radius();
+ int width = viewport->width();
+ int height = viewport->height();
+ // Igor, prepare the painter!
painter->setRenderHint( QPainter::Antialiasing, antialiasing );
-
painter->setPen( pen );
painter->setBrush( brush );
- int yTop;
- //int yBottom;
- int dummy;
+ int yTop;
+ int yBottom;
+ int xDummy;
AbstractProjection *proj = viewport->currentProjection();
- // Get the top pixel of the projected map.
+ // Get the top and bottom y coordinates of the projected map.
proj->screenCoordinates( 0.0, proj->maxLat(), viewport,
- dummy, yTop );
+ xDummy, yTop );
+ proj->screenCoordinates( 0.0, -proj->maxLat(), viewport,
+ xDummy, yBottom );
if ( yTop < 0 )
- yTop = 0;
-#if 0
- proj->screenCoordinates( 0.0, -proj->maxLat(), viewport,
- dummy, yBottom );
- if ( yBottom > viewport->height() )
- yBottom = viewport->height();
-#endif
+ yTop = 0;
+ if ( yBottom > height )
+ yBottom = height;
- painter->drawRect( 0, yTop, viewport->width(), 2 * radius);
+ painter->drawRect( 0, yTop, width, yBottom - yTop );
}
void MercatorProjectionHelper::setActiveRegion( ViewportParams *viewport )
{
- // FIXME: Change for Mercator
- int radius = viewport->radius();
+ // Convenience variables
+ //int radius = viewport->radius();
+ int width = viewport->width();
+ int height = viewport->height();
// Calculate translation of center point
double centerLon;
double centerLat;
viewport->centerCoordinates( centerLon, centerLat );
- int yCenterOffset = (int)((double)( 2 * radius ) / M_PI * centerLat);
- int yTop = viewport->height() / 2 - radius + yCenterOffset;
- d->activeRegion = QRegion( 0, yTop, viewport->width(), 2 * radius,
+ int yTop;
+ int yBottom;
+ int xDummy;
+ AbstractProjection *proj = viewport->currentProjection();
+
+ // Get the top and bottom y coordinates of the projected map.
+ proj->screenCoordinates( 0.0, proj->maxLat(), viewport,
+ xDummy, yTop );
+ proj->screenCoordinates( 0.0, -proj->maxLat(), viewport,
+ xDummy, yBottom );
+
+ // Don't let the active area be outside the image, and also let a
+ // thin strip 25 pixels wide be outside it.
+ if ( yTop < 25 )
+ yTop = 25;
+ if ( yBottom > height - 25 )
+ yBottom = height - 25;
+
+ d->activeRegion = QRegion( 25, yTop, width - 50, yBottom - yTop,
QRegion::Rectangle );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic