Add basic OSM notes to marble
ClosedPublic

Authored by spencerb on Dec 31 2016, 4:21 PM.

Diff Detail

Repository
R34 Marble
Lint
Lint Skipped
Unit
Unit Tests Skipped
spencerb updated this revision to Diff 9556.Dec 31 2016, 4:21 PM
spencerb retitled this revision from to Add basic OSM notes to marble.
spencerb updated this object.
spencerb edited the test plan for this revision. (Show Details)
spencerb added reviewers: Marble, nienhueser, rahn.
spencerb set the repository for this revision to R34 Marble.
spencerb added a project: Marble.
spencerb updated this revision to Diff 9557.Dec 31 2016, 4:27 PM

Diff was reversed, where modified changes were "removed" instead of "added", etc.

nienhueser requested changes to this revision.Dec 31 2016, 7:42 PM
nienhueser edited edge metadata.

Any chance you attached an incomplete patch? It compiles etc, but has some logic errors. Maybe it's just one commit of several?

src/plugins/render/notes/NotesModel.cpp
45

The last append(",") results in an invalid URL.

74

The id is not extracted here, guess it needs a toInt() and afterwards a conversion to QString.

This revision now requires changes to proceed.Dec 31 2016, 7:42 PM
spencerb updated this revision to Diff 9594.Jan 1 2017, 9:17 PM
spencerb updated this object.
spencerb edited edge metadata.

Fixed inline problems:
id extraction from json,
typo in urlquery generation

spencerb updated this revision to Diff 9595.Jan 1 2017, 9:18 PM
spencerb edited edge metadata.

Remove debugging statement

I still don't see any drawing. Placed a debug statement in NotesItem::paint(), but it never gets triggered. The notes online service is activated in the menu of course, and I see that it downloads and parses notes with ids successfully. Do you know what could go wrong there?

Strange. I'm not very experienced with QPainter, so I wouldn't be surprised if that was the issue. But if paint() is never called, that's impossible. I would think that the item wasn't created successfully, but it seems it is. I'll keep looking around; I'll check to see where the paint() is actually supposed to be called from - perhaps by looking some more in AbstractDataPlugin and PostalCodePlugin and the item classes.

It looks like paint() is called from MarbleGraphicsItem::paintEvent(). I'm placing some debug statements in their to try and see what happens.

spencerb updated this object.Jan 2 2017, 7:07 PM
nienhueser requested changes to this revision.Jan 3 2017, 8:16 AM
nienhueser edited edge metadata.

There are three problems that prevent notes from showing up:

  • the item size is initialized to (0, 0) and not updated later
  • the image is loaded from a relative location where it cannot be found
  • longitude and latitude are swapped in the parser, leading to wrong/invalid coordinates

See https://paste.kde.org/pdqyyb64q for a patch that fixes that. With that I finally have notes showing up on my system.

This revision now requires changes to proceed.Jan 3 2017, 8:16 AM
spencerb updated this revision to Diff 9672.EditedJan 3 2017, 10:02 PM
spencerb edited edge metadata.

Thanks. I had a really wrong idea of what QSize did. Sorry about the trouble.
And ofc the image wouldn't load in the built application because the relative path from the source would no longer be valid (since the image wouldn't be installed directly beside the notes plugin), this one is a bit of a facepalm for me.
Off topic, the reason to use drawPixmap instead of drawImage is simply performance efficiency, right?

Closed by commit R34:a8e5b33e843a: Add basic OSM notes to marble (authored by Spencer Brown <sbrown124@gmail.com>, committed by nienhueser). · Explain WhyJan 3 2017, 10:39 PM
This revision was automatically updated to reflect the committed changes.