void SkServer::getPos() { QByteArray data; CMapView *view = m_mainWin->getView(); double ra, dec; trfConvScrPtToXY(view->width() / 2., view->height() / 2., ra, dec); if (view->m_mapView.epochJ2000 && view->m_mapView.coordType == SMCT_RA_DEC) { precess(&ra, &dec, view->m_mapView.jd, JD2000); } data.append(QString::number(R2D(ra), 'f')); data.append(","); data.append(QString::number(R2D(dec), 'f')); sendData(data); }
void CGrid::renderGrid(int type, SKMATRIX *mat, mapView_t *mapView, CSkPainter *pPainter, bool eqOnly) ////////////////////////////////////////////////////////////////////////////////////////////////////// { double spc; double cx, cy; setSetFont(FONT_GRID, pPainter); trfGetScreenSize(scrWidth, scrHeight); QColor col = g_skSet.map.grid[type].color; pPainter->setPen(col); pPainter->drawRect(clipSize, clipSize, scrWidth - clipSize * 2, scrHeight - clipSize * 2); if (type == SMCT_ECL || type == SMCT_ALT_AZM) { radec_t rd; SKPOINT pt; double sx, sy; trfGetCenter(sx, sy); trfConvScrPtToXY(sx, sy, cx, cy); rd.Ra = cx; rd.Dec = cy; precess(&rd.Ra, &rd.Dec, mapView->jd, JD2000); SKMATRIX matInv; SKMATRIXInverse(&matInv, mat); trfRaDecToPointNoCorrect(&rd, &pt, &matInv); cx = -atan2(pt.w.x, pt.w.z); cy = atan2(-pt.w.y, sqrt(pt.w.x * pt.w.x + pt.w.z * pt.w.z)); rangeDbl(&cx, R360); if (type == SMCT_ALT_AZM) { cy += cAstro.getAtmRef(cy); } } else { double sx, sy; trfGetCenter(sx, sy); trfConvScrPtToXY(sx, sy, cx, cy); if (mapView->coordType == SMCT_RA_DEC && mapView->epochJ2000) { precess(&cx, &cy, mapView->jd, JD2000); } } if (mapView->fov > D2R(45)) spc = 10; else if (mapView->fov > D2R(10)) spc = 5; else if (mapView->fov > D2R(5)) spc = 2; else if (mapView->fov > D2R(1)) spc = 1; else if (mapView->fov > D2R(0.5)) spc = 0.5; else if (mapView->fov > D2R(0.25)) spc = 0.1; else spc = (0.05); mSet.clear(); double spcx = spc; double spcy = spc; if (qAbs(mapView->y) > D2R(80)) { spcx *= 40; } else if (qAbs(mapView->y) > D2R(60)) { spcx *= 5; } else if (qAbs(mapView->y) > D2R(45)) { spcx *= 2; } spcx = CLAMP(spcx, 0.25, 10); spcy = CLAMP(spcy, 0.25, 10); double x = R2D(cx - fmod(cx, D2R(spcx))); double y; if (cy >= 0) { y = R2D(cy - fmod(cy, D2R(spcy))); } else { y = -(R2D(qAbs(cy) - fmod(qAbs(cy), D2R(spcy))) + spcy); if (y < -90) y = -90; } depth = 0; ren = 0; render(type, mat, mapView, pPainter, eqOnly, FROMRA(x), FROMDEC(y), FROMRA(spcx), FROMRA(spcy)); }