gmaps4rails 2.0.0.pre → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -4
- data/Gemfile +5 -1
- data/Gemfile.lock +31 -113
- data/README.rdoc +53 -70
- data/Rakefile +21 -1
- data/gmaps4rails.gemspec +4 -19
- data/js_compilation/gmaps_google.js +961 -0
- data/lib/generators/gmaps4rails/copy_coffee_generator.rb +14 -0
- data/lib/generators/gmaps4rails/copy_js_generator.rb +15 -0
- data/lib/gmaps4rails.rb +12 -22
- data/lib/gmaps4rails/markers_builder.rb +74 -0
- data/lib/gmaps4rails/rails/engine.rb +6 -0
- data/lib/gmaps4rails/rails/railtie.rb +6 -0
- data/lib/gmaps4rails/version.rb +2 -2
- data/script/compile_coffee_files.rb +19 -0
- data/script/gmaps4rails.rake +7 -0
- data/spec/javascripts/google/builders/marker_spec.js +96 -0
- data/spec/javascripts/helpers/SpecHelper.js +101 -0
- data/spec/javascripts/helpers/matchers.js +12 -0
- data/spec/javascripts/helpers/underscore.js +6 -0
- data/spec/javascripts/objects/handler_spec.js +320 -0
- data/spec/javascripts/support/jasmine.yml +86 -0
- data/spec/javascripts/support/jasmine_helper.rb +11 -0
- data/spec/lib/base_spec.rb +10 -52
- data/spec/lib/markers_builder_spec.rb +49 -0
- data/spec/spec_helper.rb +1 -25
- data/vendor/assets/javascripts/gmaps/base.coffee +16 -0
- data/vendor/assets/javascripts/gmaps/base/base.coffee +17 -0
- data/vendor/assets/javascripts/gmaps/google.coffee +3 -0
- data/vendor/assets/javascripts/gmaps/google/builders/bound.coffee +6 -0
- data/vendor/assets/javascripts/gmaps/google/builders/circle.coffee +21 -0
- data/vendor/assets/javascripts/gmaps/google/builders/clusterer.coffee +6 -0
- data/vendor/assets/javascripts/gmaps/google/builders/kml.coffee +17 -0
- data/vendor/assets/javascripts/gmaps/google/builders/map.coffee +27 -0
- data/vendor/assets/javascripts/gmaps/google/builders/marker.coffee +100 -0
- data/vendor/assets/javascripts/gmaps/google/builders/polygon.coffee +24 -0
- data/vendor/assets/javascripts/gmaps/google/builders/polyline.coffee +24 -0
- data/vendor/assets/javascripts/gmaps/google/objects/bound.coffee +13 -0
- data/vendor/assets/javascripts/gmaps/google/objects/circle.coffee +9 -0
- data/vendor/assets/javascripts/gmaps/google/objects/clusterer.coffee +13 -0
- data/vendor/assets/javascripts/gmaps/google/objects/common.coffee +23 -0
- data/vendor/assets/javascripts/gmaps/google/objects/kml.coffee +15 -0
- data/vendor/assets/javascripts/gmaps/google/objects/map.coffee +19 -0
- data/vendor/assets/javascripts/gmaps/google/objects/marker.coffee +11 -0
- data/vendor/assets/javascripts/gmaps/google/objects/polygon.coffee +8 -0
- data/vendor/assets/javascripts/gmaps/google/objects/polyline.coffee +8 -0
- data/vendor/assets/javascripts/gmaps/google/primitives.coffee +43 -0
- data/vendor/assets/javascripts/gmaps/objects/base_builder.coffee +20 -0
- data/vendor/assets/javascripts/gmaps/objects/builder.coffee +12 -0
- data/vendor/assets/javascripts/gmaps/objects/handler.coffee +153 -0
- data/vendor/assets/javascripts/gmaps/objects/null_clusterer.coffee +4 -0
- metadata +66 -299
- data/Guardfile.old +0 -24
- data/app/views/gmaps4rails/_gmaps4rails.html.erb +0 -20
- data/lib/generators/gmaps4rails/install_generator.rb +0 -43
- data/lib/generators/templates/README +0 -2
- 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 -126
- 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 -154
- data/lib/gmaps4rails/json_builder.rb +0 -140
- data/lib/gmaps4rails/model_handler.rb +0 -101
- data/lib/gmaps4rails/view_helper.rb +0 -172
- data/lib/tasks/jasmine.rake +0 -8
- data/public/javascripts/gmaps4rails/all.js +0 -2144
- data/public/javascripts/gmaps4rails/base.js +0 -792
- data/public/javascripts/gmaps4rails/google.js +0 -556
- data/public/javascripts/gmaps4rails/openlayers.js +0 -377
- data/public/stylesheets/gmaps4rails.css +0 -24
- data/spec/dummy/.gitignore +0 -3
- 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 -18
- 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 -105
- 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 -17
- data/spec/dummy/app/views/users/_form.html.erb +0 -37
- data/spec/dummy/app/views/users/edit.html.erb +0 -6
- data/spec/dummy/app/views/users/index.html.erb +0 -268
- 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/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/direction_spec.rb +0 -53
- data/spec/lib/geocoder_spec.rb +0 -46
- data/spec/lib/js_builder_spec.rb +0 -134
- data/spec/lib/json_builder_spec.rb +0 -232
- data/spec/lib/places_spec.rb +0 -25
- data/spec/models/place_spec.rb +0 -39
- data/spec/models/user_spec.rb +0 -187
- data/spec/support/geocoding.rb +0 -40
- data/spec/support/matchers.rb +0 -73
- data/todo +0 -0
- data/vendor/assets/javascripts/gmaps4rails/all.js +0 -1
- data/vendor/assets/javascripts/gmaps4rails/base.coffee +0 -1
- data/vendor/assets/javascripts/gmaps4rails/base/common.coffee +0 -43
- data/vendor/assets/javascripts/gmaps4rails/base/configuration.coffee +0 -7
- data/vendor/assets/javascripts/gmaps4rails/base/gmaps.coffee +0 -13
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/basic_interface.coffee +0 -15
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/controller_interface.coffee +0 -15
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/map_interface.coffee +0 -27
- data/vendor/assets/javascripts/gmaps4rails/base/interfaces/marker_interface.coffee +0 -15
- data/vendor/assets/javascripts/gmaps4rails/base/main.coffee +0 -124
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/circle_controller.coffee +0 -29
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/kml_controller.coffee +0 -5
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/marker_controller.coffee +0 -76
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polygon_controller.coffee +0 -29
- data/vendor/assets/javascripts/gmaps4rails/base/main_controller_extensions/polyline_controller.coffee +0 -29
- data/vendor/assets/javascripts/gmaps4rails/base/objects/circle.coffee +0 -12
- data/vendor/assets/javascripts/gmaps4rails/base/objects/kml.coffee +0 -8
- data/vendor/assets/javascripts/gmaps4rails/base/objects/map.coffee +0 -62
- data/vendor/assets/javascripts/gmaps4rails/base/objects/marker.coffee +0 -24
- data/vendor/assets/javascripts/gmaps4rails/base/objects/polygon.coffee +0 -11
- data/vendor/assets/javascripts/gmaps4rails/base/objects/polyline.coffee +0 -11
- data/vendor/assets/javascripts/gmaps4rails/bing.coffee +0 -1
- data/vendor/assets/javascripts/gmaps4rails/bing/main.coffee +0 -29
- data/vendor/assets/javascripts/gmaps4rails/bing/objects/map.coffee +0 -63
- data/vendor/assets/javascripts/gmaps4rails/bing/objects/marker.coffee +0 -78
- data/vendor/assets/javascripts/gmaps4rails/bing/shared.coffee +0 -20
- data/vendor/assets/javascripts/gmaps4rails/google.coffee +0 -1
- data/vendor/assets/javascripts/gmaps4rails/google/main.coffee +0 -47
- data/vendor/assets/javascripts/gmaps4rails/google/objects/circle.coffee +0 -38
- data/vendor/assets/javascripts/gmaps4rails/google/objects/kml.coffee +0 -16
- data/vendor/assets/javascripts/gmaps4rails/google/objects/map.coffee +0 -71
- data/vendor/assets/javascripts/gmaps4rails/google/objects/marker.coffee +0 -114
- data/vendor/assets/javascripts/gmaps4rails/google/objects/polygon.coffee +0 -38
- data/vendor/assets/javascripts/gmaps4rails/google/objects/polyline.coffee +0 -49
- data/vendor/assets/javascripts/gmaps4rails/google/shared.coffee +0 -27
- data/vendor/assets/javascripts/gmaps4rails/openlayers.coffee +0 -1
- data/vendor/assets/javascripts/gmaps4rails/openlayers/main.coffee +0 -138
- data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/map.coffee +0 -49
- data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/marker.coffee +0 -68
- data/vendor/assets/javascripts/gmaps4rails/openlayers/objects/polyline.coffee +0 -39
- data/vendor/assets/javascripts/gmaps4rails/openlayers/shared.coffee +0 -19
data/.travis.yml
CHANGED
@@ -3,7 +3,5 @@ rvm:
|
|
3
3
|
- 1.8.7
|
4
4
|
- 1.9.2
|
5
5
|
- 1.9.3
|
6
|
-
|
7
|
-
|
8
|
-
script: 'rspec spec'
|
9
|
-
# after_script: 'bundle exec guard-jasmine -u http://localhost:8888/'
|
6
|
+
- 2.0
|
7
|
+
script: 'bundle exec rspec spec && bundle exec rake jasmine_travis'
|
data/Gemfile
CHANGED
@@ -4,4 +4,8 @@ source "http://rubygems.org"
|
|
4
4
|
# Bundler will treat runtime dependencies like base dependencies, and
|
5
5
|
# development dependencies will be added by default to the :development group.
|
6
6
|
|
7
|
-
gemspec
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
group :development, :test do
|
10
|
+
gem 'jasmine', :platforms => [:ruby_19, :ruby_20]
|
11
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,149 +1,67 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gmaps4rails (2.0.0.
|
4
|
+
gmaps4rails (2.0.0.pre2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
mail (~> 2.4.4)
|
12
|
-
actionpack (3.2.3)
|
13
|
-
activemodel (= 3.2.3)
|
14
|
-
activesupport (= 3.2.3)
|
15
|
-
builder (~> 3.0.0)
|
16
|
-
erubis (~> 2.7.0)
|
17
|
-
journey (~> 1.0.1)
|
18
|
-
rack (~> 1.4.0)
|
19
|
-
rack-cache (~> 1.2)
|
20
|
-
rack-test (~> 0.6.1)
|
21
|
-
sprockets (~> 2.1.2)
|
22
|
-
activemodel (3.2.3)
|
23
|
-
activesupport (= 3.2.3)
|
24
|
-
builder (~> 3.0.0)
|
25
|
-
activerecord (3.2.3)
|
26
|
-
activemodel (= 3.2.3)
|
27
|
-
activesupport (= 3.2.3)
|
28
|
-
arel (~> 3.0.2)
|
29
|
-
tzinfo (~> 0.3.29)
|
30
|
-
activeresource (3.2.3)
|
31
|
-
activemodel (= 3.2.3)
|
32
|
-
activesupport (= 3.2.3)
|
33
|
-
activesupport (3.2.3)
|
34
|
-
i18n (~> 0.6)
|
35
|
-
multi_json (~> 1.0)
|
36
|
-
addressable (2.2.8)
|
37
|
-
arel (3.0.2)
|
38
|
-
builder (3.0.0)
|
9
|
+
childprocess (0.3.9)
|
10
|
+
ffi (~> 1.0, >= 1.0.11)
|
39
11
|
coderay (1.0.6)
|
40
12
|
coffee-script (2.2.0)
|
41
13
|
coffee-script-source
|
42
14
|
execjs
|
43
15
|
coffee-script-source (1.3.3)
|
44
|
-
|
45
|
-
database_cleaner (0.7.2)
|
46
|
-
diff-lcs (1.1.3)
|
47
|
-
erubis (2.7.0)
|
16
|
+
diff-lcs (1.2.4)
|
48
17
|
execjs (1.4.0)
|
49
18
|
multi_json (~> 1.0)
|
50
|
-
|
51
|
-
activesupport (>= 2.3.9)
|
52
|
-
factory_girl_rails (1.7.0)
|
53
|
-
factory_girl (~> 2.6.0)
|
54
|
-
railties (>= 3.0.0)
|
19
|
+
ffi (1.9.0)
|
55
20
|
hike (1.2.1)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
mail (2.4.4)
|
63
|
-
i18n (>= 0.4.0)
|
64
|
-
mime-types (~> 1.16)
|
65
|
-
treetop (~> 1.4.8)
|
21
|
+
jasmine (1.3.2)
|
22
|
+
jasmine-core (~> 1.3.1)
|
23
|
+
rack (~> 1.0)
|
24
|
+
rspec (>= 1.3.1)
|
25
|
+
selenium-webdriver (>= 0.1.3)
|
26
|
+
jasmine-core (1.3.1)
|
66
27
|
method_source (0.7.1)
|
67
|
-
mime-types (1.18)
|
68
|
-
mongoid (3.0.6)
|
69
|
-
activemodel (~> 3.1)
|
70
|
-
moped (~> 1.1)
|
71
|
-
origin (~> 1.0)
|
72
|
-
tzinfo (~> 0.3.22)
|
73
|
-
moped (1.2.5)
|
74
28
|
multi_json (1.2.0)
|
75
|
-
origin (1.0.9)
|
76
|
-
polyglot (0.3.3)
|
77
29
|
pry (0.9.8.4)
|
78
30
|
coderay (~> 1.0.5)
|
79
31
|
method_source (~> 0.7.1)
|
80
32
|
slop (>= 2.4.4, < 3)
|
81
33
|
rack (1.4.1)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
actionpack (= 3.2.3)
|
98
|
-
activesupport (= 3.2.3)
|
99
|
-
rack-ssl (~> 1.3.2)
|
100
|
-
rake (>= 0.8.7)
|
101
|
-
rdoc (~> 3.4)
|
102
|
-
thor (~> 0.14.6)
|
103
|
-
rake (0.9.2.2)
|
104
|
-
rdoc (3.12)
|
105
|
-
json (~> 1.4)
|
106
|
-
rspec (2.8.0)
|
107
|
-
rspec-core (~> 2.8.0)
|
108
|
-
rspec-expectations (~> 2.8.0)
|
109
|
-
rspec-mocks (~> 2.8.0)
|
110
|
-
rspec-core (2.8.0)
|
111
|
-
rspec-expectations (2.8.0)
|
112
|
-
diff-lcs (~> 1.1.2)
|
113
|
-
rspec-mocks (2.8.0)
|
114
|
-
rspec-rails (2.8.1)
|
115
|
-
actionpack (>= 3.0)
|
116
|
-
activesupport (>= 3.0)
|
117
|
-
railties (>= 3.0)
|
118
|
-
rspec (~> 2.8.0)
|
34
|
+
rake (10.1.0)
|
35
|
+
rspec (2.14.0)
|
36
|
+
rspec-core (~> 2.14.0)
|
37
|
+
rspec-expectations (~> 2.14.0)
|
38
|
+
rspec-mocks (~> 2.14.0)
|
39
|
+
rspec-core (2.14.6)
|
40
|
+
rspec-expectations (2.14.3)
|
41
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
42
|
+
rspec-mocks (2.14.4)
|
43
|
+
rubyzip (1.0.0)
|
44
|
+
selenium-webdriver (2.37.0)
|
45
|
+
childprocess (>= 0.2.5)
|
46
|
+
multi_json (~> 1.0)
|
47
|
+
rubyzip (~> 1.0.0)
|
48
|
+
websocket (~> 1.0.4)
|
119
49
|
slop (2.4.4)
|
120
50
|
sprockets (2.1.2)
|
121
51
|
hike (~> 1.2)
|
122
52
|
rack (~> 1.0)
|
123
53
|
tilt (~> 1.1, != 1.3.0)
|
124
|
-
sqlite3 (1.3.5)
|
125
|
-
thor (0.14.6)
|
126
54
|
tilt (1.3.3)
|
127
|
-
|
128
|
-
polyglot
|
129
|
-
polyglot (>= 0.3.1)
|
130
|
-
tzinfo (0.3.32)
|
131
|
-
webmock (1.8.7)
|
132
|
-
addressable (>= 2.2.7)
|
133
|
-
crack (>= 0.1.7)
|
55
|
+
websocket (1.0.7)
|
134
56
|
|
135
57
|
PLATFORMS
|
136
58
|
ruby
|
137
59
|
|
138
60
|
DEPENDENCIES
|
139
61
|
coffee-script
|
140
|
-
database_cleaner
|
141
|
-
factory_girl_rails
|
142
62
|
gmaps4rails!
|
143
|
-
|
144
|
-
mongoid (~> 3)
|
63
|
+
jasmine
|
145
64
|
pry
|
146
|
-
|
147
|
-
rspec
|
148
|
-
|
149
|
-
webmock
|
65
|
+
rake (= 10.1.0)
|
66
|
+
rspec (= 2.14.0)
|
67
|
+
sprockets
|
data/README.rdoc
CHANGED
@@ -1,20 +1,8 @@
|
|
1
|
-
== Google Maps for Rails (gmaps4rails) {<img src="https://secure.travis-ci.org/apneadiving/Google-Maps-for-Rails.png?branch=master" alt="Build Status" />}[http://travis-ci.org/apneadiving/Google-Maps-for-Rails] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/apneadiving/Google-Maps-for-Rails]
|
1
|
+
== Google Maps for Rails (gmaps4rails) {<img src="https://secure.travis-ci.org/apneadiving/Google-Maps-for-Rails.png?branch=master" alt="Build Status" />}[http://travis-ci.org/apneadiving/Google-Maps-for-Rails] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/apneadiving/Google-Maps-for-Rails] {<img src="http://api.coderwall.com/apneadiving/endorsecount.png" alt="Endorse" />}[http://coderwall.com/apneadiving]
|
2
2
|
|
3
|
-
Gmaps4rails is developed to simply create a Google Map
|
3
|
+
Gmaps4rails is developed to simply create a Google Map with overlays (markers, infowindows...).
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
- from your own json
|
8
|
-
|
9
|
-
It's based on Ruby on Rails 3 Engines and uses Google Maps API V3.
|
10
|
-
|
11
|
-
== When Gmaps4rails finally means Global Maps for Rails
|
12
|
-
|
13
|
-
I've added support for other map providers: openlayers, mapquest & bing.
|
14
|
-
|
15
|
-
See: https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Map-Apis
|
16
|
-
|
17
|
-
Any help would be appreciated to complete this work.
|
5
|
+
Use it with any Ruby app (I guess you could simply take the js anywhere if you like).
|
18
6
|
|
19
7
|
== Requirements
|
20
8
|
|
@@ -22,67 +10,76 @@ Any help would be appreciated to complete this work.
|
|
22
10
|
|
23
11
|
gem 'gmaps4rails'
|
24
12
|
|
25
|
-
2)
|
26
|
-
|
27
|
-
rails generate gmaps4rails:install
|
13
|
+
2) HTML
|
28
14
|
|
29
|
-
|
15
|
+
Add a div to bear your map, example:
|
30
16
|
|
31
|
-
|
17
|
+
<div style='width: 800px;'>
|
18
|
+
<div id="map" style='width: 800px; height: 400px;'></div>
|
19
|
+
</div>
|
32
20
|
|
33
|
-
|
34
|
-
|
35
|
-
<%= yield :scripts %> (in your footer)
|
21
|
+
2) Javascript Dependencies:
|
36
22
|
|
37
|
-
|
23
|
+
Insert google scripts in your dom:
|
38
24
|
|
39
|
-
|
25
|
+
<script src="//maps.google.com/maps/api/js?v=3.13&sensor=false&libraries=geometry" type="text/javascript"></script>
|
26
|
+
<script src='//google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js' type='text/javascript'></script>
|
40
27
|
|
41
|
-
|
42
|
-
Be sure to require this file in your view for your first steps.
|
28
|
+
You'll require underscore.js too, see here: {http://underscorejs.org/}[http://underscorejs.org/]
|
43
29
|
|
44
|
-
|
30
|
+
3) Javascript source code
|
45
31
|
|
46
|
-
|
47
|
-
|
48
|
-
For Rails >= 3.1 with assets pipeline, same principle: add the required file to your manifest.
|
32
|
+
If you have the asset pipeline, add this:
|
49
33
|
|
34
|
+
//= require underscore
|
35
|
+
//= require gmaps/google
|
50
36
|
|
51
|
-
|
52
|
-
In your model, add:
|
37
|
+
If you don't have aset pipeline, you'll need to import the js/coffee files:
|
53
38
|
|
54
|
-
|
39
|
+
rails g gmaps4rails:copy_js
|
55
40
|
|
56
|
-
|
57
|
-
#describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki
|
58
|
-
"#{self.street}, #{self.city}, #{self.country}"
|
59
|
-
end
|
41
|
+
rails g gmaps4rails:copy_coffee
|
60
42
|
|
61
|
-
|
43
|
+
4) Javascript code:
|
62
44
|
|
63
|
-
|
64
|
-
add_column :users, :longitude, :float #you can change the name, see wiki
|
65
|
-
add_column :users, :gmaps, :boolean #not mandatory, see wiki
|
45
|
+
Create your map:
|
66
46
|
|
67
|
-
|
47
|
+
handler = Gmaps.build('Google');
|
48
|
+
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
|
49
|
+
markers = handler.addMarkers([
|
50
|
+
{
|
51
|
+
"lat": 0,
|
52
|
+
"lng": 0,
|
53
|
+
"picture": {
|
54
|
+
"url": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png",
|
55
|
+
"width": 36,
|
56
|
+
"height": 36
|
57
|
+
},
|
58
|
+
"infowindow": "hello!"
|
59
|
+
}
|
60
|
+
]);
|
61
|
+
handler.bounds.extendWith(markers);
|
62
|
+
handler.fitMapToBounds();
|
63
|
+
});
|
68
64
|
|
69
|
-
Mongoid example:
|
70
65
|
|
71
|
-
|
66
|
+
== Generating JSON
|
72
67
|
|
73
|
-
field :location, :type => Array
|
74
|
-
|
75
|
-
== How to?
|
76
|
-
=== QuickStart!
|
77
68
|
In your controller:
|
78
|
-
|
79
|
-
@
|
69
|
+
|
70
|
+
@users = User.all
|
71
|
+
@hash = Gmaps4rails.build_markers(@users) do |user, marker|
|
72
|
+
marker.lat user.latitude
|
73
|
+
marker.lng user.longitude
|
74
|
+
end
|
80
75
|
|
81
76
|
In your view:
|
82
77
|
|
83
|
-
|
78
|
+
markers = handler.addMarkers(<%=raw @hash.to_json %>);
|
79
|
+
|
80
|
+
== Easily customizable
|
84
81
|
|
85
|
-
|
82
|
+
You can change almost everything with a few lines of code. {See details here}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Change-handler-behavior]
|
86
83
|
|
87
84
|
== Options
|
88
85
|
|
@@ -90,7 +87,7 @@ Done!
|
|
90
87
|
|
91
88
|
* Circles, Polylines, Polygons
|
92
89
|
|
93
|
-
* Geocode directly your address and retrieve coordinates.
|
90
|
+
* Geocode directly your address and retrieve coordinates.
|
94
91
|
|
95
92
|
* Auto-adjust the map to your markers
|
96
93
|
|
@@ -106,24 +103,10 @@ Done!
|
|
106
103
|
|
107
104
|
Feel free to contact us, you have your say.
|
108
105
|
|
109
|
-
== Want to help?
|
110
|
-
|
111
|
-
This is how you can launch the spec suite (js + ruby):
|
112
|
-
|
113
|
-
* Clone the gem repository
|
114
|
-
|
115
|
-
* Go to the gem's folder
|
116
|
-
|
117
|
-
* run `bundle`
|
118
|
-
|
119
|
-
* run `cd spec/dummy; rake db:migrate RAILS_ENV=test; cd ../..`
|
120
|
-
|
121
|
-
* run `bundle exec rspec spec`
|
122
|
-
|
123
106
|
|
124
107
|
== Copyright
|
125
|
-
MIT license.
|
108
|
+
MIT license.
|
126
109
|
|
127
110
|
Authors: Benjamin Roth, David Ruyer
|
128
111
|
|
129
|
-
{Contributors}[https://github.com/apneadiving/Google-Maps-for-Rails/graphs/contributors]
|
112
|
+
{Contributors}[https://github.com/apneadiving/Google-Maps-for-Rails/graphs/contributors]
|
data/Rakefile
CHANGED
@@ -1,4 +1,24 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jasmine'
|
7
|
+
load 'jasmine/tasks/jasmine.rake'
|
8
|
+
rescue LoadError
|
9
|
+
task :jasmine do
|
10
|
+
abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "launch jasmine specs"
|
15
|
+
task :jasmine_travis do
|
16
|
+
puts "Starting to run 'rake jasmine:ci'..."
|
17
|
+
if defined? Jasmine
|
18
|
+
system("export DISPLAY=:99.0 && bundle exec rake jasmine:ci")
|
19
|
+
raise "'rake jasmine:ci' failed!" unless $?.exitstatus == 0
|
20
|
+
else
|
21
|
+
puts "Jasmine was not found"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/gmaps4rails.gemspec
CHANGED
@@ -11,28 +11,13 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = [%q{apnea.diving.deep@gmail.com}, %q{david.ruyer@gmail.com}]
|
12
12
|
s.homepage = %q{http://github.com/apneadiving/Google-Maps-for-Rails}
|
13
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
|
14
|
+
s.description = %q{Enables easy display of items (taken from a Rails 3 model) on a Google Maps (JS API V3), OpenLayers, Mapquest, Bing and Yandex (API V2).}
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
17
17
|
|
18
|
-
s.add_development_dependency "
|
19
|
-
s.add_development_dependency "
|
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"
|
18
|
+
s.add_development_dependency "rspec", '2.14.0'
|
19
|
+
s.add_development_dependency "rake", '10.1.0'
|
30
20
|
s.add_development_dependency 'coffee-script'
|
31
|
-
|
32
|
-
# s.add_development_dependency "guard-rspec"
|
33
|
-
|
34
|
-
s.add_development_dependency "factory_girl_rails"
|
35
|
-
s.add_development_dependency "webmock"
|
36
|
-
|
21
|
+
s.add_development_dependency 'sprockets'
|
37
22
|
s.add_development_dependency 'pry'
|
38
23
|
end
|
@@ -0,0 +1,961 @@
|
|
1
|
+
(function() {
|
2
|
+
this.Gmaps = {
|
3
|
+
build: function(type, options) {
|
4
|
+
var model;
|
5
|
+
if (options == null) {
|
6
|
+
options = {};
|
7
|
+
}
|
8
|
+
model = _.isFunction(options.handler) ? options.handler : Gmaps.Objects.Handler;
|
9
|
+
return new model(type, options);
|
10
|
+
},
|
11
|
+
Builders: {},
|
12
|
+
Objects: {},
|
13
|
+
Google: {
|
14
|
+
Objects: {},
|
15
|
+
Builders: {}
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
}).call(this);
|
20
|
+
(function() {
|
21
|
+
var moduleKeywords,
|
22
|
+
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
23
|
+
|
24
|
+
moduleKeywords = ['extended', 'included'];
|
25
|
+
|
26
|
+
this.Gmaps.Base = (function() {
|
27
|
+
function Base() {}
|
28
|
+
|
29
|
+
Base.extend = function(obj) {
|
30
|
+
var key, value, _ref;
|
31
|
+
for (key in obj) {
|
32
|
+
value = obj[key];
|
33
|
+
if (__indexOf.call(moduleKeywords, key) < 0) {
|
34
|
+
this[key] = value;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if ((_ref = obj.extended) != null) {
|
38
|
+
_ref.apply(this);
|
39
|
+
}
|
40
|
+
return this;
|
41
|
+
};
|
42
|
+
|
43
|
+
Base.include = function(obj) {
|
44
|
+
var key, value, _ref;
|
45
|
+
for (key in obj) {
|
46
|
+
value = obj[key];
|
47
|
+
if (__indexOf.call(moduleKeywords, key) < 0) {
|
48
|
+
this.prototype[key] = value;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
if ((_ref = obj.included) != null) {
|
52
|
+
_ref.apply(this);
|
53
|
+
}
|
54
|
+
return this;
|
55
|
+
};
|
56
|
+
|
57
|
+
return Base;
|
58
|
+
|
59
|
+
})();
|
60
|
+
|
61
|
+
}).call(this);
|
62
|
+
(function() {
|
63
|
+
this.Gmaps.Objects.BaseBuilder = (function() {
|
64
|
+
function BaseBuilder() {}
|
65
|
+
|
66
|
+
BaseBuilder.prototype.build = function() {
|
67
|
+
return new (this.model_class())(this.serviceObject);
|
68
|
+
};
|
69
|
+
|
70
|
+
BaseBuilder.prototype.before_init = function() {};
|
71
|
+
|
72
|
+
BaseBuilder.prototype.after_init = function() {};
|
73
|
+
|
74
|
+
BaseBuilder.prototype.addListener = function(action, fn) {
|
75
|
+
return this.primitives().addListener(this.getServiceObject(), action, fn);
|
76
|
+
};
|
77
|
+
|
78
|
+
BaseBuilder.prototype.getServiceObject = function() {
|
79
|
+
return this.serviceObject;
|
80
|
+
};
|
81
|
+
|
82
|
+
BaseBuilder.prototype.primitives = function() {
|
83
|
+
return this.constructor.PRIMITIVES;
|
84
|
+
};
|
85
|
+
|
86
|
+
BaseBuilder.prototype.model_class = function() {
|
87
|
+
return this.constructor.OBJECT;
|
88
|
+
};
|
89
|
+
|
90
|
+
return BaseBuilder;
|
91
|
+
|
92
|
+
})();
|
93
|
+
|
94
|
+
}).call(this);
|
95
|
+
(function() {
|
96
|
+
this.Gmaps.Objects.Builders = function(builderClass, objectClass, primitivesProvider) {
|
97
|
+
objectClass.PRIMITIVES = primitivesProvider;
|
98
|
+
builderClass.OBJECT = objectClass;
|
99
|
+
builderClass.PRIMITIVES = primitivesProvider;
|
100
|
+
return {
|
101
|
+
build: function(args, provider_options, internal_options) {
|
102
|
+
var builder;
|
103
|
+
builder = new builderClass(args, provider_options, internal_options);
|
104
|
+
return builder.build();
|
105
|
+
}
|
106
|
+
};
|
107
|
+
};
|
108
|
+
|
109
|
+
}).call(this);
|
110
|
+
(function() {
|
111
|
+
this.Gmaps.Objects.Handler = (function() {
|
112
|
+
function Handler(type, options) {
|
113
|
+
this.type = type;
|
114
|
+
if (options == null) {
|
115
|
+
options = {};
|
116
|
+
}
|
117
|
+
this.setPrimitives(options);
|
118
|
+
this.setOptions(options);
|
119
|
+
this.resetBounds();
|
120
|
+
}
|
121
|
+
|
122
|
+
Handler.prototype.buildMap = function(options, onMapLoad) {
|
123
|
+
var _this = this;
|
124
|
+
if (onMapLoad == null) {
|
125
|
+
onMapLoad = function() {};
|
126
|
+
}
|
127
|
+
return this.map = this._map_builder().build(options, function() {
|
128
|
+
_this._createClusterer();
|
129
|
+
return onMapLoad();
|
130
|
+
});
|
131
|
+
};
|
132
|
+
|
133
|
+
Handler.prototype.addMarkers = function(markers_data, provider_options) {
|
134
|
+
var _this = this;
|
135
|
+
return _.map(markers_data, function(marker_data) {
|
136
|
+
return _this.addMarker(marker_data, provider_options);
|
137
|
+
});
|
138
|
+
};
|
139
|
+
|
140
|
+
Handler.prototype.addMarker = function(marker_data, provider_options) {
|
141
|
+
var marker;
|
142
|
+
marker = this._marker_builder().build(marker_data, provider_options, this.marker_options);
|
143
|
+
marker.setMap(this.getMap());
|
144
|
+
this.clusterer.addMarker(marker);
|
145
|
+
return marker;
|
146
|
+
};
|
147
|
+
|
148
|
+
Handler.prototype.addCircles = function(circles_data, provider_options) {
|
149
|
+
var _this = this;
|
150
|
+
return _.map(circles_data, function(circle_data) {
|
151
|
+
return _this.addCircle(circle_data, provider_options);
|
152
|
+
});
|
153
|
+
};
|
154
|
+
|
155
|
+
Handler.prototype.addCircle = function(circle_data, provider_options) {
|
156
|
+
return this._addResource('circle', circle_data, provider_options);
|
157
|
+
};
|
158
|
+
|
159
|
+
Handler.prototype.addPolylines = function(polylines_data, provider_options) {
|
160
|
+
var _this = this;
|
161
|
+
return _.map(polylines_data, function(polyline_data) {
|
162
|
+
return _this.addPolyline(polyline_data, provider_options);
|
163
|
+
});
|
164
|
+
};
|
165
|
+
|
166
|
+
Handler.prototype.addPolyline = function(polyline_data, provider_options) {
|
167
|
+
return this._addResource('polyline', polyline_data, provider_options);
|
168
|
+
};
|
169
|
+
|
170
|
+
Handler.prototype.addPolygons = function(polygons_data, provider_options) {
|
171
|
+
var _this = this;
|
172
|
+
return _.map(polygons_data, function(polygon_data) {
|
173
|
+
return _this.addPolygon(polygon_data, provider_options);
|
174
|
+
});
|
175
|
+
};
|
176
|
+
|
177
|
+
Handler.prototype.addPolygon = function(polygon_data, provider_options) {
|
178
|
+
return this._addResource('polygon', polygon_data, provider_options);
|
179
|
+
};
|
180
|
+
|
181
|
+
Handler.prototype.addKmls = function(kmls_data, provider_options) {
|
182
|
+
var _this = this;
|
183
|
+
return _.map(kmls_data, function(kml_data) {
|
184
|
+
return _this.addKml(kml_data, provider_options);
|
185
|
+
});
|
186
|
+
};
|
187
|
+
|
188
|
+
Handler.prototype.addKml = function(kml_data, provider_options) {
|
189
|
+
return this._addResource('kml', kml_data, provider_options);
|
190
|
+
};
|
191
|
+
|
192
|
+
Handler.prototype.fitMapToBounds = function() {
|
193
|
+
return this.map.fitToBounds(this.bounds.getServiceObject());
|
194
|
+
};
|
195
|
+
|
196
|
+
Handler.prototype.getMap = function() {
|
197
|
+
return this.map.getServiceObject();
|
198
|
+
};
|
199
|
+
|
200
|
+
Handler.prototype.setOptions = function(options) {
|
201
|
+
this.marker_options = _.extend(this._default_marker_options(), options.markers);
|
202
|
+
this.builders = _.extend(this._default_builders(), options.builders);
|
203
|
+
return this.models = _.extend(this._default_models(), options.models);
|
204
|
+
};
|
205
|
+
|
206
|
+
Handler.prototype.resetBounds = function() {
|
207
|
+
return this.bounds = this._bound_builder().build();
|
208
|
+
};
|
209
|
+
|
210
|
+
Handler.prototype.setPrimitives = function(options) {
|
211
|
+
return this.primitives = options.primitives === void 0 ? this._rootModule().Primitives() : _.isFunction(options.primitives) ? options.primitives() : options.primitives;
|
212
|
+
};
|
213
|
+
|
214
|
+
Handler.prototype.currentInfowindow = function() {
|
215
|
+
return this.builders.Marker.CURRENT_INFOWINDOW;
|
216
|
+
};
|
217
|
+
|
218
|
+
Handler.prototype._addResource = function(resource_name, resource_data, provider_options) {
|
219
|
+
var resource;
|
220
|
+
resource = this["_" + resource_name + "_builder"]().build(resource_data, provider_options);
|
221
|
+
resource.setMap(this.getMap());
|
222
|
+
return resource;
|
223
|
+
};
|
224
|
+
|
225
|
+
Handler.prototype._clusterize = function() {
|
226
|
+
return _.isObject(this.marker_options.clusterer);
|
227
|
+
};
|
228
|
+
|
229
|
+
Handler.prototype._createClusterer = function() {
|
230
|
+
return this.clusterer = this._clusterer_builder().build({
|
231
|
+
map: this.getMap()
|
232
|
+
}, this.marker_options.clusterer);
|
233
|
+
};
|
234
|
+
|
235
|
+
Handler.prototype._default_marker_options = function() {
|
236
|
+
return {
|
237
|
+
singleInfowindow: true,
|
238
|
+
maxRandomDistance: 100,
|
239
|
+
clusterer: {
|
240
|
+
maxZoom: 5,
|
241
|
+
gridSize: 50
|
242
|
+
}
|
243
|
+
};
|
244
|
+
};
|
245
|
+
|
246
|
+
Handler.prototype._bound_builder = function() {
|
247
|
+
return this._builder('Bound');
|
248
|
+
};
|
249
|
+
|
250
|
+
Handler.prototype._clusterer_builder = function() {
|
251
|
+
return this._builder('Clusterer');
|
252
|
+
};
|
253
|
+
|
254
|
+
Handler.prototype._marker_builder = function() {
|
255
|
+
return this._builder('Marker');
|
256
|
+
};
|
257
|
+
|
258
|
+
Handler.prototype._map_builder = function() {
|
259
|
+
return this._builder('Map');
|
260
|
+
};
|
261
|
+
|
262
|
+
Handler.prototype._kml_builder = function() {
|
263
|
+
return this._builder('Kml');
|
264
|
+
};
|
265
|
+
|
266
|
+
Handler.prototype._circle_builder = function() {
|
267
|
+
return this._builder('Circle');
|
268
|
+
};
|
269
|
+
|
270
|
+
Handler.prototype._polyline_builder = function() {
|
271
|
+
return this._builder('Polyline');
|
272
|
+
};
|
273
|
+
|
274
|
+
Handler.prototype._polygon_builder = function() {
|
275
|
+
return this._builder('Polygon');
|
276
|
+
};
|
277
|
+
|
278
|
+
Handler.prototype._builder = function(name) {
|
279
|
+
var _name;
|
280
|
+
if (this[_name = "__builder" + name] == null) {
|
281
|
+
this[_name] = Gmaps.Objects.Builders(this.builders[name], this.models[name], this.primitives);
|
282
|
+
}
|
283
|
+
return this["__builder" + name];
|
284
|
+
};
|
285
|
+
|
286
|
+
Handler.prototype._default_models = function() {
|
287
|
+
var models;
|
288
|
+
models = this._rootModule().Objects;
|
289
|
+
if (this._clusterize()) {
|
290
|
+
return models;
|
291
|
+
} else {
|
292
|
+
models.Clusterer = Gmaps.Objects.NullClusterer;
|
293
|
+
return models;
|
294
|
+
}
|
295
|
+
};
|
296
|
+
|
297
|
+
Handler.prototype._default_builders = function() {
|
298
|
+
return this._rootModule().Builders;
|
299
|
+
};
|
300
|
+
|
301
|
+
Handler.prototype._rootModule = function() {
|
302
|
+
if (this.__rootModule == null) {
|
303
|
+
this.__rootModule = Gmaps[this.type];
|
304
|
+
}
|
305
|
+
return this.__rootModule;
|
306
|
+
};
|
307
|
+
|
308
|
+
return Handler;
|
309
|
+
|
310
|
+
})();
|
311
|
+
|
312
|
+
}).call(this);
|
313
|
+
(function() {
|
314
|
+
this.Gmaps.Objects.NullClusterer = (function() {
|
315
|
+
function NullClusterer() {}
|
316
|
+
|
317
|
+
NullClusterer.prototype.addMarkers = function() {};
|
318
|
+
|
319
|
+
NullClusterer.prototype.addMarker = function() {};
|
320
|
+
|
321
|
+
NullClusterer.prototype.clear = function() {};
|
322
|
+
|
323
|
+
return NullClusterer;
|
324
|
+
|
325
|
+
})();
|
326
|
+
|
327
|
+
}).call(this);
|
328
|
+
(function() {
|
329
|
+
this.Gmaps.Google.Objects.Common = {
|
330
|
+
getServiceObject: function() {
|
331
|
+
return this.serviceObject;
|
332
|
+
},
|
333
|
+
setMap: function(map) {
|
334
|
+
return this.getServiceObject().setMap(map);
|
335
|
+
},
|
336
|
+
clear: function() {
|
337
|
+
this.serviceObject.setMap(null);
|
338
|
+
return this.serviceObject = null;
|
339
|
+
},
|
340
|
+
show: function() {
|
341
|
+
return this.serviceObject.setVisible(true);
|
342
|
+
},
|
343
|
+
hide: function() {
|
344
|
+
return this.serviceObject.setVisible(false);
|
345
|
+
},
|
346
|
+
isVisible: function() {
|
347
|
+
return this.serviceObject.getVisible();
|
348
|
+
},
|
349
|
+
primitives: function() {
|
350
|
+
return this.constructor.PRIMITIVES;
|
351
|
+
}
|
352
|
+
};
|
353
|
+
|
354
|
+
}).call(this);
|
355
|
+
(function() {
|
356
|
+
var __hasProp = {}.hasOwnProperty,
|
357
|
+
__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; };
|
358
|
+
|
359
|
+
this.Gmaps.Google.Builders.Bound = (function(_super) {
|
360
|
+
__extends(Bound, _super);
|
361
|
+
|
362
|
+
function Bound(options) {
|
363
|
+
this.before_init();
|
364
|
+
this.serviceObject = new (this.primitives().latLngBounds);
|
365
|
+
this.after_init();
|
366
|
+
}
|
367
|
+
|
368
|
+
return Bound;
|
369
|
+
|
370
|
+
})(Gmaps.Objects.BaseBuilder);
|
371
|
+
|
372
|
+
}).call(this);
|
373
|
+
(function() {
|
374
|
+
var __hasProp = {}.hasOwnProperty,
|
375
|
+
__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; };
|
376
|
+
|
377
|
+
this.Gmaps.Google.Builders.Circle = (function(_super) {
|
378
|
+
__extends(Circle, _super);
|
379
|
+
|
380
|
+
function Circle(args, provider_options) {
|
381
|
+
this.args = args;
|
382
|
+
this.provider_options = provider_options != null ? provider_options : {};
|
383
|
+
this.before_init();
|
384
|
+
this.serviceObject = this.create_circle();
|
385
|
+
this.after_init();
|
386
|
+
}
|
387
|
+
|
388
|
+
Circle.prototype.create_circle = function() {
|
389
|
+
return new (this.primitives().circle)(this.circle_options());
|
390
|
+
};
|
391
|
+
|
392
|
+
Circle.prototype.circle_options = function() {
|
393
|
+
var base_options;
|
394
|
+
base_options = {
|
395
|
+
center: new (this.primitives().latLng)(this.args.lat, this.args.lng),
|
396
|
+
radius: this.args.radius
|
397
|
+
};
|
398
|
+
return _.defaults(base_options, this.provider_options);
|
399
|
+
};
|
400
|
+
|
401
|
+
return Circle;
|
402
|
+
|
403
|
+
})(Gmaps.Objects.BaseBuilder);
|
404
|
+
|
405
|
+
}).call(this);
|
406
|
+
(function() {
|
407
|
+
var __hasProp = {}.hasOwnProperty,
|
408
|
+
__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; };
|
409
|
+
|
410
|
+
this.Gmaps.Google.Builders.Clusterer = (function(_super) {
|
411
|
+
__extends(Clusterer, _super);
|
412
|
+
|
413
|
+
function Clusterer(args, options) {
|
414
|
+
this.args = args;
|
415
|
+
this.options = options;
|
416
|
+
this.before_init();
|
417
|
+
this.serviceObject = new (this.primitives().clusterer)(this.args.map, [], this.options);
|
418
|
+
this.after_init();
|
419
|
+
}
|
420
|
+
|
421
|
+
return Clusterer;
|
422
|
+
|
423
|
+
})(Gmaps.Objects.BaseBuilder);
|
424
|
+
|
425
|
+
}).call(this);
|
426
|
+
(function() {
|
427
|
+
var __hasProp = {}.hasOwnProperty,
|
428
|
+
__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; };
|
429
|
+
|
430
|
+
this.Gmaps.Google.Builders.Kml = (function(_super) {
|
431
|
+
__extends(Kml, _super);
|
432
|
+
|
433
|
+
function Kml(args, provider_options) {
|
434
|
+
this.args = args;
|
435
|
+
this.provider_options = provider_options != null ? provider_options : {};
|
436
|
+
this.before_init();
|
437
|
+
this.serviceObject = this.create_kml();
|
438
|
+
this.after_init();
|
439
|
+
}
|
440
|
+
|
441
|
+
Kml.prototype.create_kml = function() {
|
442
|
+
return new (this.primitives().kml)(this.args.url, this.kml_options());
|
443
|
+
};
|
444
|
+
|
445
|
+
Kml.prototype.kml_options = function() {
|
446
|
+
var base_options;
|
447
|
+
base_options = {};
|
448
|
+
return _.defaults(base_options, this.provider_options);
|
449
|
+
};
|
450
|
+
|
451
|
+
return Kml;
|
452
|
+
|
453
|
+
})(Gmaps.Objects.BaseBuilder);
|
454
|
+
|
455
|
+
}).call(this);
|
456
|
+
(function() {
|
457
|
+
var __hasProp = {}.hasOwnProperty,
|
458
|
+
__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; };
|
459
|
+
|
460
|
+
this.Gmaps.Google.Builders.Map = (function(_super) {
|
461
|
+
__extends(Map, _super);
|
462
|
+
|
463
|
+
function Map(options, onMapLoad) {
|
464
|
+
var provider_options;
|
465
|
+
this.before_init();
|
466
|
+
provider_options = _.extend(this.default_options(), options.provider);
|
467
|
+
this.internal_options = options.internal;
|
468
|
+
this.serviceObject = new (this.primitives().map)(document.getElementById(this.internal_options.id), provider_options);
|
469
|
+
this.on_map_load(onMapLoad);
|
470
|
+
this.after_init();
|
471
|
+
}
|
472
|
+
|
473
|
+
Map.prototype.build = function() {
|
474
|
+
return new (this.model_class())(this.serviceObject, this.primitives());
|
475
|
+
};
|
476
|
+
|
477
|
+
Map.prototype.on_map_load = function(onMapLoad) {
|
478
|
+
return this.primitives().addListenerOnce(this.serviceObject, 'idle', onMapLoad);
|
479
|
+
};
|
480
|
+
|
481
|
+
Map.prototype.default_options = function() {
|
482
|
+
return {
|
483
|
+
mapTypeId: this.primitives().mapTypes('ROADMAP'),
|
484
|
+
center: this.primitives().latLng(0, 0),
|
485
|
+
zoom: 8
|
486
|
+
};
|
487
|
+
};
|
488
|
+
|
489
|
+
return Map;
|
490
|
+
|
491
|
+
})(Gmaps.Objects.BaseBuilder);
|
492
|
+
|
493
|
+
}).call(this);
|
494
|
+
(function() {
|
495
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
496
|
+
__hasProp = {}.hasOwnProperty,
|
497
|
+
__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; };
|
498
|
+
|
499
|
+
this.Gmaps.Google.Builders.Marker = (function(_super) {
|
500
|
+
__extends(Marker, _super);
|
501
|
+
|
502
|
+
Marker.CURRENT_INFOWINDOW = void 0;
|
503
|
+
|
504
|
+
Marker.CACHE_STORE = {};
|
505
|
+
|
506
|
+
function Marker(args, provider_options, internal_options) {
|
507
|
+
this.args = args;
|
508
|
+
this.provider_options = provider_options != null ? provider_options : {};
|
509
|
+
this.internal_options = internal_options != null ? internal_options : {};
|
510
|
+
this.infowindow_binding = __bind(this.infowindow_binding, this);
|
511
|
+
this.before_init();
|
512
|
+
this.create_marker();
|
513
|
+
this.create_infowindow();
|
514
|
+
this.after_init();
|
515
|
+
}
|
516
|
+
|
517
|
+
Marker.prototype.build = function() {
|
518
|
+
return new (this.model_class())(this.serviceObject, this.infowindow);
|
519
|
+
};
|
520
|
+
|
521
|
+
Marker.prototype.create_marker = function() {
|
522
|
+
return this.serviceObject = new (this.primitives().marker)(this.marker_options());
|
523
|
+
};
|
524
|
+
|
525
|
+
Marker.prototype.create_infowindow = function() {
|
526
|
+
if (!_.isString(this.args.infowindow)) {
|
527
|
+
return null;
|
528
|
+
}
|
529
|
+
this.infowindow = new (this.primitives().infowindow)({
|
530
|
+
content: this.args.infowindow
|
531
|
+
});
|
532
|
+
return this.bind_infowindow();
|
533
|
+
};
|
534
|
+
|
535
|
+
Marker.prototype.marker_options = function() {
|
536
|
+
var base_options, coords;
|
537
|
+
coords = this._randomized_coordinates();
|
538
|
+
base_options = {
|
539
|
+
title: this.args.marker_title,
|
540
|
+
position: new (this.primitives().latLng)(coords[0], coords[1]),
|
541
|
+
icon: this._get_picture('picture'),
|
542
|
+
shadow: this._get_picture('shadow')
|
543
|
+
};
|
544
|
+
return _.extend(this.provider_options, base_options);
|
545
|
+
};
|
546
|
+
|
547
|
+
Marker.prototype.bind_infowindow = function() {
|
548
|
+
return this.addListener('click', this.infowindow_binding);
|
549
|
+
};
|
550
|
+
|
551
|
+
Marker.prototype.infowindow_binding = function() {
|
552
|
+
this.panTo();
|
553
|
+
if (this._should_close_infowindow()) {
|
554
|
+
this.constructor.CURRENT_INFOWINDOW.close();
|
555
|
+
}
|
556
|
+
this.infowindow.open(this.getServiceObject().getMap(), this.getServiceObject());
|
557
|
+
return this.constructor.CURRENT_INFOWINDOW = this.infowindow;
|
558
|
+
};
|
559
|
+
|
560
|
+
Marker.prototype.panTo = function() {
|
561
|
+
return this.getServiceObject().getMap().panTo(this.getServiceObject().getPosition());
|
562
|
+
};
|
563
|
+
|
564
|
+
Marker.prototype._get_picture = function(picture_name) {
|
565
|
+
if (!_.isObject(this.args[picture_name]) || !_.isString(this.args[picture_name].url)) {
|
566
|
+
return null;
|
567
|
+
}
|
568
|
+
return this._create_or_retrieve_image(this._picture_args(picture_name));
|
569
|
+
};
|
570
|
+
|
571
|
+
Marker.prototype._create_or_retrieve_image = function(picture_args) {
|
572
|
+
if (this.constructor.CACHE_STORE[picture_args.url] === void 0) {
|
573
|
+
this.constructor.CACHE_STORE[picture_args.url] = new (this.primitives().markerImage)(picture_args.url, picture_args.size, picture_args.origin, picture_args.anchor, picture_args.scaledSize);
|
574
|
+
}
|
575
|
+
return this.constructor.CACHE_STORE[picture_args.url];
|
576
|
+
};
|
577
|
+
|
578
|
+
Marker.prototype._picture_args = function(picture_name) {
|
579
|
+
return {
|
580
|
+
url: this.args[picture_name].url,
|
581
|
+
anchor: this._createImageAnchorPosition(this.args[picture_name].anchor),
|
582
|
+
size: new (this.primitives().size)(this.args[picture_name].width, this.args[picture_name].height),
|
583
|
+
scaledSize: null,
|
584
|
+
origin: null
|
585
|
+
};
|
586
|
+
};
|
587
|
+
|
588
|
+
Marker.prototype._createImageAnchorPosition = function(anchorLocation) {
|
589
|
+
if (!_.isArray(anchorLocation)) {
|
590
|
+
return null;
|
591
|
+
}
|
592
|
+
return new (this.primitives().point)(anchorLocation[0], anchorLocation[1]);
|
593
|
+
};
|
594
|
+
|
595
|
+
Marker.prototype._should_close_infowindow = function() {
|
596
|
+
return this.internal_options.singleInfowindow && (this.constructor.CURRENT_INFOWINDOW != null);
|
597
|
+
};
|
598
|
+
|
599
|
+
Marker.prototype._randomized_coordinates = function() {
|
600
|
+
var Lat, Lng, dx, dy, random;
|
601
|
+
if (!_.isNumber(this.internal_options.maxRandomDistance)) {
|
602
|
+
return [this.args.lat, this.args.lng];
|
603
|
+
}
|
604
|
+
random = function() {
|
605
|
+
return Math.random() * 2 - 1;
|
606
|
+
};
|
607
|
+
dx = this.internal_options.maxRandomDistance * random();
|
608
|
+
dy = this.internal_options.maxRandomDistance * random();
|
609
|
+
Lat = parseFloat(this.args.lat) + (180 / Math.PI) * (dy / 6378137);
|
610
|
+
Lng = parseFloat(this.args.lng) + (90 / Math.PI) * (dx / 6378137) / Math.cos(this.args.lat);
|
611
|
+
return [Lat, Lng];
|
612
|
+
};
|
613
|
+
|
614
|
+
return Marker;
|
615
|
+
|
616
|
+
})(Gmaps.Objects.BaseBuilder);
|
617
|
+
|
618
|
+
}).call(this);
|
619
|
+
(function() {
|
620
|
+
var __hasProp = {}.hasOwnProperty,
|
621
|
+
__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; };
|
622
|
+
|
623
|
+
this.Gmaps.Google.Builders.Polygon = (function(_super) {
|
624
|
+
__extends(Polygon, _super);
|
625
|
+
|
626
|
+
function Polygon(args, provider_options) {
|
627
|
+
this.args = args;
|
628
|
+
this.provider_options = provider_options != null ? provider_options : {};
|
629
|
+
this.before_init();
|
630
|
+
this.serviceObject = this.create_polygon();
|
631
|
+
this.after_init();
|
632
|
+
}
|
633
|
+
|
634
|
+
Polygon.prototype.create_polygon = function() {
|
635
|
+
return new (this.primitives().polygon)(this.polygon_options());
|
636
|
+
};
|
637
|
+
|
638
|
+
Polygon.prototype.polygon_options = function() {
|
639
|
+
var base_options;
|
640
|
+
base_options = {
|
641
|
+
path: this._build_path()
|
642
|
+
};
|
643
|
+
return _.defaults(base_options, this.provider_options);
|
644
|
+
};
|
645
|
+
|
646
|
+
Polygon.prototype._build_path = function() {
|
647
|
+
var _this = this;
|
648
|
+
return _.map(this.args, function(arg) {
|
649
|
+
return new (_this.primitives().latLng)(arg.lat, arg.lng);
|
650
|
+
});
|
651
|
+
};
|
652
|
+
|
653
|
+
return Polygon;
|
654
|
+
|
655
|
+
})(Gmaps.Objects.BaseBuilder);
|
656
|
+
|
657
|
+
}).call(this);
|
658
|
+
(function() {
|
659
|
+
var __hasProp = {}.hasOwnProperty,
|
660
|
+
__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; };
|
661
|
+
|
662
|
+
this.Gmaps.Google.Builders.Polyline = (function(_super) {
|
663
|
+
__extends(Polyline, _super);
|
664
|
+
|
665
|
+
function Polyline(args, provider_options) {
|
666
|
+
this.args = args;
|
667
|
+
this.provider_options = provider_options != null ? provider_options : {};
|
668
|
+
this.before_init();
|
669
|
+
this.serviceObject = this.create_polyline();
|
670
|
+
this.after_init();
|
671
|
+
}
|
672
|
+
|
673
|
+
Polyline.prototype.create_polyline = function() {
|
674
|
+
return new (this.primitives().polyline)(this.polyline_options());
|
675
|
+
};
|
676
|
+
|
677
|
+
Polyline.prototype.polyline_options = function() {
|
678
|
+
var base_options;
|
679
|
+
base_options = {
|
680
|
+
path: this._build_path()
|
681
|
+
};
|
682
|
+
return _.defaults(base_options, this.provider_options);
|
683
|
+
};
|
684
|
+
|
685
|
+
Polyline.prototype._build_path = function() {
|
686
|
+
var _this = this;
|
687
|
+
return _.map(this.args, function(arg) {
|
688
|
+
return new (_this.primitives().latLng)(arg.lat, arg.lng);
|
689
|
+
});
|
690
|
+
};
|
691
|
+
|
692
|
+
return Polyline;
|
693
|
+
|
694
|
+
})(Gmaps.Objects.BaseBuilder);
|
695
|
+
|
696
|
+
}).call(this);
|
697
|
+
(function() {
|
698
|
+
var __hasProp = {}.hasOwnProperty,
|
699
|
+
__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; };
|
700
|
+
|
701
|
+
this.Gmaps.Google.Objects.Bound = (function(_super) {
|
702
|
+
__extends(Bound, _super);
|
703
|
+
|
704
|
+
Bound.include(Gmaps.Google.Objects.Common);
|
705
|
+
|
706
|
+
function Bound(serviceObject) {
|
707
|
+
this.serviceObject = serviceObject;
|
708
|
+
}
|
709
|
+
|
710
|
+
Bound.prototype.extendWith = function(array_or_object) {
|
711
|
+
var collection,
|
712
|
+
_this = this;
|
713
|
+
collection = _.isArray(array_or_object) ? array_or_object : [array_or_object];
|
714
|
+
return _.each(collection, function(object) {
|
715
|
+
return object.updateBounds(_this);
|
716
|
+
});
|
717
|
+
};
|
718
|
+
|
719
|
+
Bound.prototype.extend = function(value) {
|
720
|
+
return this.getServiceObject().extend(value);
|
721
|
+
};
|
722
|
+
|
723
|
+
return Bound;
|
724
|
+
|
725
|
+
})(Gmaps.Base);
|
726
|
+
|
727
|
+
}).call(this);
|
728
|
+
(function() {
|
729
|
+
var __hasProp = {}.hasOwnProperty,
|
730
|
+
__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; };
|
731
|
+
|
732
|
+
this.Gmaps.Google.Objects.Circle = (function(_super) {
|
733
|
+
__extends(Circle, _super);
|
734
|
+
|
735
|
+
Circle.include(Gmaps.Google.Objects.Common);
|
736
|
+
|
737
|
+
function Circle(serviceObject) {
|
738
|
+
this.serviceObject = serviceObject;
|
739
|
+
}
|
740
|
+
|
741
|
+
Circle.prototype.updateBounds = function(bounds) {
|
742
|
+
bounds.extend(this.getServiceObject().getBounds().getNorthEast());
|
743
|
+
return bounds.extend(this.getServiceObject().getBounds().getSouthWest());
|
744
|
+
};
|
745
|
+
|
746
|
+
return Circle;
|
747
|
+
|
748
|
+
})(Gmaps.Base);
|
749
|
+
|
750
|
+
}).call(this);
|
751
|
+
(function() {
|
752
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
753
|
+
|
754
|
+
this.Gmaps.Google.Objects.Clusterer = (function() {
|
755
|
+
function Clusterer(serviceObject) {
|
756
|
+
this.serviceObject = serviceObject;
|
757
|
+
this.clear = __bind(this.clear, this);
|
758
|
+
this.addMarker = __bind(this.addMarker, this);
|
759
|
+
this.addMarkers = __bind(this.addMarkers, this);
|
760
|
+
}
|
761
|
+
|
762
|
+
Clusterer.prototype.addMarkers = function(markers) {
|
763
|
+
var _this = this;
|
764
|
+
return _.each(markers, function(marker) {
|
765
|
+
return _this.addMarker(marker);
|
766
|
+
});
|
767
|
+
};
|
768
|
+
|
769
|
+
Clusterer.prototype.addMarker = function(marker) {
|
770
|
+
return this.serviceObject.addMarker(marker.serviceObject);
|
771
|
+
};
|
772
|
+
|
773
|
+
Clusterer.prototype.clear = function() {
|
774
|
+
return this.serviceObject.clearMarkers();
|
775
|
+
};
|
776
|
+
|
777
|
+
return Clusterer;
|
778
|
+
|
779
|
+
})();
|
780
|
+
|
781
|
+
}).call(this);
|
782
|
+
(function() {
|
783
|
+
var __hasProp = {}.hasOwnProperty,
|
784
|
+
__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; };
|
785
|
+
|
786
|
+
this.Gmaps.Google.Objects.Kml = (function(_super) {
|
787
|
+
__extends(Kml, _super);
|
788
|
+
|
789
|
+
function Kml(serviceObject) {
|
790
|
+
this.serviceObject = serviceObject;
|
791
|
+
}
|
792
|
+
|
793
|
+
Kml.prototype.updateBounds = function(bounds) {};
|
794
|
+
|
795
|
+
Kml.prototype.setMap = function(map) {
|
796
|
+
return this.getServiceObject().setMap(map);
|
797
|
+
};
|
798
|
+
|
799
|
+
Kml.prototype.getServiceObject = function() {
|
800
|
+
return this.serviceObject;
|
801
|
+
};
|
802
|
+
|
803
|
+
Kml.prototype.primitives = function() {
|
804
|
+
return this.constructor.PRIMITIVES;
|
805
|
+
};
|
806
|
+
|
807
|
+
return Kml;
|
808
|
+
|
809
|
+
})(Gmaps.Base);
|
810
|
+
|
811
|
+
}).call(this);
|
812
|
+
(function() {
|
813
|
+
var __hasProp = {}.hasOwnProperty,
|
814
|
+
__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; };
|
815
|
+
|
816
|
+
this.Gmaps.Google.Objects.Map = (function(_super) {
|
817
|
+
__extends(Map, _super);
|
818
|
+
|
819
|
+
function Map(serviceObject) {
|
820
|
+
this.serviceObject = serviceObject;
|
821
|
+
}
|
822
|
+
|
823
|
+
Map.prototype.getServiceObject = function() {
|
824
|
+
return this.serviceObject;
|
825
|
+
};
|
826
|
+
|
827
|
+
Map.prototype.centerOn = function(position) {
|
828
|
+
return this.getServiceObject().setCenter(this.primitives().latLngFromPosition(position));
|
829
|
+
};
|
830
|
+
|
831
|
+
Map.prototype.fitToBounds = function(boundsObject) {
|
832
|
+
if (!boundsObject.isEmpty()) {
|
833
|
+
return this.getServiceObject().fitBounds(boundsObject);
|
834
|
+
}
|
835
|
+
};
|
836
|
+
|
837
|
+
Map.prototype.primitives = function() {
|
838
|
+
return this.constructor.PRIMITIVES;
|
839
|
+
};
|
840
|
+
|
841
|
+
return Map;
|
842
|
+
|
843
|
+
})(Gmaps.Base);
|
844
|
+
|
845
|
+
}).call(this);
|
846
|
+
(function() {
|
847
|
+
var __hasProp = {}.hasOwnProperty,
|
848
|
+
__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; };
|
849
|
+
|
850
|
+
this.Gmaps.Google.Objects.Marker = (function(_super) {
|
851
|
+
__extends(Marker, _super);
|
852
|
+
|
853
|
+
Marker.include(Gmaps.Google.Objects.Common);
|
854
|
+
|
855
|
+
function Marker(serviceObject, infowindow) {
|
856
|
+
this.serviceObject = serviceObject;
|
857
|
+
this.infowindow = infowindow;
|
858
|
+
}
|
859
|
+
|
860
|
+
Marker.prototype.updateBounds = function(bounds) {
|
861
|
+
return bounds.extend(this.getServiceObject().position);
|
862
|
+
};
|
863
|
+
|
864
|
+
Marker.prototype.panTo = function() {
|
865
|
+
return this.getServiceObject().getMap().panTo(this.getServiceObject().getPosition());
|
866
|
+
};
|
867
|
+
|
868
|
+
return Marker;
|
869
|
+
|
870
|
+
})(Gmaps.Base);
|
871
|
+
|
872
|
+
}).call(this);
|
873
|
+
(function() {
|
874
|
+
var __hasProp = {}.hasOwnProperty,
|
875
|
+
__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; };
|
876
|
+
|
877
|
+
this.Gmaps.Google.Objects.Polygon = (function(_super) {
|
878
|
+
__extends(Polygon, _super);
|
879
|
+
|
880
|
+
Polygon.include(Gmaps.Google.Objects.Common);
|
881
|
+
|
882
|
+
function Polygon(serviceObject) {
|
883
|
+
this.serviceObject = serviceObject;
|
884
|
+
}
|
885
|
+
|
886
|
+
Polygon.prototype.updateBounds = function(bounds) {};
|
887
|
+
|
888
|
+
return Polygon;
|
889
|
+
|
890
|
+
})(Gmaps.Base);
|
891
|
+
|
892
|
+
}).call(this);
|
893
|
+
(function() {
|
894
|
+
var __hasProp = {}.hasOwnProperty,
|
895
|
+
__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; };
|
896
|
+
|
897
|
+
this.Gmaps.Google.Objects.Polyline = (function(_super) {
|
898
|
+
__extends(Polyline, _super);
|
899
|
+
|
900
|
+
Polyline.include(Gmaps.Google.Objects.Common);
|
901
|
+
|
902
|
+
function Polyline(serviceObject) {
|
903
|
+
this.serviceObject = serviceObject;
|
904
|
+
}
|
905
|
+
|
906
|
+
Polyline.prototype.updateBounds = function(bounds) {};
|
907
|
+
|
908
|
+
return Polyline;
|
909
|
+
|
910
|
+
})(Gmaps.Base);
|
911
|
+
|
912
|
+
}).call(this);
|
913
|
+
(function() {
|
914
|
+
this.Gmaps.Google.Primitives = function() {
|
915
|
+
var factory;
|
916
|
+
factory = {
|
917
|
+
point: google.maps.Point,
|
918
|
+
size: google.maps.Size,
|
919
|
+
circle: google.maps.Circle,
|
920
|
+
latLng: google.maps.LatLng,
|
921
|
+
latLngBounds: google.maps.LatLngBounds,
|
922
|
+
map: google.maps.Map,
|
923
|
+
mapTypez: google.maps.MapTypeId,
|
924
|
+
markerImage: google.maps.MarkerImage,
|
925
|
+
marker: google.maps.Marker,
|
926
|
+
infowindow: google.maps.InfoWindow,
|
927
|
+
listener: google.maps.event.addListener,
|
928
|
+
clusterer: MarkerClusterer,
|
929
|
+
listenerOnce: google.maps.event.addListenerOnce,
|
930
|
+
polyline: google.maps.Polyline,
|
931
|
+
polygon: google.maps.Polygon,
|
932
|
+
kml: google.maps.KmlLayer,
|
933
|
+
addListener: function(object, event_name, fn) {
|
934
|
+
return factory.listener(object, event_name, fn);
|
935
|
+
},
|
936
|
+
addListenerOnce: function(object, event_name, fn) {
|
937
|
+
return factory.listenerOnce(object, event_name, fn);
|
938
|
+
},
|
939
|
+
mapTypes: function(type) {
|
940
|
+
return factory.mapTypez[type];
|
941
|
+
},
|
942
|
+
latLngFromPosition: function(position) {
|
943
|
+
if (_.isArray(position)) {
|
944
|
+
return new factory.latLng(position[0], position[1]);
|
945
|
+
} else {
|
946
|
+
if (_.isNumber(position.lat) && _.isNumber(position.lng)) {
|
947
|
+
return new factory.latLng(position.lat, position.lng);
|
948
|
+
} else {
|
949
|
+
return position;
|
950
|
+
}
|
951
|
+
}
|
952
|
+
}
|
953
|
+
};
|
954
|
+
return factory;
|
955
|
+
};
|
956
|
+
|
957
|
+
}).call(this);
|
958
|
+
(function() {
|
959
|
+
|
960
|
+
|
961
|
+
}).call(this);
|