1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_PrsObject_i.cxx
25 // Author : Alexey PETROV
28 #include "VISU_ColoredPrs3d_i.hh"
29 #include "VISU_Prs3dUtils.hh"
31 #include "VISU_Result_i.hh"
32 #include "VISU_ColoredPL.hxx"
33 #include "VISU_PipeLineUtils.hxx"
34 #include "VISU_Convertor.hxx"
36 #include "SUIT_ResourceMgr.h"
37 #include "SALOME_Event.h"
40 #include <vtkMapper.h>
41 #include <vtkDataSet.h>
44 static int MYDEBUG = 0;
47 static int MYDEBUG = 0;
52 //---------------------------------------------------------------
56 FindOrCreate3DPresentationsFolder(SALOMEDS::Study_ptr theStudy)
58 static char aFolderName[] = "3D Presentations";
59 CORBA::String_var anEntry;
60 SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName);
61 if(!CORBA::is_nil(aSObject) && aSObject->Depth() == 3){
62 anEntry = aSObject->GetID();
65 SALOMEDS::SComponent_var aSComponent = VISU::FindOrCreateVisuComponent(theStudy);
66 CORBA::String_var aFatherEntry = aSComponent->GetID();
67 anEntry = VISU::CreateAttributes(theStudy,
79 //---------------------------------------------------------------
82 //---------------------------------------------------------------
85 GetMinMax(VISU::Result_i* theResult,
86 VISU::PField theField,
89 if(!theResult->IsMinMaxDone())
90 theResult->GetInput()->BuildMinMax();
91 if(theField->myIsELNO)
92 return theField->GetMinMax(theCompID, VISU::TNames());
94 return theField->GetAverageMinMax(theCompID, VISU::TNames());
97 //---------------------------------------------------------------
100 ::UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d)
104 //---------------------------------------------------------------
107 ::GetComponentMin(vtkIdType theCompID)
109 return VTK_LARGE_FLOAT;
113 //---------------------------------------------------------------
116 ::GetComponentMax(vtkIdType theCompID)
118 return -VTK_LARGE_FLOAT;
122 //---------------------------------------------------------------
123 struct TSimpleMinMaxController: virtual TVTKMinMaxController
125 VISU::Result_i* myResult;
126 VISU::ColoredPrs3d_i* myColoredPrs3d;
128 TSimpleMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d):
129 myResult(theColoredPrs3d->GetCResult()),
130 myColoredPrs3d(theColoredPrs3d)
133 ~TSimpleMinMaxController()
138 GetComponentMin(vtkIdType theCompID)
140 if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) {
141 TMinMax aMinMax = GetMinMax(myResult, aField, theCompID);
142 return aMinMax.first;
144 return TMinMaxController::GetComponentMin(theCompID);
149 GetComponentMax(vtkIdType theCompID)
151 if ( VISU::PField aField = myColoredPrs3d->GetScalarField() ) {
152 TMinMax aMinMax = GetMinMax(myResult, aField, theCompID);
153 return aMinMax.second;
155 return TMinMaxController::GetComponentMax(theCompID);
160 //---------------------------------------------------------------
162 CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d)
164 return PMinMaxController(new TSimpleMinMaxController(theColoredPrs3d));
168 //---------------------------------------------------------------
172 //---------------------------------------------------------------
173 VISU::ColoredPrs3d_i::
174 ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) :
176 myRestoringSObject( SALOMEDS::SObject::_nil() ),
177 myEntity( VISU::Entity( -1 ) ),
178 myPreviousEntity( VISU::Entity( -1 ) ),
179 myTimeStampNumber( -1 ),
180 myPreviousTimeStampNumber( -1 ),
181 myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp),
182 myPublishInStudyMode(thePublishInStudyMode),
184 myNumberOfLabels( -1 ),
185 myOrientation( VISU::ColoredPrs3dBase::HORIZONTAL ),
186 //myPosition[2], myWidth, myHeight, myTitleWidth, myTitleHeight,
187 //myLabelWidth, myLabelHeight, myBarWidth, myBarHeight,
188 //myIsBoldTitle, myIsItalicTitle, myIsShadowTitle, myTitFontType, myTitleColor[3],
189 //myIsBoldLabel, myIsItalicLabel, myIsShadowLabel, myLblFontType, myLabelColor[3],
191 myIsFixedRange(false),
192 myIsDistributionVisible(false)
195 //---------------------------------------------------------------
200 //---------------------------------------------------------------
205 TSuperClass::Register();
208 //---------------------------------------------------------------
213 TSuperClass::UnRegister();
216 //---------------------------------------------------------------
221 struct TEvent: public SALOME_Event
223 VISU::ColoredPrs3d_i* myRemovable;
225 TEvent(VISU::ColoredPrs3d_i* theRemovable):
226 myRemovable(theRemovable)
233 SALOMEDS::SObject_var aSObject = myRemovable->GetSObject();
235 if(!CORBA::is_nil(aSObject.in()))
236 VISU::RemoveFromStudy(aSObject,false);
238 myRemovable->TSuperClass::RemoveFromStudy();
242 ProcessVoidEvent(new TEvent(this));
246 //----------------------------------------------------------------------------
249 ::UpdateFromResult(Result_i* theResult)
251 struct TEvent: public SALOME_Event
253 VISU::ColoredPrs3d_i* myColoredPrs3d;
255 TEvent(VISU::ColoredPrs3d_i* theColoredPrs3d):
256 myColoredPrs3d(theColoredPrs3d)
264 myColoredPrs3d->DoSetInput(false, false);
265 myColoredPrs3d->UpdateActors();
266 }catch(std::exception& exc){
267 INFOS("Follow exception was occured :\n"<<exc.what());
269 INFOS("Unknown exception was occured!");
274 if ( theResult == GetCResult() )
275 ProcessVoidEvent(new TEvent(this));
279 //---------------------------------------------------------------
282 ::SetInput(bool theReInit)
285 if(TSuperClass::SetInput(theReInit)){
286 if(CheckIsPossible()){
287 if(OnSetInput(theReInit)){
288 if(Create(GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber()))
301 //----------------------------------------------------------------------------
306 TSuperClass::OnRestoreInput();
307 myEntity = myPreviousEntity;
308 myFieldName = myPreviousFieldName;
309 myTimeStampNumber = myPreviousTimeStampNumber;
313 //---------------------------------------------------------------
316 ::OnSetInput(bool theReInit)
318 bool anIsCreatNew = !IsPipeLineExists();
320 CreatePipeLine(NULL); // to create proper pipeline
323 DoSetInput(anIsCreatNew, theReInit);
326 GetSpecificPL()->Init();
328 // To update scalar range according to the new input
329 if(!IsRangeFixed() && theReInit)
332 if(GetPublishInStudyMode() != EDoNotPublish)
333 GetCResult()->ConnectObserver(this, myResultConnection);
335 myPreviousEntity = myEntity;
336 myPreviousFieldName = myFieldName;
337 myPreviousTimeStampNumber = myTimeStampNumber;
338 }catch(std::exception& exc){
339 INFOS("Follow exception was occured :\n"<<exc.what());
343 INFOS("Unknown exception was occured!");
348 // To update title according to the new input
350 SetTitle(GetCFieldName().c_str());
356 //---------------------------------------------------------------
359 ::SetEntity(VISU::Entity theEntity)
361 if ( myEntity == theEntity )
364 VISU::TSetModified aModified(this);
366 myEntity = theEntity;
367 myParamsTime.Modified();
371 //---------------------------------------------------------------
380 //----------------------------------------------------------------------------
385 return VISU::TEntity(int(myEntity));
389 //----------------------------------------------------------------------------
392 ::SetFieldName(const char* theFieldName)
394 if(myFieldName == theFieldName)
397 VISU::TSetModified aModified(this);
399 myFieldName = theFieldName;
400 myParamsTime.Modified();
404 //----------------------------------------------------------------------------
409 return CORBA::string_dup(myFieldName.c_str());
413 //----------------------------------------------------------------------------
416 ::GetCFieldName() const
422 //----------------------------------------------------------------------------
431 //---------------------------------------------------------------
434 ::SetField(VISU::PField theField)
440 //----------------------------------------------------------------------------
443 ::SetTimeStampNumber(CORBA::Long theTimeStampNumber)
445 if ( myTimeStampNumber == theTimeStampNumber )
448 VISU::TSetModified aModified(this);
450 myTimeStampNumber = theTimeStampNumber;
451 myParamsTime.Modified();
455 //----------------------------------------------------------------------------
458 ::GetTimeStampNumber()
460 return myTimeStampNumber;
464 //----------------------------------------------------------------------------
467 ::GetTimeStampNumberByIndex( CORBA::Long theIndex )
469 VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
470 CORBA::Long aLength = aTimeStampsRange->length();
472 if( theIndex >= 0 && theIndex < aLength )
474 VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ theIndex ];
475 return anInfo.myNumber;
482 //----------------------------------------------------------------------------
485 ::GetTimeStampIndexByNumber( CORBA::Long theNumber )
487 VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = GetTimeStampsRange();
488 CORBA::Long aLength = aTimeStampsRange->length();
490 for( int index = 0; index < aLength; index++ )
492 VISU::ColoredPrs3dHolder::TimeStampInfo anInfo = aTimeStampsRange[ index ];
494 if( anInfo.myNumber == theNumber )
502 //----------------------------------------------------------------------------
511 //----------------------------------------------------------------------------
512 VISU::PMinMaxController
514 ::GetMinMaxController()
516 return myMinMaxController;
520 //----------------------------------------------------------------------------
523 ::SetMinMaxController( const VISU::PMinMaxController& theController )
525 myMinMaxController = theController;
532 //----------------------------------------------------------------------------
535 ::SetMinMaxController( VISU::ColoredPrs3d_i* theOrigin )
537 VISU::PMinMaxController aController = theOrigin->GetMinMaxController();
540 aController->UpdateReference( theOrigin, this );
542 SetMinMaxController( aController );
546 //----------------------------------------------------------------------------
549 ::GetScalarTimeStampNumber() const
551 return myTimeStampNumber;
555 //----------------------------------------------------------------------------
556 VISU::ColoredPrs3dHolder::TimeStampsRange*
558 ::GetTimeStampsRange()
560 VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange =
561 new VISU::ColoredPrs3dHolder::TimeStampsRange();
562 VISU::TValField& aValField = GetField()->myValField;
563 if(IsTimeStampFixed()){
564 aTimeStampsRange->length(1);
565 PValForTime& aValForTime = aValField[GetTimeStampNumber()];
566 std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
567 VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
568 anInfo.myNumber = GetTimeStampNumber();
569 anInfo.myTime = aTime.c_str();
570 aTimeStampsRange[0] = anInfo;
571 return aTimeStampsRange._retn();
574 // To exclude timstamps with repeated time
575 typedef std::map<std::string, long> TTimeStampsRange;
576 TTimeStampsRange aRange;
578 VISU::TValField::const_iterator anIter = aValField.begin();
579 for(; anIter != aValField.end(); anIter++){
580 vtkIdType aTimeStampNumber = anIter->first;
581 const PValForTime& aValForTime = anIter->second;
582 std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime);
583 aRange[aTime] = aTimeStampNumber;
587 // To sort timestamps according to their timestamp number
588 typedef std::map<long, std::string> TTimeStampsSortedRange;
589 TTimeStampsSortedRange aSortedRange;
591 TTimeStampsRange::const_iterator anIter = aRange.begin();
592 for(size_t aCounter = 0; anIter != aRange.end(); anIter++, aCounter++){
593 vtkIdType aTimeStampNumber = anIter->second;
594 const std::string& aTime = anIter->first;
595 aSortedRange[aTimeStampNumber] = aTime;
599 // To map the C++ data structures to the corresponding CORBA ones
601 aTimeStampsRange->length(aRange.size());
602 TTimeStampsSortedRange::const_iterator anIter = aSortedRange.begin();
603 for(size_t aCounter = 0; anIter != aSortedRange.end(); anIter++, aCounter++){
604 vtkIdType aTimeStampNumber = anIter->first;
605 const std::string& aTime = anIter->second;
606 VISU::ColoredPrs3dHolder::TimeStampInfo anInfo;
607 anInfo.myNumber = aTimeStampNumber;
608 anInfo.myTime = aTime.c_str();
609 aTimeStampsRange[aCounter] = anInfo;
612 return aTimeStampsRange._retn();
619 return TSuperClass::GetMemorySize();
622 VISU::ColoredPrs3dHolder::BasicInput*
626 VISU::ColoredPrs3dHolder::BasicInput* aBasicInput = new VISU::ColoredPrs3dHolder::BasicInput();
627 aBasicInput->myResult = GetResultObject();
628 aBasicInput->myMeshName = GetMeshName();
629 aBasicInput->myEntity = GetEntity();
630 aBasicInput->myFieldName = GetFieldName();
631 aBasicInput->myTimeStampNumber = GetTimeStampNumber();
637 //----------------------------------------------------------------------------
640 ::SetHolderEntry(const std::string& theEntry)
642 myHolderEntry = theEntry;
646 //----------------------------------------------------------------------------
651 return myHolderEntry;
655 //----------------------------------------------------------------------------
660 if(myHolderEntry != "")
661 return myHolderEntry;
662 return TSuperClass::GetActorEntry();
666 //----------------------------------------------------------------------------
671 return myIsTimeStampFixed;
674 //----------------------------------------------------------------------------
675 VISU::ColoredPrs3d_i::EPublishInStudyMode
677 ::GetPublishInStudyMode()
679 return myPublishInStudyMode;
682 //---------------------------------------------------------------
685 ::SameAs(const Prs3d_i* theOrigin)
687 if(const ColoredPrs3d_i* aPrs3d = dynamic_cast<const ColoredPrs3d_i*>(theOrigin)){
688 ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(aPrs3d);
690 bool anIsCreatNew = OnSetInput(false);
694 TSuperClass::SameAs(theOrigin);
696 CORBA::Long aNbComp = GetScalarField()->myNbComp;
697 CORBA::Long anOriginNbComp = anOrigin->GetScalarField()->myNbComp;
698 if(anOriginNbComp < aNbComp)
701 SetScalarMode(anOrigin->GetScalarMode());
703 SetNbColors(anOrigin->GetNbColors());
705 SetUnitsVisible(anOrigin->IsUnitsVisible());
706 SetIsDistributionVisible(anOrigin->GetIsDistributionVisible());
707 SetLabelsFormat( anOrigin->GetLabelsFormat() );
709 SetBarOrientation(anOrigin->GetBarOrientation());
711 SetMinMaxController( anOrigin );
713 if ( anOrigin->IsRangeFixed() )
714 SetRange( anOrigin->GetMin(), anOrigin->GetMax() );
718 SetScalarFilterRange( anOrigin->GetScalarFilterMin(), anOrigin->GetScalarFilterMax() );
719 UseScalarFiltering( anOrigin->IsScalarFilterUsed() );
721 SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
722 SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
723 SetRatios(anOrigin->GetTitleSize(), anOrigin->GetLabelSize(),
724 anOrigin->GetBarWidth(), anOrigin->GetBarHeight());
725 SetLabels(anOrigin->GetLabels());
727 SetTitle(anOrigin->GetTitle());
728 SetBoldTitle(anOrigin->IsBoldTitle());
729 SetItalicTitle(anOrigin->IsItalicTitle());
730 SetShadowTitle(anOrigin->IsShadowTitle());
731 SetTitFontType(anOrigin->GetTitFontType());
733 anOrigin->GetTitleColor(r,g,b);
734 SetTitleColor(r,g,b);
736 SetBoldLabel(anOrigin->IsBoldLabel());
737 SetItalicLabel(anOrigin->IsItalicLabel());
738 SetShadowLabel(anOrigin->IsShadowLabel());
739 SetLblFontType(anOrigin->GetLblFontType());
740 anOrigin->GetLabelColor(r,g,b);
741 SetLabelColor(r,g,b);
743 myIsTimeStampFixed = anOrigin->IsTimeStampFixed();
745 SetHolderEntry( anOrigin->GetHolderEntry() );
747 myGroupNames = anOrigin->GetGroupNames();
751 //----------------------------------------------------------------------------
754 ::UpdateActor(VISU_ActorBase* theActor)
756 bool isOnGroups = myGroupNames.size() > 0;
760 TGroupNames::const_iterator anIter = myGroupNames.begin();
761 for ( ; anIter != myGroupNames.end(); anIter++ )
763 const std::string aGroupName = *anIter;
764 aList << QString( aGroupName.c_str() );
766 theActor->SetNameActorText( aList.join( "\n" ).toLatin1().constData() );
768 theActor->SetIsDisplayNameActor( isOnGroups );
770 TSuperClass::UpdateActor(theActor);
773 //----------------------------------------------------------------------------
778 return myColoredPL->GetScalarMode();
782 //----------------------------------------------------------------------------
785 ::SetScalarMode(CORBA::Long theScalarMode)
787 CORBA::Long aNbComp = GetScalarField()->myNbComp;
790 else if(theScalarMode > aNbComp)
793 VISU::TSetModified aModified(this);
795 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, int>
796 (GetSpecificPL(), &VISU_ColoredPL::SetScalarMode, theScalarMode));
799 //----------------------------------------------------------------------------
804 return myColoredPL->GetScalarRange()[0];
807 //----------------------------------------------------------------------------
812 return myColoredPL->GetScalarRange()[1];
816 //----------------------------------------------------------------------------
819 ::SetRange( CORBA::Double theMin, CORBA::Double theMax )
821 VISU::TSetModified aModified(this);
823 double aScalarRange[2] = {theMin, theMax};
824 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, double*>
825 (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
830 //----------------------------------------------------------------------------
833 ::SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax )
835 VISU::TSetModified aModified(this);
837 double aScalarRange[ 2 ] = { theMin, theMax };
838 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, double*>
839 (GetSpecificPL(), &VISU_ColoredPL::SetScalarFilterRange, aScalarRange) );
843 //----------------------------------------------------------------------------
846 ::GetScalarFilterMin()
848 double aScalarRange[ 2 ];
849 GetSpecificPL()->GetScalarFilterRange( aScalarRange );
851 return aScalarRange[ 0 ];
855 //----------------------------------------------------------------------------
858 ::GetScalarFilterMax()
860 double aScalarRange[ 2 ];
861 GetSpecificPL()->GetScalarFilterRange( aScalarRange );
863 return aScalarRange[ 1 ];
867 //----------------------------------------------------------------------------
870 ::IsScalarFilterUsed()
872 return myColoredPL->IsScalarFilterUsed();
875 //----------------------------------------------------------------------------
878 ::UseScalarFiltering( CORBA::Boolean theUseScalarFilter )
880 return myColoredPL->UseScalarFiltering( theUseScalarFilter );
883 //----------------------------------------------------------------------------
888 VISU::TSetModified aModified(this);
890 if(IsTimeStampFixed()){
891 GetSpecificPL()->SetSourceRange();
892 ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
893 (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange));
895 double aScalarRange[ 2 ] = {GetSourceMin(), GetSourceMax()};
896 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, double*>
897 (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange));
899 UseFixedRange(false);
902 //----------------------------------------------------------------------------
907 if(IsTimeStampFixed()){
909 GetSpecificPL()->GetSourceRange(aRange);
912 return GetComponentMin(GetScalarMode());
915 //----------------------------------------------------------------------------
920 if(IsTimeStampFixed()){
922 GetSpecificPL()->GetSourceRange(aRange);
925 return GetComponentMax(GetScalarMode());
929 //----------------------------------------------------------------------------
932 ::SetNbColors(CORBA::Long theNbColors)
934 VISU::TSetModified aModified(this);
936 ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, int>
937 (GetSpecificPL(), &VISU_ColoredPL::SetNbColors, theNbColors));
940 //----------------------------------------------------------------------------
945 return GetSpecificPL()->GetNbColors();
948 //----------------------------------------------------------------------------
951 ::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation)
953 if ( myOrientation == theOrientation )
956 VISU::TSetModified aModified(this);
958 myOrientation = theOrientation;
959 myParamsTime.Modified();
962 //----------------------------------------------------------------------------
963 VISU::ColoredPrs3dBase::Orientation
965 ::GetBarOrientation()
967 return myOrientation;
970 //----------------------------------------------------------------------------
973 ::SetPosition(CORBA::Double theX, CORBA::Double theY)
975 bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX);
976 anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY);
980 VISU::TSetModified aModified(this);
982 myPosition[0] = theX;
983 myPosition[1] = theY;
984 myParamsTime.Modified();
987 //----------------------------------------------------------------------------
992 return myPosition[0];
995 //----------------------------------------------------------------------------
1000 return myPosition[1];
1003 //----------------------------------------------------------------------------
1005 VISU::ColoredPrs3d_i
1006 ::SetSize(CORBA::Double theWidth, CORBA::Double theHeight)
1008 bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth);
1009 anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight);
1013 VISU::TSetModified aModified(this);
1016 myHeight = theHeight;
1017 myParamsTime.Modified();
1020 //----------------------------------------------------------------------------
1022 VISU::ColoredPrs3d_i
1028 //----------------------------------------------------------------------------
1030 VISU::ColoredPrs3d_i
1036 //----------------------------------------------------------------------------
1038 VISU::ColoredPrs3d_i
1039 ::SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
1040 CORBA::Long theBarWidth, CORBA::Long theBarHeight)
1042 bool anIsSameValue = VISU::CheckIsSameValue(myTitleSize, theTitleSize);
1043 anIsSameValue &= VISU::CheckIsSameValue(myLabelSize, theLabelSize);
1044 anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
1045 anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
1049 VISU::TSetModified aModified(this);
1051 myTitleSize = theTitleSize;
1052 myLabelSize = theLabelSize;
1053 myBarWidth = theBarWidth;
1054 myBarHeight = theBarHeight;
1055 myParamsTime.Modified();
1058 //----------------------------------------------------------------------------
1060 VISU::ColoredPrs3d_i
1066 //----------------------------------------------------------------------------
1068 VISU::ColoredPrs3d_i
1074 //----------------------------------------------------------------------------
1076 VISU::ColoredPrs3d_i
1082 //----------------------------------------------------------------------------
1084 VISU::ColoredPrs3d_i
1090 //----------------------------------------------------------------------------
1092 VISU::ColoredPrs3d_i
1093 ::SetLabels(CORBA::Long theNbLabels)
1095 if(myNumberOfLabels == theNbLabels)
1098 VISU::TSetModified aModified(this);
1100 myNumberOfLabels = theNbLabels;
1101 myParamsTime.Modified();
1104 //----------------------------------------------------------------------------
1106 VISU::ColoredPrs3d_i
1109 return myNumberOfLabels;
1112 //----------------------------------------------------------------------------
1114 //----------------------------------------------------------------------------
1116 VISU::ColoredPrs3d_i
1117 ::SetLabelsFormat(const char* theFormat)
1119 if( myLabelsFormat != theFormat ){
1120 VISU::TSetModified aModified(this);
1121 myLabelsFormat = theFormat;
1122 myParamsTime.Modified();
1127 //----------------------------------------------------------------------------
1129 VISU::ColoredPrs3d_i
1132 return CORBA::string_dup(myLabelsFormat.c_str());
1135 //----------------------------------------------------------------------------
1137 VISU::ColoredPrs3d_i
1138 ::SetTitle(const char* theTitle)
1140 VISU::PValForTime aValForTime;
1141 VISU::TValField& aValField = GetScalarField()->myValField;
1142 VISU::TValField::iterator anIter = aValField.find(GetScalarTimeStampNumber());
1143 if (anIter != aValField.end())
1144 aValForTime = anIter->second;
1147 std::stringstream aStream;
1148 const VISU::TTime& aTime = aValForTime->myTime;
1149 aStream<<theTitle<<" ";
1150 if(IsUnitsVisible()) {
1151 aStream << VISU_Convertor::GenerateName(aTime);
1154 aName.sprintf("%g", aTime.first);
1155 aStream << aName.toLatin1().data();
1157 aStream <<std::ends;
1158 std::string aScalarBarTitle = aStream.str();
1159 if(myTitle != theTitle || myScalarBarTitle != aScalarBarTitle){
1160 VISU::TSetModified aModified(this);
1162 myScalarBarTitle = aScalarBarTitle;
1164 myParamsTime.Modified();
1169 //----------------------------------------------------------------------------
1171 VISU::ColoredPrs3d_i
1174 return CORBA::string_dup(myTitle.c_str());
1177 //----------------------------------------------------------------------------
1179 VISU::ColoredPrs3d_i
1180 ::SetUnitsVisible(CORBA::Boolean theIsVisible)
1182 if ( myIsUnits == theIsVisible )
1185 VISU::TSetModified aModified( this );
1187 myIsUnits = theIsVisible;
1188 myParamsTime.Modified();
1191 //----------------------------------------------------------------------------
1193 VISU::ColoredPrs3d_i
1199 //----------------------------------------------------------------------------
1201 VISU::ColoredPrs3d_i
1207 //----------------------------------------------------------------------------
1209 VISU::ColoredPrs3d_i
1212 return myIsBoldTitle;
1215 //----------------------------------------------------------------------------
1217 VISU::ColoredPrs3d_i
1218 ::SetBoldTitle(bool theIsBoldTitle)
1220 if(myIsBoldTitle == theIsBoldTitle)
1223 VISU::TSetModified aModified(this);
1225 myIsBoldTitle = theIsBoldTitle;
1226 myParamsTime.Modified();
1229 //----------------------------------------------------------------------------
1231 VISU::ColoredPrs3d_i
1234 return myIsItalicTitle;
1237 //----------------------------------------------------------------------------
1239 VISU::ColoredPrs3d_i
1240 ::SetItalicTitle(bool theIsItalicTitle)
1242 if(myIsItalicTitle == theIsItalicTitle)
1245 VISU::TSetModified aModified(this);
1247 myIsItalicTitle = theIsItalicTitle;
1248 myParamsTime.Modified();
1251 //----------------------------------------------------------------------------
1253 VISU::ColoredPrs3d_i
1256 return myIsShadowTitle;
1259 //----------------------------------------------------------------------------
1261 VISU::ColoredPrs3d_i
1262 ::SetShadowTitle(bool theIsShadowTitle)
1264 if(myIsShadowTitle == theIsShadowTitle)
1267 VISU::TSetModified aModified(this);
1269 myIsShadowTitle = theIsShadowTitle;
1270 myParamsTime.Modified();
1273 //----------------------------------------------------------------------------
1275 VISU::ColoredPrs3d_i
1278 return myTitFontType;
1281 //----------------------------------------------------------------------------
1283 VISU::ColoredPrs3d_i
1284 ::SetTitFontType(int theTitFontType)
1286 if(myTitFontType == theTitFontType)
1289 VISU::TSetModified aModified(this);
1291 myTitFontType = theTitFontType;
1292 myParamsTime.Modified();
1295 //----------------------------------------------------------------------------
1297 VISU::ColoredPrs3d_i
1298 ::GetTitleColor(double& theR,
1302 theR = myTitleColor[0];
1303 theG = myTitleColor[1];
1304 theB = myTitleColor[2];
1307 //----------------------------------------------------------------------------
1309 VISU::ColoredPrs3d_i
1310 ::SetTitleColor(double theR,
1314 bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR);
1315 anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG);
1316 anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB);
1320 VISU::TSetModified aModified(this);
1322 myTitleColor[0] = theR;
1323 myTitleColor[1] = theG;
1324 myTitleColor[2] = theB;
1325 myParamsTime.Modified();
1328 //----------------------------------------------------------------------------
1330 VISU::ColoredPrs3d_i
1333 return myIsBoldLabel;
1336 //----------------------------------------------------------------------------
1338 VISU::ColoredPrs3d_i
1339 ::SetBoldLabel(bool theIsBoldLabel)
1341 if(myIsBoldLabel == theIsBoldLabel)
1344 VISU::TSetModified aModified(this);
1346 myIsBoldLabel = theIsBoldLabel;
1347 myParamsTime.Modified();
1350 //----------------------------------------------------------------------------
1352 VISU::ColoredPrs3d_i
1355 return myIsItalicLabel;
1358 //----------------------------------------------------------------------------
1360 VISU::ColoredPrs3d_i
1361 ::SetItalicLabel(bool theIsItalicLabel)
1363 if(myIsItalicLabel == theIsItalicLabel)
1366 VISU::TSetModified aModified(this);
1368 myIsItalicLabel = theIsItalicLabel;
1369 myParamsTime.Modified();
1372 //----------------------------------------------------------------------------
1374 VISU::ColoredPrs3d_i
1377 return myIsShadowLabel;
1380 //----------------------------------------------------------------------------
1382 VISU::ColoredPrs3d_i
1383 ::SetShadowLabel(bool theIsShadowLabel)
1385 if(myIsShadowLabel == theIsShadowLabel)
1388 VISU::TSetModified aModified(this);
1390 myIsShadowLabel = theIsShadowLabel;
1391 myParamsTime.Modified();
1394 //----------------------------------------------------------------------------
1396 VISU::ColoredPrs3d_i
1399 return myLblFontType;
1402 //----------------------------------------------------------------------------
1404 VISU::ColoredPrs3d_i
1405 ::SetLblFontType(int theLblFontType)
1407 if(myLblFontType == theLblFontType)
1410 VISU::TSetModified aModified(this);
1412 myLblFontType = theLblFontType;
1413 myParamsTime.Modified();
1416 //----------------------------------------------------------------------------
1418 VISU::ColoredPrs3d_i
1419 ::GetLabelColor(double& theR,
1423 theR = myLabelColor[0];
1424 theG = myLabelColor[1];
1425 theB = myLabelColor[2];
1428 //----------------------------------------------------------------------------
1430 VISU::ColoredPrs3d_i
1431 ::SetLabelColor(double theR,
1435 bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR);
1436 anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG);
1437 anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB);
1441 VISU::TSetModified aModified(this);
1443 myLabelColor[0] = theR;
1444 myLabelColor[1] = theG;
1445 myLabelColor[2] = theB;
1446 myParamsTime.Modified();
1450 //----------------------------------------------------------------------------
1452 VISU::ColoredPrs3d_i
1455 return myIsFixedRange;
1458 //----------------------------------------------------------------------------
1460 VISU::ColoredPrs3d_i
1461 ::UseFixedRange(bool theUseFixedRange)
1463 if(myIsFixedRange == theUseFixedRange)
1466 myIsFixedRange = theUseFixedRange;
1467 myParamsTime.Modified();
1470 //----------------------------------------------------------------------------
1472 VISU::ColoredPrs3d_i
1473 ::GetScalarBarTitle()
1475 return myScalarBarTitle;
1478 //----------------------------------------------------------------------------
1480 * Creates ColoredPrs3d and initialises it from resources
1483 VISU::ColoredPrs3d_i
1484 ::Create(const std::string& theMeshName,
1485 VISU::Entity theEntity,
1486 const std::string& theFieldName,
1487 CORBA::Long theTimeStampNumber)
1489 SetMeshName(theMeshName.c_str());
1490 SetEntity(theEntity);
1491 SetFieldName(theFieldName.c_str());
1492 SetTimeStampNumber(theTimeStampNumber);
1495 Build(ECreateNew); // to get corresponding input from result and initilize the pipeline
1497 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
1499 int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
1500 SetScalarMode(aScalarMode);
1503 int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
1504 if ( aRangeType == 1 ) {
1505 float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
1506 float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
1507 SetRange( aMin, aMax );
1509 UseFixedRange( aRangeType == 1 );
1511 bool isFiltered = aResourceMgr->booleanValue("VISU", "scalar_bar_filter_by_scalars", false);
1512 UseScalarFiltering( isFiltered );
1514 int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
1515 SetNbColors(aNumberOfColors);
1517 bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true );
1518 SetUnitsVisible(isUnits);
1520 SetIsDistributionVisible( aResourceMgr->booleanValue("VISU", "scalar_bar_show_distribution", false) ); // RKV
1522 int lp = aResourceMgr->integerValue( "VISU", "scalar_bar_label_precision", 3 );
1523 SetLabelsFormat( VISU::ToFormat( lp ).c_str() );
1526 int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
1527 if(anOrientation == 1)
1528 SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL);
1530 SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL);
1532 // Scalar Bar origin
1533 QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
1535 double aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.1;
1536 aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
1537 myPosition[0] = aXorigin;
1539 double aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.01;
1540 aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
1541 myPosition[1] = aYorigin;
1544 myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.08 : 0.8;
1545 myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
1547 myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.08;
1548 myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
1551 myTitleSize = aResourceMgr->integerValue("VISU", propertyName + "title_size", myTitleSize);
1554 myLabelSize = aResourceMgr->integerValue("VISU", propertyName + "label_size", myLabelSize);
1557 myBarWidth = aResourceMgr->integerValue("VISU", propertyName + "bar_width", myBarWidth);
1560 myBarHeight = aResourceMgr->integerValue("VISU", propertyName + "bar_height", myBarHeight);
1562 // scalar bar default position
1563 bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0);
1565 if (anIsArrangeBar){
1566 aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0);
1568 if(myOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){
1569 myPosition[1] += myHeight*(aPlace-1);
1571 myPosition[0] += myWidth*(aPlace-1);
1575 myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
1577 // Fonts properties definition
1578 myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
1579 myTitFontType = VTK_ARIAL;
1581 if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
1582 QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
1583 if ( f.family() == "Arial" )
1584 myTitFontType = VTK_ARIAL;
1585 else if ( f.family() == "Courier" )
1586 myTitFontType = VTK_COURIER;
1587 else if ( f.family() == "Times" )
1588 myTitFontType = VTK_TIMES;
1590 myIsBoldTitle = f.bold();
1591 myIsItalicTitle = f.italic();
1592 myIsShadowTitle = f.overline();
1595 QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
1597 SetTitleColor(aTextColor.red()/255., aTextColor.green()/255., aTextColor.blue()/255.);
1599 myTitleColor[0] = aTextColor.red() / 255.;
1600 myTitleColor[1] = aTextColor.green() / 255.;
1601 myTitleColor[2] = aTextColor.blue() / 255.;
1603 myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
1604 myLblFontType = VTK_ARIAL;
1606 if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
1607 QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
1608 if ( f.family() == "Arial" )
1609 myLblFontType = VTK_ARIAL;
1610 else if ( f.family() == "Courier" )
1611 myLblFontType = VTK_COURIER;
1612 else if ( f.family() == "Times" )
1613 myLblFontType = VTK_TIMES;
1615 myIsBoldLabel = f.bold();
1616 myIsItalicLabel = f.italic();
1617 myIsShadowLabel = f.overline();
1620 QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
1622 SetLabelColor(aLabelColor.red()/255., aLabelColor.green()/255., aLabelColor.blue()/255.);
1624 myLabelColor[0] = aLabelColor.red() / 255.;
1625 myLabelColor[1] = aLabelColor.green() / 255.;
1626 myLabelColor[2] = aLabelColor.blue() / 255.;
1628 // Parameters of labels displaed field values
1630 myValLblFontType = VTK_ARIAL;
1631 myIsBoldValLbl = true;
1632 myIsItalicValLbl = myIsShadowValLbl = false;
1633 myValLblFontSize = 12;
1634 if( aResourceMgr->hasValue( "VISU", "values_labeling_font" ) )
1637 QFont f = aResourceMgr->fontValue( "VISU", "values_labeling_font" );
1638 if ( f.family() == "Arial" )
1639 myValLblFontType = VTK_ARIAL;
1640 else if ( f.family() == "Courier" )
1641 myValLblFontType = VTK_COURIER;
1642 else if ( f.family() == "Times" )
1643 myValLblFontType = VTK_TIMES;
1646 if ( f.pointSize() > -1 )
1647 myValLblFontSize = f.pointSize();
1650 QColor aColor = aResourceMgr->colorValue(
1651 "VISU", "values_labeling_color", QColor( 255, 255, 255 ) );
1652 myValLblFontColor[ 0 ] = aColor.red() / 255.;
1653 myValLblFontColor[ 1 ] = aColor.green() / 255.;
1654 myValLblFontColor[ 2 ] = aColor.blue()/ 255.;
1656 // bold, italic, shadow
1657 myIsBoldValLbl = f.bold();
1658 myIsItalicValLbl = f.italic();
1659 myIsShadowValLbl = f.overline();
1666 //----------------------------------------------------------------------------
1668 VISU::ColoredPrs3d_i
1669 ::SaveRestoringState(SALOMEDS::SObject_ptr theSObject,
1670 const Storable::TRestoringMap& theMap)
1672 myRestoringSObject = SALOMEDS::SObject::_duplicate(theSObject);
1673 myRestoringMap = theMap;
1674 myIsRestored = false;
1678 //----------------------------------------------------------------------------
1680 VISU::ColoredPrs3d_i
1681 ::InitFromRestoringState()
1684 Restore(myRestoringSObject, myRestoringMap);
1685 myIsRestored = true;
1690 //----------------------------------------------------------------------------
1692 VISU::ColoredPrs3d_i
1693 ::Restore(SALOMEDS::SObject_ptr theSObject,
1694 const Storable::TRestoringMap& theMap)
1696 if(!TSuperClass::Restore(theSObject, theMap))
1699 SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt());
1700 SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").toLatin1().data());
1701 SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt());
1702 myIsTimeStampFixed = VISU::Storable::FindValue(theMap,"myIsTimeStampFixed", "1").toInt();
1707 SetScalarMode(VISU::Storable::FindValue( theMap,"myScalarMode" ).toInt() );
1709 float aMin = VISU::Storable::FindValue( theMap, "myScalarRange[0]" ).toDouble();
1710 float aMax = VISU::Storable::FindValue( theMap, "myScalarRange[1]" ).toDouble();
1711 SetRange( aMin, aMax );
1714 bool isFiltered = VISU::Storable::FindValue( theMap, "myIsFilteredByScalars", "0" ).toInt();
1715 float aMin = VISU::Storable::FindValue( theMap, "myScalarFilterRange[0]" ).toDouble();
1716 float aMax = VISU::Storable::FindValue( theMap, "myScalarFilterRange[1]" ).toDouble();
1717 SetScalarFilterRange( aMin, aMax );
1718 UseScalarFiltering( isFiltered );
1720 SetIsDistributionVisible(VISU::Storable::FindValue(theMap,"myIsDistributionVisible", "0").toInt());
1722 UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt());
1724 SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
1725 SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt());
1726 SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g").toLatin1().data());
1727 SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
1729 SetTitle(VISU::Storable::FindValue(theMap,"myTitle").toLatin1().data());
1730 myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
1731 myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
1732 myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
1733 myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
1734 myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
1735 myTitleSize = VISU::Storable::FindValue(theMap,"myTitleSize").toInt();
1736 myLabelSize = VISU::Storable::FindValue(theMap,"myLabelSize").toInt();
1737 myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
1738 myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
1740 myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
1741 myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
1742 myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
1743 myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
1744 myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
1745 myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
1746 myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
1748 myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
1749 myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
1750 myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
1751 myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
1752 myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
1753 myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
1754 myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
1757 QString aGeomNames = VISU::Storable::FindValue(theMap, "myGeomNameList", &anIsExists);
1759 QStringList aGeomNameList = aGeomNames.split("|", QString::SkipEmptyParts);
1760 int aNbOfGroups = aGeomNameList.count();
1761 if(aNbOfGroups > 0){
1763 for(int aGroupNum = 0; aGroupNum < aNbOfGroups; aGroupNum++){
1764 QString aGroupName = aGeomNameList[aGroupNum];
1765 AddMeshOnGroup(aGroupName.toLatin1().data());
1770 // Parameters of labels displayed field values
1772 myValLblFontType = VISU::Storable::FindValue( theMap, "myValLblFontType", "0" ).toInt();
1773 myIsBoldValLbl = VISU::Storable::FindValue( theMap, "myIsBoldValLbl", "1" ).toInt();
1774 myIsItalicValLbl = VISU::Storable::FindValue( theMap, "myIsItalicValLbl", "0" ).toInt();
1775 myIsShadowValLbl = VISU::Storable::FindValue( theMap, "myIsShadowValLbl", "0" ).toInt();
1776 myValLblFontSize = VISU::Storable::FindValue( theMap, "myValLblFontSize", "12" ).toDouble();
1777 myValLblFontColor[ 0 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[0]", "1" ).toFloat();
1778 myValLblFontColor[ 1 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[1]", "1" ).toFloat();
1779 myValLblFontColor[ 2 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[2]", "1" ).toFloat();
1784 //----------------------------------------------------------------------------
1786 VISU::ColoredPrs3d_i
1787 ::ToStream(std::ostringstream& theStr)
1789 TSuperClass::ToStream(theStr);
1791 Storable::DataToStream( theStr, "myEntity", GetEntity() );
1792 Storable::DataToStream( theStr, "myFieldName", GetCFieldName().c_str() );
1793 Storable::DataToStream( theStr, "myIteration", int(GetTimeStampNumber()) );
1794 Storable::DataToStream( theStr, "myIsTimeStampFixed", int(myIsTimeStampFixed) );
1796 Storable::DataToStream( theStr, "myScalarMode", int(GetScalarMode()) );
1797 Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
1798 Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
1799 Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() );
1801 Storable::DataToStream( theStr, "myIsFilteredByScalars", IsScalarFilterUsed() );
1802 Storable::DataToStream( theStr, "myScalarFilterRange[0]", GetScalarFilterMin() );
1803 Storable::DataToStream( theStr, "myScalarFilterRange[1]", GetScalarFilterMax() );
1805 Storable::DataToStream( theStr, "myIsDistributionVisible", GetIsDistributionVisible() ); // RKV
1807 Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
1808 Storable::DataToStream( theStr, "myOrientation", myOrientation );
1810 Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
1811 Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits );
1812 Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
1814 Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() );
1816 Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] );
1817 Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
1818 Storable::DataToStream( theStr, "myWidth", myWidth );
1819 Storable::DataToStream( theStr, "myHeight", myHeight );
1820 Storable::DataToStream( theStr, "myTitleSize", myTitleSize );
1821 Storable::DataToStream( theStr, "myLabelSize", myLabelSize );
1822 Storable::DataToStream( theStr, "myBarWidth", myBarWidth );
1823 Storable::DataToStream( theStr, "myBarHeight", myBarHeight );
1825 Storable::DataToStream( theStr, "myTitFontType", myTitFontType );
1826 Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle );
1827 Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle );
1828 Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle );
1829 Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] );
1830 Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] );
1831 Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] );
1833 Storable::DataToStream( theStr, "myLblFontType", myLblFontType );
1834 Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel );
1835 Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel );
1836 Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel );
1837 Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
1838 Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
1839 Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
1841 // Parameters of labels displayed field values
1843 Storable::DataToStream( theStr, "myValLblFontType", myValLblFontType );
1844 Storable::DataToStream( theStr, "myIsBoldValLbl", myIsBoldValLbl );
1845 Storable::DataToStream( theStr, "myIsItalicValLbl", myIsItalicValLbl );
1846 Storable::DataToStream( theStr, "myIsShadowValLbl", myIsShadowValLbl );
1847 Storable::DataToStream( theStr, "myValLblFontSize", myValLblFontSize );
1848 Storable::DataToStream( theStr, "myValLblFontColor[0]", myValLblFontColor[ 0 ] );
1849 Storable::DataToStream( theStr, "myValLblFontColor[1]", myValLblFontColor[ 1 ] );
1850 Storable::DataToStream( theStr, "myValLblFontColor[2]", myValLblFontColor[ 2 ] );
1853 std::ostringstream aGeomNameList;
1854 std::string aMeshName = GetCMeshName();
1855 const TGroupNames& aGroupNames = GetGroupNames();
1856 TGroupNames::const_iterator anIter = aGroupNames.begin();
1857 for(; anIter != aGroupNames.end(); anIter++){
1858 const std::string& aGroupName = *anIter;
1859 aGeomNameList<<aGroupName<<"|";
1861 Storable::DataToStream(theStr, "myGeomNameList", aGeomNameList.str().c_str());
1864 //----------------------------------------------------------------------------
1865 const VISU::ColoredPrs3d_i
1867 VISU::ColoredPrs3d_i
1870 return myGroupNames;
1873 //----------------------------------------------------------------------------
1875 VISU::ColoredPrs3d_i
1878 return !myGroupNames.empty();
1882 //----------------------------------------------------------------------------
1884 VISU::ColoredPrs3d_i
1885 ::SetMapScale(double theMapScale)
1887 GetSpecificPL()->SetMapScale(theMapScale);
1891 //----------------------------------------------------------------------------
1893 VISU::ColoredPrs3d_i
1894 ::CreatePipeLine(VISU_PipeLine* thePipeLine)
1896 if(MYDEBUG) MESSAGE("ColoredPrs3d_i::CreatePipeLine() - "<<thePipeLine);
1897 myColoredPL = dynamic_cast<VISU_ColoredPL*>(thePipeLine);
1899 SetPipeLine(myColoredPL);
1902 //----------------------------------------------------------------------------
1906 VISU::ColoredPrs3d_i
1907 ::Build(EBuildMode theBuildMode)
1910 MESSAGE("ColoredPrs3d_i::Build - "<<myFieldName<<"; theBuildMode = "<<theBuildMode);
1911 SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder();
1912 bool anIsPublishInStudy = (myPublishInStudyMode == EPublishUnderTimeStamp || myPublishInStudyMode == EPublishIndependently);
1913 if(anIsPublishInStudy)
1914 aStudyBuilder->NewCommand(); // There is a transaction
1919 SetName("NoName", false);
1920 if(theBuildMode == ECreateNew || theBuildMode == ESameAs){
1923 if(theBuildMode == ECreateNew)
1924 SetTitle(GetCFieldName().c_str());
1926 if(myPublishInStudyMode == EPublishUnderTimeStamp){
1927 SetName(GenerateName().toLatin1().data(), false);
1928 VISU::Storable::TRestoringMap aRestoringMap;
1929 aRestoringMap["myComment"] = "TIMESTAMP";
1930 aRestoringMap["myMeshName"] = GetCMeshName().c_str();
1931 aRestoringMap["myEntityId"] = QString::number(GetEntity());
1932 aRestoringMap["myFieldName"] = GetCFieldName().c_str();
1933 aRestoringMap["myTimeStampId"] = QString::number(GetTimeStampNumber());
1934 aRestoringMap["myNumComponent"] = QString::number(GetScalarField()->myNbComp);
1935 std::string anEntry = GetCResult()->GetEntry(aRestoringMap);
1937 throw std::runtime_error("There is no Entry for binding the presentation !!!");
1938 aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
1940 GetCMeshName().c_str(),
1942 GetCFieldName().c_str(),
1943 GetTimeStampNumber(),
1944 GetScalarField()->myNbComp);
1945 CORBA::String_var anIOR = GetID();
1946 CreateAttributes(GetStudyDocument(),
1952 aComment.toLatin1().data(),
1954 }else if(myPublishInStudyMode == EPublishIndependently){
1955 SetName(GenerateName().toLatin1().data(), false);
1956 CORBA::String_var anIOR = GetID();
1957 std::string aFatherEntry = ::FindOrCreate3DPresentationsFolder(GetStudyDocument());
1958 aComment.sprintf("myComment=%s",
1960 CreateAttributes(GetStudyDocument(),
1966 aComment.toLatin1().data(),
1970 }catch(std::exception& exc){
1971 INFOS("Follow exception was occured :\n"<<exc.what());
1974 INFOS("Unknown exception was occured!");
1979 if(anIsPublishInStudy)
1980 aStudyBuilder->CommitCommand();
1984 //----------------------------------------------------------------------------
1986 VISU::ColoredPrs3d_i
1987 ::SetIsDistributionVisible(CORBA::Boolean isVisible)
1989 if( myIsDistributionVisible != isVisible ){
1990 VISU::TSetModified aModified(this);
1991 myIsDistributionVisible = isVisible;
1992 myParamsTime.Modified();
1996 //----------------------------------------------------------------------------
1998 VISU::ColoredPrs3d_i
1999 ::GetIsDistributionVisible()
2001 return myIsDistributionVisible;
2004 //----------------------------------------------------------------------------
2008 VISU::ColoredPrs3d_i
2009 ::GetValLblFontType() const
2011 return myValLblFontType;
2014 //----------------------------------------------------------------------------
2017 VISU::ColoredPrs3d_i
2018 ::SetValLblFontType( const int theType )
2020 if ( myValLblFontType == theType )
2023 VISU::TSetModified aModified( this );
2025 myValLblFontType = theType;
2026 myParamsTime.Modified();
2029 //----------------------------------------------------------------------------
2032 VISU::ColoredPrs3d_i
2033 ::GetValLblFontSize() const
2035 return myValLblFontSize;
2038 //----------------------------------------------------------------------------
2041 VISU::ColoredPrs3d_i
2042 ::SetValLblFontSize( const double theSize )
2044 if ( VISU::CheckIsSameValue( myValLblFontSize, theSize ) )
2047 VISU::TSetModified aModified( this );
2049 myValLblFontSize = theSize;
2050 myParamsTime.Modified();
2053 //----------------------------------------------------------------------------
2056 VISU::ColoredPrs3d_i
2057 ::GetValLblFontColor( double& theR,
2059 double& theB ) const
2061 theR = myValLblFontColor[ 0 ];
2062 theG = myValLblFontColor[ 1 ];
2063 theB = myValLblFontColor[ 2 ];
2066 //----------------------------------------------------------------------------
2069 VISU::ColoredPrs3d_i
2070 ::SetValLblFontColor( const double theR,
2074 if ( VISU::CheckIsSameValue( myValLblFontColor[ 0 ], theR ) &&
2075 VISU::CheckIsSameValue( myValLblFontColor[ 1 ], theG ) &&
2076 VISU::CheckIsSameValue (myValLblFontColor[ 2 ], theB ) )
2079 VISU::TSetModified aModified(this);
2081 myValLblFontColor[ 0 ] = theR;
2082 myValLblFontColor[ 1 ] = theG;
2083 myValLblFontColor[ 2 ] = theB;
2084 myParamsTime.Modified();
2087 //----------------------------------------------------------------------------
2090 VISU::ColoredPrs3d_i
2091 ::IsBoldValLbl() const
2093 return myIsBoldValLbl;
2096 //----------------------------------------------------------------------------
2099 VISU::ColoredPrs3d_i
2100 ::SetBoldValLbl( const bool theVal )
2102 if ( myIsBoldValLbl == theVal )
2105 VISU::TSetModified aModified( this );
2107 myIsBoldValLbl = theVal;
2108 myParamsTime.Modified();
2111 //----------------------------------------------------------------------------
2114 VISU::ColoredPrs3d_i
2115 ::IsItalicValLbl() const
2117 return myIsItalicValLbl;
2120 //----------------------------------------------------------------------------
2123 VISU::ColoredPrs3d_i
2124 ::SetItalicValLbl( const bool theVal )
2126 if ( myIsItalicValLbl == theVal )
2129 VISU::TSetModified aModified( this );
2131 myIsItalicValLbl = theVal;
2132 myParamsTime.Modified();
2135 //----------------------------------------------------------------------------
2138 VISU::ColoredPrs3d_i
2139 ::IsShadowValLbl() const
2141 return myIsShadowValLbl;
2144 //----------------------------------------------------------------------------
2147 VISU::ColoredPrs3d_i
2148 ::SetShadowValLbl( const bool theVal )
2150 if ( myIsShadowValLbl == theVal )
2153 VISU::TSetModified aModified( this );
2155 myIsShadowValLbl = theVal;
2156 myParamsTime.Modified();
2159 //----------------------------------------------------------------------------
2162 VISU::ColoredPrs3d_i
2163 ::UpdateMapperLookupTable()
2165 ProcessVoidEvent(new TVoidMemFunEvent<VISU_ColoredPL>
2166 (GetSpecificPL(), &VISU_ColoredPL::UpdateMapperLookupTable));
2169 //----------------------------------------------------------------------------^