KickJava   Java API By Example, From Geeks To Geeks.

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


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  * GoogleMapMapTypeTag
8  *
9  * This class represents a <googlemaps:maptype> tag. Developers should not
10  * extend this class or override it's methods.
11  *
12  * @author Tom Cole
13  * @version 0.85
14  */

15 public class GoogleMapMapTypeTag extends TagSupport JavaDoc {
16
17     String JavaDoc baseType = "map";
18     String JavaDoc url = null;
19     String JavaDoc lowResUrl = null;
20     String JavaDoc overlayUrl = null;
21     String JavaDoc name = null;
22     String JavaDoc id = null;
23     String JavaDoc copyright = null;
24     boolean showOnStartup = true;
25     int maxZoom = -1;
26     int minZoom = -1;
27     String JavaDoc upperLeftBound = null;
28     String JavaDoc lowerRightBound = null;
29     boolean png = false;
30     float opacity = 1.0f;
31     /**
32      * Overrides doStartTag() from TagSupport. Developers should not override this method.
33      */

34     public int doStartTag() {
35         Tag JavaDoc tag = this;
36         while (tag.getParent() != null) {
37             if (tag.getParent() instanceof GoogleMapTag) {
38                 ((GoogleMapTag) tag.getParent()).addMapType(this);
39                 return SKIP_BODY;
40             }
41             tag = tag.getParent();
42         }
43         return SKIP_BODY;
44     }
45     /**
46      * Returns the id of the point that represents the lower right hand bounds
47      * of the viewable area of this map.
48      *
49      * @return A string that represents a point id.
50      */

51     public String JavaDoc getLowerRightBound() {
52         return lowerRightBound;
53     }
54     /**
55      * Sets the id of the point that represents the low right hand bounds
56      * of the viewable area of this map.
57      *
58      * @param point The id of a point in this map.
59      */

60     public void setLowerRightBound(String JavaDoc point) {
61         this.lowerRightBound = point;
62     }
63     /**
64      * Returns the id of the point that represents the upper left hand bounds
65      * of the viewable area of this map.
66      *
67      * @return A string that represents a point id.
68      */

69     public String JavaDoc getUpperLeftBound() {
70         return upperLeftBound;
71     }
72     /**
73      * Sets the id of the point that represents the upper left hand bounds
74      * of the viewable area of this map.
75      *
76      * @param point The id of a point in this map.
77      */

78     public void setUpperLeftBound(String JavaDoc upperLeftBound) {
79         this.upperLeftBound = upperLeftBound;
80     }
81     /**
82      * Returns the base map type from which this map type derives.
83      *
84      * @return The base map type.
85      */

86     public String JavaDoc getBaseType() {
87         return baseType;
88     }
89     /**
90      * Sets the base map type from which this map type is derived.
91      * Valid values are map, satellite and hybrid.
92      *
93      * @param baseType The base map type for this map type.
94      */

95     public void setBaseType(String JavaDoc baseType) {
96         this.baseType = baseType;
97     }
98     /**
99      * Returns the id for this custom map type.
100      *
101      * @return The id for this map type.
102      */

103     public String JavaDoc getId() {
104         return id;
105     }
106     /**
107      * Sets the id for this map type. This should be unique within the map.
108      *
109      * @param id A unique id for this map type.
110      */

111     public void setId(String JavaDoc id) {
112         this.id = id;
113     }
114     /**
115      * Returns the user viewable name for this map type. This text is placed
116      * on the control button for this map type.
117      *
118      * @return The name for this map type.
119      */

120     public String JavaDoc getName() {
121         return name;
122     }
123     /**
124      * Sets the user viewable name for this map type.
125      *
126      * @param name A name for this map type.
127      */

128     public void setName(String JavaDoc name) {
129         this.name = name;
130     }
131     /**
132      * Returns the url for the server side process that supplies the tiles
133      * for this map type.
134      *
135      * @return A url to the tile generator.
136      */

137     public String JavaDoc getUrl() {
138         return url;
139     }
140     /**
141      * Sets the url for the server side process that supplied the tiles
142      * for this map type.
143      *
144      * @param url A url to a resource that provides map tiles for this map type.
145      */

146     public void setUrl(String JavaDoc url) {
147         this.url = url;
148     }
149     /**
150      * Denotes whether or not this map type should be initially displayed when the
151      * Google Map is rendered.
152      *
153      * @return True or false.
154      */

155     public boolean isShowOnStartup() {
156         return showOnStartup;
157     }
158     /**
159      * Sets whether or not this map type should be initially selected when the map
160      * is rendered.
161      *
162      * @param showOnStartup True if this map type should be initially selected, false if not.
163      */

164     public void setShowOnStartup(boolean showOnStartup) {
165         this.showOnStartup = showOnStartup;
166     }
167     /**
168      * Returns the url of the server side process that returns overlay tiles. This only
169      * applied if this custom map is based on a hybrid map type.
170      *
171      * @return A valid url to a tile generator.
172      */

173     public String JavaDoc getOverlayUrl() {
174         return overlayUrl;
175     }
176     /**
177      * Sets the url of the server side process that provides over tiles for this
178      * custom map type. This will only apply if the base map type is set to hybrid.
179      *
180      * @param overlayUrl Url to the process that provides overlay tiles for this map type.
181      */

182     public void setOverlayUrl(String JavaDoc overlayUrl) {
183         this.overlayUrl = overlayUrl;
184     }
185     /**
186      * Returns the url of the server side process that returns tile images for zoom levels less than
187      * 50%.
188      *
189      * @return Url to a tile generator.
190      */

191     public String JavaDoc getLowResUrl() {
192         return lowResUrl;
193     }
194     /**
195      * Set the url of the server side process that generates tiles for this map type
196      * when the zoom leve is less than half way.
197      *
198      * @param lowResUrl Url to a tile generator.
199      */

200     public void setLowResUrl(String JavaDoc lowResUrl) {
201         this.lowResUrl = lowResUrl;
202     }
203     /**
204      * Returns copyright information for this map type.
205      *
206      * @return Copyright string.
207      */

208     public String JavaDoc getCopyright() {
209         return copyright;
210     }
211     /**
212      * Sets the copyright information for this map type.
213      *
214      * @param copyright The copyright string to display when this map type is selected.
215      */

216     public void setCopyright(String JavaDoc copyright) {
217         this.copyright = copyright;
218     }
219     /**
220      * Returns the maximum zoom level supported by this map type.
221      *
222      * @return A valid zoom level as an int.
223      */

224     public int getMaxZoom() {
225         return maxZoom;
226     }
227     /**
228      * Sets the maximum zoom level this map type supports. When the zoom level goes past this level,
229      * the default map tiles will be presented.
230      *
231      * NOTE: <b>Remember that if you map is version 1, zoom levels range from 0 (all the way in) to 17 (all the way out).
232      * In version 2 maps, they are reversed...</b>
233      *
234      * @param maxZoom The maximum zoom level for this map type.
235      */

236     public void setMaxZoom(int maxZoom) {
237         this.maxZoom = maxZoom;
238     }
239     /**
240      * Returns the minimum zoom level supported by this map type.
241      *
242      * @return A valid zoom level as an int.
243      */

244     public int getMinZoom() {
245         return minZoom;
246     }
247     /**
248      * Sets the minimum zoom level this map type supports. When the zoom level goes past this level,
249      * the default map tiles will be presented.
250      *
251      * NOTE: <b>Remember that if you map is version 1, zoom levels range from 0 (all the way in) to 17 (all the way out).
252      * In version 2 maps, they are reversed...</b>
253      *
254      * @param minZoom The minimum zoom level for this map type.
255      */

256     public void setMinZoom(int minZoom) {
257         this.minZoom = minZoom;
258     }
259     /**
260      * Denotes whether or not the tiles supplied by this tile server are .png files.
261      *
262      * @return True if tiles are .png format, false otherwise
263      */

264     public boolean isPng() {
265         return png;
266     }
267     /**
268      * Sets whether or not the tiles for this map type are .png format.
269      *
270      * @param png True if tiles for this map type are .png format, false otherwise.
271      */

272     public void setPng(boolean png) {
273         this.png = png;
274     }
275 }
276
Popular Tags