// Generated by CoffeeScript 1.6.3
(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() 
 ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['backbone', 'underscore', 'jquery', 'leaflet'], function(Backbone, _, $) {
    var RouteMapDetailView, _ref;
    RouteMapDetailView = (function(_super) {
      __extends(RouteMapDetailView, _super);

      function RouteMapDetailView() {
        _ref = RouteMapDetailView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      RouteMapDetailView.prototype.el = '.map-block';

      RouteMapDetailView.prototype.initialize = function() {
        return this.render();
      };

      RouteMapDetailView.prototype.render = function() {
        var layer, map, vectorData, vectorLayer;
        this.$el.html('<div id="map"></div>');
        map = new L.Map('map');
        layer = L.tileLayer('http://{s}.tile.cloudmade.com/9d0b97ba4e6d403aad532091aaafbc0b/997/256/{z}/{x}/{y}.png', {
          attribution: 'Cloudmade',
          maxZoom: 18
        });
        layer.addTo(map);
        vectorData = {
          type: 'Feature',
          geometry: this.model.get('st_asgeojson')
        };
        vectorLayer = L.geoJson();
        vectorLayer.addTo(map);
        vectorLayer.addData(vectorData);
        console.log(vectorLayer.getBounds());
        return map.fitBounds(vectorLayer.getBounds());
      };

      return RouteMapDetailView;

    })(Backbone.View);
    return RouteMapDetailView;
  });

}).call(this);

{ this.constructor = child; }