diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-05-21 15:23:05 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-21 22:18:36 +0900 |
commit | 19e22e1bb76d942ae17a5515c5d635a7d63f70e9 (patch) | |
tree | 05fbf1b5ff96f4e14bf8c46109691b04e19a314e /worldmap-save.c | |
parent | 7dc642860def420f85ae25548ddfa674e14636d1 (diff) | |
download | subsurface-19e22e1bb76d942ae17a5515c5d635a7d63f70e9.tar.gz |
Add ability to export only selected dives in worldmap exporter
This patch adds the ability to export selected dives only in the worldmap
exporter. After Miika added the export dialog in commit 7dc642860def
("Implementing export dialog") and exporting only selected dives became a
choice while exporting.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'worldmap-save.c')
-rw-r--r-- | worldmap-save.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/worldmap-save.c b/worldmap-save.c index e867846f5..21a0810b1 100644 --- a/worldmap-save.c +++ b/worldmap-save.c @@ -83,14 +83,16 @@ void put_HTML_notes(struct membuffer *b, struct dive *dive) } } -void writeMarkers(struct membuffer *b) +void writeMarkers(struct membuffer *b, const bool selected_only) { int i, dive_no = 0; struct dive *dive; for_each_dive(i, dive) { - /*export selected dives only ?*/ - + if (selected_only) { + if (!dive->selected) + continue; + } if (dive->latitude.udeg == 0 && dive->longitude.udeg == 0) continue; @@ -120,7 +122,7 @@ void insert_css(struct membuffer *b) put_format(b, "<style type=\"text/css\">%s</style>\n", css); } -void insert_javascript(struct membuffer *b) +void insert_javascript(struct membuffer *b, const bool selected_only) { put_string(b, "<script type=\"text/javascript\" src=\""); put_string(b, getGoogleApi()); @@ -129,25 +131,25 @@ void insert_javascript(struct membuffer *b) put_string(b, "rotateControl: false,\n\tstreetViewControl: false,\n\tmapTypeControl: false\n};\n"); put_string(b, "map = new google.maps.Map(document.getElementById(\"map-canvas\"),mapOptions);\nvar markers = new Array();"); put_string(b, "\nvar infowindows = new Array();\nvar temp;\nvar tempinfowindow;\n"); - writeMarkers(b); + writeMarkers(b, selected_only); put_string(b, "\nfor(var i=0;i<markers.length;i++)\n\tmarkers[i].setMap(map);\n}\n"); put_string(b, "google.maps.event.addDomListener(window, 'load', initialize);</script>\n"); } -void export(struct membuffer *b) +void export(struct membuffer *b, const bool selected_only) { insert_html_header(b); insert_css(b); - insert_javascript(b); + insert_javascript(b, selected_only); put_string(b, "\t</head>\n<body>\n<div id=\"map-canvas\"></div>\n</body>\n</html>"); } -void export_worldmap_HTML(const char *file_name) +void export_worldmap_HTML(const char *file_name, const bool selected_only) { FILE *f; struct membuffer buf = { 0 }; - export(&buf); + export(&buf, selected_only); f = fopen(file_name, "w+"); if (!f) |