Salome HOME
Merge remote branch 'origin/V8_5_asterstudy' V9_1_0
authorvsr <vsr@opencascade.com>
Wed, 12 Sep 2018 07:49:27 +0000 (10:49 +0300)
committervsr <vsr@opencascade.com>
Wed, 12 Sep 2018 07:49:27 +0000 (10:49 +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 9c1b51d..a9ffc18 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 21b5ead..29ff130 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 46bff48..23dee68 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 7ad9d2f..c72ca7e 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 833e825..3488f44 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 35e2c48..1225963 100644 (file)
@@ -5100,6 +5100,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 );
@@ -5333,6 +5338,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 );
@@ -5432,7 +5441,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 5b4a504..b74d29e 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"
@@ -879,6 +880,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 ),
@@ -920,12 +923,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 7a5649f..75d649a 100644 (file)
@@ -4828,6 +4828,10 @@ Please, create VTK viewer and try again</translation>
         <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>
     </message>
index b26fe66..52b164b 100755 (executable)
@@ -4774,6 +4774,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
         <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>
     </message>
index c266cb9..3b32bdd 100644 (file)
       <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>
     </message>