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 virtual void Update();
265 const VISU::TField* GetField() const { return myField;}
266 const string& GetFieldName() const { return myFieldName;}
267 int GetScalarMode() const { return myScalarMode;}
268 virtual void SetMapScale(double theMapScale = 1.0);
270 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
271 virtual void UpdateActor(VISU_Actor* theActor);
273 Storable* ScalarMapRestore(SALOMEDS::SObject_ptr theSObject,
274 const string& thePrefix, const Storable::TRestoringMap& theMap)
275 throw(std::logic_error&);
278 //==============================================================================
279 class DeformedShape_i : public virtual POA_VISU::DeformedShape,
280 public virtual ScalarMap_i
282 static int myNbPresent;
284 DeformedShape_i(const DeformedShape_i&);
286 DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
287 virtual void SameAs(const DeformedShape_i* theOrigin);
288 virtual ~DeformedShape_i();
289 virtual void Destroy();
291 virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
293 virtual void SetScale(CORBA::Double theScale) { myFactor = theScale;}
294 virtual CORBA::Double GetScale() { return myFactor;}
296 typedef VISU::DeformedShape InterfaceType;
298 virtual bool isColored() { return myIsColored; }
299 virtual void setColored(bool theColor) { myIsColored = theColor; }
300 virtual void SetColor(const SALOMEDS::Color& theColor);
303 virtual DataType* DoHook(int theRestoring);
305 vtkWarpVector *myWarpVector;
308 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
309 const char* theFieldName, double theIteration);
310 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
311 throw(std::logic_error&);
312 static const string myComment;
313 virtual const char* GetComment() const;
314 virtual QString GenerateName();
315 virtual void Update();
316 virtual void ToStream(std::ostringstream& theStr);
317 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
318 const char* theFieldName, double theIteration);
320 virtual void SetMapScale(double theMapScale = 1.0);
322 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
323 virtual void UpdateActor(VISU_Actor* theActor);
325 Storable* DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject,
326 const string& thePrefix, const Storable::TRestoringMap& theMap)
327 throw(std::logic_error&);
332 //==============================================================================
333 class CutPlanes_i : public virtual POA_VISU::CutPlanes,
334 public virtual ScalarMap_i
336 static int myNbPresent;
338 CutPlanes_i(const CutPlanes_i&);
340 CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
341 virtual void SameAs(const CutPlanes_i* theOrigin);
342 virtual ~CutPlanes_i();
343 virtual void Destroy();
345 virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
347 virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
348 myBasePlane = theOrient;
350 virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane;}
352 virtual void SetDisplacement(CORBA::Double theDisp) { myDisplacement = theDisp;}
353 virtual CORBA::Double GetDisplacement() { return myDisplacement;}
355 virtual void SetNbPlanes(CORBA::Long theNb) { myNbPlanes = theNb;}
356 virtual CORBA::Long GetNbPlanes() { return myNbPlanes;}
358 virtual void SetRotateX(CORBA::Double theAngle);
359 virtual CORBA::Double GetRotateX();
360 virtual void SetRotateY(CORBA::Double theAngle);
361 virtual CORBA::Double GetRotateY();
363 typedef VISU::CutPlanes InterfaceType;
366 virtual DataType* DoHook(int theRestoring);
369 float myAng[3], myDisplacement;
370 vtkAppendPolyData *myAppendPolyData;
371 VISU::CutPlanes::Orientation myBasePlane;
374 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
375 const char* theFieldName, double theIteration);
376 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
377 throw(std::logic_error&);
378 static const string myComment;
379 virtual const char* GetComment() const;
380 virtual QString GenerateName();
381 virtual void Update();
382 virtual void ToStream(std::ostringstream& theStr);
383 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
384 const char* theFieldName, double theIteration);
385 void SetPlane(int theId);
387 Storable* CutPlanesRestore(SALOMEDS::SObject_ptr theSObject,
388 const string& thePrefix, const Storable::TRestoringMap& theMap)
389 throw(std::logic_error&);
393 //==============================================================================
394 class CutLines_i : public virtual POA_VISU::CutLines,
395 public virtual ScalarMap_i
397 static int myNbPresent;
399 CutLines_i(const CutPlanes_i&);
401 CutLines_i(Result_i* theResult, bool theAddToStudy = true);
402 virtual void SameAs(const CutLines_i* theOrigin);
403 virtual ~CutLines_i();
404 virtual void Destroy();
406 virtual VISU::VISUType GetType() { return VISU::TCUTLINES;};
408 virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
409 myBasePlane[0] = theOrient;
411 virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane[0];}
413 virtual void SetOrientationType2(VISU::CutPlanes::Orientation theOrient) {
414 myBasePlane[1] = theOrient;
416 virtual VISU::CutPlanes::Orientation GetOrientationType2() { return myBasePlane[1];}
418 virtual void SetDisplacement(CORBA::Double theDisp) { myDisplacement[0] = theDisp;}
419 virtual CORBA::Double GetDisplacement() { return myDisplacement[0];}
420 virtual void SetDisplacement2(CORBA::Double theDisp) { myDisplacement[1] = theDisp;}
421 virtual CORBA::Double GetDisplacement2() { return myDisplacement[1];}
423 virtual void SetNbLines(CORBA::Long theNb) { myNbLines = theNb;}
424 virtual CORBA::Long GetNbLines() { return myNbLines;}
426 virtual void SetRotateX(CORBA::Double theAngle);
427 virtual CORBA::Double GetRotateX();
428 virtual void SetRotateY(CORBA::Double theAngle);
429 virtual CORBA::Double GetRotateY();
431 virtual void SetRotateX2(CORBA::Double theAngle);
432 virtual CORBA::Double GetRotateX2();
433 virtual void SetRotateY2(CORBA::Double theAngle);
434 virtual CORBA::Double GetRotateY2();
436 typedef VISU::CutLines InterfaceType;
439 virtual DataType* DoHook(int theRestoring);
442 vtkAppendPolyData *myAppendPolyData;
443 float myAng[2][3], myDisplacement[2];
444 VISU::CutPlanes::Orientation myBasePlane[2];
445 float myDirLn[3], myBoundPrjLn[3], myBasePnt[3];
448 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
449 const char* theFieldName, double theIteration);
450 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
451 throw(std::logic_error&);
452 void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
453 static const string myComment;
454 virtual const char* GetComment() const;
455 virtual QString GenerateName();
456 virtual void Update();
457 virtual void ToStream(std::ostringstream& theStr);
458 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
459 const char* theFieldName, double theIteration);
461 Storable* CutLinesRestore(SALOMEDS::SObject_ptr theSObject,
462 const string& thePrefix, const Storable::TRestoringMap& theMap)
463 throw(std::logic_error&);
467 //==============================================================================
468 class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
469 public virtual ScalarMap_i
471 static int myNbPresent;
473 IsoSurfaces_i(const IsoSurfaces_i&);
475 IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
476 virtual void SameAs(const IsoSurfaces_i* theOrigin);
477 virtual ~IsoSurfaces_i();
478 virtual void Destroy();
480 virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
482 virtual void SetNbSurfaces(CORBA::Long theNb) { myNbSurface = theNb;}
483 virtual CORBA::Long GetNbSurfaces() { return myNbSurface;}
485 virtual void SetRange(float theMin, float theMax);
486 virtual float GetRangeMin() { return myRange[0]; }
487 virtual float GetRangeMax() { return myRange[1]; }
489 typedef VISU::IsoSurfaces InterfaceType;
492 virtual DataType* DoHook(int theRestoring);
494 vtkContourFilter *myContourFilter;
499 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
500 const char* theFieldName, double theIteration);
501 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
502 throw(std::logic_error&);
503 static const string myComment;
504 virtual const char* GetComment() const;
505 virtual QString GenerateName();
506 virtual void Update();
507 virtual void ToStream(std::ostringstream& theStr);
508 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
509 const char* theFieldName, double theIteration);
510 virtual void SetMapScale(double theMapScale = 1.0);
512 Storable* IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject,
513 const string& thePrefix, const Storable::TRestoringMap& theMap)
514 throw(std::logic_error&);
518 //==============================================================================
519 class StreamLines_i : public virtual POA_VISU::StreamLines,
520 public virtual DeformedShape_i
522 static int myNbPresent;
524 StreamLines_i(const StreamLines_i&);
526 StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
527 virtual void SameAs(const StreamLines_i* theOriginal);
528 virtual ~StreamLines_i();
529 virtual void Destroy();
531 virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
533 typedef VISU::StreamLines InterfaceType;
535 virtual void SetDirection(VISU::StreamLines::Direction theDirection)
536 { myDirection = theDirection; }
537 virtual VISU::StreamLines::Direction GetDirection() { return myDirection;}
539 virtual void SetStepLength(CORBA::Double theStep) { myStepLength = theStep; }
540 virtual CORBA::Double GetStepLength() { return myStepLength; }
542 virtual void SetPropagationTime(CORBA::Double theTime) { myPropagationTime = theTime; }
543 virtual CORBA::Double GetPropagationTime() { return myPropagationTime; }
545 virtual void SetIntegrationStep(CORBA::Double theStep) { myIntegrationStep = theStep; }
546 virtual CORBA::Double GetIntegrationStep() { return myIntegrationStep; }
548 virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
549 virtual VISU::Prs3d_ptr GetSource();
551 virtual void SetUsedPoints(CORBA::Double thePercents) { myPercents = thePercents; }
552 virtual CORBA::Double GetUsedPoints() { return myPercents; }
555 virtual DataType* DoHook(int theRestoring);
556 vtkStreamLine* myStream;
558 VISU::StreamLines::Direction myDirection;
560 float myIntegrationStep;
561 float myPropagationTime;
562 string mySourceEntry;
563 VISU::Prs3d_i* myPrs3di;
567 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
568 const char* theFieldName, double theIteration);
569 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
570 throw(std::logic_error&);
571 static const string myComment;
572 virtual const char* GetComment() const;
573 virtual QString GenerateName();
575 virtual float GetMinIntegrationStep();
576 virtual float GetMaxIntegrationStep();
577 virtual float GetBasePropagationTime();
579 virtual void Update();
580 virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); }
581 virtual void ToStream(std::ostringstream& theStr);
582 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
583 const char* theFieldName, double theIteration);
585 Storable* StreamLinesRestore(SALOMEDS::SObject_ptr theSObject,
586 const string& thePrefix, const Storable::TRestoringMap& theMap)
587 throw(std::logic_error&);
590 //==============================================================================
591 class Vectors_i : public virtual POA_VISU::Vectors,
592 public virtual DeformedShape_i
594 static int myNbPresent;
596 Vectors_i(const Vectors_i&);
598 Vectors_i(Result_i* theResult, bool theAddToStudy = true);
599 virtual void SameAs(const Vectors_i* theOrigin);
600 virtual ~Vectors_i();
601 virtual void Destroy();
603 virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
605 virtual void SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth;}
606 virtual CORBA::Double GetLineWidth() { return myLineWidth;}
608 virtual void SetGlyphType(VISU::Vectors::GlyphType theType) { myTypeGlyph = theType;}
609 virtual VISU::Vectors::GlyphType GetGlyphType() { return myTypeGlyph;}
611 virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos) { myPosGlyph = thePos;}
612 virtual VISU::Vectors::GlyphPos GetGlyphPos() { return myPosGlyph;}
614 typedef VISU::Vectors InterfaceType;
617 virtual DataType* DoHook(int theRestoring);
620 VISU::Vectors::GlyphType myTypeGlyph;
621 VISU::Vectors::GlyphPos myPosGlyph;
626 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
627 const char* theFieldName, double theIteration);
628 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
629 throw(std::logic_error&);
630 static const string myComment;
631 virtual const char* GetComment() const;
632 virtual QString GenerateName();
633 virtual void Update();
634 virtual void ToStream(std::ostringstream& theStr);
635 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
636 const char* theFieldName, double theIteration);
637 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
638 virtual void UpdateActor(VISU_Actor* theActor);
640 Storable* VectorsRestore(SALOMEDS::SObject_ptr theSObject,
641 const string& thePrefix, const Storable::TRestoringMap& theMap)
642 throw(std::logic_error&);
643 //==============================================================================