gmaps4rails 0.11.1 → 1.0.0
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/README.rdoc +6 -2
- data/app/views/gmaps4rails/_gmaps4rails.html.erb +18 -20
- data/lib/gmaps4rails/base.rb +95 -0
- data/lib/gmaps4rails/extensions/hash.rb +3 -67
- data/lib/gmaps4rails/helper/gmaps4rails_helper.rb +13 -2
- data/public/javascripts/gmaps4rails/all_apis.js +5 -0
- data/public/javascripts/gmaps4rails/gmaps4rails.base.js +147 -112
- data/public/javascripts/gmaps4rails/gmaps4rails.bing.js +182 -171
- data/public/javascripts/gmaps4rails/gmaps4rails.googlemaps.js +269 -235
- data/public/javascripts/gmaps4rails/gmaps4rails.mapquest.js +135 -125
- data/public/javascripts/gmaps4rails/gmaps4rails.openlayers.js +227 -218
- data/public/stylesheets/gmaps4rails.css +2 -2
- metadata +9 -111
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/users_controller.rb +0 -60
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/users_helper.rb +0 -3
- data/test/dummy/app/models/user.rb +0 -38
- data/test/dummy/config/application.rb +0 -41
- data/test/dummy/config/boot.rb +0 -6
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -26
- data/test/dummy/config/environments/production.rb +0 -49
- data/test/dummy/config/environments/test.rb +0 -35
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/routes.rb +0 -7
- data/test/dummy/db/migrate/20110306182914_create_users.rb +0 -21
- data/test/dummy/db/migrate/20110430081624_add_addresses_to_users.rb +0 -11
- data/test/dummy/db/migrate/20110430083824_remove_address_from_users.rb +0 -9
- data/test/dummy/db/schema.rb +0 -35
- data/test/dummy/db/seeds.rb +0 -7
- data/test/dummy/spec/base/base_spec.rb +0 -127
- data/test/dummy/spec/helpers/gmaps4rails_helper_spec.rb +0 -13
- data/test/dummy/spec/javascripts/support/jasmine_config.rb +0 -23
- data/test/dummy/spec/javascripts/support/jasmine_runner.rb +0 -20
- data/test/dummy/spec/models/user_spec.rb +0 -284
- data/test/dummy/spec/requests/users_spec.rb +0 -22
- data/test/dummy/spec/spec_helper.rb +0 -41
- data/test/dummy/spec/support/factories.rb +0 -20
- data/test/dummy/spec/support/matchers.rb +0 -7
- data/test/dummy31/app/controllers/application_controller.rb +0 -3
- data/test/dummy31/app/controllers/users_controller.rb +0 -83
- data/test/dummy31/app/helpers/application_helper.rb +0 -2
- data/test/dummy31/app/helpers/users_helper.rb +0 -2
- data/test/dummy31/app/models/user.rb +0 -7
- data/test/dummy31/config/application.rb +0 -43
- data/test/dummy31/config/boot.rb +0 -6
- data/test/dummy31/config/environment.rb +0 -5
- data/test/dummy31/config/environments/development.rb +0 -27
- data/test/dummy31/config/environments/production.rb +0 -51
- data/test/dummy31/config/environments/test.rb +0 -39
- data/test/dummy31/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy31/config/initializers/inflections.rb +0 -10
- data/test/dummy31/config/initializers/mime_types.rb +0 -5
- data/test/dummy31/config/initializers/secret_token.rb +0 -7
- data/test/dummy31/config/initializers/session_store.rb +0 -8
- data/test/dummy31/config/initializers/wrap_parameters.rb +0 -12
- data/test/dummy31/config/routes.rb +0 -61
- data/test/dummy31/db/migrate/20110809134019_create_users.rb +0 -13
- data/test/dummy31/db/schema.rb +0 -25
- data/test/dummy31/db/seeds.rb +0 -7
@@ -1,172 +1,182 @@
|
|
1
|
-
|
1
|
+
var Gmaps4RailsMapquest = function() {
|
2
2
|
|
3
|
-
//
|
4
|
-
Gmaps4Rails.map_options.type = "map"; // //map type (map, sat, hyb)
|
3
|
+
// http://www.mapquestapi.com/sdk/js/v6.0.0/poi.html
|
5
4
|
|
5
|
+
//Map settings
|
6
|
+
this.map_options = {
|
7
|
+
type: "map" // //map type (map, sat, hyb)
|
8
|
+
};
|
9
|
+
this.markers_conf = {};
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
////////////////////////////////////////////////////
|
11
|
+
this.mergeWithDefault("markers_conf");
|
12
|
+
this.mergeWithDefault("map_options");
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
////////////////////////////////////////////////////
|
15
|
+
/////////////// Basic Objects //////////////
|
16
|
+
////////////////////////////////////////////////////
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
};
|
18
|
+
this.createPoint = function(lat, lng){
|
19
|
+
return new MQA.Poi({lat: lat, lng: lng});
|
20
|
+
};
|
18
21
|
|
19
|
-
|
20
|
-
};
|
22
|
+
this.createLatLng = function(lat, lng){
|
23
|
+
return {lat: lat, lng: lng};
|
24
|
+
};
|
21
25
|
|
26
|
+
this.createLatLngBounds = function(){
|
27
|
+
};
|
22
28
|
|
23
|
-
Gmaps4Rails.createMap = function(){
|
24
|
-
var map = new MQA.TileMap( // Constructs an instance of MQA.TileMap
|
25
|
-
document.getElementById("mapQuest"), //the id of the element on the page you want the map to be added into
|
26
|
-
Gmaps4Rails.map_options.zoom, //intial zoom level of the map
|
27
|
-
{lat: Gmaps4Rails.map_options.center_latitude, //the lat/lng of the map to center on
|
28
|
-
lng: Gmaps4Rails.map_options.center_longitude},
|
29
|
-
Gmaps4Rails.map_options.type); //map type (map, sat, hyb)
|
30
|
-
MQA.withModule('zoomcontrol3', function() {
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
this.createMap = function(){
|
31
|
+
var map = new MQA.TileMap( // Constructs an instance of MQA.TileMap
|
32
|
+
document.getElementById(this.map_options.id), //the id of the element on the page you want the map to be added into
|
33
|
+
this.map_options.zoom, //intial zoom level of the map
|
34
|
+
{lat: this.map_options.center_latitude, //the lat/lng of the map to center on
|
35
|
+
lng: this.map_options.center_longitude},
|
36
|
+
this.map_options.type); //map type (map, sat, hyb)
|
37
|
+
MQA.withModule('zoomcontrol3', function() {
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
map.addControl(
|
40
|
+
new MQA.LargeZoomControl3(),
|
41
|
+
new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT)
|
42
|
+
);
|
40
43
|
|
41
|
-
|
44
|
+
});
|
45
|
+
return map;
|
46
|
+
};
|
42
47
|
|
43
|
-
|
48
|
+
this.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {
|
44
49
|
|
50
|
+
};
|
45
51
|
|
46
|
-
////////////////////////////////////////////////////
|
47
|
-
////////////////////// Markers /////////////////////
|
48
|
-
////////////////////////////////////////////////////
|
49
52
|
|
50
|
-
|
53
|
+
////////////////////////////////////////////////////
|
54
|
+
////////////////////// Markers /////////////////////
|
55
|
+
////////////////////////////////////////////////////
|
56
|
+
|
57
|
+
this.createMarker = function(args){
|
51
58
|
|
52
|
-
|
59
|
+
var marker = new MQA.Poi( {lat: args.Lat, lng: args.Lng} );
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
61
|
+
if (args.marker_picture !== "" ) {
|
62
|
+
var icon = new MQA.Icon(args.marker_picture, args.marker_height, args.marker_width);
|
63
|
+
marker.setIcon(icon);
|
64
|
+
if(args.marker_anchor !== null) {
|
65
|
+
marker.setBias({x: args.marker_anchor[0], y: args.marker_anchor[1]});
|
66
|
+
}
|
59
67
|
}
|
60
|
-
}
|
61
68
|
|
62
|
-
|
63
|
-
|
64
|
-
|
69
|
+
if (args.shadow_picture !== "" ) {
|
70
|
+
var icon = new MQA.Icon(args.shadow_picture, args.shadow_height, args.shadow_width);
|
71
|
+
marker.setShadow(icon);
|
65
72
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
73
|
+
if(args.shadow_anchor !== null) {
|
74
|
+
marker.setShadowOffset({x: args.shadow_anchor[0], y: args.shadow_anchor[1]});
|
75
|
+
}
|
76
|
+
}
|
70
77
|
|
71
|
-
|
72
|
-
|
73
|
-
};
|
78
|
+
this.addToMap(marker);
|
79
|
+
return marker;
|
80
|
+
};
|
74
81
|
|
75
82
|
|
76
|
-
// clear markers
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
};
|
83
|
+
// clear markers
|
84
|
+
this.clearMarkers = function() {
|
85
|
+
for (var i = 0; i < this.markers.length; ++i) {
|
86
|
+
this.clearMarker(this.markers[i]);
|
87
|
+
}
|
88
|
+
};
|
82
89
|
|
83
|
-
//show and hide markers
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
};
|
90
|
+
//show and hide markers
|
91
|
+
this.showMarkers = function() {
|
92
|
+
for (var i = 0; i < this.markers.length; ++i) {
|
93
|
+
this.showMarker(this.markers[i]);
|
94
|
+
}
|
95
|
+
};
|
89
96
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
};
|
97
|
+
this.hideMarkers = function() {
|
98
|
+
for (var i = 0; i < this.markers.length; ++i) {
|
99
|
+
this.hideMarker(this.markers[i]);
|
100
|
+
}
|
101
|
+
};
|
95
102
|
|
96
|
-
|
97
|
-
|
98
|
-
};
|
103
|
+
this.clearMarker = function(marker) {
|
104
|
+
this.removeFromMap(marker.serviceObject);
|
105
|
+
};
|
99
106
|
|
100
|
-
|
101
|
-
|
102
|
-
};
|
107
|
+
this.showMarker = function(marker) {
|
108
|
+
// marker.serviceObject
|
109
|
+
};
|
103
110
|
|
104
|
-
|
105
|
-
|
106
|
-
};
|
111
|
+
this.hideMarker = function(marker) {
|
112
|
+
// marker.serviceObject
|
113
|
+
};
|
107
114
|
|
108
|
-
|
115
|
+
this.extendBoundsWithMarkers = function(){
|
109
116
|
|
110
|
-
|
111
|
-
|
117
|
+
if (this.markers.length >=2) {
|
118
|
+
this.boundsObject = new MQA.RectLL(this.markers[0].serviceObject.latLng, this.markers[1].serviceObject.latLng);
|
112
119
|
|
113
|
-
|
114
|
-
|
120
|
+
for (var i = 2; i < this.markers.length; ++i) {
|
121
|
+
this.boundsObject.extend(this.markers[i].serviceObject.latLng);
|
122
|
+
}
|
115
123
|
}
|
116
|
-
}
|
117
124
|
|
118
|
-
};
|
125
|
+
};
|
119
126
|
|
120
|
-
////////////////////////////////////////////////////
|
121
|
-
/////////////////// Clusterer //////////////////////
|
122
|
-
////////////////////////////////////////////////////
|
127
|
+
////////////////////////////////////////////////////
|
128
|
+
/////////////////// Clusterer //////////////////////
|
129
|
+
////////////////////////////////////////////////////
|
123
130
|
|
124
|
-
|
131
|
+
this.createClusterer = function(markers_array){
|
125
132
|
|
126
|
-
};
|
133
|
+
};
|
127
134
|
|
128
|
-
|
135
|
+
this.clearClusterer = function() {
|
129
136
|
|
130
|
-
};
|
137
|
+
};
|
131
138
|
|
132
|
-
//creates clusters
|
133
|
-
|
134
|
-
{
|
139
|
+
//creates clusters
|
140
|
+
this.clusterize = function()
|
141
|
+
{
|
135
142
|
|
136
|
-
};
|
143
|
+
};
|
137
144
|
|
138
|
-
////////////////////////////////////////////////////
|
139
|
-
/////////////////// INFO WINDOW ////////////////////
|
140
|
-
////////////////////////////////////////////////////
|
145
|
+
////////////////////////////////////////////////////
|
146
|
+
/////////////////// INFO WINDOW ////////////////////
|
147
|
+
////////////////////////////////////////////////////
|
141
148
|
|
142
|
-
// creates infowindows
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
};
|
149
|
+
// creates infowindows
|
150
|
+
this.createInfoWindow = function(marker_container){
|
151
|
+
marker_container.serviceObject.setInfoTitleHTML(marker_container.description);
|
152
|
+
//TODO: how to disable the mouseover display when using setInfoContentHTML?
|
153
|
+
//marker_container.serviceObject.setInfoContentHTML(marker_container.description);
|
154
|
+
};
|
148
155
|
|
149
|
-
////////////////////////////////////////////////////
|
150
|
-
/////////////////// Other methods //////////////////
|
151
|
-
////////////////////////////////////////////////////
|
156
|
+
////////////////////////////////////////////////////
|
157
|
+
/////////////////// Other methods //////////////////
|
158
|
+
////////////////////////////////////////////////////
|
152
159
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
};
|
160
|
+
this.fitBounds = function(){
|
161
|
+
if (this.markers.length >=2) {
|
162
|
+
this.map.zoomToRect(this.boundsObject);
|
163
|
+
}
|
164
|
+
if (this.markers.length ==1 ) {
|
165
|
+
this.map.setCenter(this.markers[0].serviceObject.latLng);
|
166
|
+
}
|
167
|
+
};
|
161
168
|
|
162
|
-
|
163
|
-
|
164
|
-
};
|
169
|
+
this.centerMapOnUser = function(){
|
170
|
+
this.map.setCenter(this.userLocation);
|
171
|
+
};
|
165
172
|
|
166
|
-
|
167
|
-
|
168
|
-
};
|
173
|
+
this.addToMap = function(object){
|
174
|
+
this.map.addShape(object);
|
175
|
+
};
|
176
|
+
|
177
|
+
this.removeFromMap = function(object){
|
178
|
+
this.map.removeShape(object);
|
179
|
+
}
|
180
|
+
}
|
169
181
|
|
170
|
-
|
171
|
-
Gmaps4Rails.map.removeShape(object);
|
172
|
-
}
|
182
|
+
Gmaps4RailsMapquest.prototype = new Gmaps4Rails();
|