mapstraction-rails 2.0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +14 -0
  3. data/LICENSE +22 -0
  4. data/README.md +32 -0
  5. data/Rakefile +2 -0
  6. data/lib/mapstraction/engine.rb +4 -0
  7. data/lib/mapstraction/version.rb +3 -0
  8. data/lib/mapstraction.rb +5 -0
  9. data/mapstraction/.gitignore +17 -0
  10. data/mapstraction.gemspec +17 -0
  11. data/vendor/.DS_Store +0 -0
  12. data/vendor/assets/.DS_Store +0 -0
  13. data/vendor/assets/javascripts/mxn-min.js +15 -0
  14. data/vendor/assets/javascripts/mxn.cartociudad.geocoder-min.js +15 -0
  15. data/vendor/assets/javascripts/mxn.cartociudad.geocoder.js +46 -0
  16. data/vendor/assets/javascripts/mxn.cloudmade.core-min.js +15 -0
  17. data/vendor/assets/javascripts/mxn.cloudmade.core.js +383 -0
  18. data/vendor/assets/javascripts/mxn.core-min.js +15 -0
  19. data/vendor/assets/javascripts/mxn.core.js +1892 -0
  20. data/vendor/assets/javascripts/mxn.geocoder-min.js +15 -0
  21. data/vendor/assets/javascripts/mxn.geocoder.js +74 -0
  22. data/vendor/assets/javascripts/mxn.geocommons.core-min.js +15 -0
  23. data/vendor/assets/javascripts/mxn.geocommons.core.js +343 -0
  24. data/vendor/assets/javascripts/mxn.google.core-min.js +15 -0
  25. data/vendor/assets/javascripts/mxn.google.core.js +536 -0
  26. data/vendor/assets/javascripts/mxn.google.geocoder-min.js +15 -0
  27. data/vendor/assets/javascripts/mxn.google.geocoder.js +87 -0
  28. data/vendor/assets/javascripts/mxn.googleearth.core-min.js +15 -0
  29. data/vendor/assets/javascripts/mxn.googleearth.core.js +350 -0
  30. data/vendor/assets/javascripts/mxn.googlev3.core-min.js +15 -0
  31. data/vendor/assets/javascripts/mxn.googlev3.core.js +630 -0
  32. data/vendor/assets/javascripts/mxn.googlev3.geocoder-min.js +15 -0
  33. data/vendor/assets/javascripts/mxn.googlev3.geocoder.js +101 -0
  34. data/vendor/assets/javascripts/mxn.js +581 -0
  35. data/vendor/assets/javascripts/mxn.leaflet.core-min.js +15 -0
  36. data/vendor/assets/javascripts/mxn.leaflet.core.js +398 -0
  37. data/vendor/assets/javascripts/mxn.mapquest.geocoder-min.js +15 -0
  38. data/vendor/assets/javascripts/mxn.mapquest.geocoder.js +63 -0
  39. data/vendor/assets/javascripts/mxn.microsoft.core-min.js +15 -0
  40. data/vendor/assets/javascripts/mxn.microsoft.core.js +429 -0
  41. data/vendor/assets/javascripts/mxn.microsoft7.core-min.js +15 -0
  42. data/vendor/assets/javascripts/mxn.microsoft7.core.js +458 -0
  43. data/vendor/assets/javascripts/mxn.microsoft7.geocoder-min.js +15 -0
  44. data/vendor/assets/javascripts/mxn.microsoft7.geocoder.js +66 -0
  45. data/vendor/assets/javascripts/mxn.multimap.core-min.js +15 -0
  46. data/vendor/assets/javascripts/mxn.multimap.core.js +473 -0
  47. data/vendor/assets/javascripts/mxn.openlayers.core-min.js +15 -0
  48. data/vendor/assets/javascripts/mxn.openlayers.core.js +630 -0
  49. data/vendor/assets/javascripts/mxn.openlayers.geocoder-min.js +15 -0
  50. data/vendor/assets/javascripts/mxn.openlayers.geocoder.js +106 -0
  51. data/vendor/assets/javascripts/mxn.openmq.core-min.js +15 -0
  52. data/vendor/assets/javascripts/mxn.openmq.core.js +364 -0
  53. data/vendor/assets/javascripts/mxn.openspace.core-min.js +15 -0
  54. data/vendor/assets/javascripts/mxn.openspace.core.js +460 -0
  55. data/vendor/assets/javascripts/mxn.ovi.core-min.js +15 -0
  56. data/vendor/assets/javascripts/mxn.ovi.core.js +508 -0
  57. data/vendor/assets/javascripts/mxn.ovi.geocoder-min.js +15 -0
  58. data/vendor/assets/javascripts/mxn.ovi.geocoder.js +129 -0
  59. data/vendor/assets/javascripts/mxn.yahoo.core-min.js +15 -0
  60. data/vendor/assets/javascripts/mxn.yahoo.core.js +406 -0
  61. data/vendor/assets/javascripts/mxn.yandex.core-min.js +15 -0
  62. data/vendor/assets/javascripts/mxn.yandex.core.js +527 -0
  63. data/vendor/assets/javascripts/mxn.yandex.geocoder-min.js +15 -0
  64. data/vendor/assets/javascripts/mxn.yandex.geocoder.js +66 -0
  65. metadata +110 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mapstraction.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ mapstraction-rails (2.0.18)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ mapstraction-rails!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Alex Reis
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Mapstraction
2
+
3
+ Mapstraction (http://mapstraction.com) is a programming library that provides a common interface for numerous javascript mapping libraries to enable switching from one to another as smoothly as possible. Developers can code their web applications once, and then easily switch the mapping provider based on project needs, terms and conditions, and new functionality.
4
+
5
+ This gem packages it up for usage in the Rails 3.1+ asset pipeline
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile under the asset scope:
10
+
11
+ gem 'mapstraction-rails'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install mapstraction-rails
20
+
21
+ ## Usage
22
+
23
+ In application.js require mxn.js and the provider you want (i.e.
24
+ mxn.google.js)
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ module Mapstraction
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Mapstraction
2
+ VERSION = "2.0.18.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "mapstraction/engine"
2
+ require "mapstraction/version"
3
+
4
+ module Mapstraction
5
+ end
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/mapstraction/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Alex Reis"]
6
+ gem.email = ["alex@alexmreis.com"]
7
+ gem.description = %q{Mapstraction gemmed up for use in rails 3.1+ apps}
8
+ gem.summary = %q{Mapstraction abstracts mapping APIs so you can easily switch from Google Maps to something else}
9
+ gem.homepage = "http://github.com/alexmreis/mapstraction-rails"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "mapstraction-rails"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Mapstraction::VERSION
17
+ end
data/vendor/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,15 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ (function(){var g=null;var c="core";var d;var e=document.getElementsByTagName("script");for(var h=0;h<e.length;h++){var k=e[h].src.replace(/%20/g,"").match(/^(.*?)mxn\.js(\?\(\[?(.*?)\]?\))?$/);if(k!==null){d=k[1];if(k[3]){var b=k[3].split(",[");g=b[0].replace("]","");if(b[1]){c+=","+b[1]}}break}}if(g===null||g=="none"){return}g=g.replace(/ /g,"").split(",");c=c.replace(/ /g,"").split(",");var l='<script type="text/javascript" src="'+d+"mxn.";var m='.js"><\/script>';var a=[];for(h=0;h<c.length;h++){a.push(l+c[h]+m);for(var f=0;f<g.length;f++){a.push(l+g[f]+"."+c[h]+m)}}document.write(a.join(""))})();(function(){var c={};var b=function(i,h,g,e,f){if(!d(i,h,g)){throw"Method "+g+" of object "+h+" is not supported by API "+i+". Are you missing a script tag?"}if(typeof(c[i][h].deferrable)!="undefined"&&c[i][h].deferrable[g]===true){a.deferUntilLoaded.call(e,function(){return c[i][h][g].apply(e,f)})}else{return c[i][h][g].apply(e,f)}};var d=function(g,f,e){if(typeof(c[g])=="undefined"){throw"API "+g+" not loaded. Are you missing a script tag?"}if(typeof(c[g][f])=="undefined"){throw"Object definition "+f+" in API "+g+" not loaded. Are you missing a script tag?"}return typeof(c[g][f][e])=="function"};var a=window.mxn={register:function(f,e){if(!c.hasOwnProperty(f)){c[f]={}}a.util.merge(c[f],e)},addProxyMethods:function(g,j,f){for(var e=0;e<j.length;e++){var h=j[e];if(f){g.prototype[h]=new Function("return this.invoker.go('"+h+"', arguments, { overrideApi: true } );")}else{g.prototype[h]=new Function("return this.invoker.go('"+h+"', arguments);")}}},checkLoad:function(f){if(this.loaded[this.api]===false){var e=this;this.onload[this.api].push(function(){f.callee.apply(e,f)});return true}return false},deferUntilLoaded:function(e){if(this.loaded[this.api]===false){var f=this;this.onload[this.api].push(e)}else{e.call(this)}},addEvents:function(f,h){for(var e=0;e<h.length;e++){var g=h[e];if(g in f){throw"Event or method "+g+" already declared."}f[g]=new a.Event(g,f)}}};a.Event=function(g,f){var e=[];if(!g){throw"Event name must be provided"}this.addHandler=function(i,h){e.push({context:h,handler:i})};this.removeHandler=function(k,h){for(var j=0;j<e.length;j++){if(e[j].handler==k&&e[j].context==h){e.splice(j,1)}}};this.removeAllHandlers=function(){e=[]};this.fire=function(k){var h=[g,f,k];for(var j=0;j<e.length;j++){e[j].handler.apply(e[j].context,h)}}};a.Invoker=function(g,h,k){var j=g;var f=h;var e=k;var i={overrideApi:false,context:null,fallback:null};this.go=function(o,m,l){m=typeof(m)!="undefined"?Array.prototype.slice.apply(m):[];if(typeof(l)=="undefined"){l=i}var n;if(l.overrideApi){n=m.shift()}else{n=e.apply(j)}if(typeof(n)!="string"){throw"API ID not available."}if(typeof(l.context)!="undefined"&&l.context!==null){m.push(l.context)}if(typeof(l.fallback)=="function"&&!d(n,f,o)){return l.fallback.apply(j,m)}else{return b(n,f,o,j,m)}}};a.util={merge:function(g,e){for(var f in e){if(e.hasOwnProperty(f)){if(!g.hasOwnProperty(f)||typeof(g[f])!=="object"||typeof(e[f])!=="object"){g[f]=e[f]}else{a.util.merge(g[f],e[f])}}}},$m:function(){var g=[];for(var f=0;f<arguments.length;f++){var e=arguments[f];if(typeof(e)=="string"){e=document.getElementById(e)}if(arguments.length==1){return e}g.push(e)}return g},loadScript:function(i,j){var f=document.createElement("script");f.type="text/javascript";f.src=i;if(j){if(f.addEventListener){f.addEventListener("load",j,true)}else{if(f.attachEvent){var e=false;f.attachEvent("onreadystatechange",function(){if(!e&&document.readyState==="complete"){e=true;j()}})}}}var g=document.getElementsByTagName("head")[0];g.appendChild(f);return},convertLatLonXY_Yahoo:function(e,l){var h=1<<(26-l);var j=h/360;var k=h/(2*Math.PI);var g=new YCoordPoint(h/2,h/2);var i=new YCoordPoint();i.x=Math.floor(g.x+e.lon*j);var f=Math.sin(e.lat*Math.PI/180);i.y=Math.floor(g.y+0.5*Math.log((1+f)/(1-f))*-k);return i},loadStyle:function(e){var f=document.createElement("link");f.type="text/css";f.rel="stylesheet";f.href=e;document.getElementsByTagName("head")[0].appendChild(f);return},getStyle:function(e,g){var f;if(e.currentStyle){f=e.currentStyle[g]}else{if(window.getComputedStyle){f=window.getComputedStyle(e,"").getPropertyValue(g)}}return f},lonToMetres:function(f,e){return f*(111200*Math.cos(e*(Math.PI/180)))},metresToLon:function(e,f){return e/(111200*Math.cos(f*(Math.PI/180)))},KMToMiles:function(e){return e/1.609344},milesToKM:function(e){return e*1.609344},getDegreesFromGoogleZoomLevel:function(f,e){return(360*f)/(Math.pow(2,e+8))},getGoogleZoomLevelFromDegrees:function(f,e){return a.util.logN((360*f)/e,2)-8},logN:function(e,f){return Math.log(e)/Math.log(f)},getAvailableProviders:function(){var f=[];for(var e in c){if(c.hasOwnProperty(e)){f.push(e)}}return f},stringFormat:function(g){var f=/\{\d+\}/g;var e=Array.prototype.slice.apply(arguments);e.shift();return g.replace(f,function(i){var h=i.slice(1,-1);return e[h]})},traverse:function(h){var f=Array.prototype.slice.apply(arguments);f.shift();var e=h;while(typeof(e)!="undefined"&&e!==null&&f.length>0){var g=f.shift();e=g(e)}}};a.util.Color=function(){if(arguments.length==3){this.red=arguments[0];this.green=arguments[1];this.blue=arguments[2]}else{if(arguments.length==1){this.setHexColor(arguments[0])}}};a.util.Color.prototype.reHex=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;a.util.Color.prototype.setHexColor=function(f){var e=f.match(this.reHex);if(e){f=e[1]}else{throw"Invalid HEX color format, expected #000, 000, #000000 or 000000"}if(f.length==3){f=f.replace(/\w/g,function(g){return g.concat(g)})}this.red=parseInt(f.substr(0,2),16);this.green=parseInt(f.substr(2,2),16);this.blue=parseInt(f.substr(4,2),16)};a.util.Color.prototype.getHexColor=function(){var f=this.blue|(this.green<<8)|(this.red<<16);var e=f.toString(16).toUpperCase();if(e.length<6){e="0"+e}return"#"+e}})();
@@ -0,0 +1,15 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register("cartociudad",{Geocoder:{init:function(){this.geocoders[this.api]=new metodosCartociudad()},geocode:function(b){var a={};var c=this;b.error=0;this.geocoders[this.api].queryNomenclator(b);if(b.error!==0){this.error_callback(b)}else{this.geocoders[this.api].addressToMapstraction(b);this.callback(b)}},geocode_callback:function(b,c){var a={}}}});
@@ -0,0 +1,46 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register('cartociudad', {
16
+
17
+ Geocoder: {
18
+
19
+ init: function() {
20
+ this.geocoders[this.api] = new metodosCartociudad();
21
+ },
22
+
23
+ geocode: function(address){
24
+ var return_location = {};
25
+ var mapstraction_geodocer = this;
26
+
27
+ address.error = 0; //creamos una variable para devolver errores
28
+
29
+ this.geocoders[this.api].queryNomenclator(address);
30
+
31
+ if (address.error !== 0) {
32
+ this.error_callback(address);
33
+ }
34
+ else {
35
+ this.geocoders[this.api].addressToMapstraction(address);
36
+ this.callback(address);
37
+ }
38
+ },
39
+
40
+ geocode_callback: function(response, mapstraction_geocoder){
41
+ var return_location = {};
42
+
43
+ // TODO: Add provider code
44
+ }
45
+ }
46
+ });
@@ -0,0 +1,15 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register("cloudmade",{Mapstraction:{init:function(a,b){var d=this;var c={key:cloudmade_key};if(typeof cloudmade_styleId!="undefined"){c.styleId=cloudmade_styleId}var e=new CM.Tiles.CloudMade.Web(c);this.maps[b]=new CM.Map(a,e);this.loaded[b]=true;CM.Event.addListener(this.maps[b],"click",function(g,f){if(f&&f.mapstraction_marker){f.mapstraction_marker.click.fire()}else{if(g){d.click.fire({location:new mxn.LatLonPoint(g.lat(),g.lng())})}}if(g){d.clickHandler(g.lat(),g.lng(),g,d)}});CM.Event.addListener(this.maps[b],"dragend",function(){d.endPan.fire()});CM.Event.addListener(this.maps[b],"zoomend",function(){d.changeZoom.fire()})},applyOptions:function(){var a=this.maps[this.api];if(this.options.enableScrollWheelZoom){a.enableScrollWheelZoom()}else{a.disableScrollWheelZoom()}},resizeTo:function(b,a){this.maps[this.api].checkResize()},addControls:function(a){var b=this.maps[this.api];var d=this.addControlsArgs;switch(d.zoom){case"large":this.addLargeControls();break;case"small":this.addSmallControls();break}if(d.map_type){this.addMapTypeControls()}if(d.scale){b.addControl(new CM.ScaleControl());this.addControlsArgs.scale=true}},addSmallControls:function(){var a=this.maps[this.api];a.addControl(new CM.SmallMapControl());this.addControlsArgs.zoom="small"},addLargeControls:function(){var a=this.maps[this.api];a.addControl(new CM.LargeMapControl());this.addControlsArgs.zoom="large"},addMapTypeControls:function(){var a=this.maps[this.api];a.addControl(new CM.TileLayerControl());this.addControlsArgs.map_type=true},dragging:function(a){var b=this.maps[this.api];if(a){b.enableDragging()}else{b.disableDragging()}},setCenterAndZoom:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);d.setCenter(c,b)},addMarker:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);return c},removeMarker:function(a){var b=this.maps[this.api];a.proprietary_marker.closeInfoWindow();b.removeOverlay(a.proprietary_marker)},declutterMarkers:function(a){var b=this.maps[this.api]},addPolyline:function(b,a){var d=this.maps[this.api];var c=b.toProprietary(this.api);d.addOverlay(c);return c},removePolyline:function(a){var b=this.maps[this.api];b.removeOverlay(a.proprietary_polyline)},getCenter:function(){var b=this.maps[this.api];var a=b.getCenter();return new mxn.LatLonPoint(a.lat(),a.lng())},setCenter:function(a,b){var d=this.maps[this.api];var c=a.toProprietary(this.api);if(b!==null&&b.pan){d.panTo(c)}else{d.setCenter(c)}},setZoom:function(a){var b=this.maps[this.api];b.setZoom(a)},getZoom:function(){var a=this.maps[this.api];return a.getZoom()},getZoomLevelForBoundingBox:function(e){var d=this.maps[this.api];var c=e.getNorthEast();var a=e.getSouthWest();var b=d.getBoundsZoomLevel(new CM.LatLngBounds(a.toProprietary(this.api),c.toProprietary(this.api)));return b},setMapType:function(a){var b=this.maps[this.api];switch(a){case mxn.Mapstraction.ROAD:break;case mxn.Mapstraction.SATELLITE:break;case mxn.Mapstraction.HYBRID:break;default:}},getMapType:function(){var a=this.maps[this.api];return mxn.Mapstraction.ROAD},getBounds:function(){var d=this.maps[this.api];var b=d.getBounds();var a=b.getSouthWest();var c=b.getNorthEast();return new mxn.BoundingBox(a.lat(),a.lng(),c.lat(),c.lng())},setBounds:function(b){var d=this.maps[this.api];var a=b.getSouthWest();var c=b.getNorthEast();d.zoomToBounds(new CM.LatLngBounds(a.toProprietary(this.api),c.toProprietary(this.api)))},addImageOverlay:function(c,a,e,i,f,g,d,h){var b=this.maps[this.api]},setImagePosition:function(e,b){var d=this.maps[this.api];var c;var a},addOverlay:function(a,b){var c=this.maps[this.api]},addTileLayer:function(f,a,b,d,e){var c=this.maps[this.api]},toggleTileLayer:function(b){var a=this.maps[this.api]},getPixelRatio:function(){var a=this.maps[this.api]},mousePosition:function(a){var b=this.maps[this.api]}},LatLonPoint:{toProprietary:function(){var a=new CM.LatLng(this.lat,this.lon);return a},fromProprietary:function(a){this.lat=a.lat();this.lon=a.lng()}},Marker:{toProprietary:function(){var d=this.location.toProprietary(this.api);var a={};if(this.iconUrl){var b=new CM.Icon();b.image=this.iconUrl;if(this.iconSize){b.iconSize=new CM.Size(this.iconSize[0],this.iconSize[1]);if(this.iconAnchor){b.iconAnchor=new CM.Point(this.iconAnchor[0],this.iconAnchor[1])}}if(this.iconShadowUrl){b.shadow=this.iconShadowUrl;if(this.iconShadowSize){b.shadowSize=new CM.Size(this.iconShadowSize[0],this.iconShadowSize[1])}}a.icon=b}if(this.labelText){a.title=this.labelText}var c=new CM.Marker(d,a);if(this.infoBubble){c.bindInfoWindow(this.infoBubble)}return c},openBubble:function(){var a=this.proprietary_marker;a.openInfoWindow(this.infoBubble)},hide:function(){var a=this.proprietary_marker;a.hide()},show:function(){var a=this.proprietary_marker;a.show()},update:function(){}},Polyline:{toProprietary:function(){var d=[];var c;for(var a=0,b=this.points.length;a<b;a++){d.push(this.points[a].toProprietary(this.api))}if(this.closed||d[0].equals(d[d.length-1])){c=new CM.Polygon(d,this.color,this.width,this.opacity,this.fillColor||"#5462E3",this.opacity||"0.3")}else{c=new CM.Polyline(d,this.color,this.width,this.opacity)}return c},show:function(){this.proprietary_polyline.show()},hide:function(){this.proprietary_polyline.hide()}}});
@@ -0,0 +1,383 @@
1
+ /*
2
+ MAPSTRACTION v2.0.18 http://www.mapstraction.com
3
+
4
+ Copyright (c) 2012 Tom Carden, Steve Coast, Mikel Maron, Andrew Turner, Henri Bergius, Rob Moran, Derek Fowler, Gary Gale
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the Mapstraction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
+ */
15
+ mxn.register('cloudmade', {
16
+
17
+ Mapstraction: {
18
+
19
+ init: function(element, api) {
20
+ var me = this;
21
+ var opts = {
22
+ key: cloudmade_key
23
+ };
24
+ if (typeof cloudmade_styleId != "undefined"){
25
+ opts.styleId = cloudmade_styleId;
26
+ }
27
+ var cloudmade = new CM.Tiles.CloudMade.Web(opts);
28
+ this.maps[api] = new CM.Map(element, cloudmade);
29
+ this.loaded[api] = true;
30
+
31
+ CM.Event.addListener(this.maps[api], 'click', function(location,marker) {
32
+ if ( marker && marker.mapstraction_marker ) {
33
+ marker.mapstraction_marker.click.fire();
34
+ }
35
+ else if ( location ) {
36
+ me.click.fire({'location': new mxn.LatLonPoint(location.lat(), location.lng())});
37
+ }
38
+
39
+ // If the user puts their own Google markers directly on the map
40
+ // then there is no location and this event should not fire.
41
+ if ( location ) {
42
+ me.clickHandler(location.lat(),location.lng(),location,me);
43
+ }
44
+ });
45
+ CM.Event.addListener(this.maps[api], 'dragend', function() {
46
+ me.endPan.fire();
47
+ });
48
+ CM.Event.addListener(this.maps[api], 'zoomend', function() {
49
+ me.changeZoom.fire();
50
+ });
51
+ },
52
+
53
+ applyOptions: function(){
54
+ var map = this.maps[this.api];
55
+ if (this.options.enableScrollWheelZoom) {
56
+ map.enableScrollWheelZoom();
57
+ }
58
+ else {
59
+ map.disableScrollWheelZoom();
60
+ }
61
+ },
62
+
63
+ resizeTo: function(width, height){
64
+ this.maps[this.api].checkResize();
65
+ },
66
+
67
+ addControls: function( args ) {
68
+ var map = this.maps[this.api];
69
+
70
+ var c = this.addControlsArgs;
71
+ switch (c.zoom) {
72
+ case 'large':
73
+ this.addLargeControls();
74
+ break;
75
+ case 'small':
76
+ this.addSmallControls();
77
+ break;
78
+ }
79
+
80
+ if (c.map_type) {
81
+ this.addMapTypeControls();
82
+ }
83
+ if (c.scale) {
84
+ map.addControl(new CM.ScaleControl());
85
+ this.addControlsArgs.scale = true;
86
+ }
87
+ },
88
+
89
+ addSmallControls: function() {
90
+ var map = this.maps[this.api];
91
+ map.addControl(new CM.SmallMapControl());
92
+ this.addControlsArgs.zoom = 'small';
93
+ },
94
+
95
+ addLargeControls: function() {
96
+ var map = this.maps[this.api];
97
+ map.addControl(new CM.LargeMapControl());
98
+ this.addControlsArgs.zoom = 'large';
99
+ },
100
+
101
+ addMapTypeControls: function() {
102
+ var map = this.maps[this.api];
103
+ map.addControl(new CM.TileLayerControl());
104
+ this.addControlsArgs.map_type = true;
105
+ },
106
+
107
+ dragging: function(on) {
108
+ var map = this.maps[this.api];
109
+
110
+ if (on) {
111
+ map.enableDragging();
112
+ } else {
113
+ map.disableDragging();
114
+ }
115
+ },
116
+
117
+ setCenterAndZoom: function(point, zoom) {
118
+ var map = this.maps[this.api];
119
+ var pt = point.toProprietary(this.api);
120
+ map.setCenter(pt, zoom);
121
+
122
+ },
123
+
124
+ addMarker: function(marker, old) {
125
+ var map = this.maps[this.api];
126
+ var pin = marker.toProprietary(this.api);
127
+ map.addOverlay(pin);
128
+ return pin;
129
+ },
130
+
131
+ removeMarker: function(marker) {
132
+ var map = this.maps[this.api];
133
+ marker.proprietary_marker.closeInfoWindow();
134
+ map.removeOverlay(marker.proprietary_marker);
135
+ },
136
+
137
+ declutterMarkers: function(opts) {
138
+ var map = this.maps[this.api];
139
+
140
+ // TODO: Add provider code
141
+ },
142
+
143
+ addPolyline: function(polyline, old) {
144
+ var map = this.maps[this.api];
145
+ var pl = polyline.toProprietary(this.api);
146
+ map.addOverlay(pl);
147
+ return pl;
148
+ },
149
+
150
+ removePolyline: function(polyline) {
151
+ var map = this.maps[this.api];
152
+ map.removeOverlay(polyline.proprietary_polyline);
153
+ },
154
+
155
+ getCenter: function() {
156
+ var map = this.maps[this.api];
157
+ var pt = map.getCenter();
158
+
159
+ return new mxn.LatLonPoint(pt.lat(), pt.lng());
160
+ },
161
+
162
+ setCenter: function(point, options) {
163
+ var map = this.maps[this.api];
164
+ var pt = point.toProprietary(this.api);
165
+ if(options !== null && options.pan) { map.panTo(pt); }
166
+ else { map.setCenter(pt); }
167
+ },
168
+
169
+ setZoom: function(zoom) {
170
+ var map = this.maps[this.api];
171
+ map.setZoom(zoom);
172
+ },
173
+
174
+ getZoom: function() {
175
+ var map = this.maps[this.api];
176
+ return map.getZoom();
177
+ },
178
+
179
+ getZoomLevelForBoundingBox: function( bbox ) {
180
+ var map = this.maps[this.api];
181
+ // NE and SW points from the bounding box.
182
+ var ne = bbox.getNorthEast();
183
+ var sw = bbox.getSouthWest();
184
+
185
+ var zoom = map.getBoundsZoomLevel(new CM.LatLngBounds(sw.toProprietary(this.api), ne.toProprietary(this.api)));
186
+ return zoom;
187
+ },
188
+
189
+ setMapType: function(type) {
190
+ var map = this.maps[this.api];
191
+
192
+ // TODO: Are there any MapTypes for Cloudmade?
193
+
194
+ switch(type) {
195
+ case mxn.Mapstraction.ROAD:
196
+ // TODO: Add provider code
197
+ break;
198
+ case mxn.Mapstraction.SATELLITE:
199
+ // TODO: Add provider code
200
+ break;
201
+ case mxn.Mapstraction.HYBRID:
202
+ // TODO: Add provider code
203
+ break;
204
+ default:
205
+ // TODO: Add provider code
206
+ }
207
+ },
208
+
209
+ getMapType: function() {
210
+ var map = this.maps[this.api];
211
+
212
+ // TODO: Are there any MapTypes for Cloudmade?
213
+
214
+ return mxn.Mapstraction.ROAD;
215
+ //return mxn.Mapstraction.SATELLITE;
216
+ //return mxn.Mapstraction.HYBRID;
217
+
218
+ },
219
+
220
+ getBounds: function () {
221
+ var map = this.maps[this.api];
222
+
223
+ var box = map.getBounds();
224
+ var sw = box.getSouthWest();
225
+ var ne = box.getNorthEast();
226
+
227
+ return new mxn.BoundingBox(sw.lat(), sw.lng(), ne.lat(), ne.lng());
228
+ },
229
+
230
+ setBounds: function(bounds){
231
+ var map = this.maps[this.api];
232
+ var sw = bounds.getSouthWest();
233
+ var ne = bounds.getNorthEast();
234
+
235
+ map.zoomToBounds(new CM.LatLngBounds(sw.toProprietary(this.api), ne.toProprietary(this.api)));
236
+ },
237
+
238
+ addImageOverlay: function(id, src, opacity, west, south, east, north, oContext) {
239
+ var map = this.maps[this.api];
240
+
241
+ // TODO: Add provider code
242
+ },
243
+
244
+ setImagePosition: function(id, oContext) {
245
+ var map = this.maps[this.api];
246
+ var topLeftPoint; var bottomRightPoint;
247
+
248
+ // TODO: Add provider code
249
+
250
+ },
251
+
252
+ addOverlay: function(url, autoCenterAndZoom) {
253
+ var map = this.maps[this.api];
254
+
255
+ // TODO: Add provider code
256
+
257
+ },
258
+
259
+ addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, max_zoom) {
260
+ var map = this.maps[this.api];
261
+
262
+ // TODO: Add provider code
263
+ },
264
+
265
+ toggleTileLayer: function(tile_url) {
266
+ var map = this.maps[this.api];
267
+
268
+ // TODO: Add provider code
269
+ },
270
+
271
+ getPixelRatio: function() {
272
+ var map = this.maps[this.api];
273
+
274
+ // TODO: Add provider code
275
+ },
276
+
277
+ mousePosition: function(element) {
278
+ var map = this.maps[this.api];
279
+
280
+ // TODO: Add provider code
281
+ }
282
+ },
283
+
284
+ LatLonPoint: {
285
+
286
+ toProprietary: function() {
287
+ var cll = new CM.LatLng(this.lat,this.lon);
288
+ return cll;
289
+ },
290
+
291
+ fromProprietary: function(point) {
292
+ this.lat = point.lat();
293
+ this.lon = point.lng();
294
+ }
295
+
296
+ },
297
+
298
+ Marker: {
299
+
300
+ toProprietary: function() {
301
+ var pt = this.location.toProprietary(this.api);
302
+ var options = {};
303
+
304
+ if (this.iconUrl) {
305
+ var cicon = new CM.Icon();
306
+ cicon.image = this.iconUrl;
307
+ if (this.iconSize) {
308
+ cicon.iconSize = new CM.Size(this.iconSize[0], this.iconSize[1]);
309
+ if (this.iconAnchor) {
310
+ cicon.iconAnchor = new CM.Point(this.iconAnchor[0], this.iconAnchor[1]);
311
+ }
312
+ }
313
+ if (this.iconShadowUrl) {
314
+ cicon.shadow = this.iconShadowUrl;
315
+ if (this.iconShadowSize) {
316
+ cicon.shadowSize = new CM.Size(this.iconShadowSize[0], this.iconShadowSize[1]);
317
+ }
318
+ }
319
+ options.icon = cicon;
320
+ }
321
+ if (this.labelText) {
322
+ options.title = this.labelText;
323
+ }
324
+ var cmarker = new CM.Marker(pt, options);
325
+
326
+ if (this.infoBubble) {
327
+ cmarker.bindInfoWindow(this.infoBubble);
328
+ }
329
+
330
+
331
+ return cmarker;
332
+ },
333
+
334
+ openBubble: function() {
335
+ var pin = this.proprietary_marker;
336
+ pin.openInfoWindow(this.infoBubble);
337
+ },
338
+
339
+ hide: function() {
340
+ var pin = this.proprietary_marker;
341
+ pin.hide();
342
+ },
343
+
344
+ show: function() {
345
+ var pin = this.proprietary_marker;
346
+ pin.show();
347
+ },
348
+
349
+ update: function() {
350
+ // TODO: Add provider code
351
+ }
352
+
353
+ },
354
+
355
+ Polyline: {
356
+
357
+ toProprietary: function() {
358
+ var pts = [];
359
+ var poly;
360
+
361
+ for (var i = 0, length = this.points.length ; i< length; i++){
362
+ pts.push(this.points[i].toProprietary(this.api));
363
+ }
364
+ if (this.closed || pts[0].equals(pts[pts.length-1])) {
365
+ poly = new CM.Polygon(pts, this.color, this.width, this.opacity, this.fillColor || "#5462E3", this.opacity || "0.3");
366
+ }
367
+ else {
368
+ poly = new CM.Polyline(pts, this.color, this.width, this.opacity);
369
+ }
370
+ return poly;
371
+ },
372
+
373
+ show: function() {
374
+ this.proprietary_polyline.show();
375
+ },
376
+
377
+ hide: function() {
378
+ this.proprietary_polyline.hide();
379
+ }
380
+
381
+ }
382
+
383
+ });