Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGVLayerTiles opacity #46

Open
de-wu opened this issue Feb 21, 2024 · 1 comment
Open

QGVLayerTiles opacity #46

de-wu opened this issue Feb 21, 2024 · 1 comment

Comments

@de-wu
Copy link

de-wu commented Feb 21, 2024

I've problem with layer tiles opacity. When I set opacity lower than 1.0, lines between tiles become visible. I think that's caused by old tiles in the background. Is it any solution for this problem?

@AmonRaNet
Copy link
Owner

I think I know reason. When I have developed online layer (tiles) I found bad behavior in QGraphicsView.
Neighbor tiles during zoom starts to get free space in-between (1 pixel) - right/bottom edge. And it was not because of wrong coordinates of tiles, but because of zoom itself. Most likely is because of rounding (scene to display pixels). In any case it was looking really bad.

Here is example:
Screenshot_38

To fix it I have added extra code to adjust size (by 1 display pixel) of image every time when zoom is changed:

in QGVImage::projPaint

    if (!isFlag(QGV::ItemFlag::IgnoreScale)) {
        const double pixelFactor = 1.0 / getMap()->getCamera().scale();
        paintRect.setSize(paintRect.size() + QSizeF(pixelFactor, pixelFactor));
    }

As result there are no gaps, but when opacity changed most likely you will see opposite of problem (1 pixel overlap).

You can find better solution to solve both problems or at least you can remote this code for your version.

Please share results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants