1 /******************************************************************************************************
2  * (C) 2019 markummitchell@github.com. This file is part of Engauge Digitizer, which is released      *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission.     *
5  ******************************************************************************************************/
6 
7 #ifndef GUIDELINE_FACTORY_H
8 #define GUIDELINE_FACTORY_H
9 
10 #include "Guidelines.h"
11 #include "GuidelineState.h"
12 #include <QMap>
13 
14 class GraphicsScene;
15 class GuidelineAbstract;
16 class Guidelines;
17 class MainWindow;
18 class QGraphicsScene;
19 
20 typedef QMap<GuidelineState, QGraphicsScene*> MapStateToScene;
21 typedef QMap<GuidelineState, bool> MapStatesWithEllipse;
22 
23 /// Factory for generating Guideline objects. The complications are:
24 /// -# Some guidelines are lines (GuidelineLine) and some are ellipses (GuidelineEllipse)
25 /// -# Guidelines are either horizontal (X or theta T) or vertical (Y or range R)
26 class GuidelineFactory
27 {
28 public:
29   /// Single constructor.
30   GuidelineFactory (GraphicsScene *sceneMain);
31   virtual ~GuidelineFactory();
32 
33   GuidelineAbstract *createGuideline (Guidelines &guidelines,
34                                       GuidelineState stateInitial,
35                                       MainWindow &mainWindow,
36                                       const QString &identifier);
37 
38 private:
39   GuidelineFactory ();
40 
41   void createEllipseMap ();
42 
43   GraphicsScene *m_sceneMain;
44 
45   MapStatesWithEllipse m_mapStatesWithEllipse;
46 };
47 
48 #endif // GUIDELINE_FACTORY_H
49