From 87fa8d2a6bc268c71c1627d1074a643f44a86775 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 30 Sep 2005 13:33:08 +0000 Subject: [PATCH] 1. To introduce new intermediate level for ScalarMap interface hierarchy - ColoredPrs3d. 2. Now GaussPoints interface inherits from ColoredPrs3d --- idl/VISU_Gen.idl | 99 ++-- src/OBJECT/VISU_GaussPtsAct.cxx | 68 +-- src/OBJECT/VISU_GaussPtsAct.h | 27 +- src/VISUGUI/VisuGUI_GaussPointsDlg.cxx | 10 +- src/VISUGUI/VisuGUI_GaussPointsDlg.h | 2 +- src/VISU_I/Makefile.in | 12 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 690 +++++++++++++++++++++++++ src/VISU_I/VISU_ColoredPrs3d_i.hh | 296 +++++++++++ src/VISU_I/VISU_CutLines_i.cc | 5 +- src/VISU_I/VISU_CutPlanes_i.cc | 8 +- src/VISU_I/VISU_DeformedShape_i.cc | 2 + src/VISU_I/VISU_GaussPoints_i.cc | 192 +++---- src/VISU_I/VISU_GaussPoints_i.hh | 7 +- src/VISU_I/VISU_IsoSurfaces_i.cc | 8 +- src/VISU_I/VISU_Plot3D_i.cc | 32 +- src/VISU_I/VISU_Prs3d_i.cc | 4 +- src/VISU_I/VISU_ScalarMap_i.cc | 488 ++++++----------- src/VISU_I/VISU_ScalarMap_i.hh | 224 ++++---- src/VISU_I/VISU_StreamLines_i.cc | 2 + src/VISU_I/VISU_Vectors_i.cc | 2 + 20 files changed, 1502 insertions(+), 676 deletions(-) create mode 100644 src/VISU_I/VISU_ColoredPrs3d_i.cc create mode 100644 src/VISU_I/VISU_ColoredPrs3d_i.hh diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 46b78203..c2f9b047 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -365,8 +365,9 @@ module VISU { PresentationType GetPresentationType(); }; + //------------------------------------------------------- - /*! \brief Interface of the %Scalar Map + /*! \brief Basic Interface for the %Colored 3D Presentations * * This interface is responsable for coloring of 3D field presentations * according the scalar values applied to different cells. @@ -374,7 +375,7 @@ module VISU { * bar is displayed along with each colored field presentation and serves for * consulting the correspondance between colors and data values. */ - interface ScalarMap : Prs3d { + interface ColoredPrd3d : Prs3d { /*! Sets the method of coloring of the elements composing a 3D presentation. */ void SetScalarMode(in long theScalarMode); @@ -383,36 +384,8 @@ module VISU { */ long GetScalarMode(); - /*! - * Sets the type of scaling of the values reflected by the scalar bar. - * \param theScaling The value of this parameter is taken from the Scaling enumeration. - */ - void SetScaling(in Scaling theScaling); - - /*! - * Gets the type of scaling of the values reflected by this presentation. - */ - Scaling GetScaling(); - - /*! - * Sets scalar range - min and max boundaries of the scalar bar. - * \param theMin Min boundary of the scalar bar. - * \param theMax Max boundary of the scalar bar. - */ - void SetRange(in double theMin, in double theMax); - - /*! - * Gets the min boundary of the scalar bar. - */ - double GetMin(); - - /*! - * Gets the max boundary of the scalar bar. - */ - double GetMax(); - /*! %Orientation of the scalar bar. */ - enum Orientation { + enum ScalarBarOrientation { HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/ VERTICAL /*!< Vertical orientation of the scalar bar.*/ }; @@ -422,12 +395,12 @@ module VISU { * \param theOrientation This parameter defines the orientation of the scalar bar. * It is taken from the Orientaton enumeration. */ - void SetBarOrientation(in Orientation theOrientation); + void SetScalarBarOrientation(in ScalarBarOrientation theOrientation); /*! * Gets the type of orientation of the scalar bar. */ - Orientation GetBarOrientation(); + ScalarBarOrientation GetScalarBarOrientation(); /*! \brief Position of the scalar bar. * @@ -506,13 +479,71 @@ module VISU { string GetTitle(); }; + + //------------------------------------------------------- + /*! \brief Interface of the %Scalar Map + * + * This interface is responsable for coloring of 3D field presentations + * according the scalar values applied to different cells. + * As well it contains presentation parameters of the scalar bar. The scalar + * bar is displayed along with each colored field presentation and serves for + * consulting the correspondance between colors and data values. + */ + interface ScalarMap : ColoredPrd3d { + /*! + * Sets the type of scaling of the values reflected by the scalar bar. + * \param theScaling The value of this parameter is taken from the Scaling enumeration. + */ + void SetScaling(in Scaling theScaling); + + /*! + * Gets the type of scaling of the values reflected by this presentation. + */ + Scaling GetScaling(); + + /*! + * Sets scalar range - min and max boundaries of the scalar bar. + * \param theMin Min boundary of the scalar bar. + * \param theMax Max boundary of the scalar bar. + */ + void SetRange(in double theMin, in double theMax); + + /*! + * Gets the min boundary of the scalar bar. + */ + double GetMin(); + + /*! + * Gets the max boundary of the scalar bar. + */ + double GetMax(); + + /*! %Orientation of the scalar bar (to provide backward compatibility). */ + enum Orientation { + HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/ + VERTICAL /*!< Vertical orientation of the scalar bar.*/ + }; + + /*! + * Sets the type of orientation of the scalar bar (to provide backward compatibility). + * \param theOrientation This parameter defines the orientation of the scalar bar. + * It is taken from the Orientaton enumeration. + */ + void SetBarOrientation(in Orientation theOrientation); + + /*! + * Gets the type of orientation of the scalar bar (to provide backward compatibility). + */ + Orientation GetBarOrientation(); + }; + //------------------------------------------------------- /*! \brief Gauss Points presentation interface * * Presentation parameters of the Gauss Points presentation. */ //------------------------------------------------------- - interface GaussPoints : ScalarMap { + interface GaussPoints : ColoredPrd3d { }; /*! \brief Deformed shape presentation interface diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 3fa5a171..ed2dcd92 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -119,7 +119,9 @@ VISU_GaussPtsAct mySphereSourceSelected(vtkSphereSource::New()), mySphereActorSelected(vtkActor::New()), myCellSource(vtkUnstructuredGrid::New()), - myCellActor(vtkActor::New()) + myCellActor(vtkActor::New()), + myScalarBarCtrl(VISU_ScalarBarCtrl::New()), + myBarVisibility(true) { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<GetProperty()->SetAmbient(1.0); myCellActor->GetProperty()->SetDiffuse(0.0); myCellActor->GetProperty()->SetRepresentationToWireframe(); - mySBCtrl=VISU_ScalarBarCtrl::New(); - mySBCtrl->Delete(); - mySBCtrl->SetMode(0); - mySBCtrl->SetRangeGlobal(0.,10.); - mySBCtrl->SetOrientationToHorizontal(); - mySBCtrl->GetScalarBarActor(0)->SetTitle("GLB"); - mySBCtrl->GetScalarBarActor(1)->SetTitle("LOC"); - - myScalarBar->SetVisibility(0); + + myScalarBarCtrl->Delete(); + myScalarBarCtrl->SetMode(0); + myScalarBarCtrl->SetRangeGlobal(0.,10.); + myScalarBarCtrl->SetOrientationToHorizontal(); + myScalarBarCtrl->GetScalarBarActor(0)->SetTitle("GLB"); + myScalarBarCtrl->GetScalarBarActor(1)->SetTitle("LOC"); } VISU_GaussPtsAct @@ -278,7 +278,7 @@ VISU_GaussPtsAct theRenderer->AddActor(myCellActor.GetPointer()); myCursorPyramid->AddToRender(theRenderer); - mySBCtrl->AddToRender(theRenderer); + myScalarBarCtrl->AddToRender(theRenderer); } void @@ -297,7 +297,7 @@ VISU_GaussPtsAct theRenderer->RemoveActor(myCellActor.GetPointer()); myCursorPyramid->RemoveFromRender(theRenderer); - mySBCtrl->RemoveFromRender(theRenderer); + myScalarBarCtrl->RemoveFromRender(theRenderer); } void @@ -418,6 +418,30 @@ VISU_GaussPtsAct ::SetVisibility(int theMode) { Superclass::SetVisibility(theMode); + myScalarBarCtrl->SetBarVisibility(theMode && myBarVisibility); +} + +//---------------------------------------------------------------------------- +void +VISU_GaussPtsAct +::SetBarVisibility(bool theMode) +{ + myBarVisibility = theMode; + myScalarBarCtrl->SetBarVisibility(theMode); +} + +bool +VISU_GaussPtsAct +::GetBarVisibility() +{ + return myBarVisibility; +} + +VISU_ScalarBarCtrl* +VISU_GaussPtsAct +::GetScalarBarCtrl() +{ + return myScalarBarCtrl.GetPointer(); } //---------------------------------------------------------------------------- @@ -813,26 +837,6 @@ VISU_GaussPtsAct return bRet; } -//================================================================== -// function : SetBarVisibility -// purpose : -//================================================================== -void VISU_GaussPtsAct::SetBarVisibility(bool theMode) -{ - myBarVisibility = theMode; - mySBCtrl->SetBarVisibility(myBarVisibility); - //VISU_ScalarMapAct::SetBarVisibility(theMode); -} - -//================================================================== -// function : GetScalarBarCtrl -// purpose : -//================================================================== -VISU_ScalarBarCtrl* VISU_GaussPtsAct::GetScalarBarCtrl() -{ - return mySBCtrl.GetPointer(); -} - //============================================================================== vtkStandardNewMacro(VISU_GaussPtsAct1); diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 85e10a6e..095447f3 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -29,7 +29,7 @@ #ifndef VISU_GaussPtsAct_HeaderFile #define VISU_GaussPtsAct_HeaderFile -#include "VISU_ScalarMapAct.h" +#include "VISU_Actor.h" #include "VISU_GaussPtsActorFactory.h" #include @@ -58,6 +58,8 @@ class vtkInteractorObserver; class vtkCallbackCommand; class VISU_ScalarBarCtrl; + +//============================================================================ class VTKOCC_EXPORT VISU_OutsideCursorSettings : public vtkObject { public: @@ -98,11 +100,12 @@ private: float Color[3]; }; -//---------------------------------------------------------------------------- -class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct + +//============================================================================ +class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor { public: - vtkTypeMacro(VISU_GaussPtsAct,VISU_ScalarMapAct); + vtkTypeMacro(VISU_GaussPtsAct,VISU_Actor); typedef vtkSmartPointer PDeviceActor; static @@ -175,6 +178,15 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct void SetVisibility(int theMode); + VISU_ScalarBarCtrl* + GetScalarBarCtrl(); + + void + SetBarVisibility(bool theMode); + + bool + GetBarVisibility(); + virtual void SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget); @@ -202,9 +214,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight); - virtual void SetBarVisibility(bool theMode); - VISU_ScalarBarCtrl* GetScalarBarCtrl(); - protected: //---------------------------------------------------------------------------- VISU_GaussPtsAct(); @@ -257,7 +266,9 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_ScalarMapAct vtkSmartPointer myCellSource; vtkSmartPointer myCellActor; - vtkSmartPointer mySBCtrl; + + bool myBarVisibility; + vtkSmartPointer myScalarBarCtrl; vtkSmartPointer myOutsideCursorSettings; }; diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 88095ca0..d1354b68 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -59,7 +59,7 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool S { myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80; myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12; - Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0; + Imin = 0.0; Imax = 0.0; myRangeMode = -1; setSpacing(6); @@ -500,7 +500,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) thePrs->GetPosY(), thePrs->GetWidth(), thePrs->GetHeight(), - thePrs->GetBarOrientation()); + thePrs->GetScalarBarOrientation()); bool bicolor = thePrs->GetGaussPointsPL()->GetBicolor(); BicolorButton->setChecked( bicolor ); @@ -510,9 +510,6 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) LabelLabel->setEnabled( !bicolor ); LabelSpin->setEnabled( !bicolor ); - float aRange[2]; - thePrs->GetGaussPointsPL()->GetSourceRange(aRange); - Rmin = aRange[0]; Rmax = aRange[1]; setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() ); // Update myModeCombo @@ -573,10 +570,9 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) { thePrs->SetScalarMode(myModeCombo->currentItem()); thePrs->SetPosition(XSpin->value(), YSpin->value()); thePrs->SetSize(WidthSpin->value(), HeightSpin->value()); - thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL); + thePrs->SetScalarBarOrientation((RBvert->isChecked())? VISU::ColoredPrd3d::VERTICAL : VISU::ColoredPrd3d::HORIZONTAL); thePrs->SetIsActiveLocalScalarBar(myRBLocal->isChecked()); thePrs->SetIsDispGlobalScalarBar(myCBDisplayed->isChecked()); - thePrs->SetSourceRange(); thePrs->SetNbColors(ColorSpin->value()); thePrs->SetLabels(LabelSpin->value()); diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index bd8faff9..d963fc11 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -105,7 +105,7 @@ class VisuGUI_GaussScalarBarPane : public QVBox QRadioButton* myRBLocal; QCheckBox* myCBDisplayed; - double Imin, Imax, /* Fmin, Fmax,*/ Rmin, Rmax; + double Imin, Imax; double myHorX, myHorY, myHorW, myHorH; double myVerX, myVerY, myVerW, myVerH; int myRangeMode; diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index af558c6f..4ce33ec5 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -20,13 +20,11 @@ LIB = libVISUEngineImpl.la LIB_SRC = \ VISUConfig.cc \ - VISU_Gen_i.cc \ - VISU_Result_i.cc \ VISU_PrsObject_i.cc \ - VISU_Table_i.cc \ VISU_Prs3d_i.cc \ - VISU_Mesh_i.cc \ + VISU_ColoredPrs3d_i.cc \ VISU_ScalarMap_i.cc \ + VISU_GaussPoints_i.cc \ VISU_IsoSurfaces_i.cc \ VISU_DeformedShape_i.cc \ VISU_Plot3D_i.cc \ @@ -34,7 +32,10 @@ LIB_SRC = \ VISU_CutLines_i.cc \ VISU_Vectors_i.cc \ VISU_StreamLines_i.cc \ - VISU_GaussPoints_i.cc \ + VISU_Mesh_i.cc \ + VISU_Table_i.cc \ + VISU_Gen_i.cc \ + VISU_Result_i.cc \ VISU_ViewManager_i.cc \ VISU_View_i.cc \ VISU_TimeAnimation.cxx \ @@ -71,6 +72,7 @@ EXPORT_HEADERS = \ VISU_Table_i.hh \ VISU_Prs3d_i.hh \ VISU_Mesh_i.hh \ + VISU_ColoredPrs3d_i.hh \ VISU_ScalarMap_i.hh \ VISU_IsoSurfaces_i.hh \ VISU_DeformedShape_i.hh \ diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc new file mode 100644 index 00000000..154bec64 --- /dev/null +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -0,0 +1,690 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 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. +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// File : VISU_PrsObject_i.cxx +// Author : Alexey PETROV +// Module : VISU + +#include "VISU_ColoredPrs3d_i.hh" + +#include "VISU_ScalarMapPL.hxx" +#include "VISU_Result_i.hh" +#include "VISU_Convertor.hxx" + +#include "SUIT_ResourceMgr.h" + +#include + +using namespace VISU; +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +static int INCMEMORY = 4; + + +//============================================================================ +VISU::ColoredPrs3d_i:: +ColoredPrs3d_i(Result_i* theResult, + bool theAddToStudy) : + PrsObject_i(theResult->GetStudyDocument()), + Prs3d_i(theResult,theAddToStudy), + myScalarMapPL(NULL), + myIsFixedRange(false) +{} + +VISU::ColoredPrs3d_i:: +ColoredPrs3d_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject) : + PrsObject_i(theResult->GetStudyDocument()), + Prs3d_i(theResult,theSObject), + myScalarMapPL(NULL), + myIsFixedRange(false) +{} + +VISU::ColoredPrs3d_i +::~ColoredPrs3d_i() +{} + +void +VISU::ColoredPrs3d_i +::RemoveFromStudy() +{ + TSuperClass::RemoveFromStudy(); + VISU::RemoveFromStudy(mySObject,false); +} + +void +VISU::ColoredPrs3d_i +::SameAs(const ColoredPrs3d_i* theOrigin) +{ + DoHook(); + + TSuperClass::SameAs(theOrigin); + + ColoredPrs3d_i* anOrigin = const_cast(theOrigin); + + myField = anOrigin->GetField(); + myMeshName = myField->myMeshName; + myEntity = myField->myEntity; + myIteration = anOrigin->GetIteration(); + myFieldName = anOrigin->GetFieldName(); + + SetScalarMode(anOrigin->GetScalarMode()); + SetNbColors(anOrigin->GetNbColors()); + SetScalarBarOrientation(anOrigin->GetScalarBarOrientation()); + + SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY()); + SetSize(anOrigin->GetWidth(), anOrigin->GetHeight()); + SetLabels(anOrigin->GetLabels()); + SetTitle(anOrigin->GetTitle()); + + SetBoldTitle(anOrigin->IsBoldTitle()); + SetItalicTitle(anOrigin->IsItalicTitle()); + SetShadowTitle(anOrigin->IsShadowTitle()); + SetTitFontType(anOrigin->GetTitFontType()); + float r,g,b; + anOrigin->GetTitleColor(&r,&g,&b); + SetTitleColor(r,g,b); + + SetBoldLabel(anOrigin->IsBoldLabel()); + SetItalicLabel(anOrigin->IsItalicLabel()); + SetShadowLabel(anOrigin->IsShadowLabel()); + SetLblFontType(anOrigin->GetLblFontType()); + anOrigin->GetLabelColor(&r,&g,&b); + SetLabelColor(r,g,b); +} + +void +VISU::ColoredPrs3d_i +::SameAsParams(const ColoredPrs3d_i* theOrigin) +{ + int anIteration = GetIteration(); + SameAs(theOrigin); + myIteration = anIteration; + + Build(-1); + Update(); +} + + +//---------------------------------------------------------------------------- +CORBA::Long +VISU::ColoredPrs3d_i +::GetScalarMode() +{ + return myScalarMapPL->GetScalarMode(); +} + +void +VISU::ColoredPrs3d_i +::SetScalarMode(CORBA::Long theScalarMode) +{ + myScalarMapPL->SetScalarMode(theScalarMode); +} + +void +VISU::ColoredPrs3d_i +::SetNbColors(CORBA::Long theNbColors) +{ + myScalarMapPL->SetNbColors(theNbColors); +} + +CORBA::Long +VISU::ColoredPrs3d_i +::GetNbColors() +{ + return myScalarMapPL->GetNbColors(); +} + +void +VISU::ColoredPrs3d_i +::SetScalarBarOrientation(VISU::ColoredPrd3d::ScalarBarOrientation theOrientation) +{ + myOrientation = theOrientation; +} + +VISU::ColoredPrd3d::ScalarBarOrientation +VISU::ColoredPrs3d_i +::GetScalarBarOrientation() +{ + return myOrientation; +} + +void +VISU::ColoredPrs3d_i +::SetPosition(CORBA::Double X, CORBA::Double Y) +{ + myPosition[0] = X; + myPosition[1] = Y; +} + +CORBA::Double +VISU::ColoredPrs3d_i +::GetPosX() +{ + return myPosition[0]; +} + +CORBA::Double +VISU::ColoredPrs3d_i +::GetPosY() +{ + return myPosition[1]; +} + +void +VISU::ColoredPrs3d_i +::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) +{ + myWidth = theWidth; + myHeight = theHeight; +} + +CORBA::Double +VISU::ColoredPrs3d_i +::GetWidth() +{ + return myWidth; +} + +CORBA::Double +VISU::ColoredPrs3d_i +::GetHeight() +{ + return myHeight; +} + +void +VISU::ColoredPrs3d_i +::SetLabels(CORBA::Long theNbLabels) +{ + myNumberOfLabels = theNbLabels; +} + +CORBA::Long +VISU::ColoredPrs3d_i +::GetLabels() +{ + return myNumberOfLabels; +} + +void +VISU::ColoredPrs3d_i +::SetTitle(const char* theName) +{ + myTitle = theName; +} + +char* +VISU::ColoredPrs3d_i +::GetTitle() +{ + return CORBA::string_dup(myTitle.c_str()); +} + +bool +VISU::ColoredPrs3d_i +::IsBoldTitle() +{ + return myIsBoldTitle; +} + +void +VISU::ColoredPrs3d_i +::SetBoldTitle(bool isBold) +{ + myIsBoldTitle = isBold; +} + +bool +VISU::ColoredPrs3d_i +::IsItalicTitle() +{ + return myIsItalicTitle; +} + +void +VISU::ColoredPrs3d_i +::SetItalicTitle(bool isItalic) +{ + myIsItalicTitle = isItalic; +} + +bool +VISU::ColoredPrs3d_i +::IsShadowTitle() +{ + return myIsShadowTitle; +} + +void +VISU::ColoredPrs3d_i +::SetShadowTitle(bool isShadow) +{ + myIsShadowTitle = isShadow; +} + +int +VISU::ColoredPrs3d_i +::GetTitFontType() +{ + return myTitFontType; +} + +void +VISU::ColoredPrs3d_i +::SetTitFontType(int theType) +{ + myTitFontType = theType; +} + +void +VISU::ColoredPrs3d_i +::GetTitleColor(float* theR, float* theG, float* theB) +{ + *theR = myTitleColor[0]; + *theG = myTitleColor[1]; + *theB = myTitleColor[2]; +} + +void +VISU::ColoredPrs3d_i +::SetTitleColor(float theR, float theG, float theB) +{ + myTitleColor[0] = theR; + myTitleColor[1] = theG; + myTitleColor[2] = theB; +} + +bool +VISU::ColoredPrs3d_i +::IsBoldLabel() +{ + return myIsBoldLabel; +} + +void +VISU::ColoredPrs3d_i +::SetBoldLabel(bool isBold) +{ + myIsBoldLabel = isBold; +} + +bool +VISU::ColoredPrs3d_i +::IsItalicLabel() +{ + return myIsItalicLabel; +} + +void +VISU::ColoredPrs3d_i +::SetItalicLabel(bool isItalic) +{ + myIsItalicLabel = isItalic; +} + +bool +VISU::ColoredPrs3d_i +::IsShadowLabel() +{ + return myIsShadowLabel; +} + +void +VISU::ColoredPrs3d_i +::SetShadowLabel(bool isShadow) +{ + myIsShadowLabel = isShadow; +} + +int +VISU::ColoredPrs3d_i +::GetLblFontType() +{ + return myLblFontType; +} + +void +VISU::ColoredPrs3d_i +::SetLblFontType(int theType) +{ + myLblFontType = theType; +} + +void +VISU::ColoredPrs3d_i +::GetLabelColor(float* theR, float* theG, float* theB) +{ + *theR = myLabelColor[0]; + *theG = myLabelColor[1]; + *theB = myLabelColor[2]; +} + +void +VISU::ColoredPrs3d_i +::SetLabelColor(float theR, float theG, float theB) +{ + myLabelColor[0] = theR; + myLabelColor[1] = theG; + myLabelColor[2] = theB; +} + + +//---------------------------------------------------------------------------- +/** + * Creates ColoredPrs3d and initialises it from resources + */ +VISU::Storable* +VISU::ColoredPrs3d_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration) +{ + DoHook(); + + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + + int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0); + SetScalarMode(aScalarMode); + + int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 ); + SetNbColors(aNumberOfColors); + + // Orientation + int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0); + if(anOrientation == 1) + myOrientation = VISU::ColoredPrd3d::HORIZONTAL; + else + myOrientation = VISU::ColoredPrd3d::VERTICAL; + + // Scalar Bar origin + QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" ); + + float aXorigin = (myOrientation == VISU::ColoredPrd3d::VERTICAL) ? 0.01 : 0.2; + aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin); + myPosition[0] = aXorigin; + + float aYorigin = (myOrientation == VISU::ColoredPrd3d::VERTICAL) ? 0.1 : 0.012; + aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin); + myPosition[1] = aYorigin; + + // Scalar Bar size + myWidth = (myOrientation == VISU::ColoredPrd3d::VERTICAL)? 0.1 : 0.6; + myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth); + + myHeight = (myOrientation == VISU::ColoredPrd3d::VERTICAL)? 0.8:0.12; + myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight); + + // Nb of Labels + myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 ); + + // Fonts properties definition + myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true; + myTitFontType = VTK_ARIAL; + + if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){ + QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" ); + if ( f.family() == "Arial" ) + myTitFontType = VTK_ARIAL; + else if ( f.family() == "Courier" ) + myTitFontType = VTK_COURIER; + else if ( f.family() == "Times" ) + myTitFontType = VTK_TIMES; + + myIsBoldTitle = f.bold(); + myIsItalicTitle = f.italic(); + myIsShadowTitle = f.underline(); + } + + QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) ); + + myTitleColor[0] = aTextColor.red() / 255; + myTitleColor[1] = aTextColor.green() / 255; + myTitleColor[2] = aTextColor.blue() / 255; + + myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true; + myLblFontType = VTK_ARIAL; + + if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){ + QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" ); + if ( f.family() == "Arial" ) + myLblFontType = VTK_ARIAL; + else if ( f.family() == "Courier" ) + myLblFontType = VTK_COURIER; + else if ( f.family() == "Times" ) + myLblFontType = VTK_TIMES; + + myIsBoldLabel = f.bold(); + myIsItalicLabel = f.italic(); + myIsShadowLabel = f.underline(); + } + + QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) ); + + myLabelColor[0] = aLabelColor.red() / 255; + myLabelColor[1] = aLabelColor.green() / 255; + myLabelColor[2] = aLabelColor.blue() / 255; + + myMeshName = theMeshName; + myEntity = (VISU::TEntity)theEntity; + myFieldName =theFieldName; + myIteration = theIteration; + + return Build(false); +} + +VISU::Storable* +VISU::ColoredPrs3d_i +::Restore(const Storable::TRestoringMap& theMap) +{ + DoHook(); + + TSuperClass::Restore(theMap); + + SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt()); + SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt()); + SetScalarBarOrientation((VISU::ColoredPrd3d::ScalarBarOrientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt()); + + myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1(); + myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt(); + myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1(); + myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt(); + + myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1(); + myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt(); + myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble(); + myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble(); + myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble(); + myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble(); + + myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt(); + myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt(); + myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt(); + myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt(); + myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat(); + myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat(); + myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat(); + + myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt(); + myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt(); + myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt(); + myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt(); + myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat(); + myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat(); + myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat(); + + myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study. + + return Build(true); +} + +void +VISU::ColoredPrs3d_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); + + Storable::DataToStream( theStr, "myScalarMode", int(GetScalarMode()) ); + Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) ); + Storable::DataToStream( theStr, "myOrientation", myOrientation ); + + Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() ); + Storable::DataToStream( theStr, "myEntity", myEntity ); + Storable::DataToStream( theStr, "myFieldName", myFieldName.c_str() ); + Storable::DataToStream( theStr, "myIteration", myIteration ); + + Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); + Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels ); + Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] ); + Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] ); + Storable::DataToStream( theStr, "myWidth", myWidth ); + Storable::DataToStream( theStr, "myHeight", myHeight ); + + Storable::DataToStream( theStr, "myTitFontType", myTitFontType ); + Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle ); + Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle ); + Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle ); + Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] ); + Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] ); + Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] ); + + Storable::DataToStream( theStr, "myLblFontType", myLblFontType ); + Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel ); + Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel ); + Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel ); + Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] ); + Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] ); + Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] ); +} + + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::DoHook() +{ + if(MYDEBUG) MESSAGE("ColoredPrs3d_i::DoHook() - "<GetMapper()->SetScalarVisibility(1); + } + myScalarMapPL = dynamic_cast(myPipeLine); +} + +//---------------------------------------------------------------------------- +VISU::Storable* +VISU::ColoredPrs3d_i +::Build(int theRestoring) +{ + if(MYDEBUG) + MESSAGE("ColoredPrs3d_i::Build - "<Init(); + if(!myIsFixedRange) myScalarMapPL->SetSourceRange(); + const VISU::TValField& aValField = myField->myValField; + const VISU::PValForTime aValForTime = aValField.find(myIteration)->second; + aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str()); + if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1(); + } + if(myAddToStudy){ + myName = GenerateName().latin1(); + aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", + VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp); + string aResultEntry = myResult->GetEntry(); + string aRefFatherEntry = myResult->GetRefFatherEntry(); + string anEntry = myResult->GetEntry(aComment.latin1()); + if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!"); + aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", + GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp); + CORBA::String_var anIOR = GetID(); + CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); + mySObject = myStudy->FindObjectIOR(anIOR); + } + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<CommitCommand(); + return this; +} + + +//---------------------------------------------------------------------------- +const VISU::PField& +VISU::ColoredPrs3d_i +::GetField() const +{ + return myField; +} + +const std::string& +VISU::ColoredPrs3d_i +::GetMeshName() const +{ + return myMeshName; +} + +VISU::Entity +VISU::ColoredPrs3d_i +::GetEntity() const +{ + return VISU::Entity(myEntity); +} + +const std::string& +VISU::ColoredPrs3d_i +::GetFieldName() const +{ + return myFieldName; +} + +int +VISU::ColoredPrs3d_i +::GetIteration() const +{ + return myIteration; +} + +VISU_ScalarMapPL* +VISU::ColoredPrs3d_i +::GetScalarMapPL() +{ + return myScalarMapPL; +} diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh new file mode 100644 index 00000000..57456253 --- /dev/null +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -0,0 +1,296 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 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. +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// File : VISU_PrsObject_i.hxx +// Author : Alexey PETROV +// Module : VISU + +#ifndef VISU_ColoredPrs3d_i_HeaderFile +#define VISU_ColoredPrs3d_i_HeaderFile + +#include "VISU_Prs3d_i.hh" + +class VISU_ScalarMapPL; + +namespace VISU +{ + //============================================================================ + class ColoredPrs3d_i : public virtual POA_VISU::ColoredPrd3d, + public virtual Prs3d_i + { + ColoredPrs3d_i(); + ColoredPrs3d_i(const ColoredPrs3d_i&); + public: + //---------------------------------------------------------------------------- + typedef Prs3d_i TSuperClass; + + explicit + ColoredPrs3d_i(Result_i* theResult, + bool theAddToStudy); + explicit + ColoredPrs3d_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject); + + virtual + ~ColoredPrs3d_i(); + + virtual + void + RemoveFromStudy(); + + //---------------------------------------------------------------------------- + virtual + CORBA::Long + GetScalarMode(); + + virtual + void + SetScalarMode(CORBA::Long theScalarMode); + + virtual + void + SetNbColors(CORBA::Long theNbColors); + + virtual + CORBA::Long + GetNbColors(); + + virtual + void + SetScalarBarOrientation(VISU::ColoredPrd3d::ScalarBarOrientation theOrientation); + + virtual + VISU::ColoredPrd3d::ScalarBarOrientation + GetScalarBarOrientation(); + + virtual + void + SetPosition(CORBA::Double X, CORBA::Double Y); + + virtual + CORBA::Double + GetPosX(); + + virtual + CORBA::Double + GetPosY(); + + virtual + void + SetSize(CORBA::Double theWidth, CORBA::Double theHeight); + + virtual + CORBA::Double + GetWidth(); + + virtual + CORBA::Double + GetHeight(); + + virtual + void + SetLabels(CORBA::Long theNbLabels); + + virtual + CORBA::Long + GetLabels(); + + virtual + void + SetTitle(const char* theName); + + virtual + char* + GetTitle(); + + //---------------------------------------------------------------------------- + protected: + VISU::ColoredPrd3d::ScalarBarOrientation myOrientation; + std::string myTitle; + int myNumberOfLabels; + float myPosition[2], myWidth, myHeight; + + public: + //---------------------------------------------------------------------------- + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration); + + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + + virtual + void + ToStream(std::ostringstream& theStr); + + virtual + void + SameAs(const ColoredPrs3d_i* theOrigin); + + /*! + * \brief Works like SameAs() method, but keep myIteration value unchanged. + * + * Is used in VISU_TimeAnimation class implementation. + */ + void + SameAsParams(const ColoredPrs3d_i* theOrigin); + + const VISU::PField& + GetField() const; + + const std::string& + GetMeshName() const; + + VISU::Entity + GetEntity() const; + + const std::string& + GetFieldName() const; + + int + GetIteration() const; + + VISU_ScalarMapPL* + GetScalarMapPL(); + + virtual + bool + IsBoldTitle(); + + virtual + void + SetBoldTitle(bool isBold); + + virtual + bool + IsItalicTitle(); + + virtual + void + SetItalicTitle(bool isItalic); + + virtual + bool + IsShadowTitle(); + + virtual + void + SetShadowTitle(bool isShadow); + + virtual + int + GetTitFontType(); + + virtual + void + SetTitFontType(int theType); + + virtual + void + GetTitleColor(float* theR, float* theG, float* theB); + + virtual + void + SetTitleColor(float theR, float theG, float theB); + + virtual + bool + IsBoldLabel(); + + virtual + void + SetBoldLabel(bool isBold); + + virtual + bool + IsItalicLabel(); + + virtual + void + SetItalicLabel(bool isItalic); + + virtual + bool + IsShadowLabel(); + + virtual + void + SetShadowLabel(bool isShadow); + + virtual + int + GetLblFontType(); + + virtual + void + SetLblFontType(int theType); + + virtual + void + GetLabelColor(float* theR, float* theG, float* theB); + + virtual + void + SetLabelColor(float theR, float theG, float theB); + + //---------------------------------------------------------------------------- + protected: + PField myField; + TEntity myEntity; + std::string myFieldName; + int myIteration; + + //Font management + bool myIsBoldTitle; + bool myIsItalicTitle; + bool myIsShadowTitle; + int myTitFontType; + float myTitleColor[3]; + + bool myIsBoldLabel; + bool myIsItalicLabel; + bool myIsShadowLabel; + int myLblFontType; + float myLabelColor[3]; + + VISU_ScalarMapPL* myScalarMapPL; + bool myIsFixedRange; + + virtual + void + DoSetInput(Result_i* theResult) = 0; + + Storable* + Build(int theRestoring); + + virtual + void + DoHook(); + }; + +} + +#endif diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 12a3e679..90eb9f0c 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -63,10 +63,10 @@ CutLines_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), myCutLinesPL(NULL) -{ -} +{} VISU::CutLines_i:: @@ -74,6 +74,7 @@ CutLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myCutLinesPL(NULL) { diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index 120cae90..cff4a1a2 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -58,10 +58,10 @@ CutPlanes_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), myCutPlanesPL(NULL) -{ -} +{} VISU::CutPlanes_i:: @@ -69,10 +69,10 @@ CutPlanes_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myCutPlanesPL(NULL) -{ -} +{} void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin){ diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 8ba69d30..ae4dbe45 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -69,6 +69,7 @@ DeformedShape_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), myDeformedShapePL(NULL) { @@ -81,6 +82,7 @@ DeformedShape_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myDeformedShapePL(NULL) { diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 6392349c..6be98763 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -25,6 +25,7 @@ // Module : #include "VISU_GaussPoints_i.hh" +#include "VISU_ScalarMap_i.hh" #include "VISU_Result_i.hh" #include "VISU_GaussPtsAct.h" @@ -97,10 +98,10 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- VISU::GaussPoints_i:: GaussPoints_i(Result_i* theResult, - bool theAddToStudy) : + bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), myGaussPointsPL(NULL), myIsColored(true), myColor(Qt::blue), @@ -117,7 +118,7 @@ GaussPoints_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), - ScalarMap_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), myGaussPointsPL(NULL), myIsColored(true), myColor(Qt::blue), @@ -131,10 +132,12 @@ GaussPoints_i(Result_i* theResult, //---------------------------------------------------------------------------- VISU::Storable* VISU::GaussPoints_i -::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration) { - VISU::ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); @@ -182,8 +185,9 @@ VISU::Storable* VISU::GaussPoints_i ::Restore(const Storable::TRestoringMap& theMap) { - DoHook(); - return VISU::ScalarMap_i::Restore(theMap); + TSuperClass::Restore(theMap); + + return this; } @@ -192,7 +196,7 @@ void VISU::GaussPoints_i ::ToStream(std::ostringstream& theStr) { - VISU::ScalarMap_i::ToStream(theStr); + TSuperClass::ToStream(theStr); } @@ -353,15 +357,16 @@ void VISU::GaussPoints_i ::DoSetInput(Result_i* theResult) { - if(theResult->GetInput() == NULL) + VISU::Result_i::TInput* anInput = theResult->GetInput(); + if(!anInput) throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!"); - myField = theResult->GetInput()->GetField(myMeshName,myEntity,myFieldName); - if(myField == NULL) + myField = anInput->GetField(myMeshName,myEntity,myFieldName); + if(!myField) throw std::runtime_error("There is no Field with the parameters !!!"); VISU::PGaussPtsIDMapper aGaussPtsIDMapper = - theResult->GetInput()->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration); + anInput->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration); if(!aGaussPtsIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); @@ -381,7 +386,7 @@ VISU::GaussPoints_i myGaussPointsPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::DoHook(); } @@ -406,7 +411,7 @@ VISU::GaussPoints_i const Handle(SALOME_InteractiveObject)& theIO) { try{ - VISU::Prs3d_i::CreateActor(theActor,theIO); + TSuperClass::CreateActor(theActor,theIO); theActor->GetPipeLine()->Delete(); theActor->SetRepresentation(VTK_POINTS); UpdateActor(theActor); @@ -459,8 +464,11 @@ VISU::GaussPoints_i } //---------------------------------------------------------------------------- -void VISU::GaussPoints_i::UpdateActor(VISU_Actor* theActor) +void +VISU::GaussPoints_i +::UpdateActor(VISU_Actor* theActor) { + TSuperClass::UpdateActor(theActor); if(VISU_GaussPtsAct* anActor = dynamic_cast(theActor)){ if(GetIsColored()){ anActor->SetBarVisibility(true); @@ -474,82 +482,62 @@ void VISU::GaussPoints_i::UpdateActor(VISU_Actor* theActor) myColor.green() / 255.0, myColor.blue() / 255.0); } - // - VISU_ScalarBarCtrl *aSBCtrl = anActor->GetScalarBarCtrl(); - // - // Ranges - float *pRange=myScalarMapPL->GetBarTable()->GetRange(); - // - - VISU::TField *pField=myField.get(); - vtkIdType aIndexOfComponent=(vtkIdType)GetScalarMode(); - TMinMax aTMinMax=pField->GetMinMax(aIndexOfComponent); - aSBCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); - - /* Stub for testing - { - float dR; - // - dR=0.5*(pRange[1]-pRange[0]); - aSBCtrl->SetRangeGlobal (pRange[0]-dR, pRange[1]+dR); - } - */ - aSBCtrl->SetRangeLocal (pRange); - aSBCtrl->SetOrientation(myOrientation); - // - // Mode - int iSBMode; - // - if (myIsActiveLocalScalarBar) { - iSBMode=1; - } - else { - if (myIsDispGlobalScalarBar) { - iSBMode=2; - } - else { - iSBMode=0; - aSBCtrl->SetRangeGlobal(pRange); + if(VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl()){ + vtkIdType aScalarMode = GetScalarMode(); + TMinMax aTMinMax = myField->GetMinMax(aScalarMode); + float *aRange = myScalarMapPL->GetBarTable()->GetRange(); + + aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); + aScalarBarCtrl->SetRangeLocal(aRange); + + aScalarBarCtrl->SetOrientation(myOrientation); + + int aScalarBarMode; + if(myIsActiveLocalScalarBar){ + aScalarBarMode = 1; + }else{ + if(myIsDispGlobalScalarBar){ + aScalarBarMode = 2; + }else{ + aScalarBarMode = 0; + aScalarBarCtrl->SetRangeGlobal(aRange); + } } - } - aSBCtrl->SetMode(iSBMode); - // - // Position - aSBCtrl->SetWidth(myWidth); - aSBCtrl->SetHeight(myHeight); - aSBCtrl->SetPosition(myPosition); - // - // Bicolor - bool bBicolor=GetGaussPointsPL()->GetBicolor(); - aSBCtrl->SetBicolor(bBicolor); - // - aSBCtrl->Update(); - // - for (int i=0; i<2; ++i) { - vtkScalarBarActor *aScalarBar = aSBCtrl->GetScalarBarActor(i); - - aScalarBar->SetTitle(myTitle.c_str()); + aScalarBarCtrl->SetMode(aScalarBarMode); - aScalarBar->SetNumberOfLabels(myNumberOfLabels); + // Position + aScalarBarCtrl->SetWidth(myWidth); + aScalarBarCtrl->SetHeight(myHeight); + aScalarBarCtrl->SetPosition(myPosition); + + // Bicolor + bool anIsBicolor = GetGaussPointsPL()->GetBicolor(); + aScalarBarCtrl->SetBicolor(anIsBicolor); + + aScalarBarCtrl->Update(); - vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); - aTitleProp->SetFontFamily(myTitFontType); - aTitleProp->SetColor(myTitleColor); - (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); - (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); - (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); + for(int i = 0; i < 2; ++i){ + vtkScalarBarActor *aScalarBar = aScalarBarCtrl->GetScalarBarActor(i); + aScalarBar->SetTitle(myTitle.c_str()); + aScalarBar->SetNumberOfLabels(myNumberOfLabels); - vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); - aLabelProp->SetFontFamily(myLblFontType); - aLabelProp->SetColor(myLabelColor); - (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); - (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); - (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); - - aScalarBar->Modified(); + vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); + aTitleProp->SetFontFamily(myTitFontType); + aTitleProp->SetColor(myTitleColor); + (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); + (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); + (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); + + vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); + aLabelProp->SetFontFamily(myLblFontType); + aLabelProp->SetColor(myLabelColor); + (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); + (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); + (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); + + aScalarBar->Modified(); + } } - // - VISU::ScalarMap_i::UpdateActor(theActor); } } @@ -597,19 +585,33 @@ VISU::GaussPoints_i anImageData->Delete(); } } + + //---------------------------------------------------------------------------- -void VISU::GaussPoints_i::SetIsActiveLocalScalarBar(const bool theFlag){ - myIsActiveLocalScalarBar=theFlag; +void +VISU::GaussPoints_i +::SetIsActiveLocalScalarBar(const bool theFlag) +{ + myIsActiveLocalScalarBar = theFlag; } -//---------------------------------------------------------------------------- -bool VISU::GaussPoints_i::GetIsActiveLocalScalarBar()const { + +bool +VISU::GaussPoints_i +::GetIsActiveLocalScalarBar() const +{ return myIsActiveLocalScalarBar; } -//---------------------------------------------------------------------------- -void VISU::GaussPoints_i::SetIsDispGlobalScalarBar(const bool theFlag){ + +void +VISU::GaussPoints_i +::SetIsDispGlobalScalarBar(const bool theFlag) +{ myIsDispGlobalScalarBar=theFlag; } -//---------------------------------------------------------------------------- -bool VISU::GaussPoints_i::GetIsDispGlobalScalarBar()const { + +bool +VISU::GaussPoints_i +::GetIsDispGlobalScalarBar() const +{ return myIsDispGlobalScalarBar; } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index f1a0a1f3..312c1c8d 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -27,7 +27,7 @@ #ifndef VISU_GaussPoints_i_HeaderFile #define VISU_GaussPoints_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_ColoredPrs3d_i.hh" #include "VISU_GaussPtsActorFactory.h" class VISU_GaussPointsPL; @@ -36,13 +36,16 @@ namespace VISU { class GaussPoints_i : public virtual POA_VISU::GaussPoints, public virtual VISU::TGaussPtsActorFactory, - public virtual ScalarMap_i + public virtual ColoredPrs3d_i { static int myNbPresent; GaussPoints_i(); GaussPoints_i(const GaussPoints_i&); public: + //---------------------------------------------------------------------------- + typedef ColoredPrs3d_i TSuperClass; + explicit GaussPoints_i(Result_i* theResult, bool theAddToStudy); diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 3895cc7e..2ea83ae0 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -56,10 +56,10 @@ IsoSurfaces_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), myIsoSurfacesPL(NULL) -{ -} +{} VISU::IsoSurfaces_i:: @@ -67,10 +67,10 @@ IsoSurfaces_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), myIsoSurfacesPL(NULL) -{ -} +{} void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) { diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 641afcb0..cb6dff61 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -29,21 +29,25 @@ QString VISU::Plot3D_i::GenerateName() { return VISU::GenerateName("Plot3D",myNb const string VISU::Plot3D_i::myComment = "PLOT3D"; const char* VISU::Plot3D_i::GetComment() const { return myComment.c_str(); } -VISU::Plot3D_i::Plot3D_i (Result_i* theResult, bool theAddToStudy) - : PrsObject_i(theResult->GetStudyDocument()), - Prs3d_i(theResult,theAddToStudy), - ScalarMap_i(theResult,theAddToStudy), - myPlot3DPL(NULL) -{ -} +VISU::Plot3D_i +::Plot3D_i(Result_i* theResult, + bool theAddToStudy) : + PrsObject_i(theResult->GetStudyDocument()), + Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), + ScalarMap_i(theResult,theAddToStudy), + myPlot3DPL(NULL) +{} -VISU::Plot3D_i::Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject) - : PrsObject_i(theResult->GetStudyDocument()), - Prs3d_i(theResult,theSObject), - ScalarMap_i(theResult,theSObject), - myPlot3DPL(NULL) -{ -} +VISU::Plot3D_i +::Plot3D_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject) : + PrsObject_i(theResult->GetStudyDocument()), + Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), + ScalarMap_i(theResult,theSObject), + myPlot3DPL(NULL) +{} void VISU::Plot3D_i::SameAs (const Plot3D_i* theOrigin) { diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 49a093b5..a2486ce2 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -49,7 +49,7 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- VISU::Prs3d_i ::Prs3d_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), mySObject(SALOMEDS::SObject::_duplicate(theSObject)), myActorCollection(vtkActorCollection::New()), @@ -65,7 +65,7 @@ VISU::Prs3d_i VISU::Prs3d_i ::Prs3d_i(Result_i* theResult, - bool theAddToStudy) : + bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), myActorCollection(vtkActorCollection::New()), mySObject(SALOMEDS::SObject::_nil()), diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 5fcedadf..66b1f09a 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -49,8 +49,14 @@ static int MYDEBUG = 0; static int INCMEMORY = 4; -int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) + +//============================================================================ +int +VISU::ScalarMap_i +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, int theIteration, int isMemoryCheck) { try{ float aSize = INCMEMORY* @@ -69,149 +75,94 @@ int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, return 0; } -int VISU::ScalarMap_i::myNbPresent = 0; -QString VISU::ScalarMap_i::GenerateName() { return VISU::GenerateName("ScalarMap",myNbPresent++);} +//---------------------------------------------------------------------------- +int +VISU::ScalarMap_i +::myNbPresent = 0; + +QString +VISU::ScalarMap_i +::GenerateName() +{ + return VISU::GenerateName("ScalarMap",myNbPresent++); +} + +const string +VISU::ScalarMap_i +::myComment = "SCALARMAP"; + +const char* +VISU::ScalarMap_i +::GetComment() const { + return myComment.c_str(); +} + -const string VISU::ScalarMap_i::myComment = "SCALARMAP"; -const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();} +//---------------------------------------------------------------------------- VISU::ScalarMap_i:: ScalarMap_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), - myScalarMapPL(NULL) -{ -} - + ColoredPrs3d_i(theResult,theAddToStudy) +{} VISU::ScalarMap_i:: ScalarMap_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), - myScalarMapPL(NULL) -{ -} - + ColoredPrs3d_i(theResult,theSObject) +{} -void VISU::ScalarMap_i::RemoveFromStudy() -{ - VISU::Prs3d_i::RemoveFromStudy(); - VISU::RemoveFromStudy(mySObject,false); -} +VISU::ScalarMap_i +::~ScalarMap_i() +{} -void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin) +//---------------------------------------------------------------------------- +void +VISU::ScalarMap_i +::SameAs(const ScalarMap_i* theOrigin) { - ScalarMap_i* aScalarMap = const_cast(theOrigin); - DoHook(); - VISU::Prs3d_i::SameAs(aScalarMap); - myField = aScalarMap->GetField(); - myMeshName = myField->myMeshName; - myEntity = myField->myEntity; - myIteration = aScalarMap->GetIteration(); - myFieldName = aScalarMap->GetFieldName(); - - SetScalarMode(aScalarMap->GetScalarMode()); - - SetRange(aScalarMap->GetMin(), aScalarMap->GetMax()); - myIsFixedRange = aScalarMap->IsRangeFixed(); - - SetScaling(aScalarMap->GetScaling()); - - SetBarOrientation(aScalarMap->GetBarOrientation()); - SetPosition(aScalarMap->GetPosX(), aScalarMap->GetPosY()); - SetSize(aScalarMap->GetWidth(), aScalarMap->GetHeight()); - SetNbColors(aScalarMap->GetNbColors()); - SetLabels(aScalarMap->GetLabels()); - SetTitle(aScalarMap->GetTitle()); - - SetBoldTitle(aScalarMap->IsBoldTitle()); - SetItalicTitle(aScalarMap->IsItalicTitle()); - SetShadowTitle(aScalarMap->IsShadowTitle()); - SetTitFontType(aScalarMap->GetTitFontType()); - float r,g,b; - aScalarMap->GetTitleColor(&r,&g,&b); - SetTitleColor(r,g,b); - - SetBoldLabel(aScalarMap->IsBoldLabel()); - SetItalicLabel(aScalarMap->IsItalicLabel()); - SetShadowLabel(aScalarMap->IsShadowLabel()); - SetLblFontType(aScalarMap->GetLblFontType()); - aScalarMap->GetLabelColor(&r,&g,&b); - SetLabelColor(r,g,b); + TSuperClass::SameAs(theOrigin); - Build(-1); - Update(); -} + ScalarMap_i* anOrigin = const_cast(theOrigin); + + SetRange(anOrigin->GetMin(), anOrigin->GetMax()); + myIsFixedRange = anOrigin->IsRangeFixed(); -void VISU::ScalarMap_i::SameAsParams (const ScalarMap_i* theOrigin) -{ - int time = GetIteration(); - SameAs(theOrigin); - myIteration = time; + SetScaling(anOrigin->GetScaling()); - //??Build(true); Build(-1); Update(); } +//---------------------------------------------------------------------------- /** * Creates Scalar Map and initialises it from resources */ -VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration) +VISU::Storable* +VISU::ScalarMap_i +::Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration) { - DoHook(); + TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0); - SetScalarMode(aScalarMode); - - // Orientation - int orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0); - if (orient == 1) - myOrientation = VISU::ScalarMap::HORIZONTAL; - else - myOrientation = VISU::ScalarMap::VERTICAL; - - // Scalar Bar origin - QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" ); - - float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2; - aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin); - myPosition[0] = aXorigin; - - float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012; - aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin); - myPosition[1] = aYorigin; - - // Scalar Bar size - myWidth = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.1 : 0.6; - myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth); - - myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12; - myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight); - - // Nb of Colors - int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 ); - SetNbColors(aNumberOfColors); - - // Nb of Labels - myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 ); - // Scalar Range - int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); - myIsFixedRange = (rangeType == 1) ? true : false; - - if (myIsFixedRange) - { - float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0); - float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); - SetRange(aMin,aMax); - } + int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); + myIsFixedRange = (aRangeType == 1) ? true : false; + + if(myIsFixedRange){ + float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0); + float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); + SetRange(aMin,aMax); + } bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false); @@ -220,253 +171,109 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity else SetScaling(VISU::LINEAR); - // Fonts properties definition - myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true; - myTitFontType = VTK_ARIAL; - - if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) ) - { - QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" ); - - if ( f.family() == "Arial" ) - myTitFontType = VTK_ARIAL; - else if ( f.family() == "Courier" ) - myTitFontType = VTK_COURIER; - else if ( f.family() == "Times" ) - myTitFontType = VTK_TIMES; - - myIsBoldTitle = f.bold(); - myIsItalicTitle = f.italic(); - myIsShadowTitle = f.underline(); - } - - QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) ); - - myTitleColor[0] = aTextColor.red() / 255; - myTitleColor[1] = aTextColor.green() / 255; - myTitleColor[2] = aTextColor.blue() / 255; - - /// - - myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true; - myLblFontType = VTK_ARIAL; - - if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) ) - { - QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" ); - - if ( f.family() == "Arial" ) - myLblFontType = VTK_ARIAL; - else if ( f.family() == "Courier" ) - myLblFontType = VTK_COURIER; - else if ( f.family() == "Times" ) - myLblFontType = VTK_TIMES; - - myIsBoldLabel = f.bold(); - myIsItalicLabel = f.italic(); - myIsShadowLabel = f.underline(); - } - - QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) ); - - myLabelColor[0] = aLabelColor.red() / 255; - myLabelColor[1] = aLabelColor.green() / 255; - myLabelColor[2] = aLabelColor.blue() / 255; - - - myMeshName = theMeshName; - myEntity = (VISU::TEntity)theEntity; - myFieldName =theFieldName; - myIteration = theIteration; - - return Build(false); + return this; } - -VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap) +VISU::Storable* +VISU::ScalarMap_i +::Restore(const Storable::TRestoringMap& theMap) { - DoHook(); - myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1(); - myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt(); - myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1(); - myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt(); + TSuperClass::Restore(theMap); - SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt()); SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt())); + float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble(); float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble(); SetRange(aMin,aMax); + myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt(); - myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1(); - myOrientation = (VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt(); - SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt()); - myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt(); - myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble(); - myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble(); - myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble(); - myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble(); - - myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt(); - myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt(); - myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt(); - myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt(); - myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat(); - myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat(); - myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat(); - - myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt(); - myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt(); - myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt(); - myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt(); - myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat(); - myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat(); - myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat(); - - Prs3d_i::Restore(theMap); - myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study. - return Build(true); + return this; } +void +VISU::ScalarMap_i +::ToStream(std::ostringstream& theStr) +{ + TSuperClass::ToStream(theStr); -void VISU::ScalarMap_i::ToStream(std::ostringstream& theStr){ - Prs3d_i::ToStream(theStr); - - Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() ); - Storable::DataToStream( theStr, "myEntity", myEntity ); - Storable::DataToStream( theStr, "myFieldName", myFieldName.c_str() ); - Storable::DataToStream( theStr, "myIteration", myIteration ); - - Storable::DataToStream( theStr, "myScalarMode", int(GetScalarMode()) ); Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() ); Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() ); Storable::DataToStream( theStr, "myIsFixedRange", myIsFixedRange ); Storable::DataToStream( theStr, "myScaling", GetScaling() ); - - Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); - Storable::DataToStream( theStr, "myOrientation", myOrientation ); - Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) ); - Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels ); - Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] ); - Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] ); - Storable::DataToStream( theStr, "myWidth", myWidth ); - Storable::DataToStream( theStr, "myHeight", myHeight ); - - Storable::DataToStream( theStr, "myTitFontType", myTitFontType ); - Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle ); - Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle ); - Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle ); - Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] ); - Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] ); - Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] ); - - Storable::DataToStream( theStr, "myLblFontType", myLblFontType ); - Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel ); - Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel ); - Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel ); - Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] ); - Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] ); - Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] ); } -CORBA::Long VISU::ScalarMap_i::GetScalarMode(){ - return myScalarMapPL->GetScalarMode(); -} -void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode) { - myScalarMapPL->SetScalarMode(theScalarMode); +//---------------------------------------------------------------------------- +void +VISU::ScalarMap_i +::SetBarOrientation(VISU::ScalarMap::Orientation theOrientation) +{ + SetScalarBarOrientation((VISU::ColoredPrd3d::ScalarBarOrientation)theOrientation); } +VISU::ScalarMap::Orientation +VISU::ScalarMap_i +::GetBarOrientation() +{ + return (VISU::ScalarMap::Orientation)GetScalarBarOrientation(); +} -VISU::Scaling VISU::ScalarMap_i::GetScaling(){ +VISU::Scaling +VISU::ScalarMap_i +::GetScaling() +{ return VISU::Scaling(myScalarMapPL->GetScaling()); } -void VISU::ScalarMap_i::SetScaling(VISU::Scaling theScaling){ + +void +VISU::ScalarMap_i +::SetScaling(VISU::Scaling theScaling) +{ myScalarMapPL->SetScaling(theScaling); } - -void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax){ - if(theMin > theMax) return; +void +VISU::ScalarMap_i +::SetRange(CORBA::Double theMin, CORBA::Double theMax) +{ + if(theMin > theMax) + return; float aScalarRange[2] = {theMin, theMax}; myScalarMapPL->SetScalarRange(aScalarRange); myIsFixedRange = true; } -CORBA::Double VISU::ScalarMap_i::GetMin(){ +CORBA::Double +VISU::ScalarMap_i +::GetMin() +{ return myScalarMapPL->GetScalarRange()[0]; } -CORBA::Double VISU::ScalarMap_i::GetMax(){ +CORBA::Double +VISU::ScalarMap_i +::GetMax() +{ return myScalarMapPL->GetScalarRange()[1]; } -void VISU::ScalarMap_i::SetNbColors(CORBA::Long theNbColors){ - myScalarMapPL->SetNbColors(theNbColors); -} - -CORBA::Long VISU::ScalarMap_i::GetNbColors(){ - return myScalarMapPL->GetNbColors(); -} - - -VISU::ScalarMap_i::~ScalarMap_i(){} - - -VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){ - if(MYDEBUG) - MESSAGE("ScalarMap_i::Build - "<Init(); - if(!myIsFixedRange) myScalarMapPL->SetSourceRange(); - const VISU::TValField& aValField = myField->myValField; - const VISU::PValForTime aValForTime = aValField.find(myIteration)->second; - aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str()); - if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1(); - } - if(myAddToStudy){ - myName = GenerateName().latin1(); - aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", - VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp); - string aResultEntry = myResult->GetEntry(); - string aRefFatherEntry = myResult->GetRefFatherEntry(); - string anEntry = myResult->GetEntry(aComment.latin1()); - if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!"); - aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d", - GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp); - CORBA::String_var anIOR = GetID(); - CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); - mySObject = myStudy->FindObjectIOR(anIOR); - } - }catch(std::exception& exc){ - INFOS("Follow exception was occured :\n"<CommitCommand(); - return this; -} - - -void VISU::ScalarMap_i::DoSetInput(Result_i* theResult){ - if(theResult->GetInput() == NULL) +//---------------------------------------------------------------------------- +void +VISU::ScalarMap_i +::DoSetInput(Result_i* theResult) +{ + VISU::Result_i::TInput* anInput = theResult->GetInput(); + if(!anInput) throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!"); - myField = theResult->GetInput()->GetField(myMeshName,myEntity,myFieldName); - if(myField == NULL) + myField = anInput->GetField(myMeshName,myEntity,myFieldName); + if(!myField) throw std::runtime_error("There is no Field with the parameters !!!"); VISU::PIDMapper anIDMapper = - theResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration); + anInput->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration); if(!anIDMapper) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); @@ -475,31 +282,45 @@ void VISU::ScalarMap_i::DoSetInput(Result_i* theResult){ myScalarMapPL->Build(); } +void +VISU::ScalarMap_i +::Update() +{ + TSuperClass::Update(); +} + -void VISU::ScalarMap_i::DoHook(){ - if(MYDEBUG) MESSAGE("ScalarMap_i::DoHook() - "<GetMapper()->SetScalarVisibility(1); - } - myScalarMapPL = dynamic_cast(myPipeLine); +//---------------------------------------------------------------------------- +void +VISU::ScalarMap_i +::SetMapScale(double theMapScale) +{ + myScalarMapPL->SetMapScale(theMapScale); } -void VISU::ScalarMap_i::Update() { - VISU::Prs3d_i::Update(); +bool +VISU::ScalarMap_i +::IsRangeFixed() +{ + return myIsFixedRange; } -void VISU::ScalarMap_i::SetMapScale(double theMapScale){ - myScalarMapPL->SetMapScale(theMapScale); +void +VISU::ScalarMap_i +::SetSourceRange() +{ + myScalarMapPL->SetSourceRange(); + myIsFixedRange = false; } +//---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New(); try{ - VISU::Prs3d_i::CreateActor(anActor,theIO); + TSuperClass::CreateActor(anActor,theIO); anActor->SetBarVisibility(true); anActor->SetRepresentation(2); UpdateActor(anActor); @@ -510,9 +331,12 @@ VISU::ScalarMap_i return anActor; } -void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) { +void +VISU::ScalarMap_i +::UpdateActor(VISU_Actor* theActor) +{ + TSuperClass::UpdateActor(theActor); if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ - VISU::Prs3d_i::UpdateActor(theActor); VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar(); aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable()); aScalarBar->SetTitle(myTitle.c_str()); @@ -540,9 +364,3 @@ void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) { aScalarBar->Modified(); } } - - -void VISU::ScalarMap_i::SetSourceRange(){ - myScalarMapPL->SetSourceRange(); - myIsFixedRange = false; -} diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 60e666ae..acdf7af3 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -27,180 +27,142 @@ #ifndef VISU_ScalarMap_i_HeaderFile #define VISU_ScalarMap_i_HeaderFile -#include "VISU_Prs3d_i.hh" +#include "VISU_ColoredPrs3d_i.hh" -class VISU_ScalarMapPL; -namespace VISU{ +namespace VISU +{ + //============================================================================ class ScalarMap_i : public virtual POA_VISU::ScalarMap, - public virtual Prs3d_i + public virtual ColoredPrs3d_i { static int myNbPresent; ScalarMap_i(); ScalarMap_i(const ScalarMap_i&); public: + //---------------------------------------------------------------------------- + typedef ColoredPrs3d_i TSuperClass; + explicit ScalarMap_i(Result_i* theResult, bool theAddToStudy); explicit ScalarMap_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual void SameAs(const ScalarMap_i* theOrigin); - virtual ~ScalarMap_i(); - virtual void RemoveFromStudy(); - - virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;}; - - virtual CORBA::Long GetScalarMode(); - virtual void SetScalarMode(CORBA::Long theScalarMode); - - virtual VISU::Scaling GetScaling(); - virtual void SetScaling(VISU::Scaling theScaling); - - virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax); - virtual CORBA::Double GetMin(); - virtual CORBA::Double GetMax(); - - virtual void SetNbColors(CORBA::Long theNbColors); - virtual CORBA::Long GetNbColors(); - - virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){ - myOrientation = theOrientation; + virtual + ~ScalarMap_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TSCALARMAP; } - virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;} - - virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;} - virtual CORBA::Double GetPosX() { return myPosition[0];} - virtual CORBA::Double GetPosY() { return myPosition[1];} - - virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) { - myWidth = theWidth; myHeight = theHeight; - } - virtual CORBA::Double GetWidth() { return myWidth;} - virtual CORBA::Double GetHeight() { return myHeight;} - - virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;} - virtual CORBA::Long GetLabels() { return myNumberOfLabels;} - - virtual void SetTitle(const char* theName) { myTitle = theName;} - virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());} - - virtual bool IsBoldTitle() { return myIsBoldTitle;} - virtual void SetBoldTitle(bool isBold) { myIsBoldTitle = isBold;} - - virtual bool IsItalicTitle() { return myIsItalicTitle;} - virtual void SetItalicTitle(bool isItalic) { myIsItalicTitle = isItalic;} - virtual bool IsShadowTitle() { return myIsShadowTitle;} - virtual void SetShadowTitle(bool isShadow) { myIsShadowTitle = isShadow;} - - virtual int GetTitFontType() { return myTitFontType;} - virtual void SetTitFontType(int theType) { myTitFontType = theType;} + virtual + VISU::Scaling + GetScaling(); - virtual void GetTitleColor(float* theR, float* theG, float* theB) - {*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];} - virtual void SetTitleColor(float theR, float theG, float theB) - {myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; } + virtual + void + SetScaling(VISU::Scaling theScaling); - ///// - virtual bool IsBoldLabel() { return myIsBoldLabel;} - virtual void SetBoldLabel(bool isBold) { myIsBoldLabel = isBold;} + virtual + void + SetRange(CORBA::Double theMin, CORBA::Double theMax); - virtual bool IsItalicLabel() { return myIsItalicLabel;} - virtual void SetItalicLabel(bool isItalic) { myIsItalicLabel = isItalic;} + virtual + CORBA::Double + GetMin(); - virtual bool IsShadowLabel() { return myIsShadowLabel;} - virtual void SetShadowLabel(bool isShadow) {myIsShadowLabel = isShadow;} + virtual + CORBA::Double + GetMax(); - virtual int GetLblFontType() { return myLblFontType;} - virtual void SetLblFontType(int theType) { myLblFontType = theType;} + // To provide backward compatibility + virtual + void + SetBarOrientation(VISU::ScalarMap::Orientation theOrientation); - virtual void GetLabelColor(float* theR, float* theG, float* theB) - {*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];} - virtual void SetLabelColor(float theR, float theG, float theB) - {myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; } + virtual + VISU::ScalarMap::Orientation + GetBarOrientation(); typedef VISU::ScalarMap TInterface; - VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;} - - /*! - * \brief Works like SameAs() method, but keep myIteration value unchanged. - * - * Is used in VISU_TimeAnimation class implementation. - */ - void SameAsParams (const ScalarMap_i* theOrigin); protected: - Storable* Build(int theRestoring); - virtual void DoSetInput(Result_i* theResult); - virtual void DoHook(); - - VISU_ScalarMapPL* myScalarMapPL; - PField myField; - - // std::string myMeshName; move it to Prs3d_i - TEntity myEntity; - std::string myFieldName; - int myIteration; - - bool myIsFixedRange; - - std::string myTitle; - int myNumberOfLabels; - float myPosition[2], myWidth, myHeight; - VISU::ScalarMap::Orientation myOrientation; - - //Font management - bool myIsBoldTitle; - bool myIsItalicTitle; - bool myIsShadowTitle; - int myTitFontType; - float myTitleColor[3]; - - bool myIsBoldLabel; - bool myIsItalicLabel; - bool myIsShadowLabel; - int myLblFontType; - float myLabelColor[3]; + virtual + void + DoSetInput(Result_i* theResult); public: - static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck = true); - virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration); - - const std::string& GetMeshName() const { return myMeshName;} - VISU::Entity GetEntity() const { return VISU::Entity(myEntity);} - const string& GetFieldName() const { return myFieldName;} - int GetIteration() const { return myIteration;} + static + int + IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration, + int isMemoryCheck = true); + virtual + Storable* + Create(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration); - virtual void ToStream(std::ostringstream& theStr); + virtual + void + ToStream(std::ostringstream& theStr); static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); - virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual + const char* + GetComment() const; - static Storable* Restore(SALOMEDS::SObject_ptr theSObject, - const std::string& thePrefix, const Storable::TRestoringMap& theMap); + virtual + QString + GenerateName(); - virtual void Update() ; - virtual void SetMapScale(double theMapScale = 1.0); + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + + static + Storable* + Restore(SALOMEDS::SObject_ptr theSObject, + const std::string& thePrefix, + const Storable::TRestoringMap& theMap); + + virtual + void + Update() ; - const VISU::PField GetField() const { return myField;} + virtual + void + SetMapScale(double theMapScale = 1.0); - virtual bool IsRangeFixed() { return myIsFixedRange; } - virtual void SetSourceRange(); + virtual + bool + IsRangeFixed(); - virtual int GetIteration() { return myIteration; } + virtual + void + SetSourceRange(); + + virtual + void + SameAs(const ScalarMap_i* theOrigin); virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); - virtual void UpdateActor(VISU_Actor* theActor) ; + virtual + void + UpdateActor(VISU_Actor* theActor); }; } diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index b5ae48a8..0ccf6dec 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -79,6 +79,7 @@ StreamLines_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), myStreamLinesPL(NULL), @@ -92,6 +93,7 @@ StreamLines_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), myStreamLinesPL(NULL), diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index db8b2648..26218a0b 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -76,6 +76,7 @@ Vectors_i(Result_i* theResult, bool theAddToStudy) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), myVectorsPL(NULL) @@ -88,6 +89,7 @@ Vectors_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), myVectorsPL(NULL) -- 2.39.2