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

LineObject is not positioned properly on the map #12

Open
asdzxcasd opened this issue Dec 15, 2014 · 3 comments
Open

LineObject is not positioned properly on the map #12

asdzxcasd opened this issue Dec 15, 2014 · 3 comments

Comments

@asdzxcasd
Copy link

I tried to draw a line that connects two points 200 km apart. But one of ends of line was about 7 km to south of the first point, so the line did not pass through the point.

Code fragment:

void CustomMapGraphicsView::updatePointDirection(int id)
{
    QPointF location = _matchesManager->getCameraLocation();
    QPointF pointLocation = _matchesManager->getPointLocation(id);

    MapGraphicsObject* line = new LineObject(location, pointLocation);
    scene()->addObject(line);
}
@raptorswing
Copy link
Owner

Hi,

Thanks for letting me know. When I wrote this library, my use cases never included using such large objects. So I never ran into this. Probably this is a problem with conversion between coordinate spaces while drawing objects...I think I am taking some lazy shortcuts which are not "too bad" at a small/local scale but on a large scale like 200km the errors will become apparent.

I will try to take a look at this soon and see if I can make it work.

@asdzxcasd
Copy link
Author

Hi,

Thanks for your quick response. I think that the issue is that information about map projection is hidden in PrivateQGraphicsObject, and LineObject itself knows only its position to paint itself. However both endpoints of the line require map projection.

@raptorswing
Copy link
Owner

Hello again,

Spent some time looking at this... might be tricky to make it work in a good way since the framework currently assumes that drawing takes place in East-North-Up coordinates (or rather just East-North since we only do 2D). ENU makes a flat earth assumption... which isn't too horrible over small distances, but of course it breaks down over hundreds of km.

I will think some more about this... let me know if you come up with a good way to handle this (or better yet, submit a pull request 😄 )

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