Skip to content

Commit

Permalink
when graph corrections are shown to scale, show tha actual guide dura…
Browse files Browse the repository at this point in the history
…tion, not the guide distance
  • Loading branch information
agalasso committed Jul 18, 2018
1 parent 948633f commit 1640dc8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
27 changes: 20 additions & 7 deletions graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,23 +1309,33 @@ void GraphLogClientWindow::OnPaint(wxPaintEvent& WXUNUSED(evt))

if (m_showCorrections)
{
int maxDur = GetMaxDuration(m_history, start_item);

const double ymagc = !m_correctionsToScale ? (size.y - 10) * 0.5 / (double)maxDur : ymag;
double ymagc;
if (m_correctionsToScale)
{
ymagc = ymag;
}
else
{
int maxDur = GetMaxDuration(m_history, start_item);
ymagc = (size.y - 10) * 0.5 / (double) maxDur;
}
ScaleAndTranslate sctr(xorig, yorig, xmag, ymagc);

dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(wxPen(m_raOrDxColor.ChangeLightness(60)));

double const xRate = pMount ? pMount->xRate() : 1.0;

for (unsigned int i = start_item, j = 0; i < m_history.size(); i++, j++)
{
const S_HISTORY& h = m_history[i];

if (h.raDur != 0)
{
// West corrections => Up on graph
const double raDur = !m_correctionsToScale ?
(h.raDir == WEST ? -h.raDur : h.raDur) : -h.racorr;
double raDur = h.raDir == WEST ? -h.raDur : h.raDur;
if (m_correctionsToScale)
raDur *= xRate;
wxPoint pt(sctr.pt(j, raDur));
if (raDur < 0)
dc.DrawRectangle(pt, wxSize(4, yorig - pt.y));
Expand All @@ -1336,15 +1346,18 @@ void GraphLogClientWindow::OnPaint(wxPaintEvent& WXUNUSED(evt))

dc.SetPen(wxPen(m_decOrDyColor.ChangeLightness(60)));

double const yRate = pMount ? pMount->yRate() : 1.0;

for (unsigned int i = start_item, j = 0; i < m_history.size(); i++, j++)
{
const S_HISTORY& h = m_history[i];

if (h.decDur != 0)
{
// North Corrections => Up on graph
const double decDur = !m_correctionsToScale ?
(h.decDir == SOUTH ? h.decDur : -h.decDur) : h.deccorr;
double decDur = h.decDir == SOUTH ? h.decDur : -h.decDur;
if (m_correctionsToScale)
decDur *= yRate;
wxPoint pt(sctr.pt(j, decDur));
pt.x += 5;
if (decDur < 0)
Expand Down
3 changes: 0 additions & 3 deletions graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ struct S_HISTORY
double dy;
double ra;
double dec;
double racorr;
double deccorr;
double starSNR;
double starMass;
int raDur;
Expand All @@ -74,7 +72,6 @@ struct S_HISTORY
S_HISTORY(const GuideStepInfo& step)
: timestamp(::wxGetUTCTimeMillis().GetValue()),
dx(step.cameraOffset.X), dy(step.cameraOffset.Y), ra(step.mountOffset.X), dec(step.mountOffset.Y),
racorr(step.guideDistanceRA), deccorr(step.guideDistanceDec),
starSNR(step.starSNR), starMass(step.starMass),
raDur(step.durationRA), decDur(step.durationDec),
raDir(step.directionRA), decDir(step.directionDec),
Expand Down

0 comments on commit 1640dc8

Please sign in to comment.