Skip to content
OE_pattern.cpp 2.65 KiB
Newer Older
3dsman's avatar
3dsman committed
* 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 "OE_pattern.h"

3dsman's avatar
3dsman committed
OE_pattern::OE_pattern()
{
}

OE_pattern::OE_pattern(std::vector<vector_2d> _pts, float _defaultOffset, bool _endPoints, std::string _name)
raoul's avatar
raoul committed
	pts = _pts;
	endPoints = _endPoints;
raoul's avatar
raoul committed
	name = _name;
3dsman's avatar
3dsman committed
void OE_pattern::persist(Pakal::Archive* archive)
{
	archive->value("pts", pts);
	archive->value("endPoints", endPoints);
	archive->value("defaultOffset", defaultOffset);
3dsman's avatar
3dsman committed
	archive->value("name", name);
}

std::list<OE_pattern*> OE_pattern::createStandardPatterns()
{
	std::list<OE_pattern*> standardPattern;
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0)},0, false, "straight"));
raoul's avatar
raoul committed
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0),
	                                          vector_2d(1, 0),
											  vector_2d(0, 0)},0, false, "triple straight"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 1),
											  vector_2d(0.5, 0)},0.5, false, "satin"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0),
											  vector_2d(0, 1)},0.5, false, "stretch"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0),
											  vector_2d(0.3, 1),
											  vector_2d(0.6, 0)},0.5, false, "overcast"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0),
											  vector_2d(0, 1),
											  vector_2d(0, 0)},0.5, false, "applique"));
	standardPattern.push_back(new OE_pattern({vector_2d(1, 1),
											  vector_2d(0.5, 0.5),
											  vector_2d(0, 1),
											  vector_2d(1, 0)},0.5, false, "cross"));
	standardPattern.push_back(new OE_pattern({vector_2d(0, 0),
											  vector_2d(0.5, 0),
											  vector_2d(0.5, 0.6),
											  vector_2d(0.3, 0.8),
											  vector_2d(0.5, 1),
											  vector_2d(0.7, 0.8),
											  vector_2d(0.5, 0.6),
											  vector_2d(0.5, 0)},0.5, false, "applique circle"));
	standardPattern.push_back(new OE_pattern({vector_2d(0.5, 0.5),
											  vector_2d(0.8, 0.5),
											  vector_2d(0.2, 0.5),
											  vector_2d(0.5, 0.5),
											  vector_2d(0.5, 0.2),
											  vector_2d(0.5, 0.8),
											  vector_2d(0.5, 0.5),
											  vector_2d(0.3, 0.3),
											  vector_2d(0.7, 0.7),
											  vector_2d(0.5, 0.5),
											  vector_2d(0.7, 0.3),
											  vector_2d(0.3, 0.7),
											  vector_2d(0.5, 0.5)},0.5, false, "flower"));

	return standardPattern;
}