GLScope: polar grid and conversion for XY display (1)

pull/436/head
f4exb 2019-10-14 01:42:24 +02:00
rodzic f1e2b93cb6
commit b5a2180c30
10 zmienionych plików z 710 dodań i 753 usunięć

Wyświetl plik

@ -614,7 +614,7 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa
float traceTime = ((float) m_traceSize) / m_sampleRate;
if (traceTime >= 1.0f) { // display continuously if trace time is 1 second or more
m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex());
m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes);
}
if (m_nbSamples == 0) // finished
@ -623,7 +623,7 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa
if (traceTime < 1.0f)
{
if (m_glScope->getProcessingTraceIndex().load() < 0) {
m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex());
m_glScope->newTraces(m_traces.m_traces, m_traces.currentBufferIndex(), &m_traces.m_projectionTypes);
}
}

Wyświetl plik

@ -878,6 +878,7 @@ private:
std::vector<TraceControl*> m_tracesControl; //!< Corresponding traces control data
std::vector<TraceData> m_tracesData; //!< Corresponding traces data
std::vector<float *> m_traces[2]; //!< Double buffer of traces processed by glScope
std::vector<Projector::ProjectionType> m_projectionTypes;
int m_traceSize; //!< Current size of a trace in buffer
int m_maxTraceSize; //!< Maximum Size of a trace in buffer
bool evenOddIndex; //!< Even (true) or odd (false) index
@ -924,6 +925,7 @@ private:
m_traces[0].push_back(0);
m_traces[1].push_back(0);
m_tracesData.push_back(traceData);
m_projectionTypes.push_back(traceData.m_projectionType);
m_tracesControl.push_back(new TraceControl());
TraceControl *traceControl = m_tracesControl.back();
traceControl->initProjector(traceData.m_projectionType);
@ -939,6 +941,7 @@ private:
traceControl->releaseProjector();
traceControl->initProjector(traceData.m_projectionType);
m_tracesData[traceIndex] = traceData;
m_projectionTypes[traceIndex] = traceData.m_projectionType;
}
}
@ -949,6 +952,7 @@ private:
qDebug("ScopeVis::removeTrace");
m_traces[0].erase(m_traces[0].begin() + traceIndex);
m_traces[1].erase(m_traces[1].begin() + traceIndex);
m_projectionTypes.erase(m_projectionTypes.begin() + traceIndex);
TraceControl *traceControl = m_tracesControl[traceIndex];
traceControl->releaseProjector();
m_tracesControl.erase(m_tracesControl.begin() + traceIndex);
@ -967,6 +971,11 @@ private:
int nextControlIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesControl.size());
int nextDataIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesData.size()); // should be the same
int nextProjectionTypeIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_projectionTypes.size()); // should be the same
Projector::ProjectionType nextType = m_projectionTypes[traceIndex];
m_projectionTypes[nextProjectionTypeIndex] = m_projectionTypes[traceIndex];
m_projectionTypes[traceIndex] = nextType;
TraceControl *traceControl = m_tracesControl[traceIndex];
TraceControl *nextTraceControl = m_tracesControl[nextControlIndex];

Plik diff jest za duży Load Diff

Wyświetl plik

@ -56,8 +56,7 @@ public:
void connectTimer(const QTimer& timer);
void setTraces(std::vector<ScopeVis::TraceData>* tracesData, std::vector<float *>* traces);
void newTraces(std::vector<float *>* traces);
void newTraces(std::vector<float *>* traces, int traceIndex);
void newTraces(std::vector<float *>* traces, int traceIndex, std::vector<Projector::ProjectionType>* projectionTypes);
int getSampleRate() const { return m_sampleRate; }
int getTraceSize() const { return m_traceSize; }
@ -79,6 +78,7 @@ public:
bool getDataChanged() const { return m_dataChanged; }
DisplayMode getDisplayMode() const { return m_displayMode; }
void setDisplayXYPoints(bool value) { m_displayXYPoints = value; }
void setDisplayXYPolarGrid(bool value) { m_displayPolGrid = value; }
const QAtomicInt& getProcessingTraceIndex() const { return m_processingTraceIndex; }
signals:
@ -89,11 +89,13 @@ signals:
private:
std::vector<ScopeVis::TraceData> *m_tracesData;
std::vector<float *> *m_traces;
std::vector<Projector::ProjectionType> *m_projectionTypes;
QAtomicInt m_processingTraceIndex;
ScopeVis::TriggerData m_focusedTriggerData;
//int m_traceCounter;
uint32_t m_bufferIndex;
DisplayMode m_displayMode;
bool m_displayPolGrid;
QTimer m_timer;
QMutex m_mutex;
QAtomicInt m_dataChanged;
@ -170,6 +172,13 @@ private:
QPixmap& channelOverlayPixmap,
const QRectF& glScopeRect);
static bool isPositiveProjection(Projector::ProjectionType& projectionType)
{
return (projectionType == Projector::ProjectionMagLin)
|| (projectionType == Projector::ProjectionMagDB)
|| (projectionType == Projector::ProjectionMagSq);
}
protected slots:
void cleanup();
void tick();

Wyświetl plik

@ -540,6 +540,11 @@ void GLScopeGUI::on_polarPoints_toggled(bool checked)
m_glScope->setDisplayXYPoints(checked);
}
void GLScopeGUI::on_polarGrid_toggled(bool checked)
{
m_glScope->setDisplayXYPolarGrid(checked);
}
void GLScopeGUI::on_traceIntensity_valueChanged(int value)
{
ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(value));

Wyświetl plik

@ -196,6 +196,7 @@ private slots:
void on_verticalXY_toggled(bool checked);
void on_polar_toggled(bool checked);
void on_polarPoints_toggled(bool checked);
void on_polarGrid_toggled(bool checked);
void on_traceIntensity_valueChanged(int value);
void on_gridIntensity_valueChanged(int value);
void on_time_valueChanged(int value);

Wyświetl plik

@ -280,6 +280,21 @@
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="polarGrid">
<property name="toolTip">
<string>Toggle between polar and rectangular grid for XY display</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/res.qrc">
<normaloff>:/gridrect.png</normaloff>
<normalon>:/gridpolar.png</normalon>:/gridrect.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="traceIntensity">
<property name="minimumSize">

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 747 B

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 415 B

Wyświetl plik

@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/">
<file>gridpolar.png</file>
<file>gridrect.png</file>
<file>double_arrow_up.png</file>
<file>no_film.png</file>
<file>gps.png</file>