1

i am working with qgis 2.8.2, c++ api and qt 4.8.5 i have a layer in the mapcanvas, this layer contains a raster ( a georef tif picture ) when i zoom in, the raster fill the entire canvas , ok but if i grad it in any direction, in the left bottom corner by exemple, the rest of the canvas stay empty i want to know how i can redraw the canvas in order that the zoomed raster fit all the canvas and a little region on the screen

i try to use updateMap(); in the mouseReleaseEvent but nothing change

  • I've run into something similar to this when trying to view ascii grids for global-scale data that's in a non-standard projection. In some cases, on-the-fly projection rendering doesn't work due to some data being out of bounds. Are you viewing this raster in WGS84/NAD83? – Trevor J. Smith Feb 7 '16 at 5:12
  • i use the WGS84, is it a problem for panning with that kind of raster – ainardi Feb 15 '16 at 7:56
  • infact it is wgs84 / world mercator, i try with other raster,the result on pan operation after large zoom is the same, i'll try to catch the signal repaintrequested but nothing append – ainardi Feb 15 '16 at 16:00
0

after comparing my actual code of the new application with an old one of an other project i find a little difference in a class to do the pan mode

just set the properties to true on the mousepressevent forthe pan fix the problem, and set it to false when pan is finished

sample code :

void CMyQgsMapCanvas::mousePressEvent(QMouseEvent* pevent)
{

    mMouseEvent = new QMouseEvent(pevent->type() , pevent->pos(), pevent->globalPos(), pevent->button(),pevent->buttons(), pevent->modifiers() );
    mClickTimer.start(220);
    qDebug() << "Button ::" << mMouseEvent->button();

    if ( pevent->button() == Qt::LeftButton )
    {
        setRenderFlag(false);
        mCanvasProperties->panSelectorDown = true;
        mCanvasProperties->mouseButtonDown = true;
        QPoint  lPos = pevent->pos();
        mCanvasProperties->rubberStartPoint = lPos;
    }
    pevent->ignore();
}

void CMyQgsMapCanvas::mouseReleaseEvent( QMouseEvent* pevent)
{
    mLeftButtonPressed=false;
    if ( pevent->button() == Qt::LeftButton )
    {
        setRenderFlag(true);
        mCanvasProperties->panSelectorDown = false;
        mCanvasProperties->mouseButtonDown = false;
    }
    pevent->ignore();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.