Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
KStars
Commits
bcf13d8c
Commit
bcf13d8c
authored
Dec 16, 2017
by
Robert Lancaster
Committed by
Jasem Mutlaq
Dec 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scatter plot in guide module
parent
e6bb032f
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
676 additions
and
435 deletions
+676
-435
kstars/ekos/guide/guide.cpp
kstars/ekos/guide/guide.cpp
+192
-0
kstars/ekos/guide/guide.h
kstars/ekos/guide/guide.h
+14
-0
kstars/ekos/guide/guide.ui
kstars/ekos/guide/guide.ui
+470
-435
No files found.
kstars/ekos/guide/guide.cpp
View file @
bcf13d8c
...
...
@@ -285,6 +285,69 @@ Guide::Guide() : QWidget()
connect
(
driftGraph
,
SIGNAL
(
mouseMove
(
QMouseEvent
*
)),
this
,
SLOT
(
driftMouseOverLine
(
QMouseEvent
*
)));
connect
(
driftGraph
,
SIGNAL
(
mousePress
(
QMouseEvent
*
)),
this
,
SLOT
(
driftMouseClicked
(
QMouseEvent
*
)));
//drift plot
double
accuracyRadius
=
2
;
driftPlot
->
setBackground
(
QBrush
(
Qt
::
black
));
driftPlot
->
setSelectionTolerance
(
10
);
driftPlot
->
xAxis
->
setBasePen
(
QPen
(
Qt
::
white
,
1
));
driftPlot
->
yAxis
->
setBasePen
(
QPen
(
Qt
::
white
,
1
));
driftPlot
->
xAxis
->
setTickPen
(
QPen
(
Qt
::
white
,
1
));
driftPlot
->
yAxis
->
setTickPen
(
QPen
(
Qt
::
white
,
1
));
driftPlot
->
xAxis
->
setSubTickPen
(
QPen
(
Qt
::
white
,
1
));
driftPlot
->
yAxis
->
setSubTickPen
(
QPen
(
Qt
::
white
,
1
));
driftPlot
->
xAxis
->
setTickLabelColor
(
Qt
::
white
);
driftPlot
->
yAxis
->
setTickLabelColor
(
Qt
::
white
);
driftPlot
->
xAxis
->
setLabelColor
(
Qt
::
white
);
driftPlot
->
yAxis
->
setLabelColor
(
Qt
::
white
);
driftPlot
->
xAxis
->
setLabelFont
(
QFont
(
font
().
family
(),
10
));
driftPlot
->
yAxis
->
setLabelFont
(
QFont
(
font
().
family
(),
10
));
driftPlot
->
xAxis
->
setLabelPadding
(
2
);
driftPlot
->
yAxis
->
setLabelPadding
(
2
);
driftPlot
->
xAxis
->
grid
()
->
setPen
(
QPen
(
QColor
(
140
,
140
,
140
),
1
,
Qt
::
DotLine
));
driftPlot
->
yAxis
->
grid
()
->
setPen
(
QPen
(
QColor
(
140
,
140
,
140
),
1
,
Qt
::
DotLine
));
driftPlot
->
xAxis
->
grid
()
->
setSubGridPen
(
QPen
(
QColor
(
80
,
80
,
80
),
1
,
Qt
::
DotLine
));
driftPlot
->
yAxis
->
grid
()
->
setSubGridPen
(
QPen
(
QColor
(
80
,
80
,
80
),
1
,
Qt
::
DotLine
));
driftPlot
->
xAxis
->
grid
()
->
setZeroLinePen
(
QPen
(
Qt
::
gray
));
driftPlot
->
yAxis
->
grid
()
->
setZeroLinePen
(
QPen
(
Qt
::
gray
));
driftPlot
->
xAxis
->
setLabel
(
i18n
(
"dRA (arcsec)"
));
driftPlot
->
yAxis
->
setLabel
(
i18n
(
"dDE (arcsec)"
));
driftPlot
->
xAxis
->
setRange
(
-
accuracyRadius
*
3
,
accuracyRadius
*
3
);
driftPlot
->
yAxis
->
setRange
(
-
accuracyRadius
*
3
,
accuracyRadius
*
3
);
driftPlot
->
setInteractions
(
QCP
::
iRangeZoom
);
driftPlot
->
setInteraction
(
QCP
::
iRangeDrag
,
true
);
driftPlot
->
addGraph
();
driftPlot
->
graph
(
0
)
->
setLineStyle
(
QCPGraph
::
lsNone
);
driftPlot
->
graph
(
0
)
->
setScatterStyle
(
QCPScatterStyle
(
QCPScatterStyle
::
ssStar
,
Qt
::
gray
,
5
));
driftPlot
->
addGraph
();
driftPlot
->
graph
(
1
)
->
setLineStyle
(
QCPGraph
::
lsNone
);
driftPlot
->
graph
(
1
)
->
setScatterStyle
(
QCPScatterStyle
(
QCPScatterStyle
::
ssPlusCircle
,
QPen
(
Qt
::
yellow
,
2
),
QBrush
(),
10
));
buildTarget
();
//connect(driftPlot, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(handlePointTooltip(QMouseEvent*)));
connect
(
rightLayout
,
SIGNAL
(
splitterMoved
(
int
,
int
)),
this
,
SLOT
(
handleVerticalPlotSizeChange
()));
connect
(
driftSplitter
,
SIGNAL
(
splitterMoved
(
int
,
int
)),
this
,
SLOT
(
handleHorizontalPlotSizeChange
()));
//connect(accuracySpin, SIGNAL(valueChanged(int)), this, SLOT(buildTarget()));
driftPlot
->
resize
(
190
,
190
);
driftPlot
->
replot
();
// Init Internal Guider always
internalGuider
=
new
InternalGuider
();
KConfigDialog
*
dialog
=
new
KConfigDialog
(
this
,
"guidesettings"
,
Options
::
self
());
...
...
@@ -308,6 +371,104 @@ Guide::~Guide()
delete
guider
;
}
void
Guide
::
handleHorizontalPlotSizeChange
()
{
driftPlot
->
xAxis
->
setScaleRatio
(
driftPlot
->
yAxis
,
1.0
);
driftPlot
->
replot
();
}
void
Guide
::
handleVerticalPlotSizeChange
()
{
driftPlot
->
yAxis
->
setScaleRatio
(
driftPlot
->
xAxis
,
1.0
);
driftPlot
->
replot
();
}
void
Guide
::
resizeEvent
(
QResizeEvent
*
event
)
{
if
(
event
->
oldSize
().
width
()
!=
-
1
)
{
if
(
event
->
oldSize
().
width
()
!=
size
().
width
())
handleHorizontalPlotSizeChange
();
else
if
(
event
->
oldSize
().
height
()
!=
size
().
height
())
handleVerticalPlotSizeChange
();
}
else
{
QTimer
::
singleShot
(
10
,
this
,
SLOT
(
handleHorizontalPlotSizeChange
()));
}
}
void
Guide
::
buildTarget
()
{
double
accuracyRadius
=
2
;
if
(
centralTarget
)
{
concentricRings
->
data
()
->
clear
();
redTarget
->
data
()
->
clear
();
yellowTarget
->
data
()
->
clear
();
centralTarget
->
data
()
->
clear
();
}
else
{
concentricRings
=
new
QCPCurve
(
driftPlot
->
xAxis
,
driftPlot
->
yAxis
);
redTarget
=
new
QCPCurve
(
driftPlot
->
xAxis
,
driftPlot
->
yAxis
);
yellowTarget
=
new
QCPCurve
(
driftPlot
->
xAxis
,
driftPlot
->
yAxis
);
centralTarget
=
new
QCPCurve
(
driftPlot
->
xAxis
,
driftPlot
->
yAxis
);
}
const
int
pointCount
=
200
;
QVector
<
QCPCurveData
>
circleRings
(
pointCount
*
(
5
));
//Have to multiply by the number of rings, Rings at : 25%, 50%, 75%, 125%, 175%
QVector
<
QCPCurveData
>
circleCentral
(
pointCount
);
QVector
<
QCPCurveData
>
circleYellow
(
pointCount
);
QVector
<
QCPCurveData
>
circleRed
(
pointCount
);
int
circleRingPt
=
0
;
for
(
int
i
=
0
;
i
<
pointCount
;
i
++
)
{
double
theta
=
i
/
(
double
)(
pointCount
)
*
2
*
M_PI
;
for
(
double
ring
=
1
;
ring
<
8
;
ring
++
)
{
if
(
ring
!=
4
&&
ring
!=
6
)
{
if
(
i
%
(
9
-
(
int
)
ring
)
==
0
)
//This causes fewer points to draw on the inner circles.
{
circleRings
[
circleRingPt
]
=
QCPCurveData
(
circleRingPt
,
accuracyRadius
*
ring
*
0.25
*
qCos
(
theta
),
accuracyRadius
*
ring
*
0.25
*
qSin
(
theta
));
circleRingPt
++
;
}
}
}
circleCentral
[
i
]
=
QCPCurveData
(
i
,
accuracyRadius
*
qCos
(
theta
),
accuracyRadius
*
qSin
(
theta
));
circleYellow
[
i
]
=
QCPCurveData
(
i
,
accuracyRadius
*
1.5
*
qCos
(
theta
),
accuracyRadius
*
1.5
*
qSin
(
theta
));
circleRed
[
i
]
=
QCPCurveData
(
i
,
accuracyRadius
*
2
*
qCos
(
theta
),
accuracyRadius
*
2
*
qSin
(
theta
));
}
concentricRings
->
setLineStyle
(
QCPCurve
::
lsNone
);
concentricRings
->
setScatterSkip
(
0
);
concentricRings
->
setScatterStyle
(
QCPScatterStyle
(
QCPScatterStyle
::
ssDisc
,
QColor
(
255
,
255
,
255
,
150
),
1
));
concentricRings
->
data
()
->
set
(
circleRings
,
true
);
redTarget
->
data
()
->
set
(
circleRed
,
true
);
yellowTarget
->
data
()
->
set
(
circleYellow
,
true
);
centralTarget
->
data
()
->
set
(
circleCentral
,
true
);
concentricRings
->
setPen
(
QPen
(
Qt
::
white
));
redTarget
->
setPen
(
QPen
(
Qt
::
red
));
yellowTarget
->
setPen
(
QPen
(
Qt
::
yellow
));
centralTarget
->
setPen
(
QPen
(
Qt
::
green
));
concentricRings
->
setBrush
(
Qt
::
NoBrush
);
redTarget
->
setBrush
(
QBrush
(
QColor
(
255
,
0
,
0
,
50
)));
yellowTarget
->
setBrush
(
QBrush
(
QColor
(
0
,
255
,
0
,
50
)));
//Note this is actually yellow. It is green on top of red with equal opacity.
centralTarget
->
setBrush
(
QBrush
(
QColor
(
0
,
255
,
0
,
50
)));
if
(
driftPlot
->
size
().
width
()
>
0
)
driftPlot
->
replot
();
}
void
Guide
::
addCCD
(
ISD
::
GDInterface
*
newCCD
)
{
ISD
::
CCD
*
ccd
=
static_cast
<
ISD
::
CCD
*>
(
newCCD
);
...
...
@@ -1408,6 +1569,8 @@ void Guide::setStatus(Ekos::GuideState newState)
driftGraph
->
graph
(
0
)
->
data
().
clear
();
driftGraph
->
graph
(
1
)
->
data
().
clear
();
driftPlot
->
graph
(
0
)
->
data
()
->
clear
();
driftPlot
->
graph
(
1
)
->
data
()
->
clear
();
guideTimer
=
QTime
::
currentTime
();
refreshColorScheme
();
}
...
...
@@ -2118,6 +2281,35 @@ void Guide::setAxisDelta(double ra, double de)
driftGraph
->
xAxis
->
setRange
(
key
,
driftGraph
->
xAxis
->
range
().
size
(),
Qt
::
AlignRight
);
driftGraph
->
replot
();
//Add to Drift Plot
driftPlot
->
graph
(
0
)
->
addData
(
ra
,
de
);
driftPlot
->
clearItems
();
driftPlot
->
graph
(
1
)
->
data
()
->
clear
();
driftPlot
->
graph
(
1
)
->
addData
(
ra
,
de
);
/**
//This would be a good autoscale function.
if (driftPlot->xAxis->range().contains(ra) == false)
{
driftPlot->graph(0)->rescaleKeyAxis(true);
driftPlot->yAxis->setScaleRatio(driftPlot->xAxis, 1.0);
}
if (driftPlot->yAxis->range().contains(de) == false)
{
driftPlot->graph(0)->rescaleValueAxis(true);
driftPlot->xAxis->setScaleRatio(driftPlot->yAxis, 1.0);
}
**/
if
(
driftPlot
->
xAxis
->
range
().
contains
(
ra
)
==
false
||
driftPlot
->
yAxis
->
range
().
contains
(
de
)
==
false
)
{
driftPlot
->
setBackground
(
QBrush
(
Qt
::
gray
));
QTimer
::
singleShot
(
0.3
,
this
,
[
=
](){
driftPlot
->
setBackground
(
QBrush
(
Qt
::
black
));
driftPlot
->
replot
();});
}
driftPlot
->
replot
();
l_DeltaRA
->
setText
(
QString
::
number
(
ra
,
'f'
,
2
));
l_DeltaDEC
->
setText
(
QString
::
number
(
de
,
'f'
,
2
));
...
...
kstars/ekos/guide/guide.h
View file @
bcf13d8c
...
...
@@ -349,6 +349,11 @@ class Guide : public QWidget, public Ui::Guide
void
refreshColorScheme
();
//plot slots
void
handleVerticalPlotSizeChange
();
void
handleHorizontalPlotSizeChange
();
//void slotAutoScaleGraph();
protected
slots
:
void
updateTelescopeType
(
int
index
);
void
updateCCDBin
(
int
index
);
...
...
@@ -412,6 +417,10 @@ class Guide : public QWidget, public Ui::Guide
void
guideChipUpdated
(
ISD
::
CCDChip
*
);
private:
void
resizeEvent
(
QResizeEvent
*
event
);
void
buildTarget
();
/**
* @brief updateGuideParams Update the guider and frame parameters due to any changes in the mount and/or ccd frame
*/
...
...
@@ -537,5 +546,10 @@ class Guide : public QWidget, public Ui::Guide
QPointer
<
FITSViewer
>
fv
;
double
primaryFL
=
-
1
,
primaryAperture
=
-
1
,
guideFL
=
-
1
,
guideAperture
=
-
1
;
QCPCurve
*
centralTarget
{
nullptr
};
QCPCurve
*
yellowTarget
{
nullptr
};
QCPCurve
*
redTarget
{
nullptr
};
QCPCurve
*
concentricRings
{
nullptr
};
};
}
kstars/ekos/guide/guide.ui
View file @
bcf13d8c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment