drawMap->setRenderThreadCount( 0 );
drawMap->attach( MPlot );
baseMap->setRenderThreadCount( 0 );
baseMap->attach( MPlot );
RD = new QwtMatrixRasterData();
RDb = new QwtMatrixRasterData();
/... etc/
mapRescaler = new QwtPlotRescaler( MPlot->canvas() );
/... etc/
magnifier->setAxisEnabled( MPlot->yRight, false );
panner->setAxisEnabled( MPlot->yRight, false );
drawMap = new QwtPlotSpectrogram();
drawMap->setRenderThreadCount( 0 );
drawMap->attach( MPlot );
baseMap = new QwtPlotSpectrogram();
baseMap->setRenderThreadCount( 0 );
baseMap->attach( MPlot );
RD = new QwtMatrixRasterData();
RDb = new QwtMatrixRasterData();
rightAxis = new QwtScaleWidget();
/... etc/
mapRescaler = new QwtPlotRescaler( MPlot->canvas() );
/... etc/
magnifier = new QwtPlotMagnifier( MPlot->canvas() );
magnifier->setAxisEnabled( MPlot->yRight, false );
panner = new QwtPlotPanner( MPlot->canvas() );
panner->setAxisEnabled( MPlot->yRight, false );
To copy to clipboard, switch view to plain text mode
if (op.drawMapType == 1)
{
MinV = 0.01;
MPlot->setTitle("Runoff (l/s)");
drawMap->setColorMap(new colorMapWaterLog());
maxAxis1 = qMax(maxAxis1, MaxV);
RD->setInterval( Qt::ZAxis, QwtInterval( 0, qMax(MinV, maxAxis1)));
}
else
if (op.drawMapType == 2)
{ ... }
else
if (op.drawMapType == 3)
{ ... }
else
if (op.drawMapType == 4)
{ ... }
drawMap->setData(RD);
// link raster data to drawMap
// add legend right of axis
if (op.drawMapType == 1)
{
// log scale for runoff
rightAxis->setColorMap( drawMap->data()->interval( Qt::ZAxis ), new colorMapWaterLog());
if (maxAxis1 < 100)
MPlot->setAxisScale( MPlot->yRight, MinV, qMax(1.0,maxAxis1));
else
MPlot->setAxisScale( MPlot->yRight, MinV, qMax(10.0,maxAxis1));
}
else
if (op.drawMapType == 2)
{ ... }
else
if (op.drawMapType == 3)
{ ... }
else
if (op.drawMapType == 4)
{ ... }
MPlot->enableAxis( MPlot->yRight );
MPlot->plotLayout()->setAlignCanvasToScales( true );
MPlot->setAxisScale( MPlot->xBottom, 0.0, nrCols, nrCols/20);
MPlot->setAxisMaxMinor( MPlot->xBottom, 0 );
MPlot->setAxisScale( MPlot->yLeft, 0.0, nrRows, nrRows/20);
MPlot->setAxisMaxMinor( MPlot->yLeft, 0 );
mapRescaler->rescale();
MPlot->replot(); //<=======
if (op.drawMapType == 1)
{
MinV = 0.01;
MPlot->setTitle("Runoff (l/s)");
drawMap->setColorMap(new colorMapWaterLog());
maxAxis1 = qMax(maxAxis1, MaxV);
RD->setInterval( Qt::ZAxis, QwtInterval( 0, qMax(MinV, maxAxis1)));
}
else
if (op.drawMapType == 2)
{ ... }
else
if (op.drawMapType == 3)
{ ... }
else
if (op.drawMapType == 4)
{ ... }
drawMap->setData(RD);
// link raster data to drawMap
// add legend right of axis
if (op.drawMapType == 1)
{
// log scale for runoff
rightAxis->setColorMap( drawMap->data()->interval( Qt::ZAxis ), new colorMapWaterLog());
if (maxAxis1 < 100)
MPlot->setAxisScale( MPlot->yRight, MinV, qMax(1.0,maxAxis1));
else
MPlot->setAxisScale( MPlot->yRight, MinV, qMax(10.0,maxAxis1));
MPlot->setAxisScaleEngine( MPlot->yRight, new QwtLog10ScaleEngine() );
}
else
if (op.drawMapType == 2)
{ ... }
else
if (op.drawMapType == 3)
{ ... }
else
if (op.drawMapType == 4)
{ ... }
MPlot->enableAxis( MPlot->yRight );
MPlot->plotLayout()->setAlignCanvasToScales( true );
MPlot->setAxisScale( MPlot->xBottom, 0.0, nrCols, nrCols/20);
MPlot->setAxisMaxMinor( MPlot->xBottom, 0 );
MPlot->setAxisScale( MPlot->yLeft, 0.0, nrRows, nrRows/20);
MPlot->setAxisMaxMinor( MPlot->yLeft, 0 );
mapRescaler->rescale();
MPlot->replot(); //<=======
To copy to clipboard, switch view to plain text mode
Evry cycle the plot resets to the original zoom level showing the whole plot, and does not stay zoomed in.
Bookmarks