#include <SketchPlugin_ConstraintPerpendicular.h>
#include <SketchPlugin_ConstraintRadius.h>
#include <SketchPlugin_ConstraintRigid.h>
+#include <SketchPlugin_ConstraintHorizontal.h>
+#include <SketchPlugin_ConstraintVertical.h>
+#include <SketchPlugin_ConstraintEqual.h>
+#include <SketchPlugin_ConstraintTangent.h>
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <StdSelect_BRepOwner.hxx>
{
if (!isNestedCreateOperation(getCurrentOperation()))
return;
+ // the method should be performed if the popup menu is called,
+ // the reset of the current widget should not happen
+ if (myIsPopupMenuActive)
+ return;
myIsMouseOverViewProcessed = false;
myIsMouseOverWindow = false;
aIds << SketchPlugin_ConstraintRadius::ID().c_str();
aIds << SketchPlugin_ConstraintPerpendicular::ID().c_str();
aIds << SketchPlugin_ConstraintParallel::ID().c_str();
+ aIds << SketchPlugin_ConstraintHorizontal::ID().c_str();
+ aIds << SketchPlugin_ConstraintVertical::ID().c_str();
+ aIds << SketchPlugin_ConstraintEqual::ID().c_str();
+ aIds << SketchPlugin_ConstraintTangent::ID().c_str();
}
return aIds;
}
return aCanDisplay;
}
-bool PartSet_SketcherMgr::canChangeConstruction(bool& isConstruction) const
+bool PartSet_SketcherMgr::canSetAuxiliary(bool& theValue) const
{
bool anEnabled = false;
ModuleBase_Operation* anOperation = getCurrentOperation();
return anEnabled;
QObjectPtrList anObjects;
- // 1. change construction type of a created feature
+ // 1. change auxiliary type of a created feature
if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation) &&
PartSet_SketcherMgr::isEntityOperation(anOperation) ) {
anObjects.append(anOperation->feature());
}
else {
- if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
- anOperation->abort();
- // 2. change construction type of selected sketch entities
+ /// 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))
+ /// anOperation->abort();
+ // 2. change auxiliary type of selected sketch entities
ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
anObjects = aSelection->selectedPresentations();
}
anEnabled = anObjects.size() > 0;
- bool isNotConstructedFound = false;
+ bool isNotAuxiliaryFound = false;
if (anObjects.size() > 0) {
QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
- for (; anIt != aLast && !isNotConstructedFound; anIt++) {
+ for (; anIt != aLast && !isNotAuxiliaryFound; anIt++) {
FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
if (aFeature.get() != NULL) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFeature.get() != NULL) {
- std::string anAttribute = SketchPlugin_SketchEntity::CONSTRUCTION_ID();
+ std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
- std::shared_ptr<ModelAPI_AttributeBoolean> aConstructionAttr =
+ std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
- isNotConstructedFound = !aConstructionAttr->value();
+ if (anAuxiliaryAttr)
+ isNotAuxiliaryFound = !anAuxiliaryAttr->value();
}
}
}
}
- isConstruction = anObjects.size() && !isNotConstructedFound;
+ theValue = anObjects.size() && !isNotAuxiliaryFound;
return anEnabled;
}
-void PartSet_SketcherMgr::setConstruction(const bool isChecked)
+void PartSet_SketcherMgr::setAuxiliary(const bool isChecked)
{
ModuleBase_Operation* anOperation = getCurrentOperation();
QObjectPtrList anObjects;
bool isUseTransaction = false;
- // 1. change construction type of a created feature
+ // 1. change auxiliary type of a created feature
if (PartSet_SketcherMgr::isNestedCreateOperation(anOperation) &&
PartSet_SketcherMgr::isEntityOperation(anOperation) ) {
anObjects.append(anOperation->feature());
}
else {
isUseTransaction = true;
- // 2. change construction type of selected sketch entities
+ // 2. change auxiliary type of selected sketch entities
ModuleBase_ISelection* aSelection = myModule->workshop()->selection();
anObjects = aSelection->selectedPresentations();
}
- QAction* anAction = myModule->action("CONSTRUCTION_CMD");
+ QAction* anAction = myModule->action("AUXILIARY_CMD");
SessionPtr aMgr = ModelAPI_Session::get();
if (isUseTransaction) {
if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFeature.get() != NULL) {
- std::string anAttribute = SketchPlugin_SketchEntity::CONSTRUCTION_ID();
+ std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
- std::shared_ptr<ModelAPI_AttributeBoolean> aConstructionAttr =
+ std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
- aConstructionAttr->setValue(isChecked);
+ if (anAuxiliaryAttr)
+ anAuxiliaryAttr->setValue(isChecked);
}
}
}