From: nds Date: Thu, 12 Mar 2015 08:35:34 +0000 (+0300) Subject: Constuction sketch entity attribute. X-Git-Tag: V_1.1.0~140^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2e9c8b6bbbc29447cd5c68e9ca9f341d022bdd1b;p=modules%2Fshaper.git Constuction sketch entity attribute. Rename the construction flag in the auxiliary --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index abc1378b5..08191e8d3 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -300,11 +300,11 @@ void PartSet_Module::addViewerItems(QMenu* theMenu) const theMenu->addAction(anAction); } } - bool isConstruction; - if (mySketchMgr->canChangeConstruction(isConstruction)) { - QAction* anAction = action("CONSTRUCTION_CMD"); + bool isAuxiliary; + if (mySketchMgr->canSetAuxiliary(isAuxiliary)) { + QAction* anAction = action("AUXILIARY_CMD"); theMenu->addAction(anAction); - anAction->setChecked(isConstruction); + anAction->setChecked(isAuxiliary); } } @@ -488,9 +488,9 @@ void PartSet_Module::createActions() { QAction* anAction; - anAction = new QAction(tr("Construction"), this); + anAction = new QAction(tr("Auxiliary"), this); anAction->setCheckable(true); - addAction("CONSTRUCTION_CMD", anAction); + addAction("AUXILIARY_CMD", anAction); } QAction* PartSet_Module::action(const QString& theId) const @@ -514,8 +514,8 @@ void PartSet_Module::onAction(bool isChecked) QAction* aAction = static_cast(sender()); QString anId = aAction->data().toString(); - if (anId == "CONSTRUCTION_CMD") { - mySketchMgr->setConstruction(isChecked); + if (anId == "AUXILIARY_CMD") { + mySketchMgr->setAuxiliary(isChecked); } } diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 178cf792f..d7cca143c 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -751,7 +751,7 @@ bool PartSet_SketcherMgr::canDisplayObject() const return aCanDisplay; } -bool PartSet_SketcherMgr::canChangeConstruction(bool& isConstruction) const +bool PartSet_SketcherMgr::canSetAuxiliary(bool& theValue) const { bool anEnabled = false; ModuleBase_Operation* anOperation = getCurrentOperation(); @@ -762,7 +762,7 @@ bool PartSet_SketcherMgr::canChangeConstruction(bool& isConstruction) const 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()); @@ -770,35 +770,35 @@ bool PartSet_SketcherMgr::canChangeConstruction(bool& isConstruction) const else { if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) anOperation->abort(); - // 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(); } 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 aSketchFeature = std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get() != NULL) { - std::string anAttribute = SketchPlugin_SketchEntity::CONSTRUCTION_ID(); + std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); - std::shared_ptr aConstructionAttr = + std::shared_ptr anAuxiliaryAttr = std::dynamic_pointer_cast(aSketchFeature->data()->attribute(anAttribute)); - isNotConstructedFound = !aConstructionAttr->value(); + 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(); @@ -809,19 +809,19 @@ void PartSet_SketcherMgr::setConstruction(const bool isChecked) 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)) @@ -838,11 +838,11 @@ void PartSet_SketcherMgr::setConstruction(const bool isChecked) std::shared_ptr aSketchFeature = std::dynamic_pointer_cast(aFeature); if (aSketchFeature.get() != NULL) { - std::string anAttribute = SketchPlugin_SketchEntity::CONSTRUCTION_ID(); + std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); - std::shared_ptr aConstructionAttr = + std::shared_ptr anAuxiliaryAttr = std::dynamic_pointer_cast(aSketchFeature->data()->attribute(anAttribute)); - aConstructionAttr->setValue(isChecked); + anAuxiliaryAttr->setValue(isChecked); } } } diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 36f91db2d..c5f7effe1 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -138,13 +138,13 @@ public: bool canDisplayObject() const; /// Returns true if the current operation is sketch entity create operation - /// \param isConstruction the current construction state + /// \param theValue the current auxiliary value /// \return the boolean result - bool canChangeConstruction(bool& isConstruction) const; + bool canSetAuxiliary(bool& theValue) const; /// Changes the sketcher entity construction argument value /// \param isChecked if true, the feature is a construction - void setConstruction(const bool isChecked); + void setAuxiliary(const bool isChecked); public slots: /// Process sketch plane selected event diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 51efb1721..c4188bf90 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -63,8 +63,8 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() Config_PropManager::registerProp("Visualization", "sketch_external_color", "Sketch external entity color", Config_Prop::Color, SKETCH_EXTERNAL_COLOR); - Config_PropManager::registerProp("Visualization", "sketch_construction_color", "Sketch construction color", - Config_Prop::Color, SKETCH_CONSTRUCTION_COLOR); + Config_PropManager::registerProp("Visualization", "sketch_auxiliary_color", "Sketch auxiliary entity color", + Config_Prop::Color, SKETCH_AUXILIARY_COLOR); Config_PropManager::registerProp("Visualization", "sketch_constraint_color", "Sketch constraint color", Config_Prop::Color, SKETCH_CONSTRAINT_COLOR); diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index 58ab7cb98..466024127 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -89,8 +89,8 @@ void SketchPlugin_Sketch::execute() continue; } // do not include the construction entities in the result - if (aFeature->data()->attribute(SketchPlugin_SketchEntity::CONSTRUCTION_ID())) { - if (aFeature->data()->boolean(SketchPlugin_SketchEntity::CONSTRUCTION_ID())->value()) + if (aFeature->data()->attribute(SketchPlugin_SketchEntity::AUXILIARY_ID())) { + if (aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) continue; } diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.cpp b/src/SketchPlugin/SketchPlugin_SketchEntity.cpp index 0737eb899..39cc06a67 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.cpp +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.cpp @@ -13,6 +13,6 @@ SketchPlugin_SketchEntity::SketchPlugin_SketchEntity() void SketchPlugin_SketchEntity::initAttributes() { - data()->addAttribute(CONSTRUCTION_ID(), ModelAPI_AttributeBoolean::type()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CONSTRUCTION_ID()); + data()->addAttribute(AUXILIARY_ID(), ModelAPI_AttributeBoolean::type()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), AUXILIARY_ID()); } diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 489d23345..8f716c79f 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -22,7 +22,7 @@ #define SKETCH_ENTITY_COLOR "#ff0000" #define SKETCH_EXTERNAL_COLOR "#00ff00" -#define SKETCH_CONSTRUCTION_COLOR "#000000" +#define SKETCH_AUXILIARY_COLOR "#000000" /**\class SketchPlugin_SketchEntity * \ingroup Plugins @@ -33,10 +33,10 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC { public: /// Reference to the construction type of the feature - inline static const std::string& CONSTRUCTION_ID() + inline static const std::string& AUXILIARY_ID() { - static const std::string MY_CONSTRUCTION_ID("Construction"); - return MY_CONSTRUCTION_ID; + static const std::string MY_AUXILIARY_ID("Auxiliary"); + return MY_AUXILIARY_ID; } /// Reference to the external edge or vertex as a AttributeSelection @@ -70,12 +70,12 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC // set color from preferences std::vector aColor; - std::shared_ptr aConstructionAttr = - data()->boolean(SketchPlugin_SketchEntity::CONSTRUCTION_ID()); - bool isConstruction = aConstructionAttr.get() != NULL && aConstructionAttr->value(); + std::shared_ptr anAuxiliaryAttr = + data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID()); + bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value(); if (isConstruction) { - aColor = Config_PropManager::color("Visualization", "sketch_construction_color", - SKETCH_CONSTRUCTION_COLOR); + aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color", + SKETCH_AUXILIARY_COLOR); } else if (isExternal()) { aColor = Config_PropManager::color("Visualization", "sketch_external_color", diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 3875aa213..fafdb2fde 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -15,25 +15,25 @@ - + - + - + - +