Class Ym4r::GmPlugin::Clusterer
In: lib/gm_plugin/overlay.rb
Parent: Object

Makes the link with the Clusterer2 library by Jef Poskanzer (slightly modified though). Is a GOverlay making clusters out of its GMarkers, so that GMarkers very close to each other appear as one when the zoom is low. When the zoom gets higher, the individual markers are drawn.

Methods

create   new  

Included Modules

MappingObject

Attributes

grid_size  [RW] 
icon  [RW] 
markers  [RW] 
max_lines_per_info_box  [RW] 
max_visible_markers  [RW] 
min_markers_per_cluster  [RW] 

Public Class methods

[Source]

     # File lib/gm_plugin/overlay.rb, line 229
229:       def initialize(markers = [], options = {})
230:         @markers = markers
231:         @icon = options[:icon] || GIcon::DEFAULT
232:         @max_visible_markers = options[:max_visible_markers] || 150
233:         @grid_size = options[:grid_size] || 5
234:         @min_markers_per_cluster = options[:min_markers_per_cluster] || 5
235:         @max_lines_per_info_box = options[:max_lines_per_info_box] || 10
236:       end

Public Instance methods

[Source]

     # File lib/gm_plugin/overlay.rb, line 238
238:       def create 
239:         js_marker = '[' + @markers.collect do |marker|
240:           add_description(marker)
241:         end.join(",") + ']'
242: 
243:         "new Clusterer(#{js_marker},#{MappingObject.javascriptify_variable(@icon)},#{MappingObject.javascriptify_variable(@max_visible_markers)},#{MappingObject.javascriptify_variable(@grid_size)},#{MappingObject.javascriptify_variable(@min_markers_per_cluster)},#{MappingObject.javascriptify_variable(@max_lines_per_info_box)})"
244:       end

[Validate]