-- $Date: 2004/02/02 09:01:43 $
-- $Revision: 1.24 $
-- $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 is abstract tagged record
      To     : Vector;
      Length : Real := 0.0;
   end record;

   -- Access type for lines.
   type Line_Access is access all Line'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-- 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-- Scale this line.
      Factor : in Real)     -- Scaling factor.
     is abstract;

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

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

   -- Format a line for Scalable Vector Graphics output.
   function To_SVG
     (This      : access Line-- Format this line.
      Tolerance : in Real)     -- Tolerance level.
     return String             -- The resulting SVG code.
     is abstract;

   -- Format a line for Postscript output.
   function To_Postscript
     (This      : access Line-- Format this line.
      Tolerance : in Real)     -- Tolerance level.
     return String             -- The resulting Postscript code.
     is abstract;

end Lines;