From: dbv Date: Wed, 22 Jun 2016 14:48:48 +0000 (+0300) Subject: Changed highlight presentation of vertices X-Git-Tag: V_2.4.0~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b0434962195bc456f5bbea9698761d774a14ba87;p=modules%2Fshaper.git Changed highlight presentation of vertices --- diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 9e77f0650..fa47856fa 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -44,6 +44,8 @@ #include #include +#include + #include #include #include @@ -82,6 +84,12 @@ const double DEFAULT_DEVIATION_COEFFICIENT = 1.e-4; #include #endif +#ifdef WIN32 +# define FSEP "\\" +#else +# define FSEP "/" +#endif + namespace ModuleBase_Tools { //****************************************************************** @@ -1159,10 +1167,47 @@ void translate(const std::string& theContext, std::string& theMessage) void setPointBallHighlighting(AIS_Shape* theAIS) { + static Handle(Image_AlienPixMap) aPixMap; + if(aPixMap.IsNull()) { + // Load icon for the presentation + std::string aFile; + char* anEnv = getenv("SHAPER_ROOT_DIR"); + if(anEnv) { + aFile = std::string(anEnv) + + FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; + } else { + anEnv = getenv("OPENPARTS_ROOT_DIR"); + if (anEnv) + aFile = std::string(anEnv) + FSEP + "resources"; + } + + aFile += FSEP; + static const std::string aMarkerName = "marker_dot.png"; + aFile += aMarkerName; + aPixMap = new Image_AlienPixMap(); + if(!aPixMap->Load(aFile.c_str())) { + // The icon for constraint is not found + static const std::string aMsg = "Error: Point market not found by path: \"" + aFile + "\". Falling back."; + //Events_InfoMessage("ModuleBase_Tools::setPointBallHighlighting", aMsg).send(); + } + } + + Handle(Graphic3d_AspectMarker3d) anAspect; Handle(Prs3d_Drawer) aDrawer = theAIS->HilightAttributes(); - if (aDrawer->HasOwnPointAspect()) { + if(aDrawer->HasOwnPointAspect()) { Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect(); - aPntAspect->Aspect()->SetType(Aspect_TOM_BALL); + if(aPixMap->IsEmpty()) { + anAspect = aPntAspect->Aspect(); + anAspect->SetType(Aspect_TOM_BALL); + } else { + if(aPixMap->Format() == Image_PixMap::ImgGray) { + aPixMap->SetFormat (Image_PixMap::ImgAlpha); + } else if(aPixMap->Format() == Image_PixMap::ImgGrayF) { + aPixMap->SetFormat (Image_PixMap::ImgAlphaF); + } + anAspect = new Graphic3d_AspectMarker3d(aPixMap); + aPntAspect->SetAspect(anAspect); + } aDrawer->SetPointAspect(aPntAspect); theAIS->SetHilightAttributes(aDrawer); } diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index 1d7d56c41..2a8561f4a 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -152,3 +152,4 @@ TARGET_LINK_LIBRARIES(XGUI ${PROJECT_LIBRARIES}) INSTALL(TARGETS XGUI DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES}) INSTALL(FILES ${PREFERENCES_XML} DESTINATION ${SHAPER_INSTALL_RESOURCES}) +INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_RESOURCES}) diff --git a/src/XGUI/icons/marker_dot.png b/src/XGUI/icons/marker_dot.png new file mode 100644 index 000000000..23394f25f Binary files /dev/null and b/src/XGUI/icons/marker_dot.png differ