]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Changed highlight presentation of vertices
authordbv <dbv@opencascade.com>
Wed, 22 Jun 2016 14:48:48 +0000 (17:48 +0300)
committerdbv <dbv@opencascade.com>
Wed, 22 Jun 2016 14:57:44 +0000 (17:57 +0300)
src/ModuleBase/ModuleBase_Tools.cpp
src/XGUI/CMakeLists.txt
src/XGUI/icons/marker_dot.png [new file with mode: 0644]

index 9e77f06503b7250a8814eb7689c8dd9483b46c0e..fa47856fa7d23b918cebf5092e1402ded7935f4f 100755 (executable)
@@ -44,6 +44,8 @@
 #include <Prs3d_PointAspect.hxx>
 #include <Graphic3d_AspectMarker3d.hxx>
 
+#include <Image_AlienPixMap.hxx>
+
 #include <QWidget>
 #include <QLayout>
 #include <QPainter>
@@ -82,6 +84,12 @@ const double DEFAULT_DEVIATION_COEFFICIENT = 1.e-4;
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
 #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);
   }
index 1d7d56c4167b442d66c14607ec37fda333ba7bdb..2a8561f4a3d597f128b5fcf257224105e1dcd39d 100644 (file)
@@ -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 (file)
index 0000000..23394f2
Binary files /dev/null and b/src/XGUI/icons/marker_dot.png differ