From: vsv Date: Mon, 23 Nov 2015 16:00:44 +0000 (+0300) Subject: Create icons dependent on a shape of bodies result type X-Git-Tag: V_2.1.0~238 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e138647d5a0c06ba7c16d441cba0af3fa14ddac0;p=modules%2Fshaper.git Create icons dependent on a shape of bodies result type --- diff --git a/src/ModuleBase/ModuleBase_IconFactory.cpp b/src/ModuleBase/ModuleBase_IconFactory.cpp index f87fa91f3..ed2719816 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.cpp +++ b/src/ModuleBase/ModuleBase_IconFactory.cpp @@ -10,6 +10,11 @@ ModuleBase_IconFactory* MYIconFactory = 0; +ModuleBase_IconFactory::ModuleBase_IconFactory() +{ + setFactory(this); +} + void ModuleBase_IconFactory::setFactory(ModuleBase_IconFactory* theFactory) { if (MYIconFactory) diff --git a/src/ModuleBase/ModuleBase_IconFactory.h b/src/ModuleBase/ModuleBase_IconFactory.h index 3a7c99d4e..1fda9b43b 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.h +++ b/src/ModuleBase/ModuleBase_IconFactory.h @@ -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); diff --git a/src/PartSet/PartSet_IconFactory.cpp b/src/PartSet/PartSet_IconFactory.cpp index 30fe5aa4b..3926597d2 100644 --- a/src/PartSet/PartSet_IconFactory.cpp +++ b/src/PartSet/PartSet_IconFactory.cpp @@ -19,7 +19,6 @@ QMap 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(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(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; diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index acd74cb15..417a6a0c8 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -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, diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index 192bb1c7e..9e6925a41 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -45,5 +45,13 @@ pictures/wireframe.png pictures/expression.png pictures/arrow.png + + pictures/solid.png + pictures/compsolid.png + pictures/compoundofsolids.png + pictures/edge.png + pictures/vertex.png + pictures/face.png + pictures/compound.png diff --git a/src/XGUI/pictures/compound.png b/src/XGUI/pictures/compound.png new file mode 100644 index 000000000..0ad7728bf 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 index 000000000..b30242c08 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 index 000000000..6a1657089 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 index 000000000..497061286 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 index 000000000..6abc697c0 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 index 000000000..dbffe4c07 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 index 000000000..6795c4c4e Binary files /dev/null and b/src/XGUI/pictures/vertex.png differ