Class: AtlasOnRails::AtlasMap

Inherits:
Object
  • Object
show all
Defined in:
lib/atlas_on_rails/map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AtlasMap

Returns a new instance of AtlasMap.



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/atlas_on_rails/map.rb', line 155

def initialize(options={})                  
  case (options[:api].downcase unless options[:api].nil?)
    when 'google' then 
      self.extend(GoogleMap)
      @mapping_object, @mapping_api = [AtlasOnRails::GoogleMap, 'google']
    when 'yahoo' then
      self.extend(YahooMap)
      @mapping_object, @mapping_api = [AtlasOnRails::YahooMap, 'yahoo']
    else 
      self.extend(GoogleMap)
      @mapping_object, @mapping_api = [AtlasOnRails::GoogleMap, 'google']
    end      
  @latitude = options[:latitude].nil? ? 0 : options[:latitude]
  @longitude = options[:longitude].nil? ? 0 : options[:longitude]
  @zoom = options[:zoom].nil? ? 1 : options[:zoom]
  @name = options[:name].nil? ? 'map' : options[:name]
  @width = options[:width].nil? ? '500px' : options[:width]
  @height = options[:height].nil? ? '300px' : options[:height]
  @pan_control = options[:pan_control]
  @zoom_control = options[:zoom_control]
  @events = Array.new
  @icons = AtlasIconList.new
  @markers = AtlasMarkerList.new(@icons)
  @windows = AtlasWindowList.new(@icons)
  @polylines = Array.new
end

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



151
152
153
# File 'lib/atlas_on_rails/map.rb', line 151

def events
  @events
end

#heightObject (readonly)

Returns the value of attribute height.



146
147
148
# File 'lib/atlas_on_rails/map.rb', line 146

def height
  @height
end

#iconsObject

Returns the value of attribute icons.



150
151
152
# File 'lib/atlas_on_rails/map.rb', line 150

def icons
  @icons
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



142
143
144
# File 'lib/atlas_on_rails/map.rb', line 142

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



143
144
145
# File 'lib/atlas_on_rails/map.rb', line 143

def longitude
  @longitude
end

#markersObject

Returns the value of attribute markers.



149
150
151
# File 'lib/atlas_on_rails/map.rb', line 149

def markers
  @markers
end

#nameObject (readonly)

Returns the value of attribute name.



141
142
143
# File 'lib/atlas_on_rails/map.rb', line 141

def name
  @name
end

#pan_controlObject (readonly)

Returns the value of attribute pan_control.



147
148
149
# File 'lib/atlas_on_rails/map.rb', line 147

def pan_control
  @pan_control
end

#polylinesObject

Returns the value of attribute polylines.



153
154
155
# File 'lib/atlas_on_rails/map.rb', line 153

def polylines
  @polylines
end

#widthObject (readonly)

Returns the value of attribute width.



145
146
147
# File 'lib/atlas_on_rails/map.rb', line 145

def width
  @width
end

#windowsObject

Returns the value of attribute windows.



152
153
154
# File 'lib/atlas_on_rails/map.rb', line 152

def windows
  @windows
end

#zoomObject (readonly)

Returns the value of attribute zoom.



144
145
146
# File 'lib/atlas_on_rails/map.rb', line 144

def zoom
  @zoom
end

#zoom_controlObject (readonly)

Returns the value of attribute zoom_control.



148
149
150
# File 'lib/atlas_on_rails/map.rb', line 148

def zoom_control
  @zoom_control
end

Instance Method Details

#key(options = {}) ⇒ Object



182
183
184
185
# File 'lib/atlas_on_rails/map.rb', line 182

def key(options={})
  options[:api] = @mapping_api
  AtlasOnRails::AtlasKey.get(options)
end