1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 #include "VISU_GaussPoints_i.hh"
28 #include "VISU_ScalarMap_i.hh"
29 #include "VISU_Prs3dUtils.hh"
31 #include "VISU_Result_i.hh"
32 #include "VISU_GaussPtsAct.h"
33 #include "VISU_GaussPointsPL.hxx"
34 #include "VISU_GaussPtsDeviceActor.h"
36 #include "VISU_OpenGLPointSpriteMapper.hxx"
37 #include "VISU_ScalarBarCtrl.hxx"
38 #include <VISU_ScalarBarActor.hxx>
39 #include "VISU_LookupTable.hxx"
40 #include "VISU_Convertor.hxx"
42 #include "SUIT_ResourceMgr.h"
44 #include "VISU_PipeLineUtils.hxx"
46 #include <vtkImageData.h>
47 #include <vtkXMLImageDataReader.h>
48 #include <vtkTextProperty.h>
49 #include <vtkProperty.h>
52 static int MYDEBUG = 0;
54 static int MYDEBUG = 0;
57 static int INCMEMORY = 10;
59 //----------------------------------------------------------------------------
62 ::IsPossible(Result_i* theResult,
63 const std::string& theMeshName,
64 VISU::Entity theEntity,
65 const std::string& theFieldName,
66 CORBA::Long theTimeStampNumber,
67 bool theIsMemoryCheck)
70 if(theEntity == VISU::NODE)
73 bool anIsEstimated = true;
74 VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName,
78 size_t aSize = anInput->GetTimeStampOnGaussPtsSize(theMeshName,
79 VISU::TEntity(theEntity),
87 aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
89 MESSAGE("GaussPoints_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
91 }catch(std::exception& exc){
92 INFOS("Follow exception was occured :\n"<<exc.what());
94 INFOS("Unknown exception was occured!");
99 //----------------------------------------------------------------------------
100 int VISU::GaussPoints_i::myNbPresent = 0;
106 return VISU::GenerateName("Gauss Points",myNbPresent++);
109 //----------------------------------------------------------------------------
110 const string VISU::GaussPoints_i::myComment = "GAUSSPOINTS";
116 return myComment.c_str();
120 //---------------------------------------------------------------
125 return "ICON_TREE_GAUSS_POINTS";
129 //----------------------------------------------------------------------------
131 ::GaussPoints_i(EPublishInStudyMode thePublishInStudyMode) :
132 ColoredPrs3d_i(thePublishInStudyMode),
133 myGaussPointsPL(NULL),
135 myIsActiveLocalScalarBar(true),
136 myIsDispGlobalScalarBar(true),
140 if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
144 //----------------------------------------------------------------------------
147 ::Create(const std::string& theMeshName,
148 VISU::Entity theEntity,
149 const std::string& theFieldName,
150 CORBA::Long theTimeStampNumber)
152 TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber);
154 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
156 int anActiveLocal = aResourceMgr->integerValue( "VISU", "scalar_bar_active_local", GetIsActiveLocalScalarBar() );
157 SetIsActiveLocalScalarBar( anActiveLocal == 0 );
159 bool aDisplayGlobal = aResourceMgr->booleanValue( "VISU", "scalar_bar_diplay_global", GetIsDispGlobalScalarBar() );
160 SetIsDispGlobalScalarBar( aDisplayGlobal );
162 int aBicolor = aResourceMgr->integerValue( "VISU", "scalar_bar_bicolor", GetBiColor() );
163 SetBiColor( aBicolor == 0 );
165 vtkFloatingPointType aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() );
166 SetSpacing( aSpacing );
168 vtkFloatingPointType aScaleFactor = aResourceMgr->doubleValue( "VISU", "deformed_shape_scale_factor", GetScaleFactor() );
169 SetScaleFactor( aScaleFactor );
171 int aPrimitiveType = aResourceMgr->integerValue( "VISU", "point_sprite_primitive_type", GetPrimitiveType() );
172 SetPrimitiveType( VISU::GaussPoints::PrimitiveType(aPrimitiveType) );
174 vtkFloatingPointType aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() );
177 int aMinSize = aResourceMgr->integerValue( "VISU", "point_sprite_min_size", ( int )( GetMinSize() * 100.0 ) );
178 SetMinSize( aMinSize / 100.0 );
180 int aMaxSize = aResourceMgr->integerValue( "VISU", "point_sprite_max_size", ( int )( GetMaxSize() * 100.0 ) );
181 SetMaxSize( aMaxSize / 100.0 );
183 int aGeomSize = aResourceMgr->integerValue( "VISU", "point_sprite_size", ( int )( GetGeomSize() * 100.0 ) );
184 SetGeomSize( aGeomSize / 100.0 );
186 int aMagnification = aResourceMgr->integerValue( "VISU", "point_sprite_magnification", ( int )( GetMagnification() * 100.0 ) );
187 SetMagnification( aMagnification / 100.0 );
189 vtkFloatingPointType anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() );
190 SetMagnificationIncrement( anIncrement );
192 bool isColored = aResourceMgr->booleanValue( "VISU", "point_sprite_results", GetIsColored() );
193 SetIsColored( isColored );
195 QColor aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", GetQColor() );
198 vtkFloatingPointType anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() );
199 SetAlphaThreshold( anAlphaThreshold );
201 int aResolution = aResourceMgr->integerValue( "VISU", "geom_sphere_resolution", GetResolution() );
202 SetResolution( aResolution );
204 int aFaceLimit = aResourceMgr->integerValue( "VISU", "geom_sphere_face_limit", GetFaceLimit() );
205 SetFaceLimit( aFaceLimit );
207 QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_texture.bmp";
208 aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture );
210 QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/visu/sprite_alpha.bmp";
211 anAlphaTexture = aResourceMgr->stringValue( "VISU", "point_sprite_alpha_texture", anAlphaTexture );
213 SetTextures( aMainTexture, anAlphaTexture );
219 //---------------------------------------------------------------
222 ::SameAs(const Prs3d_i* theOrigin)
224 TSuperClass::SameAs(theOrigin);
226 if(const GaussPoints_i* aPrs3d = dynamic_cast<const GaussPoints_i*>(theOrigin)){
227 GaussPoints_i* anOrigin = const_cast<GaussPoints_i*>(aPrs3d);
229 SetIsActiveLocalScalarBar(anOrigin->GetIsActiveLocalScalarBar());
230 SetIsDispGlobalScalarBar(anOrigin->GetIsDispGlobalScalarBar());
232 SetSpacing(anOrigin->GetSpacing());
234 SetFaceLimit(anOrigin->GetFaceLimit());
236 SetColor(anOrigin->GetColor());
238 SetTextures(anOrigin->GetMainTexture(), anOrigin->GetAlphaTexture());
242 //----------------------------------------------------------------------------
247 return TSuperClass::GetMemorySize();
250 //----------------------------------------------------------------------------
253 ::Restore(SALOMEDS::SObject_ptr theSObject,
254 const Storable::TRestoringMap& theMap)
256 if(!TSuperClass::Restore(theSObject, theMap))
259 // Check if the icon needs to be updated, update if necessary
260 SALOMEDS::Study_var aStudy = theSObject->GetStudy();
261 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
262 SALOMEDS::GenericAttribute_var anAttr =
263 aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributePixMap");
264 SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
266 CORBA::String_var aPixMapName = aPixmap->GetPixMap();
267 if(strcmp(GetIconName(), aPixMapName.in()) != 0)
268 aPixmap->SetPixMap(GetIconName());
270 SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt());
271 SetIsDispGlobalScalarBar(Storable::FindValue(theMap,"myIsDispGlobalScalarBar").toInt());
272 SetBiColor(Storable::FindValue(theMap,"myIsBiColor").toInt());
273 SetSpacing(Storable::FindValue(theMap,"mySpacing").toDouble());
275 int aPrimitiveType = Storable::FindValue(theMap,"myPrimitiveType").toInt();
276 SetPrimitiveType(VISU::GaussPoints::PrimitiveType(aPrimitiveType));
277 SetClamp(Storable::FindValue(theMap,"myClamp").toDouble());
278 SetMinSize(Storable::FindValue(theMap,"myMinSize").toDouble());
279 SetMaxSize(Storable::FindValue(theMap,"myMaxSize").toDouble());
280 SetGeomSize(Storable::FindValue(theMap,"myGeomSize").toDouble());
282 SetMagnification(Storable::FindValue(theMap,"myMagnification").toDouble());
283 SetMagnificationIncrement(Storable::FindValue(theMap,"myMagnificationIncrement").toDouble());
285 SetIsDeformed(Storable::FindValue(theMap,"myIsDeformed").toInt());
286 SetScaleFactor(Storable::FindValue(theMap,"myScaleFactor").toDouble());
288 SetFaceLimit(Storable::FindValue(theMap,"myFaceLimit").toInt());
290 SetIsColored(Storable::FindValue(theMap,"myIsColored").toInt());
291 int aRed = Storable::FindValue(theMap,"myColor.R").toInt();
292 int aGreen = Storable::FindValue(theMap,"myColor.G").toInt();
293 int aBlue = Storable::FindValue(theMap,"myColor.B").toInt();
294 SetQColor( QColor(aRed, aGreen, aBlue) );
296 SetAlphaThreshold(Storable::FindValue(theMap,"myAlphaThreshold").toDouble());
298 SetTextures( Storable::FindValue(theMap,"myMainTexture"),
299 Storable::FindValue(theMap,"myAlphaTexture") );
301 SetResolution(Storable::FindValue(theMap,"myResolution").toInt());
307 //----------------------------------------------------------------------------
310 ::ToStream(std::ostringstream& theStr)
312 TSuperClass::ToStream(theStr);
314 Storable::DataToStream( theStr, "myIsActiveLocalScalarBar", myIsActiveLocalScalarBar );
315 Storable::DataToStream( theStr, "myIsDispGlobalScalarBar", myIsDispGlobalScalarBar );
316 Storable::DataToStream( theStr, "myIsBiColor", GetBiColor() );
317 Storable::DataToStream( theStr, "mySpacing", GetSpacing() );
319 Storable::DataToStream( theStr, "myPrimitiveType", GetPrimitiveType() );
320 Storable::DataToStream( theStr, "myClamp", GetClamp() );
321 Storable::DataToStream( theStr, "myMinSize", GetMinSize() );
322 Storable::DataToStream( theStr, "myMaxSize", GetMaxSize() );
323 Storable::DataToStream( theStr, "myGeomSize", GetGeomSize() );
325 Storable::DataToStream( theStr, "myMagnification", GetMagnification() );
326 Storable::DataToStream( theStr, "myMagnificationIncrement", GetMagnificationIncrement() );
328 Storable::DataToStream( theStr, "myIsDeformed", GetIsDeformed() );
329 Storable::DataToStream( theStr, "myScaleFactor", GetScaleFactor() );
331 Storable::DataToStream( theStr, "myFaceLimit", GetFaceLimit() );
333 Storable::DataToStream( theStr, "myIsColored", GetIsColored() );
334 QColor aColor = GetQColor();
335 Storable::DataToStream( theStr, "myColor.R", aColor.red() );
336 Storable::DataToStream( theStr, "myColor.G", aColor.green() );
337 Storable::DataToStream( theStr, "myColor.B", aColor.blue() );
339 Storable::DataToStream( theStr, "myAlphaThreshold", GetAlphaThreshold() );
340 Storable::DataToStream( theStr, "myMainTexture", GetQMainTexture() );
341 Storable::DataToStream( theStr, "myAlphaTexture", GetQAlphaTexture() );
343 Storable::DataToStream( theStr, "myResolution", GetResolution() );
350 if(MYDEBUG) MESSAGE("GaussPoints_i::~GaussPoints_i() - this = "<<this);
354 //----------------------------------------------------------------------------
362 //----------------------------------------------------------------------------
365 ::SetFaceLimit( CORBA::Long theFaceLimit )
367 if( myFaceLimit == theFaceLimit )
370 VISU::TSetModified aModified(this);
372 myFaceLimit = theFaceLimit;
373 myParamsTime.Modified();
376 //----------------------------------------------------------------------------
379 ::SetIsDeformed( CORBA::Boolean theIsDeformed )
381 VISU::TSetModified aModified(this);
383 myGaussPointsPL->SetIsDeformed( theIsDeformed );
390 return myGaussPointsPL->GetIsDeformed();
393 //----------------------------------------------------------------------------
396 ::SetScaleFactor( CORBA::Double theScaleFactor )
398 VISU::TSetModified aModified(this);
400 myGaussPointsPL->SetScale( theScaleFactor );
407 return myGaussPointsPL->GetScale();
410 //----------------------------------------------------------------------------
422 SALOMEDS::Color aColor;
423 aColor.R = myColor.red();
424 aColor.G = myColor.green();
425 aColor.B = myColor.blue();
430 //----------------------------------------------------------------------------
433 ::SetQColor( const QColor& theColor )
435 if(myColor == theColor)
438 VISU::TSetModified aModified(this);
441 myParamsTime.Modified();
446 ::SetColor( const SALOMEDS::Color& theColor )
448 SetQColor(QColor(int(theColor.R), int(theColor.G), int(theColor.B)));
452 //----------------------------------------------------------------------------
455 ::SetIsColored( bool theIsColored )
457 VISU::TSetModified aModified(this);
459 myGaussPointsPL->SetIsColored( theIsColored );
466 return myGaussPointsPL->GetIsColored();
469 //----------------------------------------------------------------------------
472 ::SetMainTexture( const QString& theMainTexture )
474 if(myMainTexture != theMainTexture){
475 VISU::TSetModified aModified(this);
477 myMainTexture = theMainTexture;
478 myParamsTime.Modified();
489 return myMainTexture;
496 return CORBA::string_dup(myMainTexture.latin1());
500 //----------------------------------------------------------------------------
503 ::SetAlphaTexture( const QString& theAlphaTexture )
505 if(myAlphaTexture != theAlphaTexture){
506 VISU::TSetModified aModified(this);
508 myAlphaTexture = theAlphaTexture;
509 myParamsTime.Modified();
520 return myAlphaTexture;
527 return CORBA::string_dup(myAlphaTexture.latin1());
531 //----------------------------------------------------------------------------
534 ::SetAlphaThreshold( CORBA::Double theAlphaThreshold )
536 VISU::TSetModified aModified(this);
538 myGaussPointsPL->SetAlphaThreshold( theAlphaThreshold );
543 ::GetAlphaThreshold()
545 return myGaussPointsPL->GetAlphaThreshold();
548 //----------------------------------------------------------------------------
551 ::SetResolution( CORBA::Long theResolution )
553 VISU::TSetModified aModified(this);
555 myGaussPointsPL->SetResolution( theResolution );
562 return myGaussPointsPL->GetResolution();
565 //----------------------------------------------------------------------------
568 ::SetPrimitiveType(VISU::GaussPoints::PrimitiveType thePrimitiveType)
570 VISU::TSetModified aModified(this);
572 myGaussPointsPL->SetPrimitiveType( thePrimitiveType );
575 VISU::GaussPoints::PrimitiveType
579 int aPrimitiveType = myGaussPointsPL->GetPrimitiveType();
581 if(aPrimitiveType == VISU_OpenGLPointSpriteMapper::OpenGLPoint)
582 return VISU::GaussPoints::POINT;
584 if(aPrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere)
585 return VISU::GaussPoints::SPHERE;
587 return VISU::GaussPoints::SPRITE;
590 //----------------------------------------------------------------------------
593 ::GetMaximumSupportedSize()
595 return myGaussPointsPL->GetMaximumSupportedSize();
598 //----------------------------------------------------------------------------
601 ::SetClamp(CORBA::Double theClamp)
603 VISU::TSetModified aModified(this);
605 myGaussPointsPL->SetClamp( theClamp );
612 return myGaussPointsPL->GetClamp();
615 //----------------------------------------------------------------------------
618 ::SetGeomSize( CORBA::Double theGeomSize )
620 VISU::TSetModified aModified(this);
622 myGaussPointsPL->SetSize( theGeomSize );
629 return myGaussPointsPL->GetSize();
632 //----------------------------------------------------------------------------
635 ::SetMinSize( CORBA::Double theMinSize )
637 VISU::TSetModified aModified(this);
639 myGaussPointsPL->SetMinSize( theMinSize );
646 return myGaussPointsPL->GetMinSize();
649 //----------------------------------------------------------------------------
652 ::SetMaxSize( CORBA::Double theMaxSize )
654 VISU::TSetModified aModified(this);
656 myGaussPointsPL->SetMaxSize( theMaxSize );
663 return myGaussPointsPL->GetMaxSize();
666 //----------------------------------------------------------------------------
669 ::SetMagnification( CORBA::Double theMagnification )
671 VISU::TSetModified aModified(this);
673 myGaussPointsPL->SetMagnification( theMagnification );
680 return myGaussPointsPL->GetMagnification();
683 //----------------------------------------------------------------------------
686 ::SetMagnificationIncrement( CORBA::Double theIncrement )
688 VISU::TSetModified aModified(this);
690 myGaussPointsPL->SetMagnificationIncrement( theIncrement );
695 ::GetMagnificationIncrement()
697 return myGaussPointsPL->GetMagnificationIncrement();
700 //----------------------------------------------------------------------------
703 ::SetSourceGeometry()
705 int aNbGroups = myGroupNames.size();
707 GetSpecificPL()->SetSourceGeometry();
708 myGroupNames.clear();
713 //----------------------------------------------------------------------------
716 ::AddMeshOnGroup(const char* theGroupName)
718 VISU::Result_i::PInput anInput = GetCResult()->GetInput();
719 VISU::PUnstructuredGridIDMapper anIDMapper = anInput->GetMeshOnGroup(GetCMeshName(), theGroupName);
721 int aNbGroups = myGroupNames.size();
722 if(myGroupNames.find(theGroupName) == myGroupNames.end()){
723 GetSpecificPL()->AddGeometry(anIDMapper->GetOutput());
724 myGroupNames.insert(theGroupName);
734 //----------------------------------------------------------------------------
739 int aNbGroups = myGroupNames.size();
740 GetSpecificPL()->ClearGeometry();
741 myGroupNames.clear();
748 //----------------------------------------------------------------------------
751 ::DoSetInput(bool theIsInitilizePipe, bool theReInit)
753 VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(),
756 GetTimeStampNumber());
758 throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
760 SetField(anInput->GetField(GetCMeshName(),
764 throw std::runtime_error("There is no Field with the parameters !!!");
766 VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
767 anInput->GetTimeStampOnGaussPts(GetCMeshName(),
770 GetTimeStampNumber());
771 if(!aGaussPtsIDMapper)
772 throw std::runtime_error("There is no TimeStamp with the parameters !!!");
774 GetSpecificPL()->SetGaussPtsIDMapper(aGaussPtsIDMapper);
778 //----------------------------------------------------------------------------
783 return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
787 //----------------------------------------------------------------------------
790 ::CreatePipeLine(VISU_PipeLine* thePipeLine)
793 myGaussPointsPL = VISU_GaussPointsPL::New();
795 myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
797 TSuperClass::CreatePipeLine(myGaussPointsPL);
801 //----------------------------------------------------------------------------
806 // We create a new PipeLine instance in order to provide
807 // different representations for different actors (basic and segmented)
808 VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
809 aPipeLine->ShallowCopy(GetPipeLine(), true);
814 //----------------------------------------------------------------------------
817 ::OnCreateActor(VISU_GaussPtsAct* theActor)
820 TSuperClass::CreateActor(theActor);
821 UpdateActor(theActor);
834 VISU_GaussPtsAct1* anActor = VISU_GaussPtsAct1::New();
835 if(OnCreateActor(anActor))
844 VISU_GaussPtsAct2* anActor = VISU_GaussPtsAct2::New();
845 if(OnCreateActor(anActor))
854 return OnCreateActor1();
857 //----------------------------------------------------------------------------
860 ::CloneActor(VISU_GaussPtsAct1* theActor)
862 if(MYDEBUG) MESSAGE("GaussPoints_i::CloneActor - this = "<<this);
863 if(VISU_GaussPtsAct2* anActor = OnCreateActor2()){
864 theActor->Connect(anActor);
871 //----------------------------------------------------------------------------
874 ::UpdateScalarBar(VISU_ScalarBarActor *theScalarBar,
875 VISU_LookupTable* theLookupTable)
877 theScalarBar->SetTitle(GetScalarBarTitle().c_str());
878 theScalarBar->SetOrientation(GetBarOrientation());
879 theScalarBar->SetNumberOfLabels(GetLabels());
880 theScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(),
881 GetLabelWidth(), GetLabelHeight(),
882 GetBarWidth(), GetBarHeight());
883 theScalarBar->SetLabelFormat(GetLabelsFormat());
885 VISU_LookupTable* aLookupTable = GetSpecificPL()->GetBarTable();
887 theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors());
888 theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors());
890 vtkFloatingPointType anRGB[3];
892 vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty();
893 aTitleProp->SetFontFamily(GetTitFontType());
895 GetTitleColor(&anRGB[0],&anRGB[1],&anRGB[2]);
896 aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
898 IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff();
899 IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
900 IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
902 vtkTextProperty* aLabelProp = theScalarBar->GetLabelTextProperty();
903 aLabelProp->SetFontFamily(GetLblFontType());
905 GetLabelColor(&anRGB[0],&anRGB[1],&anRGB[2]);
906 aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
908 IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff();
909 IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
910 IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
912 theScalarBar->Modified();
916 //----------------------------------------------------------------------------
919 ::UpdateActor(VISU_Actor* theActor)
921 if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
922 VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl();
924 anActor->SetBarVisibility(true);
925 GetPipeLine()->GetMapper()->SetScalarVisibility(1);
928 vtkFloatingPointType* aRange = GetSpecificPL()->GetScalarRange();
929 aScalarBarCtrl->SetRangeLocal(aRange);
931 vtkFloatingPointType aRange[2];
932 GetSpecificPL()->GetSourceRange(aRange);
933 aScalarBarCtrl->SetRangeLocal(aRange);
936 bool anIsMinMaxDone = IsGlobalRangeDefined();
937 aScalarBarCtrl->SetGlobalRangeIsDefined(anIsMinMaxDone);
939 TMinMax aTMinMax( GetComponentMin( GetScalarMode() ),
940 GetComponentMax( GetScalarMode() ));
941 aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
943 VISU_ScalarBarCtrl::EMode aScalarBarMode = VISU_ScalarBarCtrl::eGlobal;
944 if(myIsActiveLocalScalarBar){
945 if(myIsDispGlobalScalarBar){
946 aScalarBarMode = VISU_ScalarBarCtrl::eLocal;
948 aScalarBarMode = VISU_ScalarBarCtrl::eSimple;
952 if(aScalarBarMode == VISU_ScalarBarCtrl::eGlobal){
953 vtkFloatingPointType aRangeGlobal[2];
955 aRangeGlobal[0] = aTMinMax.first;
956 aRangeGlobal[1] = aTMinMax.second;
958 GetSpecificPL()->GetMapper()->SetScalarRange(aRangeGlobal);
961 aScalarBarCtrl->SetMode(aScalarBarMode);
964 aScalarBarCtrl->SetWidth(GetWidth());
965 aScalarBarCtrl->SetHeight(GetHeight());
967 vtkFloatingPointType aPosition[] = {GetPosX(), GetPosY()};
968 aScalarBarCtrl->SetPosition(aPosition);
970 aScalarBarCtrl->SetSpacing(mySpacing);
973 bool anIsBicolor = GetSpecificPL()->GetBicolor();
974 aScalarBarCtrl->SetBicolor(anIsBicolor);
976 UpdateScalarBar(aScalarBarCtrl->GetLocalBar(),
977 aScalarBarCtrl->GetLocalTable());
979 UpdateScalarBar(aScalarBarCtrl->GetGlobalBar(),
980 aScalarBarCtrl->GetGlobalTable());
982 aScalarBarCtrl->Update();
984 anActor->SetBarVisibility(false);
986 GetPipeLine()->GetMapper()->SetScalarVisibility(0);
988 anActor->GetProperty()->SetColor(myColor.red() / 255.0,
989 myColor.green() / 255.0,
990 myColor.blue() / 255.0);
993 if( GetSpecificPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
994 theActor->SetRepresentation( VTK_POINTS );
996 theActor->SetRepresentation( VTK_SURFACE );
998 TSuperClass::UpdateActor(theActor);
1001 //----------------------------------------------------------------------------
1004 ::UpdateFromActor(VISU_GaussPtsAct* theActor)
1006 if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this);
1007 myGaussPointsPL->ChangeMagnification(theActor->GetChangeMagnification());
1008 myParamsTime.Modified();
1013 //----------------------------------------------------------------------------
1016 ::SetQTextures( const QString& theMainTexture,
1017 const QString& theAlphaTexture )
1019 bool updateMainTexture = SetMainTexture( theMainTexture );
1020 bool updateAlphaTexture = SetAlphaTexture( theAlphaTexture );
1021 if( !updateMainTexture && !updateAlphaTexture )
1024 VISU::TSetModified aModified(this);
1026 using namespace VISU;
1027 TTextureValue aTextureValue = GetTexture(theMainTexture, theAlphaTexture);
1028 myGaussPointsPL->SetImageData( aTextureValue.GetPointer() );
1033 ::SetTextures( const char* theMainTexture,
1034 const char* theAlphaTexture )
1036 SetQTextures(theMainTexture, theAlphaTexture);
1040 //----------------------------------------------------------------------------
1043 ::SetIsActiveLocalScalarBar(CORBA::Boolean theIsActiveLocalScalarBar)
1045 if(myIsActiveLocalScalarBar == theIsActiveLocalScalarBar)
1048 VISU::TSetModified aModified(this);
1050 myIsActiveLocalScalarBar = theIsActiveLocalScalarBar;
1052 if ( !theIsActiveLocalScalarBar || !IsRangeFixed() )
1055 myParamsTime.Modified();
1060 ::GetIsActiveLocalScalarBar()
1062 return myIsActiveLocalScalarBar;
1067 ::SetIsDispGlobalScalarBar(CORBA::Boolean theIsDispGlobalScalarBar)
1069 if(myIsDispGlobalScalarBar == theIsDispGlobalScalarBar)
1072 VISU::TSetModified aModified(this);
1074 myIsDispGlobalScalarBar = theIsDispGlobalScalarBar;
1075 myParamsTime.Modified();
1080 ::IsGlobalRangeDefined() const
1082 return GetCResult()->IsMinMaxDone();
1085 //----------------------------------------------------------------------------
1090 VISU::TSetModified aModified(this);
1092 vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()};
1093 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
1094 (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
1096 UseFixedRange(false);
1100 //----------------------------------------------------------------------------
1101 struct TGetSourceMin: public SALOME_Event
1103 VISU::GaussPoints_i* myColoredPrs3d;
1105 typedef CORBA::Double TResult;
1108 TGetSourceMin( VISU::GaussPoints_i* theColoredPrs3d ):
1109 myColoredPrs3d( theColoredPrs3d )
1116 if ( myColoredPrs3d->IsTimeStampFixed() || myColoredPrs3d->GetIsActiveLocalScalarBar() ) {
1117 vtkFloatingPointType aRange[2];
1118 myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange);
1119 myResult = aRange[0];
1121 VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() );
1122 myResult = aTMinMax.first;
1128 //----------------------------------------------------------------------------
1133 return ProcessEvent( new TGetSourceMin( this ) );
1137 //----------------------------------------------------------------------------
1138 struct TGetSourceMax: public SALOME_Event
1140 VISU::GaussPoints_i* myColoredPrs3d;
1142 typedef CORBA::Double TResult;
1145 TGetSourceMax( VISU::GaussPoints_i* theColoredPrs3d ):
1146 myColoredPrs3d( theColoredPrs3d )
1153 if ( myColoredPrs3d->IsTimeStampFixed() || myColoredPrs3d->GetIsActiveLocalScalarBar() ) {
1154 vtkFloatingPointType aRange[2];
1155 myColoredPrs3d->GetSpecificPL()->GetSourceRange(aRange);
1156 myResult = aRange[1];
1158 VISU::TMinMax aTMinMax = myColoredPrs3d->GetField()->GetMinMax( myColoredPrs3d->GetScalarMode() );
1159 myResult = aTMinMax.second;
1165 //----------------------------------------------------------------------------
1170 return ProcessEvent( new TGetSourceMax( this ) );
1174 //----------------------------------------------------------------------------
1177 ::GetIsDispGlobalScalarBar()
1179 return myIsDispGlobalScalarBar;
1185 ::SetBiColor(CORBA::Boolean theIsBiColor)
1187 VISU::TSetModified aModified(this);
1189 GetSpecificPL()->SetBicolor(theIsBiColor);
1196 return GetSpecificPL()->GetBicolor();
1201 ::SetSpacing(CORBA::Double theSpacing)
1203 if(VISU::CheckIsSameValue(mySpacing, theSpacing))
1206 VISU::TSetModified aModified(this);
1208 mySpacing = theSpacing;
1209 myParamsTime.Modified();