#define MIN_BUTTON_HEIGHT 18
#define MIN_BUTTON_WIDTH 40
+/**\class XGUI_Command
+ * \ingroup GUI
+ * \brief Represents a command item in the application menu (Workbench)
+ */
class XGUI_Command: public QWidgetAction
{
Q_OBJECT
XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent);
~XGUI_Command();
+ //! Returns true if the command is enabled
virtual bool enabled() const;
+
+ //! Set the command enabled
virtual void enable();
+
+ //! Set the command disabled
virtual void disable();
+
+ //! Returns Id of the command
virtual QString getId() const
{
return myId;
}
+ //! Connect the command to a slot
virtual void connectTo(const QObject* theResiver, const char* theSlot);
protected:
+ //! Creates a command representation widget dependently on parent widget type
virtual QWidget* createWidget(QWidget* theParent);
private:
#include <QList>
+//! This file contains varioous constants used in the application
+
+
typedef QList<int> QIntList; //!< list of int values
typedef QList<short> QShortList; //!< list of short int values
typedef QList<double> QDoubleList; //!< list of double values
namespace XGUI
{
+//! Types of gradient type used in background of Viewer 3d
enum GradientType
{
NoGradient = -1,
LastGradient = Corner4Gradient
};
+//! Type of rotation point in viewer 3d
enum RotationPointType
{
GRAVITY, SELECTED
};
+//! Type of ribbon rect in Viewer 3d
enum SketchingType
{
NoSketching, Rect, Polygon
};
+
+//! View window operations accessible by hot keys
enum HotOperation
{
PAN, ZOOM, ROTATE, FIT_AREA
};
+//! Types of view window interactions
enum InteractionStyle
{
STANDARD, KEY_FREE
};
+//! Types of 2d mode in viewer 3d
enum Mode2dType
{
No2dMode, XYPlane, XZPlane, YZPlane
};
+//! Types of background in view window
enum BackgroundMode
{
NoBackground, // no (invalid) background data
XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
: QAbstractItemModel(theParent)
{
+ // Find Document object
std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
myDocument = aMgr->currentDocument();
+ // Register in event loop
Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ // Create a top part of data tree model
myModel = new XGUI_TopDataModel(this);
myModel->setDocument(myDocument);
}
class XGUI_PartDataModel;
class XGUI_TopDataModel;
-
+/**\class XGUI_DocumentDataModel
+ * \ingroup GUI
+ * \brief This is a proxy data model for Object Browser (QTreeView).
+ * It contains several sub-models for generation of each sub-part of data tree.
+ */
class XGUI_DocumentDataModel : public QAbstractItemModel, public Event_Listener
{
Q_OBJECT
public:
+
+
XGUI_DocumentDataModel(QObject* theParent);
virtual ~XGUI_DocumentDataModel();
private:
+ //! Converts QModelIndex of this model to QModelIndex of a one of sub-models.
QModelIndex toSourceModel(const QModelIndex& theProxy) const;
+
+ //! Finds a pointer on QModelIndex which is equal to the given one
QModelIndex* findModelIndex(const QModelIndex& theIndex) const;
+
+ //! Returns pointer on QModelIndex which is equal to the given one.
QModelIndex* getModelIndex(const QModelIndex& theIndex) const;
+
+ //! Deletes all saved pointers on QModelIndex objects.
void clearModelIndexes();
+ //! Document
std::shared_ptr<ModelAPI_Document> myDocument;
+ //! Data model of top part of data tree (not parts object)
XGUI_TopDataModel* myModel;
+
+ //! Data models for Parts data tree representation (one data model per a one part)
QList<XGUI_PartDataModel*> myPartModels;
+ //! List of saved QModelIndexes created by sub-models
QList<QModelIndex*> myIndexes;
};
class QAction;
class QDockWidget;
+/**\class XGUI_MainMenu
+ * \ingroup GUI
+ * \brief Class for creation of main menu (set of workbenches)
+ */
class XGUI_MainMenu: public QObject
{
Q_OBJECT
XGUI_MainMenu(XGUI_MainWindow *parent);
virtual ~XGUI_MainMenu();
+ //! Creates and adds a new workbench (menu group) with the given name and returns it.
XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = "");
+
+ //! Returns workbench (menu group) by the given name.
XGUI_Workbench* findWorkbench(const QString& theId);
+ //! Returns General page (predefined workbench)
XGUI_Workbench* generalPage() const { return myGeneralPage; }
+ //! Rerturns last created workbench in dock widget container
QDockWidget* getLastDockWindow() const { return myMenuTabs.last(); }
private:
class QMdiArea;
class PyConsole_EnhConsole;
+/**\class XGUI_MainWindow
+ * \ingroup GUI
+ * \brief Main window of the application (Desktop).
+ * It contains: Object Browser, 3d Viewer, Python console, property panel, main menu
+ */
class XGUI_MainWindow: public QMainWindow
{
Q_OBJECT
XGUI_MainWindow(QWidget* parent = 0);
virtual ~XGUI_MainWindow();
+ //! Returns main menu object
XGUI_MainMenu* menuObject() const
{
return myMenuBar;
}
+ //! Returns Object browser
XGUI_ObjectsBrowser* objectBrowser() const
{
return myObjectBrowser;
}
- void showObjectBrowser();
- void hideObjectBrowser();
-
+ //! Returns MDI area
QMdiArea* mdiArea() const;
+ //! Returns 3d viewer
XGUI_Viewer* viewer() const
{
return myViewer;
void hidePythonConsole();
void showPropertyPanel();
void hidePropertyPanel();
+ void showObjectBrowser();
+ void hideObjectBrowser();
private:
void createDockWidgets();
#include "XGUI_ObjectsBrowser.h"
#include "XGUI_DocumentDataModel.h"
-//#include "XGUI_PartDataModel.h"
-
-//#include <ModelAPI_PluginManager.h>
-//#include <ModelAPI_Iterator.h>
-//#include <ModelAPI_Document.h>
-//#include <ModelAPI_Feature.h>
-//#include <ModelAPI_Object.h>
-//#include <Model_Document.h>
XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
: QTreeView(theParent)
{
setHeaderHidden(true);
XGUI_DocumentDataModel* aDocModel = new XGUI_DocumentDataModel(this);
- //std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- //std::shared_ptr<ModelAPI_Document> aDocument = aMgr->currentDocument();
- //aDocModel->setDocument(aDocument, 0);
setModel(aDocModel);
}
class ModelAPI_Feature;
class ModelAPI_Document;
+/**\class XGUI_TopDataModel
+ * \ingroup GUI
+ * \brief This is a data model for Object Browser (QTreeView).
+ * It represents only upper part of data tree (non-parts tree items)
+ */
class XGUI_TopDataModel : public QAbstractItemModel
{
Q_OBJECT
XGUI_TopDataModel(QObject* theParent);
virtual ~XGUI_TopDataModel();
+ //! Set a document object
virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc)
{
myDocument = theDoc;
virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
private:
+ //! Types of QModelIndexes
enum DataIds {
ParamsFolder,
ParamObject,
ConstructObject
};
+ //! Document object
std::shared_ptr<ModelAPI_Document> myDocument;
};
-
+/**\class XGUI_PartDataModel
+ * \ingroup GUI
+ * \brief This is a data model for Object Browser (QTreeView).
+ * It represents data tree only of a one part
+ */
class XGUI_PartDataModel : public QAbstractItemModel
{
Q_OBJECT
XGUI_PartDataModel(QObject* theParent);
virtual ~XGUI_PartDataModel();
+ //! Set a document object and Id of a part in the document
virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc, int theId)
{
myDocument = theDoc;
private:
std::shared_ptr<ModelAPI_Document> featureDocument() const;
-
+ //! Types of QModelIndexes
enum DataIds {
MyRoot,
ParamsFolder,
ConstructObject
};
+ //! Document object
std::shared_ptr<ModelAPI_Document> myDocument;
+
+ //! Id of the current part object in the document
int myId;
};
#include <QWidget>
+/*!
+ \class XGUI_AbstractRubberBand
+ \ingroup GUI
+ \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection.
+
+ Currently this class does not support Style functionality in full.
+*/
class XGUI_AbstractRubberBand: public QWidget
{
Q_OBJECT
bool myIsClosed;
};
+/*!
+ \class XGUI_RectRubberBand
+ \ingroup GUI
+ \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection.
+
+ Redefinition for rectangular rubber band
+*/
class XGUI_RectRubberBand: public XGUI_AbstractRubberBand
{
Q_OBJECT
class XGUI_RectRubberBand;
class QMdiSubWindow;
+/*!
+ \class XGUI_ViewWindow
+ \ingroup GUI
+ \brief Implements a one view window of 3d viewer object.
+ It contains a view port object (drawing area) and toolbars for view camera and window management.
+ Also it managements events in view port
+*/
class XGUI_ViewWindow: public QFrame
{
Q_OBJECT
public:
+ //! Types of viewer operations
enum OperationType
{
NOTHING,
virtual ~XGUI_ViewWindow();
+ //! Returns view port object
XGUI_ViewPort* viewPort() const
{
return myViewPort;
}
+ //! Retrurns current interaction style
XGUI::InteractionStyle interactionStyle() const
{
return myInteractionStyle;
}
+ //! Disable or enable given operation type
void setTransformEnabled(const OperationType, const bool);
+
+ //! Returns true if the given operation type is enabled
bool transformEnabled(const OperationType) const;
+ //! Returns View background object
XGUI_ViewBackground background() const;
+
+ //! Sets View background object
void setBackground(const XGUI_ViewBackground& theBackground);
+ //! Returns true if the current view window can be closed
bool closable() const { return myClosable; }
+
+ //! Sets the current view window closable or not
void setClosable( const bool isClosable ) { myClosable = isClosable; }
signals:
- void vpTransformationStarted(XGUI_ViewWindow::OperationType type);
- void vpTransformationFinished(XGUI_ViewWindow::OperationType type);
-
- void Show(QShowEvent *);
- void Hide(QHideEvent *);
- void maximized(XGUI_ViewWindow*, bool);
- void returnedTo3d();
-
- void tryClosing(XGUI_ViewWindow*);
- void closed( QMdiSubWindow* );
- void mousePressed(XGUI_ViewWindow*, QMouseEvent*);
- void mouseReleased(XGUI_ViewWindow*, QMouseEvent*);
- void mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*);
- void mouseMoving(XGUI_ViewWindow*, QMouseEvent*);
- void keyPressed(XGUI_ViewWindow*, QKeyEvent*);
- void keyReleased(XGUI_ViewWindow*, QKeyEvent*);
- void contextMenuRequested(QContextMenuEvent *e);
-
- void viewModified(XGUI_ViewWindow*);
- void viewCloned( QMdiSubWindow* theView );
+ //! Emited whien view transformation operation is started
+ void vpTransformationStarted(XGUI_ViewWindow::OperationType type);
+
+ //! Emited whien view transformation operation is finished
+ void vpTransformationFinished(XGUI_ViewWindow::OperationType type);
+
+ //void Show(QShowEvent *);
+ //void Hide(QHideEvent *);
+ //void maximized(XGUI_ViewWindow*, bool);
+ //void returnedTo3d();
+
+ //! Emited before the window closing
+ void tryClosing(XGUI_ViewWindow*);
+
+ //! Emited when window is closing
+ void closed( QMdiSubWindow* );
+
+ //! Emited on mouse press in view port
+ void mousePressed(XGUI_ViewWindow*, QMouseEvent*);
+
+ //! Emited on mouse release in view port
+ void mouseReleased(XGUI_ViewWindow*, QMouseEvent*);
+
+ //! Emited on mouse double click in view port
+ void mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*);
+
+ //! Emited on mouse moving in view port
+ void mouseMoving(XGUI_ViewWindow*, QMouseEvent*);
+
+ //! Emited on key press in view port
+ void keyPressed(XGUI_ViewWindow*, QKeyEvent*);
+
+ //! Emited on key release in view port
+ void keyReleased(XGUI_ViewWindow*, QKeyEvent*);
+
+ //! Emited on context menu request in view port
+ void contextMenuRequested(QContextMenuEvent *e);
+
+ //void viewModified(XGUI_ViewWindow*);
+ void viewCloned( QMdiSubWindow* theView );
public slots:
+ //! Start zooming operation
void activateZoom();
+
+ //! Start rotation operation
void activateRotation();
+
+ //! Start panning operation
void activatePanning();
+
+ //! Start window fit operation
void activateWindowFit();
+
+ //! Start global panning operation
void activateGlobalPanning();
+ //! Clone the view window preserving a view point of the current view
void cloneView();
+
+ //! Dump the view window into external file (*.bmp *.png *.jpg *.jpeg *.eps *.ps)
void dumpView();
+
+ //! Fit all command
void fitAll();
+ //! Set front view
void frontView();
+
+ //! Set back view
void backView();
+
+ //! Set top view
void topView();
+
+ //! Set bottom view
void bottomView();
+
+ //! Set left view
void leftView();
+
+ //! Set right view
void rightView();
+ //! Reset point of view
void reset();
};
//******************************************************
+/*!
+ \class ViewerToolbar
+ \ingroup GUI
+ \brief Provides a toolbar widget with treansparent background over OCCT View window
+*/
class ViewerToolbar: public QToolBar
{
Q_OBJECT
};
//******************************************************
+/*!
+ \class ViewerToolbar
+ \ingroup GUI
+ \brief Provides a Label widget with treansparent background over OCCT View window
+*/
class ViewerLabel: public QLabel
{
Q_OBJECT
class Config_FeatureMessage;
class Config_PointerMessage;
+/**\class XGUI_Workshop
+ * \ingroup GUI
+ * \brief Class which defines a configuration of the application (Workshop) and launches it.
+ */
class XGUI_Workshop: public QObject, public Event_Listener
{
Q_OBJECT
XGUI_Workshop();
virtual ~XGUI_Workshop();
+ //! Starting of the application
void startApplication();
+ //! Returns main window (Desktop) of the application
XGUI_MainWindow* mainWindow() const
{
return myMainWindow;
}
+ //! Creates and adds a new workbench (menu group) with the given name and returns it
XGUI_Workbench* addWorkbench(const QString& theName);
+ //! Redefinition of Event_Listener method
virtual void processEvent(const Event_Message* theMessage);
public slots: