// Unnamed CAD Software // // License: GPLv3 (or later) // Language: C++17 // Notes: // - use a right-handed, Z-up coordinate system to match Open CASCADE #ifndef APPLICATIONCONTROLLER_H #define APPLICATIONCONTROLLER_H #include #include #include class Document; class MainWindow; class SketchFeature; class ApplicationController : public QObject { Q_OBJECT public: enum ToolType { None, Line, Rectangle, Circle }; Q_ENUM(ToolType) explicit ApplicationController(QObject *parent = nullptr); ~ApplicationController(); void setMainWindow(MainWindow* mainWindow); Document* document() const; SketchFeature* activeSketch() const; ToolType activeTool() const; public slots: void setActiveTool(ToolType tool); void addLine(const gp_Pnt& start, const gp_Pnt& end); void addRectangle(const gp_Pnt& corner1, const gp_Pnt& corner2); void addCircle(const gp_Pnt& center, double radius); void newDocument(); bool openDocument(); bool saveDocument(); bool saveDocumentAs(); void beginSketchCreation(); void onPlaneSelected(const gp_Ax2& plane); void endSketch(); signals: void planeSelectionModeStarted(); void sketchModeStarted(const gp_Ax2& plane); void sketchModeEnded(); void currentFileChanged(const QString& path); void activeToolChanged(ToolType tool); private: ApplicationController(const ApplicationController&) = delete; ApplicationController& operator=(const ApplicationController&) = delete; void setCurrentFile(const QString& fileName); Document* m_document; QString m_currentFile; MainWindow* m_mainWindow = nullptr; SketchFeature* m_activeSketch = nullptr; ToolType m_activeTool = ToolType::None; }; #endif // APPLICATIONCONTROLLER_H