openEmbroider  0.1
an open source embroidery software
OE_controller.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_CONTROLLER_H
23 #define OE_CONTROLLER_H
24 
25 #include "OE_display.h"
26 #include "OE_document.h"
27 #include "curves/OE_joincurve.h"
28 #include "curves/OE_subcurve.h"
29 #include "curves/OE_pointcurve.h"
30 
31 #include "stitchs/OE_linestitch.h"
32 #include "stitchs/OE_birailstitch.h"
33 #include "stitchs/OE_linkstitch.h"
34 
35 #include "instructions/OE_waitcolor.h"
36 #include "instructions/OE_start.h"
37 #include "../comm/master.hpp"
38 
40 {
41  public:
43  OE_controller(OE_display* display, OE_document* document );
45  virtual ~OE_controller();
46 
48  bool testLogo2();
49  bool testOpenEmbroider();
50  bool setDefault();
51 
52  OE_curve* getCurve (unsigned index);
53  OE_pointcurve* getPointcurve (unsigned index);
54  OE_subcurve* getSubcurve (unsigned index);
55  OE_joincurve* getJoincurve (unsigned index);
56 
58  OE_stitchs* getStitch (unsigned index);
59  OE_linestitch* getLineStitch (unsigned index);
60  OE_birailstitch* getBirailStitch (unsigned index);
61  OE_linkstitch* getLinkStitch (unsigned index);
62  OE_thread* getThread (unsigned index);
63 
65  bool addCurve( std::vector<vector_2d> points, bool closed);
66  bool addCurve( OE_curve* curve);
67 
68  bool addStitch(OE_stitchs * stitch);
69 
71  bool addLineStitch(OE_curve* curve);
72  bool addLineStitch( OE_curve* curve, float len, float width, unsigned motif, float offset);
74  bool addBirailStitch();
75  bool addBirailStitch(OE_curve* curve1, OE_curve* curve2, bool reverse1, bool reverse2, float offset1, float offset2, float len);
76 
78  bool addLinkStitch(OE_stitchs* stitchStart, OE_stitchs* stitchEnd);
79 
81  bool addThread();
82  bool addThread(unsigned char r, unsigned char g, unsigned char b, float width );
83 
84  bool selectCurve( OE_curve* curve, bool add);
85  bool selectStitch( OE_stitchs* stitch, bool add);
86 
87  bool refreshStitchs();
88 
89  bool setStitchMaxLen( unsigned index, float maxLen);
90 
91  bool setLineStitchMotif( unsigned index, unsigned motif);
92  bool setLineStitchCurve( unsigned index, OE_curve* curve);
93  bool setLineStitchSize( unsigned index, float len, float width);
94  bool setLineStitchSizeReverse(unsigned index, bool reverse);
95 
96  bool setBirailStitchCurves( unsigned index, OE_curve* curve1, OE_curve* curve2);
97  //bool setBirailStitchSub( unsigned index, float start1, float end1, bool reverse1, float start2, float end2, bool reverse2);
98  bool setBirailStitchSize( unsigned index, float len, float offset1, float offset2);
99 
100  bool setLinkStitchStitch( unsigned index, OE_stitchs* stitchStart, OE_stitchs* stitchEnd);
101 
102  bool setStitchThread(unsigned index, OE_thread * thread);
103 
104  bool setThreadColor(unsigned index, unsigned char r, unsigned char g, unsigned char b );
105  bool setThreadWidth(unsigned index, float width );
106 
107  bool setsubcurvePos( unsigned index, float start, float end);
108 
109  bool generateInstructions();
110  void sendInstPoint();
111 
112  protected:
113  OE_display * display = nullptr;
114  OE_document* document = nullptr;
115  CommMaster comm;
116  private:
117 
118 };
119 
120 #endif // OE_CONTROLLER_H
bool addLinkStitch(OE_stitchs *stitchStart, OE_stitchs *stitchEnd)
to create a new linkstitch.
Definition: OE_linestitch.h:40
Definition: OE_subcurve.h:29
bool addLineStitch(OE_curve *curve)
to create a new linestitch.
Definition: OE_controller.cpp:458
bool testLogo2()
to create a new curve.
Definition: OE_controller.cpp:40
bool addBirailStitch()
to create a new birailstitch.
Definition: OE_pointcurve.h:30
Definition: OE_thread.h:26
OE_controller(OE_display *display, OE_document *document)
Definition: OE_controller.cpp:28
bool addThread()
to create a new thread.
Definition: OE_controller.cpp:481
virtual ~OE_controller()
Definition: OE_controller.cpp:36
Definition: OE_display.h:34
OE_stitchs * getStitch(unsigned index)
return linestitch if the index is pointing on a linestitch, else return null
Definition: OE_controller.cpp:370
Definition: OE_stitchs.h:31
Definition: OE_linkstitch.h:27
Definition: OE_curve.h:30
Definition: master.hpp:118
Definition: OE_controller.h:39
Definition: OE_document.h:32
Definition: OE_birailstitch.h:28
bool addCurve(std::vector< vector_2d > points, bool closed)
to create a new curve.
Definition: OE_controller.cpp:440
Definition: OE_joincurve.h:29