KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lamatek > tags > google > GoogleMapWMSTag


1 package com.lamatek.tags.google;
2
3 import javax.servlet.jsp.tagext.Tag JavaDoc;
4 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
5
6 /**
7  * GoogleMapWMSTag
8  *
9  * Represents a <googlemaps:wms> tag. Developers should not extend this class
10  * or override it's methods.
11  *
12  * @author Tom Cole
13  * @version 0.92
14  */

15 public class GoogleMapWMSTag extends TagSupport JavaDoc {
16     
17     String JavaDoc id = null;
18     String JavaDoc name = null;
19     String JavaDoc url = null;
20     String JavaDoc layers = null;
21     String JavaDoc srs = "EPSG:4326";
22     String JavaDoc version = "1.1.1";
23     String JavaDoc format = "image/jpeg";
24     boolean showOnStartup = true;
25     String JavaDoc pathToScript = null;
26     boolean showOverlay = false;
27     String JavaDoc copyright = "(c) Unknown";
28     /**
29      * Overrides doStartTag() from TagSupport. Developers should not override this method.
30      */

31     public int doStartTag() {
32         Tag JavaDoc tag = this;
33         while (tag.getParent() != null) {
34             if (tag.getParent() instanceof GoogleMapTag) {
35                 ((GoogleMapTag) tag.getParent()).addWMSTag(this);
36                 return SKIP_BODY;
37             }
38             tag = tag.getParent();
39         }
40         return SKIP_BODY;
41     }
42     /**
43      * Returns the desired image file format to retrieve from this WMS server.
44      *
45      * @return The content-type for the desired image format.
46      */

47     public String JavaDoc getFormat() {
48         return format;
49     }
50     /**
51      * Sets the desired image type for images retrieved from this server. This value
52      * must be a valid content-type.
53      *
54      * @param format The desired content-type for images retrieved from this server.
55      */

56     public void setFormat(String JavaDoc format) {
57         this.format = format;
58     }
59     /**
60      * Returns the unique id for this WMS layer.
61      *
62      * @return A unique id for this layer.
63      */

64     public String JavaDoc getId() {
65         return id;
66     }
67     /**
68      * Sets the unique id for this layer. Must be unique per map.
69      *
70      * @param id A unique id for this layer.
71      */

72     public void setId(String JavaDoc id) {
73         this.id = id;
74     }
75     /**
76      * Returns the desired WMS layers to include in this map layer. These must be valid layer names
77      * for the server referenced by the url. The layer names must be comma separated (without spaces).
78      *
79      * @return A comma separated list of layer names.
80      */

81     public String JavaDoc getLayers() {
82         return layers;
83     }
84     /**
85      * Sets the comma separated list of layers to include in this map.
86      *
87      * @param layers A comma separated list of vlaid layer names.
88      */

89     public void setLayers(String JavaDoc layers) {
90         this.layers = layers;
91     }
92     /**
93      * Returns the descriptive name for this layer.
94      *
95      * @return A short name for this layer.
96      */

97     public String JavaDoc getName() {
98         return name;
99     }
100     /**
101      * Sets the descriptive name for this layer. This value is used as the
102      * button label for this map type.
103      */

104     public void setName(String JavaDoc name) {
105         this.name = name;
106     }
107     /**
108      * Denotes whether or not this map type should be initially selected on startup.
109      *
110      * @return True if this maptype is to be initially selected. False if not.
111      */

112     public boolean isShowOnStartup() {
113         return showOnStartup;
114     }
115     /**
116      * Sets whether or not this map type should be initially selected on startup.
117      *
118      * @param showOnStartup True or false.
119      */

120     public void setShowOnStartup(boolean showOnStartup) {
121         this.showOnStartup = showOnStartup;
122     }
123     /**
124      * Returns the WMS SRS set for this layer.
125      *
126      * @return The desired srs.
127      */

128     public String JavaDoc getSrs() {
129         return srs;
130     }
131     /**
132      * Sets the WMS SRS for this map.
133      *
134      * @param srs The desired SRS.
135      */

136     public void setSrs(String JavaDoc srs) {
137         this.srs = srs;
138     }
139     /**
140      * Returns the base URL to the WMS map server used to supply the tiles.
141      * This url will include an ending ?.
142      *
143      * @return A valid url to a WMS map server.
144      */

145     public String JavaDoc getUrl() {
146         return url;
147     }
148     /**
149      * Sets the base URL to the WMS server.
150      *
151      * @param url A valid url to a WMS map server.
152      */

153     public void setUrl(String JavaDoc url) {
154         if (url.indexOf("?") < 0)
155             this.url = url + "?";
156         else
157             this.url = url;
158     }
159     /**
160      * Returns the desired version. Default is 1.1.1
161      *
162      * @return A valid WMS version number.
163      */

164     public String JavaDoc getVersion() {
165         return version;
166     }
167     /**
168      * Sets the desired version. Default is 1.1.1.
169      *
170      * @param A valid WMS version number.
171      */

172     public void setVersion(String JavaDoc version) {
173         this.version = version;
174     }
175     /**
176      * Returns the path (either relative or absolute) to the
177      * wms1.js or wms2.js script required.
178      *
179      * @return A relative or absolute path.
180      */

181     public String JavaDoc getPathToScript() {
182         return pathToScript;
183     }
184     /**
185      * Sets the path (either relative or absolute) to the
186      * wms1.js or wms2.js script required.
187      *
188      * @param pathToScript A valid relative or absolute path.
189      */

190     public void setPathToScript(String JavaDoc pathToScript) {
191         this.pathToScript = pathToScript;
192     }
193     /**
194      * Denotes whether or not this map should show the hybrid overlay.
195      *
196      * @return True or false.
197      */

198     public boolean isShowOverlay() {
199         return showOverlay;
200     }
201     /**
202      * Sets whether or not this map should also include the Google Map Hybrid overlay.
203      * This feature is not available in version 2 maps.
204      *
205      * @param showOverlay True to display the Hybrid Overlay, false if not.
206      */

207     public void setShowOverlay(boolean showOverlay) {
208         this.showOverlay = showOverlay;
209     }
210     /**
211      * Returns the copyright string that is displayed anytime this WMS mashup
212      * is presented on the map.
213      *
214      * @return Copyright string
215      */

216     public String JavaDoc getCopyright() {
217         return copyright;
218     }
219     /**
220      * Sets the copyright string that is displayed anytime this WMS mashup
221      * is presented on the map.
222      *
223      * @param copyright A copyright string
224      */

225     public void setCopyright(String JavaDoc copyright) {
226         this.copyright = copyright;
227     }
228 }
229
Popular Tags