Remove updateCommandStatus() after commit(), because it happens in slot onOperationStopped()
Add comments for code
+// File: XGUI_Displayer.cxx
+// Created: 20 Apr 2014
+// Author: Natalia ERMOLAEVA
+
#include "XGUI_Displayer.h"
-#include "XGUI_Tools.h"
#include "XGUI_Viewer.h"
#include <ModelAPI_Document.h>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
-/*!
- \brief Constructor
- */
XGUI_Displayer::XGUI_Displayer(XGUI_Viewer* theViewer)
: myViewer(theViewer)
{
}
-/*!
- \brief Destructor
- */
XGUI_Displayer::~XGUI_Displayer()
{
}
-/*!
- * Display the feature
- * \param theFeature a feature instance
- */
void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature)
{
}
-/*!
- * Display the feature and a shape. This shape would be associated to the given feature
- * \param theFeature a feature instance
- * \param theFeature a shape
- */
void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
const TopoDS_Shape& theShape)
{
aContext->UpdateCurrentViewer();
}
-/*!
- * Erase the feature and a shape.
- * \param theFeature a feature instance
- * \param theFeature a shape
- */
void XGUI_Displayer::Erase(boost::shared_ptr<ModelAPI_Feature> theFeature,
const TopoDS_Shape& theShape)
{
+// File: XGUI_Displayer.h
+// Created: 20 Apr 2014
+// Author: Natalia ERMOLAEVA
+
#ifndef XGUI_Displayer_H
#define XGUI_Displayer_H
/**\class XGUI_Displayer
* \ingroup GUI
- * \brief Displayer. Provides mechanizm of displa/erase of objects in viewer
+ * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
*/
class XGUI_EXPORT XGUI_Displayer
{
public:
+ /// Constructor
+ /// \param theViewer the viewer
XGUI_Displayer(XGUI_Viewer* theViewer);
+ /// Destructor
virtual ~XGUI_Displayer();
+ /// Display the feature. Obtain the visualized object from the feature.
+ /// \param theFeature a feature instance
void Display(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ /// Display the feature and a shape. This shape would be associated to the given feature
+ /// \param theFeature a feature instance
+ /// \param theFeature a shape
void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
+ /// Erase the feature and a shape.
+ /// \param theFeature a feature instance
+ /// \param theFeature a shape
void Erase(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
protected:
- XGUI_Viewer* myViewer; ///< the viewer
+ XGUI_Viewer* myViewer; ///< the viewer where the objects should be visualized
};
#endif
+// File: XGUI_OperationMgr.h
+// Created: 20 Apr 2014
+// Author: Natalia ERMOLAEVA
+
#include "XGUI_OperationMgr.h"
#include "ModuleBase_Operation.h"
return aCanStart;
}
-void XGUI_OperationMgr::commitCurrentOperation()
-{
- ModuleBase_Operation* anOperation = currentOperation();
- if (!anOperation)
- return;
-
- anOperation->commit();
-}
-
void XGUI_OperationMgr::onOperationStopped()
{
ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+// File: XGUI_OperationMgr.h
+// Created: 20 Apr 2014
+// Author: Natalia ERMOLAEVA
+
#ifndef XGUI_OperationMgr_H
#define XGUI_OperationMgr_H
/// \return the current operation
bool startOperation(ModuleBase_Operation* theOperation);
- void commitCurrentOperation();
-
signals:
+ /// Signal about an operation is started. It is emitted after the start() of operation is done.
void operationStarted();
+ /// Signal about an operation is stopped. It is emitted after the stop() of operation is done.
+ /// \param theOperation a stopped operation
void operationStopped(ModuleBase_Operation* theOperation);
protected:
+ /// Returns whether the operation can be started. Check if there is already started operation and
+ /// the granted parameter of the launched operation
+ /// \param theOperation an operation to check
bool canStartOperation(ModuleBase_Operation* theOperation);
protected slots:
+ /// Slot that is called by an operation stop. Removes the stopped operation form the stack.
+ /// If there is a suspended operation, restart it.
void onOperationStopped();
private:
(ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
if (myOperationMgr->startOperation(anOperation)) {
- if (anOperation->isPerformedImmediately()) {
- myOperationMgr->commitCurrentOperation();
- updateCommandStatus();
- }
+ if (anOperation->isPerformedImmediately())
+ anOperation->commit();
}
return;
}
}
+//******************************************************
void XGUI_Workshop::onOperationStarted()
{
ModuleBase_PropPanelOperation* aOperation =
}
}
-/**
- *
- */
+//******************************************************
void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
{
myMainWindow->hidePropertyPanel();
void connectWithOperation(ModuleBase_Operation* theOperation);
protected slots:
+ /// SLOT, that is called after the operation is started. Update workshop state according to
+ /// the started operation, e.g. visualizes the property panel and connect to it.
void onOperationStarted();
+ /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
+ /// hides the property panel and udpate the command status.
+ /// \param theOpertion a stopped operation
void onOperationStopped(ModuleBase_Operation* theOperation);
private: