Newer
Older
* This file is part of project OpenEmbroidery. It's copyrighted by
* the contributors recorded in the version control history of the file.
* Original project location https://code.electrolab.fr/openEmbroidery/openEmbroidery_software
*
* SPDX-License-Identifier: CECILL-2.1
* License-Filename: Licence_CeCILL_V2.1-en.txt
*/
#include "curves/OE_subcurve.h"
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <algorithm>
OE_subcurve::OE_subcurve() : curve(nullptr), start(0), end(0), reverse(false)
{
}
OE_subcurve::OE_subcurve(OE_curve* curve, float curveStart, float curveEnd, bool reverse) : start(-1), end(-1)
curve->addDependency(this);
start = curveStart;
end = curveEnd;
}
OE_subcurve::~OE_subcurve()
{
void OE_subcurve::persist(Pakal::Archive* archive)
{
archive->refer("curve", curve);
archive->value("start", start);
archive->value("end", end);
archive->value("reverse", reverse);
}
bool OE_subcurve::check()
{
void OE_subcurve::refresh(float dpi, bool force)
{
if (!check() || !(needRefresh||force))
{
return;
}
curve->refresh(dpi, force);
float tmpStart = start;
float tmpEnd = end;
if (start == -1)
{
tmpStart = 0;
}
if (end == -1)
{
tmpEnd = (curve->getNpts()-1)/3;
}
pts.clear();
pts = curve->subCurve(tmpStart, tmpEnd, reverse);
}
{
}
void OE_subcurve::refreshDependency()
{
bool OE_subcurve::setStart(float curveStart)
{
return true;
}
bool OE_subcurve::setEnd(float curveEnd)
{
return true;
3dsman
committed
bool OE_subcurve::setReverse(bool curveReverse)
{
reverse = curveReverse;
setNeedRefresh();
return true;
3dsman
committed
}
return curve;
}
float OE_subcurve::getStart()
{
return start;
}
float OE_subcurve::getEnd()
{
return end;
}
bool OE_subcurve::getReverse()
{
return reverse;