gmaps4rails 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +6 -386
- data/.gitignore +0 -17
- data/.travis.yml +0 -10
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -182
- data/Guardfile +0 -24
- data/MIT-LICENSE +0 -20
- data/README.rdoc +0 -135
- data/Rakefile +0 -4
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.base.js.coffee +0 -444
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.bing.js.coffee +0 -174
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.googlemaps.js.coffee +0 -339
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.mapquest.js.coffee +0 -145
- data/app/assets/javascripts/gmaps4rails/gmaps4rails.openlayers.js.coffee +0 -261
- data/app/views/gmaps4rails/_gmaps4rails.html.erb +0 -20
- data/gmaps4rails.gemspec +0 -39
- data/lib/generators/gmaps4rails/install_generator.rb +0 -48
- data/lib/generators/templates/README +0 -2
- data/lib/gmaps4rails.rb +0 -26
- data/lib/gmaps4rails/acts_as_gmappable.rb +0 -54
- data/lib/gmaps4rails/api_wrappers/base_net_methods.rb +0 -40
- data/lib/gmaps4rails/api_wrappers/direction.rb +0 -87
- data/lib/gmaps4rails/api_wrappers/geocoder.rb +0 -54
- data/lib/gmaps4rails/api_wrappers/places.rb +0 -74
- data/lib/gmaps4rails/base.rb +0 -119
- data/lib/gmaps4rails/extensions/enumerable.rb +0 -14
- data/lib/gmaps4rails/extensions/hash.rb +0 -9
- data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +0 -33
- data/lib/gmaps4rails/js_builder.rb +0 -157
- data/lib/gmaps4rails/json_builder.rb +0 -140
- data/lib/gmaps4rails/model_handler.rb +0 -101
- data/lib/gmaps4rails/version.rb +0 -3
- data/lib/gmaps4rails/view_helper.rb +0 -175
- data/lib/tasks/gmaps4rails_tasks.rake +0 -4
- data/lib/tasks/jasmine.rake +0 -8
- data/public/javascripts/gmaps4rails/gmaps4rails.base.js +0 -464
- data/public/javascripts/gmaps4rails/gmaps4rails.bing.js +0 -226
- data/public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js +0 -430
- data/public/javascripts/gmaps4rails/gmaps4rails.mapquest.js +0 -178
- data/public/javascripts/gmaps4rails/gmaps4rails.openlayers.js +0 -265
- data/public/stylesheets/gmaps4rails.css +0 -24
- data/spec/dummy/.gitignore +0 -2
- data/spec/dummy/.rspec +0 -1
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/assets/stylesheets/gmaps4rails.css +0 -24
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/controllers/users_controller.rb +0 -101
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/place.rb +0 -16
- data/spec/dummy/app/models/user.rb +0 -12
- data/spec/dummy/app/views/layouts/application.html.erb +0 -16
- data/spec/dummy/app/views/users/_form.html.erb +0 -37
- data/spec/dummy/app/views/users/_map.html.erb +0 -5
- data/spec/dummy/app/views/users/edit.html.erb +0 -6
- data/spec/dummy/app/views/users/index.html.erb +0 -260
- data/spec/dummy/app/views/users/new.html.erb +0 -5
- data/spec/dummy/app/views/users/show.html.erb +0 -30
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -62
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/gmaps4rails.rb +0 -1
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -60
- data/spec/dummy/db/migrate/20120408170155_create_users.rb +0 -16
- data/spec/dummy/db/schema.rb +0 -29
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/Player.js +0 -22
- data/spec/dummy/public/javascripts/Song.js +0 -7
- data/spec/dummy/public/logo.png +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/factories/place_factory.rb +0 -16
- data/spec/factories/user_factory.rb +0 -23
- data/spec/fixtures/google_direction_valid.json +0 -65
- data/spec/fixtures/google_geocoding_toulon_france.json +0 -58
- data/spec/fixtures/google_places_valid.json +0 -45
- data/spec/fixtures/google_wrong_geocoding.json +0 -4
- data/spec/javascripts/basic_methods_spec.js +0 -103
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/helpers/SpecHelper.js +0 -87
- data/spec/javascripts/map_spec.js +0 -49
- data/spec/javascripts/markers_methods_spec.js +0 -368
- data/spec/javascripts/mocks_spec.js +0 -27
- data/spec/javascripts/support/jasmine.yml +0 -10
- data/spec/javascripts/support/jasmine_config.rb +0 -23
- data/spec/javascripts/support/jasmine_runner.rb +0 -20
- 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/lib/base_spec.rb +0 -59
- data/spec/lib/direction_spec.rb +0 -53
- data/spec/lib/geocoder_spec.rb +0 -46
- data/spec/lib/js_builder_spec.rb +0 -139
- data/spec/lib/json_builder_spec.rb +0 -232
- data/spec/lib/places_spec.rb +0 -25
- data/spec/models/place_spec.rb +0 -35
- data/spec/models/user_spec.rb +0 -187
- data/spec/spec_helper.rb +0 -44
- data/spec/support/geocoding.rb +0 -41
- data/spec/support/matchers.rb +0 -73
@@ -1,226 +0,0 @@
|
|
1
|
-
(function() {
|
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
|
-
|
9
|
-
function Gmaps4RailsBing() {
|
10
|
-
Gmaps4RailsBing.__super__.constructor.apply(this, arguments);
|
11
|
-
this.map_options = {
|
12
|
-
type: "road"
|
13
|
-
};
|
14
|
-
this.markers_conf = {
|
15
|
-
infobox: "description"
|
16
|
-
};
|
17
|
-
this.mergeWithDefault("map_options");
|
18
|
-
this.mergeWithDefault("markers_conf");
|
19
|
-
}
|
20
|
-
|
21
|
-
Gmaps4RailsBing.prototype.getMapType = function() {
|
22
|
-
switch (this.map_options.type) {
|
23
|
-
case "road":
|
24
|
-
return Microsoft.Maps.MapTypeId.road;
|
25
|
-
case "aerial":
|
26
|
-
return Microsoft.Maps.MapTypeId.aerial;
|
27
|
-
case "auto":
|
28
|
-
return Microsoft.Maps.MapTypeId.auto;
|
29
|
-
case "birdseye":
|
30
|
-
return Microsoft.Maps.MapTypeId.birdseye;
|
31
|
-
case "collinsBart":
|
32
|
-
return Microsoft.Maps.MapTypeId.collinsBart;
|
33
|
-
case "mercator":
|
34
|
-
return Microsoft.Maps.MapTypeId.mercator;
|
35
|
-
case "ordnanceSurvey":
|
36
|
-
return Microsoft.Maps.MapTypeId.ordnanceSurvey;
|
37
|
-
default:
|
38
|
-
return Microsoft.Maps.MapTypeId.auto;
|
39
|
-
}
|
40
|
-
};
|
41
|
-
|
42
|
-
Gmaps4RailsBing.prototype.createPoint = function(lat, lng) {
|
43
|
-
return new Microsoft.Maps.Point(lat, lng);
|
44
|
-
};
|
45
|
-
|
46
|
-
Gmaps4RailsBing.prototype.createLatLng = function(lat, lng) {
|
47
|
-
return new Microsoft.Maps.Location(lat, lng);
|
48
|
-
};
|
49
|
-
|
50
|
-
Gmaps4RailsBing.prototype.createLatLngBounds = function() {};
|
51
|
-
|
52
|
-
Gmaps4RailsBing.prototype.createMap = function() {
|
53
|
-
return new Microsoft.Maps.Map(document.getElementById(this.map_options.id), {
|
54
|
-
credentials: this.map_options.provider_key,
|
55
|
-
mapTypeId: this.getMapType(),
|
56
|
-
center: this.createLatLng(this.map_options.center_latitude, this.map_options.center_longitude),
|
57
|
-
zoom: this.map_options.zoom
|
58
|
-
});
|
59
|
-
};
|
60
|
-
|
61
|
-
Gmaps4RailsBing.prototype.createSize = function(width, height) {
|
62
|
-
return new google.maps.Size(width, height);
|
63
|
-
};
|
64
|
-
|
65
|
-
Gmaps4RailsBing.prototype.createMarker = function(args) {
|
66
|
-
var marker, markerLatLng;
|
67
|
-
markerLatLng = this.createLatLng(args.Lat, args.Lng);
|
68
|
-
marker;
|
69
|
-
if (args.marker_picture === "") {
|
70
|
-
marker = new Microsoft.Maps.Pushpin(this.createLatLng(args.Lat, args.Lng), {
|
71
|
-
draggable: args.marker_draggable,
|
72
|
-
anchor: this.createImageAnchorPosition(args.Lat, args.Lng),
|
73
|
-
text: args.marker_title
|
74
|
-
});
|
75
|
-
} else {
|
76
|
-
marker = new Microsoft.Maps.Pushpin(this.createLatLng(args.Lat, args.Lng), {
|
77
|
-
draggable: args.marker_draggable,
|
78
|
-
anchor: this.createImageAnchorPosition(args.Lat, args.Lng),
|
79
|
-
icon: args.marker_picture,
|
80
|
-
height: args.marker_height,
|
81
|
-
text: args.marker_title,
|
82
|
-
width: args.marker_width
|
83
|
-
});
|
84
|
-
}
|
85
|
-
this.addToMap(marker);
|
86
|
-
return marker;
|
87
|
-
};
|
88
|
-
|
89
|
-
Gmaps4RailsBing.prototype.clearMarkers = function() {
|
90
|
-
var marker, _i, _len, _ref, _results;
|
91
|
-
_ref = this.markers;
|
92
|
-
_results = [];
|
93
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
94
|
-
marker = _ref[_i];
|
95
|
-
_results.push(this.clearMarker(marker));
|
96
|
-
}
|
97
|
-
return _results;
|
98
|
-
};
|
99
|
-
|
100
|
-
Gmaps4RailsBing.prototype.clearMarker = function(marker) {
|
101
|
-
return this.removeFromMap(marker.serviceObject);
|
102
|
-
};
|
103
|
-
|
104
|
-
Gmaps4RailsBing.prototype.showMarkers = function() {
|
105
|
-
var marker, _i, _len, _ref, _results;
|
106
|
-
_ref = this.markers;
|
107
|
-
_results = [];
|
108
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
109
|
-
marker = _ref[_i];
|
110
|
-
_results.push(this.showMarker(marker));
|
111
|
-
}
|
112
|
-
return _results;
|
113
|
-
};
|
114
|
-
|
115
|
-
Gmaps4RailsBing.prototype.showMarker = function(marker) {
|
116
|
-
return marker.serviceObject.setOptions({
|
117
|
-
visible: true
|
118
|
-
});
|
119
|
-
};
|
120
|
-
|
121
|
-
Gmaps4RailsBing.prototype.hideMarkers = function() {
|
122
|
-
var marker, _i, _len, _ref, _results;
|
123
|
-
_ref = this.markers;
|
124
|
-
_results = [];
|
125
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
126
|
-
marker = _ref[_i];
|
127
|
-
_results.push(this.hideMarker(marker));
|
128
|
-
}
|
129
|
-
return _results;
|
130
|
-
};
|
131
|
-
|
132
|
-
Gmaps4RailsBing.prototype.hideMarker = function(marker) {
|
133
|
-
return marker.serviceObject.setOptions({
|
134
|
-
visible: false
|
135
|
-
});
|
136
|
-
};
|
137
|
-
|
138
|
-
Gmaps4RailsBing.prototype.extendBoundsWithMarkers = function() {
|
139
|
-
var locationsArray, marker, _i, _len, _ref;
|
140
|
-
locationsArray = [];
|
141
|
-
_ref = this.markers;
|
142
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
143
|
-
marker = _ref[_i];
|
144
|
-
locationsArray.push(marker.serviceObject.getLocation());
|
145
|
-
}
|
146
|
-
return this.boundsObject = Microsoft.Maps.LocationRect.fromLocations(locationsArray);
|
147
|
-
};
|
148
|
-
|
149
|
-
Gmaps4RailsBing.prototype.createClusterer = function(markers_array) {};
|
150
|
-
|
151
|
-
Gmaps4RailsBing.prototype.clearClusterer = function() {};
|
152
|
-
|
153
|
-
Gmaps4RailsBing.prototype.clusterize = function() {};
|
154
|
-
|
155
|
-
Gmaps4RailsBing.prototype.createInfoWindow = function(marker_container) {
|
156
|
-
var currentMap;
|
157
|
-
if (marker_container.description != null) {
|
158
|
-
if (this.markers_conf.infobox === "description") {
|
159
|
-
marker_container.info_window = new Microsoft.Maps.Infobox(marker_container.serviceObject.getLocation(), {
|
160
|
-
description: marker_container.description,
|
161
|
-
visible: false,
|
162
|
-
showCloseButton: true
|
163
|
-
});
|
164
|
-
} else {
|
165
|
-
marker_container.info_window = new Microsoft.Maps.Infobox(marker_container.serviceObject.getLocation(), {
|
166
|
-
htmlContent: marker_container.description,
|
167
|
-
visible: false
|
168
|
-
});
|
169
|
-
}
|
170
|
-
currentMap = this;
|
171
|
-
Microsoft.Maps.Events.addHandler(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, marker_container.info_window));
|
172
|
-
return this.addToMap(marker_container.info_window);
|
173
|
-
}
|
174
|
-
};
|
175
|
-
|
176
|
-
Gmaps4RailsBing.prototype.openInfoWindow = function(currentMap, infoWindow) {
|
177
|
-
return function() {
|
178
|
-
if (currentMap.visibleInfoWindow) {
|
179
|
-
currentMap.visibleInfoWindow.setOptions({
|
180
|
-
visible: false
|
181
|
-
});
|
182
|
-
}
|
183
|
-
infoWindow.setOptions({
|
184
|
-
visible: true
|
185
|
-
});
|
186
|
-
return currentMap.visibleInfoWindow = infoWindow;
|
187
|
-
};
|
188
|
-
};
|
189
|
-
|
190
|
-
Gmaps4RailsBing.prototype.fitBounds = function() {
|
191
|
-
return this.serviceObject.setView({
|
192
|
-
bounds: this.boundsObject
|
193
|
-
});
|
194
|
-
};
|
195
|
-
|
196
|
-
Gmaps4RailsBing.prototype.addToMap = function(object) {
|
197
|
-
return this.serviceObject.entities.push(object);
|
198
|
-
};
|
199
|
-
|
200
|
-
Gmaps4RailsBing.prototype.removeFromMap = function(object) {
|
201
|
-
return this.serviceObject.entities.remove(object);
|
202
|
-
};
|
203
|
-
|
204
|
-
Gmaps4RailsBing.prototype.centerMapOnUser = function() {
|
205
|
-
return this.serviceObject.setView({
|
206
|
-
center: this.userLocation
|
207
|
-
});
|
208
|
-
};
|
209
|
-
|
210
|
-
Gmaps4RailsBing.prototype.updateBoundsWithPolylines = function() {};
|
211
|
-
|
212
|
-
Gmaps4RailsBing.prototype.updateBoundsWithPolygons = function() {};
|
213
|
-
|
214
|
-
Gmaps4RailsBing.prototype.updateBoundsWithCircles = function() {};
|
215
|
-
|
216
|
-
Gmaps4RailsBing.prototype.extendMapBounds = function() {};
|
217
|
-
|
218
|
-
Gmaps4RailsBing.prototype.adaptMapToBounds = function() {
|
219
|
-
return this.fitBounds();
|
220
|
-
};
|
221
|
-
|
222
|
-
return Gmaps4RailsBing;
|
223
|
-
|
224
|
-
})(Gmaps4Rails);
|
225
|
-
|
226
|
-
}).call(this);
|
@@ -1,430 +0,0 @@
|
|
1
|
-
(function() {
|
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
|
-
|
9
|
-
function Gmaps4RailsGoogle() {
|
10
|
-
Gmaps4RailsGoogle.__super__.constructor.apply(this, arguments);
|
11
|
-
this.map_options = {
|
12
|
-
disableDefaultUI: false,
|
13
|
-
disableDoubleClickZoom: false,
|
14
|
-
type: "ROADMAP"
|
15
|
-
};
|
16
|
-
this.markers_conf = {
|
17
|
-
clusterer_gridSize: 50,
|
18
|
-
clusterer_maxZoom: 5,
|
19
|
-
custom_cluster_pictures: null,
|
20
|
-
custom_infowindow_class: null
|
21
|
-
};
|
22
|
-
this.mergeWithDefault("map_options");
|
23
|
-
this.mergeWithDefault("markers_conf");
|
24
|
-
this.kml_options = {
|
25
|
-
clickable: true,
|
26
|
-
preserveViewport: false,
|
27
|
-
suppressInfoWindows: false
|
28
|
-
};
|
29
|
-
this.polygons_conf = {
|
30
|
-
strokeColor: "#FFAA00",
|
31
|
-
strokeOpacity: 0.8,
|
32
|
-
strokeWeight: 2,
|
33
|
-
fillColor: "#000000",
|
34
|
-
fillOpacity: 0.35,
|
35
|
-
clickable: false
|
36
|
-
};
|
37
|
-
this.circles_conf = {
|
38
|
-
fillColor: "#00AAFF",
|
39
|
-
fillOpacity: 0.35,
|
40
|
-
strokeColor: "#FFAA00",
|
41
|
-
strokeOpacity: 0.8,
|
42
|
-
strokeWeight: 2,
|
43
|
-
clickable: false,
|
44
|
-
zIndex: null
|
45
|
-
};
|
46
|
-
this.direction_conf = {
|
47
|
-
panel_id: null,
|
48
|
-
display_panel: false,
|
49
|
-
origin: null,
|
50
|
-
destination: null,
|
51
|
-
waypoints: [],
|
52
|
-
optimizeWaypoints: false,
|
53
|
-
unitSystem: "METRIC",
|
54
|
-
avoidHighways: false,
|
55
|
-
avoidTolls: false,
|
56
|
-
region: null,
|
57
|
-
travelMode: "DRIVING"
|
58
|
-
};
|
59
|
-
}
|
60
|
-
|
61
|
-
Gmaps4RailsGoogle.prototype.createPoint = function(lat, lng) {
|
62
|
-
return new google.maps.Point(lat, lng);
|
63
|
-
};
|
64
|
-
|
65
|
-
Gmaps4RailsGoogle.prototype.createLatLng = function(lat, lng) {
|
66
|
-
return new google.maps.LatLng(lat, lng);
|
67
|
-
};
|
68
|
-
|
69
|
-
Gmaps4RailsGoogle.prototype.createLatLngBounds = function() {
|
70
|
-
return new google.maps.LatLngBounds();
|
71
|
-
};
|
72
|
-
|
73
|
-
Gmaps4RailsGoogle.prototype.createMap = function() {
|
74
|
-
var defaultOptions, mergedOptions;
|
75
|
-
defaultOptions = {
|
76
|
-
maxZoom: this.map_options.maxZoom,
|
77
|
-
minZoom: this.map_options.minZoom,
|
78
|
-
zoom: this.map_options.zoom,
|
79
|
-
center: this.createLatLng(this.map_options.center_latitude, this.map_options.center_longitude),
|
80
|
-
mapTypeId: google.maps.MapTypeId[this.map_options.type],
|
81
|
-
mapTypeControl: this.map_options.mapTypeControl,
|
82
|
-
disableDefaultUI: this.map_options.disableDefaultUI,
|
83
|
-
disableDoubleClickZoom: this.map_options.disableDoubleClickZoom,
|
84
|
-
draggable: this.map_options.draggable
|
85
|
-
};
|
86
|
-
mergedOptions = this.mergeObjectWithDefault(this.map_options.raw, defaultOptions);
|
87
|
-
return new google.maps.Map(document.getElementById(this.map_options.id), mergedOptions);
|
88
|
-
};
|
89
|
-
|
90
|
-
Gmaps4RailsGoogle.prototype.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {
|
91
|
-
return new google.maps.MarkerImage(markerPicture, markerSize, origin, anchor, scaledSize);
|
92
|
-
};
|
93
|
-
|
94
|
-
Gmaps4RailsGoogle.prototype.createSize = function(width, height) {
|
95
|
-
return new google.maps.Size(width, height);
|
96
|
-
};
|
97
|
-
|
98
|
-
Gmaps4RailsGoogle.prototype.createMarker = function(args) {
|
99
|
-
var defaultOptions, imageAnchorPosition, markerImage, markerLatLng, mergedOptions, shadowAnchorPosition, shadowImage;
|
100
|
-
markerLatLng = this.createLatLng(args.Lat, args.Lng);
|
101
|
-
if (args.marker_picture === "" && args.rich_marker === null) {
|
102
|
-
defaultOptions = {
|
103
|
-
position: markerLatLng,
|
104
|
-
map: this.serviceObject,
|
105
|
-
title: args.marker_title,
|
106
|
-
draggable: args.marker_draggable,
|
107
|
-
zIndex: args.zindex
|
108
|
-
};
|
109
|
-
mergedOptions = this.mergeObjectWithDefault(this.markers_conf.raw, defaultOptions);
|
110
|
-
return new google.maps.Marker(mergedOptions);
|
111
|
-
}
|
112
|
-
if (args.rich_marker !== null) {
|
113
|
-
return new RichMarker({
|
114
|
-
position: markerLatLng,
|
115
|
-
map: this.serviceObject,
|
116
|
-
draggable: args.marker_draggable,
|
117
|
-
content: args.rich_marker,
|
118
|
-
flat: args.marker_anchor === null ? false : args.marker_anchor[1],
|
119
|
-
anchor: args.marker_anchor === null ? 0 : args.marker_anchor[0],
|
120
|
-
zIndex: args.zindex
|
121
|
-
});
|
122
|
-
}
|
123
|
-
imageAnchorPosition = this.createImageAnchorPosition(args.marker_anchor);
|
124
|
-
shadowAnchorPosition = this.createImageAnchorPosition(args.shadow_anchor);
|
125
|
-
markerImage = this.createOrRetrieveImage(args.marker_picture, args.marker_width, args.marker_height, imageAnchorPosition);
|
126
|
-
shadowImage = this.createOrRetrieveImage(args.shadow_picture, args.shadow_width, args.shadow_height, shadowAnchorPosition);
|
127
|
-
defaultOptions = {
|
128
|
-
position: markerLatLng,
|
129
|
-
map: this.serviceObject,
|
130
|
-
icon: markerImage,
|
131
|
-
title: args.marker_title,
|
132
|
-
draggable: args.marker_draggable,
|
133
|
-
shadow: shadowImage,
|
134
|
-
zIndex: args.zindex
|
135
|
-
};
|
136
|
-
mergedOptions = this.mergeObjectWithDefault(this.markers_conf.raw, defaultOptions);
|
137
|
-
return new google.maps.Marker(mergedOptions);
|
138
|
-
};
|
139
|
-
|
140
|
-
Gmaps4RailsGoogle.prototype.includeMarkerImage = function(arr, obj) {
|
141
|
-
var index, object, _len;
|
142
|
-
for (index = 0, _len = arr.length; index < _len; index++) {
|
143
|
-
object = arr[index];
|
144
|
-
if (object.url === obj) return index;
|
145
|
-
}
|
146
|
-
return false;
|
147
|
-
};
|
148
|
-
|
149
|
-
Gmaps4RailsGoogle.prototype.createOrRetrieveImage = function(currentMarkerPicture, markerWidth, markerHeight, imageAnchorPosition) {
|
150
|
-
var markerImage, test_image_index;
|
151
|
-
if (currentMarkerPicture === "" || currentMarkerPicture === null) {
|
152
|
-
return null;
|
153
|
-
}
|
154
|
-
test_image_index = this.includeMarkerImage(this.markerImages, currentMarkerPicture);
|
155
|
-
switch (test_image_index) {
|
156
|
-
case false:
|
157
|
-
markerImage = this.createMarkerImage(currentMarkerPicture, this.createSize(markerWidth, markerHeight), null, imageAnchorPosition, null);
|
158
|
-
this.markerImages.push(markerImage);
|
159
|
-
return markerImage;
|
160
|
-
break;
|
161
|
-
default:
|
162
|
-
if (typeof test_image_index === 'number') {
|
163
|
-
return this.markerImages[test_image_index];
|
164
|
-
}
|
165
|
-
return false;
|
166
|
-
}
|
167
|
-
};
|
168
|
-
|
169
|
-
Gmaps4RailsGoogle.prototype.clearMarkers = function() {
|
170
|
-
var marker, _i, _len, _ref, _results;
|
171
|
-
_ref = this.markers;
|
172
|
-
_results = [];
|
173
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
174
|
-
marker = _ref[_i];
|
175
|
-
_results.push(this.clearMarker(marker));
|
176
|
-
}
|
177
|
-
return _results;
|
178
|
-
};
|
179
|
-
|
180
|
-
Gmaps4RailsGoogle.prototype.showMarkers = function() {
|
181
|
-
var marker, _i, _len, _ref, _results;
|
182
|
-
_ref = this.markers;
|
183
|
-
_results = [];
|
184
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
185
|
-
marker = _ref[_i];
|
186
|
-
_results.push(this.showMarker(marker));
|
187
|
-
}
|
188
|
-
return _results;
|
189
|
-
};
|
190
|
-
|
191
|
-
Gmaps4RailsGoogle.prototype.hideMarkers = function() {
|
192
|
-
var marker, _i, _len, _ref, _results;
|
193
|
-
_ref = this.markers;
|
194
|
-
_results = [];
|
195
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
196
|
-
marker = _ref[_i];
|
197
|
-
_results.push(this.hideMarker(marker));
|
198
|
-
}
|
199
|
-
return _results;
|
200
|
-
};
|
201
|
-
|
202
|
-
Gmaps4RailsGoogle.prototype.clearMarker = function(marker) {
|
203
|
-
return marker.serviceObject.setMap(null);
|
204
|
-
};
|
205
|
-
|
206
|
-
Gmaps4RailsGoogle.prototype.showMarker = function(marker) {
|
207
|
-
return marker.serviceObject.setVisible(true);
|
208
|
-
};
|
209
|
-
|
210
|
-
Gmaps4RailsGoogle.prototype.hideMarker = function(marker) {
|
211
|
-
return marker.serviceObject.setVisible(false);
|
212
|
-
};
|
213
|
-
|
214
|
-
Gmaps4RailsGoogle.prototype.extendBoundsWithMarkers = function() {
|
215
|
-
var marker, _i, _len, _ref, _results;
|
216
|
-
_ref = this.markers;
|
217
|
-
_results = [];
|
218
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
219
|
-
marker = _ref[_i];
|
220
|
-
_results.push(this.boundsObject.extend(marker.serviceObject.position));
|
221
|
-
}
|
222
|
-
return _results;
|
223
|
-
};
|
224
|
-
|
225
|
-
Gmaps4RailsGoogle.prototype.createClusterer = function(markers_array) {
|
226
|
-
return new MarkerClusterer(this.serviceObject, markers_array, {
|
227
|
-
maxZoom: this.markers_conf.clusterer_maxZoom,
|
228
|
-
gridSize: this.markers_conf.clusterer_gridSize,
|
229
|
-
styles: this.customClusterer()
|
230
|
-
});
|
231
|
-
};
|
232
|
-
|
233
|
-
Gmaps4RailsGoogle.prototype.clearClusterer = function() {
|
234
|
-
return this.markerClusterer.clearMarkers();
|
235
|
-
};
|
236
|
-
|
237
|
-
Gmaps4RailsGoogle.prototype.clusterize = function() {
|
238
|
-
var marker, markers_array, _i, _len, _ref;
|
239
|
-
if (this.markers_conf.do_clustering === true) {
|
240
|
-
if (this.markerClusterer !== null) this.clearClusterer();
|
241
|
-
markers_array = new Array;
|
242
|
-
_ref = this.markers;
|
243
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
244
|
-
marker = _ref[_i];
|
245
|
-
markers_array.push(marker.serviceObject);
|
246
|
-
}
|
247
|
-
return this.markerClusterer = this.createClusterer(markers_array);
|
248
|
-
}
|
249
|
-
};
|
250
|
-
|
251
|
-
Gmaps4RailsGoogle.prototype.createInfoWindow = function(marker_container) {
|
252
|
-
var boxText, currentMap;
|
253
|
-
if (typeof this.jsTemplate === "function" || (marker_container.description != null)) {
|
254
|
-
if (typeof this.jsTemplate === "function") {
|
255
|
-
marker_container.description = this.jsTemplate(marker_container);
|
256
|
-
}
|
257
|
-
if (this.markers_conf.custom_infowindow_class !== null) {
|
258
|
-
boxText = document.createElement("div");
|
259
|
-
boxText.setAttribute("class", this.markers_conf.custom_infowindow_class);
|
260
|
-
boxText.innerHTML = marker_container.description;
|
261
|
-
marker_container.infowindow = new InfoBox(this.infobox(boxText));
|
262
|
-
currentMap = this;
|
263
|
-
return google.maps.event.addListener(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, marker_container.infowindow, marker_container.serviceObject));
|
264
|
-
} else {
|
265
|
-
marker_container.infowindow = new google.maps.InfoWindow({
|
266
|
-
content: marker_container.description
|
267
|
-
});
|
268
|
-
currentMap = this;
|
269
|
-
return google.maps.event.addListener(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, marker_container.infowindow, marker_container.serviceObject));
|
270
|
-
}
|
271
|
-
}
|
272
|
-
};
|
273
|
-
|
274
|
-
Gmaps4RailsGoogle.prototype.openInfoWindow = function(currentMap, infoWindow, marker) {
|
275
|
-
return function() {
|
276
|
-
if (currentMap.visibleInfoWindow !== null) {
|
277
|
-
currentMap.visibleInfoWindow.close();
|
278
|
-
}
|
279
|
-
infoWindow.open(currentMap.serviceObject, marker);
|
280
|
-
return currentMap.visibleInfoWindow = infoWindow;
|
281
|
-
};
|
282
|
-
};
|
283
|
-
|
284
|
-
Gmaps4RailsGoogle.prototype.createKmlLayer = function(kml) {
|
285
|
-
var kml_options;
|
286
|
-
kml_options = kml.options || {};
|
287
|
-
kml_options = this.mergeObjectWithDefault(kml_options, this.kml_options);
|
288
|
-
kml = new google.maps.KmlLayer(kml.url, kml_options);
|
289
|
-
kml.setMap(this.serviceObject);
|
290
|
-
return kml;
|
291
|
-
};
|
292
|
-
|
293
|
-
Gmaps4RailsGoogle.prototype.create_polyline = function(polyline) {
|
294
|
-
var clickable, decoded_array, element, latlng, new_poly, point, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _j, _len, _len2;
|
295
|
-
polyline_coordinates = [];
|
296
|
-
for (_i = 0, _len = polyline.length; _i < _len; _i++) {
|
297
|
-
element = polyline[_i];
|
298
|
-
if (element.coded_array != null) {
|
299
|
-
decoded_array = new google.maps.geometry.encoding.decodePath(element.coded_array);
|
300
|
-
for (_j = 0, _len2 = decoded_array.length; _j < _len2; _j++) {
|
301
|
-
point = decoded_array[_j];
|
302
|
-
polyline_coordinates.push(point);
|
303
|
-
}
|
304
|
-
} else {
|
305
|
-
if (element === polyline[0]) {
|
306
|
-
strokeColor = element.strokeColor || this.polylines_conf.strokeColor;
|
307
|
-
strokeOpacity = element.strokeOpacity || this.polylines_conf.strokeOpacity;
|
308
|
-
strokeWeight = element.strokeWeight || this.polylines_conf.strokeWeight;
|
309
|
-
clickable = element.clickable || this.polylines_conf.clickable;
|
310
|
-
zIndex = element.zIndex || this.polylines_conf.zIndex;
|
311
|
-
}
|
312
|
-
if ((element.lat != null) && (element.lng != null)) {
|
313
|
-
latlng = this.createLatLng(element.lat, element.lng);
|
314
|
-
polyline_coordinates.push(latlng);
|
315
|
-
}
|
316
|
-
}
|
317
|
-
}
|
318
|
-
new_poly = new google.maps.Polyline({
|
319
|
-
path: polyline_coordinates,
|
320
|
-
strokeColor: strokeColor,
|
321
|
-
strokeOpacity: strokeOpacity,
|
322
|
-
strokeWeight: strokeWeight,
|
323
|
-
clickable: clickable,
|
324
|
-
zIndex: zIndex
|
325
|
-
});
|
326
|
-
polyline.serviceObject = new_poly;
|
327
|
-
return new_poly.setMap(this.serviceObject);
|
328
|
-
};
|
329
|
-
|
330
|
-
Gmaps4RailsGoogle.prototype.updateBoundsWithPolylines = function() {
|
331
|
-
var point, polyline, polyline_points, _i, _len, _ref, _results;
|
332
|
-
_ref = this.polylines;
|
333
|
-
_results = [];
|
334
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
335
|
-
polyline = _ref[_i];
|
336
|
-
polyline_points = polyline.serviceObject.latLngs.getArray()[0].getArray();
|
337
|
-
_results.push((function() {
|
338
|
-
var _j, _len2, _results2;
|
339
|
-
_results2 = [];
|
340
|
-
for (_j = 0, _len2 = polyline_points.length; _j < _len2; _j++) {
|
341
|
-
point = polyline_points[_j];
|
342
|
-
_results2.push(this.boundsObject.extend(point));
|
343
|
-
}
|
344
|
-
return _results2;
|
345
|
-
}).call(this));
|
346
|
-
}
|
347
|
-
return _results;
|
348
|
-
};
|
349
|
-
|
350
|
-
Gmaps4RailsGoogle.prototype.create_kml = function() {
|
351
|
-
var kml, _i, _len, _ref, _results;
|
352
|
-
_ref = this.kml;
|
353
|
-
_results = [];
|
354
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
355
|
-
kml = _ref[_i];
|
356
|
-
_results.push(kml.serviceObject = this.createKmlLayer(kml));
|
357
|
-
}
|
358
|
-
return _results;
|
359
|
-
};
|
360
|
-
|
361
|
-
Gmaps4RailsGoogle.prototype.fitBounds = function() {
|
362
|
-
if (!this.boundsObject.isEmpty()) {
|
363
|
-
return this.serviceObject.fitBounds(this.boundsObject);
|
364
|
-
}
|
365
|
-
};
|
366
|
-
|
367
|
-
Gmaps4RailsGoogle.prototype.centerMapOnUser = function() {
|
368
|
-
return this.serviceObject.setCenter(this.userLocation);
|
369
|
-
};
|
370
|
-
|
371
|
-
Gmaps4RailsGoogle.prototype.updateBoundsWithPolygons = function() {
|
372
|
-
var point, polygon, polygon_points, _i, _len, _ref, _results;
|
373
|
-
_ref = this.polygons;
|
374
|
-
_results = [];
|
375
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
376
|
-
polygon = _ref[_i];
|
377
|
-
polygon_points = polygon.serviceObject.latLngs.getArray()[0].getArray();
|
378
|
-
_results.push((function() {
|
379
|
-
var _j, _len2, _results2;
|
380
|
-
_results2 = [];
|
381
|
-
for (_j = 0, _len2 = polygon_points.length; _j < _len2; _j++) {
|
382
|
-
point = polygon_points[_j];
|
383
|
-
_results2.push(this.boundsObject.extend(point));
|
384
|
-
}
|
385
|
-
return _results2;
|
386
|
-
}).call(this));
|
387
|
-
}
|
388
|
-
return _results;
|
389
|
-
};
|
390
|
-
|
391
|
-
Gmaps4RailsGoogle.prototype.updateBoundsWithCircles = function() {
|
392
|
-
var circle, _i, _len, _ref, _results;
|
393
|
-
_ref = this.circles;
|
394
|
-
_results = [];
|
395
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
396
|
-
circle = _ref[_i];
|
397
|
-
this.boundsObject.extend(circle.serviceObject.getBounds().getNorthEast());
|
398
|
-
_results.push(this.boundsObject.extend(circle.serviceObject.getBounds().getSouthWest()));
|
399
|
-
}
|
400
|
-
return _results;
|
401
|
-
};
|
402
|
-
|
403
|
-
Gmaps4RailsGoogle.prototype.extendMapBounds = function() {
|
404
|
-
var bound, _i, _len, _ref, _results;
|
405
|
-
_ref = this.map_options.bounds;
|
406
|
-
_results = [];
|
407
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
408
|
-
bound = _ref[_i];
|
409
|
-
_results.push(this.boundsObject.extend(this.createLatLng(bound.lat, bound.lng)));
|
410
|
-
}
|
411
|
-
return _results;
|
412
|
-
};
|
413
|
-
|
414
|
-
Gmaps4RailsGoogle.prototype.adaptMapToBounds = function() {
|
415
|
-
var map_center;
|
416
|
-
if (!this.map_options.auto_zoom) {
|
417
|
-
map_center = this.boundsObject.getCenter();
|
418
|
-
this.map_options.center_latitude = map_center.lat();
|
419
|
-
this.map_options.center_longitude = map_center.lng();
|
420
|
-
return this.serviceObject.setCenter(map_center);
|
421
|
-
} else {
|
422
|
-
return this.fitBounds();
|
423
|
-
}
|
424
|
-
};
|
425
|
-
|
426
|
-
return Gmaps4RailsGoogle;
|
427
|
-
|
428
|
-
})(Gmaps4Rails);
|
429
|
-
|
430
|
-
}).call(this);
|