Salome HOME
Issue #2024: Redesign of circle and arc of circle
[modules/shaper.git] / src / PartSet / PartSet_IconFactory.cpp
index 3926597d227bf9c548e0affbfc3cd8920024f290..f6b27be574f981a428b45be7c3ed7d5e75b06b36 100644 (file)
@@ -19,7 +19,7 @@ QMap<QString, QString> PartSet_IconFactory::myIcons;
 
 PartSet_IconFactory::PartSet_IconFactory():ModuleBase_IconFactory()
 {
-  Events_Loop::loop()->registerListener(this, 
+  Events_Loop::loop()->registerListener(this,
     Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT()));
 }
 
@@ -44,7 +44,7 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
     switch(aState) {
       case ModelAPI_StateDone:
       case ModelAPI_StateNothing: {
-        anIcon = QIcon(anIconString);
+        anIcon = loadIcon(anIconString);
       }
       break;
       case ModelAPI_StateMustBeUpdated: {
@@ -60,9 +60,9 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
                                              anIconString);
       }
       break;
-      default: break;  
+      default: break;
     }
-  } 
+  }
 
   if (theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated)
     return QIcon(":pictures/constr_object_modified.png");
@@ -77,29 +77,31 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObj);
   if (aResult.get()) {
     GeomShapePtr aShape = aResult->shape();
-    if (aShape.get()) {
-      if (aShape->isSolid()) 
-        return QIcon(":pictures/solid.png");
-      else if (aShape->isCompound()) 
-        return QIcon(":pictures/compound.png");
-      else if (aShape->isCompoundOfSolids()) 
-        return QIcon(":pictures/compoundofsolids.png");
-      else if (aShape->isCompSolid()) 
-        return QIcon(":pictures/compsolid.png");
-      else if (aShape->isEdge()) 
-        return QIcon(":pictures/edge.png");
-      else if (aShape->isFace()) 
-        return QIcon(":pictures/face.png");
-      else if (aShape->isVertex()) 
-        return QIcon(":pictures/vertex.png");
+    if(aShape.get()) {
+      switch(aShape->shapeType()) {
+        case GeomAPI_Shape::COMPOUND: {
+          ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
+          if (aBody.get() && aBody->isConnectedTopology())
+            return QIcon(":pictures/compoundofsolids.png");
+          return QIcon(":pictures/compound.png");
+        }
+        case GeomAPI_Shape::COMPSOLID: return QIcon(":pictures/compsolid.png");
+        case GeomAPI_Shape::SOLID:     return QIcon(":pictures/solid.png");
+        case GeomAPI_Shape::SHELL:     return QIcon(":pictures/shell.png");
+        case GeomAPI_Shape::FACE:      return QIcon(":pictures/face.png");
+        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");
+      }
     }
   }
-  return anIcon;  
+  return anIcon;
 }
 
 void PartSet_IconFactory::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
-  if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
+  if (theMessage->eventID() ==
+      Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
     std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
        std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
     if (!aFeatureMsg->isInternal()) {