After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760352 - Make sure our markers gets exported to PNG/print
Make sure our markers gets exported to PNG/print
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on: 760351
Blocks:
 
 
Reported: 2016-01-09 09:57 UTC by Jonas Danielsson
Modified: 2016-01-12 19:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Implement ChamplainExportable interface for markers (6.60 KB, patch)
2016-01-09 09:57 UTC, Jonas Danielsson
none Details | Review
Exported PNG from route before patch (223.20 KB, image/png)
2016-01-09 09:59 UTC, Jonas Danielsson
  Details
Exported PNG from route after patch (223.59 KB, image/png)
2016-01-09 09:59 UTC, Jonas Danielsson
  Details
Implement ChamplainExportable interface for markers (7.37 KB, patch)
2016-01-11 08:44 UTC, Jonas Danielsson
committed Details | Review

Description Jonas Danielsson 2016-01-09 09:57:30 UTC
Champlain can now export to a cairo surface. It is not magic. It can only export tiles and layers that implement the ChamplainExportable interface.

I have patches pending to make the MarkerLayer implement the interface. When/if they land we can make sure our own markers are exportable. That means they need to be able to export their content to a cairo surface.
Comment 1 Jonas Danielsson 2016-01-09 09:57:57 UTC
Created attachment 318571 [details] [review]
Implement ChamplainExportable interface for markers

This cycle we added a way to export the ChamplainView
to a cairo surface. This is meant as way of creating PNG
images of our map. As well as a way to facilitate printing
of the map view.

The cairo_view_to_surface function will go through each
ChamplainLayer added to the view and check if it implements
ChamplainExportable, and add it to the final surface if
it does. The ChamplainMarkerLayer will only export surface
if the markers within implements ChamplainExportable.
Let's make it so.
Comment 2 Jonas Danielsson 2016-01-09 09:59:28 UTC
Created attachment 318572 [details]
Exported PNG from route before patch
Comment 3 Jonas Danielsson 2016-01-09 09:59:54 UTC
Created attachment 318573 [details]
Exported PNG from route after patch
Comment 4 Hashem Nasarat 2016-01-11 07:45:52 UTC
Review of attachment 318571 [details] [review]:

Small comments, but looks good otherwise. Still, this patch doesn't seem to work on my system. I have up-to-date libchamplain and gnome-maps, but the exported image only has the base map layer (no markers, no blue circle for gps, etc). Not sure why.

::: src/mapMarker.js
@@ +120,3 @@
+
+            return actor;
+        } catch(e) {

space before (

(says gjslint)

@@ +121,3 @@
+            return actor;
+        } catch(e) {
+            Utils.debug("Failed to load image: " + e.message);

Should be 'single quoted' because it's not translated.

::: src/placeMarker.js
@@ +33,3 @@
         this.parent(params);
 
+        this.add_actor(this._actorFromIconName('mark-location', 32));

Utils is no longer needed as an import.

::: src/userLocationMarker.js
@@ +73,2 @@
         if (this.place.location.heading > -1) {
+            let actor = this._actorFromIconName('user-location-compass', 0);

Likewise Utils not used anymore here

::: src/utils.js
@@ +162,2 @@
 }
 

Clutter and Cogl imports are no longer used
Comment 5 Jonas Danielsson 2016-01-11 07:50:14 UTC
Review of attachment 318571 [details] [review]:

Thanks for review Hashem!

::: src/mapMarker.js
@@ +120,3 @@
+
+            return actor;
+                                            null, null)[0];

I see, we do not seem to follow that in rest of Maps, or rather we are not consistent, we do sometimes. We might as well follow gjslin then I guess :)

[...]
src/application.js:            } catch(e) {
src/application.js:        } catch (e) {
src/exportViewDialog.js:        } catch(e) {
src/exportViewDialog.js:        } catch(e) {
src/geoclue.js:        catch (e) {
src/geocodeService.js:            } catch (e) {
src/geocodeService.js:            } catch (e) {
src/locationServiceNotification.js:            } catch(e) {
[...]

@@ +121,3 @@
+            return actor;
+        } catch(e) {
+                                            null, null)[0];

Right you are.
Comment 6 Jonas Danielsson 2016-01-11 08:44:48 UTC
Created attachment 318708 [details] [review]
Implement ChamplainExportable interface for markers

This cycle we added a way to export the ChamplainView
to a cairo surface. This is meant as way of creating PNG
images of our map. As well as a way to facilitate printing
of the map view.

The cairo_view_to_surface function will go through each
ChamplainLayer added to the view and check if it implements
ChamplainExportable, and add it to the final surface if
it does. The ChamplainMarkerLayer will only export surface
if the markers within implements ChamplainExportable.
Let's make it so.
Comment 7 Jonas Danielsson 2016-01-12 19:47:31 UTC
Attachment 318708 [details] pushed as 625b545 - Implement ChamplainExportable interface for markers