-- $Date: 2004/01/11 00:59:25 $
-- $Revision: 1.21 $
-- $Author: jcrocholl $

with Real_Numbers; use Real_Numbers;
with Real_Vectors; use Real_Vectors;

-- Common features of all lines.
package Lines is

   -- Abstract parent type of all lines.
   -- Starting point "From" is implicit
   -- (ending point "To" of previous Line).
   type Line_Record is abstract tagged record
      To     : Vector;
      Length : Real := 0.0;
   end record;

   -- Access type for lines.
   type Line is access all Line_Record'Class;

   -- Calculate the length of this line. Results are cached for
   -- reuse. So make sure the starting point always remains the same
   -- between calls.
   function Length
     (Start : in Vector;          -- Starting point of the line.
      This  : access Line_Record-- Get this line's length.
     return Real                  -- The distance from start to end point.
     is abstract;

   -- Scale a line by a given factor.
   procedure Scale
     (This   : access Line_Record-- Scale this line.
      Factor : in Real)            -- Scaling factor.
     is abstract;

   -- Translate a line by a given offset.
   procedure Translate
     (This   : access Line_Record-- Translate this line.
      Offset : in Vector)          -- Translating offset.
     is abstract;

   function Way_Point
     (Start : in Vector;
      This  : access Line_Record;
      Part  : in Real)
     return Vector
     is abstract;

   -- Format a line for postscript output.
   function Postscript
     (This : access Line_Record-- Format this line.
     return String               -- The resulting postscript code.
     is abstract;

   --------------------------------------------
   -- Helper functions for line implementations
   --------------------------------------------

   -- Format a vector for postscript output.
   function Postscript
     (This : in Vector-- Format this vector.
     return String;     -- The resulting postscript code.

end Lines;