Changeset - 0e27c36ff949
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-04-01 08:49:22
hy@ozderya.net
fix symbols
3 files changed with 14 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/plot.cpp
Show inline comments
 
@@ -35,12 +35,13 @@ Plot::Plot(QWidget* parent) :
 
    QwtPlot(parent),
 
    zoomer(this->canvas(), false),
 
    sZoomer(this, &zoomer)
 
{
 
    isAutoScaled = true;
 
    symbolSize = 0;
 
    numOfSamples = 1;
 

	
 
    QObject::connect(&zoomer, &Zoomer::unzoomed, this, &Plot::unzoomed);
 

	
 
    zoomer.setZoomBase();
 
    grid.attach(this);
 
    legend.attach(this);
 
@@ -247,13 +248,16 @@ void Plot::flashSnapshotOverlay(bool lig
 

	
 
void Plot::onXScaleChanged()
 
{
 
    auto sw = axisWidget(QwtPlot::xBottom);
 
    auto paintDist = sw->scaleDraw()->scaleMap().pDist();
 
    auto scaleDist = sw->scaleDraw()->scaleMap().sDist();
 
    int symDisPx = round(paintDist / scaleDist);
 
    auto fullScaleDist = zoomer.zoomBase().width();
 
    auto zoomRate = fullScaleDist / scaleDist;
 
    float samplesInView = numOfSamples / zoomRate;
 
    int symDisPx = round(paintDist / samplesInView);
 

	
 
    if (symDisPx < SYMBOL_SHOW_AT_WIDTH)
 
    {
 
        symbolSize = 0;
 
    }
 
    else
 
@@ -291,11 +295,16 @@ void Plot::resizeEvent(QResizeEvent * ev
 
    QwtPlot::resizeEvent(event);
 
    onXScaleChanged();
 
}
 

	
 
void Plot::onNumOfSamplesChanged(unsigned value)
 
{
 
    numOfSamples = value;
 
    onXScaleChanged();
 

	
 
    // TODO: what to do with this?
 

	
 
    // auto currentBase = zoomer.zoomBase();
 
    // currentBase.setWidth(value);
 
    // zoomer.setZoomBase(currentBase);
 
    // onXScaleChanged();
 
}
src/plot.h
Show inline comments
 
@@ -69,12 +69,13 @@ protected:
 
    void updateSymbols();
 

	
 
private:
 
    bool isAutoScaled;
 
    double yMin, yMax;
 
    double _xMin, _xMax;
 
    unsigned numOfSamples;
 
    int symbolSize;
 
    Zoomer zoomer;
 
    ScaleZoomer sZoomer;
 
    QwtPlotGrid grid;
 
    PlotSnapshotOverlay* snapshotOverlay;
 
    QwtPlotLegendItem legend;
src/plotmanager.cpp
Show inline comments
 
@@ -459,18 +459,16 @@ void PlotManager::flashSnapshotOverlay()
 
    }
 
}
 

	
 
void PlotManager::onNumOfSamplesChanged(unsigned value)
 
{
 
    _numOfSamples = value;
 
    if (_xAxisAsIndex)
 
    for (auto plot : plotWidgets)
 
    {
 
        for (auto plot : plotWidgets)
 
        {
 
            plot->setXAxis(0, value);
 
        }
 
        plot->onNumOfSamplesChanged(value);
 
        if (_xAxisAsIndex) plot->setXAxis(0, value);
 
    }
 
}
 

	
 
void PlotManager::saveSettings(QSettings* settings)
 
{
 
    settings->beginGroup(SettingGroup_Plot);
0 comments (0 inline, 0 general)