Class: MapboxMarker

Inherits:
AbstractMarker show all
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

Attributes inherited from AbstractMarker

#latitude, #longitude

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractMarker

#lat, #lat=, #lon, #lon=

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

#colorObject

Returns the value of attribute color.



2
3
4
# File 'lib/mapbox/mapbox_marker.rb', line 2

def color
  @color
end

#labelObject

Returns the value of attribute label.



2
3
4
# File 'lib/mapbox/mapbox_marker.rb', line 2

def label
  @label
end

#nameObject

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_iconsObject



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

.sizeObject



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_stringObject



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_stringObject



56
57
58
# File 'lib/mapbox/mapbox_marker.rb', line 56

def label_string
  "-#{self.label}" unless self.label.nil? || self.label.strip == ""
end

#sizeObject



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_sObject



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