const gp_Pnt& aStart = theStart->impl<gp_Pnt>();
const gp_Pnt& anEnd = theEnd->impl<gp_Pnt>();
+ if (aStart.IsEqual(anEnd, Precision::Confusion()))
+ return boost::shared_ptr<GeomAPI_Shape>();
BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd);
boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
ModuleBase_PropPanelOperation(const QString& theId = "", QObject* parent = 0);
virtual ~ModuleBase_PropPanelOperation();
- /*!
- * \brief Replied whether the operation should be commited after the start, or the operation itself
- * do that. The default realization provides the check by the operation having the xml prepresentation
- * @return the boolean value
- */
- virtual bool isPerformedImmediately() const
- {
- return xmlRepresentation().isEmpty();
- }
/*!
* \brief Returns XML representation of the operation's widget.
* \return XML QString
#include <Events_Loop.h>
#include <Events_Message.h>
+#include <GeomAPI_Shape.h>
+
#include <AIS_ListOfInteractive.hxx>
#include <QObject>
return;
if (isDisplay) {
- myWorkshop->displayer()->LocalSelection(anOperation->feature(), aPreviewOp->preview(),
- aPreviewOp->getSelectionMode());
+ boost::shared_ptr<GeomAPI_Shape> aPreview = aPreviewOp->preview();
+ if (aPreview)
+ myWorkshop->displayer()->LocalSelection(anOperation->feature(),
+ aPreview->impl<TopoDS_Shape>(), aPreviewOp->getSelectionMode());
}
else {
myWorkshop->displayer()->GlobalSelection(false);
{
}
-bool PartSet_OperationSketch::isPerformedImmediately() const
-{
- return false;
-}
-
int PartSet_OperationSketch::getSelectionMode() const
{
return TopAbs_FACE;
/// Destructor
virtual ~PartSet_OperationSketch();
- /// The sketch can not be created immediately, firstly a plane should be set
- virtual bool isPerformedImmediately() const;
-
/// Returns the operation local selection mode
/// \return the selection mode
virtual int getSelectionMode() const;
{
}
-const TopoDS_Shape& PartSet_OperationSketchBase::preview() const
+boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview() const
{
boost::shared_ptr<SketchPlugin_Feature> aFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
- return aFeature->preview()->impl<TopoDS_Shape>();
+ return aFeature->preview();
}
#include <ModuleBase_PropPanelOperation.h>
#include <QObject>
+class GeomAPI_Shape;
+
/*!
\class PartSet_OperationSketchBase
* \brief The base operation for the sketch features.
virtual ~PartSet_OperationSketchBase();
/// Returns the feature preview shape
- const TopoDS_Shape& preview() const;
+ boost::shared_ptr<GeomAPI_Shape> preview() const;
/// Returns the operation local selection mode
/// \return the selection mode
{
}
-bool PartSet_OperationSketchLine::isPerformedImmediately() const
+bool PartSet_OperationSketchLine::isGranted() const
{
- return false;
+ return true;
}
int PartSet_OperationSketchLine::getSelectionMode() const
/// Destructor
virtual ~PartSet_OperationSketchLine();
- /// The sketch can not be created immediately, firstly a plane should be set
- virtual bool isPerformedImmediately() const;
+ /// Returns that this operator can be started above already running one.
+ /// The runned operation should be the sketch feature modified operation
+ virtual bool isGranted() const;
/// Returns the operation local selection mode
/// \return the selection mode
(ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
if (myOperationMgr->startOperation(anOperation)) {
- if (anOperation->isPerformedImmediately()) {
+ if (anOperation->xmlRepresentation().isEmpty()) {
anOperation->commit();
updateCommandStatus();
}