Salome HOME
Create icons dependent on a shape of bodies result type
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 23 Nov 2015 16:00:44 +0000 (19:00 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 23 Nov 2015 16:00:44 +0000 (19:00 +0300)
12 files changed:
src/ModuleBase/ModuleBase_IconFactory.cpp
src/ModuleBase/ModuleBase_IconFactory.h
src/PartSet/PartSet_IconFactory.cpp
src/SketcherPrs/SketcherPrs_SensitivePoint.cpp
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/compound.png [new file with mode: 0644]
src/XGUI/pictures/compoundofsolids.png [new file with mode: 0644]
src/XGUI/pictures/compsolid.png [new file with mode: 0644]
src/XGUI/pictures/edge.png [new file with mode: 0644]
src/XGUI/pictures/face.png [new file with mode: 0644]
src/XGUI/pictures/solid.png [new file with mode: 0644]
src/XGUI/pictures/vertex.png [new file with mode: 0644]

index f87fa91f3c0b65b0b147056e0bbd633b06564901..ed2719816e245dba947607a30edce4ed24e98c57 100644 (file)
 ModuleBase_IconFactory* MYIconFactory = 0;
 
 
+ModuleBase_IconFactory::ModuleBase_IconFactory()
+{
+  setFactory(this);
+}
+
 void ModuleBase_IconFactory::setFactory(ModuleBase_IconFactory* theFactory)
 {
   if (MYIconFactory)
index 3a7c99d4eaa7d9ac070edcb37aa559574b11dd00..1fda9b43b44ef773455b874404ce4be3d6f24cc5 100644 (file)
@@ -26,6 +26,8 @@ public:
   virtual QIcon getIcon(ObjectPtr theObj);
 
 protected:
+  ModuleBase_IconFactory();
+
   /// Set the current icons factory instance
   /// \param theFactory a new factory
   static void setFactory(ModuleBase_IconFactory* theFactory);
index 30fe5aa4b718a655791f955bfa6e2d6cd2db9f76..3926597d227bf9c548e0affbfc3cd8920024f290 100644 (file)
@@ -19,7 +19,6 @@ QMap<QString, QString> PartSet_IconFactory::myIcons;
 
 PartSet_IconFactory::PartSet_IconFactory():ModuleBase_IconFactory()
 {
-  setFactory(this);
   Events_Loop::loop()->registerListener(this, 
     Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT()));
 }
@@ -29,6 +28,9 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
 {
   QIcon anIcon;
 
+  if (!theObj.get())
+    return anIcon;
+
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
   if (aFeature.get()) {
     std::string aKind = aFeature->getKind();
@@ -60,14 +62,36 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj)
       break;
       default: break;  
     }
-  } else {
-    std::string aGroup = theObj->groupName();
-    if (aGroup == ModelAPI_ResultPart::group()) {
-      return QIcon(":pictures/part_ico.png");
-    } else {
-      if (theObj && theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated)
-        return QIcon(":pictures/constr_object_modified.png");
-      return QIcon(":pictures/constr_object.png");
+  } 
+
+  if (theObj->data() && theObj->data()->execState() == ModelAPI_StateMustBeUpdated)
+    return QIcon(":pictures/constr_object_modified.png");
+
+  std::string aGroup = theObj->groupName();
+  if (aGroup == ModelAPI_ResultPart::group())
+    return QIcon(":pictures/part_ico.png");
+
+  if (aGroup == ModelAPI_ResultConstruction::group())
+    return QIcon(":pictures/constr_object.png");
+
+  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");
     }
   }
   return anIcon;  
index acd74cb158bdf90deabdb73b721ac7532978bdbd..417a6a0c8b1ab21a68d2fda0b59b17695c5619c1 100644 (file)
@@ -19,7 +19,7 @@ SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics
                                                        int theId)
 :Select3D_SensitiveEntity(anOwner), myId(theId)
 {
-  SetSensitivityFactor(12.);
+  SetSensitivityFactor(12);
 }
 
 Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr,
index 192bb1c7e947f1d1b2b6532d4b85f13433c39b2d..9e6925a41e9ddf5db30cbb4f5fa692799c01cd3a 100644 (file)
      <file>pictures/wireframe.png</file>
      <file>pictures/expression.png</file>
      <file>pictures/arrow.png</file>
+   
+     <file>pictures/solid.png</file>
+     <file>pictures/compsolid.png</file>
+     <file>pictures/compoundofsolids.png</file>
+     <file>pictures/edge.png</file>
+     <file>pictures/vertex.png</file>
+     <file>pictures/face.png</file>
+     <file>pictures/compound.png</file>
  </qresource>
  </RCC>
diff --git a/src/XGUI/pictures/compound.png b/src/XGUI/pictures/compound.png
new file mode 100644 (file)
index 0000000..0ad7728
Binary files /dev/null and b/src/XGUI/pictures/compound.png differ
diff --git a/src/XGUI/pictures/compoundofsolids.png b/src/XGUI/pictures/compoundofsolids.png
new file mode 100644 (file)
index 0000000..b30242c
Binary files /dev/null and b/src/XGUI/pictures/compoundofsolids.png differ
diff --git a/src/XGUI/pictures/compsolid.png b/src/XGUI/pictures/compsolid.png
new file mode 100644 (file)
index 0000000..6a16570
Binary files /dev/null and b/src/XGUI/pictures/compsolid.png differ
diff --git a/src/XGUI/pictures/edge.png b/src/XGUI/pictures/edge.png
new file mode 100644 (file)
index 0000000..4970612
Binary files /dev/null and b/src/XGUI/pictures/edge.png differ
diff --git a/src/XGUI/pictures/face.png b/src/XGUI/pictures/face.png
new file mode 100644 (file)
index 0000000..6abc697
Binary files /dev/null and b/src/XGUI/pictures/face.png differ
diff --git a/src/XGUI/pictures/solid.png b/src/XGUI/pictures/solid.png
new file mode 100644 (file)
index 0000000..dbffe4c
Binary files /dev/null and b/src/XGUI/pictures/solid.png differ
diff --git a/src/XGUI/pictures/vertex.png b/src/XGUI/pictures/vertex.png
new file mode 100644 (file)
index 0000000..6795c4c
Binary files /dev/null and b/src/XGUI/pictures/vertex.png differ