Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T torque-postgresql
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 6
    • Issues 6
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Carlos
  • torque-postgresql
  • Wiki
  • Line
Last edited by Carlos 5 years ago
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Line

Line original implementation. Provides an easy interface to manipulate, save and restore, line-like values from the database. Works very similar to the ActiveRecord::Point, but for the values that compose a line (a, b, and c). PostgreSQL Docs

The biggest difference between this and a segment is that its composition is based on the A, B, C form 0 = Ax + By + C.

How it works

Migration

Just set the type of the column as line when creating a table.

create_table "Hit" do |t|
  t.string "source", null: false
  t.line   "trajectory"
end

Using it

The column is automatically identified and its value turned into what is defined in geometry.line_class or into a Torque::PostgreSQL::Line.

This original implementation provides a couple of methods:

hit = Hit.new
hit.trajectory.a
hit.trajectory.b
hit.trajectory.c
hit.trajectory.horizontal?
hit.trajectory.cvertical?
hit.trajectory.intercept      # Same as c

The value can be set in some different manners:

hit.trajectory = '2,-5,4'
hit.trajectory = '{2,-5,4}'
hit.trajectory = [2,-5,4]
hit.trajectory = { a: 2, b: -5, c: 4 }
Clone repository
  • Wiki
  • Configuring

Core Extensions

  • Range

Data types

  • Enum
  • Enum Set
  • Interval
  • Date/Time Range
  • Box
  • Circle
  • Line
  • Segment

Querying

  • Arel
  • Has Many
  • Belongs to Many
  • Dynamic Attributes
  • Distinct On
  • Auxiliary Statements
  • Inherited Tables

Menu

Explore Projects Groups Snippets