1 // File: VISU_PrsObject_i.hxx
2 // Created: Fri Jan 17 09:26:33 2003
3 // Author: Alexey PETROV
4 // <apo@ivanox.nnov.matra-dtv.fr>
7 #ifndef VISU_PrsObject_i_HeaderFile
8 #define VISU_PrsObject_i_HeaderFile
10 #include "VISU_Result_i.hh"
11 //#include "VISU_Convertor.hxx"
12 #include "Handle_SALOME_InteractiveObject.hxx"
15 class VISU_FieldTransform;
18 class vtkDataSetMapper;
23 class vtkContourFilter;
24 class vtkAppendPolyData;
28 class vtkPolyDataSource;
34 //==============================================================================
35 class PrsObject_i : public virtual POA_VISU::PrsObject,
36 public virtual Storable
38 PrsObject_i(const PrsObject_i&);
41 PrsObject_i(SALOMEDS::Study_ptr theStudy) :
42 myStudy(SALOMEDS::Study::_duplicate(theStudy)) {};
43 virtual ~PrsObject_i() {}
47 SALOMEDS::Study_var myStudy;
50 virtual const char* GetName() const { return myName.c_str();}
51 const SALOMEDS::Study_var& GetStudyDocument() const { return myStudy;}
56 //==============================================================================
57 class Prs3d_i : public virtual PrsObject_i
60 Prs3d_i(const Prs3d_i&);
62 Prs3d_i(Result_i* theResult);
63 virtual void SameAs(const Prs3d_i* theOrigin);
66 typedef vtkDataSetMapper MapperType;
67 typedef vtkDataSet DataType;
69 virtual const float* GetColor() const { return myColorRGB;}
70 virtual void SetColor(const float* theRGB){
71 myColor.R = myColorRGB[0] = theRGB[0];
72 myColor.G = myColorRGB[1] = theRGB[1];
73 myColor.B = myColorRGB[2] = theRGB[2];
82 struct SALOMEDS::Color myColor;
87 virtual void Update();
88 virtual const char* GetComment() const = 0;
89 virtual QString GenerateName() = 0;
90 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
91 throw(std::logic_error&);
92 virtual void ToStream(ostrstream& theStr);
93 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
94 MapperType* GetMapper() const { return myMapper;}
95 Result_i* GetResult() const { return myResult; }
99 //==============================================================================
100 class Mesh_i : public virtual POA_VISU::Mesh,
101 public virtual Prs3d_i
103 static int myNbPresent;
105 Mesh_i(const Mesh_i&);
107 Mesh_i(Result_i* theResult);
108 virtual void SameAs(const Mesh_i* theOrigin);
110 virtual VISU::VISUType GetType() { return VISU::TMESH;};
112 virtual void SetCellColor(const SALOMEDS::Color& theColor) { myCellColor = theColor;}
113 virtual SALOMEDS::Color GetCellColor() { return myCellColor;}
115 virtual void SetNodeColor(const SALOMEDS::Color& theColor) { myNodeColor = theColor;}
116 virtual SALOMEDS::Color GetNodeColor() { return myNodeColor;}
118 virtual void SetLinkColor(const SALOMEDS::Color& theColor) { myLinkColor = theColor;}
119 virtual SALOMEDS::Color GetLinkColor() { return myLinkColor;}
121 virtual void SetPresentationType(VISU::PresentationType theType) { myPresentType = theType;}
122 virtual PresentationType GetPresentationType() { return myPresentType;}
124 typedef VISU::Mesh InterfaceType;
125 typedef vtkUnstructuredGridReader InputType;
128 Storable* Build(int theRestoring);
131 VISU::VISUType myType;
134 string mySubMeshName;
135 struct SALOMEDS::Color myCellColor, myNodeColor, myLinkColor;
136 VISU::PresentationType myPresentType;
139 virtual Storable* Create(const char* theMeshName, int theEntity);
140 virtual Storable* Create(const char* theMeshName, int theEntity, const char* theFamilyName);
141 virtual Storable* Create(const char* theMeshName, const char* theGroupName);
142 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
143 throw(std::logic_error&);
144 virtual void ToStream(ostrstream& theStr);
145 static const string myComment;
146 virtual const char* GetComment() const;
147 virtual QString GenerateName();
148 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
149 virtual InputType* GetInput() const { return myInput;}
151 Storable* MeshRestore(SALOMEDS::SObject_ptr theSObject,
152 const string& thePrefix, const Storable::TRestoringMap& theMap)
153 throw(std::logic_error&);
156 //==============================================================================
157 class ScalarMap_i : public virtual POA_VISU::ScalarMap,
158 public virtual Prs3d_i
160 static int myNbPresent;
162 ScalarMap_i(const ScalarMap_i&);
165 ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
166 virtual void SameAs(const ScalarMap_i* theOrigin);
167 virtual ~ScalarMap_i();
169 virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
171 virtual void SetScalarMode(CORBA::Long theScalarMode);
172 virtual CORBA::Long GetScalarMode() { return myScalarMode;}
174 virtual void SetScaling(VISU::Scaling theScaling);
175 virtual VISU::Scaling GetScaling();
177 virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
178 virtual CORBA::Double GetMin() { return myScalarRange[0];}
179 virtual CORBA::Double GetMax() { return myScalarRange[1];}
181 virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation) {
182 myOrientation = theOrientation;
184 virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
186 virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
187 virtual CORBA::Double GetPosX() { return myPosition[0];}
188 virtual CORBA::Double GetPosY() { return myPosition[1];}
190 virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
191 myWidth = theWidth; myHeight = theHeight;
193 virtual CORBA::Double GetWidth() { return myWidth;}
194 virtual CORBA::Double GetHeight() { return myHeight;}
196 virtual void SetNbColors(CORBA::Long theNbColors) { myNumberOfColors = theNbColors;}
197 virtual CORBA::Long GetNbColors() { return myNumberOfColors;}
199 virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
200 virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
202 virtual void SetTitle(const char* theName) { myTitle = theName;}
203 virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
205 virtual void CalculateRange();
206 virtual bool isRangeFixed() { return myIsFixedRange; }
208 virtual double GetIteration() { return myIteration; }
210 typedef VISU::ScalarMap InterfaceType;
211 typedef VISU_Extractor InputType;
214 Storable* Build(int theRestoring);
215 virtual DataType* DoHook(int theRestoring);
224 VISU_FieldTransform *myFieldTransform;
225 const TField* myField;
227 float myScalarRange[2];
229 VISU::Scaling myScaling;
232 VISU::ScalarMap::Orientation myOrientation;
233 int myNumberOfColors, myNumberOfLabels;
234 float myPosition[2], myWidth, myHeight;
237 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
238 const char* theFieldName, double theIteration);
239 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
240 throw(std::logic_error&);
241 static const string myComment;
242 virtual const char* GetComment() const;
243 virtual QString GenerateName();
244 virtual void ToStream(ostrstream& theStr);
245 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
246 const char* theFieldName, double theIteration);
247 InputType* GetInput() { return myInput;}
249 const VISU::TField* GetField() const { return myField;}
250 const string& GetFieldName() const { return myFieldName;}
251 int GetScalarMode() const { return myScalarMode;}
253 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
255 Storable* ScalarMapRestore(SALOMEDS::SObject_ptr theSObject,
256 const string& thePrefix, const Storable::TRestoringMap& theMap)
257 throw(std::logic_error&);
260 //==============================================================================
261 class DeformedShape_i : public virtual POA_VISU::DeformedShape,
262 public virtual ScalarMap_i
264 static int myNbPresent;
266 DeformedShape_i(const DeformedShape_i&);
268 DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
269 virtual void SameAs(const DeformedShape_i* theOrigin);
270 virtual ~DeformedShape_i();
272 virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
274 virtual void SetScale(CORBA::Double theScale) { myFactor = theScale;}
275 virtual CORBA::Double GetScale() { return myFactor;}
277 typedef VISU::DeformedShape InterfaceType;
279 virtual bool isColored() { return myIsColored; }
280 virtual void setColored(bool theColor)
281 { myIsColored = theColor; }
284 virtual DataType* DoHook(int theRestoring);
287 vtkWarpVector *myWarpVector;
290 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
291 const char* theFieldName, double theIteration);
292 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
293 throw(std::logic_error&);
294 static const string myComment;
295 virtual const char* GetComment() const;
296 virtual QString GenerateName();
297 virtual void Update();
298 virtual void ToStream(ostrstream& theStr);
299 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
300 const char* theFieldName, double theIteration);
303 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
305 Storable* DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject,
306 const string& thePrefix, const Storable::TRestoringMap& theMap)
307 throw(std::logic_error&);
312 //==============================================================================
313 class CutPlanes_i : public virtual POA_VISU::CutPlanes,
314 public virtual ScalarMap_i
316 static int myNbPresent;
318 CutPlanes_i(const CutPlanes_i&);
320 CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
321 virtual void SameAs(const CutPlanes_i* theOrigin);
322 virtual ~CutPlanes_i();
323 virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
325 virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
326 myBasePlane = theOrient;
328 virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane;}
330 virtual void SetNbPlanes(CORBA::Long theNb) { myNbPlanes = theNb;}
331 virtual CORBA::Long GetNbPlanes() { return myNbPlanes;}
333 virtual void SetRotateX(CORBA::Double theAngle);
334 virtual CORBA::Double GetRotateX();
335 virtual void SetRotateY(CORBA::Double theAngle);
336 virtual CORBA::Double GetRotateY();
338 typedef VISU::CutPlanes InterfaceType;
341 virtual DataType* DoHook(int theRestoring);
343 float myRotation[3][3];
344 float myAng[3], myDir[3], myInvDir[3], myBoundPrj[3], myDBPrj;
345 vtkAppendPolyData *myAppendPolyData;
346 VISU::CutPlanes::Orientation myBasePlane;
350 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
351 const char* theFieldName, double theIteration);
352 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
353 throw(std::logic_error&);
354 static const string myComment;
355 virtual const char* GetComment() const;
356 virtual QString GenerateName();
357 virtual void Update();
358 virtual void ToStream(ostrstream& theStr);
359 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
360 const char* theFieldName, double theIteration);
361 void SetPlane(int theId);
363 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
365 Storable* CutPlanesRestore(SALOMEDS::SObject_ptr theSObject,
366 const string& thePrefix, const Storable::TRestoringMap& theMap)
367 throw(std::logic_error&);
371 //==============================================================================
372 class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
373 public virtual ScalarMap_i
375 static int myNbPresent;
377 IsoSurfaces_i(const IsoSurfaces_i&);
379 IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
380 virtual void SameAs(const IsoSurfaces_i* theOrigin);
381 virtual ~IsoSurfaces_i();
382 virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
384 virtual void SetNbSurfaces(CORBA::Long theNb) { myNbSurface = theNb;}
385 virtual CORBA::Long GetNbSurfaces() { return myNbSurface;}
387 virtual void SetRange(float theMin, float theMax)
388 { myRange[0] = theMin; myRange[1] = theMax; }
390 virtual float GetRangeMin() { return myRange[0]; }
391 virtual float GetRangeMax() { return myRange[1]; }
393 typedef VISU::IsoSurfaces InterfaceType;
396 virtual DataType* DoHook(int theRestoring);
398 vtkContourFilter *myContourFilter;
403 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
404 const char* theFieldName, double theIteration);
405 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
406 throw(std::logic_error&);
407 static const string myComment;
408 virtual const char* GetComment() const;
409 virtual QString GenerateName();
410 virtual void Update();
411 virtual void ToStream(ostrstream& theStr);
412 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
413 const char* theFieldName, double theIteration);
414 vtkContourFilter* GetFilter() { return myContourFilter;}
415 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
417 Storable* IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject,
418 const string& thePrefix, const Storable::TRestoringMap& theMap)
419 throw(std::logic_error&);
423 //==============================================================================
424 class StreamLines_i : public virtual POA_VISU::StreamLines,
425 public virtual DeformedShape_i
427 static int myNbPresent;
429 StreamLines_i(const StreamLines_i&);
431 StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
432 virtual void SameAs(const StreamLines_i* theOriginal);
433 virtual ~StreamLines_i();
435 virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
437 typedef VISU::StreamLines InterfaceType;
439 virtual void SetDirection(VISU::StreamLines::Direction theDirection)
440 { myDirection = theDirection; }
441 virtual VISU::StreamLines::Direction GetDirection() { return myDirection;}
443 virtual void SetStepLength(float theStep) { myStepLength = theStep; }
444 virtual float GetStepLength() { return myStepLength; }
446 virtual void SetPropagationTime(float theTime) { myPropagationTime = theTime; }
447 virtual float GetPropagationTime() { return myPropagationTime; }
449 virtual void SetIntegrationStep(float theStep) { myIntegrationStep = theStep; }
450 virtual float GetIntegrationStep() { return myIntegrationStep; }
453 virtual DataType* DoHook(int theRestoring);
454 vtkStreamLine* myStream;
456 VISU::StreamLines::Direction myDirection;
458 float myIntegrationStep;
459 float myPropagationTime;
462 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
463 const char* theFieldName, double theIteration);
464 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
465 throw(std::logic_error&);
466 static const string myComment;
467 virtual const char* GetComment() const;
468 virtual QString GenerateName();
469 virtual void Update();
470 virtual void ToStream(ostrstream& theStr);
471 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
472 const char* theFieldName, double theIteration);
473 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
475 Storable* StreamLinesRestore(SALOMEDS::SObject_ptr theSObject,
476 const string& thePrefix, const Storable::TRestoringMap& theMap)
477 throw(std::logic_error&);
480 //==============================================================================
481 class Vectors_i : public virtual POA_VISU::Vectors,
482 public virtual DeformedShape_i
484 static int myNbPresent;
486 Vectors_i(const Vectors_i&);
488 Vectors_i(Result_i* theResult, bool theAddToStudy = true);
489 virtual void SameAs(const Vectors_i* theOrigin);
490 virtual ~Vectors_i();
491 virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
493 virtual void SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth;}
494 virtual CORBA::Double GetLineWidth() { return myLineWidth;}
496 virtual void SetGlyphType(VISU::Vectors::GlyphType theType) { myTypeGlyph = theType;}
497 virtual VISU::Vectors::GlyphType GetGlyphType() { return myTypeGlyph;}
499 virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos) { myPosGlyph = thePos;}
500 virtual VISU::Vectors::GlyphPos GetGlyphPos() { return myPosGlyph;}
502 typedef VISU::Vectors InterfaceType;
505 virtual DataType* DoHook(int theRestoring);
508 VISU::Vectors::GlyphType myTypeGlyph;
509 VISU::Vectors::GlyphPos myPosGlyph;
514 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
515 const char* theFieldName, double theIteration);
516 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
517 throw(std::logic_error&);
518 static const string myComment;
519 virtual const char* GetComment() const;
520 virtual QString GenerateName();
521 virtual void Update();
522 virtual void ToStream(ostrstream& theStr);
523 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
524 const char* theFieldName, double theIteration);
525 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
527 Storable* VectorsRestore(SALOMEDS::SObject_ptr theSObject,
528 const string& thePrefix, const Storable::TRestoringMap& theMap)
529 throw(std::logic_error&);
530 //==============================================================================