/*
* 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
*/

#pragma once

#include "OE_stitchs.h"

namespace Pakal { class Archive; }

class OE_linkstitch : public OE_stitchs
{
	public:
		//OE_linkstitch();
		OE_linkstitch(OE_stitchs* stitchStart=nullptr, OE_stitchs* stitchEnd=nullptr);
		~OE_linkstitch();

		virtual void persist(Pakal::Archive* archive) override;

		virtual bool check();

		//virtual void refresh();

		virtual void refresh(float dpi, bool force = false);

		void setStitchStart( OE_stitchs* stitch);
		void setStitchEnd( OE_stitchs* stitch);
		OE_stitchs* getStitchStart();
		OE_stitchs* getStitchEnd();
		vector_2d getStepPt( int pos);

		void setStepPts( std::list<vector_2d> pts);
		void setStepPt( int pos, vector_2d pt);
		void addStepPt( int pos, vector_2d pt);
		void delStepPt( int pos);

		std::list<vector_2d> stepPts;

		void delDependency(OE_base * object);
		virtual void refreshDependency();

		static float defaultLinkMaxlen;

		virtual void move(vector_2d offset);
		virtual void scale(vector_2d ratio, vector_2d pos);

	protected:
		OE_stitchs* stitchStart;
		OE_stitchs* stitchEnd;
};

