1 package com.lamatek.tags.google; 2 3 import java.io.Serializable ; 4 import java.util.Vector ; 5 6 import javax.servlet.jsp.tagext.Tag ; 7 import javax.servlet.jsp.tagext.TagSupport ; 8 9 18 public class GoogleMapPolylineTag extends TagSupport implements Serializable , GoogleMapEventListener { 19 20 private String id = null; 21 private String pointlist = null; 22 private String color = "#ff0000"; 23 private int weight = 2; 24 private float opacity = 0.50f; 25 Vector points = null; 26 Vector events = null; 27 32 public int doStartTag() { 33 Tag tag = this; 34 while (tag.getParent() != null) { 35 if (tag.getParent() instanceof GoogleMapTag) { 36 ((GoogleMapTag) tag.getParent()).addPolyline(this); 37 return SKIP_BODY; 38 } 39 tag = tag.getParent(); 40 } 41 return SKIP_BODY; 42 } 43 48 public void setColor(String color) { 49 this.color = color; 50 } 51 56 public void setOpacity(float opacity) { 57 this.opacity = opacity; 58 } 59 64 public void setWeight(int weight) { 65 this.weight = weight; 66 } 67 72 public int pointCount() { 73 if (points == null) 74 return 0; 75 else 76 return points.size(); 77 } 78 85 public String getPoint(int p) { 86 if (points == null) 87 return null; 88 else 89 return (String ) points.elementAt(p); 90 } 91 96 public String getId() { 97 return id; 98 } 99 104 public void setId(String id) { 105 this.id = id; 106 } 107 112 public String getPointlist() { 113 return pointlist; 114 } 115 123 public void setPointlist(String pointlist) { 124 this.pointlist = pointlist; 125 points = new Vector (); 126 String [] p = pointlist.split(","); 127 for (int i = 0; i < p.length; i++) { 128 points.add(p[i].trim()); 129 } 130 } 131 136 public String getColor() { 137 return color; 138 } 139 144 public float getOpacity() { 145 return opacity; 146 } 147 152 public int getWeight() { 153 return weight; 154 } 155 160 public void addEvent(GoogleMapEventTag event) { 161 if (events == null) 162 events = new Vector (); 163 events.add(event); 164 } 165 171 public Vector getEvents() { 172 return events; 173 } 174 } 175 | Popular Tags |