This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Placemark style does not update after switch to 15.12

Tags: None
(comma "," separated)
joshl
Registered Member
Posts
4
Karma
0
Hi all,

I am using marble within my own Qt application to track the position of a vehicle. I initially developed the program using the 15.08 release of marble, and the switch to 15.12 has caused some problems.

My vehicle is displayed using a GeoDataPlacemark and I adjust the orientation, color, and size by modifying the placemark's icon, GeoDataIconStyle, and GeoDataStyle, and then calling treeModel()->updateFeature(). In 15.08 this worked just fine. In 15.12, none of the elements contained within GeoDataStyle are updated while the placemark is in the field of view. However, if the placemark goes out of view and then comes back into view (by panning or zooming), the style is updated once when the placemark reenters view.

It seems like something inside marble changed how and when styles are updated. Is there some way of forcing a style refresh or is there a new model for handling styles that I need to be following?

Regards,
Josh
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS
It might be related to commit d609996, but could be another problem as well. Can you create a minimum example to help tracking things down?
joshl
Registered Member
Posts
4
Karma
0
Here is roughly what I did under 15.08 and worked:

First some initial setup:
Code: Select all
Marble::GeoDataIconStyle iconStyle; // the icon style used within vehiStyle
Marble::GeoDataStyle * vehiStyle = new Marble::GeoDataStyle(); // our vehicle style
Marble::GeoDataPlacemark * vehiMark = new Marble::GeoDataPlacemark(); // our vehicle placemark

// set up the icon style
iconStyle.setIcon(/*Existing QImage here*/)
iconStyle.setScale(0.5)

// now the vehicle style
vehiStyle->setIconStyle(iconStyle);
vehiMark->setStyle(vehiStyle);

// add the vehicle to the map
Marble::GeoDataDocument *document = new Marble::GeoDataDocument();
document->append(m_vehiMark);
ui.marbleWidget->model()->treeModel()->addDocument(document);

If I then wanted to change the size of the icon:
Code: Select all
iconStyle.setScale(1.0); // make the icon bigger
vehiStyle->setIconStyle(iconStyle);
ui.marbleWidget->model()->treeModel()->updateFeature(vehiMark);


With 15.12 I started by changing vehiStyle to be of type QSharePointer<Marble::GeoDataStyle>, but the same code does not work. I've tried a few variants of re-applying the styles and such, but without success so far.

Interestingly, when I change the scale of the icon like this in 15.12, the icon does move a bit even though its coordinates are not changing. It looks like the position is being adjusted to correctly center the new icon size, even though the visible icon does not change size until you pan away and come back. See images here: http://imgur.com/a/7mCiD
masoudnorozi
Registered Member
Posts
6
Karma
0
I have the same problem
i cant fix it
I'm using qt 5.5 and marble 0.22 develop version
geodataplacemark do not update when set style , when it go out of view port and goes back , it updated
I'm confused ?!!!!!!!!!!!!!!!!

please help ...................
:'( :'( :'( :'( :'( :'( :'(
joshl
Registered Member
Posts
4
Karma
0
I never did fix this issue. Instead, since I needed to draw other feature types as well, I ended up creating my own paint layer following the example here: https://techbase.kde.org/Marble/LayerInterface. LayerInterface requires a little bit more upfront investment, but I think the end result is cleaner, especially if you're trying to do something more complicated.
masoudnorozi
Registered Member
Posts
6
Karma
0
can i add GeDataPlaceMark to LayerInterface?
joshl
Registered Member
Posts
4
Karma
0
Not exactly, but you can do something similar. LayerInterface lets you define your own layer and add it to the map. Whenever the marble widget updates, your layer's render method will be called and you can paint whatever you wish onto the map. It's up to you to keep track of what you actually render. For something similar to a placemark, take a look at the drawImage method here: http://api.kde.org/4.x-api/kdeedu-apidocs/marble/html/classMarble_1_1GeoPainter.html.

Perhaps the biggest limitation is that you can't click on objects you rendered in your custom layer on the map. This may or may not be an issue for you.
masoudnorozi
Registered Member
Posts
6
Karma
0
mouse click detection is mostly what i want from GeoDataPlaceMark object and rotation of it.
i can rotate QImage , but Cant detect Mouse Click on it.
i am manipulating the source code of GeoDataPlaceMark to Fix this Issue of setting style
thanks for your advice ....
masoudnorozi
Registered Member
Posts
6
Karma
0
i Tried this on Version 16.04 , But the Same as pre Versions

Any Body Can Help !?
:| :| :| :|
masoudnorozi
Registered Member
Posts
6
Karma
0
I Want to rotate a placemark in marblewidget ....
anybody help ?????


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell