[kstars] kstars/projections: I found the drawing issue that was making the horizontal bar for different pixel heights of the window. It took me some time to dig up what exactly was causing the black line. But I finally did.

Jasem Mutlaq null at kde.org
Mon Mar 27 07:07:45 UTC 2017


Git commit 84e2ce9db4f07eddb13b793ef5c3a08bc67ceaf7 by Jasem Mutlaq, on behalf of Robert Lancaster.
Committed on 27/03/2017 at 07:07.
Pushed by mutlaqja into branch 'master'.

I found the drawing issue that was making the horizontal bar for different pixel heights of the window.  It took me some time to dig up what exactly was causing the black line.  But I finally did.

It was a result of clipping that was taking place in Skymapqdraw.cpp:

    // Set Clipping
    QPainterPath path;
    path.addPolygon(m_SkyMap->projector()->clipPoly());
    psky.setClipPath(path);
    psky.setClipping(true);

Which was based upon some code in Projector.cpp in the method void Projector::updateClipPoly()

The issue was that in creating the clip path, it was stepping around the circle from 0 to 180 degrees and then from 0 to -180 degrees.  As a result, it created not a circular clipping region but two semicircular clipping regions.   I painted the path so that I could clearly see what was going on:

Then I tried reversing the direction for the second half circle from -180 to 0.  This did not work, it produced an unbounded clipping region.

But then I tried doing a full circular path from 0 to 360.  This not only gave a circular path, it worked perfectly for the clipping region and fixed the problem.

Now what I don’t know is whether the reason for two separate half circles was based upon some issue with the sincos method accurately calculating the other half of the circle.  The reason I suspect this is because someone went to a lot of trouble to write two separate loops that are nearly identical.

As far as I can tell, this method works, please check for me.

CCMAIL:kstars-devel at kde.org

M  +1    -13   kstars/projections/projector.cpp

https://commits.kde.org/kstars/84e2ce9db4f07eddb13b793ef5c3a08bc67ceaf7

diff --git a/kstars/projections/projector.cpp b/kstars/projections/projector.cpp
index 9a2d6f602..74955d78a 100644
--- a/kstars/projections/projector.cpp
+++ b/kstars/projections/projector.cpp
@@ -389,7 +389,7 @@ void Projector::updateClipPoly()
 
     double r = m_vp.zoomFactor*radius();
     double t1 = 0 ;
-    double t2 = 180;
+    double t2 = 360;
     double inc=1.0;
     for ( double t=t1; t <= t2; t += inc )
     {
@@ -399,18 +399,6 @@ void Projector::updateClipPoly()
         a.SinCos( sa, ca );
         m_clipPolygon << QPointF( 0.5*m_vp.width + r*ca, 0.5*m_vp.height - r*sa);
     }
-
-    t1 =0 ;
-    t2 =- 180.;
-    for ( double t=t1; t >= t2; t -= inc )
-    {
-        //step along circumference
-        dms a( t );
-        double sa(0.), ca(0.);
-        a.SinCos( sa, ca );
-        m_clipPolygon << QPointF( 0.5*m_vp.width + r*ca, 0.5*m_vp.height - r*sa);
-    }
-
 }
 
 QPolygonF Projector::clipPoly() const


More information about the Kstars-devel mailing list