Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_IconFactory.cpp
index 2b811848733c1bbe2b93af5829b7aa8ef43762e4..45ccd129cdb57088651337b193b76d5f02c45af6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -28,6 +28,7 @@
 #include <ModuleBase_ActionInfo.h>
 #include <ModuleBase_Tools.h>
 
+#include <ModelAPI_ResultGroup.h>
 #include <ModelAPI_ResultPart.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_ResultBody.h>
@@ -35,8 +36,6 @@
 #include <Config_FeatureMessage.h>
 #include <Events_Loop.h>
 
-#include <CollectionPlugin_Group.h>
-
 QMap<QString, QString> PartSet_IconFactory::myIcons;
 
 PartSet_IconFactory::PartSet_IconFactory(PartSet_Module* theModule)
@@ -128,8 +127,7 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
     if(aShape.get()) {
       switch(aShape->shapeType()) {
         case GeomAPI_Shape::COMPOUND: {
-          FeaturePtr aFeature = ModelAPI_Feature::feature(theObj);
-          if (aFeature.get() && aFeature->getKind() == CollectionPlugin_Group::ID()) {
+          if (aResult->groupName() == ModelAPI_ResultGroup::group()) {
             switch (aShape->typeOfCompoundShapes()) {
             case GeomAPI_Shape::VERTEX:
               return QIcon(":icons/group_vertex.png");
@@ -139,6 +137,8 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
               return QIcon(":icons/group_face.png");
             case GeomAPI_Shape::SOLID:
               return QIcon(":icons/group_solid.png");
+            default: // [to avoid compilation warning]
+              break;
             }
           }
           ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
@@ -153,6 +153,8 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
         case GeomAPI_Shape::WIRE:      return QIcon(":pictures/wire.png");
         case GeomAPI_Shape::EDGE:      return QIcon(":pictures/edge.png");
         case GeomAPI_Shape::VERTEX:    return QIcon(":pictures/vertex.png");
+        default: // [to avoid compilation warning]
+          break;
       }
     }
   }
@@ -165,11 +167,9 @@ void PartSet_IconFactory::processEvent(const std::shared_ptr<Events_Message>& th
       Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
     std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
        std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
-    if (!aFeatureMsg->isInternal()) {
-      ActionInfo aFeatureInfo;
-      aFeatureInfo.initFrom(aFeatureMsg);
-      // Remember features icons
-      myIcons[QString::fromStdString(aFeatureMsg->id())] = aFeatureInfo.iconFile;
-    }
+    ActionInfo aFeatureInfo;
+    aFeatureInfo.initFrom(aFeatureMsg);
+    // Remember features icons
+    myIcons[QString::fromStdString(aFeatureMsg->id())] = aFeatureInfo.iconFile;
   }
 }
\ No newline at end of file