%
%  Abgel. Klasse für Strecken-Objekte
%
%  >> r = ShLine( 10, 8 )
%  >> r.draw;
%  >> r.setColor( LnColor.r );
%
classdef ShLine < ShLines
  properties (Access = private)
    lenX = 0;
    lenY = 0;
  end
    
  methods
    function obj = ShLine(lenX,lenY,varargin)
      posX = 0;
      posY = 0;
      if( nargin == 4 )  % optional posX, posY 
        posX = varargin{1};
        posY = varargin{2};
      end
      obj@ShLines(posX,posY); 
      obj.lenX = lenX;
      obj.lenY = lenY;
      obj.hnd = [];
    end
    
    function disp( obj )
      disp@Shape(obj);
      fprintf( 'lenX = %g, lenY = %g \n', obj.lenX, obj.lenY );
    end
  
    function draw( obj )      
      clear( obj );    % Methode von Shape
      % Koordinaten 
      x = [obj.x, obj.x + obj.lenX];
      y = [obj.y, obj.y + obj.lenY];
      % Plotten und MATLAB Handle merken 
      obj.hnd = plot( x,y );           
      % Lines-Eigenschaften setzen
      obj.setLnData();
    end
    
  end
end