Class: Mapbox::Overlay::Marker

Inherits:
Base
  • Object
show all
Defined in:
lib/mapbox/overlay/marker.rb

Overview

Marker class

Constant Summary collapse

MAKI =
%w(
  a-z 0-9 airfield airport alcohol-shop america-football art-gallery
  bakery bank bar baseball basketball beer bicycle building bus cafe
  camera campsite car cemetery chemist cinema circle-stroked circle
  city clothing-store college commercial cricket cross dam danger
  dentist disability dog-park embassy emergency-telephone entrance
  farm fast-food ferry fire-station fuel garden gift golf grocery
  hairdresser harbor heart heliport hospital ice-cream industrial
  land-use laundry library lighthouse lodging logging london-underground
  marker-stroked marker minefield mobilephone monument museum music
  oil-well park2 park parking-garage parking pharmacy pitch place-of-worship
  playground police polling-place post prison rail-above rail-light rail-metro
  rail-underground rail religious-christian religious-jewish religious-muslim
  restaurant roadblock rocket school scooter shop skiing slaughterhouse
  soccer square-stroked square star-stroked star suitcase swimming
  telephone tennis theatre toilets town-hall town triangle-stroked
  triangle village warehouse waste-basket water wetland zoo
)

Instance Method Summary collapse

Methods inherited from Base

add, #initialize

Constructor Details

This class inherits a constructor from Mapbox::Overlay::Base

Instance Method Details

#arguments_checkObject



24
25
26
27
# File 'lib/mapbox/overlay/marker.rb', line 24

def arguments_check
  return if @label.nil?
  fail ArgumentError, ":label not found: #{@label}" if MAKI.include?(@label) == false
end

#generate_overlayObject



29
30
31
32
33
34
35
36
# File 'lib/mapbox/overlay/marker.rb', line 29

def generate_overlay
  oly = []
  oly << "pin-#{@size}"
  oly << "-#{@label}" unless @label.nil?
  oly << "+#{@color}" unless @color.nil?
  oly << "(#{@lat},#{@lon})"
  oly.join
end