X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISU_I%2FVISU_Prs3d_i.hh;h=92df8102554c8d7ceeab6d1e4073634a503e3e38;hb=716894d52739e56d77c5085e02b4cdfdbef60136;hp=0a151cb9239f63373427c3b071a3247e4228dc2b;hpb=3f4152dedc1ae968267cfb8a079f261ec0088ed0;p=modules%2Fvisu.git diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index 0a151cb9..92df8102 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx @@ -33,23 +33,36 @@ #include "VISU_ConvertorDef.hxx" #include "SALOME_GenericObj_i.hh" +#include "SALOME_GenericObjPointer.hh" #include "SALOME_InteractiveObject.hxx" #include "VTKViewer.h" #include +#include class VISU_PipeLine; class VISU_Actor; class vtkPlane; class vtkActorCollection; -class vtkUnstructuredGrid; +class vtkDataSet; namespace VISU { + //---------------------------------------------------------------------------- class Result_i; + + //---------------------------------------------------------------------------- + struct TResultObserver: public virtual boost::signalslib::trackable + { + virtual + void + UpdateFromResult(Result_i* theResult) = 0; + }; + + //---------------------------------------------------------------------------- //! Base class for all VTK 3D presentations. /*! @@ -61,27 +74,22 @@ namespace VISU - implement basic actor management (CreateActor, UpdateActor, UpdateActors, RemoveActor and RemoveActors); - implement common 3D functionality like "clipping planes" and offset. */ - class Prs3d_i : - public virtual POA_VISU::Prs3d, - public virtual SALOME::GenericObj_i, - public virtual TActorFactory, - public virtual PrsObject_i + class VISU_I_EXPORT Prs3d_i : public virtual POA_VISU::Prs3d, + public virtual SALOME::GenericObj_i, + public virtual TActorFactory, + public virtual PrsObject_i { - Prs3d_i(); Prs3d_i(const Prs3d_i&); public: //---------------------------------------------------------------------------- - //! A constructor to create a fresh instance of the class - explicit - Prs3d_i(Result_i* theResult, - bool theAddToStudy); + typedef PrsObject_i TSuperClass; + typedef VISU::Prs3d TInterface; - //! A constructor to restore an instance of the class - explicit - Prs3d_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject); + //---------------------------------------------------------------------------- + //! A constructor to create a fresh instance of the class + Prs3d_i(); //! To create a deep copy from another instance of the class virtual @@ -91,6 +99,38 @@ namespace VISU virtual ~Prs3d_i(); + //---------------------------------------------------------------------------- + virtual + CORBA::Boolean + Apply(bool theReInit); + + //---------------------------------------------------------------------------- + void + SetCResult(Result_i* theResult); + + Result_i* + GetCResult() const; + + virtual + void + SetResultObject(VISU::Result_ptr theResult); + + virtual + VISU::Result_ptr + GetResultObject(); + + //---------------------------------------------------------------------------- + virtual + void + SetMeshName(const char* theMeshName); + + virtual + char* + GetMeshName(); + + std::string + GetCMeshName() const; + //---------------------------------------------------------------------------- //! To generate an unique type name for the class (used into persistent functionality) virtual @@ -102,29 +142,23 @@ namespace VISU QString GenerateName() = 0; - //! To restore paramters of the instance from Storable::TRestoringMap - virtual - Storable* - Restore(const Storable::TRestoringMap& theMap); - //! To save paramters of the instance to std::ostringstream virtual void ToStream(std::ostringstream& theStr); - //---------------------------------------------------------------------------- - //! Get corresponding Result_i - Result_i* - GetResult() const; + //! To restore paramters of the instance from Storable::TRestoringMap + virtual + Storable* + Restore(SALOMEDS::SObject_ptr theSObject, + const Storable::TRestoringMap& theMap); + //---------------------------------------------------------------------------- //! Get corresponding SALOMEDS::SObject virtual SALOMEDS::SObject_var GetSObject(); - const std::string& - GetMeshName() const; - //---------------------------------------------------------------------------- //! To update is internal state virtual @@ -139,17 +173,20 @@ namespace VISU //---------------------------------------------------------------------------- //! Get corresponding VISU_PipeLine VISU_PipeLine* - GetPL(); + GetPipeLine() const; + + bool + IsPipeLineExists(); //! Get input of the VISU_PipeLine - vtkUnstructuredGrid* + vtkDataSet* GetInput(); //---------------------------------------------------------------------------- //! To define a way to create VTK representation of the instance virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0; + CreateActor() = 0; //! To unregister the pointed actor virtual @@ -194,18 +231,25 @@ namespace VISU void GetBounds(vtkFloatingPointType aBounds[6]); + int + GetNumberOfActors (); + + //! Move the 3D presentation according to the given offset parameters void SetOffset(const CORBA::Float* theOffsets); + //! Move the 3D presentation according to the given offset parameters virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz); + //! Gets offset parameters for the 3D presentation void GetOffset(CORBA::Float* theOffsets); + //! Gets offset parameters for the 3D presentation virtual void GetOffset(CORBA::Float& theDx, @@ -213,51 +257,105 @@ namespace VISU CORBA::Float& theDz); //---------------------------------------------------------------------------- + //! Gets memory size actually used by the presentation (Mb). + virtual + CORBA::Float + GetMemorySize(); + + //---------------------------------------------------------------------------- + //! Gets know whether the factory instance can be used for actor management or not + virtual + bool + GetActiveState(); + + //---------------------------------------------------------------------------- + //! Return modified time of the presentation + virtual + unsigned long int + GetMTime(); + + //---------------------------------------------------------------------------- + //! Create and return the interactive object + virtual + Handle(SALOME_InteractiveObject) + GetIO(); + + //! Used in derived classes to initilize the IO for actors + virtual + std::string + GetActorEntry(); + protected: + /*! + Used in Apply method to get know whether it is possible to create presentation + with the input parameters or not. The derived classes can use this method + to customize Apply behaviour. + */ + virtual + bool + SetInput(bool theReInit); + + //! Restore input parameters if Apply function fails + virtual + void + OnRestoreInput(); + + //! Used in derived classes to initilize the myPipeLine member + void + SetPipeLine(VISU_PipeLine* thePipeLine); + + //! Used in derived classes to initilize the myPipeLine member void - CreateActor(VISU_Actor* theActor, - const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(VISU_Actor* theActor); + //! Gets or creates VISU_PipeLine instance for actor initilization virtual VISU_PipeLine* - GetPipeLine(); + GetActorPipeLine(); //! To check dataset validity, throws std::exception if not valid virtual void CheckDataSet(); - bool myAddToStudy; - CORBA::Float myOffset[3]; - Result_i *myResult; - VISU_PipeLine *myPipeLine; - SALOMEDS::SObject_var mySObject; + protected: + vtkTimeStamp myUpdateTime; + vtkTimeStamp myParamsTime; + + private: + void + SetResultEntry(const std::string& theResultEntry); + + std::string + GetResultEntry(); + + typedef SALOME::GenericObjPtr TResultPtr; + TResultPtr myResult; + TResultPtr myPreviousResult; + std::string myMeshName; + std::string myPreviousMeshName; + + CORBA::Float myOffset[3]; boost::signal0 myUpdateActorsSignal; boost::signal0 myRemoveActorsFromRendererSignal; vtkSmartPointer myActorCollection; - }; + vtkSmartPointer myPipeLine; - //---------------------------------------------------------------------------- - Result_i* - GetResult(SALOMEDS::SObject_ptr theSObject); + Handle(SALOME_InteractiveObject) myIO; + + private: + friend class ColoredPrs3dCache_i; + + //! Sets activity flag for the factory instance + void + SetActiveState(bool theState); + + bool myIsActiveSatate; + }; - //---------------------------------------------------------------------------- - template - Storable* - Restore(SALOMEDS::SObject_ptr theSObject, - const std::string& thePrefix, - const Storable::TRestoringMap& theMap) - { - VISU::Result_i* pResult = GetResult(theSObject); - if(pResult != NULL){ - TPrs3d* pPrs3d = new TPrs3d(pResult,theSObject); - return pPrs3d->Restore(theMap); - } - return NULL; - } //---------------------------------------------------------------------------- }