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,145 +0,0 @@
|
|
1
|
-
#######################################################################################################
|
2
|
-
############################################## Map Quest #############################################
|
3
|
-
#######################################################################################################
|
4
|
-
# http://developer.mapquest.com/web/documentation/sdk/javascript/v7.0/api/MQA.Poi.html
|
5
|
-
|
6
|
-
class @Gmaps4RailsMapquest extends Gmaps4Rails
|
7
|
-
|
8
|
-
constructor: ->
|
9
|
-
super
|
10
|
-
#Map settings
|
11
|
-
@map_options = {type: "map"} #map type (map, sat, hyb)
|
12
|
-
@markers_conf = {}
|
13
|
-
@mergeWithDefault "markers_conf"
|
14
|
-
@mergeWithDefault "map_options"
|
15
|
-
|
16
|
-
#////////////////////////////////////////////////////
|
17
|
-
#/////////////// Basic Objects //////////////
|
18
|
-
#////////////////////////////////////////////////////
|
19
|
-
|
20
|
-
createPoint: (lat, lng) ->
|
21
|
-
return new MQA.Poi({lat: lat, lng: lng})
|
22
|
-
|
23
|
-
createLatLng: (lat, lng) ->
|
24
|
-
return {lat: lat, lng: lng}
|
25
|
-
|
26
|
-
createLatLngBounds: ->
|
27
|
-
|
28
|
-
createMap: ->
|
29
|
-
map = new MQA.TileMap( #// Constructs an instance of MQA.TileMap
|
30
|
-
document.getElementById(@map_options.id), #//the id of the element on the page you want the map to be added into
|
31
|
-
@map_options.zoom, #//intial zoom level of the map
|
32
|
-
{lat: @map_options.center_latitude, lng: @map_options.center_longitude},
|
33
|
-
@map_options.type) #//map type (map, sat, hyb)
|
34
|
-
|
35
|
-
MQA.withModule('zoomcontrol3', (->
|
36
|
-
map.addControl(
|
37
|
-
new MQA.LargeZoomControl3(),
|
38
|
-
new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT)
|
39
|
-
)
|
40
|
-
))
|
41
|
-
return map
|
42
|
-
|
43
|
-
createMarkerImage: (markerPicture, markerSize, origin, anchor, scaledSize) ->
|
44
|
-
|
45
|
-
#////////////////////////////////////////////////////
|
46
|
-
#////////////////////// Markers /////////////////////
|
47
|
-
#////////////////////////////////////////////////////
|
48
|
-
|
49
|
-
createMarker: (args)->
|
50
|
-
marker = new MQA.Poi( {lat: args.Lat, lng: args.Lng} )
|
51
|
-
|
52
|
-
if args.marker_picture != ""
|
53
|
-
icon = new MQA.Icon(args.marker_picture, args.marker_height, args.marker_width)
|
54
|
-
marker.setIcon(icon)
|
55
|
-
if args.marker_anchor != null
|
56
|
-
marker.setBias({x: args.marker_anchor[0], y: args.marker_anchor[1]})
|
57
|
-
|
58
|
-
if args.shadow_picture != ""
|
59
|
-
icon = new MQA.Icon(args.shadow_picture, args.shadow_height, args.shadow_width)
|
60
|
-
marker.setShadow(icon)
|
61
|
-
|
62
|
-
if args.shadow_anchor != null
|
63
|
-
marker.setShadowOffset({x: args.shadow_anchor[0], y: args.shadow_anchor[1]})
|
64
|
-
|
65
|
-
@addToMap marker
|
66
|
-
return marker
|
67
|
-
|
68
|
-
|
69
|
-
#// clear markers
|
70
|
-
clearMarkers: ->
|
71
|
-
for marker in markers
|
72
|
-
@clearMarker marker
|
73
|
-
|
74
|
-
#//show and hide markers
|
75
|
-
showMarkers: ->
|
76
|
-
for marker in markers
|
77
|
-
@showMarker marker
|
78
|
-
|
79
|
-
hideMarkers: ->
|
80
|
-
for marker in markers
|
81
|
-
@hideMarker marker
|
82
|
-
|
83
|
-
clearMarker: (marker) ->
|
84
|
-
@removeFromMap(marker.serviceObject)
|
85
|
-
|
86
|
-
showMarker: (marker) ->
|
87
|
-
#// marker.serviceObject
|
88
|
-
|
89
|
-
hideMarker: (marker) ->
|
90
|
-
#// marker.serviceObject
|
91
|
-
|
92
|
-
extendBoundsWithMarkers: ->
|
93
|
-
if @markers.length >=2
|
94
|
-
@boundsObject = new MQA.RectLL(@markers[0].serviceObject.latLng, @markers[1].serviceObject.latLng)
|
95
|
-
for marker in @markers
|
96
|
-
@boundsObject.extend marker.serviceObject.latLng
|
97
|
-
|
98
|
-
#////////////////////////////////////////////////////
|
99
|
-
#/////////////////// Clusterer //////////////////////
|
100
|
-
#////////////////////////////////////////////////////
|
101
|
-
|
102
|
-
createClusterer: (markers_array) ->
|
103
|
-
|
104
|
-
clearClusterer: ->
|
105
|
-
|
106
|
-
#//creates clusters
|
107
|
-
clusterize: ->
|
108
|
-
|
109
|
-
#////////////////////////////////////////////////////
|
110
|
-
#/////////////////// INFO WINDOW ////////////////////
|
111
|
-
#////////////////////////////////////////////////////
|
112
|
-
|
113
|
-
#// creates infowindows
|
114
|
-
createInfoWindow: (marker_container) ->
|
115
|
-
marker_container.serviceObject.setInfoTitleHTML(marker_container.description)
|
116
|
-
#//TODO: how to disable the mouseover display when using setInfoContentHTML?
|
117
|
-
#//marker_container.serviceObject.setInfoContentHTML(marker_container.description);
|
118
|
-
|
119
|
-
#////////////////////////////////////////////////////
|
120
|
-
#/////////////////// Other methods //////////////////
|
121
|
-
#////////////////////////////////////////////////////
|
122
|
-
|
123
|
-
fitBounds: ->
|
124
|
-
@serviceObject.zoomToRect @boundsObject if @markers.length >=2
|
125
|
-
@serviceObject.setCenter @markers[0].serviceObject.latLng if @markers.length == 1
|
126
|
-
|
127
|
-
centerMapOnUser: ->
|
128
|
-
@serviceObject.setCenter @userLocation
|
129
|
-
|
130
|
-
addToMap: (object) ->
|
131
|
-
@serviceObject.addShape object
|
132
|
-
|
133
|
-
removeFromMap: (object)->
|
134
|
-
@serviceObject.removeShape object
|
135
|
-
|
136
|
-
updateBoundsWithPolylines: ()->
|
137
|
-
|
138
|
-
updateBoundsWithPolygons: ()->
|
139
|
-
|
140
|
-
updateBoundsWithCircles: ()->
|
141
|
-
|
142
|
-
extendMapBounds :->
|
143
|
-
|
144
|
-
adaptMapToBounds: ->
|
145
|
-
@fitBounds()
|
@@ -1,261 +0,0 @@
|
|
1
|
-
#######################################################################################################
|
2
|
-
############################################## Open Layers ##########################################
|
3
|
-
#######################################################################################################
|
4
|
-
|
5
|
-
#// http://wiki.openstreetmap.org/wiki/OpenLayers
|
6
|
-
#// http://openlayers.org/dev/examples
|
7
|
-
#//http://docs.openlayers.org/contents.html
|
8
|
-
|
9
|
-
class @Gmaps4RailsOpenlayers extends Gmaps4Rails
|
10
|
-
|
11
|
-
constructor: ->
|
12
|
-
super
|
13
|
-
@map_options = {}
|
14
|
-
@mergeWithDefault "map_options"
|
15
|
-
@markers_conf = {}
|
16
|
-
@mergeWithDefault "markers_conf"
|
17
|
-
|
18
|
-
@openMarkers = null
|
19
|
-
@markersLayer = null
|
20
|
-
@markersControl = null
|
21
|
-
@polylinesLayer = null
|
22
|
-
|
23
|
-
#////////////////////////////////////////////////////
|
24
|
-
#/////////////// Basic Objects ////////////////////
|
25
|
-
#////////////////////////////////////////////////////
|
26
|
-
|
27
|
-
createPoint: (lat, lng)->
|
28
|
-
|
29
|
-
createLatLng: (lat, lng)->
|
30
|
-
return new OpenLayers.LonLat(lng, lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")) # transform from WGS 1984 to Spherical Mercator Projection
|
31
|
-
|
32
|
-
createAnchor: (offset)->
|
33
|
-
return null if offset == null
|
34
|
-
return new OpenLayers.Pixel(offset[0], offset[1])
|
35
|
-
|
36
|
-
createSize: (width, height)->
|
37
|
-
return new OpenLayers.Size(width, height)
|
38
|
-
|
39
|
-
createLatLngBounds: ->
|
40
|
-
return new OpenLayers.Bounds()
|
41
|
-
|
42
|
-
createMap: ->
|
43
|
-
#//todo add customization: kind of map and other map options
|
44
|
-
map = new OpenLayers.Map(@map_options.id)
|
45
|
-
map.addLayer(new OpenLayers.Layer.OSM())
|
46
|
-
map.setCenter(@createLatLng(@map_options.center_latitude, @map_options.center_longitude), #// Center of the map
|
47
|
-
@map_options.zoom) #// Zoom level
|
48
|
-
return map
|
49
|
-
|
50
|
-
#////////////////////////////////////////////////////
|
51
|
-
#////////////////////// Markers /////////////////////
|
52
|
-
#////////////////////////////////////////////////////
|
53
|
-
#//http://openlayers.org/dev/examples/marker-shadow.html
|
54
|
-
createMarker: (args) ->
|
55
|
-
style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default'])
|
56
|
-
style_mark.fillOpacity = 1
|
57
|
-
|
58
|
-
#//creating markers' dedicated layer
|
59
|
-
if (@markersLayer == null)
|
60
|
-
@markersLayer = new OpenLayers.Layer.Vector("Markers", null)
|
61
|
-
@serviceObject.addLayer(@markersLayer)
|
62
|
-
#//TODO move?
|
63
|
-
@markersLayer.events.register("featureselected", @markersLayer, @onFeatureSelect)
|
64
|
-
@markersLayer.events.register("featureunselected", @markersLayer, @onFeatureUnselect)
|
65
|
-
@markersControl = new OpenLayers.Control.SelectFeature(@markersLayer)
|
66
|
-
@serviceObject.addControl(@markersControl)
|
67
|
-
@markersControl.activate()
|
68
|
-
#//showing default pic if none available
|
69
|
-
if args.marker_picture == ""
|
70
|
-
#style_mark.graphicWidth = 24
|
71
|
-
style_mark.graphicHeight = 30
|
72
|
-
style_mark.externalGraphic = "http://openlayers.org/dev/img/marker-blue.png"
|
73
|
-
#//creating custom pic
|
74
|
-
else
|
75
|
-
style_mark.graphicWidth = args.marker_width
|
76
|
-
style_mark.graphicHeight = args.marker_height
|
77
|
-
style_mark.externalGraphic = args.marker_picture
|
78
|
-
#//adding anchor if any
|
79
|
-
if args.marker_anchor != null
|
80
|
-
style_mark.graphicXOffset = args.marker_anchor[0]
|
81
|
-
style_mark.graphicYOffset = args.marker_anchor[1]
|
82
|
-
#//adding shadow if any
|
83
|
-
if args.shadow_picture != ""
|
84
|
-
style_mark.backgroundGraphic = args.shadow_picture
|
85
|
-
style_mark.backgroundWidth = args.shadow_width
|
86
|
-
style_mark.backgroundHeight = args.shadow_height
|
87
|
-
#//adding shadow's anchor if any
|
88
|
-
if args.shadow_anchor != null
|
89
|
-
style_mark.backgroundXOffset = args.shadow_anchor[0]
|
90
|
-
style_mark.backgroundYOffset = args.shadow_anchor[1]
|
91
|
-
|
92
|
-
style_mark.graphicTitle = args.marker_title
|
93
|
-
marker = new OpenLayers.Feature.Vector(
|
94
|
-
new OpenLayers.Geometry.Point(args.Lng, args.Lat),
|
95
|
-
null,
|
96
|
-
style_mark)
|
97
|
-
#//changing coordinates so that it actually appears on the map!
|
98
|
-
marker.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"))
|
99
|
-
#//adding layer to the map
|
100
|
-
@markersLayer.addFeatures([marker])
|
101
|
-
|
102
|
-
return marker
|
103
|
-
|
104
|
-
#//clear markers
|
105
|
-
clearMarkers: ->
|
106
|
-
@clearMarkersLayerIfExists()
|
107
|
-
@markersLayer = null
|
108
|
-
@boundsObject = new OpenLayers.Bounds()
|
109
|
-
|
110
|
-
clearMarkersLayerIfExists: ->
|
111
|
-
@serviceObject.removeLayer(@markersLayer) if @markersLayer != null and @serviceObject.getLayer(@markersLayer.id) != null
|
112
|
-
|
113
|
-
extendBoundsWithMarkers: ->
|
114
|
-
console.log "here"
|
115
|
-
for marker in @markers
|
116
|
-
@boundsObject.extend(@createLatLng(marker.lat,marker.lng))
|
117
|
-
|
118
|
-
#////////////////////////////////////////////////////
|
119
|
-
#/////////////////// Clusterer //////////////////////
|
120
|
-
#////////////////////////////////////////////////////
|
121
|
-
#//too ugly to be considered valid :(
|
122
|
-
|
123
|
-
createClusterer: (markers_array)->
|
124
|
-
options =
|
125
|
-
pointRadius: "${radius}"
|
126
|
-
fillColor: "#ffcc66"
|
127
|
-
fillOpacity: 0.8
|
128
|
-
strokeColor: "#cc6633"
|
129
|
-
strokeWidth: "${width}"
|
130
|
-
strokeOpacity: 0.8
|
131
|
-
funcs =
|
132
|
-
context:
|
133
|
-
width: (feature) ->
|
134
|
-
return (feature.cluster) ? 2 : 1
|
135
|
-
radius: (feature) ->
|
136
|
-
pix = 2
|
137
|
-
pix = Math.min(feature.attributes.count, 7) + 2 if feature.cluster
|
138
|
-
return pix
|
139
|
-
|
140
|
-
style = new OpenLayers.Style options, funcs
|
141
|
-
|
142
|
-
strategy = new OpenLayers.Strategy.Cluster()
|
143
|
-
|
144
|
-
clusters = new OpenLayers.Layer.Vector "Clusters",
|
145
|
-
strategies: [strategy]
|
146
|
-
styleMap: new OpenLayers.StyleMap
|
147
|
-
"default": style
|
148
|
-
"select":
|
149
|
-
fillColor: "#8aeeef"
|
150
|
-
strokeColor: "#32a8a9"
|
151
|
-
|
152
|
-
@clearMarkersLayerIfExists()
|
153
|
-
@serviceObject.addLayer(clusters)
|
154
|
-
clusters.addFeatures(markers_array)
|
155
|
-
return clusters
|
156
|
-
|
157
|
-
clusterize: ->
|
158
|
-
|
159
|
-
if @markers_conf.do_clustering == true
|
160
|
-
#//first clear the existing clusterer if any
|
161
|
-
if @markerClusterer != null
|
162
|
-
@clearClusterer()
|
163
|
-
markers_array = new Array
|
164
|
-
for marker in @markers
|
165
|
-
markers_array.push(marker.serviceObject)
|
166
|
-
@markerClusterer = @createClusterer markers_array
|
167
|
-
|
168
|
-
clearClusterer: ->
|
169
|
-
@serviceObject.removeLayer @markerClusterer
|
170
|
-
|
171
|
-
#////////////////////////////////////////////////////
|
172
|
-
#/////////////////// INFO WINDOW ////////////////////
|
173
|
-
#////////////////////////////////////////////////////
|
174
|
-
|
175
|
-
#// creates infowindows
|
176
|
-
createInfoWindow: (marker_container) ->
|
177
|
-
marker_container.serviceObject.infoWindow = marker_container.description if marker_container.description?
|
178
|
-
|
179
|
-
onPopupClose: (evt) ->
|
180
|
-
#// 'this' is the popup.
|
181
|
-
@markersControl.unselect @feature
|
182
|
-
|
183
|
-
onFeatureSelect: (evt) ->
|
184
|
-
feature = evt.feature
|
185
|
-
popup = new OpenLayers.Popup.FramedCloud("featurePopup",
|
186
|
-
feature.geometry.getBounds().getCenterLonLat(),
|
187
|
-
new OpenLayers.Size(300,200),
|
188
|
-
feature.infoWindow,
|
189
|
-
null, true, @onPopupClose)
|
190
|
-
feature.popup = popup
|
191
|
-
popup.feature = feature
|
192
|
-
@map.addPopup popup
|
193
|
-
|
194
|
-
onFeatureUnselect: (evt) ->
|
195
|
-
feature = evt.feature
|
196
|
-
if feature.popup
|
197
|
-
#//popup.feature = null;
|
198
|
-
@map.removePopup feature.popup
|
199
|
-
feature.popup.destroy()
|
200
|
-
feature.popup = null
|
201
|
-
|
202
|
-
#////////////////////////////////////////////////////
|
203
|
-
#/////////////////// POLYLINES //////////////////////
|
204
|
-
#////////////////////////////////////////////////////
|
205
|
-
|
206
|
-
create_polyline : (polyline) ->
|
207
|
-
|
208
|
-
if(@polylinesLayer == null)
|
209
|
-
@polylinesLayer = new OpenLayers.Layer.Vector("Polylines", null)
|
210
|
-
@serviceObject.addLayer(@polylinesLayer)
|
211
|
-
@polylinesLayer.events.register("featureselected", @polylinesLayer, @onFeatureSelect)
|
212
|
-
@polylinesLayer.events.register("featureunselected", @polylinesLayer, @onFeatureUnselect)
|
213
|
-
@polylinesControl = new OpenLayers.Control.DrawFeature(@polylinesLayer, OpenLayers.Handler.Path)
|
214
|
-
@serviceObject.addControl(@polylinesControl)
|
215
|
-
|
216
|
-
polyline_coordinates = []
|
217
|
-
|
218
|
-
for element in polyline
|
219
|
-
#by convention, a single polyline could be customized in the first array or it uses default values
|
220
|
-
if element == polyline[0]
|
221
|
-
strokeColor = element.strokeColor || @polylines_conf.strokeColor
|
222
|
-
strokeOpacity = element.strokeOpacity || @polylines_conf.strokeOpacity
|
223
|
-
strokeWeight = element.strokeWeight || @polylines_conf.strokeWeight
|
224
|
-
clickable = element.clickable || @polylines_conf.clickable
|
225
|
-
zIndex = element.zIndex || @polylines_conf.zIndex
|
226
|
-
|
227
|
-
#add latlng if positions provided
|
228
|
-
if element.lat? && element.lng?
|
229
|
-
latlng = new OpenLayers.Geometry.Point(element.lng, element.lat)
|
230
|
-
polyline_coordinates.push(latlng)
|
231
|
-
|
232
|
-
line_points = new OpenLayers.Geometry.LineString(polyline_coordinates);
|
233
|
-
line_style = { strokeColor: strokeColor, strokeOpacity: strokeOpacity, 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
|
-
|
238
|
-
@polylinesLayer.addFeatures([polyline])
|
239
|
-
|
240
|
-
return polyline
|
241
|
-
|
242
|
-
updateBoundsWithPolylines: ()->
|
243
|
-
|
244
|
-
updateBoundsWithPolygons: ()->
|
245
|
-
|
246
|
-
updateBoundsWithCircles: ()->
|
247
|
-
|
248
|
-
# #////////////////////////////////////////////////////
|
249
|
-
# #/////////////////// Other methods //////////////////
|
250
|
-
# #////////////////////////////////////////////////////
|
251
|
-
|
252
|
-
fitBounds: ->
|
253
|
-
@serviceObject.zoomToExtent(@boundsObject, true)
|
254
|
-
|
255
|
-
centerMapOnUser: ->
|
256
|
-
@serviceObject.setCenter @userLocation
|
257
|
-
|
258
|
-
extendMapBounds :->
|
259
|
-
|
260
|
-
adaptMapToBounds: ->
|
261
|
-
@fitBounds()
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<% content_for :scripts do %>
|
2
|
-
<%= javascript_include_tag *js_dependencies %>
|
3
|
-
|
4
|
-
<script type="text/javascript">
|
5
|
-
<%=raw options.to_gmaps4rails %>
|
6
|
-
</script>
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
<% case dom.map_provider %>
|
10
|
-
<% when "mapquest" %>
|
11
|
-
<div id="<%= dom.map_id %>" style="width:750px; height:475px;">
|
12
|
-
<!-- TODO: change this style dynamically -->
|
13
|
-
</div>
|
14
|
-
<% when "bing" %>
|
15
|
-
<div id="<%= dom.map_id %>" class="<%= dom.map_class %>"></div>
|
16
|
-
<% else %>
|
17
|
-
<div class="<%= dom.container_class %>">
|
18
|
-
<div id="<%= dom.map_id %>" class="<%= dom.map_class %>"></div>
|
19
|
-
</div>
|
20
|
-
<% end %>
|
data/gmaps4rails.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
|
3
|
-
# Maintain your gem's version:
|
4
|
-
require "gmaps4rails/version"
|
5
|
-
|
6
|
-
# Describe your gem and declare its dependencies:
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "gmaps4rails"
|
9
|
-
s.version = Gmaps4rails::VERSION
|
10
|
-
s.authors = [%q{Benjamin Roth}, %q{David Ruyer}]
|
11
|
-
s.email = [%q{apnea.diving.deep@gmail.com}, %q{david.ruyer@gmail.com}]
|
12
|
-
s.homepage = %q{http://github.com/apneadiving/Google-Maps-for-Rails}
|
13
|
-
s.summary = %q{Maps made easy for Rails 3}
|
14
|
-
s.description = %q{Enables easy display of items (taken from a Rails 3 model) on a Google Maps (JS API V3), OpenLayers, Mapquest and Bing. Geocoding + Directions included.}
|
15
|
-
s.files = `git ls-files`.split("\n")
|
16
|
-
s.test_files = `git ls-files -- spec/*`.split("\n")
|
17
|
-
|
18
|
-
s.add_development_dependency "rails", "~> 3.2.1"
|
19
|
-
s.add_development_dependency "sqlite3"
|
20
|
-
s.add_development_dependency "mongoid", "~> 3" if RUBY_VERSION == "1.9.3"
|
21
|
-
s.add_development_dependency 'jquery-rails'
|
22
|
-
s.add_development_dependency "rspec-rails"
|
23
|
-
s.add_development_dependency 'database_cleaner'
|
24
|
-
#s.add_development_dependency "capybara"
|
25
|
-
#s.add_development_dependency 'launchy'
|
26
|
-
|
27
|
-
s.add_development_dependency "jasmine"
|
28
|
-
|
29
|
-
s.add_development_dependency "guard", "~> 1.0.1"
|
30
|
-
s.add_development_dependency "guard-spork"
|
31
|
-
s.add_development_dependency 'guard-coffeescript'
|
32
|
-
s.add_development_dependency 'guard-jasmine'
|
33
|
-
s.add_development_dependency "guard-rspec"
|
34
|
-
|
35
|
-
s.add_development_dependency "factory_girl_rails"
|
36
|
-
s.add_development_dependency "webmock"
|
37
|
-
|
38
|
-
s.add_development_dependency 'pry'
|
39
|
-
end
|