Sha256: fc8acfbcf550f2694e5efd1f9ba27d4eb62829a211941b60001ec39eaff8d164

Contents?: true

Size: 1.57 KB

Versions: 14

Compression:

Stored size: 1.57 KB

Contents

class Chouette::ConnectionLink < Chouette::TridentActiveRecord
  # FIXME http://jira.codehaus.org/browse/JRUBY-6358
  self.primary_key = "id"

  attr_accessor :connection_link_type

  attr_accessible :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creation_time, :creator_id, :name, :comment
  attr_accessible :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration
  attr_accessible :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs

  belongs_to :departure, :class_name => 'Chouette::StopArea'
  belongs_to :arrival, :class_name => 'Chouette::StopArea'

  validates_presence_of :name
  validates_presence_of :link_type

  def connection_link_type
    link_type && Chouette::ConnectionLinkType.new( link_type.underscore)
  end

  def connection_link_type=(connection_link_type)
    self.link_type = (connection_link_type ? connection_link_type.camelcase : nil)
  end

  @@connection_link_types = nil
  def self.connection_link_types
    @@connection_link_types ||= Chouette::ConnectionLinkType.all
  end

  def possible_areas
    Chouette::StopArea.where("area_type != 'ITL'")
  end

  def stop_areas
    Chouette::StopArea.where(:id => [self.departure_id,self.arrival_id])
  end

  def geometry
    GeoRuby::SimpleFeatures::LineString.from_points( [ departure.geometry, arrival.geometry], 4326) if departure.geometry and arrival.geometry
  end

  def geometry_presenter
    Chouette::Geometry::ConnectionLinkPresenter.new self
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ninoxe-1.1.5 app/models/chouette/connection_link.rb
ninoxe-1.1.4 app/models/chouette/connection_link.rb
ninoxe-1.1.3 app/models/chouette/connection_link.rb
ninoxe-1.1.2 app/models/chouette/connection_link.rb
ninoxe-1.1.1 app/models/chouette/connection_link.rb
ninoxe-1.1.0 app/models/chouette/connection_link.rb
ninoxe-1.0.3 app/models/chouette/connection_link.rb
ninoxe-1.0.2 app/models/chouette/connection_link.rb
ninoxe-1.0.1 app/models/chouette/connection_link.rb
ninoxe-1.0.0 app/models/chouette/connection_link.rb
ninoxe-0.1.6 app/models/chouette/connection_link.rb
ninoxe-0.1.5 app/models/chouette/connection_link.rb
ninoxe-0.1.4 app/models/chouette/connection_link.rb
ninoxe-0.1.3 app/models/chouette/connection_link.rb