-// File: VISU_PrsObject_i.hxx
-// Created: Fri Jan 17 09:26:33 2003
-// Author: Alexey PETROV
-// <apo@ivanox.nnov.matra-dtv.fr>
-
-
+// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// VISU OBJECT : interactive object for VISU entities implementation
+// File : VISU_PrsObject_i.hxx
+// Author : Alexey PETROV
+// Module : VISU
+//
#ifndef VISU_PrsObject_i_HeaderFile
#define VISU_PrsObject_i_HeaderFile
-#include "VISU_Result_i.hh"
-//#include "VISU_Convertor.hxx"
-#include "Handle_SALOME_InteractiveObject.hxx"
-
-class VISU_Extractor;
-class VISU_FieldTransform;
-class VISU_Actor;
-
-class vtkDataSetMapper;
-class vtkDataSet;
-class vtkProperty;
-
-class vtkWarpVector;
-class vtkContourFilter;
-class vtkAppendPolyData;
-
-class vtkGlyph3D;
-class vtkHedgeHog;
-class vtkPolyDataSource;
-class vtkStreamLine;
-
-
-namespace VISU{
- struct TField;
- //==============================================================================
- class PrsObject_i : public virtual POA_VISU::PrsObject,
- public virtual Storable
- {
- PrsObject_i(const PrsObject_i&);
-
- public:
- PrsObject_i(SALOMEDS::Study_ptr theStudy) :
- myStudy(SALOMEDS::Study::_duplicate(theStudy)) {};
- virtual ~PrsObject_i() {}
-
- protected:
- string myName;
- SALOMEDS::Study_var myStudy;
-
- public:
- virtual const char* GetName() const { return myName.c_str();}
- const SALOMEDS::Study_var& GetStudyDocument() const { return myStudy;}
- QString GetEntry();
- };
-
-
- //==============================================================================
- class Prs3d_i : public virtual PrsObject_i
- {
- Prs3d_i();
- Prs3d_i(const Prs3d_i&);
- public:
- Prs3d_i(Result_i* theResult);
- virtual void SameAs(const Prs3d_i* theOrigin);
- virtual ~Prs3d_i();
-
- typedef vtkDataSetMapper MapperType;
- typedef vtkDataSet DataType;
-
- virtual const float* GetColor() const { return myColorRGB;}
- virtual void SetColor(const float* theRGB){
- myColor.R = myColorRGB[0] = theRGB[0];
- myColor.G = myColorRGB[1] = theRGB[1];
- myColor.B = myColorRGB[2] = theRGB[2];
- }
-
-
- protected:
- Result_i* myResult;
- MapperType *myMapper;
- float myBounds[6];
- float myColorRGB[3];
- struct SALOMEDS::Color myColor;
-
- bool myAddToStudy;
-
- public:
- virtual void Update();
- virtual const char* GetComment() const = 0;
- virtual QString GenerateName() = 0;
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- virtual void ToStream(ostrstream& theStr);
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- MapperType* GetMapper() const { return myMapper;}
- Result_i* GetResult() const { return myResult; }
- };
-
-
- //==============================================================================
- class Mesh_i : public virtual POA_VISU::Mesh,
- public virtual Prs3d_i
- {
- static int myNbPresent;
- Mesh_i();
- Mesh_i(const Mesh_i&);
- public:
- Mesh_i(Result_i* theResult);
- virtual void SameAs(const Mesh_i* theOrigin);
- virtual ~Mesh_i();
- virtual VISU::VISUType GetType() { return VISU::TMESH;};
-
- virtual void SetCellColor(const SALOMEDS::Color& theColor) { myCellColor = theColor;}
- virtual SALOMEDS::Color GetCellColor() { return myCellColor;}
-
- virtual void SetNodeColor(const SALOMEDS::Color& theColor) { myNodeColor = theColor;}
- virtual SALOMEDS::Color GetNodeColor() { return myNodeColor;}
-
- virtual void SetLinkColor(const SALOMEDS::Color& theColor) { myLinkColor = theColor;}
- virtual SALOMEDS::Color GetLinkColor() { return myLinkColor;}
-
- virtual void SetPresentationType(VISU::PresentationType theType) { myPresentType = theType;}
- virtual PresentationType GetPresentationType() { return myPresentType;}
-
- typedef VISU::Mesh InterfaceType;
- typedef vtkUnstructuredGridReader InputType;
-
- protected:
- Storable* Build(int theRestoring);
-
- InputType *myInput;
- VISU::VISUType myType;
- string myMeshName;
- int myEntity;
- string mySubMeshName;
- struct SALOMEDS::Color myCellColor, myNodeColor, myLinkColor;
- VISU::PresentationType myPresentType;
-
- public:
- virtual Storable* Create(const char* theMeshName, int theEntity);
- virtual Storable* Create(const char* theMeshName, int theEntity, const char* theFamilyName);
- virtual Storable* Create(const char* theMeshName, const char* theGroupName);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- virtual void ToStream(ostrstream& theStr);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- virtual InputType* GetInput() const { return myInput;}
- };
- Storable* MeshRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
-
- //==============================================================================
- class ScalarMap_i : public virtual POA_VISU::ScalarMap,
- public virtual Prs3d_i
- {
- static int myNbPresent;
- ScalarMap_i();
- ScalarMap_i(const ScalarMap_i&);
-
- public:
- ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
- virtual void SameAs(const ScalarMap_i* theOrigin);
- virtual ~ScalarMap_i();
-
- virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
-
- virtual void SetScalarMode(CORBA::Long theScalarMode);
- virtual CORBA::Long GetScalarMode() { return myScalarMode;}
-
- virtual void SetScaling(VISU::Scaling theScaling);
- virtual VISU::Scaling GetScaling();
-
- virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
- virtual CORBA::Double GetMin() { return myScalarRange[0];}
- virtual CORBA::Double GetMax() { return myScalarRange[1];}
-
- virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation) {
- myOrientation = theOrientation;
- }
- virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
-
- virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
- virtual CORBA::Double GetPosX() { return myPosition[0];}
- virtual CORBA::Double GetPosY() { return myPosition[1];}
-
- virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
- myWidth = theWidth; myHeight = theHeight;
- }
- virtual CORBA::Double GetWidth() { return myWidth;}
- virtual CORBA::Double GetHeight() { return myHeight;}
-
- virtual void SetNbColors(CORBA::Long theNbColors) { myNumberOfColors = theNbColors;}
- virtual CORBA::Long GetNbColors() { return myNumberOfColors;}
-
- virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
- virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
-
- virtual void SetTitle(const char* theName) { myTitle = theName;}
- virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
-
- virtual void CalculateRange();
- virtual bool isRangeFixed() { return myIsFixedRange; }
-
- virtual double GetIteration() { return myIteration; }
-
- typedef VISU::ScalarMap InterfaceType;
- typedef VISU_Extractor InputType;
-
- protected:
- Storable* Build(int theRestoring);
- virtual DataType* DoHook(int theRestoring);
-
- InputType *myInput;
-
- string myMeshName;
- int myEntity;
- string myFieldName;
- int myScalarMode;
- double myIteration;
- VISU_FieldTransform *myFieldTransform;
- const TField* myField;
-
- float myScalarRange[2];
- bool myIsFixedRange;
- VISU::Scaling myScaling;
+#include "VISUConfig.hh"
- string myTitle;
- VISU::ScalarMap::Orientation myOrientation;
- int myNumberOfColors, myNumberOfLabels;
- float myPosition[2], myWidth, myHeight;
-
- public:
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void ToStream(ostrstream& theStr);
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- InputType* GetInput() { return myInput;}
-
- const VISU::TField* GetField() const { return myField;}
- const string& GetFieldName() const { return myFieldName;}
- int GetScalarMode() const { return myScalarMode;}
-
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- };
- Storable* ScalarMapRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
-
- //==============================================================================
- class DeformedShape_i : public virtual POA_VISU::DeformedShape,
- public virtual ScalarMap_i
+namespace VISU
+{
+ //----------------------------------------------------------------------------
+ class VISU_I_EXPORT RemovableObject_i : public virtual POA_VISU::RemovableObject,
+ public virtual Storable
{
- static int myNbPresent;
- DeformedShape_i();
- DeformedShape_i(const DeformedShape_i&);
public:
- DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
- virtual void SameAs(const DeformedShape_i* theOrigin);
- virtual ~DeformedShape_i();
-
- virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
+ typedef Storable TSuperClass;
- virtual void SetScale(CORBA::Double theScale) { myFactor = theScale;}
- virtual CORBA::Double GetScale() { return myFactor;}
+ virtual
+ ~RemovableObject_i();
- typedef VISU::DeformedShape InterfaceType;
+ SALOMEDS::Study_var
+ GetStudyDocument() const;
- virtual bool isColored() { return myIsColored; }
- virtual void setColored(bool theColor)
- { myIsColored = theColor; }
-
- protected:
- virtual DataType* DoHook(int theRestoring);
- float myFactor;
- bool myIsColored;
- vtkWarpVector *myWarpVector;
-
- public:
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void Update();
- virtual void ToStream(ostrstream& theStr);
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- float ScaleFactor();
-
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- };
- Storable* DeformedShapeRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
+ SalomeApp_Study*
+ GetGUIStudy() const;
+ virtual
+ std::string
+ GetEntry();
+ virtual
+ std::string
+ GetName() const;
-
- //==============================================================================
- class CutPlanes_i : public virtual POA_VISU::CutPlanes,
- public virtual ScalarMap_i
- {
- static int myNbPresent;
- CutPlanes_i();
- CutPlanes_i(const CutPlanes_i&);
- public:
- CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
- virtual void SameAs(const CutPlanes_i* theOrigin);
- virtual ~CutPlanes_i();
- virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
-
- virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient) {
- myBasePlane = theOrient;
- }
- virtual VISU::CutPlanes::Orientation GetOrientationType() { return myBasePlane;}
-
- virtual void SetNbPlanes(CORBA::Long theNb) { myNbPlanes = theNb;}
- virtual CORBA::Long GetNbPlanes() { return myNbPlanes;}
-
- virtual void SetRotateX(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateX();
- virtual void SetRotateY(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateY();
-
- typedef VISU::CutPlanes InterfaceType;
+ virtual
+ void
+ SetName(const std::string& theName,
+ bool theIsUpdateStudyAttr);
protected:
- virtual DataType* DoHook(int theRestoring);
-
- float myRotation[3][3];
- float myAng[3], myDir[3], myInvDir[3], myBoundPrj[3], myDBPrj;
- vtkAppendPolyData *myAppendPolyData;
- VISU::CutPlanes::Orientation myBasePlane;
- int myNbPlanes;
-
- public:
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void Update();
- virtual void ToStream(ostrstream& theStr);
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- void SetPlane(int theId);
-
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- };
- Storable* CutPlanesRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
-
-
- //==============================================================================
- class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces,
- public virtual ScalarMap_i
- {
- static int myNbPresent;
- IsoSurfaces_i();
- IsoSurfaces_i(const IsoSurfaces_i&);
- public:
- IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
- virtual void SameAs(const IsoSurfaces_i* theOrigin);
- virtual ~IsoSurfaces_i();
- virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
-
- virtual void SetNbSurfaces(CORBA::Long theNb) { myNbSurface = theNb;}
- virtual CORBA::Long GetNbSurfaces() { return myNbSurface;}
-
- virtual void SetRange(float theMin, float theMax)
- { myRange[0] = theMin; myRange[1] = theMax; }
+ RemovableObject_i();
- virtual float GetRangeMin() { return myRange[0]; }
- virtual float GetRangeMax() { return myRange[1]; }
+ void
+ SetStudyDocument(SALOMEDS::Study_ptr theStudy);
- typedef VISU::IsoSurfaces InterfaceType;
+ private:
+ std::string myName;
+ SalomeApp_Study* myGUIStudy;
+ SALOMEDS::Study_var myStudyDocument;
- protected:
- virtual DataType* DoHook(int theRestoring);
-
- vtkContourFilter *myContourFilter;
- int myNbSurface;
- float myRange[2];
-
- public:
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void Update();
- virtual void ToStream(ostrstream& theStr);
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- vtkContourFilter* GetFilter() { return myContourFilter;}
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+ RemovableObject_i(const RemovableObject_i&);
};
- Storable* IsoSurfacesRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
- //==============================================================================
- class StreamLines_i : public virtual POA_VISU::StreamLines,
- public virtual DeformedShape_i
+ //----------------------------------------------------------------------------
+ class VISU_I_EXPORT PrsObject_i : public virtual POA_VISU::PrsObject,
+ public virtual RemovableObject_i
{
- static int myNbPresent;
- StreamLines_i();
- StreamLines_i(const StreamLines_i&);
- public:
- StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
- virtual void SameAs(const StreamLines_i* theOriginal);
- virtual ~StreamLines_i();
-
- virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
-
- typedef VISU::StreamLines InterfaceType;
-
- virtual void SetDirection(VISU::StreamLines::Direction theDirection)
- { myDirection = theDirection; }
- virtual VISU::StreamLines::Direction GetDirection() { return myDirection;}
-
- virtual void SetStepLength(float theStep) { myStepLength = theStep; }
- virtual float GetStepLength() { return myStepLength; }
-
- virtual void SetPropagationTime(float theTime) { myPropagationTime = theTime; }
- virtual float GetPropagationTime() { return myPropagationTime; }
-
- virtual void SetIntegrationStep(float theStep) { myIntegrationStep = theStep; }
- virtual float GetIntegrationStep() { return myIntegrationStep; }
-
- protected:
- virtual DataType* DoHook(int theRestoring);
- vtkStreamLine* myStream;
-
- VISU::StreamLines::Direction myDirection;
- float myStepLength;
- float myIntegrationStep;
- float myPropagationTime;
-
- public:
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void Update();
- virtual void ToStream(ostrstream& theStr);
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
- };
- Storable* StreamLinesRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
+ PrsObject_i(const PrsObject_i&);
- //==============================================================================
- class Vectors_i : public virtual POA_VISU::Vectors,
- public virtual DeformedShape_i
- {
- static int myNbPresent;
- Vectors_i();
- Vectors_i(const Vectors_i&);
public:
- Vectors_i(Result_i* theResult, bool theAddToStudy = true);
- virtual void SameAs(const Vectors_i* theOrigin);
- virtual ~Vectors_i();
- virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
-
- virtual void SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth;}
- virtual CORBA::Double GetLineWidth() { return myLineWidth;}
-
- virtual void SetGlyphType(VISU::Vectors::GlyphType theType) { myTypeGlyph = theType;}
- virtual VISU::Vectors::GlyphType GetGlyphType() { return myTypeGlyph;}
-
- virtual void SetGlyphPos(VISU::Vectors::GlyphPos thePos) { myPosGlyph = thePos;}
- virtual VISU::Vectors::GlyphPos GetGlyphPos() { return myPosGlyph;}
-
- typedef VISU::Vectors InterfaceType;
+ typedef RemovableObject_i TSuperClass;
- protected:
- virtual DataType* DoHook(int theRestoring);
-
- float myLineWidth;
- VISU::Vectors::GlyphType myTypeGlyph;
- VISU::Vectors::GlyphPos myPosGlyph;
- vtkGlyph3D *myGlyph;
- vtkHedgeHog *myHog;
-
- public:
- virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap, int theBuilding = true)
- throw(std::logic_error&);
- static const string myComment;
- virtual const char* GetComment() const;
- virtual QString GenerateName();
- virtual void Update();
- virtual void ToStream(ostrstream& theStr);
- static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, double theIteration);
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+ PrsObject_i(SALOMEDS::Study_ptr theStudy = SALOMEDS::Study::_nil());
};
- Storable* VectorsRestore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
- //==============================================================================
}
-#endif
-
+#endif