gmaps4rails 1.4.8 → 1.5.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +11 -0
- data/.travis.yml +10 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +175 -0
- data/Guardfile +38 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +26 -37
- data/Rakefile +4 -0
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.base.js.coffee +40 -34
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.googlemaps.js.coffee +4 -2
- data/app/views/gmaps4rails/_gmaps4rails.html.erb +13 -12
- data/gmaps4rails.gemspec +38 -0
- data/lib/gmaps4rails.rb +0 -8
- data/lib/gmaps4rails/acts_as_gmappable.rb +55 -33
- data/lib/gmaps4rails/base.rb +7 -12
- data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +16 -42
- data/lib/gmaps4rails/js_builder.rb +121 -0
- data/lib/gmaps4rails/json_builder.rb +127 -0
- data/lib/gmaps4rails/version.rb +3 -0
- data/lib/gmaps4rails/view_helper.rb +171 -0
- data/lib/tasks/gmaps4rails_tasks.rake +4 -0
- data/lib/tasks/jasmine.rake +8 -0
- data/public/javascripts/gmaps4rails/gmaps4rails.base.js +81 -30
- data/public/javascripts/gmaps4rails/gmaps4rails.bing.js +34 -11
- data/public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js +45 -21
- data/public/javascripts/gmaps4rails/gmaps4rails.mapquest.js +33 -14
- data/public/javascripts/gmaps4rails/gmaps4rails.openlayers.js +33 -20
- data/spec/base/base_spec.rb +185 -0
- data/spec/base/geocoding_spec.rb +17 -0
- data/spec/dummy/.gitignore +2 -0
- data/spec/dummy/.rspec +1 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/gmaps4rails.css +24 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/users_controller.rb +96 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/user.rb +9 -0
- data/spec/dummy/app/views/layouts/application.html.erb +16 -0
- data/spec/dummy/app/views/users/_form.html.erb +37 -0
- data/spec/dummy/app/views/users/_my_template.html.erb +2 -0
- data/spec/dummy/app/views/users/_my_template2.html.erb +1 -0
- data/spec/dummy/app/views/users/ajax_data.js.erb +2 -0
- data/spec/dummy/app/views/users/ajax_test.html.erb +22 -0
- data/spec/dummy/app/views/users/edit.html.erb +6 -0
- data/spec/dummy/app/views/users/index.html.erb +238 -0
- data/spec/dummy/app/views/users/new.html.erb +5 -0
- data/spec/dummy/app/views/users/show.html.erb +30 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +60 -0
- data/spec/dummy/db/migrate/20120408170155_create_users.rb +16 -0
- data/spec/dummy/db/schema.rb +29 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/Player.js +22 -0
- data/spec/dummy/public/javascripts/Song.js +7 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/user_factory.rb +23 -0
- data/spec/javascripts/basic_methods_spec.js +103 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/helpers/SpecHelper.js +87 -0
- data/spec/javascripts/map_spec.js +49 -0
- data/spec/javascripts/markers_methods_spec.js +368 -0
- data/spec/javascripts/mocks_spec.js +27 -0
- data/spec/javascripts/support/jasmine.yml +76 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +20 -0
- data/spec/launchers/all_but_requests.rb +0 -0
- data/spec/launchers/all_specs.rb +0 -0
- data/spec/launchers/requests.rb +0 -0
- data/spec/models/user_spec.rb +447 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/geocoding.rb +14 -0
- data/spec/support/matchers.rb +43 -0
- metadata +364 -31
- data/LICENSE.txt +0 -21
- data/app/assets/javascripts/gmaps4rails/all_apis.js +0 -5
- data/app/assets/javascripts/gmaps4rails/bing.js +0 -2
- data/app/assets/javascripts/gmaps4rails/googlemaps.js +0 -2
- data/app/assets/javascripts/gmaps4rails/mapquest.js +0 -2
- data/app/assets/javascripts/gmaps4rails/openlayers.js +0 -2
- data/app/views/gmaps4rails/_html.html.erb +0 -12
- data/app/views/gmaps4rails/_scripts.html.erb +0 -37
- data/lib/gmaps4rails/js_handler.rb +0 -112
- data/lib/gmaps4rails/json_handler.rb +0 -116
- data/public/images/marker.png +0 -0
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var __hasProp = Object.prototype.hasOwnProperty,
|
|
3
|
-
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
this.Gmaps4RailsBing = (function() {
|
|
11
|
-
__extends(Gmaps4RailsBing, Gmaps4Rails);
|
|
2
|
+
var __hasProp = Object.prototype.hasOwnProperty,
|
|
3
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
|
4
|
+
|
|
5
|
+
this.Gmaps4RailsBing = (function(_super) {
|
|
6
|
+
|
|
7
|
+
__extends(Gmaps4RailsBing, _super);
|
|
8
|
+
|
|
12
9
|
function Gmaps4RailsBing() {
|
|
13
10
|
Gmaps4RailsBing.__super__.constructor.apply(this, arguments);
|
|
14
11
|
this.map_options = {
|
|
@@ -20,6 +17,7 @@
|
|
|
20
17
|
this.mergeWithDefault("map_options");
|
|
21
18
|
this.mergeWithDefault("markers_conf");
|
|
22
19
|
}
|
|
20
|
+
|
|
23
21
|
Gmaps4RailsBing.prototype.getMapType = function() {
|
|
24
22
|
switch (this.map_options.type) {
|
|
25
23
|
case "road":
|
|
@@ -40,13 +38,17 @@
|
|
|
40
38
|
return Microsoft.Maps.MapTypeId.auto;
|
|
41
39
|
}
|
|
42
40
|
};
|
|
41
|
+
|
|
43
42
|
Gmaps4RailsBing.prototype.createPoint = function(lat, lng) {
|
|
44
43
|
return new Microsoft.Maps.Point(lat, lng);
|
|
45
44
|
};
|
|
45
|
+
|
|
46
46
|
Gmaps4RailsBing.prototype.createLatLng = function(lat, lng) {
|
|
47
47
|
return new Microsoft.Maps.Location(lat, lng);
|
|
48
48
|
};
|
|
49
|
+
|
|
49
50
|
Gmaps4RailsBing.prototype.createLatLngBounds = function() {};
|
|
51
|
+
|
|
50
52
|
Gmaps4RailsBing.prototype.createMap = function() {
|
|
51
53
|
return new Microsoft.Maps.Map(document.getElementById(this.map_options.id), {
|
|
52
54
|
credentials: this.map_options.provider_key,
|
|
@@ -55,9 +57,11 @@
|
|
|
55
57
|
zoom: this.map_options.zoom
|
|
56
58
|
});
|
|
57
59
|
};
|
|
60
|
+
|
|
58
61
|
Gmaps4RailsBing.prototype.createSize = function(width, height) {
|
|
59
62
|
return new google.maps.Size(width, height);
|
|
60
63
|
};
|
|
64
|
+
|
|
61
65
|
Gmaps4RailsBing.prototype.createMarker = function(args) {
|
|
62
66
|
var marker, markerLatLng;
|
|
63
67
|
markerLatLng = this.createLatLng(args.Lat, args.Lng);
|
|
@@ -81,6 +85,7 @@
|
|
|
81
85
|
this.addToMap(marker);
|
|
82
86
|
return marker;
|
|
83
87
|
};
|
|
88
|
+
|
|
84
89
|
Gmaps4RailsBing.prototype.clearMarkers = function() {
|
|
85
90
|
var marker, _i, _len, _ref, _results;
|
|
86
91
|
_ref = this.markers;
|
|
@@ -91,9 +96,11 @@
|
|
|
91
96
|
}
|
|
92
97
|
return _results;
|
|
93
98
|
};
|
|
99
|
+
|
|
94
100
|
Gmaps4RailsBing.prototype.clearMarker = function(marker) {
|
|
95
101
|
return this.removeFromMap(marker.serviceObject);
|
|
96
102
|
};
|
|
103
|
+
|
|
97
104
|
Gmaps4RailsBing.prototype.showMarkers = function() {
|
|
98
105
|
var marker, _i, _len, _ref, _results;
|
|
99
106
|
_ref = this.markers;
|
|
@@ -104,11 +111,13 @@
|
|
|
104
111
|
}
|
|
105
112
|
return _results;
|
|
106
113
|
};
|
|
114
|
+
|
|
107
115
|
Gmaps4RailsBing.prototype.showMarker = function(marker) {
|
|
108
116
|
return marker.serviceObject.setOptions({
|
|
109
117
|
visible: true
|
|
110
118
|
});
|
|
111
119
|
};
|
|
120
|
+
|
|
112
121
|
Gmaps4RailsBing.prototype.hideMarkers = function() {
|
|
113
122
|
var marker, _i, _len, _ref, _results;
|
|
114
123
|
_ref = this.markers;
|
|
@@ -119,11 +128,13 @@
|
|
|
119
128
|
}
|
|
120
129
|
return _results;
|
|
121
130
|
};
|
|
131
|
+
|
|
122
132
|
Gmaps4RailsBing.prototype.hideMarker = function(marker) {
|
|
123
133
|
return marker.serviceObject.setOptions({
|
|
124
134
|
visible: false
|
|
125
135
|
});
|
|
126
136
|
};
|
|
137
|
+
|
|
127
138
|
Gmaps4RailsBing.prototype.extendBoundsWithMarkers = function() {
|
|
128
139
|
var locationsArray, marker, _i, _len, _ref;
|
|
129
140
|
locationsArray = [];
|
|
@@ -134,9 +145,13 @@
|
|
|
134
145
|
}
|
|
135
146
|
return this.boundsObject = Microsoft.Maps.LocationRect.fromLocations(locationsArray);
|
|
136
147
|
};
|
|
148
|
+
|
|
137
149
|
Gmaps4RailsBing.prototype.createClusterer = function(markers_array) {};
|
|
150
|
+
|
|
138
151
|
Gmaps4RailsBing.prototype.clearClusterer = function() {};
|
|
152
|
+
|
|
139
153
|
Gmaps4RailsBing.prototype.clusterize = function() {};
|
|
154
|
+
|
|
140
155
|
Gmaps4RailsBing.prototype.createInfoWindow = function(marker_container) {
|
|
141
156
|
var currentMap;
|
|
142
157
|
if (marker_container.description != null) {
|
|
@@ -157,6 +172,7 @@
|
|
|
157
172
|
return this.addToMap(marker_container.info_window);
|
|
158
173
|
}
|
|
159
174
|
};
|
|
175
|
+
|
|
160
176
|
Gmaps4RailsBing.prototype.openInfoWindow = function(currentMap, infoWindow) {
|
|
161
177
|
return function() {
|
|
162
178
|
if (currentMap.visibleInfoWindow) {
|
|
@@ -170,22 +186,29 @@
|
|
|
170
186
|
return currentMap.visibleInfoWindow = infoWindow;
|
|
171
187
|
};
|
|
172
188
|
};
|
|
189
|
+
|
|
173
190
|
Gmaps4RailsBing.prototype.fitBounds = function() {
|
|
174
191
|
return this.map.setView({
|
|
175
192
|
bounds: this.boundsObject
|
|
176
193
|
});
|
|
177
194
|
};
|
|
195
|
+
|
|
178
196
|
Gmaps4RailsBing.prototype.addToMap = function(object) {
|
|
179
197
|
return this.map.entities.push(object);
|
|
180
198
|
};
|
|
199
|
+
|
|
181
200
|
Gmaps4RailsBing.prototype.removeFromMap = function(object) {
|
|
182
201
|
return this.map.entities.remove(object);
|
|
183
202
|
};
|
|
203
|
+
|
|
184
204
|
Gmaps4RailsBing.prototype.centerMapOnUser = function() {
|
|
185
205
|
return this.map.setView({
|
|
186
206
|
center: this.userLocation
|
|
187
207
|
});
|
|
188
208
|
};
|
|
209
|
+
|
|
189
210
|
return Gmaps4RailsBing;
|
|
190
|
-
|
|
211
|
+
|
|
212
|
+
})(Gmaps4Rails);
|
|
213
|
+
|
|
191
214
|
}).call(this);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var __hasProp = Object.prototype.hasOwnProperty,
|
|
3
|
-
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
this.Gmaps4RailsGoogle = (function() {
|
|
11
|
-
__extends(Gmaps4RailsGoogle, Gmaps4Rails);
|
|
2
|
+
var __hasProp = Object.prototype.hasOwnProperty,
|
|
3
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
|
4
|
+
|
|
5
|
+
this.Gmaps4RailsGoogle = (function(_super) {
|
|
6
|
+
|
|
7
|
+
__extends(Gmaps4RailsGoogle, _super);
|
|
8
|
+
|
|
12
9
|
function Gmaps4RailsGoogle() {
|
|
13
10
|
Gmaps4RailsGoogle.__super__.constructor.apply(this, arguments);
|
|
14
11
|
this.map_options = {
|
|
@@ -34,7 +31,8 @@
|
|
|
34
31
|
strokeOpacity: 0.8,
|
|
35
32
|
strokeWeight: 2,
|
|
36
33
|
fillColor: "#000000",
|
|
37
|
-
fillOpacity: 0.35
|
|
34
|
+
fillOpacity: 0.35,
|
|
35
|
+
clickable: false
|
|
38
36
|
};
|
|
39
37
|
this.polylines_conf = {
|
|
40
38
|
strokeColor: "#FF0000",
|
|
@@ -66,15 +64,19 @@
|
|
|
66
64
|
travelMode: "DRIVING"
|
|
67
65
|
};
|
|
68
66
|
}
|
|
67
|
+
|
|
69
68
|
Gmaps4RailsGoogle.prototype.createPoint = function(lat, lng) {
|
|
70
69
|
return new google.maps.Point(lat, lng);
|
|
71
70
|
};
|
|
71
|
+
|
|
72
72
|
Gmaps4RailsGoogle.prototype.createLatLng = function(lat, lng) {
|
|
73
73
|
return new google.maps.LatLng(lat, lng);
|
|
74
74
|
};
|
|
75
|
+
|
|
75
76
|
Gmaps4RailsGoogle.prototype.createLatLngBounds = function() {
|
|
76
77
|
return new google.maps.LatLngBounds();
|
|
77
78
|
};
|
|
79
|
+
|
|
78
80
|
Gmaps4RailsGoogle.prototype.createMap = function() {
|
|
79
81
|
var defaultOptions, mergedOptions;
|
|
80
82
|
defaultOptions = {
|
|
@@ -91,12 +93,15 @@
|
|
|
91
93
|
mergedOptions = this.mergeObjectWithDefault(this.map_options.raw, defaultOptions);
|
|
92
94
|
return new google.maps.Map(document.getElementById(this.map_options.id), mergedOptions);
|
|
93
95
|
};
|
|
96
|
+
|
|
94
97
|
Gmaps4RailsGoogle.prototype.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {
|
|
95
98
|
return new google.maps.MarkerImage(markerPicture, markerSize, origin, anchor, scaledSize);
|
|
96
99
|
};
|
|
100
|
+
|
|
97
101
|
Gmaps4RailsGoogle.prototype.createSize = function(width, height) {
|
|
98
102
|
return new google.maps.Size(width, height);
|
|
99
103
|
};
|
|
104
|
+
|
|
100
105
|
Gmaps4RailsGoogle.prototype.createMarker = function(args) {
|
|
101
106
|
var defaultOptions, imageAnchorPosition, markerImage, markerLatLng, mergedOptions, shadowAnchorPosition, shadowImage;
|
|
102
107
|
markerLatLng = this.createLatLng(args.Lat, args.Lng);
|
|
@@ -105,7 +110,8 @@
|
|
|
105
110
|
position: markerLatLng,
|
|
106
111
|
map: this.map,
|
|
107
112
|
title: args.marker_title,
|
|
108
|
-
draggable: args.marker_draggable
|
|
113
|
+
draggable: args.marker_draggable,
|
|
114
|
+
zIndex: args.zindex
|
|
109
115
|
};
|
|
110
116
|
mergedOptions = this.mergeObjectWithDefault(this.markers_conf.raw, defaultOptions);
|
|
111
117
|
return new google.maps.Marker(mergedOptions);
|
|
@@ -117,7 +123,8 @@
|
|
|
117
123
|
draggable: args.marker_draggable,
|
|
118
124
|
content: args.rich_marker,
|
|
119
125
|
flat: args.marker_anchor === null ? false : args.marker_anchor[1],
|
|
120
|
-
anchor: args.marker_anchor === null ? 0 : args.marker_anchor[0]
|
|
126
|
+
anchor: args.marker_anchor === null ? 0 : args.marker_anchor[0],
|
|
127
|
+
zIndex: args.zindex
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
130
|
imageAnchorPosition = this.createImageAnchorPosition(args.marker_anchor);
|
|
@@ -130,21 +137,22 @@
|
|
|
130
137
|
icon: markerImage,
|
|
131
138
|
title: args.marker_title,
|
|
132
139
|
draggable: args.marker_draggable,
|
|
133
|
-
shadow: shadowImage
|
|
140
|
+
shadow: shadowImage,
|
|
141
|
+
zIndex: args.zindex
|
|
134
142
|
};
|
|
135
143
|
mergedOptions = this.mergeObjectWithDefault(this.markers_conf.raw, defaultOptions);
|
|
136
144
|
return new google.maps.Marker(mergedOptions);
|
|
137
145
|
};
|
|
146
|
+
|
|
138
147
|
Gmaps4RailsGoogle.prototype.includeMarkerImage = function(arr, obj) {
|
|
139
148
|
var index, object, _len;
|
|
140
149
|
for (index = 0, _len = arr.length; index < _len; index++) {
|
|
141
150
|
object = arr[index];
|
|
142
|
-
if (object.url === obj)
|
|
143
|
-
return index;
|
|
144
|
-
}
|
|
151
|
+
if (object.url === obj) return index;
|
|
145
152
|
}
|
|
146
153
|
return false;
|
|
147
154
|
};
|
|
155
|
+
|
|
148
156
|
Gmaps4RailsGoogle.prototype.createOrRetrieveImage = function(currentMarkerPicture, markerWidth, markerHeight, imageAnchorPosition) {
|
|
149
157
|
var markerImage, test_image_index;
|
|
150
158
|
if (currentMarkerPicture === "" || currentMarkerPicture === null) {
|
|
@@ -164,6 +172,7 @@
|
|
|
164
172
|
return false;
|
|
165
173
|
}
|
|
166
174
|
};
|
|
175
|
+
|
|
167
176
|
Gmaps4RailsGoogle.prototype.clearMarkers = function() {
|
|
168
177
|
var marker, _i, _len, _ref, _results;
|
|
169
178
|
_ref = this.markers;
|
|
@@ -174,6 +183,7 @@
|
|
|
174
183
|
}
|
|
175
184
|
return _results;
|
|
176
185
|
};
|
|
186
|
+
|
|
177
187
|
Gmaps4RailsGoogle.prototype.showMarkers = function() {
|
|
178
188
|
var marker, _i, _len, _ref, _results;
|
|
179
189
|
_ref = this.markers;
|
|
@@ -184,6 +194,7 @@
|
|
|
184
194
|
}
|
|
185
195
|
return _results;
|
|
186
196
|
};
|
|
197
|
+
|
|
187
198
|
Gmaps4RailsGoogle.prototype.hideMarkers = function() {
|
|
188
199
|
var marker, _i, _len, _ref, _results;
|
|
189
200
|
_ref = this.markers;
|
|
@@ -194,15 +205,19 @@
|
|
|
194
205
|
}
|
|
195
206
|
return _results;
|
|
196
207
|
};
|
|
208
|
+
|
|
197
209
|
Gmaps4RailsGoogle.prototype.clearMarker = function(marker) {
|
|
198
210
|
return marker.serviceObject.setMap(null);
|
|
199
211
|
};
|
|
212
|
+
|
|
200
213
|
Gmaps4RailsGoogle.prototype.showMarker = function(marker) {
|
|
201
214
|
return marker.serviceObject.setVisible(true);
|
|
202
215
|
};
|
|
216
|
+
|
|
203
217
|
Gmaps4RailsGoogle.prototype.hideMarker = function(marker) {
|
|
204
218
|
return marker.serviceObject.setVisible(false);
|
|
205
219
|
};
|
|
220
|
+
|
|
206
221
|
Gmaps4RailsGoogle.prototype.extendBoundsWithMarkers = function() {
|
|
207
222
|
var marker, _i, _len, _ref, _results;
|
|
208
223
|
_ref = this.markers;
|
|
@@ -213,6 +228,7 @@
|
|
|
213
228
|
}
|
|
214
229
|
return _results;
|
|
215
230
|
};
|
|
231
|
+
|
|
216
232
|
Gmaps4RailsGoogle.prototype.createClusterer = function(markers_array) {
|
|
217
233
|
return new MarkerClusterer(this.map, markers_array, {
|
|
218
234
|
maxZoom: this.markers_conf.clusterer_maxZoom,
|
|
@@ -220,15 +236,15 @@
|
|
|
220
236
|
styles: this.customClusterer()
|
|
221
237
|
});
|
|
222
238
|
};
|
|
239
|
+
|
|
223
240
|
Gmaps4RailsGoogle.prototype.clearClusterer = function() {
|
|
224
241
|
return this.markerClusterer.clearMarkers();
|
|
225
242
|
};
|
|
243
|
+
|
|
226
244
|
Gmaps4RailsGoogle.prototype.clusterize = function() {
|
|
227
245
|
var marker, markers_array, _i, _len, _ref;
|
|
228
246
|
if (this.markers_conf.do_clustering === true) {
|
|
229
|
-
if (this.markerClusterer !== null)
|
|
230
|
-
this.clearClusterer();
|
|
231
|
-
}
|
|
247
|
+
if (this.markerClusterer !== null) this.clearClusterer();
|
|
232
248
|
markers_array = new Array;
|
|
233
249
|
_ref = this.markers;
|
|
234
250
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
@@ -238,6 +254,7 @@
|
|
|
238
254
|
return this.markerClusterer = this.createClusterer(markers_array);
|
|
239
255
|
}
|
|
240
256
|
};
|
|
257
|
+
|
|
241
258
|
Gmaps4RailsGoogle.prototype.createInfoWindow = function(marker_container) {
|
|
242
259
|
var boxText, currentMap;
|
|
243
260
|
if (typeof this.jsTemplate === "function" || (marker_container.description != null)) {
|
|
@@ -260,6 +277,7 @@
|
|
|
260
277
|
}
|
|
261
278
|
}
|
|
262
279
|
};
|
|
280
|
+
|
|
263
281
|
Gmaps4RailsGoogle.prototype.openInfoWindow = function(currentMap, infoWindow, marker) {
|
|
264
282
|
return function() {
|
|
265
283
|
if (currentMap.visibleInfoWindow !== null) {
|
|
@@ -269,6 +287,7 @@
|
|
|
269
287
|
return currentMap.visibleInfoWindow = infoWindow;
|
|
270
288
|
};
|
|
271
289
|
};
|
|
290
|
+
|
|
272
291
|
Gmaps4RailsGoogle.prototype.createKmlLayer = function(kml) {
|
|
273
292
|
var kml_options;
|
|
274
293
|
kml_options = kml.options || {};
|
|
@@ -277,14 +296,19 @@
|
|
|
277
296
|
kml.setMap(this.map);
|
|
278
297
|
return kml;
|
|
279
298
|
};
|
|
299
|
+
|
|
280
300
|
Gmaps4RailsGoogle.prototype.fitBounds = function() {
|
|
281
301
|
if (!this.boundsObject.isEmpty()) {
|
|
282
302
|
return this.map.fitBounds(this.boundsObject);
|
|
283
303
|
}
|
|
284
304
|
};
|
|
305
|
+
|
|
285
306
|
Gmaps4RailsGoogle.prototype.centerMapOnUser = function() {
|
|
286
307
|
return this.map.setCenter(this.userLocation);
|
|
287
308
|
};
|
|
309
|
+
|
|
288
310
|
return Gmaps4RailsGoogle;
|
|
289
|
-
|
|
311
|
+
|
|
312
|
+
})(Gmaps4Rails);
|
|
313
|
+
|
|
290
314
|
}).call(this);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
var __hasProp = Object.prototype.hasOwnProperty,
|
|
3
|
-
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
this.Gmaps4RailsMapquest = (function() {
|
|
11
|
-
__extends(Gmaps4RailsMapquest, Gmaps4Rails);
|
|
2
|
+
var __hasProp = Object.prototype.hasOwnProperty,
|
|
3
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
|
4
|
+
|
|
5
|
+
this.Gmaps4RailsMapquest = (function(_super) {
|
|
6
|
+
|
|
7
|
+
__extends(Gmaps4RailsMapquest, _super);
|
|
8
|
+
|
|
12
9
|
function Gmaps4RailsMapquest() {
|
|
13
10
|
Gmaps4RailsMapquest.__super__.constructor.apply(this, arguments);
|
|
14
11
|
this.map_options = {
|
|
@@ -18,19 +15,23 @@
|
|
|
18
15
|
this.mergeWithDefault("markers_conf");
|
|
19
16
|
this.mergeWithDefault("map_options");
|
|
20
17
|
}
|
|
18
|
+
|
|
21
19
|
Gmaps4RailsMapquest.prototype.createPoint = function(lat, lng) {
|
|
22
20
|
return new MQA.Poi({
|
|
23
21
|
lat: lat,
|
|
24
22
|
lng: lng
|
|
25
23
|
});
|
|
26
24
|
};
|
|
25
|
+
|
|
27
26
|
Gmaps4RailsMapquest.prototype.createLatLng = function(lat, lng) {
|
|
28
27
|
return {
|
|
29
28
|
lat: lat,
|
|
30
29
|
lng: lng
|
|
31
30
|
};
|
|
32
31
|
};
|
|
32
|
+
|
|
33
33
|
Gmaps4RailsMapquest.prototype.createLatLngBounds = function() {};
|
|
34
|
+
|
|
34
35
|
Gmaps4RailsMapquest.prototype.createMap = function() {
|
|
35
36
|
var map;
|
|
36
37
|
map = new MQA.TileMap(document.getElementById(this.map_options.id), this.map_options.zoom, {
|
|
@@ -42,7 +43,9 @@
|
|
|
42
43
|
}));
|
|
43
44
|
return map;
|
|
44
45
|
};
|
|
46
|
+
|
|
45
47
|
Gmaps4RailsMapquest.prototype.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {};
|
|
48
|
+
|
|
46
49
|
Gmaps4RailsMapquest.prototype.createMarker = function(args) {
|
|
47
50
|
var icon, marker;
|
|
48
51
|
marker = new MQA.Poi({
|
|
@@ -72,6 +75,7 @@
|
|
|
72
75
|
this.addToMap(marker);
|
|
73
76
|
return marker;
|
|
74
77
|
};
|
|
78
|
+
|
|
75
79
|
Gmaps4RailsMapquest.prototype.clearMarkers = function() {
|
|
76
80
|
var marker, _i, _len, _results;
|
|
77
81
|
_results = [];
|
|
@@ -81,6 +85,7 @@
|
|
|
81
85
|
}
|
|
82
86
|
return _results;
|
|
83
87
|
};
|
|
88
|
+
|
|
84
89
|
Gmaps4RailsMapquest.prototype.showMarkers = function() {
|
|
85
90
|
var marker, _i, _len, _results;
|
|
86
91
|
_results = [];
|
|
@@ -90,6 +95,7 @@
|
|
|
90
95
|
}
|
|
91
96
|
return _results;
|
|
92
97
|
};
|
|
98
|
+
|
|
93
99
|
Gmaps4RailsMapquest.prototype.hideMarkers = function() {
|
|
94
100
|
var marker, _i, _len, _results;
|
|
95
101
|
_results = [];
|
|
@@ -99,11 +105,15 @@
|
|
|
99
105
|
}
|
|
100
106
|
return _results;
|
|
101
107
|
};
|
|
108
|
+
|
|
102
109
|
Gmaps4RailsMapquest.prototype.clearMarker = function(marker) {
|
|
103
110
|
return this.removeFromMap(marker.serviceObject);
|
|
104
111
|
};
|
|
112
|
+
|
|
105
113
|
Gmaps4RailsMapquest.prototype.showMarker = function(marker) {};
|
|
114
|
+
|
|
106
115
|
Gmaps4RailsMapquest.prototype.hideMarker = function(marker) {};
|
|
116
|
+
|
|
107
117
|
Gmaps4RailsMapquest.prototype.extendBoundsWithMarkers = function() {
|
|
108
118
|
var marker, _i, _len, _ref, _results;
|
|
109
119
|
if (this.markers.length >= 2) {
|
|
@@ -117,29 +127,38 @@
|
|
|
117
127
|
return _results;
|
|
118
128
|
}
|
|
119
129
|
};
|
|
130
|
+
|
|
120
131
|
Gmaps4RailsMapquest.prototype.createClusterer = function(markers_array) {};
|
|
132
|
+
|
|
121
133
|
Gmaps4RailsMapquest.prototype.clearClusterer = function() {};
|
|
134
|
+
|
|
122
135
|
Gmaps4RailsMapquest.prototype.clusterize = function() {};
|
|
136
|
+
|
|
123
137
|
Gmaps4RailsMapquest.prototype.createInfoWindow = function(marker_container) {
|
|
124
138
|
return marker_container.serviceObject.setInfoTitleHTML(marker_container.description);
|
|
125
139
|
};
|
|
140
|
+
|
|
126
141
|
Gmaps4RailsMapquest.prototype.fitBounds = function() {
|
|
127
|
-
if (this.markers.length >= 2)
|
|
128
|
-
this.map.zoomToRect(this.boundsObject);
|
|
129
|
-
}
|
|
142
|
+
if (this.markers.length >= 2) this.map.zoomToRect(this.boundsObject);
|
|
130
143
|
if (this.markers.length === 1) {
|
|
131
144
|
return this.map.setCenter(this.markers[0].serviceObject.latLng);
|
|
132
145
|
}
|
|
133
146
|
};
|
|
147
|
+
|
|
134
148
|
Gmaps4RailsMapquest.prototype.centerMapOnUser = function() {
|
|
135
149
|
return this.map.setCenter(this.userLocation);
|
|
136
150
|
};
|
|
151
|
+
|
|
137
152
|
Gmaps4RailsMapquest.prototype.addToMap = function(object) {
|
|
138
153
|
return this.map.addShape(object);
|
|
139
154
|
};
|
|
155
|
+
|
|
140
156
|
Gmaps4RailsMapquest.prototype.removeFromMap = function(object) {
|
|
141
157
|
return this.map.removeShape(object);
|
|
142
158
|
};
|
|
159
|
+
|
|
143
160
|
return Gmaps4RailsMapquest;
|
|
144
|
-
|
|
161
|
+
|
|
162
|
+
})(Gmaps4Rails);
|
|
163
|
+
|
|
145
164
|
}).call(this);
|