]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0023580: [EDF] AsterStudy: more distinct display of selected items in 3D view V8_5_asterstudy
authorvsr <vsr@opencascade.com>
Tue, 11 Sep 2018 11:51:38 +0000 (14:51 +0300)
committervsr <vsr@opencascade.com>
Tue, 11 Sep 2018 11:51:38 +0000 (14:51 +0300)
12 files changed:
resources/SalomeApp.xml.in
src/OBJECT/CMakeLists.txt
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_ActorProps.cxx [new file with mode: 0644]
src/OBJECT/SMESH_ActorProps.h [new file with mode: 0644]
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
src/SMESHGUI/SMESH_msg_en.ts
src/SMESHGUI/SMESH_msg_fr.ts
src/SMESHGUI/SMESH_msg_ja.ts

index 9c1b51daf8971d7fcfd25f99b4b9ad9c12713f8e..a9ffc18cbaae53a51c7a23398d9f5b76e71c8631 100644 (file)
     <parameter name="parametric_precision"         value="-6"  />
     <parameter name="area_precision"               value="-6"  />
     <parameter name="vol_precision"                value="-6"  />
+    <parameter name="selection_increment"          value="0"  />
+    <parameter name="controls_increment"           value="2"  />
   </section>
   <section name="smesh_help" >
     <parameter name="User's Guide/Mesh module/User's Guide"      value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/index.html"/>
index 21b5ead3f66025c00c87508644667c3db78c1b4c..29ff1303f23848228669b2cb38a698e55155f3d1 100644 (file)
@@ -79,6 +79,7 @@ SET(SMESHObject_HEADERS
   SMESH_Actor.h
   SMESH_Object.h
   SMESH_ObjectDef.h
+  SMESH_ActorProps.h
   SMESH_ActorUtils.h
   SMESH_ActorDef.h
   SMESH_DeviceActor.h
@@ -98,6 +99,7 @@ SET(SMESHObject_SOURCES
   SMESH_Object.cxx
   SMESH_DeviceActor.cxx
   SMESH_Actor.cxx
+  SMESH_ActorProps.cxx
   SMESH_PreviewActorsCollection.cxx
   SMESH_ExtractGeometry.cxx
   SMESH_ActorUtils.cxx
index dac3d4a0d6418b22e1e8afcf6d0bd3ef55b6ca24..0bf3b4176b75cafffaf3ddaf8566305d77f0cce6 100644 (file)
@@ -28,6 +28,7 @@
 #include "SMESH_ActorDef.h"
 
 #include "SMDS_UnstructuredGrid.hxx"
+#include "SMESH_ActorProps.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_CellLabelActor.h"
 #include "SMESH_ControlsDef.hxx"
@@ -87,9 +88,6 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
-static int aLineWidthInc = 2;
-
-
 SMESH_ActorDef* SMESH_ActorDef::New(){
   return new SMESH_ActorDef();
 }
@@ -141,6 +139,9 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   myIsFacesOriented = false;
 
+  int controlsIncrement = SMESH_ActorProps::props()->controlsIncrement();
+  int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement();
+
   myControlsPrecision = -1;
   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
 
@@ -240,6 +241,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   anRGB[0] = 1 - anRGB[0];
   anRGB[1] = 1 - anRGB[1];
   anRGB[2] = 1 - anRGB[2];
+  my2DExtProp->SetLineWidth(aLineWidth + controlsIncrement);
   my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
 
   my2DExtActor = SMESH_DeviceActor::New();
@@ -290,6 +292,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   anRGB[0] = 1 - anRGB[0];
   anRGB[1] = 1 - anRGB[1];
   anRGB[2] = 1 - anRGB[2];
+  my3DExtProp->SetLineWidth(aLineWidth + controlsIncrement);
   my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
 
   my3DExtActor = SMESH_DeviceActor::New();
@@ -345,7 +348,7 @@ SMESH_ActorDef::SMESH_ActorDef()
 
   my1DProp = vtkProperty::New();
   my1DProp->DeepCopy(myEdgeProp);
-  my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
+  my1DProp->SetLineWidth(aLineWidth + controlsIncrement);
   my1DProp->SetPointSize(aElem0DSize);
 
   my1DExtProp = vtkProperty::New();
@@ -354,7 +357,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   anRGB[1] = 1 - anRGB[1];
   anRGB[2] = 1 - anRGB[2];
   my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
-  my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
+  my1DExtProp->SetLineWidth(aLineWidth + controlsIncrement);
   my1DExtProp->SetPointSize(aElem0DSize);
 
   // my1DExtActor is used to show filtered edges or links between nodes
@@ -485,7 +488,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
   myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
   myHighlightProp->SetPointSize(aElem0DSize); // ??
-  myHighlightProp->SetLineWidth(aLineWidth);
+  myHighlightProp->SetLineWidth(aLineWidth + selectionIncrement);
   myHighlightProp->SetRepresentation(1);
 
   myOutLineProp = vtkProperty::New();
@@ -504,7 +507,7 @@ SMESH_ActorDef::SMESH_ActorDef()
   SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
   myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
   myPreselectProp->SetPointSize(aElem0DSize); // ??
-  myPreselectProp->SetLineWidth(aLineWidth);
+  myPreselectProp->SetLineWidth(aLineWidth + selectionIncrement);
   myPreselectProp->SetRepresentation(1);
 
   myHighlitableActor = SMESH_DeviceActor::New();
@@ -2197,29 +2200,19 @@ void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b)
   ::GetColor(myBallProp,r,g,b);
 }
 
-void SMESH_ActorDef::SetHighlightColor(double r,double g,double b)
-{ 
-  myHighlightProp->SetColor(r,g,b);
-  Modified();
-}
-
-void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b)
-{ 
-  ::GetColor(myHighlightProp,r,g,b);
-}
-
-void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b)
-{ 
-  myPreselectProp->SetColor(r,g,b);
+void SMESH_ActorDef::UpdateSelectionProps()
+{
+  QColor selectionColor = SMESH_ActorProps::props()->selectionColor();
+  QColor highlightColor = SMESH_ActorProps::props()->highlightColor();
+  int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement();
+  double width = GetLineWidth();
+  myHighlightProp->SetColor(selectionColor.redF(), selectionColor.greenF(), selectionColor.blueF());
+  myHighlightProp->SetLineWidth(width + selectionIncrement);
+  myPreselectProp->SetColor(highlightColor.redF(), highlightColor.greenF(), highlightColor.blueF());
+  myPreselectProp->SetLineWidth(width + selectionIncrement);
   Modified();
 }
 
-void SMESH_ActorDef::GetPreHighlightColor(double& r,double& g,double& b)
-{ 
-  ::GetColor(myPreselectProp,r,g,b);
-}
-
-
 double SMESH_ActorDef::GetLineWidth()
 {
   return myEdgeProp->GetLineWidth();
@@ -2228,15 +2221,17 @@ double SMESH_ActorDef::GetLineWidth()
 
 void SMESH_ActorDef::SetLineWidth(double theVal)
 {
+  int controlsIncrement = SMESH_ActorProps::props()->controlsIncrement();
+  int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement();
+
   myEdgeProp->SetLineWidth(theVal);
 
-  my1DProp->SetLineWidth(theVal + aLineWidthInc);
-  my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
-  my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
-  my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
-  myOutLineProp->SetLineWidth(theVal);
-  myHighlightProp->SetLineWidth(theVal);
-  myPreselectProp->SetLineWidth(theVal);
+  my1DProp->SetLineWidth(theVal + controlsIncrement);
+  my1DExtProp->SetLineWidth(theVal + controlsIncrement);
+  my2DExtProp->SetLineWidth(theVal + controlsIncrement);
+  my3DExtProp->SetLineWidth(theVal + controlsIncrement);
+  myHighlightProp->SetLineWidth(theVal + selectionIncrement);
+  myPreselectProp->SetLineWidth(theVal + selectionIncrement);
   Modified();
 }
 
index 7ad9d2f886909e799fde5ab6e3644be8aa24457a..c72ca7e1688a0bf8209a34818eb438ad27482cc4 100644 (file)
@@ -83,12 +83,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
   virtual void SetBallColor(double r,double g,double b) = 0;
   virtual void GetBallColor(double& r,double& g,double& b) = 0;
 
-  virtual void SetHighlightColor(double r,double g,double b) = 0;
-  virtual void GetHighlightColor(double& r,double& g,double& b) = 0;
-
-  virtual void SetPreHighlightColor(double r,double g,double b) = 0;
-  virtual void GetPreHighlightColor(double& r,double& g,double& b) = 0;
+  virtual void UpdateSelectionProps() = 0;
+  
   virtual double GetLineWidth() = 0;
   virtual void SetLineWidth(double theVal) = 0;
 
index 833e8253fcd8c273d5c7f88268b48d8d43c1c4b2..3488f4401ed620c8b3dcf0724bfe31cd3cd6675b 100644 (file)
@@ -127,11 +127,7 @@ class SMESH_ActorDef : public SMESH_Actor
   virtual void SetBallColor(double r,double g,double b);
   virtual void GetBallColor(double& r,double& g,double& b);
 
-  virtual void SetHighlightColor(double r,double g,double b);
-  virtual void GetHighlightColor(double& r,double& g,double& b);
-
-  virtual void SetPreHighlightColor(double r,double g,double b);
-  virtual void GetPreHighlightColor(double& r,double& g,double& b);
+  virtual void UpdateSelectionProps();
  
   virtual double GetLineWidth();
   virtual void SetLineWidth(double theVal);
diff --git a/src/OBJECT/SMESH_ActorProps.cxx b/src/OBJECT/SMESH_ActorProps.cxx
new file mode 100644 (file)
index 0000000..800dc7c
--- /dev/null
@@ -0,0 +1,73 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SMESH_ActorProps.h"
+
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
+SMESH_ActorProps* SMESH_ActorProps::props()
+{
+  static SMESH_ActorProps* g_props = 0;
+  if (!g_props)
+    g_props = new SMESH_ActorProps();
+  return g_props;
+}
+
+void SMESH_ActorProps::reset()
+{
+  props()->initialize();
+}
+
+SMESH_ActorProps::SMESH_ActorProps()
+{
+  initialize();
+}
+
+void SMESH_ActorProps::initialize()
+{
+  SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+  m_selection_color = mgr->colorValue("SMESH", "selection_object_color", Qt::white);
+  m_highlight_color = mgr->colorValue("SMESH", "highlight_color", Qt::cyan);
+  m_selection_increment = qBound(0, mgr->integerValue("SMESH", "selection_increment", 0), 5);
+  m_controls_increment = qBound(0, mgr->integerValue("SMESH", "controls_increment", 2), 5);
+}
+
+QColor SMESH_ActorProps::selectionColor() const
+{
+  return m_selection_color;
+}
+
+QColor SMESH_ActorProps::highlightColor() const
+{
+  return m_highlight_color;
+}
+
+int SMESH_ActorProps::selectionIncrement() const
+{
+  return m_selection_increment;
+}
+
+int SMESH_ActorProps::controlsIncrement() const
+{
+  return m_controls_increment;
+}
diff --git a/src/OBJECT/SMESH_ActorProps.h b/src/OBJECT/SMESH_ActorProps.h
new file mode 100644 (file)
index 0000000..c2139e2
--- /dev/null
@@ -0,0 +1,48 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef SMESH_ACTORPROPS_H
+#define SMESH_ACTORPROPS_H
+
+#include "SMESH_Object.h"
+#include <QColor>
+
+class SMESHOBJECT_EXPORT SMESH_ActorProps
+{
+public:
+  static SMESH_ActorProps* props();
+  static void reset();
+
+  QColor selectionColor() const;
+  QColor highlightColor() const;
+  int selectionIncrement() const;
+  int controlsIncrement() const;
+
+private:
+  SMESH_ActorProps();
+  void initialize();
+
+  QColor m_selection_color, m_highlight_color;
+  int m_selection_increment, m_controls_increment;
+};
+
+#endif //SMESH_ACTORPROPS_H
index d3d701490518fa8c5dd5154da41c5ab8d86c198a..ce6896da3c8f2344b393fc3a09f7b84da5122c7a 100644 (file)
@@ -5137,6 +5137,11 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( doubleNodesTol, "max", 1000000.0 );
   setPreferenceProperty( doubleNodesTol, "step", 0.0000001 );
 
+  /*
+  int cinc = addPreference(tr("PREF_CONTROLS_INCREMENT"), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_increment");
+  setPreferenceProperty( cinc, "min", 0 );
+  setPreferenceProperty( cinc, "max", 5 );
+  */
 
   int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
   setPreferenceProperty( exportgroup, "columns", 2 );
@@ -5370,6 +5375,10 @@ void SMESHGUI::createPreferences()
   addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
   addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
 
+  int sinc = addPreference(tr("PREF_SELECTION_INCREMENT"), selTab, LightApp_Preferences::IntSpin, "SMESH", "selection_increment");
+  setPreferenceProperty( sinc, "min", 0 );
+  setPreferenceProperty( sinc, "max", 5 );
+
   // Scalar Bar tab ------------------------------------------------------------------------
   int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
   int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
@@ -5469,7 +5478,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
          name==        "highlight_color" ||
          name=="selection_precision_node"    ||
          name=="selection_precision_element" ||
-         name=="selection_precision_object"   )
+         name=="selection_precision_object"   ||
+        name=="selection_increment")
     {
       SMESH::UpdateSelectionProp( this );
     }
index ef9fb3896b5d62ad099ba9ba85fc9cc163ace889..ac471b318511730397ea3b093537c16183a05c96 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMESHGUI_Utils.h"
 #include "SMDS_Mesh.hxx"
 #include "SMESH_Actor.h"
+#include "SMESH_ActorProps.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_CellLabelActor.h"
 #include "SMESH_ControlsDef.hxx"
@@ -903,6 +904,8 @@ namespace SMESH
       return;
     }
 
+    SMESH_ActorProps::props()->reset();
+
     QColor
       aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
       aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
@@ -944,12 +947,7 @@ namespace SMESH
         aCollection->InitTraversal();
         while ( vtkActor *anAct = aCollection->GetNextActor() ) {
           if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct) ) {
-            anActor->SetHighlightColor(aHiColor.red()/255.,
-                                       aHiColor.green()/255.,
-                                       aHiColor.blue()/255.);
-            anActor->SetPreHighlightColor(aPreColor.red()/255.,
-                                          aPreColor.green()/255.,
-                                          aPreColor.blue()/255.);
+           anActor->UpdateSelectionProps();
           }
         }
       }
index f36fa04c73407e4dfb3cdac33b23121bf1192587..4be7190ad244e7e3c38ebaefb79384d9ec12bba3 100644 (file)
@@ -4830,6 +4830,10 @@ Please, create VTK viewer and try again</translation>
         <source>PREF_OBJECTS</source>
         <translation>Objects</translation>
     </message>
+    <message>
+        <source>PREF_SELECTION_INCREMENT</source>
+        <translation>Elements width increment</translation>
+    </message>
     <message>
         <source>PREF_OBJECT_COLOR</source>
         <translation>Object color</translation>
index 80ba636651aee3b05e8e867640a737411406bad6..66a93961cf577cac27ea6c6cb5d4675ed4800a66 100755 (executable)
@@ -4780,6 +4780,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
         <source>PREF_OBJECTS</source>
         <translation>Objets</translation>
     </message>
+    <message>
+        <source>PREF_SELECTION_INCREMENT</source>
+        <translation type="unfinished">Elements width increment</translation>
+    </message>
     <message>
         <source>PREF_OBJECT_COLOR</source>
         <translation>Couleur d&apos;objet</translation>
index 22e77aa5401bd61828e586ed9a4657924fdb6c58..91e3a408d2f9be4d07c7f65a949fe917d321a3c2 100644 (file)
       <source>PREF_OBJECTS</source>
       <translation>オブジェクト</translation>
     </message>
+    <message>
+      <source>PREF_SELECTION_INCREMENT</source>
+      <translation type="unfinished">Elements width increment</translation>
+    </message>
     <message>
       <source>PREF_OBJECT_COLOR</source>
       <translation>オブジェクトの色</translation>