[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble/esasocis-2012-eclipse] src/plugins/render/eclipses: Just render GeoDataLinearRings. Mute col
From:       Torsten Rahn <rahn () kde ! org>
Date:       2013-01-19 17:10:11
Message-ID: 20130119171011.16CF1A6091 () git ! kde ! org
[Download RAW message or body]

Git commit bb3c987431498c44eb8be52dfb6a79abe48faf4c by Torsten Rahn.
Committed on 19/01/2013 at 17:48.
Pushed by rahn into branch 'esasocis-2012-eclipse'.

Just render GeoDataLinearRings. Mute colors to something decent.

M  +3    -3    src/plugins/render/eclipses/EclipsesItem.cpp
M  +6    -6    src/plugins/render/eclipses/EclipsesItem.h
M  +63   -51   src/plugins/render/eclipses/EclipsesPlugin.cpp

http://commits.kde.org/marble/bb3c987431498c44eb8be52dfb6a79abe48faf4c

diff --git a/src/plugins/render/eclipses/EclipsesItem.cpp \
b/src/plugins/render/eclipses/EclipsesItem.cpp index 7a46942..1dc4c16 100644
--- a/src/plugins/render/eclipses/EclipsesItem.cpp
+++ b/src/plugins/render/eclipses/EclipsesItem.cpp
@@ -143,7 +143,7 @@ const GeoDataLineString& EclipsesItem::northernPenumbra()
     return m_northernPenumbra;
 }
 
-const QList<GeoDataCoordinates>& EclipsesItem::shadowConeUmbra()
+GeoDataLinearRing EclipsesItem::shadowConeUmbra()
 {
     if( m_calculationsNeedUpdate ) {
         calculate();
@@ -152,7 +152,7 @@ const QList<GeoDataCoordinates>& EclipsesItem::shadowConeUmbra()
     return m_shadowConeUmbra;
 }
 
-const QList<GeoDataCoordinates>& EclipsesItem::shadowConePenumbra()
+GeoDataLinearRing EclipsesItem::shadowConePenumbra()
 {
     if( m_calculationsNeedUpdate ) {
         calculate();
@@ -161,7 +161,7 @@ const QList<GeoDataCoordinates>& \
EclipsesItem::shadowConePenumbra()  return m_shadowConePenumbra;
 }
 
-const QList<GeoDataCoordinates>& EclipsesItem::shadowCone60MagPenumbra()
+GeoDataLinearRing EclipsesItem::shadowCone60MagPenumbra()
 {
     if( m_calculationsNeedUpdate ) {
         calculate();
diff --git a/src/plugins/render/eclipses/EclipsesItem.h \
b/src/plugins/render/eclipses/EclipsesItem.h index 6541213..19469c3 100644
--- a/src/plugins/render/eclipses/EclipsesItem.h
+++ b/src/plugins/render/eclipses/EclipsesItem.h
@@ -195,19 +195,19 @@ public:
      * @brief Return the shadow cone of the umbra
      * @return The shadow cone of the umbra
      */
-    const QList<GeoDataCoordinates>& shadowConeUmbra();
+    GeoDataLinearRing shadowConeUmbra();
 
     /**
      * @brief Return the shadow cone of the penumbra
      * @return The shadow cone of the penumbra
      */
-    const QList<GeoDataCoordinates>& shadowConePenumbra();
+    GeoDataLinearRing shadowConePenumbra();
 
     /**
      * @brief Return the shadow cone of the penumbra at 60 percent magnitude
      * @return The shadow cone of the penumbra at 60 percent magnitude
      */
-    const QList<GeoDataCoordinates>& shadowCone60MagPenumbra();
+    GeoDataLinearRing shadowCone60MagPenumbra();
 
 private:
     /**
@@ -245,9 +245,9 @@ private:
     GeoDataLinearRing m_umbra;
     GeoDataLineString m_southernPenumbra;
     GeoDataLineString m_northernPenumbra;
-    QList<GeoDataCoordinates> m_shadowConeUmbra;
-    QList<GeoDataCoordinates> m_shadowConePenumbra;
-    QList<GeoDataCoordinates> m_shadowCone60MagPenumbra;
+    GeoDataLinearRing m_shadowConeUmbra;
+    GeoDataLinearRing m_shadowConePenumbra;
+    GeoDataLinearRing m_shadowCone60MagPenumbra;
     QList<GeoDataLinearRing> m_sunBoundaries;
 };
 
diff --git a/src/plugins/render/eclipses/EclipsesPlugin.cpp \
b/src/plugins/render/eclipses/EclipsesPlugin.cpp index 59efcd8..e7c2fff 100644
--- a/src/plugins/render/eclipses/EclipsesPlugin.cpp
+++ b/src/plugins/render/eclipses/EclipsesPlugin.cpp
@@ -257,49 +257,86 @@ bool EclipsesPlugin::renderItem( GeoPainter *painter, \
EclipsesItem *item )  QList<GeoDataCoordinates>::const_iterator ci;
     int phase = item->phase();
 
-    // plot central line
-    if( m_configWidget->checkBoxShowCentralLine->isChecked() && phase > 3 ) {
-        painter->setPen( Qt::black );
-        painter->drawPolyline( item->centralLine() );
+    // Draw full penumbra shadow cone
+    if( m_configWidget->checkBoxShowFullPenumbra->isChecked() ) {
+        painter->setPen( Oxygen::aluminumGray1 );
+        QColor sunBoundingBrush ( Oxygen::aluminumGray6 );
+        sunBoundingBrush.setAlpha( 48 );
+        painter->setBrush( sunBoundingBrush );
+        painter->drawPolygon( item->shadowConePenumbra() );
+    }
+
+    // Draw 60% penumbra shadow cone
+    if( m_configWidget->checkBoxShow60MagPenumbra->isChecked() ) {
+        painter->setPen( Oxygen::aluminumGray2 );
+        QColor penumbraBrush ( Oxygen::aluminumGray6 );
+        penumbraBrush.setAlpha( 96 );
+        painter->setBrush( penumbraBrush );
+        painter->drawPolygon( item->shadowCone60MagPenumbra() );
+    }
+
+    // Draw southern boundary of the penumbra
+    if( m_configWidget->checkBoxShowSouthernPenumbra->isChecked() ) {
+        QColor southernBoundaryColor(Oxygen::brickRed1);
+        southernBoundaryColor.setAlpha(128);
+        QPen southernBoundary(southernBoundaryColor);
+        southernBoundary.setWidth(3);
+        painter->setPen( southernBoundary );
+        painter->drawPolyline( item->southernPenumbra() );
+        painter->setPen( Oxygen::brickRed5 );
+        painter->drawPolyline( item->southernPenumbra() );
+    }
+
+    // Draw northern boundary of the penumbra
+    if( m_configWidget->checkBoxShowNorthernPenumbra->isChecked() ) {
+        QColor northernBoundaryColor(Oxygen::brickRed1);
+        northernBoundaryColor.setAlpha(128);
+        QPen northernBoundary(northernBoundaryColor);
+        northernBoundary.setWidth(3);
+        painter->setPen( northernBoundary );
+        painter->drawPolyline( item->northernPenumbra() );
+        painter->setPen( Oxygen::brickRed5 );
+        painter->drawPolyline( item->northernPenumbra() );
+    }
+
+    // Draw Sunrise / Sunset Boundaries
+    if( m_configWidget->checkBoxShowSunBoundaries->isChecked() ) {
+        painter->setPen( Oxygen::hotOrange6 );
+        const QList<GeoDataLinearRing> boundaries = item->sunBoundaries();
+        QList<GeoDataLinearRing>::const_iterator i = boundaries.constBegin();
+        QColor sunBoundingBrush ( Oxygen::hotOrange5 );
+        sunBoundingBrush.setAlpha( 64 );
+        painter->setBrush( sunBoundingBrush );
+        for( ; i != boundaries.constEnd(); ++i ) {
+            painter->drawPolygon( *i );
+        }
     }
 
     // total or annular eclipse
     if( m_configWidget->checkBoxShowUmbra->isChecked() && phase > 3 )
     {
         painter->setPen( Oxygen::aluminumGray4 );
-        QColor sunBoundingBrush ( Oxygen::aluminumGray4 );
+        QColor sunBoundingBrush ( Oxygen::aluminumGray6 );
         sunBoundingBrush.setAlpha( 128 );
         painter->setBrush( sunBoundingBrush );
         painter->drawPolygon( item->umbra() );
 
         // draw shadow cone
         painter->setPen( Qt::black );
-        ci = item->shadowConeUmbra().constBegin();
-        for ( ; ci != item->shadowConeUmbra().constEnd(); ++ci ) {
-            painter->drawEllipse( *ci, 2, 2 );
-        }
+        QColor shadowConeBrush ( Oxygen::aluminumGray6 );
+        shadowConeBrush.setAlpha( 128 );
+        painter->setBrush( shadowConeBrush );
+        painter->drawPolygon( item->shadowConeUmbra() );
     }
 
-    // penumbra shadow cones
-
-    if( m_configWidget->checkBoxShowFullPenumbra->isChecked() ) {
-        painter->setPen( Qt::blue );
-        ci = item->shadowConePenumbra().constBegin();
-        for ( ; ci != item->shadowConePenumbra().constEnd(); ++ci ) {
-            painter->drawEllipse( *ci, 2, 2 );
-        }
-    }
-
-    if( m_configWidget->checkBoxShow60MagPenumbra->isChecked() ) {
-        painter->setPen( Qt::magenta );
-        ci = item->shadowCone60MagPenumbra().constBegin();
-        for ( ; ci != item->shadowCone60MagPenumbra().constEnd(); ++ci ) {
-            painter->drawEllipse( *ci, 3, 3 );
-        }
+    // plot central line
+    if( m_configWidget->checkBoxShowCentralLine->isChecked() && phase > 3 ) {
+        painter->setPen( Qt::black );
+        painter->drawPolyline( item->centralLine() );
     }
 
+    // mark point of maximum eclipse
     if( m_configWidget->checkBoxShowMaximum->isChecked() ) {
-        // mark point of maximum eclipse
         painter->setPen( Qt::white );
         QColor sunBoundingBrush ( Qt::white );
         sunBoundingBrush.setAlpha( 128 );
@@ -310,31 +347,6 @@ bool EclipsesPlugin::renderItem( GeoPainter *painter, \
                EclipsesItem *item )
         painter->drawText( item->maxLocation(), tr( "Maximum of Eclipse" ) );
     }
 
-    if( m_configWidget->checkBoxShowSouthernPenumbra->isChecked() ) {
-        // southern boundary
-        painter->setPen( Oxygen::brickRed4 );
-        painter->drawPolyline( item->southernPenumbra() );
-    }
-
-    if( m_configWidget->checkBoxShowNorthernPenumbra->isChecked() ) {
-        // northern boundary
-        painter->setPen( Oxygen::brickRed4 );
-        painter->drawPolyline( item->northernPenumbra() );
-    }
-
-    if( m_configWidget->checkBoxShowSunBoundaries->isChecked() ) {
-        // Sunrise / Sunset Boundaries
-        painter->setPen( Oxygen::hotOrange5 );
-        const QList<GeoDataLinearRing> boundaries = item->sunBoundaries();
-        QList<GeoDataLinearRing>::const_iterator i = boundaries.constBegin();
-        QColor sunBoundingBrush ( Oxygen::hotOrange5 );
-        sunBoundingBrush.setAlpha( 64 );
-        painter->setBrush( sunBoundingBrush );
-        for( ; i != boundaries.constEnd(); ++i ) {
-            painter->drawPolygon( *i );
-        }
-    }
-
     return true;
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic