Reason of regression: correction of isNestedSketchOperation() to remove hard-coded Sketch feature kinds.
ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
if (!PartSet_SketcherMgr::isSketchOperation(anOperation) &&
- !PartSet_SketcherMgr::isNestedSketchOperation(anOperation,
- myModule->sketchMgr()->activeSketch()))
+ !myModule->sketchMgr()->isNestedSketchOperation(anOperation))
return false;
myCoinsideLines.clear();
ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
- PartSet_SketcherMgr::isNestedSketchOperation(anOperation,
- myModule->sketchMgr()->activeSketch());
+ myModule->sketchMgr()->isNestedSketchOperation(anOperation);
if (isActiveSketch) {
theStdActions["WIREFRAME_CMD"]->setEnabled(false);
theStdActions["SHADING_CMD"]->setEnabled(false);
CompositeFeaturePtr aSketch = myModule->sketchMgr()->activeSketch();
bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
- PartSet_SketcherMgr::isNestedSketchOperation(anOperation, aSketch);
+ myModule->sketchMgr()->isNestedSketchOperation(anOperation);
if (!isActiveSketch)
return;
QObjectPtrList anObjects;
bool isUseTransaction = false;
// 1. change auxiliary type of a created feature
- if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation, aSketch) &&
+ if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) &&
PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) {
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(anOperation);
CompositeFeaturePtr aSketch = myModule->sketchMgr()->activeSketch();
bool isActiveSketch = PartSet_SketcherMgr::isSketchOperation(anOperation) ||
- PartSet_SketcherMgr::isNestedSketchOperation(anOperation, aSketch);
+ myModule->sketchMgr()->isNestedSketchOperation(anOperation);
if (!isActiveSketch)
return anEnabled;
QObjectPtrList anObjects;
// 1. change auxiliary type of a created feature
- if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation, aSketch) &&
+ if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) &&
PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) {
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
if (aFOperation)
else {
/// The operation should not be aborted here, because the method does not changed
/// the auxilliary state, but checks the possibility to perform this
- ///if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation,
- // myModule->sketchMgr()->activeSketch()))
+ ///if (myModule->sketchMgr()->isNestedSketchOperation(anOperation))
/// anOperation->abort();
// 2. change auxiliary type of selected sketch entities
ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
{
- if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation, sketchMgr()->activeSketch())) {
+ if (sketchMgr()->isNestedSketchOperation(theOperation)) {
mySketchMgr->commitNestedSketch(theOperation);
}
if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
mySketchMgr->startSketch(theOperation);
}
- else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation,
- sketchMgr()->activeSketch())) {
+ else if (sketchMgr()->isNestedSketchOperation(theOperation)) {
mySketchMgr->startNestedSketch(theOperation);
}
}
bool isModifiedResults = myCustomPrs->deactivate(ModuleBase_IModule::CustomizeResults, false);
bool isModified = isModifiedArgs || isModifiedResults;
- if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation, sketchMgr()->activeSketch())) {
+ if (sketchMgr()->isNestedSketchOperation(theOperation)) {
mySketchMgr->stopNestedSketch(theOperation);
}
else if (PartSet_SketcherMgr::isSketchOperation(theOperation))
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
- isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation,
- sketchMgr()->activeSketch());
+ isNestedOp = sketchMgr()->isNestedSketchOperation(anOperation);
if (isSketchOp || isNestedOp) {
// in active sketch operation it is possible to activate operation object in selection
// in the edit operation, e.g. points of the line can be moved when the line is edited
// 1. check whether the delete should be processed in the module
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
- isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation,
- sketchMgr()->activeSketch());
+ isNestedOp = sketchMgr()->isNestedSketchOperation(anOperation);
if (isSketchOp || isNestedOp) {
isProcessed = true;
// 2. find selected presentations
if (aCmd->isCheckable() && aCmd->isChecked()) {
// 1. check whether the delete should be processed in the module
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- bool isNestedOp = PartSet_SketcherMgr::isNestedCreateOperation(anOperation);
+ bool isNestedOp = myModule->sketchMgr()->isNestedCreateOperation(anOperation);
if (isNestedOp) {
// in case if in the viewer nothing is displayed, the create operation should not be
// comitted even if all values of the feature are initialized
GeomShapePtr aGeomShape;
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
- if (anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation,
- sketchMgr()->activeSketch())) {
+ if (anOperation && sketchMgr()->isNestedSketchOperation(anOperation)) {
aGeomShape = PartSet_Tools::findShapeBy2DPoint(theAttribute, myWorkshop);
}
return aGeomShape;
return;
bool isSketcher = isSketchOperation(aFOperation);
- bool isSketchOpe = isNestedSketchOperation(aFOperation, activeSketch());
+ bool isSketchOpe = isNestedSketchOperation(aFOperation);
// Avoid non-sketch operations
if ((!isSketchOpe) && (!isSketcher))
return;
ModuleBase_Operation* aOp = getCurrentOperation();
if (aOp) {
- if (isNestedSketchOperation(aOp, activeSketch())) {
+ if (isNestedSketchOperation(aOp)) {
// Only for sketcher operations
if (myIsDragging) {
if (myDragDone) {
return theOperation && theOperation->id().toStdString() == SketchPlugin_Sketch::ID();
}
-bool PartSet_SketcherMgr::isNestedSketchOperation(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch)
+bool PartSet_SketcherMgr::isNestedSketchOperation(ModuleBase_Operation* theOperation) const
{
bool aNestedSketch = false;
- if (theOperation && theSketch.get()) {
+ FeaturePtr anActiveSketch = activeSketch();
+ if (anActiveSketch.get() && theOperation) {
+ ModuleBase_Operation* aSketchOperation = operationMgr()->findOperation(
+ anActiveSketch->getKind().c_str());
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
- (theOperation);
- if (aFOperation) {
+ (theOperation);
+ if (aSketchOperation && aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
- aNestedSketch = theSketch->isSub(aFeature);
+ if (aFeature.get()) {
+ QStringList aGrantedOpIds = aSketchOperation->grantedOperationIds();
+ aNestedSketch = aGrantedOpIds.contains(aFeature->getKind().c_str());
+ }
}
}
return aNestedSketch;
}
bool PartSet_SketcherMgr::isNestedCreateOperation(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch)
+ const CompositeFeaturePtr& theSketch) const
{
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(theOperation);
return aFOperation && !aFOperation->isEditOperation() &&
- isNestedSketchOperation(aFOperation, theSketch);
+ isNestedSketchOperation(aFOperation);
}
bool PartSet_SketcherMgr::isNestedEditOperation(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch)
+ const CompositeFeaturePtr& theSketch) const
{
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(theOperation);
return aFOperation && aFOperation->isEditOperation() &&
- isNestedSketchOperation(aFOperation, theSketch);
+ isNestedSketchOperation(aFOperation);
}
bool PartSet_SketcherMgr::isEntity(const std::string& theId)
{
myIsMouseOverViewProcessed = true;
operationMgr()->onValidateOperation();
- if (canChangeCursor(theOperation)) {
+ // when sketch nested operation is stopped the cursor should be restored unconditionally
+ //if (canChangeCursor(theOperation)) {
QApplication::restoreOverrideCursor();
#ifdef DEBUG_CURSOR
qDebug("stopNestedSketch() : None");
#endif
- }
+ //}
/// improvement to deselect automatically all eventual selected objects, when
// returning to the neutral point of the Sketcher
// if the operation is restarted, the previous selection is used to initialize started operation
{
bool isOperationStopped = false;
ModuleBase_Operation* anOperation = getCurrentOperation();
- if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation, activeSketch())) {
+ if(anOperation && isNestedSketchOperation(anOperation)) {
// Set final definitions if they are necessary
//propertyPanelDefined(aOperation);
/// Commit sketcher operations automatically
(getCurrentOperation());
if (aFOperation) {
if (PartSet_SketcherMgr::isSketchOperation(aFOperation) ||
- PartSet_SketcherMgr::isNestedSketchOperation(aFOperation, activeSketch()) &&
+ isNestedSketchOperation(aFOperation) &&
thePreviousState == ModuleBase_ModelWidget::ModifiedInPP) {
FeaturePtr aFeature = aFOperation->feature();
visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature));
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(getCurrentOperation());
if (aFOperation && (PartSet_SketcherMgr::isSketchOperation(aFOperation) ||
- PartSet_SketcherMgr::isNestedSketchOperation(aFOperation, activeSketch())))
+ isNestedSketchOperation(aFOperation)))
SketcherPrs_Tools::sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]);
// update entities selection priorities
/// \return the boolean result
static bool isSketchOperation(ModuleBase_Operation* theOperation);
- /// Returns true if the operation feature is a sub in the given sketch
+ /// Returns true if the operation feature belongs to list of granted features of Sketch
+ /// operation. An operation of a sketch should be started before.
/// \param theOperation an operation
- /// \param theSketch a sketch feature
/// \return the boolean result
- static bool isNestedSketchOperation(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch);
+ bool isNestedSketchOperation(ModuleBase_Operation* theOperation) const;
/// Returns true if the operation is a create and nested sketch operationn
/// \param theOperation a checked operation
/// \param theSketch a sketch feature
//// \return boolean value
- static bool isNestedCreateOperation(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch);
+ bool isNestedCreateOperation(ModuleBase_Operation* theOperation,
+ const CompositeFeaturePtr& /*theSketch*/) const;
/// Returns true if the operation is an edit nested feature one
/// \param theOperation a checked operation
//// \return boolean value
- static bool isNestedEditOperation(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch);
+ bool isNestedEditOperation(ModuleBase_Operation* theOperation,
+ const CompositeFeaturePtr& /*theSketch*/) const;
/// Returns whether the current operation is a sketch entity - line, point, arc or circle
/// \param theId is an id of object
if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
return;
- if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation,
- module()->sketchMgr()->activeSketch())) {
+ if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
bool isStarted = false;
if (!module()->sketchMgr()->sketchSolverError()) {
if (myRestartingMode != RM_Forbided) {
bool anActive = PartSet_SketcherMgr::isSketchOperation(aCurrentOperation);
if (!anActive) {
- anActive = PartSet_SketcherMgr::isNestedSketchOperation(aCurrentOperation,
- module()->sketchMgr()->activeSketch());
+ anActive = module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation);
if (anActive) { // the manager is not active when the current operation is a usual Edit
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(myWorkshop->currentOperation());
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(myWorkshop->currentOperation());
- if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation,
- module()->sketchMgr()->activeSketch())) {
+ if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
aFOperation->setEditOperation(true/*, false*/);
createInternalFeature();
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(myWorkshop->currentOperation());
- if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation,
- module()->sketchMgr()->activeSketch())) {
+ if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
FeaturePtr anOperationFeature = aFOperation->feature();
CompositeFeaturePtr aSketch = module()->sketchMgr()->activeSketch();
}
bool PartSet_SketcherReetntrantMgr::isTangentArc(ModuleBase_Operation* theOperation,
- const CompositeFeaturePtr& theSketch)
+ const CompositeFeaturePtr& /*theSketch*/) const
{
bool aTangentArc = false;
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(theOperation);
- if (aFOperation && PartSet_SketcherMgr::isNestedSketchOperation(aFOperation, theSketch)) {
+ if (aFOperation && module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
FeaturePtr aFeature = aFOperation->feature();
if (aFeature.get() && aFeature->getKind() == SketchPlugin_Arc::ID()) {
AttributeStringPtr aTypeAttr = aFeature->data()->string(SketchPlugin_Arc::ARC_TYPE());
const bool isTemporary = false);
/// Checks whethe the feature of the given operation has kind an arc and the arc type is tangent
- static bool isTangentArc(ModuleBase_Operation* theOperation,
- const std::shared_ptr<ModelAPI_CompositeFeature>& theSketch);
+ bool isTangentArc(ModuleBase_Operation* theOperation,
+ const std::shared_ptr<ModelAPI_CompositeFeature>& /*theSketch*/) const;
/// Accept All action is enabled if an internal edit is started. It updates the state of the button
void updateAcceptAllAction();
ModuleBase_Operation* XGUI_OperationMgr::findOperation(const QString& theId) const
{
- foreach(ModuleBase_Operation* aOp, myOperations) {
- if (aOp->id() == theId)
- return aOp;
+ QList<ModuleBase_Operation*>::const_iterator anIt = myOperations.end();
+ while (anIt != myOperations.begin()) {
+ --anIt;
+ ModuleBase_Operation* anOperation = *anIt;
+ if (anOperation->id() == theId)
+ return anOperation;
}
return 0;
}