Module: Ovimap::Generators::Helpers
- Included in:
- BuildGenerator, DisplayGenerator, HeatmapGenerator, InstallGenerator, PinGenerator
- Defined in:
- lib/generators/ovimap/helpers.rb
Instance Method Summary collapse
- #asset_path ⇒ Object
- #content_for ⇒ Object
- #heatmap_options ⇒ Object
- #js_path ⇒ Object
- #layouts ⇒ Object
- #map_select ⇒ Object
- #map_style ⇒ Object
- #map_swap ⇒ Object
- #nokia_script ⇒ Object
- #pin_options ⇒ Object
- #stylesheets ⇒ Object
Instance Method Details
#asset_path ⇒ Object
5 6 7 |
# File 'lib/generators/ovimap/helpers.rb', line 5 def asset_path "app/assets" end |
#content_for ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/generators/ovimap/helpers.rb', line 29 def content_for <<-eos.gsub /^\s+/, "" <% content_for :map do %> <%= javascript_include_tag 'map.js' %> <% end %> <div id="mapContainer"></div> eos end |
#heatmap_options ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/generators/ovimap/helpers.rb', line 47 def <<-eof.gsub /^\s+/, "" var colorizeAPI = { stops: { "0": "#CCFF00", "0.5": "#FF9900", "1": "#CC0000" }, interpolate: true }; var heatmapProvider = new nokia.maps.heatmap.Overlay({ label: 'My Map', description: 'Generated with EasyMap', max: 20, opacity: 0.9, type: "value", coarseness: 10, colors: colorizeAPI, }); heatmapProvider.addData(data); map.overlays.add(heatmapProvider); eof end |
#js_path ⇒ Object
9 10 11 |
# File 'lib/generators/ovimap/helpers.rb', line 9 def js_path "#{asset_path}/javascripts" end |
#layouts ⇒ Object
17 18 19 |
# File 'lib/generators/ovimap/helpers.rb', line 17 def layouts "app/views/layouts" end |
#map_select ⇒ Object
39 40 41 |
# File 'lib/generators/ovimap/helpers.rb', line 39 def map_select "\nmap.set(\"baseMapType\", nokia.maps.map.Display.#{map_type.upcase});\n" end |
#map_style ⇒ Object
21 22 23 |
# File 'lib/generators/ovimap/helpers.rb', line 21 def map_style "\n#mapContainer {\nwidth: 100%; \nheight: 100%; \nleft: 0; \ntop: 0; \nposition: absolute;\n}\n" end |
#map_swap ⇒ Object
43 44 45 |
# File 'lib/generators/ovimap/helpers.rb', line 43 def map_swap "map.set(\"baseMapType\", nokia.maps.map.Display.#{map_type.upcase});" end |
#nokia_script ⇒ Object
25 26 27 |
# File 'lib/generators/ovimap/helpers.rb', line 25 def nokia_script "\n<script type=\"text/javascript\" charset=\"UTF-8\" src=\"http://api.maps.nokia.com/2.2.0/jsl.js?with=all\"></script>\n" end |
#pin_options ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/generators/ovimap/helpers.rb', line 74 def <<-eof.gsub /^\s+/, "" pindata = _.zip(_.pluck(data, "latitude"), _.pluck(data, "longitude")); _.each(pindata, function(num){ map.objects.add(new nokia.maps.map.Circle( new nokia.maps.geo.Coordinate(num[0], num[1]), 40000, { pen: { strokeColor: "black", lineWidth: 0 }, brush: { color: "yellow" }})); }); eof end |
#stylesheets ⇒ Object
13 14 15 |
# File 'lib/generators/ovimap/helpers.rb', line 13 def stylesheets "#{asset_path}/stylesheets" end |