Version: 6.3.1

src/VTKViewer/VTKViewer_Actor.h

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 //  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
00024 //  File   : SALOME_Actor.h
00025 //  Author : Nicolas REJNERI
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/GUI/GUI_SRC/src/VTKViewer/VTKViewer_Actor.h,v 1.9.2.2.8.2.2.1 2011-06-01 13:53:43 vsr Exp $
00028 //
00029 #ifndef VTKVIEVER_ACTOR_H
00030 #define VTKVIEVER_ACTOR_H
00031 
00032 #include "VTKViewer.h"
00033 
00034 #include <string>
00035 #include <vector>
00036 
00037 #include <vtkLODActor.h>
00038 
00039 class vtkCell;
00040 class vtkPointPicker;
00041 class vtkCellPicker;
00042 class vtkDataSet;
00043 class vtkCamera;
00044 class vtkProperty;
00045 class vtkRenderer;
00046 class vtkPassThroughFilter;
00047 
00048 class VTKViewer_Transform;
00049 class VTKViewer_GeometryFilter;
00050 class VTKViewer_TransformFilter;
00051 
00052 extern int VTKViewer_POINT_SIZE;
00053 extern int VTKViewer_LINE_WIDTH;
00054 
00055 #ifdef WIN32
00056 #pragma warning ( disable:4251 )
00057 #endif
00058 
00062 class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor 
00063 {
00064  public:
00065   static VTKViewer_Actor* New();
00066   
00067   vtkTypeMacro(VTKViewer_Actor,vtkLODActor);
00068 
00069   //----------------------------------------------------------------------------
00071   virtual 
00072   const char* 
00073   getName();
00074 
00076   virtual
00077   void
00078   setName(const char* theName);
00079 
00080   //----------------------------------------------------------------------------
00082   virtual
00083   void
00084   SetOpacity(vtkFloatingPointType theOpacity);
00085 
00087   virtual
00088   vtkFloatingPointType 
00089   GetOpacity();
00090 
00092   virtual
00093   void
00094   SetColor(vtkFloatingPointType r,
00095            vtkFloatingPointType g,
00096            vtkFloatingPointType b);
00097 
00099   virtual
00100   void
00101   GetColor(vtkFloatingPointType& r,
00102            vtkFloatingPointType& g,
00103            vtkFloatingPointType& b);
00104 
00106   virtual
00107   void
00108   SetColor(const vtkFloatingPointType theRGB[3]);
00109 
00110   //----------------------------------------------------------------------------
00111   // For selection mapping purpose
00113   virtual
00114   int 
00115   GetNodeObjId(int theVtkID);
00116 
00118   virtual
00119   vtkFloatingPointType*
00120   GetNodeCoord(int theObjID);
00121 
00123   virtual 
00124   int
00125   GetElemObjId(int theVtkID);
00126 
00128   virtual
00129   vtkCell* 
00130   GetElemCell(int theObjID);
00131 
00132   //----------------------------------------------------------------------------
00134   virtual
00135   int
00136   GetObjDimension( const int theObjId );
00137 
00139   virtual
00140   void
00141   SetMapper(vtkMapper* theMapper); 
00142 
00144   virtual
00145   vtkDataSet* 
00146   GetInput(); 
00147 
00149   virtual
00150   void
00151   SetTransform(VTKViewer_Transform* theTransform); 
00152 
00154   virtual
00155   unsigned long int
00156   GetMTime();
00157 
00158   //----------------------------------------------------------------------------
00160   virtual
00161   void
00162   SetRepresentation(int theMode);
00163 
00165   virtual
00166   int
00167   GetRepresentation();
00168 
00170   virtual
00171   int
00172   getDisplayMode();
00173 
00175   virtual
00176   void
00177   setDisplayMode(int theMode);
00178 
00179   //----------------------------------------------------------------------------
00181 
00185   void
00186   SetInfinitive(bool theIsInfinite);
00187 
00189   virtual
00190   bool
00191   IsInfinitive();
00192     
00194   virtual
00195   vtkFloatingPointType* 
00196   GetBounds();
00197 
00199   void
00200   GetBounds(vtkFloatingPointType bounds[6]);
00201 
00202   //----------------------------------------------------------------------------
00203   virtual
00204   bool
00205   IsSetCamera() const;
00206 
00207   virtual
00208   bool
00209   IsResizable() const;
00210 
00211   virtual
00212   void
00213   SetSize( const vtkFloatingPointType );
00214 
00215   virtual
00216   void 
00217   SetCamera( vtkCamera* );
00218 
00219   //----------------------------------------------------------------------------
00221   void
00222   SetResolveCoincidentTopology(bool theIsResolve);
00223 
00225   void
00226   SetPolygonOffsetParameters(vtkFloatingPointType factor, 
00227                              vtkFloatingPointType units);
00228 
00230   void
00231   GetPolygonOffsetParameters(vtkFloatingPointType& factor, 
00232                              vtkFloatingPointType& units);
00233 
00234   virtual
00235   void
00236   Render(vtkRenderer *, vtkMapper *);
00237 
00238   //----------------------------------------------------------------------------
00240   virtual
00241   vtkFloatingPointType
00242   GetShrinkFactor();
00243 
00245   virtual
00246   bool
00247   IsShrunkable();
00248 
00250   virtual
00251   bool
00252   IsShrunk();
00253 
00255   virtual
00256   void
00257   SetShrink();
00258 
00260   virtual
00261   void
00262   UnShrink();
00263 
00264   //----------------------------------------------------------------------------
00266   virtual
00267   void
00268   AddToRender(vtkRenderer* theRendere); 
00269 
00271   virtual
00272   void
00273   RemoveFromRender(vtkRenderer* theRendere);
00274 
00276   virtual
00277   void
00278   GetChildActors(vtkActorCollection*);
00279 
00280   //----------------------------------------------------------------------------
00282   virtual
00283   bool
00284   hasHighlight(); 
00285 
00287   virtual
00288   bool
00289   isHighlighted();
00290 
00292   virtual
00293   bool
00294   isPreselected();
00295 
00297   virtual
00298   void
00299   SetPreSelected(bool thePreselect = false);
00300 
00301   //----------------------------------------------------------------------------
00303   virtual
00304   void
00305   highlight(bool theHighlight);  
00306 
00307   void
00308   SetPreviewProperty(vtkProperty* theProperty);
00309 
00310   //----------------------------------------------------------------------------
00312   virtual void SetQuadraticArcMode(bool theFlag);
00313   virtual bool GetQuadraticArcMode() const;
00314 
00315   virtual void   SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
00316   virtual vtkFloatingPointType GetQuadraticArcAngle() const;
00317 
00318   //----------------------------------------------------------------------------
00320   virtual vtkDataSet* GetHighlightedDataSet();
00321 
00322  protected:
00323   //----------------------------------------------------------------------------
00324   bool myIsResolveCoincidentTopology;
00325   vtkFloatingPointType myPolygonOffsetFactor;
00326   vtkFloatingPointType myPolygonOffsetUnits;
00327 
00328   std::string myName;
00329 
00330   vtkFloatingPointType myOpacity;
00331   int myDisplayMode;
00332   bool myIsInfinite;
00333 
00334   bool myStoreMapping;
00335   VTKViewer_GeometryFilter *myGeomFilter;
00336   VTKViewer_TransformFilter *myTransformFilter;
00337   std::vector<vtkPassThroughFilter*> myPassFilter;
00338 
00339   int myRepresentation;
00340   vtkProperty *myProperty;
00341 
00342   void
00343   InitPipeLine(vtkMapper* theMapper); 
00344 
00345   VTKViewer_Actor();
00346   ~VTKViewer_Actor();
00347 
00348  protected:
00349   vtkProperty *PreviewProperty;
00350   bool myIsPreselected;
00351   bool myIsHighlighted;
00352 };
00353 
00354 #ifdef WIN32
00355 #pragma warning ( default:4251 )
00356 #endif
00357 
00358 #endif // VTKVIEVER_ACTOR_H
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