diff options
| author | Michel Etienne | 2012-11-06 18:53:29 +0100 | 
|---|---|---|
| committer | Michel Etienne | 2012-11-06 18:53:29 +0100 | 
| commit | 48842ac1197560b1b7f597e3e1be7c4d93f8d098 (patch) | |
| tree | dfeee03bf8ae1fb2b4a665b61c95bfe33056105f | |
| parent | c1c4d3fbc9231fe6b1bdd325faced49f33cdf1b2 (diff) | |
| download | chouette-core-48842ac1197560b1b7f597e3e1be7c4d93f8d098.tar.bz2 | |
add access_points and access_links managment
51 files changed, 1443 insertions, 60 deletions
| @@ -42,6 +42,7 @@ gem "acts_as_tree", :git => "git://github.com/dryade/acts_as_tree.git"  #gem 'ninoxe', :git => 'git://github.com/dryade/ninoxe.git'  #gem 'ninoxe', :git => 'git://github.com/dryade/ninoxe.git', :branch => 'V2_0_0'  gem 'ninoxe', :git => 'git://chouette.dryade.priv/ninoxe' #, :path => '~/Projects/Ninoxe' +#gem 'ninoxe', :path => '~/workspace/chouette/ninoxe'  gem 'acts_as_list', '0.1.6'  #gem 'composite_primary_keys', '~> 5.0.8' diff --git a/Gemfile.lock b/Gemfile.lock index da9f5dc21..1c583f2c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@  GIT    remote: git://chouette.dryade.priv/ninoxe -  revision: f6eceeafbdf02f5898256c467e86c60a045737ba +  revision: 7485cd03aee6e44165cf70c1902f7dbfcc272d3c    specs:      ninoxe (0.0.8)        GeoRuby @@ -225,7 +225,7 @@ GEM      map_layers (0.0.5)      mime-types (1.19)      modernizr-rails (2.0.6) -    multi_json (1.3.6) +    multi_json (1.3.7)      net-scp (1.0.4)        net-ssh (>= 1.99.1)      net-sftp (2.0.5) @@ -330,10 +330,10 @@ GEM      therubyrhino_jar (1.7.4)      thor (0.16.0)      tilt (1.3.3) -    treetop (1.4.11) +    treetop (1.4.12)        polyglot        polyglot (>= 0.3.1) -    tzinfo (0.3.33) +    tzinfo (0.3.35)      uglifier (1.2.7)        execjs (>= 0.3.0)        multi_json (~> 1.3) diff --git a/app/assets/images/icons/disabled_left_arrow.png b/app/assets/images/icons/disabled_left_arrow.pngBinary files differ new file mode 100644 index 000000000..d919ca52e --- /dev/null +++ b/app/assets/images/icons/disabled_left_arrow.png diff --git a/app/assets/images/icons/disabled_right_arrow.png b/app/assets/images/icons/disabled_right_arrow.pngBinary files differ new file mode 100644 index 000000000..57793256b --- /dev/null +++ b/app/assets/images/icons/disabled_right_arrow.png diff --git a/app/assets/images/icons/gray_left_arrow.png b/app/assets/images/icons/gray_left_arrow.pngBinary files differ new file mode 100644 index 000000000..7dc80a93e --- /dev/null +++ b/app/assets/images/icons/gray_left_arrow.png diff --git a/app/assets/images/icons/gray_right_arrow.png b/app/assets/images/icons/gray_right_arrow.pngBinary files differ new file mode 100644 index 000000000..a2fa02a7c --- /dev/null +++ b/app/assets/images/icons/gray_right_arrow.png diff --git a/app/assets/images/icons/green_left_arrow.png b/app/assets/images/icons/green_left_arrow.pngBinary files differ new file mode 100644 index 000000000..26149186d --- /dev/null +++ b/app/assets/images/icons/green_left_arrow.png diff --git a/app/assets/images/icons/green_right_arrow.png b/app/assets/images/icons/green_right_arrow.pngBinary files differ new file mode 100644 index 000000000..09ac3eec9 --- /dev/null +++ b/app/assets/images/icons/green_right_arrow.png diff --git a/app/assets/images/map/access_in.png b/app/assets/images/map/access_in.pngBinary files differ new file mode 100644 index 000000000..82ea29382 --- /dev/null +++ b/app/assets/images/map/access_in.png diff --git a/app/assets/images/map/access_in_out.png b/app/assets/images/map/access_in_out.pngBinary files differ new file mode 100644 index 000000000..82ea29382 --- /dev/null +++ b/app/assets/images/map/access_in_out.png diff --git a/app/assets/images/map/access_out.png b/app/assets/images/map/access_out.pngBinary files differ new file mode 100644 index 000000000..82ea29382 --- /dev/null +++ b/app/assets/images/map/access_out.png diff --git a/app/assets/javascripts/access_points.js.coffee b/app/assets/javascripts/access_points.js.coffee new file mode 100644 index 000000000..c0f49ebd5 --- /dev/null +++ b/app/assets/javascripts/access_points.js.coffee @@ -0,0 +1,30 @@ +jQuery -> +  x_y_change = (event) ->  +    if referential_projection != undefined +      referential_point = new OpenLayers.Geometry.Point($('input#access_point_longitude').val(), $('input#access_point_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )       +       +      $('input#access_point_x').val(referential_point.x) +      $('input#access_point_y').val(referential_point.y) +           +    feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())   +    google_point = new OpenLayers.LonLat($('input#access_point_longitude').val(), $('input#access_point_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()) +    feature.move(google_point) +    map.setCenter(google_point, 16, false, true)       + +  $('input#access_point_longitude').change(x_y_change) +  $('input#access_point_latitude').change(x_y_change) +    +  lon_lat_change = (event) ->  +    if referential_projection != undefined +      wgs84_point = new OpenLayers.Geometry.Point($('input#access_point_x').val(), $('input#access_point_y').val()).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))     +      +      $('input#access_point_longitude').val( wgs84_point.x) +      $('input#access_point_latitude').val( wgs84_point.y) + +    feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#access_point_id').val())   +    google_point =  new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()) +    feature.move(google_point) +    map.setCenter(google_point, 16, false, true)       + +  $('input#access_point_x').change(lon_lat_change) +  $('input#access_point_y').change(lon_lat_change) diff --git a/app/assets/stylesheets/access_links.css.scss b/app/assets/stylesheets/access_links.css.scss new file mode 100644 index 000000000..63a55e021 --- /dev/null +++ b/app/assets/stylesheets/access_links.css.scss @@ -0,0 +1,21 @@ +// Place all the styles related to the lines controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@import "common"; + + +#workspace.access_links.show +{ + +    .summary p label { +        font-weight: bold; +    } +    .duration { +        padding-left: 10px; +    } +     +}         + + + + diff --git a/app/assets/stylesheets/access_points.css.scss b/app/assets/stylesheets/access_points.css.scss new file mode 100644 index 000000000..7a27050fa --- /dev/null +++ b/app/assets/stylesheets/access_points.css.scss @@ -0,0 +1,104 @@ +// Place all the styles related to the lines controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@import "common"; + +#workspace.access_points.index +{ +    .access_point:after {  +        @include after_div_for_object;   +    } + +    .access_points:after { +        @include content_to_clear; +    } +     +    .access_point { +        @include div_for_object; +        /* to create multi-column index */ +        width: 250px; +        float: left; +        padding-right: 10px; + +        .access_type { +            width: 25px; +            height: 64px; +            float: left; +            margin-right: 10px; +             + +            a { +                text-decoration: none;                    +            } +        } + +    } +} + +#workspace.access_points.edit { +  legend { padding-bottom: 20px; } +} + +#workspace.access_points.show +{ +    .geo_data { +       padding-left:15px; +    } + +    .summary{ +        height: 400px; +         +        p label { +            font-weight: bold; +        } +    } +     +    .access_link_pairs { +         +        .link { +          border: 2px solid black; +        } +        .access_point{ +            float: left; +            padding: 3px 15px 0px 3px; +            height: 25px;         +            * { vertical-align:middle; } +            span { margin-left: 7px; } +            img { margin: 0px 5px 0px 5px;} +        } +        .stop_area{ +            float: left; +            padding: 3px 15px 0px 3px; +            height: 25px;         +            * { vertical-align:middle; } +            span { margin-left: 7px; } +            img { margin: 0px 5px 0px 5px;} +        } +       +      .info { +          font-size: 10px; +          color: #777; +          font-weight: normal; +          padding-top: 0px; +          padding-left: 45px; +          padding-right: 3px; +          padding-bottom: 3px; +        } +    } + +} + + +#sidebar ul.selection li {     +    a { +        line-height: 27px; +         +        img{ +            height: 25px; +            width: 25px; +            vertical-align: middle; +        } +    } +} + + diff --git a/app/assets/stylesheets/stop_areas.css.scss b/app/assets/stylesheets/stop_areas.css.scss index cd1623a05..fcfeb9fcf 100644 --- a/app/assets/stylesheets/stop_areas.css.scss +++ b/app/assets/stylesheets/stop_areas.css.scss @@ -118,6 +118,26 @@              height: 25px;          }      } +    .access_point { +        @include div_for_object; +        /* to create multi-column index */ +        width: 250px; +        float: left; +        padding-right: 10px; + +        .access_type { +            width: 25px; +            height: 64px; +            float: left; +            margin-right: 10px; +             + +            a { +                text-decoration: none;                    +            } +        } + +    }  }  #workspace.stop_areas.select_parent @@ -135,6 +155,44 @@      }  } + +#workspace.stop_areas.access_links +{ +    .access_link_pairs { +        .link { +          border: 2px solid black; +        } +       .access_point{ +            float: left; +            padding: 3px 15px 0px 3px; +            height: 25px;         +            * { vertical-align:middle; } +            span { margin-left: 7px; } +            img { margin: 0px 5px 0px 5px;} +        } +        .stop_area{ +            float: left; +            padding: 3px 15px 0px 3px; +            height: 25px;         +            * { vertical-align:middle; } +            span { margin-left: 7px; } +            img { margin: 0px 5px 0px 5px;} +        } +       +      .info { +          font-size: 10px; +          color: #777; +          font-weight: normal; +          padding-top: 0px; +          padding-left: 45px; +          padding-right: 3px; +          padding-bottom: 3px; +        } +       +    } + +} +  #sidebar ul.selection li {          a {          line-height: 27px; diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb new file mode 100644 index 000000000..4c0173d4c --- /dev/null +++ b/app/controllers/access_links_controller.rb @@ -0,0 +1,73 @@ +class AccessLinksController < ChouetteController +  defaults :resource_class => Chouette::AccessLink + +  belongs_to :referential do +    belongs_to :access_point, :parent_class => Chouette::AccessPoint, :optional => true, :polymorphic => true +    belongs_to :stop_area, :parent_class => Chouette::StopArea, :optional => true, :polymorphic => true +  end + +  respond_to :html, :kml, :xml, :json + + +  def index +    request.format.kml? ? @per_page = nil : @per_page = 12 +    index! +  end + +  def show +    #@map = AccessLinkMap.new(resource).with_helpers(self) +    show! +  end +   +  def new  +    @access_point = Chouette::AccessPoint.find(params[:access_point_id]) +    data=params[:access_link] +    @stop_area = Chouette::StopArea.find(data[:stop_area_id]) +    @orientation = data[:link_orientation_type] +    name=data[:name] +    if name.nil? || name.empty? +      if @orientation == "access_point_to_stop_area"  +        name = "#{@access_point.name} -> #{@stop_area.name}" +      else +        name = "#{@stop_area.name} -> #{@access_point.name}"         +      end +      data[:name] = name +    end +    @access_link = Chouette::AccessLink.new(data) +    new! +  end +   +  def create +    @access_point = Chouette::AccessPoint.find(params[:access_point_id]) +    data=params[:access_link] +    @stop_area = Chouette::StopArea.find(data[:stop_area_id]) +    @orientation = data[:link_orientation_type] +    create! +  end +   +  def edit +    @access_point = Chouette::AccessPoint.find(params[:access_point_id]) +    @access_link = Chouette::AccessLink.find(params[:id]) +    @stop_area = @access_link.stop_area +    @orientation = @access_link.link_orientation_type +    edit! +  end +  protected +   +  alias_method :access_link, :resource + +#  def map +#    @map = AccessLinkMap.new(access_link).with_helpers(self) +#  end + +  def collection +    @q = parent.access_links.search(params[:q]) +    @access_links ||=  +      begin +        access_links = @q.result(:distinct => true).order(:name) +        access_links = access_links.paginate(:page => params[:page]) if @per_page.present? +        access_links +      end +  end + +end diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb new file mode 100644 index 000000000..4f3c0d717 --- /dev/null +++ b/app/controllers/access_points_controller.rb @@ -0,0 +1,54 @@ +class AccessPointsController < ChouetteController +  defaults :resource_class => Chouette::AccessPoint + +  belongs_to :referential do +    belongs_to :stop_area, :parent_class => Chouette::StopArea, :optional => true, :polymorphic => true +  end + +  respond_to :html, :kml, :xml, :json + + +  def index +    request.format.kml? ? @per_page = nil : @per_page = 12 +    index! +  end + +  def show +    map.editable = false +    @access_links = @access_point.access_link_matrix +    show! do |format| +      unless access_point.position or params[:default] +        format.kml { +          render :nothing => true, :status => :not_found  +        } +         +      end +    end +  end +   +  def edit +    access_point.position ||= access_point.default_position +    map.editable = true +    edit! +  end + + +  protected +   +  alias_method :access_point, :resource + +  def map +    @map = AccessPointMap.new(access_point).with_helpers(self) +  end + +  def collection +    @q = parent.access_points.search(params[:q]) +    @access_points ||=  +      begin +        access_points = @q.result(:distinct => true).order(:name) +        access_points = access_points.paginate(:page => params[:page]) if @per_page.present? +        access_points +      end +  end + +end diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 08cf86853..dfd756d9b 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -34,6 +34,11 @@ class StopAreasController < ChouetteController      @stops = stop_area.routing_stops    end +  def access_links +    @stop_area = stop_area +    @access_links = stop_area.access_link_matrix +  end +    def index      request.format.kml? ? @per_page = nil : @per_page = 12      index! @@ -41,6 +46,7 @@ class StopAreasController < ChouetteController    def show      map.editable = false +    @access_points = @stop_area.access_points      show! do |format|        unless stop_area.position or params[:default]          format.kml { diff --git a/app/helpers/access_points_helper.rb b/app/helpers/access_points_helper.rb new file mode 100644 index 000000000..c5e9f672e --- /dev/null +++ b/app/helpers/access_points_helper.rb @@ -0,0 +1,28 @@ +module AccessPointsHelper +  def access_links_pairs(access_links) +    hpairs = Hash.new +    pairs = Array.new +    access_links.each do |link| +      key = pair_key(link) +      pair = nil +      if (hpairs.has_key? key) +        pair = hpairs[key] +      else +        pair = AccessLinkPair.new +        pairs << pair +        hpairs[key] = pair +      end +      if (link.link_orientation_type == "access_point_to_stop_area") +        pair.from_access_point = link +      else +        pair.to_access_point = link +      end +    end +    pairs +  end +   +  def pair_key(access_link) +    "#{access_link.access_point.id}-#{access_link.stop_area.id}" +  end +   +end diff --git a/app/helpers/stop_areas_helper.rb b/app/helpers/stop_areas_helper.rb new file mode 100644 index 000000000..df598b83f --- /dev/null +++ b/app/helpers/stop_areas_helper.rb @@ -0,0 +1,47 @@ +module StopAreasHelper +  def genealogical_title +    return t(".genealogical_routing") if @stop_area.stop_area_type == 'itl'     +    t(".genealogical") +  end +   +  def manage_access_points +    @stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point' +  end +  def manage_itl +    @stop_area.stop_area_type == 'itl' +  end +  def manage_parent +    @stop_area.stop_area_type != 'itl' +  end +  def manage_children +    @stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point' +  end +   +  def access_links_pairs(access_links) +    hpairs = Hash.new +    pairs = Array.new +    access_links.each do |link| +      key = pair_key(link) +      pair = nil +      if (hpairs.has_key? key) +        pair = hpairs[key] +      else +        pair = AccessLinkPair.new +        pairs << pair +        hpairs[key] = pair +      end +      if (link.link_orientation_type == "access_point_to_stop_area") +        pair.from_access_point = link +      else +        pair.to_access_point = link +      end +    end +    pairs +  end +   +  def pair_key(access_link) +    "#{access_link.access_point.id}-#{access_link.stop_area.id}" +  end + + +end diff --git a/app/maps/access_point_map.rb b/app/maps/access_point_map.rb new file mode 100644 index 000000000..ebb513ab0 --- /dev/null +++ b/app/maps/access_point_map.rb @@ -0,0 +1,62 @@ +class AccessPointMap < ApplicationMap + +  attr_reader :access_point + +  attr_accessor :editable +  alias_method :editable?, :editable + +  def initialize(access_point) +    @access_point = access_point +  end + +  def map +    @map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page| +      page << map.add_layer(MapLayers::OSM_MAPNIK) +      page << map.add_layer(google_physical)  +      page << map.add_layer(google_streets)  +      page << map.add_layer(google_hybrid)  +      page << map.add_layer(google_satellite)  + +      page.assign "edit_access_point_layer", kml_layer(access_point, { :default => editable? }, :style_map => StyleMap::EditAccessPointStyleMap.new(helpers).style_map) +      page << map.add_layer(:edit_access_point_layer) +       +       +      if editable? +       page.assign "referential_projection", projection_type.present? ? projection("EPSG:" + projection_type) : JsVar.new("undefined")   +        # TODO virer ce code inline        +        page << <<EOF +        edit_access_point_layer.events.on({  +                          'afterfeaturemodified': function(event) {  +                            geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")); +                            $('#access_point_longitude').val(geometry.x); +                            $('#access_point_latitude').val(geometry.y); + +                            if(referential_projection != undefined) +                            { +                              projection_geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), referential_projection ); +                              $('#access_point_x').val(projection_geometry.x); +                              $('#access_point_y').val(projection_geometry.y);                                                   } +                           } +                        }); +EOF +        page << map.add_control(OpenLayers::Control::ModifyFeature.new(:edit_access_point_layer, :mode => 8, :autoActivate => true)) + +      end + +      page << map.set_center(center.to_google.to_openlayers, 16, false, true) +    end +  end +   +  def projection_type +    access_point.referential.projection_type +  end + +  def ready? +    center.present? +  end + +  def center +    access_point.geometry or access_point.default_position +  end + +end diff --git a/app/maps/style_map/access_points_style_map.rb b/app/maps/style_map/access_points_style_map.rb new file mode 100644 index 000000000..c3bf2586f --- /dev/null +++ b/app/maps/style_map/access_points_style_map.rb @@ -0,0 +1,39 @@ +class StyleMap::AccessPointsStyleMap < StyleMap::GenericStyleMap +  attr_accessor :style, :context +   +  def default_style +    raise "Helpers nil" if @helpers.nil? +    {:label => "${label}", +     :fontColor => "black", +     :fontSize => "11px", +     :fontWeight => "bold", +     :labelAlign => "ct", +     :labelXOffset => 0, +     :labelYOffset => -40, +     :pointRadius => 1,  +     :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"),       +     :graphicWidth => 25, +     :graphicHeight => 25,  +     :graphicOpacity => 1,     +     :graphicXOffset => -12.5, +     :graphicYOffset => -12.5 } +  end + +  def initialize(helpers,options = {}) +    @helpers= helpers +    @style = options[:style].present? ? default_style.merge(options[:style]) : default_style +  end + +   +  def context +    { +      :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ",  +      :accessType => :" function(feature) { return feature.attributes.access_type.toLowerCase();} "  +    } +  end + +  def style_map +    OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context})                             ) +  end + +end diff --git a/app/maps/style_map/edit_access_point_style_map.rb b/app/maps/style_map/edit_access_point_style_map.rb new file mode 100644 index 000000000..83f9298e8 --- /dev/null +++ b/app/maps/style_map/edit_access_point_style_map.rb @@ -0,0 +1,46 @@ +class StyleMap::EditAccessPointStyleMap < StyleMap::GenericStyleMap +  attr_accessor :style +   +  def default_style +    { :fontColor => "black", +      :fontSize => "11px", +      :fontWeight => "bold", +      :labelAlign => "ct", +      :labelXOffset => 0, +      :labelYOffset => -15, +      :pointRadius => 4, +      :fillColor => "white", +      :fillOpacity => 1, +      :strokeColor => "black", +      :strokeOpacity => 1, +      :strokeWidth => 2 }  +  end + +  def select_style +   { :fontColor => "black",  +     :fontSize => "11px", +     :fontWeight => "bold", +     :pointRadius => 4, +     :fillColor => "#86b41d", +     :fillOpacity => 1, +     :strokeColor => "black", +     :strokeOpacity => 1, +     :strokeWidth => 2 } +  end + +  def initialize(helpers, options = {}) +    @helpers= helpers +    @style = options[:style].present? ? default_style.merge(options[:style]) : default_style +  end + +  def context +    {  +      :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} " +    } +  end + +  def style_map +    OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select =>  OpenLayers::Style.new(style.merge( select_style), { :context => context})) +  end + +end diff --git a/app/models/access_link_pair.rb b/app/models/access_link_pair.rb new file mode 100644 index 000000000..16df48fd5 --- /dev/null +++ b/app/models/access_link_pair.rb @@ -0,0 +1,45 @@ +class AccessLinkPair +  include ActiveModel::Validations   +  include ActiveModel::Conversion   +  extend ActiveModel::Naming +   +     +  attr_accessor :from_access_point, :to_access_point +   +  validates_presence_of :from_access_point, :to_access_point + +  def initialize(attributes = {}) +    attributes.each do |name, value|   +      send("#{name}=", value)   +    end   +  end   +     +  def persisted?   +    false   +  end  + +  def access_point +    return nil if from_access_point.nil? +    from_access_point.access_point  +  end +   +  def stop_area +    return nil if from_access_point.nil? +    from_access_point.stop_area  +  end +   +  def in_valid? +    access_point.access_point_type != "out" +  end +   +  def out_valid? +    access_point.access_point_type != "in" +  end +   +  def in_exists? +    !from_access_point.id.nil? +  end +  def out_exists? +    !to_access_point.id.nil? +  end +end diff --git a/app/models/referential.rb b/app/models/referential.rb index b4601caee..70035a32b 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -59,6 +59,14 @@ class Referential < ActiveRecord::Base      Chouette::StopArea.scoped    end +  def access_points +    Chouette::AccessPoint.scoped +  end + +  def access_links +    Chouette::AccessLink.scoped +  end +    def time_tables      Chouette::TimeTable.scoped    end @@ -210,4 +218,31 @@ Rails.application.config.after_initialize do        end      end    end + +  Chouette::AccessPoint +   +  class Chouette::AccessPoint +      +    # add projection_type set on pre-insert and pre_update action +    before_validation :set_projections +    def set_projections +      if ! self.latitude.nil? && ! self.longitude.nil? +        self.long_lat_type = 'WGS84' +      else +        self.long_lat_type = nil +      end +      if ! self.referential.projection_type.nil? && !self.referential.projection_type.empty? +        if ! self.x.nil?  && ! self.y.nil? +          self.projection_type = referential.projection_type_label +        else +          self.projection_type = nil +        end +      else +          self.projection_type = nil +          self.x = nil +          self.y = nil +      end +    end +  end +  end diff --git a/app/views/access_link_pairs/_access_link_pair.html.erb b/app/views/access_link_pairs/_access_link_pair.html.erb new file mode 100644 index 000000000..066411e1c --- /dev/null +++ b/app/views/access_link_pairs/_access_link_pair.html.erb @@ -0,0 +1,57 @@ +<%= div_for(access_link_pair) do %> +  <tr> +  	<td class="link"> +    <div class="access_point"> +      <%= link_to([@referential, @stop_area, access_link_pair.access_point]) do %>  +        <%= image_tag "map/access_" + access_link_pair.access_point.access_point_type + ".png" %><span><%= access_link_pair.access_point.name %></span>         +      <% end %> +    </div> +    <br/><br/> +    <div class="info"> +	    <%= t("access_types.label.#{access_link_pair.access_point.access_point_type}") %> +	</div> +    </td> +    <td> +    	<% if access_link_pair.out_valid? %> +    	   <% if access_link_pair.out_exists? %> +    	      <%= link_to(referential_access_point_access_link_path(@referential, access_link_pair.access_point,access_link_pair.stop_area,access_link_pair.to_access_point)) do %> +    	         <%= image_tag "icons/green_left_arrow.png"   %> +    	      <% end %> +    	   <% else %> +    	      <%= link_to(new_referential_access_point_access_link_path(@referential, access_link_pair.access_point, :access_link => {:stop_area_id => access_link_pair.stop_area.id, :link_orientation_type => 'stop_area_to_access_point'})) do %> +    	         <%= image_tag "icons/gray_left_arrow.png"   %> +    	      <% end %> +    	   <% end %> +    	<% else %> +    	   <%= image_tag "icons/disabled_left_arrow.png"   %> +    	<% end %> +    </td> +    <td> +    	<% if access_link_pair.in_valid? %> +    	   <% if access_link_pair.in_exists? %> +    	      <%= link_to(referential_access_point_access_link_path(@referential, access_link_pair.access_point, access_link_pair.from_access_point)) do %> +    	         <%= image_tag "icons/green_right_arrow.png"   %> +    	      <% end %> +    	   <% else %> +    	      <%= link_to(new_referential_access_point_access_link_path(@referential, access_link_pair.access_point, :access_link => {:stop_area_id => access_link_pair.stop_area.id, :link_orientation_type => 'access_point_to_stop_area'})) do %> +    	         <%= image_tag "icons/gray_right_arrow.png"   %> +    	      <% end %> +    	   <% end %> +    	<% else %> +    	   <%= image_tag "icons/disabled_right_arrow.png"   %> +    	<% end %> +    </td> +  	<td class="link"> +    <div class="stop_area"> +      <%= link_to([@referential, access_link_pair.stop_area]) do %>  +        <%= image_tag "map/" + access_link_pair.stop_area.stop_area_type + ".png" %><span><%= access_link_pair.stop_area.name %></span>         +      <% end %> +    </div> +    <br/><br/> +    <div class="info"> +	    <%= t("area_types.label.#{access_link_pair.stop_area.stop_area_type}") %> +	</div> +    </td> +  </tr> +  <tr><td colspan=4> </td></tr> +<% end %> diff --git a/app/views/access_links/_form.html.erb b/app/views/access_links/_form.html.erb new file mode 100644 index 000000000..e07de415f --- /dev/null +++ b/app/views/access_links/_form.html.erb @@ -0,0 +1,35 @@ +<%= semantic_form_for [@referential,@access_point,@access_link] do |form| %> +  <%= form.inputs do %>  +    <%= form.input :access_point_id , :as => :hidden %> +    <%= form.input :stop_area_id , :as => :hidden %> +    <%= form.input :link_orientation_type , :as => :hidden%> +    <%= form.input :name %> +    <%= form.input :access_link_type, :as => :select, :collection => Chouette::AccessLink.access_link_types, :include_blank => false, :member_label => Proc.new { |type| t("connection_link_types.label.#{type}") }  %> +    <%= form.inputs :name => t('access_links.show.durations') do %>  +      <%= form.input "default_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> +      <%= form.input "default_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "default_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input :default_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("default_duration")%> +      <%= form.input "frequent_traveller_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> +      <%= form.input "frequent_traveller_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "frequent_traveller_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input :frequent_traveller_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("frequent_traveller_duration")%> +      <%= form.input "occasional_traveller_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> +      <%= form.input "occasional_traveller_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "occasional_traveller_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input :occasional_traveller_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("occasional_traveller_duration")%> +      <%= form.input "mobility_restricted_traveller_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> +      <%= form.input "mobility_restricted_traveller_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "mobility_restricted_traveller_duration(3i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input :mobility_restricted_traveller_duration, :ignore_date=>true,:include_seconds=>true, :label => @access_link.human_attribute_name("mobility_restricted_traveller_duration")%> +    <% end %> +    <%= form.input :mobility_restricted_suitability,:as => :boolean %> +    <%= form.input :stairs_availability,:as => :boolean %> +    <%= form.input :lift_availability,:as => :boolean %> +    <%= form.input :objectid, :required => !@access_link.new_record?, :input_html => { :disabled => !@access_link.new_record? } %>   +   <% end %> +   <%= form.actions do %> +     <%= form.action :submit, :as => :button %> +     <%= form.action :cancel, :as => :link %> +   <% end %> +<% end %> diff --git a/app/views/access_links/edit.html.erb b/app/views/access_links/edit.html.erb new file mode 100644 index 000000000..c954989f1 --- /dev/null +++ b/app/views/access_links/edit.html.erb @@ -0,0 +1,4 @@ +<%= title_tag t("access_links.edit.title_#{@orientation}", :access_point => @access_point.name, :stop_area => @stop_area.name ) %> + + +<%= render "form" %> diff --git a/app/views/access_links/new.html.erb b/app/views/access_links/new.html.erb new file mode 100644 index 000000000..db9a611a5 --- /dev/null +++ b/app/views/access_links/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag  t("access_links.new.title_#{@orientation}", :access_point => @access_point.name, :stop_area => @stop_area.name ) %> + +<%= render "form" %> diff --git a/app/views/access_links/show.html.erb b/app/views/access_links/show.html.erb new file mode 100644 index 000000000..27e2e9bbf --- /dev/null +++ b/app/views/access_links/show.html.erb @@ -0,0 +1,90 @@ +<%= title_tag t('access_links.show.title', :access_link => @access_link.name ) %> + +<div class="access_link_show"> +   +  <div class="summary"> +    <p> +      <label><%= @access_link.human_attribute_name(:access_point) %>: </label> +        <%= link_to @access_link.access_point.name, [@referential, @access_link.access_point.stop_area, @access_link.access_point] %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name(:stop_area) %>: </label> +        <%= link_to @access_link.stop_area.name, [@referential, @access_link.stop_area] %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("name") %>: </label> +      <%= @access_link.name %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("access_link_type") %>: </label> +      <%= t("connection_link_types.label.#{@access_link.access_link_type}") %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("comment") %>: </label> +      <%= @access_link.comment %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("link_distance") %>: </label> +      <%= @access_link.link_distance %>  +    </p> +    <p> +      <label><%= t('access_links.show.durations') %> </label> +    </p> +    <p> +      <label class='duration'><%= @access_link.human_attribute_name("default_duration") %>: </label> +      <% if (@access_link.default_duration.present?) %> +         <%= @access_link.default_duration.strftime('%Hh %Mm %Ss') %> +      <% end %> +    </p> +    <p> +      <label class='duration'><%= @access_link.human_attribute_name("frequent_traveller_duration") %>: </label> +      <% if (@access_link.frequent_traveller_duration.present?) %> +         <%= @access_link.frequent_traveller_duration.strftime('%Hh %Mm %Ss') %> +      <% end %> +    </p> +    <p> +      <label class='duration'><%= @access_link.human_attribute_name("occasional_traveller_duration") %>: </label> +      <% if (@access_link.occasional_traveller_duration.present?) %> +         <%= @access_link.occasional_traveller_duration.strftime('%Hh %Mm %Ss') %> +      <% end %> +    </p> +    <p> +      <label class='duration'><%= @access_link.human_attribute_name("mobility_restricted_traveller_duration") %>: </label> +      <% if (@access_link.mobility_restricted_traveller_duration.present?) %> +         <%= @access_link.mobility_restricted_traveller_duration.strftime('%Hh %Mm %Ss') %> +      <% end %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("mobility_restricted_suitability") %>: </label> +      <%= t((@access_link.mobility_restricted_suitability == true).to_s) %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("stairs_availability") %>: </label> +      <%= t((@access_link.stairs_availability == true).to_s) %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("lift_availability") %>: </label> +      <%= t((@access_link.lift_availability == true).to_s) %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("objectid") %>: </label> +      <%= @access_link.objectid %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("creation_time") %>: </label> +      <%= l(@access_link.creation_time) %> +    </p> +    <p> +      <label><%= @access_link.human_attribute_name("creator_id") %>: </label> +      <%= @access_link.creator_id %> +    </p> +  </div> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> +  <li><%= link_to t('access_links.actions.edit'), edit_referential_access_point_access_link_path(@referential, @access_link.access_point, @access_link), :class => "edit" %></li> +  <li><%= link_to t('access_links.actions.destroy'), referential_access_point_access_link_path(@referential, @access_link.access_point, @access_link), :method => :delete,  :data => {:confirm =>  t('access_links.actions.destroy_confirm')}, :class => "remove" %></li> +  <br> +</ul> +<% end %> diff --git a/app/views/access_points/_access_point.html.erb b/app/views/access_points/_access_point.html.erb new file mode 100644 index 000000000..2890cc124 --- /dev/null +++ b/app/views/access_points/_access_point.html.erb @@ -0,0 +1,20 @@ +<%= div_for(access_point) do %> +  <%= link_to([@referential, @stop_area, access_point], :class => "preview") do %> +    <div class="access_point_type"> +      <%= image_tag "map/access_" + access_point.access_point_type + ".png"   %> +    </div> +  <% end %> +  <%= link_to access_point.name, [@referential, @stop_area, access_point] %> +  <div class="info"> +    <p>       +      <% unless access_point.geometry %> +      <span class="warning"><%= t('.no_position') %></span> - +      <% end %> +    </p> +    <p><%= t("access_types.label.#{access_point.access_point_type}") %></p> +    <div class="actions">   +      <%= link_to t("actions.edit"), edit_referential_stop_area_access_point_path(@referential, @stop_area, access_point), :class => "edit" %> | +      <%= link_to t("actions.destroy"), referential_stop_area_access_point_path(@referential, @stop_area, access_point), :method => :delete, :data => {:confirm =>  t('access_points.actions.destroy_confirm')}, :class => "remove" %> +    </div> +  </div> +<% end %> diff --git a/app/views/access_points/_form.html.erb b/app/views/access_points/_form.html.erb new file mode 100644 index 000000000..cd728f0d6 --- /dev/null +++ b/app/views/access_points/_form.html.erb @@ -0,0 +1,44 @@ +<%= semantic_form_for [@referential, @stop_area, @access_point] do |form| %> +  <%= form.inputs do %>  +    <%= form.input :id, :as => :hidden %> +    <%= form.input :name %> +    <%= form.input :access_point_type, :as => :select, :input_html => { :disabled => !@access_point.new_record? }, +      :collection => Chouette::AccessPoint.access_point_types, :include_blank => false, :member_label => Proc.new { |access_point_type| t("access_types.label.#{access_point_type}") }  %> +    <%= form.input :street_name %>               +    <%= form.input :country_code %>               +    <%= form.input :comment %>               +    <%= form.inputs  do %>  +      <%= form.input "openning_time(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> +      <%= form.input "openning_time(2i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "openning_time(3i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "openning_time(6i)", :as => :hidden ,:input_html => { :value => "0" } %> +      <%= form.input :openning_time, :ignore_date=>true, :label => @access_point.human_attribute_name("openning_time")%> +      <%= form.input "closing_time(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> +      <%= form.input "closing_time(2i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "closing_time(3i)", :as => :hidden ,:input_html => { :value => "1" } %> +      <%= form.input "closing_time(6i)", :as => :hidden ,:input_html => { :value => "0" } %> +      <%= form.input :closing_time, :ignore_date=>true, :label => @access_point.human_attribute_name("closing_time")%> +    <% end %> +    <%= form.input :mobility_restricted_suitability,:as => :boolean %> +    <%= form.input :stairs_availability,:as => :boolean %> +    <%= form.input :lift_availability,:as => :boolean %> +    <%= form.input :objectid, :required => !@access_point.new_record?, :input_html => { :disabled => !@access_point.new_record? } %>   +    <%= form.inputs :name => t('access_points.show.geographic_data') do %>  +      <% if ! @referential.projection_type_label.empty? %> +        <%= form.inputs :name => @referential.projection_type_label do %>  +          <%= form.input :x %> +          <%= form.input :y %> +        <% end %> +      <% end %> +      <%= form.inputs :name => "WGS84" do %>  +        <%= form.input :longitude %> +        <%= form.input :latitude %> +      <% end %>   +    <% end %> +  <% end %> + +   <%= form.actions do %> +     <%= form.action :submit, :as => :button %> +     <%= form.action :cancel, :as => :link %> +   <% end %> +<% end %> diff --git a/app/views/access_points/edit.html.erb b/app/views/access_points/edit.html.erb new file mode 100644 index 000000000..e2e8636b3 --- /dev/null +++ b/app/views/access_points/edit.html.erb @@ -0,0 +1,5 @@ +<%= title_tag t('access_points.edit.title', :access_point => @access_point.name ) %> + +<%= @map.to_html %> + +<%= render "form" %> diff --git a/app/views/access_points/index.html.erb b/app/views/access_points/index.html.erb new file mode 100644 index 000000000..164169205 --- /dev/null +++ b/app/views/access_points/index.html.erb @@ -0,0 +1,26 @@ +<%= title_tag t('access_points.index.title', :stop_area => @stop_area.name) %>  + +<%= search_form_for @q, :url => referential_stop_area_access_points_path(@referential,@stop_area), :html => {:method => :get} do |f| %> +  <%= f.label :name_or_country_code_cont, "#{t('.name_or_country_code')} :" %> +  <%= f.text_field :name_or_country_code_cont %> + +  <%= f.submit t('actions.search') %> <%= t("or") %> +  <%= link_to t("cancel"), referential_stop_area_access_points_path(@referential,@stop_area) %> +<% end %> + +<div class="page_info"> +  <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @access_points %> +</div> +<div class="access_points paginated_content"> +  <%= render :partial => "access_point", :collection => @access_points %> +</div> +<div class="pagination"> +  <%= will_paginate @access_points, :container => false %> +</div> + +<% content_for :sidebar do %> +<ul class="actions"> +  <li><%= link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" %></li> +</ul> + +<% end %> diff --git a/app/views/access_points/index.kml.erb b/app/views/access_points/index.kml.erb new file mode 100644 index 000000000..bbcf19d23 --- /dev/null +++ b/app/views/access_points/index.kml.erb @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kml xmlns="http://www.opengis.net/kml/2.2"> +  <Document> +    <% @access_points.where("latitude is not null and longitude is not null").each do |access_point| %> +      <Placemark id="<%= access_point.id %>" > +        <name><%= access_point.name %></name> +        <access_point_type><%= access_pointaccess_point_type %></access_point_type> +        <%= access_point.geometry.kml_representation.html_safe %> +      </Placemark> +    <% end %> +  </Document> +</kml> diff --git a/app/views/access_points/new.html.erb b/app/views/access_points/new.html.erb new file mode 100644 index 000000000..3b9c8a397 --- /dev/null +++ b/app/views/access_points/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag  t('access_points.new.title') %> + +<%= render "form" %> diff --git a/app/views/access_points/show.html.erb b/app/views/access_points/show.html.erb new file mode 100644 index 000000000..fb46c27c8 --- /dev/null +++ b/app/views/access_points/show.html.erb @@ -0,0 +1,123 @@ +<%= title_tag t('access_points.show.title', :access_point => @access_point.name) %> +<div class="access_point_show"> +  <% if @access_point.projection_type != nil || @access_point.long_lat_type != nil %> +    <%= @map.to_html %> +  <% end %>   +  <div class="summary"> +    <p> +      <label><%= @access_point.human_attribute_name(:stop_area) %>: </label> +       <%= link_to @stop_area.name, [@referential, @stop_area] %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("name") %>: </label> +      <%= @access_point.name %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("comment") %>: </label> +      <%= @access_point.comment %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("street_name") %>: </label> +      <%= @access_point.street_name %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("country_code") %>: </label> +      <%= @access_point.country_code %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("access_point_type") %>: </label> +      <%= t("access_types.label.#{@access_point.access_point_type}") %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("openning_time") %>: </label> +      <% if (@access_point.openning_time.present?) %> +         <%= @access_point.openning_time.strftime('%Hh %Mm') %> +      <% end %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("closing_time") %>: </label> +      <% if (@access_point.closing_time.present?) %> +         <%= @access_point.closing_time.strftime('%Hh %Mm') %> +      <% end %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("mobility_restricted_suitability") %>: </label> +      <%= t((@access_point.mobility_restricted_suitability == true).to_s) %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("stairs_availability") %>: </label> +      <%= t((@access_point.stairs_availability == true).to_s) %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("lift_availability") %>: </label> +      <%= t((@access_point.lift_availability == true).to_s) %> +    </p> +    <p> <label><%= t('access_points.show.geographic_data') %> </label></p> +    <% if @access_point.projection_type == nil && @access_point.long_lat_type == nil %> +	    <span class='geo_data'><%= t('access_points.show.no_geographic_data') %></span> +    <% else %> +	    <% if !@access_point.projection_type.nil? %> +	    <p> +	      <span class='geo_data'><%= @access_point.human_attribute_name("projection_type") %>: </span> +	      <%= @access_point.projection_type %> +	    </p> +	    <p> +	      <span class='geo_data'><%= @access_point.human_attribute_name("x") %>: </span> +	      <%= @access_point.x %> +	    </p> +	    <p> +	      <span class='geo_data'><%= @access_point.human_attribute_name("y") %>: </span> +	      <%= @access_point.y %> +	    </p> +	    <% end %> +	    <% if !@access_point.long_lat_type.nil? %> +	    <p> +	      <span class='geo_data'><%= @access_point.human_attribute_name("long_lat_type") %>: </span> +	      <%= @access_point.long_lat_type %> +	    </p> +	    <p> +	      <span class='geo_data'><%= @access_point.human_attribute_name("longitude") %>: </span> +	      <%= @access_point.longitude %> +	    </p> +	    <p> +	      <span class='geo_data'><%= @access_point.human_attribute_name("latitude") %>: </span> +	      <%= @access_point.latitude %> +	    </p> +	    <% end %> +    <% end %> +    <p> +      <label><%= @access_point.human_attribute_name("objectid") %>: </label> +      <%= @access_point.objectid %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("creation_time") %>: </label> +      <%= l(@access_point.creation_time) %> +    </p> +    <p> +      <label><%= @access_point.human_attribute_name("creator_id") %>: </label> +      <%= @access_point.creator_id %> +    </p>     +  </div> +                            +</div> +                 +<p class="after_map" /> +<div> +	<h3><%= t('.access_links') %></h3> +	<div class="access_link_pairs"> +      <table> +	  <%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@access_links) %> +      </table> +	</div> +	<p><%= t('.access_link_legend_1') %></p> +	<p><%= t('.access_link_legend_2') %></p> +</div> + +                          +<% content_for :sidebar do %> +<ul class="actions"> +  <li><%= link_to t('access_points.actions.edit'), edit_referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :class => "edit" %></li> +  <li><%= link_to  t('access_points.actions.destroy'), referential_stop_area_access_point_path(@referential, @stop_area, @access_point), :method => :delete, :data => {:confirm =>  t('access_points.actions.destroy_confirm')}, :class => "remove" %></li> +</ul> +  <br> +<% end %> diff --git a/app/views/access_points/show.kml.erb b/app/views/access_points/show.kml.erb new file mode 100644 index 000000000..f54e6340e --- /dev/null +++ b/app/views/access_points/show.kml.erb @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kml xmlns="http://www.opengis.net/kml/2.2"> +  <Document> +    <Placemark id="<%= @access_point.id %>" > +      <name><%= @access_point.name %></name> +      <access_point_type><%= @access_point.access_point_type %></access_point_type> +      <%= (@access_point.position or @access_point.default_position).kml_representation.html_safe %> +    </Placemark> +  </Document> +</kml> diff --git a/app/views/referentials/_counts.html.erb b/app/views/referentials/_counts.html.erb index f6296f52e..35841b271 100644 --- a/app/views/referentials/_counts.html.erb +++ b/app/views/referentials/_counts.html.erb @@ -63,5 +63,10 @@     		<td class="object"><%= Referential.human_attribute_name("itls") %></td>    		<td class="value"> <%= @referential.stop_areas.where("area_type = ?","ITL").size %></td>		    		</tr> +  		<tr> +   		<td class="image"><%= image_tag "map/access_in_out.png"%></td> +   		<td class="object"><%= Referential.human_attribute_name("access_points") %></td> +  		<td class="value"> <%= @referential.access_points.size %></td>		 +  		</tr>    	</tbody>    </table> diff --git a/app/views/stop_areas/access_links.html.erb b/app/views/stop_areas/access_links.html.erb new file mode 100644 index 000000000..7d2ff7928 --- /dev/null +++ b/app/views/stop_areas/access_links.html.erb @@ -0,0 +1,12 @@ +<%= title_tag t('stop_areas.access_links.title', :stop_area => @stop_area.name ) %> + +<div class="stop_area_show"> +	<div class="access_link_pairs"> +      <table> +	  <%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@access_links) %> +      </table> +	</div> +	<p><%= t('.access_link_legend_1') %></p> +	<p><%= t('.access_link_legend_2') %></p> +</div> + diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb index 17f74d905..44755d020 100644 --- a/app/views/stop_areas/show.html.erb +++ b/app/views/stop_areas/show.html.erb @@ -84,13 +84,10 @@      </p>        </div> +  <p class="after_map" />    <div class="genealogical"> -  	<% if @stop_area.stop_area_type == 'itl' %> -      <h3><%= t(".genealogical_routing") %></h3> -    <% else %> -      <h3><%= t(".genealogical") %></h3> -    <% end %> +    <h3><%= genealogical_title %></h3>      <% if @stop_area.parent.present? %>       <div class="parent"> @@ -159,26 +156,56 @@    </div>  </div> + +<% if manage_access_points %> +  <p class="after_map" /> +<div> +	<h3><%= t('.access_points') %></h3> +	 +	<div class="access_points paginated_content"> +	  <%= render :partial => "access_points/access_point", :collection => @access_points %> +	</div> +</div> +<% end %>  <% content_for :sidebar do %> -<ul class="actions"> -  <li><%= link_to t('stop_areas.actions.edit'), edit_referential_stop_area_path(@referential, @stop_area), :class => "edit" %></li> -  <li><%= link_to  t('stop_areas.actions.destroy'), referential_stop_area_path(@referential, @stop_area), :method => :delete, :data => {:confirm =>  t('stop_areas.actions.destroy_confirm')}, :class => "remove" %></li> -</ul> -  <% if @stop_area.stop_area_type == 'itl' %> +    <table> +    <tr><td>	 +	<ul class="actions"> +	  <li><%= link_to t('stop_areas.actions.edit'), edit_referential_stop_area_path(@referential, @stop_area), :class => "edit" %></li> +	  <li><%= link_to  t('stop_areas.actions.destroy'), referential_stop_area_path(@referential, @stop_area), :method => :delete, :data => {:confirm =>  t('stop_areas.actions.destroy_confirm')}, :class => "remove" %></li> +	</ul> +    </td></tr> +  <% if manage_itl %> +    <tr><td>	  	<h3><%= t(".itl_managment") %></h3>  	<ul class="actions">  	    <li><%= link_to  t('stop_areas.actions.add_routing_lines'), add_routing_lines_referential_stop_area_path(@referential, @stop_area), :class => "add_routing_lines" %></li>  	    <li><%= link_to  t('stop_areas.actions.add_routing_stops'), add_routing_stops_referential_stop_area_path(@referential, @stop_area), :class => "add_routing_stops" %></li>  	</ul> +    </td></tr>    <% else %> +    <tr><td>	  	<h3><%= t(".stop_managment") %></h3>  	<ul class="actions">  	    <li><%= link_to  t('stop_areas.actions.select_parent'), select_parent_referential_stop_area_path(@referential, @stop_area), :class => "select_parent" %></li> -		  <% if @stop_area.stop_area_type != 'boarding_position' && @stop_area.stop_area_type != 'quay' %> +		  <% if manage_children %>  		    <li><%= link_to  t('stop_areas.actions.add_children'), add_children_referential_stop_area_path(@referential, @stop_area), :class => "add_children" %></li>  		  <% end %>  	</ul> +    </td></tr> +	 +	<% if manage_access_points %> +    <tr><td>	 +	<h3><%= t(".access_managment") %></h3> +	<ul class="actions"> +        <li><%= link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" %></li> +        <li><%= link_to t('stop_areas.actions.manage_access_links'), access_links_referential_stop_area_path(@referential,@stop_area), :class => "select_parent" %></li> +    </ul> +    </td></tr> +	<% end %> +	    <% end %> +    </table>    <br>  <% end %> diff --git a/config/locales/access_links.yml b/config/locales/access_links.yml new file mode 100644 index 000000000..b81d3cd88 --- /dev/null +++ b/config/locales/access_links.yml @@ -0,0 +1,93 @@ +en: +  access_links: +    actions: +      new: Add a new access link +      edit: Edit this access link +      destroy: Remove this access link +      destroy_confirm: Are you sure you want destroy this access link? +    new: +      title_access_point_to_stop_area: Create an access link from access %{access_point} to stop area %{stop_area} +      title_stop_area_to_access_point: Create an access link from stop area %{stop_area} to access %{access_point}  +    edit: +      title_access_point_to_stop_area: Update an access link from access %{access_point} to stop area %{stop_area} +      title_stop_area_to_access_point: Update an access link from stop area %{stop_area} to access %{access_point}  +    show: +      title: "access link %{access_link}" +      durations: "Durations (hh mm ss):" +  activerecord:         +    models:         +      access_link:  +        zero:  access point +        one:   access point +        other: access points +    attributes: +      access_link: +        access_point: Access Point +        stop_area: Stop Area +        name: Name +        comment: Comment +        link_distance: Distance (m) +        access_link_type: Type +        default_duration: Average +        frequent_traveller_duration: Regular passenger +        occasional_traveller_duration: Occasional passenger +        mobility_restricted_traveller_duration: Mobility reduced passenger +        mobility_restricted_suitability: Mobility reduced passenger suitable +        stairs_availability: Escalator +        lift_availability: Lift +        objectid: Neptune identifier +        object_version: Version +        creation_time: Created on +        creatorid: Created by  +  formtastic: +    hints: +      access_link: +        objectid: "[prefix]:AccessLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + +fr: +  access_links: +    actions: +      new: Ajouter un accès +      edit: Modifier cet accès +      destroy: Supprimer cet accès +      destroy_confirm: Etes vous sûr de détruire cet accès ? +    new: +      title_access_point_to_stop_area: "Créer un lien depuis l'accès %{access_point} vers l'arrêt %{stop_area}" +      title_stop_area_to_access_point: "Créer un lien depuis l'arrêt %{stop_area} vers l'accès %{access_point}" +    edit: +      title_access_point_to_stop_area: "Modifier un lien depuis l'accès %{access_point} vers l'arrêt %{stop_area}" +      title_stop_area_to_access_point: "Modifier un lien depuis l'arrêt %{stop_area} vers l'accès %{access_point}" +    show: +      title: "lien d'accès %{access_link}" +      durations: "Durées (hh mm ss) :" +  activerecord:         +    models:         +      access_link:  +        zero:  accès +        one:   accès +        other: accès +    attributes: +      access_link: +        access_point: Accès +        stop_area: Arrêt +        name: Nom +        comment: Commentaire +        link_distance: Distance (m) +        access_link_type: Type +        default_duration: moyenne +        frequent_traveller_duration: pour un habitué +        occasional_traveller_duration: pour un voyageur occasionnel +        mobility_restricted_traveller_duration: pour un voyageur à mobilité réduite +        mobility_restricted_suitability: Accès pour voyageur à mobilité réduite +        stairs_availability: Escalator +        lift_availability: Ascenseur +        objectid: Identifiant Neptune +        object_version: Version +        creation_time: Créé le +        creator_id: Créé par +  formtastic: +    hints: +      access_link: +        objectid: "[prefixe]:AccessLink:[clé_unique]  caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + + diff --git a/config/locales/access_points.yml b/config/locales/access_points.yml new file mode 100644 index 000000000..c213a8619 --- /dev/null +++ b/config/locales/access_points.yml @@ -0,0 +1,115 @@ +en: +  access_points: +    access_point: +      no_position: No Position  +    actions: +      new: Add a new access point +      edit: Edit this access point +      destroy: Remove this access point +      destroy_confirm: Are you sure you want destroy this access point? +    new: +      title: Add a new access point +    edit: +      title: Update access point %{access_point} +    show: +      title: Access point %{access_point} +      geographic_data: Geographic data  +      no_geographic_data: None +      access_links: Access links +      access_link_legend_1 : "grays arrows for undefined links, green for defined ones" +      access_link_legend_2 : "clic on arrows to create/edit a link" +    index: +      title: Access points +      name_or_country_code: Name +  activerecord:         +    models:         +      access_point:  +        zero:  access point +        one:   access point +        other: access points +    attributes: +      access_point: +        stop_area: Contain in Stop Area +        name: Name +        comment: Comments +        access_point_type: Access point type +        street_name: Street name +        country_code: INSEE code +        openning_time: Opening time +        closing_time: Closing time +        projection_type: Projection type +        x: x-position +        y: y-position +        long_lat_type: Projection type +        longitude: Longitude +        latitude: Latitude +        mobility_restricted_suitability: Mobility reduced passenger suitable +        stairs_availability: Escalator +        lift_availability: Lift +        objectid: Neptune identifier +        object_version: Version +        creation_time: Created on +        creatorid: Created by  +  formtastic: +    hints: +      access_point: +        objectid: "[prefix]:AccessPoint:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + +fr: +  access_points: +    access_point: +      no_position: Pas de position  +    actions: +      new: Ajouter un accès +      edit: Modifier cet accès +      destroy: Supprimer cet accès +      destroy_confirm: Etes vous sûr de détruire cet accès ? +    new: +      title: Ajouter un accès +    edit: +      title: "Modifier l'accès %{access_point}" +    show: +      title: Accès %{access_point} +      geographic_data: Données géographiques  +      no_geographic_data: Aucune +      access_links: "Liens Arrêts - Accès" +      access_link_legend_1 : "Les flêches grises représentent des liens non définis" +      access_link_legend_2 : "cliquer sur les flêches pour créer/éditer un lien" +    index: +      name_or_country_code: Nom +      title: Accès de %{stop_area} +  activerecord:         +    models:         +      access_point:  +        zero:  accès +        one:   accès +        other: accès +    attributes: +      access_point: +        stop_area: "Zone d'arrêts" +        name: Nom +        comment: Commentaire +        access_point_type: "Type d'accès" +        street_name: Nom de la rue +        country_code: Code INSEE +        projection_type: Projection +        x: Position X +        y: Position Y +        long_lat_type: Projection +        longitude: Longitude +        latitude: Latitude +        openning_time: "Horaire d'ouverture"  +        closing_time: Horaire de fermeture +        mobility_restricted_suitability: Accès pour voyageur à mobilité réduite +        stairs_availability: Escalator +        lift_availability: Ascenseur +        objectid: Identifiant Neptune +        object_version: Version +        creation_time: Créé le +        creator_id: Créé par +  formtastic: +    hints: +      access_point: +        objectid: "[prefixe]:AccessPoint:[clé_unique]  caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + + diff --git a/config/locales/access_types.yml b/config/locales/access_types.yml new file mode 100644 index 000000000..6d6d2764c --- /dev/null +++ b/config/locales/access_types.yml @@ -0,0 +1,13 @@ +en: +  access_types: +    label: +      in: Entrance +      out: Exit +      in_out: Both ways +       +fr: +  access_types: +    label: +      in: Entrée +      out: Sortie +      in_out: "Entrée/Sortie" diff --git a/config/locales/connection_links.yml b/config/locales/connection_links.yml index fb9b98ba4..7597e43d5 100644 --- a/config/locales/connection_links.yml +++ b/config/locales/connection_links.yml @@ -49,7 +49,7 @@ en:          default_duration: Average          frequent_traveller_duration: Regular passenger          occasional_traveller_duration: Occasional passenger -        mobilit_yrestricted_traveller_duration: Mobility reduced passenger +        mobility_restricted_traveller_duration: Mobility reduced passenger          mobility_restricted_suitability: Mobility reduced passenger suitable          stairs_availability: Escalator          lift_availability: Lift diff --git a/config/locales/exports.yml b/config/locales/exports.yml index 80468f96e..6080bb5fe 100644 --- a/config/locales/exports.yml +++ b/config/locales/exports.yml @@ -22,9 +22,9 @@ en:        started: Started export        completed: Completed export        failed: Failed export -      undefined: %{key} undefined +      undefined: "%{key} undefined"        EXPORT_ERROR: "Error durring export" -      EXCEPTION : "Origin %{0}"  +      EXCEPTION: "Origin %{0}"         NEPTUNE_EXPORT: Neptune Export        NEPTUNE_EXPORTED_LINE: "Line %{0} (%{1}) exported"        NEPTUNE_EMPTY_LINE: "Line %{0} (%{1}) without valid vehicle journey : not exported" @@ -39,7 +39,7 @@ en:        GTFS_INVALID_DATA: "%{0} %{1} : invalid data %{2}=%{3}"        GTFS_MISSING_DATA: "%{0} %{1} : missing value for : %{2}"        CSV_EXPORT: CSV Export -      CSV_OK_LINE: Line %{0} exported +      CSV_OK_LINE: "Line %{0} exported"        CSV_TOO_MUCH_ROUTES: "Line %{0} rejected : more than 2 routes"      severities:        info: Information @@ -95,9 +95,9 @@ fr:        started: Export démarré        completed: Export achevé avec succès        failed: Export interrompu -      undefined: %{key} non défini +      undefined: "%{key} non défini"        EXPORT_ERROR: "Erreur lors de l'export" -      EXCEPTION : "Cause %{0}"  +      EXCEPTION: "Cause %{0}"         NEPTUNE_EXPORT: Export Neptune        NEPTUNE_EXPORTED_LINE: "Ligne %{0} (%{1}) exportée"        NEPTUNE_EMPTY_LINE: "Ligne %{0} (%{1}) sans course valide : non exportée" @@ -112,7 +112,7 @@ fr:        GTFS_INVALID_DATA: "%{0} %{1} : attribut %{2}=%{3} invalide"        GTFS_MISSING_DATA: "%{0} %{1} : valeur manquante : %{2}"        CSV_EXPORT: Export CSV -      CSV_OK_LINE: Ligne %{0} exportée +      CSV_OK_LINE: "Ligne %{0} exportée"        CSV_TOO_MUCH_ROUTES: "Ligne %{0} non exportable : plus de 2 séquences d'arrêt"      severities:        info: Information diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index 4d15af171..701987477 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -52,6 +52,7 @@ en:          vehicle_journeys: Vehicle journeys          companies: Companies          stop_areas: Stop Areas +        access_points: Access Points          time_tables: Time tables          connection_links: Connection links          quays: quays @@ -121,6 +122,7 @@ fr:          vehicle_journeys: Courses          companies: Transporteurs          stop_areas: Arrêts +        access_points: "points d'accès"          time_tables: Calendriers          connection_links: Correspondances          quays: quais diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index 7c956413b..10db2a6b7 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -11,6 +11,8 @@ en:        destroy_confirm: Are you sure you want destroy this stop?        select_parent: Manage Parent        add_children: Manage Children +      manage_access_points: Manage Access Points +      manage_access_links: Manage Access Links        add_routing_lines: "Manage constraint's lines"        add_routing_stops: "Manage constraint's stops"        default_geometry: "Compute missing geometries" @@ -26,12 +28,18 @@ en:        genealogical_routing: "Routing constraint's links"        itl_managment: "Routing constraint's links managment"        stop_managment: "Parent-Child links managment" +      access_managment: "Access Points and Links managment" +      access_points: Access Points      index:        title: Stop areas        name_or_country_code: Name or Country code        selection: Filter on        selection_all: All        area_type: Area Type +    access_links:  +      title: "Access links for %{stop_area}'s access" +      access_link_legend_1 : "grays arrows for undefined links, green for defined ones" +      access_link_legend_2 : "clic on arrows to create/edit a link"      select_parent:        title: Manage parent of stop area %{stop_area}       add_children: @@ -91,6 +99,9 @@ fr:        add_children: Gérer les fils        add_routing_lines: "Gérer les lignes de l'ITL"        add_routing_stops: "Gérer les arrêts de l'ITL" +      manage_access_points: Gérer les accès +      manage_access_links: Gérer les liens arrêt-accès +      add_children: Gérer les fils        default_geometry: "Calculer les géométries manquantes"      new:        title: Ajouter un arrêt @@ -104,6 +115,12 @@ fr:        genealogical_routing: "Liens de l'ITL"        itl_managment: "Gestion des liens de l'ITL"        stop_managment: "Gestion des relations père-fils" +      access_managment: "Gestion des accès et liens associés" +      access_points: "Points d'accès" +    access_links:  +      title: "Liens Accès-Arrêts des accès de %{stop_area}" +      access_link_legend_1 : "Les flêches grises représentent des liens non définis" +      access_link_legend_2 : "cliquer sur les flêches pour créer/éditer un lien"      index:        name_or_country_code: Nom ou Code INSEE        title: Arrêts diff --git a/config/routes.rb b/config/routes.rb index 6d16a187b..79b98c247 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,7 @@ ChouetteIhm::Application.routes.draw do      match 'lines' => 'lines#destroy_all', :via => :delete      resources :group_of_lines do        resources :stop_areas do +        resources :access_points          resources :stop_area_parents          resources :stop_area_children          resources :stop_area_routing_lines @@ -42,6 +43,7 @@ ChouetteIhm::Application.routes.draw do      resources :lines, :networks, :group_of_lines do        resources :stop_areas do +        resources :access_points          resources :stop_area_parents          resources :stop_area_children          resources :stop_area_routing_lines @@ -89,7 +91,12 @@ ChouetteIhm::Application.routes.draw do        resources :time_table_periods      end +    resources :access_points do +       resources :access_links +    end +      resources :stop_areas do +      resources :access_points         resources :stop_area_parents        resources :stop_area_children        resources :stop_area_routing_lines @@ -99,6 +106,7 @@ ChouetteIhm::Application.routes.draw do          get 'select_parent'          get 'add_routing_lines'          get 'add_routing_stops' +        get 'access_links'        end        collection do           put 'default_geometry' @@ -111,6 +119,7 @@ ChouetteIhm::Application.routes.draw do          get 'select_areas'        end        resources :stop_areas do +        resources :access_points          resources :stop_area_parents          resources :stop_area_children          resources :stop_area_routing_lines diff --git a/db/migrate/20121025112852_add_fields_to_access_points.ninoxe_engine.rb b/db/migrate/20121025112852_add_fields_to_access_points.ninoxe_engine.rb new file mode 100644 index 000000000..ac692647d --- /dev/null +++ b/db/migrate/20121025112852_add_fields_to_access_points.ninoxe_engine.rb @@ -0,0 +1,13 @@ +# This migration comes from ninoxe_engine (originally 20121024072219) +class AddFieldsToAccessPoints < ActiveRecord::Migration +  def change +    remove_column "access_points", "mobility_restricted_suitability" +    remove_column "access_points", "stairs_availability" +    add_column "access_points", "mobility_restricted_suitability", "boolean" +    add_column "access_points", "stairs_availability", "boolean" +    rename_column "access_points", "type","access_type" +    change_column "access_points", "openning_time","time" +    change_column "access_points", "closing_time","time" +    add_column "access_points", "stop_area_id", "integer", {:limit => 8} +  end +end diff --git a/db/schema.rb b/db/schema.rb index 20c522d1d..febc71b99 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@  #  # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120926144619) do +ActiveRecord::Schema.define(:version => 20121025112852) do    create_table "access_links", :force => true do |t|      t.integer  "access_point_id",                        :limit => 8 @@ -43,21 +43,22 @@ ActiveRecord::Schema.define(:version => 20120926144619) do      t.string   "creator_id"      t.string   "name"      t.string   "comment" -    t.decimal  "longitude",                       :precision => 19, :scale => 16 -    t.decimal  "latitude",                        :precision => 19, :scale => 16 +    t.decimal  "longitude",                                    :precision => 19, :scale => 16 +    t.decimal  "latitude",                                     :precision => 19, :scale => 16      t.string   "long_lat_type" -    t.decimal  "x",                               :precision => 19, :scale => 2 -    t.decimal  "y",                               :precision => 19, :scale => 2 +    t.decimal  "x",                                            :precision => 19, :scale => 2 +    t.decimal  "y",                                            :precision => 19, :scale => 2      t.string   "projection_type"      t.string   "country_code"      t.string   "street_name"      t.string   "contained_in" -    t.datetime "openning_time" -    t.datetime "closing_time" -    t.string   "type" +    t.time     "openning_time" +    t.time     "closing_time" +    t.string   "access_type"      t.boolean  "lift_availability" -    t.datetime "mobility_restricted_suitability" -    t.datetime "stairs_availability" +    t.boolean  "mobility_restricted_suitability" +    t.boolean  "stairs_availability" +    t.integer  "stop_area_id",                    :limit => 8    end    add_index "access_points", ["objectid"], :name => "access_points_objectid_key", :unique => true @@ -176,14 +177,16 @@ ActiveRecord::Schema.define(:version => 20120926144619) do      t.integer "choice_code"    end +  add_index "facilities_features", ["facility_id"], :name => "idx_facility_id" +    create_table "file_validation_log_messages", :force => true do |t|      t.integer  "file_validation_id"      t.string   "key"      t.string   "arguments",          :limit => 1000      t.integer  "position"      t.string   "severity" -    t.datetime "created_at",                         :null => false -    t.datetime "updated_at",                         :null => false +    t.datetime "created_at" +    t.datetime "updated_at"    end    add_index "file_validation_log_messages", ["file_validation_id"], :name => "index_file_validation_log_messages_on_file_validation_id" @@ -193,21 +196,11 @@ ActiveRecord::Schema.define(:version => 20120926144619) do      t.string   "options",         :limit => 2000      t.string   "file_name"      t.string   "file_type" -    t.datetime "created_at",                      :null => false -    t.datetime "updated_at",                      :null => false +    t.datetime "created_at" +    t.datetime "updated_at"      t.integer  "organisation_id"    end -  create_table "geometry_columns", :id => false, :force => true do |t| -    t.string  "f_table_catalog",   :limit => 256, :null => false -    t.string  "f_table_schema",    :limit => 256, :null => false -    t.string  "f_table_name",      :limit => 256, :null => false -    t.string  "f_geometry_column", :limit => 256, :null => false -    t.integer "coord_dimension",                  :null => false -    t.integer "srid",                             :null => false -    t.string  "type",              :limit => 30,  :null => false -  end -    create_table "group_of_lines", :force => true do |t|      t.string   "objectid",       :null => false      t.integer  "object_version" @@ -220,10 +213,13 @@ ActiveRecord::Schema.define(:version => 20120926144619) do    add_index "group_of_lines", ["objectid"], :name => "group_of_lines_objectid_key", :unique => true    create_table "group_of_lines_lines", :id => false, :force => true do |t| -    t.integer "group_of_line_id", :limit => 8 -    t.integer "line_id",          :limit => 8 +    t.integer "group_of_line_id", :limit => 8, :null => false +    t.integer "line_id",          :limit => 8, :null => false    end +  add_index "group_of_lines_lines", ["group_of_line_id"], :name => "idx_grli_gr" +  add_index "group_of_lines_lines", ["line_id"], :name => "idx_grli_li" +    create_table "import_log_messages", :force => true do |t|      t.integer  "import_id"      t.string   "key" @@ -265,10 +261,11 @@ ActiveRecord::Schema.define(:version => 20120926144619) do    add_index "journey_patterns", ["objectid"], :name => "journey_patterns_objectid_key", :unique => true    create_table "journey_patterns_stop_points", :id => false, :force => true do |t| -    t.integer "journey_pattern_id", :limit => 8 -    t.integer "stop_point_id",      :limit => 8 +    t.integer "journey_pattern_id", :limit => 8, :null => false +    t.integer "stop_point_id",      :limit => 8, :null => false    end +  add_index "journey_patterns_stop_points", ["journey_pattern_id"], :name => "idx_jpsp_jpid"    add_index "journey_patterns_stop_points", ["journey_pattern_id"], :name => "index_journey_pattern_id_on_journey_patterns_stop_points"    create_table "lines", :force => true do |t| @@ -337,8 +334,8 @@ ActiveRecord::Schema.define(:version => 20120926144619) do      t.datetime "updated_at"      t.string   "prefix"      t.string   "projection_type" +    t.string   "bounding_box",    :limit => nil      t.string   "time_zone" -    t.string   "the_geom"      t.string   "bounds"      t.integer  "organisation_id"    end @@ -365,13 +362,8 @@ ActiveRecord::Schema.define(:version => 20120926144619) do      t.integer "line_id",      :limit => 8    end -  create_table "spatial_ref_sys", :id => false, :force => true do |t| -    t.integer "srid",                      :null => false -    t.string  "auth_name", :limit => 256 -    t.integer "auth_srid" -    t.string  "srtext",    :limit => 2048 -    t.string  "proj4text", :limit => 2048 -  end +  add_index "routing_constraints_lines", ["line_id"], :name => "idx_rcli_li" +  add_index "routing_constraints_lines", ["stop_area_id"], :name => "idx_rcli_st"    create_table "stop_areas", :force => true do |t|      t.integer  "parent_id",           :limit => 8 @@ -459,8 +451,8 @@ ActiveRecord::Schema.define(:version => 20120926144619) do    add_index "time_tables", ["objectid"], :name => "time_tables_objectid_key", :unique => true    create_table "time_tables_vehicle_journeys", :id => false, :force => true do |t| -    t.integer "time_table_id",      :limit => 8 -    t.integer "vehicle_journey_id", :limit => 8 +    t.integer "time_table_id",      :limit => 8, :null => false +    t.integer "vehicle_journey_id", :limit => 8, :null => false    end    add_index "time_tables_vehicle_journeys", ["time_table_id"], :name => "index_time_tables_vehicle_journeys_on_time_table_id" @@ -510,8 +502,12 @@ ActiveRecord::Schema.define(:version => 20120926144619) do      t.time    "waiting_time"      t.time    "elapse_duration"      t.time    "headway_frequency" +    t.integer "position",                       :limit => 8 +    t.boolean "is_departure",                                :default => false +    t.boolean "is_arrival",                                  :default => false    end +  add_index "vehicle_journey_at_stops", ["stop_point_id"], :name => "index_vehicle_journey_at_stops_on_stop_point_id"    add_index "vehicle_journey_at_stops", ["stop_point_id"], :name => "index_vehicle_journey_at_stops_on_stop_pointid"    add_index "vehicle_journey_at_stops", ["vehicle_journey_id"], :name => "index_vehicle_journey_at_stops_on_vehicle_journey_id" | 
