source: extensions/rv_gmaps/trunk/template/styler.js @ 12719

Last change on this file since 12719 was 12719, checked in by rvelices, 12 years ago

rv_gmaps can show now different markers based on number of photos at the location

File size: 863 bytes
Line 
1
2function PwgSingleStyler( style, roc )
3{
4        style = style || {};
5        this.roc = roc || new google.maps.Size(16,32);
6       
7        this.getStyle = function() { return style; }
8        this.changeStyle = function() { return null; }
9}
10
11
12
13function PwgStyler( styles, roc )
14{
15        this.styles = styles;
16        this.roc = roc || new google.maps.Size(16,32);
17        for (var i=0; i<this.styles.length; i++)
18                this.styles[i].zIndex = 1000 - i;
19}
20
21PwgStyler.prototype =  {
22
23getStyle: function(cluster)
24{
25        return this.styles[this._indexer(cluster, this.styles)];
26},
27
28changeStyle: function(cluster, oldcluster)
29{
30        var idx = this._indexer(cluster, this.styles), idx2=this._indexer(oldcluster, this.styles);
31        return idx==idx2 ? null :  this.styles[idx];
32},
33
34_indexer: function(cluster, styles)
35{
36        var n=cluster.nb_items, i=0;
37        while (n>1 )
38        {
39                n=n/10;
40                i++;
41        }
42        return i< styles.length ? i: styles.length-1;
43}
44
45}
Note: See TracBrowser for help on using the repository browser.