openEmbroider  0.1
an open source embroidery software
OE_linestitch.h
1 /*
2  * Copyright (c) 2015 Tricoire Sebastien 3dsman@free.fr
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty. In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  * claim that you wrote the original software. If you use this software
14  * in a product, an acknowledgment in the product documentation would be
15  * appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  * misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  *
20  */
21 
22 #ifndef OE_LINESTITCH_H
23 #define OE_LINESTITCH_H
24 
25 #include "curves/OE_curve.h"
26 #include "stitchs/OE_stitchs.h"
27 
28 struct motif_line {
29  std::vector<vector_2d> pts;
30  bool endPoints;
31 
32  motif_line( std::vector<vector_2d> _pts, bool _endPoints) {
33  pts = _pts;
34  endPoints = _endPoints;
35  }
36 };
37 
38  static std::vector<motif_line> motifs;
39 
40 class OE_linestitch : public OE_stitchs
41 {
42  public:
43  //OE_linestitch();
44  OE_linestitch(OE_thread* thread, OE_curve* curve, float len, float width);
45  OE_linestitch(OE_thread* thread, OE_curve* curve, float len, float width, unsigned motif, float offset);
46  ~OE_linestitch();
47 
48  virtual bool check();
49 
50  virtual void refresh();
51 
52 
53  void setCurve( OE_curve* curve);
54  void setLen(float len);
55  void setWidth(float width);
56  void setMotif(unsigned stitch);
57  void setOffset(float offset);
58  void setReverse(bool reverse);
59 
60  static bool initMotifs();
61 
62  void delDependency(OE_base * object);
63 
64  protected:
65  OE_curve* curve = nullptr;
66  bool reverse = false;
67  float len=1;
68  float width=1;
69  unsigned stitchType = 0;
70  float offset = 0;
71 
72 };
73 
74 #endif // OE_LINESTITCH_H
Definition: OE_linestitch.h:40
Definition: OE_thread.h:26
OE_thread * thread
Tight bounding box of the shape [minx,miny,maxx,maxy].
Definition: OE_stitchs.h:90
Definition: OE_linestitch.h:28
Definition: OE_base.h:30
Definition: OE_stitchs.h:31
Definition: OE_curve.h:30
virtual bool check()
check if the stitch is valid.
Definition: OE_linestitch.cpp:86
void delDependency(OE_base *object)
the function called by a reference object when he's deleted
Definition: OE_linestitch.cpp:152