if (aColor.IsEqual(aCurrentColor))
return false;
+ Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
if (!aDimAIS.IsNull()) {
aDimAIS->DimensionAspect()->SetCommonColor(aColor);
+ if (!aContext.IsNull())
+ aContext->Redisplay(aDimAIS, false);
+ }
+ else {
+ if (!aContext.IsNull())
+ aContext->SetColor(anAIS, aColor, false);
+ else
+ anAIS->SetColor(aColor);
}
- Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
- if (!aContext.IsNull())
- aContext->SetColor(anAIS, aColor, false);
- else
- anAIS->SetColor(aColor);
return true;
}
void PartSet_Module::onConflictingConstraints()
{
const std::set<ObjectPtr>& aConstraints = myOverconstraintListener->conflictingObjects();
- if (aConstraints.size() == 1) {
- QObjectPtrList aObjectsList;
- std::set<ObjectPtr>::const_iterator aIt;
- for (aIt = aConstraints.cbegin(); aIt != aConstraints.cend(); aIt++) {
- if (mySketchReentrantMgr->isLastAutoConstraint(*aIt))
- aObjectsList.append(*aIt);
- }
- if (aObjectsList.size() > 0) {
- XGUI_Workshop* aWorkshop = getWorkshop();
- QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
- ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription);
- XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
-
- ModuleBase_Operation* anOp = anOpMgr->currentOperation();
- if (sketchMgr()->isNestedSketchOperation(anOp))
- anOp->abort();
+ QObjectPtrList aObjectsList;
+ std::set<ObjectPtr>::const_iterator aIt;
+ for (aIt = aConstraints.cbegin(); aIt != aConstraints.cend(); aIt++) {
+ if (mySketchReentrantMgr->isLastAutoConstraint(*aIt))
+ aObjectsList.append(*aIt);
+ }
+ if (aObjectsList.size() > 0) {
+ XGUI_Workshop* aWorkshop = getWorkshop();
+ QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
+ ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription);
+ XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
- anOpMgr->startOperation(anOpAction);
- aWorkshop->deleteFeatures(aObjectsList);
- anOpMgr->commitOperation();
- ModuleBase_Tools::flushUpdated(sketchMgr()->activeSketch());
+ ModuleBase_Operation* anOp = anOpMgr->currentOperation();
+ if (sketchMgr()->isNestedSketchOperation(anOp))
+ anOp->abort();
- myWorkshop->viewer()->update();
- }
+ anOpMgr->startOperation(anOpAction);
+ aWorkshop->deleteFeatures(aObjectsList);
+ anOpMgr->commitOperation();
+ ModuleBase_Tools::flushUpdated(sketchMgr()->activeSketch());
}
}
// set error state for new objects and append them in the internal map of objects
std::set<ObjectPtr>::const_iterator
anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
+ FeaturePtr aFeature;
+ bool isHVConstraint = false;
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found
aModifiedObjects.insert(anObject);
myConflictingObjects.insert(anObject);
}
+ if (!isHVConstraint) {
+ aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
+ if (aFeature) {
+ std::string aType = aFeature->getKind();
+ isHVConstraint = (aType == SketchPlugin_ConstraintHorizontal::ID()) ||
+ (aType == SketchPlugin_ConstraintVertical::ID());
+ }
+ }
}
bool isUpdated = !aModifiedObjects.empty();
if (isUpdated)
redisplayObjects(aModifiedObjects);
- if (myConflictingObjects.size() == 1) {
- // If the conflicting object is an automatic constraint caused the conflict
- // then it has to be deleted
- ObjectPtr aObj = *theConflictingObjects.cbegin();
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
- if (aFeature) {
- std::string aType = aFeature->getKind();
- if ((aType == SketchPlugin_ConstraintHorizontal::ID()) ||
- (aType == SketchPlugin_ConstraintVertical::ID())) {
- PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
- QTimer::singleShot(5, aModule, SLOT(onConflictingConstraints()));
- }
- }
+ // If the conflicting object is an automatic constraint caused the conflict
+ // then it has to be deleted
+ if (isHVConstraint) {
+ PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
+ QTimer::singleShot(5, aModule, SLOT(onConflictingConstraints()));
}
return isUpdated;