Class: MapboxMarker
- Inherits:
-
AbstractMarker
- Object
- AbstractMarker
- MapboxMarker
- Defined in:
- lib/mapbox/mapbox_marker.rb
Constant Summary collapse
- SMALL_PIN =
"pin-s"
- MEDIUM_PIN =
"pin-m"
- LARGE_PIN =
"pin-l"
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#label ⇒ Object
Returns the value of attribute label.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from AbstractMarker
Class Method Summary collapse
Instance Method Summary collapse
- #color_string ⇒ Object
-
#initialize(latitude, longitude, size = SMALL_PIN, label = nil, color = nil) ⇒ MapboxMarker
constructor
A new instance of MapboxMarker.
- #label_string ⇒ Object
- #size ⇒ Object
- #size=(size) ⇒ Object
- #to_s ⇒ Object
Methods inherited from AbstractMarker
Constructor Details
#initialize(latitude, longitude, size = SMALL_PIN, label = nil, color = nil) ⇒ MapboxMarker
Returns a new instance of MapboxMarker.
32 33 34 35 36 37 38 |
# File 'lib/mapbox/mapbox_marker.rb', line 32 def initialize(latitude, longitude, size=SMALL_PIN, label=nil, color=nil) self.name = size self.latitude = latitude self.longitude = longitude self.label = label self.color = color end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
2 3 4 |
# File 'lib/mapbox/mapbox_marker.rb', line 2 def color @color end |
#label ⇒ Object
Returns the value of attribute label.
2 3 4 |
# File 'lib/mapbox/mapbox_marker.rb', line 2 def label @label end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/mapbox/mapbox_marker.rb', line 2 def name @name end |
Class Method Details
.maki_icons ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mapbox/mapbox_marker.rb', line 16 def self.maki_icons [ "circle-stroked", "circle", "square-stroked", "square", "triangle-stroked", "triangle", "star-stroked", "star", "cross", "marker-stroked", "marker", "religious-jewish", "religious-christian", "religious-muslim", "cemetery", "place-of-worship", "airport", "heliport", "rail", "rail-underground", "rail-above", "bus", "fuel", "parking", "parking-garage", "airfield", "roadblock", "ferry", "harbor", "bicycle", "park", "park2", "museum", "lodging", "monument", "zoo", "garden", "campsite", "theatre", "art-gallery", "pitch", "soccer", "america-football", "tennis", "basketball", "baseball", "golf", "swimming", "cricket", "skiing", "school", "college", "library", "post", "fire-station", "town-hall", "police", "prison", "embassy", "waste-basket", "toilets", "telephone", "emergency-telephone", "disability", "beer", "restaurant", "cafe", "shop", "fast-food", "bar", "bank", "grocery", "cinema", "alcohol-shop", "music", "hospital", "pharmacy", "danger", "industrial", "warehouse", "commercial", "building", "oil-well", "dam", "slaughterhouse", "logging", "water", "wetland" ] end |
.size ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/mapbox/mapbox_marker.rb', line 8 def self.size { :small => SMALL_PIN, :medium => MEDIUM_PIN, :large => LARGE_PIN } end |
Instance Method Details
#color_string ⇒ Object
60 61 62 |
# File 'lib/mapbox/mapbox_marker.rb', line 60 def color_string "+#{self.color}" unless self.color.nil? || self.color.strip == "" end |
#label_string ⇒ Object
56 57 58 |
# File 'lib/mapbox/mapbox_marker.rb', line 56 def label_string "-#{self.label}" unless self.label.nil? || self.label.strip == "" end |
#size ⇒ Object
40 41 42 |
# File 'lib/mapbox/mapbox_marker.rb', line 40 def size self.name end |
#size=(size) ⇒ Object
44 45 46 |
# File 'lib/mapbox/mapbox_marker.rb', line 44 def size=(size) self.name = size end |
#to_s ⇒ Object
64 65 66 |
# File 'lib/mapbox/mapbox_marker.rb', line 64 def to_s "#{self.name}#{self.label_string}#{self.color_string}(#{self.lon},#{self.lat})" end |