/***************************************************************************
 *   Copyright (C) 2004 by Hans Oischinger                                 *
 *   hans.oischinger@kdemail.net                                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
#include "svgpathparserimpl.h"

// Elements
#include "elements/vectorelement.h"
#include "elements/vectorpath.h"

// Qt
#include <qpoint.h>

// KDE
#include <kdebug.h>

SVGPathParserImpl::SVGPathParserImpl()
    : SVGPathParser()
{}


SVGPathParserImpl::~SVGPathParserImpl()
{}

void SVGPathParserImpl::parseSVG_PolyPoints( const QString &d, VectorElement* e, bool process)
{
  m_element = e;
  SVGPathParser::parseSVG_PolyPoints(d, process);
}
  
void SVGPathParserImpl::parseSVG_D( const QString &d, VectorElement* e, bool process)
{
  m_element = e;
  SVGPathParser::parseSVG_D(d, process);
}
  
void SVGPathParserImpl::svgMoveTo(double x1, double y1, bool, bool abs)
{
  m_element->vectorPath().moveTo(x1,y1,abs);
}

void SVGPathParserImpl::svgLineTo(double x1, double y1, bool abs)
{
  m_element->vectorPath().lineTo(x1,y1,abs);
}

void SVGPathParserImpl::svgLineToHorizontal(double x, bool abs)
{
  m_element->vectorPath().lineToHorizontal( x, abs );
}

void SVGPathParserImpl::svgLineToVertical(double y, bool abs)
{
  m_element->vectorPath().lineToVertical( y, abs );
}

void SVGPathParserImpl::svgCurveToCubic(double x1, double y1, double x2, double y2, double x, double y, bool abs)
{
//   kdDebug() << k_funcinfo << endl;
  m_element->vectorPath().curveTo(x1,y1,x2,y2,x,y,abs);
}

void SVGPathParserImpl::svgCurveToCubicSmooth(double x, double y, double x2, double y2, bool abs)
{
//   kdDebug() << k_funcinfo << endl;
  m_element->vectorPath().curveToCubicSmooth(x,y,x2,y2,abs);
}

void SVGPathParserImpl::svgCurveToQuadratic(double x, double y, double x1, double y1, bool abs)
{
//   kdDebug() << k_funcinfo << endl;
  m_element->vectorPath().curveTo(x1,y1,0,0,x,y,abs);
}

void SVGPathParserImpl::svgCurveToQuadraticSmooth(double x, double y, bool abs)
{
//   kdDebug() << k_funcinfo << endl;
  m_element->vectorPath().curveTo(0,0,0,0,x,y,abs);
}

void SVGPathParserImpl::svgArcTo(double x, double y, double r1, double r2, double angle, bool largeArcFlag, bool sweepFlag, bool abs)
{
//   kdDebug() << k_funcinfo << endl;
  m_element->vectorPath().curveToArc(x,y,r1,r2,angle,largeArcFlag,sweepFlag,abs);
}

void SVGPathParserImpl::svgClosePath()
{
  m_element->vectorPath().closePath();
}
