[Kstars-devel] [kstars] kstars/skycomponents: Fix debug code that displays the trixels. Also show the level 6
Akarsh Simha
akarshsimha at gmail.com
Sun Apr 15 08:37:55 UTC 2012
Git commit 8c99222beee0f181f153068f2277993a05ced122 by Akarsh Simha.
Committed on 15/04/2012 at 06:06.
Pushed by asimha into branch 'master'.
Fix debug code that displays the trixels. Also show the level 6
mesh. Also add trixel numbers at the centroids of trixels.
This works only in QPainter mode.
CCMAIL: kstars-devel at kde.org
M +19 -6 kstars/skycomponents/skymapcomposite.cpp
M +17 -9 kstars/skycomponents/skymesh.cpp
http://commits.kde.org/kstars/8c99222beee0f181f153068f2277993a05ced122
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index 768b332..7d0c9a1 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -270,13 +270,26 @@ void SkyMapComposite::draw( SkyPainter *skyp )
m_skyMesh->inDraw( false );
+ // DEBUG Edit. Keywords: Trixel boundaries. Currently works only in QPainter mode
// -jbb uncomment these to see trixel outlines:
- //
- //psky.setPen( QPen( QBrush( QColor( "yellow" ) ), 1, Qt::SolidLine ) );
- //m_skyMesh->draw( psky, OBJ_NEAREST_BUF );
+ /*
+ QPainter *psky = dynamic_cast< QPainter *>( skyp );
+ if( psky ) {
+ kDebug() << "Drawing trixel boundaries for debugging.";
+ psky->setPen( QPen( QBrush( QColor( "yellow" ) ), 1, Qt::SolidLine ) );
+ m_skyMesh->draw( *psky, OBJ_NEAREST_BUF );
+ SkyMesh *p;
+ if( p = SkyMesh::Instance( 6 ) ) {
+ kDebug() << "We have a deep sky mesh to draw";
+ p->draw( *psky, OBJ_NEAREST_BUF );
+ }
- //psky.setPen( QPen( QBrush( QColor( "green" ) ), 1, Qt::SolidLine ) );
- //m_skyMesh->draw( psky, NO_PRECESS_BUF );
+ psky->setPen( QPen( QBrush( QColor( "green" ) ), 1, Qt::SolidLine ) );
+ m_skyMesh->draw( *psky, NO_PRECESS_BUF );
+ if( p )
+ p->draw( *psky, NO_PRECESS_BUF );
+ }
+ */
}
diff --git a/kstars/skycomponents/skymesh.cpp b/kstars/skycomponents/skymesh.cpp
index 036bb4f..c255e04 100644
--- a/kstars/skycomponents/skymesh.cpp
+++ b/kstars/skycomponents/skymesh.cpp
@@ -18,8 +18,10 @@
#include "skymesh.h"
#include "skyobjects/skypoint.h"
#include "skyobjects/starobject.h"
+#include "projections/projector.h"
#include "ksnumbers.h"
+#include <QStaticText>
#include <QHash>
#include <QPolygonF>
#include <QPointF>
@@ -331,12 +333,14 @@ const IndexHash& SkyMesh::indexPoly( const QPolygonF* points )
return indexHash;
}
-void SkyMesh::draw(QPainter& psky, MeshBufNum_t bufNum)
+// NOTE: SkyMesh::draw() is primarily used for debugging purposes, to
+// show the trixels to enable visualizing them. Thus, it is not
+// necessary that this be compatible with GL unless we abandon the
+// QPainter some day, or the need arises to use this for some other
+// purpose. -- asimha
+void SkyMesh::draw(QPainter &psky, MeshBufNum_t bufNum)
{
- #ifdef __GNUC__
- #warning PORT SKYMESH DRAW
- #endif
- #if 0
+
SkyMap* map = SkyMap::Instance();
KStarsData* data = KStarsData::Instance();
@@ -352,14 +356,18 @@ void SkyMesh::draw(QPainter& psky, MeshBufNum_t bufNum)
s1.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
s2.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
s3.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
- QPointF q1 = map->toScreen( &s1 );
- QPointF q2 = map->toScreen( &s2 );
- QPointF q3 = map->toScreen( &s3 );
+ QPointF q1 = map->projector()->toScreen( &s1 );
+ QPointF q2 = map->projector()->toScreen( &s2 );
+ QPointF q3 = map->projector()->toScreen( &s3 );
psky.drawLine( q1, q2 );
psky.drawLine( q2, q3 );
psky.drawLine( q3, q1 );
+ // Draw the name of the trixel
+ QString TrixelNumberString;
+ TrixelNumberString.setNum( trixel );
+ psky.drawStaticText( (q1 + q2 + q3 ) / 3.0, QStaticText( TrixelNumberString ) );
}
- #endif
+
}
const SkyRegion& SkyMesh::skyRegion( const SkyPoint& _p1, const SkyPoint& _p2 )
More information about the Kstars-devel
mailing list