#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomDataAPI_Point.h>
#include <SketchPlugin_ConstraintRadius.h>
#include <SketcherPrs_SymbolPrs.h>
+#include <SketcherPrs_Coincident.h>
#include <SketcherPrs_Tools.h>
#include <Events_Loop.h>
// the objects of the current operation should be deactivated
QObjectPtrList anObjects;
anObjects.append(aFeature);
- std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
anObjects.append(*aIt);
if (theActionId == "MOVE_CMD") {
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature) {
+ ResultPtr aResult = ModuleBase_Tools::firstResult(aFeature);
// part features can not be moved in the history.
- if (aFeature->getKind() == PartSetPlugin_Part::ID())
+ if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group())
aValid = false;
}
}
void PartSet_Module::launchOperation(const QString& theCmdId)
{
storeConstraintsState(theCmdId.toStdString());
+ updateConstraintsState(theCmdId.toStdString());
+
ModuleBase_IModule::launchOperation(theCmdId);
}
mySketchMgr->showConstraintStates();
myHasConstraintShown = aShownStates;
}
+}
+
+void PartSet_Module::updateConstraintsState(const std::string& theFeatureKind)
+{
if (PartSet_SketcherMgr::constraintsIdList().contains(theFeatureKind.c_str())) {
// Show constraints if a constraint was anOperation
mySketchMgr->updateBySketchParameters(PartSet_Tools::Geometrical, true);
{
bool aCustomized = false;
- if (theResult.get())
- return aCustomized;
-
XGUI_Workshop* aWorkshop = getWorkshop();
XGUI_Displayer* aDisplayer = aWorkshop->displayer();
ObjectPtr anObject = aDisplayer->getObject(thePrs);
- if (anObject.get()) {
+ if (!anObject)
+ return aCustomized;
+
+ if (!theResult.get()) {
bool isConflicting = myOverconstraintListener->isConflictingObject(anObject);
// customize sketch symbol presentation
if (thePrs.get()) {
aPrs->SetConflictingConstraint(isConflicting, aColor);
aCustomized = true;
}
+ } else if (!Handle(SketcherPrs_Coincident)::DownCast(anAISIO).IsNull()) {
+ Handle(SketcherPrs_Coincident) aPrs = Handle(SketcherPrs_Coincident)::DownCast(anAISIO);
+ if (!aPrs.IsNull()) {
+ std::vector<int> aColor;
+ myOverconstraintListener->getConflictingColor(aColor);
+ aPrs->SetConflictingConstraint(isConflicting, aColor);
+ aCustomized = true;
+ }
}
}
}
aCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
}
}
-
- // customize dimentional constrains
- sketchMgr()->customizePresentation(anObject);
}
+ // customize dimentional constrains
+ sketchMgr()->customizePresentation(anObject);
return aCustomized;
}