#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 <XGUI_DataModel.h>
#include <XGUI_ErrorMgr.h>
#include <XGUI_CustomPrs.h>
+#include <XGUI_SelectionMgr.h>
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Sketch.h>
#include <SketchPlugin_ConstraintRadius.h>
#include <SketcherPrs_SymbolPrs.h>
+#include <SketcherPrs_Coincident.h>
#include <SketcherPrs_Tools.h>
#include <Events_Loop.h>
mySelectionFilters.Append(new PartSet_GlobalFilter(myWorkshop));
mySelectionFilters.Append(new PartSet_FilterInfinite(myWorkshop));
- myHasConstraintShown[PartSet_Tools::Geometrical] = true;
- myHasConstraintShown[PartSet_Tools::Dimensional] = true;
- myHasConstraintShown[PartSet_Tools::Expressions] = false;
+ setDefaultConstraintShown();
Config_PropManager::registerProp("Visualization", "operation_parameter_color",
"Reference shape wireframe color in operation", Config_Prop::Color,
// 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 (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
mySketchMgr->stopNestedSketch(theOperation);
}
+ else if (PartSet_SketcherMgr::isSketchOperation(theOperation))
+ setDefaultConstraintShown();
//VSV: Viewer is updated on feature update and redisplay
if (isModified) {
QMap<PartSet_Tools::ConstraintVisibleState, bool>::const_iterator anIt = myHasConstraintShown.begin(),
aLast = myHasConstraintShown.end();
for (; anIt != aLast; anIt++) {
- myHasConstraintShown[anIt.key()];
mySketchMgr->updateBySketchParameters(anIt.key(), anIt.value());
}
}
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;
}
}
return mySketchMgr->canDisplayObject(theObject);
}
-void PartSet_Module::processHiddenObject(const std::list<ObjectPtr>& theObjects)
+/*void PartSet_Module::processHiddenObject(const std::list<ObjectPtr>& theObjects)
{
mySketchMgr->processHiddenObject(theObjects);
-}
+}*/
bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const
{
return aCanActivate;
}
-bool PartSet_Module::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
+bool PartSet_Module::addViewerMenu(const QMap<QString, QAction*>& theStdActions,
+ QWidget* theParent,
+ QMap<int, QAction*>& theMenuActions) const
{
- return myMenuMgr->addViewerMenu(theMenu, theStdActions);
+ return myMenuMgr->addViewerMenu(theStdActions, theParent, theMenuActions);
}
void PartSet_Module::updateViewerMenu(const QMap<QString, QAction*>& theStdActions)
PartSet_SketcherMgr::sketchSelectionModes(theModes);
}
+void PartSet_Module::customSubShapesSelectionModes(QIntList& theTypes)
+{
+ if (theTypes.contains(TopAbs_FACE))
+ theTypes.append(SketcherPrs_Tools::Sel_Sketch_Face);
+ if (theTypes.contains(TopAbs_WIRE))
+ theTypes.append(SketcherPrs_Tools::Sel_Sketch_Wire);
+}
+
bool PartSet_Module::isMouseOverWindow()
{
return mySketchMgr->isMouseOverWindow();
anOpMgr->startOperation(anOpAction);
+ // WORKAROUND, should be done to avoid viewer highlight update after deletetion of objects
+ // the problem is in AIS Dimensions recompute if a line and the dim are removed, line is the first
+ // it causes the AIS recompute, where the base line is null, the result is empty AIS in the viewer
+ XGUI_Tools::workshop(myWorkshop)->selector()->clearSelection();
+
// 4. delete features
// sketch feature should be skipped, only sub-features can be removed
// when sketch operation is active
void PartSet_Module::onFeatureTriggered()
{
- QAction* aCmd = dynamic_cast<QAction*>(sender());
+ // is commented for imp: Unpressing the button of the current action must behave like
+ // a validation if the entity can be created (instead of Cancel, as currently)
+ /*QAction* aCmd = dynamic_cast<QAction*>(sender());
if (aCmd->isCheckable() && aCmd->isChecked()) {
// 1. check whether the delete should be processed in the module
ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
launchOperation(aCmd->data().toString());
}
}
- }
+ }*/
ModuleBase_IModule::onFeatureTriggered();
}
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;
+ }
}
}
}
if (aColor.empty())
XGUI_CustomPrs::getDefaultColor(anObject, true, aColor);
if (!aColor.empty()) {
- thePrs->setColor(aColor[0], aColor[1], aColor[2]);
- 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;
}
bool hasResult = false;
bool hasFeature = false;
bool hasParameter = false;
- bool hasSubFeature = false;
- ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
-
+ bool hasCompositeOwner = false;
+ ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
+ hasCompositeOwner);
ObjectPtr aObject = aObjects.first();
if (aObject) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
if (!aOperation)
return;
ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
- aPanel->setWindowTitle(aChoiceTitle);
+ if (aPanel)
+ aPanel->setWindowTitle(aChoiceTitle);
}
}
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
return aConnector->workshop();
}
+
+//******************************************************
+void PartSet_Module::setDefaultConstraintShown()
+{
+ myHasConstraintShown[PartSet_Tools::Geometrical] = true;
+ myHasConstraintShown[PartSet_Tools::Dimensional] = true;
+ myHasConstraintShown[PartSet_Tools::Expressions] = false;
+}