From e138647d5a0c06ba7c16d441cba0af3fa14ddac0 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 23 Nov 2015 19:00:44 +0300 Subject: [PATCH] Create icons dependent on a shape of bodies result type --- src/ModuleBase/ModuleBase_IconFactory.cpp | 5 +++ src/ModuleBase/ModuleBase_IconFactory.h | 2 + src/PartSet/PartSet_IconFactory.cpp | 42 ++++++++++++++---- .../SketcherPrs_SensitivePoint.cpp | 2 +- src/XGUI/XGUI_pictures.qrc | 8 ++++ src/XGUI/pictures/compound.png | Bin 0 -> 512 bytes src/XGUI/pictures/compoundofsolids.png | Bin 0 -> 314 bytes src/XGUI/pictures/compsolid.png | Bin 0 -> 399 bytes src/XGUI/pictures/edge.png | Bin 0 -> 284 bytes src/XGUI/pictures/face.png | Bin 0 -> 469 bytes src/XGUI/pictures/solid.png | Bin 0 -> 376 bytes src/XGUI/pictures/vertex.png | Bin 0 -> 533 bytes 12 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 src/XGUI/pictures/compound.png create mode 100644 src/XGUI/pictures/compoundofsolids.png create mode 100644 src/XGUI/pictures/compsolid.png create mode 100644 src/XGUI/pictures/edge.png create mode 100644 src/XGUI/pictures/face.png create mode 100644 src/XGUI/pictures/solid.png create mode 100644 src/XGUI/pictures/vertex.png 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 0000000000000000000000000000000000000000..0ad7728bf2d757e9ffe465f76f1a8f64b427b6bd GIT binary patch literal 512 zcmV+b0{{JqP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;js(W8VM(0dYx0K~y+TWBC97KS7KaVAFt(VL;T`{~Qo+ z6LStIg$gk+Cu%jW7%XK#gZaUH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HFS2|mTz=Z1Ry(Ko0aM!{-RtxJ->>@1I_pOF|6?C5 z=d0XpzU(-yc~0HBl5?;2-_F~^qRpmxqvormL_W)|jK@#a|6h-<`cwb+sQdrxu@yh; z_toCwPl(8EuAIyGV#;NQ%XN$&{Wbe1$X}9EyuZ}edH>0ZwmMd}2kDXPH~4S5_fY=H z9_4$?vA@JR@)=@vIm{W3DTpVFs<0wqx&P_FKxfEKkgM`j28KF=r>mdKI;Vst03o@) A*#H0l literal 0 HcmV?d00001 diff --git a/src/XGUI/pictures/solid.png b/src/XGUI/pictures/solid.png new file mode 100644 index 0000000000000000000000000000000000000000..dbffe4c0773b0b06a09f6afa03b941f4b39719a2 GIT binary patch literal 376 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=fts&@Fyn;$$~izmi4xa{lHmNblJdl&REC1Y%)Ao4ywnl}6Fmbx zvp+q__kn6&db&7{9C5il^kn)6sf&Gf7hok@4wAn-*L!+d0%r*o{_&^g-Q1PpZ68cMz6E| zzx(O0?)}jVD{l8rPw2VK5c&SY{RYEI&ua3 zN%Q*y{R2PPRKpd{IX`gm;qhUwpYmt%?#5ZJ2WB}kM6)TfCX1@b{ZD6L=*d6%f62ZO R1)!%HJYD@<);T3K0RYG(mBj!6 literal 0 HcmV?d00001 diff --git a/src/XGUI/pictures/vertex.png b/src/XGUI/pictures/vertex.png new file mode 100644 index 0000000000000000000000000000000000000000..6795c4c4e9ee5d36fe27906feef43543e4891f65 GIT binary patch literal 533 zcmV+w0_y#VP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGh)&Kwv)&Y=jd7Ji@pZ+&8Jur+DCUXYM`c-1|loK@h}Z9%gc5 zg$0Q5BbNy<*+?Et>?hb}rq(P%+;ZY?M9-dK(1pP|ws_#eFF9Eh zAe@2l>BNs%+itRn&F;xW>Y>e!9%A;-2%V80b=~=0u|>V&J7ZO Xgy1f#Y`A!I00000NkvXXu0mjfI?d^} literal 0 HcmV?d00001 -- 2.30.2