]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/function/browser/WebMapFunction.java
1639c45457dec4410f83f57c2199cbc6dcaab32f
[GpsPrune.git] / tim / prune / function / browser / WebMapFunction.java
1 package tim.prune.function.browser;
2
3 import tim.prune.App;
4 import tim.prune.GenericFunction;
5
6 /**
7  * Function to show a webservice for the current area or point
8  */
9 public class WebMapFunction extends GenericFunction
10 {
11         /** Service to call */
12         private UrlGenerator.WebService _service;
13         /** Key for appearance in menu */
14         private String _nameKey = null;
15
16         /**
17          * Constructor
18          * @param inApp app object
19          * @param inService web service to call
20          * @param inNameKey name key for function
21          */
22         public WebMapFunction(App inApp, UrlGenerator.WebService inService,
23                 String inNameKey)
24         {
25                 super(inApp);
26                 _service = inService;
27                 _nameKey = inNameKey;
28         }
29
30         @Override
31         public String getNameKey() {
32                 return _nameKey;
33         }
34
35         @Override
36         /**
37          * Do the function call
38          */
39         public void begin()
40         {
41                 String url = UrlGenerator.generateUrl(_service, _app.getTrackInfo());
42                 if (url != null) {
43                         BrowserLauncher.launchBrowser(url);
44                 }
45         }
46 }