Class: Ym4r::GmPlugin::GMarkerManager

Inherits:
Object
  • Object
show all
Includes:
MappingObject
Defined in:
lib/gm_plugin/overlay.rb

Overview

Can be used to implement a clusterer, similar to the clusterer below, except that there is more stuff to manage explicitly byt the programmer (but this is also more flexible). See the README for usage esamples.

Instance Attribute Summary (collapse)

Attributes included from MappingObject

#variable

Instance Method Summary (collapse)

Methods included from MappingObject

#[], #assign_to, #declare, #declare_random, #declared?, escape_javascript, #get_property, javascriptify_method, javascriptify_variable, #method_missing, #set_property, #to_javascript

Constructor Details

- (GMarkerManager) initialize(map, options = {})

options can be :border_padding, :max_zoom, :track_markers and :managed_markers: managed_markers must be an array of ManagedMarker objects



302
303
304
305
306
# File 'lib/gm_plugin/overlay.rb', line 302

def initialize(map, options = {})
  @map = map
  @managed_markers = Array(options.delete(:managed_markers)) #[] if nil
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ym4r::GmPlugin::MappingObject

Instance Attribute Details

- (Object) managed_markers

Returns the value of attribute managed_markers



299
300
301
# File 'lib/gm_plugin/overlay.rb', line 299

def managed_markers
  @managed_markers
end

- (Object) map

Returns the value of attribute map



299
300
301
# File 'lib/gm_plugin/overlay.rb', line 299

def map
  @map
end

- (Object) options

Returns the value of attribute options



299
300
301
# File 'lib/gm_plugin/overlay.rb', line 299

def options
  @options
end

Instance Method Details

- (Object) create



308
309
310
311
# File 'lib/gm_plugin/overlay.rb', line 308

def create
  puts @options.inspect
  "addMarkersToManager(new GMarkerManager(#{MappingObject.javascriptify_variable(@map)},#{MappingObject.javascriptify_variable(@options)}),#{MappingObject.javascriptify_variable(@managed_markers)})"
end