]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
0013557: field values display
authorsln <sln@opencascade.com>
Tue, 9 Dec 2008 12:46:35 +0000 (12:46 +0000)
committersln <sln@opencascade.com>
Tue, 9 Dec 2008 12:46:35 +0000 (12:46 +0000)
Now you can display values applied to the cells or nodes of 3D presentation intended for visualization of calculation data. New methods are provided in actor.

This class is chaged for storing parameters of labels and update actor accordinly

src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_ColoredPrs3d_i.hh
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_ScalarMap_i.cc

index daa06daae63df8acc38dad7932c342126444dbbb..44605b547c87cf9886d398dc49f7eb216c64e5a7 100644 (file)
@@ -1586,7 +1586,7 @@ VISU::ColoredPrs3d_i
     
     myIsBoldTitle   = f.bold();
     myIsItalicTitle = f.italic();
-    myIsShadowTitle =  f.underline();
+    myIsShadowTitle =  f.overline();
   }
 
   QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
@@ -1611,7 +1611,7 @@ VISU::ColoredPrs3d_i
     
     myIsBoldLabel   = f.bold();
     myIsItalicLabel = f.italic();
-    myIsShadowLabel =  f.underline();
+    myIsShadowLabel =  f.overline();
   }
 
   QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
@@ -1621,7 +1621,41 @@ VISU::ColoredPrs3d_i
   myLabelColor[0] = aLabelColor.red()   / 255.;
   myLabelColor[1] = aLabelColor.green() / 255.;
   myLabelColor[2] = aLabelColor.blue()  / 255.;
+  
+  // Parameters of labels displaed field values
 
+  myValLblFontType = VTK_ARIAL;
+  myIsBoldValLbl = true;
+  myIsItalicValLbl = myIsShadowValLbl = false;
+  myValLblFontSize = 12;
+  if( aResourceMgr->hasValue( "VISU", "values_labeling_font" ) )
+  {
+    // family
+    QFont f = aResourceMgr->fontValue( "VISU", "values_labeling_font" );
+    if ( f.family() == "Arial" )
+      myValLblFontType = VTK_ARIAL;
+    else if ( f.family() == "Courier" )
+      myValLblFontType = VTK_COURIER;
+    else if ( f.family() == "Times" )
+      myValLblFontType = VTK_TIMES;
+
+    // size
+    if ( f.pointSize() > -1 )
+      myValLblFontSize = f.pointSize();
+
+    // color
+    QColor aColor = aResourceMgr->colorValue( 
+      "VISU", "values_labeling_color", QColor( 255, 255, 255 ) );
+    myValLblFontColor[ 0 ] = aColor.red() / 255.;
+    myValLblFontColor[ 1 ] = aColor.green() / 255.;
+    myValLblFontColor[ 2 ] = aColor.blue()/ 255.;
+
+    // bold, italic, shadow
+    myIsBoldValLbl = f.bold();
+    myIsItalicValLbl = f.italic();
+    myIsShadowValLbl =  f.overline();
+  }
+  
   return this;
 }
 
@@ -1731,6 +1765,18 @@ VISU::ColoredPrs3d_i
       }
     }
   }
+  
+  // Parameters of labels displayed field values
+
+  myValLblFontType = VISU::Storable::FindValue( theMap, "myValLblFontType", "0"  ).toInt();
+  myIsBoldValLbl = VISU::Storable::FindValue( theMap, "myIsBoldValLbl", "1" ).toInt();
+  myIsItalicValLbl = VISU::Storable::FindValue( theMap, "myIsItalicValLbl", "0" ).toInt();
+  myIsShadowValLbl = VISU::Storable::FindValue( theMap, "myIsShadowValLbl", "0" ).toInt();
+  myValLblFontSize = VISU::Storable::FindValue( theMap, "myValLblFontSize", "12" ).toDouble();
+  myValLblFontColor[ 0 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[0]", "1" ).toFloat();
+  myValLblFontColor[ 1 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[1]", "1" ).toFloat();
+  myValLblFontColor[ 2 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[2]", "1" ).toFloat();
+  
   return this;
 }
 
@@ -1790,6 +1836,18 @@ VISU::ColoredPrs3d_i
   Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
   Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
   Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
+  
+  // Parameters of labels displayed field values
+
+  Storable::DataToStream( theStr, "myValLblFontType", myValLblFontType );
+  Storable::DataToStream( theStr, "myIsBoldValLbl", myIsBoldValLbl );
+  Storable::DataToStream( theStr, "myIsItalicValLbl", myIsItalicValLbl );
+  Storable::DataToStream( theStr, "myIsShadowValLbl", myIsShadowValLbl );
+  Storable::DataToStream( theStr, "myValLblFontSize", myValLblFontSize );
+  Storable::DataToStream( theStr, "myValLblFontColor[0]", myValLblFontColor[ 0 ] );
+  Storable::DataToStream( theStr, "myValLblFontColor[1]", myValLblFontColor[ 1 ] );
+  Storable::DataToStream( theStr, "myValLblFontColor[2]", myValLblFontColor[ 2 ] );
+
 
   std::ostringstream aGeomNameList;
   std::string aMeshName = GetCMeshName();
@@ -1943,3 +2001,159 @@ VISU::ColoredPrs3d_i
 }
 
 //----------------------------------------------------------------------------
+
+
+int
+VISU::ColoredPrs3d_i
+::GetValLblFontType() const
+{
+  return myValLblFontType;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetValLblFontType( const int theType )
+{
+  if ( myValLblFontType == theType )
+    return;
+
+  VISU::TSetModified aModified( this );
+
+  myValLblFontType = theType;
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+double
+VISU::ColoredPrs3d_i
+::GetValLblFontSize() const
+{
+  return myValLblFontSize;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetValLblFontSize( const double theSize )
+{
+  if ( VISU::CheckIsSameValue( myValLblFontSize, theSize ) )
+    return;
+
+  VISU::TSetModified aModified( this );
+
+  myValLblFontSize = theSize;
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::GetValLblFontColor( vtkFloatingPointType& theR, 
+                      vtkFloatingPointType& theG, 
+                      vtkFloatingPointType& theB ) const
+{
+  theR = myValLblFontColor[ 0 ];
+  theG = myValLblFontColor[ 1 ];
+  theB = myValLblFontColor[ 2 ];
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetValLblFontColor( const vtkFloatingPointType theR, 
+                      const vtkFloatingPointType theG, 
+                      const vtkFloatingPointType theB )
+{
+  if ( VISU::CheckIsSameValue( myValLblFontColor[ 0 ], theR ) &&
+       VISU::CheckIsSameValue( myValLblFontColor[ 1 ], theG ) &&
+       VISU::CheckIsSameValue (myValLblFontColor[ 2 ], theB ) )
+    return;
+
+  VISU::TSetModified aModified(this);
+
+  myValLblFontColor[ 0 ] = theR; 
+  myValLblFontColor[ 1 ] = theG; 
+  myValLblFontColor[ 2 ] = theB; 
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool
+VISU::ColoredPrs3d_i
+::IsBoldValLbl() const
+{
+  return myIsBoldValLbl;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetBoldValLbl( const bool theVal )
+{
+  if ( myIsBoldValLbl == theVal )
+    return;
+
+  VISU::TSetModified aModified( this );
+
+  myIsBoldValLbl =  theVal;
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool
+VISU::ColoredPrs3d_i
+::IsItalicValLbl() const
+{
+  return myIsItalicValLbl;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetItalicValLbl( const bool theVal )
+{
+  if ( myIsItalicValLbl == theVal )
+    return;
+
+  VISU::TSetModified aModified( this );
+
+  myIsItalicValLbl =  theVal;
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool
+VISU::ColoredPrs3d_i
+::IsShadowValLbl() const
+{
+  return myIsShadowValLbl;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetShadowValLbl( const bool theVal )
+{
+  if ( myIsShadowValLbl == theVal )
+    return;
+
+  VISU::TSetModified aModified( this );
+
+  myIsShadowValLbl =  theVal;
+  myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
index df1e0c84b6ff297ecaaffe62b6f23d238407c077..73cd48071d1722663e4470be3919beb991c8af31 100644 (file)
@@ -581,6 +581,58 @@ namespace VISU
       return myColoredPL; 
     }
     
+        virtual 
+    int
+    GetValLblFontType() const;
+
+    virtual 
+    void
+    SetValLblFontType( const int theType );
+
+    virtual 
+    double
+    GetValLblFontSize() const;
+
+    virtual 
+    void
+    SetValLblFontSize( const double theSize );
+
+    virtual 
+    bool
+    IsBoldValLbl() const;
+
+    virtual
+    void
+    SetBoldValLbl( const bool theVal );
+
+    virtual 
+    bool
+    IsItalicValLbl() const;
+
+    virtual
+    void
+    SetItalicValLbl( const bool theVal );
+
+    virtual 
+    bool
+    IsShadowValLbl() const;
+
+    virtual
+    void
+    SetShadowValLbl( const bool theVal );
+
+    virtual 
+    void
+    GetValLblFontColor( vtkFloatingPointType& theR, 
+                      vtkFloatingPointType& theG, 
+                      vtkFloatingPointType& theB ) const;
+
+    virtual
+    void
+    SetValLblFontColor( const vtkFloatingPointType theR, 
+                       const vtkFloatingPointType theG, 
+                       const vtkFloatingPointType theB );
+    
     //----------------------------------------------------------------------------
   protected:
     /*!
@@ -713,6 +765,13 @@ namespace VISU
 
     bool myIsDistributionVisible; // RKV
 
+    // Result labels 
+    int                  myValLblFontType;
+    double               myValLblFontSize;
+    bool                 myIsBoldValLbl;
+    bool                 myIsItalicValLbl;
+    bool                 myIsShadowValLbl;
+    vtkFloatingPointType myValLblFontColor[ 3 ];
   };
 
 
index 8039cbc67f46fb5cfc554e332cc7f21693185753..ef1f74279379d214833c3d91c4f178b160771331 100644 (file)
@@ -1000,7 +1000,24 @@ VISU::GaussPoints_i
       theActor->SetRepresentation( VTK_POINTS );
     else
       theActor->SetRepresentation( VTK_SURFACE );
+      
+    // Update values labels
+
+    vtkTextProperty* aProp = anActor->GetsValLabelsProps();
+    if ( aProp )
+    {
+      aProp->SetFontFamily( GetValLblFontType() );
+      aProp->SetFontSize( GetValLblFontSize() );
+      aProp->SetBold( IsBoldValLbl() );
+      aProp->SetItalic( IsItalicValLbl() );
+      aProp->SetShadow( IsShadowValLbl() );
+
+      vtkFloatingPointType anRGB[ 3 ];
+      GetValLblFontColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+      aProp->SetColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+    }
   }
+  
   TSuperClass::UpdateActor(theActor);
 }
 
index db272f3dea334cd3d9c680da9aa8338996db0d3f..1ef187fe415bbbfce029d0f2d74d8f2bcfee02a2 100644 (file)
@@ -491,6 +491,22 @@ VISU::ScalarMap_i
     anActor->SetBarVisibility(myShowBar); 
 
     aScalarBar->Modified();
+    
+    // Update values labels
+
+    vtkTextProperty* aProp = anActor->GetsValLabelsProps();
+    if ( aProp )
+    {
+      aProp->SetFontFamily( GetValLblFontType() );
+      aProp->SetFontSize( GetValLblFontSize() );
+      aProp->SetBold( IsBoldValLbl() );
+      aProp->SetItalic( IsItalicValLbl() );
+      aProp->SetShadow( IsShadowValLbl() );
+
+      vtkFloatingPointType anRGB[ 3 ];
+      GetValLblFontColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+      aProp->SetColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+    }
   }
   TSuperClass::UpdateActor(theActor);
 }