void SkyQPainter::drawSkyPolyline(LineList* list, SkipList* skipList, LineListLabel* label) { SkyList *points = list->points(); bool isVisible, isVisibleLast; QPointF oLast = m_proj->toScreen( points->first(), true, &isVisibleLast ); // & with the result of checkVisibility to clip away things below horizon isVisibleLast &= m_proj->checkVisibility( points->first() ); QPointF oThis, oThis2; for ( int j = 1 ; j < points->size() ; j++ ) { SkyPoint* pThis = points->at( j ); oThis2 = oThis = m_proj->toScreen( pThis, true, &isVisible ); // & with the result of checkVisibility to clip away things below horizon isVisible &= m_proj->checkVisibility(pThis); bool doSkip = false; if( skipList ) { doSkip = skipList->skip(j); } if ( !doSkip ) { if ( isVisible && isVisibleLast ) { drawLine( oLast, oThis ); if ( label ) label->updateLabelCandidates( oThis.x(), oThis.y(), list, j ); } } oLast = oThis2; isVisibleLast = isVisible; } }
// Don't precess the points, just account for the Earth's rotation void NoPrecessIndex::JITupdate( LineList* lineList ) { KStarsData *data = KStarsData::Instance(); lineList->updateID = data->updateID(); SkyList* points = lineList->points(); for (int i = 0; i < points->size(); i++ ) { points->at( i )->EquatorialToHorizontal( data->lst(), data->geo()->lat() ); } }
void SkyQPainter::drawSkyPolyline(LineList* list, SkipList* skipList, LineListLabel* label) { SkyList *points = list->points(); bool isVisible, isVisibleLast; QPointF oLast = m_proj->toScreen( points->first(), true, &isVisibleLast ); // & with the result of checkVisibility to clip away things below horizon isVisibleLast &= m_proj->checkVisibility( points->first() ); QPointF oThis, oThis2; for ( int j = 1 ; j < points->size() ; j++ ) { SkyPoint* pThis = points->at( j ); oThis2 = oThis = m_proj->toScreen( pThis, true, &isVisible ); // & with the result of checkVisibility to clip away things below horizon isVisible &= m_proj->checkVisibility(pThis); bool doSkip = false; if( skipList ) { doSkip = skipList->skip(j); } bool pointsVisible = false; //Temporary solution to avoid random lines in Gnomonic projection and draw lines up to horizon if(SkyMap::Instance()->projector()->type() == Projector::Gnomonic) { if ( isVisible && isVisibleLast ) pointsVisible = true; } else { if ( isVisible || isVisibleLast ) pointsVisible = true; } if ( !doSkip ) { if(pointsVisible) { drawLine( oLast, oThis ); if ( label ) label->updateLabelCandidates( oThis.x(), oThis.y(), list, j ); } } oLast = oThis2; isVisibleLast = isVisible; } }
void SkyQPainter::drawSkyPolygon(LineList* list) { SkyList *points = list->points(); bool isVisible, isVisibleLast; SkyPoint* pLast = points->last(); QPointF oLast = m_proj->toScreen( pLast, true, &isVisibleLast ); // & with the result of checkVisibility to clip away things below horizon isVisibleLast &= m_proj->checkVisibility(pLast); QPolygonF polygon; for ( int i = 0; i < points->size(); ++i ) { SkyPoint* pThis = points->at( i ); QPointF oThis = m_proj->toScreen( pThis, true, &isVisible ); // & with the result of checkVisibility to clip away things below horizon isVisible &= m_proj->checkVisibility(pThis); if ( isVisible && isVisibleLast ) { polygon << oThis; } else if ( isVisibleLast ) { QPointF oMid = m_proj->clipLine( pLast, pThis ); polygon << oMid; } else if ( isVisible ) { QPointF oMid = m_proj->clipLine( pThis, pLast ); polygon << oMid; polygon << oThis; } pLast = pThis; oLast = oThis; isVisibleLast = isVisible; } if ( polygon.size() ) drawPolygon(polygon); }