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,178 +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.Gmaps4RailsMapquest = (function(_super) {
|
6
|
-
|
7
|
-
__extends(Gmaps4RailsMapquest, _super);
|
8
|
-
|
9
|
-
function Gmaps4RailsMapquest() {
|
10
|
-
Gmaps4RailsMapquest.__super__.constructor.apply(this, arguments);
|
11
|
-
this.map_options = {
|
12
|
-
type: "map"
|
13
|
-
};
|
14
|
-
this.markers_conf = {};
|
15
|
-
this.mergeWithDefault("markers_conf");
|
16
|
-
this.mergeWithDefault("map_options");
|
17
|
-
}
|
18
|
-
|
19
|
-
Gmaps4RailsMapquest.prototype.createPoint = function(lat, lng) {
|
20
|
-
return new MQA.Poi({
|
21
|
-
lat: lat,
|
22
|
-
lng: lng
|
23
|
-
});
|
24
|
-
};
|
25
|
-
|
26
|
-
Gmaps4RailsMapquest.prototype.createLatLng = function(lat, lng) {
|
27
|
-
return {
|
28
|
-
lat: lat,
|
29
|
-
lng: lng
|
30
|
-
};
|
31
|
-
};
|
32
|
-
|
33
|
-
Gmaps4RailsMapquest.prototype.createLatLngBounds = function() {};
|
34
|
-
|
35
|
-
Gmaps4RailsMapquest.prototype.createMap = function() {
|
36
|
-
var map;
|
37
|
-
map = new MQA.TileMap(document.getElementById(this.map_options.id), this.map_options.zoom, {
|
38
|
-
lat: this.map_options.center_latitude,
|
39
|
-
lng: this.map_options.center_longitude
|
40
|
-
}, this.map_options.type);
|
41
|
-
MQA.withModule('zoomcontrol3', (function() {
|
42
|
-
return map.addControl(new MQA.LargeZoomControl3(), new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT));
|
43
|
-
}));
|
44
|
-
return map;
|
45
|
-
};
|
46
|
-
|
47
|
-
Gmaps4RailsMapquest.prototype.createMarkerImage = function(markerPicture, markerSize, origin, anchor, scaledSize) {};
|
48
|
-
|
49
|
-
Gmaps4RailsMapquest.prototype.createMarker = function(args) {
|
50
|
-
var icon, marker;
|
51
|
-
marker = new MQA.Poi({
|
52
|
-
lat: args.Lat,
|
53
|
-
lng: args.Lng
|
54
|
-
});
|
55
|
-
if (args.marker_picture !== "") {
|
56
|
-
icon = new MQA.Icon(args.marker_picture, args.marker_height, args.marker_width);
|
57
|
-
marker.setIcon(icon);
|
58
|
-
if (args.marker_anchor !== null) {
|
59
|
-
marker.setBias({
|
60
|
-
x: args.marker_anchor[0],
|
61
|
-
y: args.marker_anchor[1]
|
62
|
-
});
|
63
|
-
}
|
64
|
-
}
|
65
|
-
if (args.shadow_picture !== "") {
|
66
|
-
icon = new MQA.Icon(args.shadow_picture, args.shadow_height, args.shadow_width);
|
67
|
-
marker.setShadow(icon);
|
68
|
-
if (args.shadow_anchor !== null) {
|
69
|
-
marker.setShadowOffset({
|
70
|
-
x: args.shadow_anchor[0],
|
71
|
-
y: args.shadow_anchor[1]
|
72
|
-
});
|
73
|
-
}
|
74
|
-
}
|
75
|
-
this.addToMap(marker);
|
76
|
-
return marker;
|
77
|
-
};
|
78
|
-
|
79
|
-
Gmaps4RailsMapquest.prototype.clearMarkers = function() {
|
80
|
-
var marker, _i, _len, _results;
|
81
|
-
_results = [];
|
82
|
-
for (_i = 0, _len = markers.length; _i < _len; _i++) {
|
83
|
-
marker = markers[_i];
|
84
|
-
_results.push(this.clearMarker(marker));
|
85
|
-
}
|
86
|
-
return _results;
|
87
|
-
};
|
88
|
-
|
89
|
-
Gmaps4RailsMapquest.prototype.showMarkers = function() {
|
90
|
-
var marker, _i, _len, _results;
|
91
|
-
_results = [];
|
92
|
-
for (_i = 0, _len = markers.length; _i < _len; _i++) {
|
93
|
-
marker = markers[_i];
|
94
|
-
_results.push(this.showMarker(marker));
|
95
|
-
}
|
96
|
-
return _results;
|
97
|
-
};
|
98
|
-
|
99
|
-
Gmaps4RailsMapquest.prototype.hideMarkers = function() {
|
100
|
-
var marker, _i, _len, _results;
|
101
|
-
_results = [];
|
102
|
-
for (_i = 0, _len = markers.length; _i < _len; _i++) {
|
103
|
-
marker = markers[_i];
|
104
|
-
_results.push(this.hideMarker(marker));
|
105
|
-
}
|
106
|
-
return _results;
|
107
|
-
};
|
108
|
-
|
109
|
-
Gmaps4RailsMapquest.prototype.clearMarker = function(marker) {
|
110
|
-
return this.removeFromMap(marker.serviceObject);
|
111
|
-
};
|
112
|
-
|
113
|
-
Gmaps4RailsMapquest.prototype.showMarker = function(marker) {};
|
114
|
-
|
115
|
-
Gmaps4RailsMapquest.prototype.hideMarker = function(marker) {};
|
116
|
-
|
117
|
-
Gmaps4RailsMapquest.prototype.extendBoundsWithMarkers = function() {
|
118
|
-
var marker, _i, _len, _ref, _results;
|
119
|
-
if (this.markers.length >= 2) {
|
120
|
-
this.boundsObject = new MQA.RectLL(this.markers[0].serviceObject.latLng, this.markers[1].serviceObject.latLng);
|
121
|
-
_ref = this.markers;
|
122
|
-
_results = [];
|
123
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
124
|
-
marker = _ref[_i];
|
125
|
-
_results.push(this.boundsObject.extend(marker.serviceObject.latLng));
|
126
|
-
}
|
127
|
-
return _results;
|
128
|
-
}
|
129
|
-
};
|
130
|
-
|
131
|
-
Gmaps4RailsMapquest.prototype.createClusterer = function(markers_array) {};
|
132
|
-
|
133
|
-
Gmaps4RailsMapquest.prototype.clearClusterer = function() {};
|
134
|
-
|
135
|
-
Gmaps4RailsMapquest.prototype.clusterize = function() {};
|
136
|
-
|
137
|
-
Gmaps4RailsMapquest.prototype.createInfoWindow = function(marker_container) {
|
138
|
-
return marker_container.serviceObject.setInfoTitleHTML(marker_container.description);
|
139
|
-
};
|
140
|
-
|
141
|
-
Gmaps4RailsMapquest.prototype.fitBounds = function() {
|
142
|
-
if (this.markers.length >= 2) {
|
143
|
-
this.serviceObject.zoomToRect(this.boundsObject);
|
144
|
-
}
|
145
|
-
if (this.markers.length === 1) {
|
146
|
-
return this.serviceObject.setCenter(this.markers[0].serviceObject.latLng);
|
147
|
-
}
|
148
|
-
};
|
149
|
-
|
150
|
-
Gmaps4RailsMapquest.prototype.centerMapOnUser = function() {
|
151
|
-
return this.serviceObject.setCenter(this.userLocation);
|
152
|
-
};
|
153
|
-
|
154
|
-
Gmaps4RailsMapquest.prototype.addToMap = function(object) {
|
155
|
-
return this.serviceObject.addShape(object);
|
156
|
-
};
|
157
|
-
|
158
|
-
Gmaps4RailsMapquest.prototype.removeFromMap = function(object) {
|
159
|
-
return this.serviceObject.removeShape(object);
|
160
|
-
};
|
161
|
-
|
162
|
-
Gmaps4RailsMapquest.prototype.updateBoundsWithPolylines = function() {};
|
163
|
-
|
164
|
-
Gmaps4RailsMapquest.prototype.updateBoundsWithPolygons = function() {};
|
165
|
-
|
166
|
-
Gmaps4RailsMapquest.prototype.updateBoundsWithCircles = function() {};
|
167
|
-
|
168
|
-
Gmaps4RailsMapquest.prototype.extendMapBounds = function() {};
|
169
|
-
|
170
|
-
Gmaps4RailsMapquest.prototype.adaptMapToBounds = function() {
|
171
|
-
return this.fitBounds();
|
172
|
-
};
|
173
|
-
|
174
|
-
return Gmaps4RailsMapquest;
|
175
|
-
|
176
|
-
})(Gmaps4Rails);
|
177
|
-
|
178
|
-
}).call(this);
|
@@ -1,265 +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.Gmaps4RailsOpenlayers = (function(_super) {
|
6
|
-
|
7
|
-
__extends(Gmaps4RailsOpenlayers, _super);
|
8
|
-
|
9
|
-
function Gmaps4RailsOpenlayers() {
|
10
|
-
Gmaps4RailsOpenlayers.__super__.constructor.apply(this, arguments);
|
11
|
-
this.map_options = {};
|
12
|
-
this.mergeWithDefault("map_options");
|
13
|
-
this.markers_conf = {};
|
14
|
-
this.mergeWithDefault("markers_conf");
|
15
|
-
this.openMarkers = null;
|
16
|
-
this.markersLayer = null;
|
17
|
-
this.markersControl = null;
|
18
|
-
this.polylinesLayer = null;
|
19
|
-
}
|
20
|
-
|
21
|
-
Gmaps4RailsOpenlayers.prototype.createPoint = function(lat, lng) {};
|
22
|
-
|
23
|
-
Gmaps4RailsOpenlayers.prototype.createLatLng = function(lat, lng) {
|
24
|
-
return new OpenLayers.LonLat(lng, lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
|
25
|
-
};
|
26
|
-
|
27
|
-
Gmaps4RailsOpenlayers.prototype.createAnchor = function(offset) {
|
28
|
-
if (offset === null) return null;
|
29
|
-
return new OpenLayers.Pixel(offset[0], offset[1]);
|
30
|
-
};
|
31
|
-
|
32
|
-
Gmaps4RailsOpenlayers.prototype.createSize = function(width, height) {
|
33
|
-
return new OpenLayers.Size(width, height);
|
34
|
-
};
|
35
|
-
|
36
|
-
Gmaps4RailsOpenlayers.prototype.createLatLngBounds = function() {
|
37
|
-
return new OpenLayers.Bounds();
|
38
|
-
};
|
39
|
-
|
40
|
-
Gmaps4RailsOpenlayers.prototype.createMap = function() {
|
41
|
-
var map;
|
42
|
-
map = new OpenLayers.Map(this.map_options.id);
|
43
|
-
map.addLayer(new OpenLayers.Layer.OSM());
|
44
|
-
map.setCenter(this.createLatLng(this.map_options.center_latitude, this.map_options.center_longitude), this.map_options.zoom);
|
45
|
-
return map;
|
46
|
-
};
|
47
|
-
|
48
|
-
Gmaps4RailsOpenlayers.prototype.createMarker = function(args) {
|
49
|
-
var marker, style_mark;
|
50
|
-
style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
|
51
|
-
style_mark.fillOpacity = 1;
|
52
|
-
if (this.markersLayer === null) {
|
53
|
-
this.markersLayer = new OpenLayers.Layer.Vector("Markers", null);
|
54
|
-
this.serviceObject.addLayer(this.markersLayer);
|
55
|
-
this.markersLayer.events.register("featureselected", this.markersLayer, this.onFeatureSelect);
|
56
|
-
this.markersLayer.events.register("featureunselected", this.markersLayer, this.onFeatureUnselect);
|
57
|
-
this.markersControl = new OpenLayers.Control.SelectFeature(this.markersLayer);
|
58
|
-
this.serviceObject.addControl(this.markersControl);
|
59
|
-
this.markersControl.activate();
|
60
|
-
}
|
61
|
-
if (args.marker_picture === "") {
|
62
|
-
style_mark.graphicHeight = 30;
|
63
|
-
style_mark.externalGraphic = "http://openlayers.org/dev/img/marker-blue.png";
|
64
|
-
} else {
|
65
|
-
style_mark.graphicWidth = args.marker_width;
|
66
|
-
style_mark.graphicHeight = args.marker_height;
|
67
|
-
style_mark.externalGraphic = args.marker_picture;
|
68
|
-
if (args.marker_anchor !== null) {
|
69
|
-
style_mark.graphicXOffset = args.marker_anchor[0];
|
70
|
-
style_mark.graphicYOffset = args.marker_anchor[1];
|
71
|
-
}
|
72
|
-
if (args.shadow_picture !== "") {
|
73
|
-
style_mark.backgroundGraphic = args.shadow_picture;
|
74
|
-
style_mark.backgroundWidth = args.shadow_width;
|
75
|
-
style_mark.backgroundHeight = args.shadow_height;
|
76
|
-
if (args.shadow_anchor !== null) {
|
77
|
-
style_mark.backgroundXOffset = args.shadow_anchor[0];
|
78
|
-
style_mark.backgroundYOffset = args.shadow_anchor[1];
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
style_mark.graphicTitle = args.title;
|
83
|
-
marker = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(args.Lng, args.Lat), null, style_mark);
|
84
|
-
marker.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
|
85
|
-
this.markersLayer.addFeatures([marker]);
|
86
|
-
return marker;
|
87
|
-
};
|
88
|
-
|
89
|
-
Gmaps4RailsOpenlayers.prototype.clearMarkers = function() {
|
90
|
-
this.clearMarkersLayerIfExists();
|
91
|
-
this.markersLayer = null;
|
92
|
-
return this.boundsObject = new OpenLayers.Bounds();
|
93
|
-
};
|
94
|
-
|
95
|
-
Gmaps4RailsOpenlayers.prototype.clearMarkersLayerIfExists = function() {
|
96
|
-
if (this.markersLayer !== null && this.serviceObject.getLayer(this.markersLayer.id) !== null) {
|
97
|
-
return this.serviceObject.removeLayer(this.markersLayer);
|
98
|
-
}
|
99
|
-
};
|
100
|
-
|
101
|
-
Gmaps4RailsOpenlayers.prototype.extendBoundsWithMarkers = function() {
|
102
|
-
var marker, _i, _len, _ref, _results;
|
103
|
-
console.log("here");
|
104
|
-
_ref = this.markers;
|
105
|
-
_results = [];
|
106
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
107
|
-
marker = _ref[_i];
|
108
|
-
_results.push(this.boundsObject.extend(this.createLatLng(marker.lat, marker.lng)));
|
109
|
-
}
|
110
|
-
return _results;
|
111
|
-
};
|
112
|
-
|
113
|
-
Gmaps4RailsOpenlayers.prototype.createClusterer = function(markers_array) {
|
114
|
-
var clusters, funcs, options, strategy, style;
|
115
|
-
options = {
|
116
|
-
pointRadius: "${radius}",
|
117
|
-
fillColor: "#ffcc66",
|
118
|
-
fillOpacity: 0.8,
|
119
|
-
strokeColor: "#cc6633",
|
120
|
-
strokeWidth: "${width}",
|
121
|
-
strokeOpacity: 0.8
|
122
|
-
};
|
123
|
-
funcs = {
|
124
|
-
context: {
|
125
|
-
width: function(feature) {
|
126
|
-
var _ref;
|
127
|
-
return (_ref = feature.cluster) != null ? _ref : {
|
128
|
-
2: 1
|
129
|
-
};
|
130
|
-
},
|
131
|
-
radius: function(feature) {
|
132
|
-
var pix;
|
133
|
-
pix = 2;
|
134
|
-
if (feature.cluster) pix = Math.min(feature.attributes.count, 7) + 2;
|
135
|
-
return pix;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
};
|
139
|
-
style = new OpenLayers.Style(options, funcs);
|
140
|
-
strategy = new OpenLayers.Strategy.Cluster();
|
141
|
-
clusters = new OpenLayers.Layer.Vector("Clusters", {
|
142
|
-
strategies: [strategy],
|
143
|
-
styleMap: new OpenLayers.StyleMap({
|
144
|
-
"default": style,
|
145
|
-
"select": {
|
146
|
-
fillColor: "#8aeeef",
|
147
|
-
strokeColor: "#32a8a9"
|
148
|
-
}
|
149
|
-
})
|
150
|
-
});
|
151
|
-
this.clearMarkersLayerIfExists();
|
152
|
-
this.serviceObject.addLayer(clusters);
|
153
|
-
clusters.addFeatures(markers_array);
|
154
|
-
return clusters;
|
155
|
-
};
|
156
|
-
|
157
|
-
Gmaps4RailsOpenlayers.prototype.clusterize = function() {
|
158
|
-
var marker, markers_array, _i, _len, _ref;
|
159
|
-
if (this.markers_conf.do_clustering === true) {
|
160
|
-
if (this.markerClusterer !== null) this.clearClusterer();
|
161
|
-
markers_array = new Array;
|
162
|
-
_ref = this.markers;
|
163
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
164
|
-
marker = _ref[_i];
|
165
|
-
markers_array.push(marker.serviceObject);
|
166
|
-
}
|
167
|
-
return this.markerClusterer = this.createClusterer(markers_array);
|
168
|
-
}
|
169
|
-
};
|
170
|
-
|
171
|
-
Gmaps4RailsOpenlayers.prototype.clearClusterer = function() {
|
172
|
-
return this.serviceObject.removeLayer(this.markerClusterer);
|
173
|
-
};
|
174
|
-
|
175
|
-
Gmaps4RailsOpenlayers.prototype.createInfoWindow = function(marker_container) {
|
176
|
-
if (marker_container.description != null) {
|
177
|
-
return marker_container.serviceObject.infoWindow = marker_container.description;
|
178
|
-
}
|
179
|
-
};
|
180
|
-
|
181
|
-
Gmaps4RailsOpenlayers.prototype.onPopupClose = function(evt) {
|
182
|
-
return this.markersControl.unselect(this.feature);
|
183
|
-
};
|
184
|
-
|
185
|
-
Gmaps4RailsOpenlayers.prototype.onFeatureSelect = function(evt) {
|
186
|
-
var feature, popup;
|
187
|
-
feature = evt.feature;
|
188
|
-
popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 200), feature.infoWindow, null, true, this.onPopupClose);
|
189
|
-
feature.popup = popup;
|
190
|
-
popup.feature = feature;
|
191
|
-
return this.map.addPopup(popup);
|
192
|
-
};
|
193
|
-
|
194
|
-
Gmaps4RailsOpenlayers.prototype.onFeatureUnselect = function(evt) {
|
195
|
-
var feature;
|
196
|
-
feature = evt.feature;
|
197
|
-
if (feature.popup) {
|
198
|
-
this.map.removePopup(feature.popup);
|
199
|
-
feature.popup.destroy();
|
200
|
-
return feature.popup = null;
|
201
|
-
}
|
202
|
-
};
|
203
|
-
|
204
|
-
Gmaps4RailsOpenlayers.prototype.create_polyline = function(polyline) {
|
205
|
-
var clickable, element, latlng, line_points, line_style, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _len;
|
206
|
-
if (this.polylinesLayer === null) {
|
207
|
-
this.polylinesLayer = new OpenLayers.Layer.Vector("Polylines", null);
|
208
|
-
this.serviceObject.addLayer(this.polylinesLayer);
|
209
|
-
this.polylinesLayer.events.register("featureselected", this.polylinesLayer, this.onFeatureSelect);
|
210
|
-
this.polylinesLayer.events.register("featureunselected", this.polylinesLayer, this.onFeatureUnselect);
|
211
|
-
this.polylinesControl = new OpenLayers.Control.DrawFeature(this.polylinesLayer, OpenLayers.Handler.Path);
|
212
|
-
this.serviceObject.addControl(this.polylinesControl);
|
213
|
-
}
|
214
|
-
polyline_coordinates = [];
|
215
|
-
for (_i = 0, _len = polyline.length; _i < _len; _i++) {
|
216
|
-
element = polyline[_i];
|
217
|
-
if (element === polyline[0]) {
|
218
|
-
strokeColor = element.strokeColor || this.polylines_conf.strokeColor;
|
219
|
-
strokeOpacity = element.strokeOpacity || this.polylines_conf.strokeOpacity;
|
220
|
-
strokeWeight = element.strokeWeight || this.polylines_conf.strokeWeight;
|
221
|
-
clickable = element.clickable || this.polylines_conf.clickable;
|
222
|
-
zIndex = element.zIndex || this.polylines_conf.zIndex;
|
223
|
-
}
|
224
|
-
if ((element.lat != null) && (element.lng != null)) {
|
225
|
-
latlng = new OpenLayers.Geometry.Point(element.lng, element.lat);
|
226
|
-
polyline_coordinates.push(latlng);
|
227
|
-
}
|
228
|
-
}
|
229
|
-
line_points = new OpenLayers.Geometry.LineString(polyline_coordinates);
|
230
|
-
line_style = {
|
231
|
-
strokeColor: strokeColor,
|
232
|
-
strokeOpacity: strokeOpacity,
|
233
|
-
strokeWidth: strokeWeight
|
234
|
-
};
|
235
|
-
polyline = new OpenLayers.Feature.Vector(line_points, null, line_style);
|
236
|
-
polyline.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
|
237
|
-
this.polylinesLayer.addFeatures([polyline]);
|
238
|
-
return polyline;
|
239
|
-
};
|
240
|
-
|
241
|
-
Gmaps4RailsOpenlayers.prototype.updateBoundsWithPolylines = function() {};
|
242
|
-
|
243
|
-
Gmaps4RailsOpenlayers.prototype.updateBoundsWithPolygons = function() {};
|
244
|
-
|
245
|
-
Gmaps4RailsOpenlayers.prototype.updateBoundsWithCircles = function() {};
|
246
|
-
|
247
|
-
Gmaps4RailsOpenlayers.prototype.fitBounds = function() {
|
248
|
-
return this.serviceObject.zoomToExtent(this.boundsObject, true);
|
249
|
-
};
|
250
|
-
|
251
|
-
Gmaps4RailsOpenlayers.prototype.centerMapOnUser = function() {
|
252
|
-
return this.serviceObject.setCenter(this.userLocation);
|
253
|
-
};
|
254
|
-
|
255
|
-
Gmaps4RailsOpenlayers.prototype.extendMapBounds = function() {};
|
256
|
-
|
257
|
-
Gmaps4RailsOpenlayers.prototype.adaptMapToBounds = function() {
|
258
|
-
return this.fitBounds();
|
259
|
-
};
|
260
|
-
|
261
|
-
return Gmaps4RailsOpenlayers;
|
262
|
-
|
263
|
-
})(Gmaps4Rails);
|
264
|
-
|
265
|
-
}).call(this);
|
@@ -1,24 +0,0 @@
|
|
1
|
-
.map_container {
|
2
|
-
padding: 6px;
|
3
|
-
border-width: 1px;
|
4
|
-
border-style: solid;
|
5
|
-
border-color: #ccc #ccc #999 #ccc;
|
6
|
-
-webkit-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
|
7
|
-
-moz-box-shadow: rgba(64, 64, 64, 0.5) 0 2px 5px;
|
8
|
-
box-shadow: rgba(64, 64, 64, 0.1) 0 2px 5px;
|
9
|
-
width: 800px;
|
10
|
-
}
|
11
|
-
|
12
|
-
.gmaps4rails_map {
|
13
|
-
width: 800px;
|
14
|
-
height: 400px;
|
15
|
-
}
|
16
|
-
|
17
|
-
.bing_map {
|
18
|
-
position: absolute;
|
19
|
-
top: 20;
|
20
|
-
left: 10;
|
21
|
-
width: 400px;
|
22
|
-
height: 400px;
|
23
|
-
border:#555555 2px solid;
|
24
|
-
}
|