]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Constuction sketch entity attribute.
authornds <natalia.donis@opencascade.com>
Thu, 12 Mar 2015 08:35:34 +0000 (11:35 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 12 Mar 2015 08:35:34 +0000 (11:35 +0300)
Rename the construction flag in the auxiliary

src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_SketchEntity.cpp
src/SketchPlugin/SketchPlugin_SketchEntity.h
src/SketchPlugin/plugin-Sketch.xml

index abc1378b5926ce1adb66a4a39f26ec53c01db59c..08191e8d311d101e083164a93a15ba36b4b1b420 100644 (file)
@@ -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<QAction*>(sender());
   QString anId = aAction->data().toString();
 
-  if (anId == "CONSTRUCTION_CMD") {
-    mySketchMgr->setConstruction(isChecked);
+  if (anId == "AUXILIARY_CMD") {
+    mySketchMgr->setAuxiliary(isChecked);
   }
 }
 
index 178cf792fcbcf2acd4b9805370480fafe133608e..d7cca143c85305d19b213d281217faf11a64b862 100644 (file)
@@ -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<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();
+          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<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);
+          anAuxiliaryAttr->setValue(isChecked);
         }
       }
     }
index 36f91db2d6d382d54a2a3e34d7b0ec59623b27a5..c5f7effe100641a20f6e164cf34eac5720d1fb65 100644 (file)
@@ -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
index 51efb17215a0bd15bdaea25619cddf3b4712f2bd..c4188bf90564bb80a3f32ed8c6d0bc8c29c4730e 100644 (file)
@@ -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);
index 58ab7cb98af9708399f88d172a257094dd8a7839..466024127b2af00ea9d0a95bf4ad70db9b187f26 100644 (file)
@@ -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;
       }
 
index 0737eb899b8f4c756a443b3d154ee0a4fa002476..39cc06a67d08c52d0ee42838df99aab293bd1e0c 100644 (file)
@@ -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());
 }
index 489d233455a26c77aa803488d1d79d933faff6bb..8f716c79f1de1427c742db9c61afbc18f7b67255 100644 (file)
@@ -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<int> aColor;
-    std::shared_ptr<ModelAPI_AttributeBoolean> aConstructionAttr =
-                                    data()->boolean(SketchPlugin_SketchEntity::CONSTRUCTION_ID());
-    bool isConstruction = aConstructionAttr.get() != NULL && aConstructionAttr->value();
+    std::shared_ptr<ModelAPI_AttributeBoolean> 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",
index 3875aa213b0b802f92030f0f09dc56edcacb113e..fafdb2fdee5fbccaa8e73368da9e5f73b894118b 100644 (file)
       </feature>
       <feature id="SketchPoint" title="Point" tooltip="Create a new point" icon=":icons/point.png">
         <sketch-2dpoint_selector id="PointCoordindates" title="Point" tooltip="Point coordinates"/>
-        <boolvalue id="Construction" label="Construction" default="false" tooltip="Construction element" obligatory="0"/>
+        <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
       </feature>
       <feature id="SketchLine" title="Line" tooltip="Create a new line" icon=":icons/line.png">
         <sketch-2dpoint_selector id="StartPoint" title="Start point" tooltip="Start point coordinates" previous_feature_param="EndPoint"/>
         <sketch-2dpoint_selector id="EndPoint" title="End point" tooltip="End point coordinates"/>
-        <boolvalue id="Construction" label="Construction" default="false" tooltip="Construction element" obligatory="0"/>
+        <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
       </feature>
       <feature id="SketchCircle" title="Circle" tooltip="Create a new circle" icon=":icons/circle.png">
         <sketch-2dpoint_selector id="CircleCenter" title="Center" tooltip="Center coordinates"/>
         <point2ddistance id="CircleRadius" first_point="CircleCenter" label="Radius:" min="0" step="1.0" default="0" icon=":icons/radius.png" tooltip="Set radius">
           <validator id="GeomValidators_Positive"/>
         </point2ddistance>
-        <boolvalue id="Construction" label="Construction" default="false" tooltip="Construction element" obligatory="0"/>
+        <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
       </feature>
       <feature id="SketchArc" title="Arc" tooltip="Create a new arc" icon=":icons/arc.png">
         <sketch-2dpoint_selector id="ArcCenter" title="Center" tooltip="Center of a circle"/>
         <sketch-2dpoint_selector id="ArcStartPoint" title="Start point" tooltip="Start point"/>
         <sketch-2dpoint_selector id="ArcEndPoint" title="End point" tooltip="End point"/>
-        <boolvalue id="Construction" label="Construction" default="false" tooltip="Construction element" obligatory="0"/>
+        <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
       </feature>
     </group>