1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : VISU_PrsObject_i.hxx
6 // Author : Alexey PETROV
9 #ifndef VISU_PrsObject_i_HeaderFile
10 #define VISU_PrsObject_i_HeaderFile
12 #include "VISU_Result_i.hh"
13 //#include "VISU_Convertor.hxx"
14 #include "Handle_SALOME_InteractiveObject.hxx"
17 class VISU_FieldTransform;
18 class VISU_ScalarBarActor;
19 class VISU_LookupTable;
22 class vtkDataSetMapper;
26 class vtkPolyDataMapper;
28 class vtkGeometryFilter;
31 class vtkContourFilter;
32 class vtkAppendPolyData;
36 class vtkPolyDataSource;
41 //==============================================================================
42 class PrsObject_i : public virtual POA_VISU::PrsObject,
43 public virtual Storable
45 PrsObject_i(const PrsObject_i&);
48 PrsObject_i(SALOMEDS::Study_ptr theStudy) :
49 myStudy(SALOMEDS::Study::_duplicate(theStudy)) {};
50 virtual ~PrsObject_i() {}
54 SALOMEDS::Study_var myStudy;
57 virtual const char* GetName() const { return myName.c_str();}
58 virtual void SetName( const char* theName );
59 const SALOMEDS::Study_var& GetStudyDocument() const { return myStudy;}
64 //==============================================================================
65 class Prs3d_i : public virtual POA_VISU::Prs3d,
66 public virtual PrsObject_i
69 Prs3d_i(const Prs3d_i&);
71 Prs3d_i(Result_i* theResult);
72 virtual void SameAs(const Prs3d_i* theOrigin);
74 virtual void Destroy();
76 typedef vtkPolyDataMapper MapperType;
77 typedef vtkDataSet DataType;
79 virtual SALOMEDS::Color GetColor() { return myColor;}
80 virtual void SetColor(const SALOMEDS::Color& theColor);
85 vtkGeometryFilter *myGeomFilter;
87 struct SALOMEDS::Color myColor;
90 bool CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL);
93 virtual void Update();
94 virtual const char* GetComment() const = 0;
95 virtual QString GenerateName() = 0;
96 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
97 throw(std::logic_error&);
98 virtual void ToStream(std::ostringstream& theStr);
99 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
100 virtual void UpdateActor(VISU_Actor* theActor);
101 MapperType* GetMapper() const { return myMapper;}
102 Result_i* GetResult() const { return myResult; }
106 //==============================================================================
107 class Mesh_i : public virtual POA_VISU::Mesh,
108 public virtual Prs3d_i
110 static int myNbPresent;
112 Mesh_i(const Mesh_i&);
114 Mesh_i(Result_i* theResult);
115 virtual void SameAs(const Mesh_i* theOrigin);
117 virtual void Destroy();
119 virtual VISU::VISUType GetType() { return VISU::TMESH;};
121 virtual void SetCellColor(const SALOMEDS::Color& theColor) { SetColor(theColor);}
122 virtual SALOMEDS::Color GetCellColor() { return GetColor();}
124 virtual void SetNodeColor(const SALOMEDS::Color& theColor) { myNodeColor = theColor;}
125 virtual SALOMEDS::Color GetNodeColor() { return myNodeColor;}
127 virtual void SetLinkColor(const SALOMEDS::Color& theColor) { myLinkColor = theColor;}
128 virtual SALOMEDS::Color GetLinkColor() { return myLinkColor;}
130 virtual void SetPresentationType(VISU::PresentationType theType) { myPresentType = theType;}
131 virtual PresentationType GetPresentationType() { return myPresentType;}
133 typedef VISU::Mesh InterfaceType;
134 typedef vtkUnstructuredGridReader InputType;
137 Storable* Build(int theRestoring);
140 VISU::VISUType myType;
143 string mySubMeshName;
144 struct SALOMEDS::Color myNodeColor, myLinkColor;
145 VISU::PresentationType myPresentType;
148 virtual Storable* Create(const char* theMeshName, int theEntity);
149 virtual Storable* Create(const char* theMeshName, int theEntity, const char* theFamilyName);
150 virtual Storable* Create(const char* theMeshName, const char* theGroupName);
151 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
152 throw(std::logic_error&);
153 virtual void ToStream(std::ostringstream& theStr);
154 static const string myComment;
155 virtual const char* GetComment() const;
156 virtual QString GenerateName();
157 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
158 virtual void UpdateActor(VISU_Actor* theActor);
159 virtual InputType* GetInput() const { return myInput;}
161 Storable* MeshRestore(SALOMEDS::SObject_ptr theSObject,
162 const string& thePrefix, const Storable::TRestoringMap& theMap)
163 throw(std::logic_error&);
166 //==============================================================================
167 class ScalarMap_i : public virtual POA_VISU::ScalarMap,
168 public virtual Prs3d_i
170 static int myNbPresent;
172 ScalarMap_i(const ScalarMap_i&);
175 ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
176 virtual void SameAs(const ScalarMap_i* theOrigin);
177 virtual ~ScalarMap_i();
178 virtual void Destroy();
180 virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
182 virtual void SetScalarMode(CORBA::Long theScalarMode);
183 virtual CORBA::Long GetScalarMode() { return myScalarMode;}
185 virtual void SetScaling(VISU::Scaling theScaling);
186 virtual VISU::Scaling GetScaling();
188 virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
189 virtual CORBA::Double GetMin() { return myScalarRange[0];}
190 virtual CORBA::Double GetMax() { return myScalarRange[1];}
192 virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation) {
193 myOrientation = theOrientation;
195 virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
197 virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
198 virtual CORBA::Double GetPosX() { return myPosition[0];}
199 virtual CORBA::Double GetPosY() { return myPosition[1];}
201 virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
202 myWidth = theWidth; myHeight = theHeight;
204 virtual CORBA::Double GetWidth() { return myWidth;}
205 virtual CORBA::Double GetHeight() { return myHeight;}
207 virtual void SetNbColors(CORBA::Long theNbColors) { myNumberOfColors = theNbColors;}
208 virtual CORBA::Long GetNbColors() { return myNumberOfColors;}
210 virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
211 virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
213 virtual void SetTitle(const char* theName) { myTitle = theName;}
214 virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
216 virtual void CalculateRange();
217 virtual void GetFieldRange(float theRange[2]);
218 virtual bool isRangeFixed() { return myIsFixedRange; }
220 virtual double GetIteration() { return myIteration; }
222 typedef VISU::ScalarMap InterfaceType;
223 typedef VISU_Extractor InputType;
226 Storable* Build(int theRestoring);
227 virtual DataType* DoHook(int theRestoring);
236 VISU_LookupTable *myMapperTable, *myBarTable;
237 VISU_FieldTransform *myFieldTransform;
238 const TField* myField;
240 float myScalarRange[2];
243 VISU::Scaling myScaling;
247 VISU::ScalarMap::Orientation myOrientation;
248 int myNumberOfColors, myNumberOfLabels;
249 float myPosition[2], myWidth, myHeight;
252 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
253 const char* theFieldName, double theIteration);
254 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
255 throw(std::logic_error&);
256 static const string myComment;
257 virtual const char* GetComment() const;
258 virtual QString GenerateName();
259 virtual void ToStream(std::ostringstream& theStr);
260 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
261 const char* theFieldName, double theIteration);
262 InputType* GetInput() { return myInput;}
264 const VISU::TField* GetField() const { return myField;}
265 const string& GetFieldName() const { return myFieldName;}
266 int GetScalarMode() const { return myScalarMode;}
267 virtual void SetMapScale(double theMapScale = 1.0);
269 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
270 virtual void UpdateActor(VISU_Actor* theActor);
272 Storable* ScalarMapRestore(SALOMEDS::SObject_ptr theSObject,
273 const string& thePrefix, const Storable::TRestoringMap& theMap)
274 throw(std::logic_error&);
277 //==============================================================================
278 class DeformedShape_i : public virtual POA_VISU::DeformedShape,
279 public virtual ScalarMap_i
281 static int myNbPresent;
283 DeformedShape_i(const DeformedShape_i&);
285 DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
286 virtual void SameAs(const DeformedShape_i* theOrigin);
287 virtual ~DeformedShape_i();
288 virtual void Destroy();
290 virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
292 virtual void SetScale(CORBA::Double theScale) { myFactor = theScale;}
293 virtual CORBA::Double GetScale() { return myFactor;}
295 typedef VISU::DeformedShape InterfaceType;
297 virtual bool isColored() { return myIsColored; }
298 virtual void setColored(bool theColor) { myIsColored = theColor; }
299 virtual void SetColor(const SALOMEDS::Color& theColor);
302 virtual DataType* DoHook(int theRestoring);
304 vtkWarpVector *myWarpVector;
307 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
308 const char* theFieldName, double theIteration);
309 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
310 throw(std::logic_error&);
311 static const string myComment;
312 virtual const char* GetComment() const;
313 virtual QString GenerateName();
314 virtual void Update();
315 virtual void ToStream(std::ostringstream& theStr);
316 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
317 const char* theFieldName, double theIteration);
319 virtual void SetMapScale(double theMapScale = 1.0);
321 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
322 virtual void UpdateActor(VISU_Actor* theActor);
324 Storable* DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject,
325 const string& thePrefix, const Storable::TRestoringMap& theMap)
326 throw(std::logic_error&);
331 //==============================================================================
332 class CutPlanes_i : public virtual POA_VISU::CutPlanes,
333 public virtual ScalarMap_i
335 static int myNbPresent;
337 CutPlanes_i(const CutPlanes_i&);
339 CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
340 virtual void SameAs(const CutPlanes_i* theOrigin);
341 virtual ~CutPlanes_i();
342 virtual void Destroy();
344 virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
346 virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
347 myBasePlane = theOrient;
349 virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane;}
351 virtual void SetDisplacement(CORBA::Double theDisp) { myDisplacement = theDisp;}
352 virtual CORBA::Double GetDisplacement() { return myDisplacement;}
354 virtual void SetNbPlanes(CORBA::Long theNb) { myNbPlanes = theNb;}
355 virtual CORBA::Long GetNbPlanes() { return myNbPlanes;}
357 virtual void SetRotateX(CORBA::Double theAngle);
358 virtual CORBA::Double GetRotateX();
359 virtual void SetRotateY(CORBA::Double theAngle);
360 virtual CORBA::Double GetRotateY();
362 typedef VISU::CutPlanes InterfaceType;
365 virtual DataType* DoHook(int theRestoring);
368 float myAng[3], myDisplacement;
369 vtkAppendPolyData *myAppendPolyData;
370 VISU::CutPlanes::Orientation myBasePlane;
373 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
374 const char* theFieldName, double theIteration);
375 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
376 throw(std::logic_error&);
377 static const string myComment;
378 virtual const char* GetComment() const;
379 virtual QString GenerateName();
380 virtual void Update();
381 virtual void ToStream(std::ostringstream& theStr);
382 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
383 const char* theFieldName, double theIteration);
384 void SetPlane(int theId);
386 Storable* CutPlanesRestore(SALOMEDS::SObject_ptr theSObject,
387 const string& thePrefix, const Storable::TRestoringMap& theMap)
388 throw(std::logic_error&);
392 //==============================================================================
393 class CutLines_i : public virtual POA_VISU::CutLines,
394 public virtual ScalarMap_i
396 static int myNbPresent;
398 CutLines_i(const CutPlanes_i&);
400 CutLines_i(Result_i* theResult, bool theAddToStudy = true);
401 virtual void SameAs(const CutLines_i* theOrigin);
402 virtual ~CutLines_i();
403 virtual void Destroy();
405 virtual VISU::VISUType GetType() { return VISU::TCUTLINES;};
407 virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
408 myBasePlane[0] = theOrient;
410 virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane[0];}
412 virtual void SetOrientationType2(VISU::CutPlanes::Orientation theOrient) {
413 myBasePlane[1] = theOrient;
415 virtual VISU::CutPlanes::Orientation GetOrientationType2() { return myBasePlane[1];}
417 virtual void SetDisplacement(CORBA::Double theDisp) { myDisplacement[0] = theDisp;}
418 virtual CORBA::Double GetDisplacement() { return myDisplacement[0];}
419 virtual void SetDisplacement2(CORBA::Double theDisp) { myDisplacement[1] = theDisp;}
420 virtual CORBA::Double GetDisplacement2() { return myDisplacement[1];}
422 virtual void SetNbLines(CORBA::Long theNb) { myNbLines = theNb;}
423 virtual CORBA::Long GetNbLines() { return myNbLines;}
425 virtual void SetRotateX(CORBA::Double theAngle);
426 virtual CORBA::Double GetRotateX();
427 virtual void SetRotateY(CORBA::Double theAngle);
428 virtual CORBA::Double GetRotateY();
430 virtual void SetRotateX2(CORBA::Double theAngle);
431 virtual CORBA::Double GetRotateX2();
432 virtual void SetRotateY2(CORBA::Double theAngle);
433 virtual CORBA::Double GetRotateY2();
435 typedef VISU::CutLines InterfaceType;
438 virtual DataType* DoHook(int theRestoring);
441 vtkAppendPolyData *myAppendPolyData;
442 float myAng[2][3], myDisplacement[2];
443 VISU::CutPlanes::Orientation myBasePlane[2];
444 float myDirLn[3], myBoundPrjLn[3], myBasePnt[3];
447 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
448 const char* theFieldName, double theIteration);
449 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
450 throw(std::logic_error&);
451 void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
452 static const string myComment;
453 virtual const char* GetComment() const;
454 virtual QString GenerateName();
455 virtual void Update();
456 virtual void ToStream(std::ostringstream& theStr);
457 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
458 const char* theFieldName, double theIteration);
460 Storable* CutLinesRestore(SALOMEDS::SObject_ptr theSObject,
461 const string& thePrefix, const Storable::TRestoringMap& theMap)
462 throw(std::logic_error&);
466 //==============================================================================
467 class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
468 public virtual ScalarMap_i
470 static int myNbPresent;
472 IsoSurfaces_i(const IsoSurfaces_i&);
474 IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
475 virtual void SameAs(const IsoSurfaces_i* theOrigin);
476 virtual ~IsoSurfaces_i();
477 virtual void Destroy();
479 virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
481 virtual void SetNbSurfaces(CORBA::Long theNb) { myNbSurface = theNb;}
482 virtual CORBA::Long GetNbSurfaces() { return myNbSurface;}
484 virtual void SetRange(float theMin, float theMax);
485 virtual float GetRangeMin() { return myRange[0]; }
486 virtual float GetRangeMax() { return myRange[1]; }
488 typedef VISU::IsoSurfaces InterfaceType;
491 virtual DataType* DoHook(int theRestoring);
493 vtkContourFilter *myContourFilter;
498 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
499 const char* theFieldName, double theIteration);
500 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
501 throw(std::logic_error&);
502 static const string myComment;
503 virtual const char* GetComment() const;
504 virtual QString GenerateName();
505 virtual void Update();
506 virtual void ToStream(std::ostringstream& theStr);
507 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
508 const char* theFieldName, double theIteration);
509 virtual void SetMapScale(double theMapScale = 1.0);
511 Storable* IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject,
512 const string& thePrefix, const Storable::TRestoringMap& theMap)
513 throw(std::logic_error&);
517 //==============================================================================
518 class StreamLines_i : public virtual POA_VISU::StreamLines,
519 public virtual DeformedShape_i
521 static int myNbPresent;
523 StreamLines_i(const StreamLines_i&);
525 StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
526 virtual void SameAs(const StreamLines_i* theOriginal);
527 virtual ~StreamLines_i();
528 virtual void Destroy();
530 virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
532 typedef VISU::StreamLines InterfaceType;
534 virtual void SetDirection(VISU::StreamLines::Direction theDirection)
535 { myDirection = theDirection; }
536 virtual VISU::StreamLines::Direction GetDirection() { return myDirection;}
538 virtual void SetStepLength(CORBA::Double theStep) { myStepLength = theStep; }
539 virtual CORBA::Double GetStepLength() { return myStepLength; }
541 virtual void SetPropagationTime(CORBA::Double theTime) { myPropagationTime = theTime; }
542 virtual CORBA::Double GetPropagationTime() { return myPropagationTime; }
544 virtual void SetIntegrationStep(CORBA::Double theStep) { myIntegrationStep = theStep; }
545 virtual CORBA::Double GetIntegrationStep() { return myIntegrationStep; }
547 virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
548 virtual VISU::Prs3d_ptr GetSource();
550 virtual void SetUsedPoints(CORBA::Double thePercents) { myPercents = thePercents; }
551 virtual CORBA::Double GetUsedPoints() { return myPercents; }
554 virtual DataType* DoHook(int theRestoring);
555 vtkStreamLine* myStream;
557 VISU::StreamLines::Direction myDirection;
559 float myIntegrationStep;
560 float myPropagationTime;
561 string mySourceEntry;
562 VISU::Prs3d_i* myPrs3di;
566 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
567 const char* theFieldName, double theIteration);
568 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
569 throw(std::logic_error&);
570 static const string myComment;
571 virtual const char* GetComment() const;
572 virtual QString GenerateName();
574 virtual float GetMinIntegrationStep();
575 virtual float GetMaxIntegrationStep();
576 virtual float GetBasePropagationTime();
578 virtual void Update();
579 virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); }
580 virtual void ToStream(std::ostringstream& theStr);
581 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
582 const char* theFieldName, double theIteration);
584 Storable* StreamLinesRestore(SALOMEDS::SObject_ptr theSObject,
585 const string& thePrefix, const Storable::TRestoringMap& theMap)
586 throw(std::logic_error&);
589 //==============================================================================
590 class Vectors_i : public virtual POA_VISU::Vectors,
591 public virtual DeformedShape_i
593 static int myNbPresent;
595 Vectors_i(const Vectors_i&);
597 Vectors_i(Result_i* theResult, bool theAddToStudy = true);
598 virtual void SameAs(const Vectors_i* theOrigin);
599 virtual ~Vectors_i();
600 virtual void Destroy();
602 virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
604 virtual void SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth;}
605 virtual CORBA::Double GetLineWidth() { return myLineWidth;}
607 virtual void SetGlyphType(VISU::Vectors::GlyphType theType) { myTypeGlyph = theType;}
608 virtual VISU::Vectors::GlyphType GetGlyphType() { return myTypeGlyph;}
610 virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos) { myPosGlyph = thePos;}
611 virtual VISU::Vectors::GlyphPos GetGlyphPos() { return myPosGlyph;}
613 typedef VISU::Vectors InterfaceType;
616 virtual DataType* DoHook(int theRestoring);
619 VISU::Vectors::GlyphType myTypeGlyph;
620 VISU::Vectors::GlyphPos myPosGlyph;
625 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
626 const char* theFieldName, double theIteration);
627 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
628 throw(std::logic_error&);
629 static const string myComment;
630 virtual const char* GetComment() const;
631 virtual QString GenerateName();
632 virtual void Update();
633 virtual void ToStream(std::ostringstream& theStr);
634 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
635 const char* theFieldName, double theIteration);
636 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
637 virtual void UpdateActor(VISU_Actor* theActor);
639 Storable* VectorsRestore(SALOMEDS::SObject_ptr theSObject,
640 const string& thePrefix, const Storable::TRestoringMap& theMap)
641 throw(std::logic_error&);
642 //==============================================================================