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 virtual void Update();
250 const VISU::TField* GetField() const { return myField;}
251 const string& GetFieldName() const { return myFieldName;}
252 int GetScalarMode() const { return myScalarMode;}
254 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
256 Storable* ScalarMapRestore(SALOMEDS::SObject_ptr theSObject,
257 const string& thePrefix, const Storable::TRestoringMap& theMap)
258 throw(std::logic_error&);
261 //==============================================================================
262 class DeformedShape_i : public virtual POA_VISU::DeformedShape,
263 public virtual ScalarMap_i
265 static int myNbPresent;
267 DeformedShape_i(const DeformedShape_i&);
269 DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
270 virtual void SameAs(const DeformedShape_i* theOrigin);
271 virtual ~DeformedShape_i();
273 virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
275 virtual void SetScale(CORBA::Double theScale) { myFactor = theScale;}
276 virtual CORBA::Double GetScale() { return myFactor;}
278 typedef VISU::DeformedShape InterfaceType;
280 virtual bool isColored() { return myIsColored; }
281 virtual void setColored(bool theColor)
282 { myIsColored = theColor; }
285 virtual DataType* DoHook(int theRestoring);
288 vtkWarpVector *myWarpVector;
291 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
292 const char* theFieldName, double theIteration);
293 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
294 throw(std::logic_error&);
295 static const string myComment;
296 virtual const char* GetComment() const;
297 virtual QString GenerateName();
298 virtual void Update();
299 virtual void ToStream(ostrstream& theStr);
300 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
301 const char* theFieldName, double theIteration);
304 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
306 Storable* DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject,
307 const string& thePrefix, const Storable::TRestoringMap& theMap)
308 throw(std::logic_error&);
313 //==============================================================================
314 class CutPlanes_i : public virtual POA_VISU::CutPlanes,
315 public virtual ScalarMap_i
317 static int myNbPresent;
319 CutPlanes_i(const CutPlanes_i&);
321 CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
322 virtual void SameAs(const CutPlanes_i* theOrigin);
323 virtual ~CutPlanes_i();
324 virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
326 virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
327 myBasePlane = theOrient;
329 virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane;}
331 virtual void SetNbPlanes(CORBA::Long theNb) { myNbPlanes = theNb;}
332 virtual CORBA::Long GetNbPlanes() { return myNbPlanes;}
334 virtual void SetRotateX(CORBA::Double theAngle);
335 virtual CORBA::Double GetRotateX();
336 virtual void SetRotateY(CORBA::Double theAngle);
337 virtual CORBA::Double GetRotateY();
339 typedef VISU::CutPlanes InterfaceType;
342 virtual DataType* DoHook(int theRestoring);
344 float myRotation[3][3];
345 float myAng[3], myDir[3], myInvDir[3], myBoundPrj[3], myDBPrj;
346 vtkAppendPolyData *myAppendPolyData;
347 VISU::CutPlanes::Orientation myBasePlane;
351 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
352 const char* theFieldName, double theIteration);
353 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
354 throw(std::logic_error&);
355 static const string myComment;
356 virtual const char* GetComment() const;
357 virtual QString GenerateName();
358 virtual void Update();
359 virtual void ToStream(ostrstream& theStr);
360 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
361 const char* theFieldName, double theIteration);
362 void SetPlane(int theId);
364 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
366 Storable* CutPlanesRestore(SALOMEDS::SObject_ptr theSObject,
367 const string& thePrefix, const Storable::TRestoringMap& theMap)
368 throw(std::logic_error&);
372 //==============================================================================
373 class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
374 public virtual ScalarMap_i
376 static int myNbPresent;
378 IsoSurfaces_i(const IsoSurfaces_i&);
380 IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
381 virtual void SameAs(const IsoSurfaces_i* theOrigin);
382 virtual ~IsoSurfaces_i();
383 virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
385 virtual void SetNbSurfaces(CORBA::Long theNb) { myNbSurface = theNb;}
386 virtual CORBA::Long GetNbSurfaces() { return myNbSurface;}
388 virtual void SetRange(float theMin, float theMax)
389 { myRange[0] = theMin; myRange[1] = theMax; }
391 virtual float GetRangeMin() { return myRange[0]; }
392 virtual float GetRangeMax() { return myRange[1]; }
394 typedef VISU::IsoSurfaces InterfaceType;
397 virtual DataType* DoHook(int theRestoring);
399 vtkContourFilter *myContourFilter;
404 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
405 const char* theFieldName, double theIteration);
406 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
407 throw(std::logic_error&);
408 static const string myComment;
409 virtual const char* GetComment() const;
410 virtual QString GenerateName();
411 virtual void Update();
412 virtual void ToStream(ostrstream& theStr);
413 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
414 const char* theFieldName, double theIteration);
415 vtkContourFilter* GetFilter() { return myContourFilter;}
416 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
418 Storable* IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject,
419 const string& thePrefix, const Storable::TRestoringMap& theMap)
420 throw(std::logic_error&);
424 //==============================================================================
425 class StreamLines_i : public virtual POA_VISU::StreamLines,
426 public virtual DeformedShape_i
428 static int myNbPresent;
430 StreamLines_i(const StreamLines_i&);
432 StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
433 virtual void SameAs(const StreamLines_i* theOriginal);
434 virtual ~StreamLines_i();
436 virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
438 typedef VISU::StreamLines InterfaceType;
440 virtual void SetDirection(VISU::StreamLines::Direction theDirection)
441 { myDirection = theDirection; }
442 virtual VISU::StreamLines::Direction GetDirection() { return myDirection;}
444 virtual void SetStepLength(float theStep) { myStepLength = theStep; }
445 virtual float GetStepLength() { return myStepLength; }
447 virtual void SetPropagationTime(float theTime) { myPropagationTime = theTime; }
448 virtual float GetPropagationTime() { return myPropagationTime; }
450 virtual void SetIntegrationStep(float theStep) { myIntegrationStep = theStep; }
451 virtual float GetIntegrationStep() { return myIntegrationStep; }
454 virtual DataType* DoHook(int theRestoring);
455 vtkStreamLine* myStream;
457 VISU::StreamLines::Direction myDirection;
459 float myIntegrationStep;
460 float myPropagationTime;
463 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
464 const char* theFieldName, double theIteration);
465 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
466 throw(std::logic_error&);
467 static const string myComment;
468 virtual const char* GetComment() const;
469 virtual QString GenerateName();
470 virtual void Update();
471 virtual void ToStream(ostrstream& theStr);
472 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
473 const char* theFieldName, double theIteration);
474 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
476 Storable* StreamLinesRestore(SALOMEDS::SObject_ptr theSObject,
477 const string& thePrefix, const Storable::TRestoringMap& theMap)
478 throw(std::logic_error&);
481 //==============================================================================
482 class Vectors_i : public virtual POA_VISU::Vectors,
483 public virtual DeformedShape_i
485 static int myNbPresent;
487 Vectors_i(const Vectors_i&);
489 Vectors_i(Result_i* theResult, bool theAddToStudy = true);
490 virtual void SameAs(const Vectors_i* theOrigin);
491 virtual ~Vectors_i();
492 virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
494 virtual void SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth;}
495 virtual CORBA::Double GetLineWidth() { return myLineWidth;}
497 virtual void SetGlyphType(VISU::Vectors::GlyphType theType) { myTypeGlyph = theType;}
498 virtual VISU::Vectors::GlyphType GetGlyphType() { return myTypeGlyph;}
500 virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos) { myPosGlyph = thePos;}
501 virtual VISU::Vectors::GlyphPos GetGlyphPos() { return myPosGlyph;}
503 typedef VISU::Vectors InterfaceType;
506 virtual DataType* DoHook(int theRestoring);
509 VISU::Vectors::GlyphType myTypeGlyph;
510 VISU::Vectors::GlyphPos myPosGlyph;
515 virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
516 const char* theFieldName, double theIteration);
517 virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
518 throw(std::logic_error&);
519 static const string myComment;
520 virtual const char* GetComment() const;
521 virtual QString GenerateName();
522 virtual void Update();
523 virtual void ToStream(ostrstream& theStr);
524 static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
525 const char* theFieldName, double theIteration);
526 virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
528 Storable* VectorsRestore(SALOMEDS::SObject_ptr theSObject,
529 const string& thePrefix, const Storable::TRestoringMap& theMap)
530 throw(std::logic_error&);
531 //==============================================================================