00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VISU_ColoredPrs3d_i_HeaderFile
00029 #define VISU_ColoredPrs3d_i_HeaderFile
00030
00031 #include "VISU_Prs3d_i.hh"
00032 #include "VISU_Result_i.hh"
00033 #include "VISU_BoostSignals.h"
00034 #include "SALOME_GenericObjPointer.hh"
00035
00036 #include <set>
00037
00038 class VISU_ColoredPL;
00039
00040 namespace VISU
00041 {
00042 class ColoredPrs3d_i;
00043
00044
00045 struct TMinMaxController
00046 {
00047 virtual
00048 void
00049 UpdateReference(ColoredPrs3d_i* theFromPrs3, ColoredPrs3d_i* theToPrs3d);
00050
00051 virtual
00052 vtkFloatingPointType
00053 GetComponentMin(vtkIdType theCompID);
00054
00055 virtual
00056 vtkFloatingPointType
00057 GetComponentMax(vtkIdType theCompID);
00058
00059 virtual
00060 void
00061 Register() = 0;
00062
00063 virtual
00064 void
00065 UnRegister() = 0;
00066 };
00067 typedef SALOME::GenericObjPtr<TMinMaxController> PMinMaxController;
00068
00069
00070
00071 struct TVTKMinMaxController: virtual TMinMaxController,
00072 virtual vtkObjectBase
00073 {
00074 virtual
00075 void
00076 Register()
00077 {
00078 vtkObjectBase::Register(NULL);
00079 }
00080
00081 virtual
00082 void
00083 UnRegister()
00084 {
00085 vtkObjectBase::Delete();
00086 }
00087 };
00088
00089
00090
00091 PMinMaxController
00092 CreateDefaultMinMaxController(VISU::ColoredPrs3d_i* theColoredPrs3d);
00093
00094
00095
00096 class VISU_I_EXPORT ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d,
00097 public virtual TMinMaxController,
00098 public virtual TResultObserver,
00099 public virtual Prs3d_i
00100 {
00101 ColoredPrs3d_i(const ColoredPrs3d_i&);
00102
00103 public:
00104
00105 typedef Prs3d_i TSuperClass;
00106 typedef VISU::ColoredPrs3d TInterface;
00107
00111 VISU_I_EXPORT enum EPublishInStudyMode {EPublishUnderTimeStamp, EPublishIndependently, ERegisterInCache, EDoNotPublish};
00112
00113 explicit
00114 ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode);
00115
00116 virtual
00117 ~ColoredPrs3d_i();
00118
00119 virtual
00120 void
00121 Register();
00122
00123 virtual
00124 void
00125 UnRegister();
00126
00127 virtual
00128 void
00129 RemoveFromStudy();
00130
00131
00133 virtual
00134 void
00135 UpdateFromResult(Result_i* theResult);
00136
00137
00138 virtual
00139 void
00140 SetEntity(Entity theEntity);
00141
00142 virtual
00143 Entity
00144 GetEntity();
00145
00146 TEntity
00147 GetTEntity() const;
00148
00149 virtual
00150 void
00151 SetFieldName(const char* theFieldName);
00152
00153 virtual
00154 char*
00155 GetFieldName();
00156
00157 std::string
00158 GetCFieldName() const;
00159
00160 virtual
00161 VISU::PField
00162 GetField();
00163
00164 virtual
00165 void
00166 SetTimeStampNumber(CORBA::Long theTimeStampNumber);
00167
00168 virtual
00169 CORBA::Long
00170 GetTimeStampNumber();
00171
00172 virtual
00173 CORBA::Long
00174 GetTimeStampNumberByIndex( CORBA::Long theIndex );
00175
00176 virtual
00177 CORBA::Long
00178 GetTimeStampIndexByNumber( CORBA::Long theNumber );
00179
00180 virtual
00181 VISU::PField
00182 GetScalarField();
00183
00184 VISU::PMinMaxController
00185 GetMinMaxController();
00186
00187 void
00188 SetMinMaxController( const VISU::PMinMaxController& theController );
00189
00190 void
00191 SetMinMaxController( ColoredPrs3d_i* theOrigin );
00192
00193 virtual
00194 CORBA::Long
00195 GetScalarTimeStampNumber() const;
00196
00197 virtual
00198 VISU::ColoredPrs3dHolder::TimeStampsRange*
00199 GetTimeStampsRange();
00200
00201 virtual
00202 CORBA::Boolean
00203 IsTimeStampFixed();
00204
00205 virtual
00206 EPublishInStudyMode
00207 GetPublishInStudyMode();
00208
00209
00210 virtual
00211 CORBA::Long
00212 GetScalarMode();
00213
00214 virtual
00215 void
00216 SetScalarMode(CORBA::Long theScalarMode);
00217
00218 virtual
00219 CORBA::Double
00220 GetMin();
00221
00222 virtual
00223 CORBA::Double
00224 GetMax();
00225
00226 virtual
00227 void
00228 SetRange(CORBA::Double theMin, CORBA::Double theMax);
00229
00230 virtual
00231 vtkFloatingPointType
00232 GetComponentMin(vtkIdType theCompID) = 0;
00233
00234 virtual
00235 vtkFloatingPointType
00236 GetComponentMax(vtkIdType theCompID) = 0;
00237
00238 virtual
00239 CORBA::Double
00240 GetSourceMin();
00241
00242 virtual
00243 CORBA::Double
00244 GetSourceMax();
00245
00246 virtual
00247 void
00248 SetSourceRange();
00249
00250 virtual
00251 CORBA::Boolean
00252 IsRangeFixed();
00253
00254 virtual
00255 void
00256 SetNbColors(CORBA::Long theNbColors);
00257
00258 virtual
00259 CORBA::Long
00260 GetNbColors();
00261
00262 virtual
00263 void
00264 SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
00265
00266 virtual
00267 VISU::ColoredPrs3dBase::Orientation
00268 GetBarOrientation();
00269
00270 virtual
00271 void
00272 SetPosition(CORBA::Double X, CORBA::Double Y);
00273
00274 virtual
00275 CORBA::Double
00276 GetPosX();
00277
00278 virtual
00279 CORBA::Double
00280 GetPosY();
00281
00282 virtual
00283 void
00284 SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
00285
00286 virtual
00287 void
00288 SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
00289 CORBA::Long theBarWidth, CORBA::Long theBarHeight);
00290
00291 virtual
00292 CORBA::Double
00293 GetWidth();
00294
00295 virtual
00296 CORBA::Double
00297 GetHeight();
00298
00299 virtual
00300 CORBA::Long
00301 GetTitleSize();
00302
00303 virtual
00304 CORBA::Long
00305 GetLabelSize();
00306
00307 virtual
00308 CORBA::Long
00309 GetBarWidth();
00310
00311 virtual
00312 CORBA::Long
00313 GetBarHeight();
00314
00315 virtual
00316 void
00317 SetLabels(CORBA::Long theNbLabels);
00318
00319 virtual
00320 CORBA::Long
00321 GetLabels();
00322
00323 virtual
00324 void
00325 SetLabelsFormat(const char* theFormat);
00326
00327 virtual
00328 char*
00329 GetLabelsFormat();
00330
00331 virtual
00332 void
00333 SetTitle(const char* theTitle);
00334
00335 virtual
00336 char*
00337 GetTitle();
00338
00339 std::string
00340 GetCTitle();
00341
00342 virtual
00343 void
00344 SetUnitsVisible(CORBA::Boolean isVisible);
00345
00346 virtual
00347 CORBA::Boolean
00348 IsUnitsVisible();
00349
00354 virtual void SetIsDistributionVisible(CORBA::Boolean theIs);
00355
00357 virtual CORBA::Boolean GetIsDistributionVisible();
00358
00360 virtual CORBA::Boolean IsScalarFilterUsed();
00361
00362 virtual void UseScalarFiltering( CORBA::Boolean theUseScalarFilter );
00363
00370 virtual
00371 void
00372 SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax );
00373
00374
00375 virtual
00376 CORBA::Double
00377 GetScalarFilterMin();
00378
00379
00380 virtual
00381 CORBA::Double
00382 GetScalarFilterMax();
00383
00384
00386 virtual
00387 CORBA::Float
00388 GetMemorySize();
00389
00390
00392 VISU::ColoredPrs3dHolder::BasicInput*
00393 GetBasicInput();
00394
00395 virtual
00396 void
00397 SetHolderEntry(const std::string& theEntry);
00398
00399 virtual
00400 std::string
00401 GetHolderEntry();
00402
00404 void
00405 SaveRestoringState(SALOMEDS::SObject_ptr theSObject,
00406 const Storable::TRestoringMap& theMap);
00407
00409 void
00410 InitFromRestoringState();
00411
00412
00413 virtual
00414 const char*
00415 GetIconName() = 0;
00416
00417
00418
00420 virtual
00421 void
00422 SetSourceGeometry()=0;
00423
00425 virtual
00426 void
00427 AddMeshOnGroup(const char* theGroupName)=0;
00428
00430 virtual
00431 void
00432 RemoveAllGeom()=0;
00433
00434 typedef std::string TGroupName;
00435 typedef std::set<TGroupName> TGroupNames;
00436
00437 const TGroupNames&
00438 GetGroupNames();
00439
00441 bool
00442 IsGroupsUsed();
00443
00444
00445 public:
00449 virtual
00450 Storable*
00451 Create(const std::string& theMeshName,
00452 VISU::Entity theEntity,
00453 const std::string& theFieldName,
00454 CORBA::Long theTimeStampNumber);
00455
00459 virtual
00460 Storable*
00461 Restore(SALOMEDS::SObject_ptr theSObject,
00462 const Storable::TRestoringMap& theMap);
00463
00467 virtual
00468 void
00469 ToStream(std::ostringstream& theStr);
00470
00474 virtual
00475 void
00476 SameAs(const Prs3d_i* theOrigin);
00477
00478 virtual
00479 void
00480 UpdateActor(VISU_ActorBase* theActor);
00481
00482 virtual
00483 bool
00484 IsBoldTitle();
00485
00486 virtual
00487 void
00488 SetBoldTitle(bool isBold);
00489
00490 virtual
00491 bool
00492 IsItalicTitle();
00493
00494 virtual
00495 void
00496 SetItalicTitle(bool isItalic);
00497
00498 virtual
00499 bool
00500 IsShadowTitle();
00501
00502 virtual
00503 void
00504 SetShadowTitle(bool isShadow);
00505
00506 virtual
00507 int
00508 GetTitFontType();
00509
00510 virtual
00511 void
00512 SetTitFontType(int theType);
00513
00514 virtual
00515 void
00516 GetTitleColor(vtkFloatingPointType& theR,
00517 vtkFloatingPointType& theG,
00518 vtkFloatingPointType& theB);
00519
00520 virtual
00521 void
00522 SetTitleColor(vtkFloatingPointType theR,
00523 vtkFloatingPointType theG,
00524 vtkFloatingPointType theB);
00525
00526 virtual
00527 bool
00528 IsBoldLabel();
00529
00530 virtual
00531 void
00532 SetBoldLabel(bool isBold);
00533
00534 virtual
00535 bool
00536 IsItalicLabel();
00537
00538 virtual
00539 void
00540 SetItalicLabel(bool isItalic);
00541
00542 virtual
00543 bool
00544 IsShadowLabel();
00545
00546 virtual
00547 void
00548 SetShadowLabel(bool isShadow);
00549
00550 virtual
00551 int
00552 GetLblFontType();
00553
00554 virtual
00555 void
00556 SetLblFontType(int theType);
00557
00558 virtual
00559 void
00560 GetLabelColor(vtkFloatingPointType& theR,
00561 vtkFloatingPointType& theG,
00562 vtkFloatingPointType& theB);
00563
00564 virtual
00565 void
00566 SetLabelColor(vtkFloatingPointType theR,
00567 vtkFloatingPointType theG,
00568 vtkFloatingPointType theB);
00569
00570 virtual
00571 void
00572 SetMapScale(double theMapScale = 1.0);
00573
00574 VISU_ColoredPL*
00575 GetSpecificPL() const
00576 {
00577 return myColoredPL;
00578 }
00579
00580 virtual
00581 int
00582 GetValLblFontType() const;
00583
00584 virtual
00585 void
00586 SetValLblFontType( const int theType );
00587
00588 virtual
00589 double
00590 GetValLblFontSize() const;
00591
00592 virtual
00593 void
00594 SetValLblFontSize( const double theSize );
00595
00596 virtual
00597 bool
00598 IsBoldValLbl() const;
00599
00600 virtual
00601 void
00602 SetBoldValLbl( const bool theVal );
00603
00604 virtual
00605 bool
00606 IsItalicValLbl() const;
00607
00608 virtual
00609 void
00610 SetItalicValLbl( const bool theVal );
00611
00612 virtual
00613 bool
00614 IsShadowValLbl() const;
00615
00616 virtual
00617 void
00618 SetShadowValLbl( const bool theVal );
00619
00620 virtual
00621 void
00622 GetValLblFontColor( vtkFloatingPointType& theR,
00623 vtkFloatingPointType& theG,
00624 vtkFloatingPointType& theB ) const;
00625
00626 virtual
00627 void
00628 SetValLblFontColor( const vtkFloatingPointType theR,
00629 const vtkFloatingPointType theG,
00630 const vtkFloatingPointType theB );
00631
00632 virtual
00633 void
00634 UpdateMapperLookupTable();
00635
00636
00637
00638 protected:
00643 virtual
00644 bool
00645 SetInput(bool theReInit);
00646
00648 virtual
00649 void
00650 OnRestoreInput();
00651
00656 virtual
00657 bool
00658 CheckIsPossible() = 0;
00659
00663 virtual
00664 void
00665 CreatePipeLine(VISU_PipeLine* thePipeLine);
00666
00673 virtual
00674 bool
00675 OnSetInput(bool theReInit);
00676
00681 virtual
00682 void
00683 DoSetInput(bool theIsInitilizePipe, bool theReInit) = 0;
00684
00688 enum EBuildMode {ECreateNew, ESameAs, ERestore};
00689
00693 Storable*
00694 Build(EBuildMode theBuildMode);
00695
00696 virtual
00697 void
00698 SetField(VISU::PField theField);
00699
00700 void
00701 UseFixedRange(bool theUseFixedRange);
00702
00703 std::string
00704 GetScalarBarTitle();
00705
00707 virtual
00708 std::string
00709 GetActorEntry();
00710
00711 TGroupNames myGroupNames;
00712
00713 private:
00714 bool myIsRestored;
00715 Storable::TRestoringMap myRestoringMap;
00716 SALOMEDS::SObject_var myRestoringSObject;
00717
00718
00719 VISU::Entity myEntity;
00720 VISU::Entity myPreviousEntity;
00721
00722 std::string myFieldName;
00723 std::string myPreviousFieldName;
00724
00725 CORBA::Long myTimeStampNumber;
00726 CORBA::Long myPreviousTimeStampNumber;
00727
00728 boost::signalslib::connection myResultConnection;
00729
00730 bool myIsTimeStampFixed;
00731
00732 PField myField;
00733 PMinMaxController myMinMaxController;
00734 EPublishInStudyMode myPublishInStudyMode;
00735
00736 std::string myHolderEntry;
00737
00738 std::string myTitle;
00739 std::string myScalarBarTitle;
00740 bool myIsUnits;
00741
00742 int myNumberOfLabels;
00743 std::string myLabelsFormat;
00744
00745 VISU::ColoredPrs3dBase::Orientation myOrientation;
00746 vtkFloatingPointType myPosition[2],
00747 myWidth, myHeight,
00748 myTitleSize, myLabelSize,
00749 myBarWidth, myBarHeight;
00750
00751
00752 bool myIsBoldTitle;
00753 bool myIsItalicTitle;
00754 bool myIsShadowTitle;
00755 int myTitFontType;
00756 vtkFloatingPointType myTitleColor[3];
00757
00758 bool myIsBoldLabel;
00759 bool myIsItalicLabel;
00760 bool myIsShadowLabel;
00761 int myLblFontType;
00762 vtkFloatingPointType myLabelColor[3];
00763
00764 VISU_ColoredPL* myColoredPL;
00765 bool myIsFixedRange;
00766
00767 bool myIsDistributionVisible;
00768
00769
00770 int myValLblFontType;
00771 double myValLblFontSize;
00772 bool myIsBoldValLbl;
00773 bool myIsItalicValLbl;
00774 bool myIsShadowValLbl;
00775 vtkFloatingPointType myValLblFontColor[ 3 ];
00776 };
00777
00778
00779
00780 template<class TColoredPrs3d>
00781 Storable*
00782 StorableEngine(SALOMEDS::SObject_ptr theSObject,
00783 const Storable::TRestoringMap& theMap,
00784 const std::string& thePrefix,
00785 CORBA::Boolean theIsMultiFile)
00786 {
00787 TColoredPrs3d* aColoredPrs3d = new TColoredPrs3d(ColoredPrs3d_i::EDoNotPublish);
00788 return aColoredPrs3d->Restore(theSObject, theMap);
00789 }
00790
00791
00792
00793 }
00794
00795 #endif