Version: 6.3.1

src/VISU_I/VISU_Prs3d_i.hh

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  VISU OBJECT : interactive object for VISU entities implementation
00024 //  File   : VISU_PrsObject_i.hxx
00025 //  Author : Alexey PETROV
00026 //  Module : VISU
00027 //
00028 #ifndef VISU_Prs3d_i_HeaderFile
00029 #define VISU_Prs3d_i_HeaderFile
00030 
00031 #include "VISU_PrsObject_i.hh"
00032 
00033 #include "VISU_ActorFactory.h"
00034 #include "VISU_ConvertorDef.hxx"
00035 
00036 #include "SALOME_GenericObj_i.hh"
00037 #include "SALOME_GenericObjPointer.hh"
00038 #include "SALOME_InteractiveObject.hxx"
00039 
00040 #include "VTKViewer.h"
00041 
00042 #include <vtkSmartPointer.h>
00043 #include <vtkTimeStamp.h>
00044 
00045 class VISU_PipeLine;
00046 class VISU_ActorBase;
00047 class VISU_Actor;
00048 
00049 class vtkPlane;
00050 class vtkActorCollection;
00051 class vtkDataSet;
00052 
00053 namespace VISU
00054 {
00055   //----------------------------------------------------------------------------
00056   class Result_i;
00057 
00058 
00059   //----------------------------------------------------------------------------
00060   struct TResultObserver: public virtual boost::signalslib::trackable
00061   {
00062     virtual
00063     void
00064     UpdateFromResult(Result_i* theResult) = 0;
00065   };
00066 
00067 
00068   //----------------------------------------------------------------------------
00070 
00079   class VISU_I_EXPORT Prs3d_i : public virtual POA_VISU::Prs3d,
00080                     public virtual SALOME::GenericObj_i,
00081                     public virtual TActorFactory,
00082                     public virtual PrsObject_i
00083 
00084   {
00085     Prs3d_i(const Prs3d_i&);
00086 
00087   public:
00088     //----------------------------------------------------------------------------
00089     typedef PrsObject_i TSuperClass;
00090     typedef VISU::Prs3d TInterface;
00091 
00092     //----------------------------------------------------------------------------
00094     Prs3d_i();
00095 
00097     virtual
00098     void
00099     SameAs(const Prs3d_i* theOrigin);
00100 
00101     virtual
00102     ~Prs3d_i();
00103 
00104     //----------------------------------------------------------------------------
00105     virtual
00106     CORBA::Boolean 
00107     Apply(bool theReInit);
00108 
00109     //----------------------------------------------------------------------------
00110     void 
00111     SetCResult(Result_i* theResult);
00112 
00113     Result_i* 
00114     GetCResult() const;
00115 
00116     virtual
00117     void 
00118     SetResultObject(VISU::Result_ptr theResult);
00119 
00120     virtual
00121     VISU::Result_ptr
00122     GetResultObject();
00123 
00124     //----------------------------------------------------------------------------
00125     virtual
00126     void 
00127     SetMeshName(const char* theMeshName);
00128 
00129     virtual
00130     char*
00131     GetMeshName();
00132 
00133     std::string
00134     GetCMeshName() const;
00135 
00136     //----------------------------------------------------------------------------
00138     virtual
00139     const char* 
00140     GetComment() const = 0;
00141 
00143     virtual
00144     QString
00145     GenerateName() = 0;
00146 
00148     virtual
00149     void
00150     ToStream(std::ostringstream& theStr);
00151 
00153     virtual
00154     Storable* 
00155     Restore(SALOMEDS::SObject_ptr theSObject,
00156          const Storable::TRestoringMap& theMap);
00157 
00158     //----------------------------------------------------------------------------
00160     virtual
00161     SALOMEDS::SObject_var 
00162     GetSObject();
00163 
00164     //----------------------------------------------------------------------------
00166     virtual 
00167     void
00168     Update();
00169 
00171     virtual
00172     void
00173     RemoveFromStudy();
00174 
00175     //----------------------------------------------------------------------------
00177     VISU_PipeLine* 
00178     GetPipeLine() const;
00179 
00180     bool
00181     IsPipeLineExists();
00182 
00184     vtkDataSet* 
00185     GetInput();
00186 
00187     //----------------------------------------------------------------------------
00189     virtual 
00190     VISU_Actor* 
00191     CreateActor() = 0;
00192 
00194     virtual 
00195     void
00196     RemoveActor(VISU_ActorBase* theActor);
00197 
00199     virtual 
00200     void
00201     RemoveActors();
00202 
00204     virtual 
00205     void
00206     UpdateActor(VISU_ActorBase* theActor);
00207 
00209     virtual 
00210     void
00211     UpdateActors();
00212 
00213     //----------------------------------------------------------------------------
00214     // Clipping planes
00215     void
00216     RemoveAllClippingPlanes();
00217 
00218     bool
00219     AddClippingPlane(vtkPlane* thePlane);
00220 
00221     vtkIdType
00222     GetNumberOfClippingPlanes() const;
00223 
00224     vtkPlane* 
00225     GetClippingPlane(vtkIdType theID) const;
00226 
00227     void RemoveClippingPlane(vtkIdType theID);
00228 
00229     void
00230     SetPlaneParam(vtkFloatingPointType theDir[3], 
00231             vtkFloatingPointType theDist, 
00232             vtkPlane* thePlane);
00233 
00234     //----------------------------------------------------------------------------
00235     void
00236     GetBounds(vtkFloatingPointType aBounds[6]);
00237 
00238     int
00239     GetNumberOfActors();
00240 
00241     bool
00242     HasVisibleActors();
00243 
00245     void
00246     SetOffset(const CORBA::Float* theOffsets);
00247 
00249     virtual
00250     void
00251     SetOffset(CORBA::Float theDx, 
00252            CORBA::Float theDy, 
00253            CORBA::Float theDz);
00254 
00256     void
00257     GetOffset(CORBA::Float* theOffsets);
00258 
00260     virtual
00261     void
00262     GetOffset(CORBA::Float& theDx, 
00263            CORBA::Float& theDy, 
00264            CORBA::Float& theDz);
00265 
00266     //----------------------------------------------------------------------------
00268     virtual
00269     void
00270     SetMarkerStd(VISU::MarkerType theMarkerType, VISU::MarkerScale theMarkerScale);
00271   
00273     virtual
00274     void
00275     SetMarkerTexture(CORBA::Long theTextureId);
00276   
00278     virtual
00279     VISU::MarkerType
00280     GetMarkerType();
00281 
00283     virtual
00284     VISU::MarkerScale
00285     GetMarkerScale();
00286 
00288     virtual
00289     CORBA::Long
00290     GetMarkerTexture();
00291   
00292     //----------------------------------------------------------------------------
00294     virtual
00295     CORBA::Float
00296     GetMemorySize();
00297 
00298     //----------------------------------------------------------------------------
00300     virtual
00301     bool 
00302     GetActiveState();
00303 
00304     //----------------------------------------------------------------------------
00306     virtual
00307     unsigned long int 
00308     GetMTime();
00309 
00310     //----------------------------------------------------------------------------
00312     virtual
00313     Handle(SALOME_InteractiveObject)
00314     GetIO();
00315 
00317     virtual
00318     std::string
00319     GetActorEntry();
00320 
00321     //----------------------------------------------------------------------------
00323     bool
00324     IsForcedHidden() const;
00325 
00326     void
00327     SetForcedHidden( bool );
00328 
00329   protected:
00335     virtual 
00336     bool 
00337     SetInput(bool theReInit);
00338 
00340     virtual 
00341     void 
00342     OnRestoreInput();
00343 
00345     void
00346     SetPipeLine(VISU_PipeLine* thePipeLine);
00347 
00349     void
00350     CreateActor(VISU_Actor* theActor);
00351 
00353     virtual 
00354     VISU_PipeLine* 
00355     GetActorPipeLine();
00356 
00358     virtual
00359     void
00360     CheckDataSet();
00361 
00362     bool
00363     LoadMarkerTexture(int theMarkerId, VTK::MarkerTexture& theMarkerTexture);
00364 
00365   protected:
00366     vtkTimeStamp myUpdateTime;
00367     vtkTimeStamp myParamsTime;
00368 
00369   private:
00370     void
00371     SetResultEntry(const std::string& theResultEntry);
00372 
00373     std::string
00374     GetResultEntry();
00375 
00376     typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
00377     TResultPtr myResult;
00378     TResultPtr myPreviousResult;
00379 
00380     std::string myMeshName;
00381     std::string myPreviousMeshName;
00382 
00383     CORBA::Float myOffset[3];
00384 
00385     VISU::MarkerType myMarkerType;
00386     VISU::MarkerScale myMarkerScale;
00387     int myMarkerId;
00388 
00389     boost::signal0<void> myUpdateActorsSignal;
00390     boost::signal0<void> myRemoveActorsFromRendererSignal;
00391     vtkSmartPointer<vtkActorCollection> myActorCollection;
00392 
00393     vtkSmartPointer<VISU_PipeLine> myPipeLine;
00394 
00395     Handle(SALOME_InteractiveObject) myIO;
00396 
00397   private:
00398     friend class ColoredPrs3dCache_i;
00399 
00401     void
00402     SetActiveState(bool theState);
00403     
00404     bool myIsActiveSatate;
00405 
00406     bool myIsForcedHidden;
00407   };
00408 
00409   //----------------------------------------------------------------------------
00410 }
00411 
00412 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS