mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 21:20:31 -05:00 
			
		
		
		
	GLScope: polar grid and conversion for XY display (1)
This commit is contained in:
		
							parent
							
								
									f1e2b93cb6
								
							
						
					
					
						commit
						b5a2180c30
					
				@ -614,7 +614,7 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa
 | 
				
			|||||||
    float traceTime = ((float) m_traceSize) / m_sampleRate;
 | 
					    float traceTime = ((float) m_traceSize) / m_sampleRate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (traceTime >= 1.0f) { // display continuously if trace time is 1 second or more
 | 
					    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
 | 
					    if (m_nbSamples == 0) // finished
 | 
				
			||||||
@ -623,7 +623,7 @@ int ScopeVis::processTraces(const SampleVector::const_iterator& cbegin, const Sa
 | 
				
			|||||||
        if (traceTime < 1.0f)
 | 
					        if (traceTime < 1.0f)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (m_glScope->getProcessingTraceIndex().load() < 0) {
 | 
					            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);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -878,6 +878,7 @@ private:
 | 
				
			|||||||
        std::vector<TraceControl*> m_tracesControl;   //!< Corresponding traces control data
 | 
					        std::vector<TraceControl*> m_tracesControl;   //!< Corresponding traces control data
 | 
				
			||||||
        std::vector<TraceData> m_tracesData;          //!< Corresponding traces data
 | 
					        std::vector<TraceData> m_tracesData;          //!< Corresponding traces data
 | 
				
			||||||
        std::vector<float *> m_traces[2];             //!< Double buffer of traces processed by glScope
 | 
					        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_traceSize;                              //!< Current size of a trace in buffer
 | 
				
			||||||
        int m_maxTraceSize;                           //!< Maximum Size of a trace in buffer
 | 
					        int m_maxTraceSize;                           //!< Maximum Size of a trace in buffer
 | 
				
			||||||
        bool evenOddIndex;                            //!< Even (true) or odd (false) index
 | 
					        bool evenOddIndex;                            //!< Even (true) or odd (false) index
 | 
				
			||||||
@ -924,6 +925,7 @@ private:
 | 
				
			|||||||
                m_traces[0].push_back(0);
 | 
					                m_traces[0].push_back(0);
 | 
				
			||||||
                m_traces[1].push_back(0);
 | 
					                m_traces[1].push_back(0);
 | 
				
			||||||
                m_tracesData.push_back(traceData);
 | 
					                m_tracesData.push_back(traceData);
 | 
				
			||||||
 | 
					                m_projectionTypes.push_back(traceData.m_projectionType);
 | 
				
			||||||
                m_tracesControl.push_back(new TraceControl());
 | 
					                m_tracesControl.push_back(new TraceControl());
 | 
				
			||||||
                TraceControl *traceControl = m_tracesControl.back();
 | 
					                TraceControl *traceControl = m_tracesControl.back();
 | 
				
			||||||
                traceControl->initProjector(traceData.m_projectionType);
 | 
					                traceControl->initProjector(traceData.m_projectionType);
 | 
				
			||||||
@ -939,6 +941,7 @@ private:
 | 
				
			|||||||
                traceControl->releaseProjector();
 | 
					                traceControl->releaseProjector();
 | 
				
			||||||
                traceControl->initProjector(traceData.m_projectionType);
 | 
					                traceControl->initProjector(traceData.m_projectionType);
 | 
				
			||||||
                m_tracesData[traceIndex] = traceData;
 | 
					                m_tracesData[traceIndex] = traceData;
 | 
				
			||||||
 | 
					                m_projectionTypes[traceIndex] = traceData.m_projectionType;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -949,6 +952,7 @@ private:
 | 
				
			|||||||
                qDebug("ScopeVis::removeTrace");
 | 
					                qDebug("ScopeVis::removeTrace");
 | 
				
			||||||
                m_traces[0].erase(m_traces[0].begin() + traceIndex);
 | 
					                m_traces[0].erase(m_traces[0].begin() + traceIndex);
 | 
				
			||||||
                m_traces[1].erase(m_traces[1].begin() + traceIndex);
 | 
					                m_traces[1].erase(m_traces[1].begin() + traceIndex);
 | 
				
			||||||
 | 
					                m_projectionTypes.erase(m_projectionTypes.begin() + traceIndex);
 | 
				
			||||||
                TraceControl *traceControl = m_tracesControl[traceIndex];
 | 
					                TraceControl *traceControl = m_tracesControl[traceIndex];
 | 
				
			||||||
                traceControl->releaseProjector();
 | 
					                traceControl->releaseProjector();
 | 
				
			||||||
                m_tracesControl.erase(m_tracesControl.begin() + traceIndex);
 | 
					                m_tracesControl.erase(m_tracesControl.begin() + traceIndex);
 | 
				
			||||||
@ -967,6 +971,11 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            int nextControlIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesControl.size());
 | 
					            int nextControlIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesControl.size());
 | 
				
			||||||
            int nextDataIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesData.size()); // should be the same
 | 
					            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 *traceControl = m_tracesControl[traceIndex];
 | 
				
			||||||
            TraceControl *nextTraceControl = m_tracesControl[nextControlIndex];
 | 
					            TraceControl *nextTraceControl = m_tracesControl[nextControlIndex];
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -56,8 +56,7 @@ public:
 | 
				
			|||||||
    void connectTimer(const QTimer& timer);
 | 
					    void connectTimer(const QTimer& timer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void setTraces(std::vector<ScopeVis::TraceData>* tracesData, std::vector<float *>* traces);
 | 
					    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, std::vector<Projector::ProjectionType>* projectionTypes);
 | 
				
			||||||
    void newTraces(std::vector<float *>* traces, int traceIndex);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int getSampleRate() const { return m_sampleRate; }
 | 
					    int getSampleRate() const { return m_sampleRate; }
 | 
				
			||||||
    int getTraceSize() const { return m_traceSize; }
 | 
					    int getTraceSize() const { return m_traceSize; }
 | 
				
			||||||
@ -79,6 +78,7 @@ public:
 | 
				
			|||||||
    bool getDataChanged() const { return m_dataChanged; }
 | 
					    bool getDataChanged() const { return m_dataChanged; }
 | 
				
			||||||
    DisplayMode getDisplayMode() const { return m_displayMode; }
 | 
					    DisplayMode getDisplayMode() const { return m_displayMode; }
 | 
				
			||||||
    void setDisplayXYPoints(bool value) { m_displayXYPoints = value; }
 | 
					    void setDisplayXYPoints(bool value) { m_displayXYPoints = value; }
 | 
				
			||||||
 | 
					    void setDisplayXYPolarGrid(bool value) { m_displayPolGrid = value; }
 | 
				
			||||||
    const QAtomicInt& getProcessingTraceIndex() const { return m_processingTraceIndex; }
 | 
					    const QAtomicInt& getProcessingTraceIndex() const { return m_processingTraceIndex; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
signals:
 | 
					signals:
 | 
				
			||||||
@ -89,11 +89,13 @@ signals:
 | 
				
			|||||||
private:
 | 
					private:
 | 
				
			||||||
    std::vector<ScopeVis::TraceData> *m_tracesData;
 | 
					    std::vector<ScopeVis::TraceData> *m_tracesData;
 | 
				
			||||||
    std::vector<float *> *m_traces;
 | 
					    std::vector<float *> *m_traces;
 | 
				
			||||||
 | 
					    std::vector<Projector::ProjectionType> *m_projectionTypes;
 | 
				
			||||||
    QAtomicInt m_processingTraceIndex;
 | 
					    QAtomicInt m_processingTraceIndex;
 | 
				
			||||||
    ScopeVis::TriggerData m_focusedTriggerData;
 | 
					    ScopeVis::TriggerData m_focusedTriggerData;
 | 
				
			||||||
    //int m_traceCounter;
 | 
					    //int m_traceCounter;
 | 
				
			||||||
    uint32_t m_bufferIndex;
 | 
					    uint32_t m_bufferIndex;
 | 
				
			||||||
    DisplayMode m_displayMode;
 | 
					    DisplayMode m_displayMode;
 | 
				
			||||||
 | 
					    bool m_displayPolGrid;
 | 
				
			||||||
    QTimer m_timer;
 | 
					    QTimer m_timer;
 | 
				
			||||||
    QMutex m_mutex;
 | 
					    QMutex m_mutex;
 | 
				
			||||||
    QAtomicInt m_dataChanged;
 | 
					    QAtomicInt m_dataChanged;
 | 
				
			||||||
@ -170,6 +172,13 @@ private:
 | 
				
			|||||||
            QPixmap& channelOverlayPixmap,
 | 
					            QPixmap& channelOverlayPixmap,
 | 
				
			||||||
            const QRectF& glScopeRect);
 | 
					            const QRectF& glScopeRect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    static bool isPositiveProjection(Projector::ProjectionType& projectionType)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return (projectionType == Projector::ProjectionMagLin)
 | 
				
			||||||
 | 
					            || (projectionType == Projector::ProjectionMagDB)
 | 
				
			||||||
 | 
					            || (projectionType == Projector::ProjectionMagSq);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected slots:
 | 
					protected slots:
 | 
				
			||||||
    void cleanup();
 | 
					    void cleanup();
 | 
				
			||||||
    void tick();
 | 
					    void tick();
 | 
				
			||||||
 | 
				
			|||||||
@ -540,6 +540,11 @@ void GLScopeGUI::on_polarPoints_toggled(bool checked)
 | 
				
			|||||||
    m_glScope->setDisplayXYPoints(checked);
 | 
					    m_glScope->setDisplayXYPoints(checked);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GLScopeGUI::on_polarGrid_toggled(bool checked)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    m_glScope->setDisplayXYPolarGrid(checked);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GLScopeGUI::on_traceIntensity_valueChanged(int value)
 | 
					void GLScopeGUI::on_traceIntensity_valueChanged(int value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(value));
 | 
					    ui->traceIntensity->setToolTip(QString("Trace intensity: %1").arg(value));
 | 
				
			||||||
 | 
				
			|||||||
@ -196,6 +196,7 @@ private slots:
 | 
				
			|||||||
    void on_verticalXY_toggled(bool checked);
 | 
					    void on_verticalXY_toggled(bool checked);
 | 
				
			||||||
    void on_polar_toggled(bool checked);
 | 
					    void on_polar_toggled(bool checked);
 | 
				
			||||||
    void on_polarPoints_toggled(bool checked);
 | 
					    void on_polarPoints_toggled(bool checked);
 | 
				
			||||||
 | 
					    void on_polarGrid_toggled(bool checked);
 | 
				
			||||||
    void on_traceIntensity_valueChanged(int value);
 | 
					    void on_traceIntensity_valueChanged(int value);
 | 
				
			||||||
    void on_gridIntensity_valueChanged(int value);
 | 
					    void on_gridIntensity_valueChanged(int value);
 | 
				
			||||||
    void on_time_valueChanged(int value);
 | 
					    void on_time_valueChanged(int value);
 | 
				
			||||||
 | 
				
			|||||||
@ -280,6 +280,21 @@
 | 
				
			|||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </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>
 | 
					     <item>
 | 
				
			||||||
      <widget class="QDial" name="traceIntensity">
 | 
					      <widget class="QDial" name="traceIntensity">
 | 
				
			||||||
       <property name="minimumSize">
 | 
					       <property name="minimumSize">
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								sdrgui/resources/gridpolar.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrgui/resources/gridpolar.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 747 B  | 
							
								
								
									
										
											BIN
										
									
								
								sdrgui/resources/gridrect.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								sdrgui/resources/gridrect.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 415 B  | 
@ -1,5 +1,7 @@
 | 
				
			|||||||
<RCC>
 | 
					<RCC>
 | 
				
			||||||
  <qresource prefix="/">
 | 
					  <qresource prefix="/">
 | 
				
			||||||
 | 
					    <file>gridpolar.png</file>
 | 
				
			||||||
 | 
					    <file>gridrect.png</file>
 | 
				
			||||||
    <file>double_arrow_up.png</file>
 | 
					    <file>double_arrow_up.png</file>
 | 
				
			||||||
    <file>no_film.png</file>
 | 
					    <file>no_film.png</file>
 | 
				
			||||||
    <file>gps.png</file>
 | 
					    <file>gps.png</file>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user