Back to index

salome-gui  6.5.0
Classes | Typedefs | Functions | Variables
VTK Namespace Reference

Classes

struct  VTKVIEWER_EXPORT
 This object should be used to avoid problems with recurring calls of GetActors() method of the vtkRenderer class. More...
struct  TSetFunction
struct  TSetVisibility
struct  TVertex
struct  TColorFunctorBase
struct  TPropertyColor
struct  TColors2Color
struct  TPointColors2Color
struct  TCellColors2Color

Typedefs

typedef int MarkerType
 Type of standard marker for advanced rendering of vtk points.
typedef int MarkerScale
 Scale of standard marker for advanced rendering of vtk points.
typedef std::list< unsigned short > MarkerTexture
typedef std::pair< std::string,
MarkerTexture
MarkerData
typedef std::map< int, MarkerDataMarkerMap

Functions

template<typename TActor , typename TFunction >
TFunction ForEach (vtkActorCollection *theCollection, TFunction theFun)
 For each actor(for ex: someActor) from theCollection(that can be dynamic cast to type TActor) Call method theFun(someActor)
template<typename TActor , typename TPredicate , typename TFunction >
TFunction ForEachIf (vtkActorCollection *theCollection, TPredicate thePredicate, TFunction theFun)
 For each actor(for ex: someActor) from theCollection(that can be dynamic cast to type TActor and
method thePredicate(someActor) return true)
Call method theFun(someActor)
template<typename TActor , typename TPredicate >
TActor * Find (vtkActorCollection *theCollection, TPredicate thePredicate)
 Find actor from collection, that can be dynamicaly cast to TActor,
*and method thePredicate(someActor) return true)
.
bool LoadTextureData (const QString &theFileName, VTK::MarkerScale theMarkerScale, VTK::MarkerTexture &theMarkerTexture)
vtkSmartPointer< vtkImageData > MakeVTKImage (const VTK::MarkerTexture &theMarkerTexture, bool theWhiteForeground)
QImage ConvertToQImage (vtkImageData *theImageData)
int GetUniqueId (const VTK::MarkerMap &theMarkerMap)
template<class TCoordinates >
void DrawPoints (TCoordinates *theStartPoints, vtkCellArray *theCells, TColorFunctorBase *theColorFunctor, TVertex *theVertexArr, vtkIdType &theCellId, vtkIdType &theVertexId)
template<class TCoordinates >
void DrawCellsPoints (vtkPolyData *theInput, vtkPoints *thePoints, TColorFunctorBase *theColorFunctor, TVertex *theVertexArr)

Variables

const MarkerType MT_NONE = 0
const MarkerType MT_POINT = 1
const MarkerType MT_PLUS = 2
const MarkerType MT_STAR = 3
const MarkerType MT_O = 4
const MarkerType MT_X = 5
const MarkerType MT_O_POINT = 6
const MarkerType MT_O_PLUS = 7
const MarkerType MT_O_STAR = 8
const MarkerType MT_O_X = 9
const MarkerType MT_USER = 10
const MarkerScale MS_NONE = 0
const MarkerScale MS_10 = 1
const MarkerScale MS_15 = 2
const MarkerScale MS_20 = 3
const MarkerScale MS_25 = 4
const MarkerScale MS_30 = 5
const MarkerScale MS_35 = 6
const MarkerScale MS_40 = 7
const MarkerScale MS_45 = 8
const MarkerScale MS_50 = 9
const MarkerScale MS_55 = 10
const MarkerScale MS_60 = 11
const MarkerScale MS_65 = 12
const MarkerScale MS_70 = 13

Class Documentation

struct VTK::TVertex

Definition at line 310 of file VTKViewer_PolyDataMapper.cxx.

Class Members
GLfloat a
GLfloat b
GLfloat g
GLfloat r
GLfloat vx
GLfloat vy
GLfloat vz

Typedef Documentation

typedef std::pair<std::string, MarkerTexture> VTK::MarkerData

Definition at line 61 of file VTKViewer_MarkerDef.h.

typedef std::map<int, MarkerData> VTK::MarkerMap

Definition at line 62 of file VTKViewer_MarkerDef.h.

typedef int VTK::MarkerScale

Scale of standard marker for advanced rendering of vtk points.

Definition at line 44 of file VTKViewer_MarkerDef.h.

typedef std::list<unsigned short> VTK::MarkerTexture

Definition at line 60 of file VTKViewer_MarkerDef.h.

typedef int VTK::MarkerType

Type of standard marker for advanced rendering of vtk points.

Definition at line 30 of file VTKViewer_MarkerDef.h.


Function Documentation

VTKVIEWER_EXPORT QImage VTK::ConvertToQImage ( vtkImageData *  theImageData)

Definition at line 117 of file VTKViewer_MarkerUtils.cxx.

  {
    if( theImageData->GetScalarType() != VTK_UNSIGNED_CHAR )
      return QImage();

    int extent[6];
    theImageData->GetExtent( extent );
    int width = extent[1] - extent[0] + 1;
    int height = extent[3] - extent[2] + 1;
  
    QImage anImage(width, height, QImage::Format_ARGB32);
    for( int i = 0; i < height; i++ )
    {
      QRgb* bits = reinterpret_cast<QRgb*>( anImage.scanLine(i) );
      unsigned char* row = static_cast<unsigned char*>(
        theImageData->GetScalarPointer( extent[0], extent[2] + height - i - 1, extent[4] ) );
      for( int j = 0; j < width; j++ )
      {
        unsigned char* data = &row[ j*4 ];
        bits[j] = qRgba( data[0], data[1], data[2], data[3] );
      }
    }
    return anImage;
  }
template<class TCoordinates >
void VTK::DrawCellsPoints ( vtkPolyData *  theInput,
vtkPoints *  thePoints,
TColorFunctorBase *  theColorFunctor,
TVertex *  theVertexArr 
)

Definition at line 452 of file VTKViewer_PolyDataMapper.cxx.

  {
    vtkIdType aCellId = 0, aVertexId = 0;

    TCoordinates* aStartPoints = (TCoordinates*)thePoints->GetVoidPointer(0);

    if ( vtkCellArray* aCellArray = theInput->GetVerts() )
      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
  
    if ( vtkCellArray* aCellArray = theInput->GetLines() )
      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
  
    if ( vtkCellArray* aCellArray = theInput->GetPolys() )
      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
  
    if ( vtkCellArray* aCellArray = theInput->GetStrips() )
      DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId ); 
  }

Here is the call graph for this function:

template<class TCoordinates >
void VTK::DrawPoints ( TCoordinates *  theStartPoints,
vtkCellArray *  theCells,
TColorFunctorBase *  theColorFunctor,
TVertex *  theVertexArr,
vtkIdType &  theCellId,
vtkIdType &  theVertexId 
)

Definition at line 416 of file VTKViewer_PolyDataMapper.cxx.

  {
    vtkIdType* ptIds = theCells->GetPointer();
    vtkIdType* endPtIds = ptIds + theCells->GetNumberOfConnectivityEntries();

    while ( ptIds < endPtIds ) {
      vtkIdType nPts = *ptIds;
      ++ptIds;

      while ( nPts > 0 ) {
        TVertex& aVertex = theVertexArr[ theVertexId ];
        vtkIdType aPointId = *ptIds;

        TCoordinates* anOffsetPoints = theStartPoints + 3 * aPointId;
        aVertex.vx = anOffsetPoints[0];
        aVertex.vy = anOffsetPoints[1];
        aVertex.vz = anOffsetPoints[2];

        theColorFunctor->get( aVertex, aPointId, theCellId );

        ++theVertexId;
        ++ptIds; 
        --nPts; 
      }

      ++theCellId;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename TActor , typename TPredicate >
TActor* VTK::Find ( vtkActorCollection *  theCollection,
TPredicate  thePredicate 
)

Find actor from collection, that can be dynamicaly cast to TActor,
*and method thePredicate(someActor) return true)
.

Return values:
someActor

Definition at line 103 of file VTKViewer_Algorithm.h.

      {
        if(theCollection){
          theCollection->InitTraversal();
          while(vtkActor *anAct = theCollection->GetNextActor())
            if(TActor *anActor = dynamic_cast<TActor*>(anAct))
              if(thePredicate(anActor))
                return anActor;
        }
        return NULL;
      }
template<typename TActor , typename TFunction >
TFunction VTK::ForEach ( vtkActorCollection *  theCollection,
TFunction  theFun 
)

For each actor(for ex: someActor) from theCollection(that can be dynamic cast to type TActor) Call method theFun(someActor)

Definition at line 68 of file VTKViewer_Algorithm.h.

      {
        if(theCollection){
          theCollection->InitTraversal();
          while(vtkActor *anAct = theCollection->GetNextActor())
            if(TActor *anActor = dynamic_cast<TActor*>(anAct))
              theFun(anActor);
        }
        return theFun;
      }
template<typename TActor , typename TPredicate , typename TFunction >
TFunction VTK::ForEachIf ( vtkActorCollection *  theCollection,
TPredicate  thePredicate,
TFunction  theFun 
)

For each actor(for ex: someActor) from theCollection(that can be dynamic cast to type TActor and
method thePredicate(someActor) return true)
Call method theFun(someActor)

Definition at line 84 of file VTKViewer_Algorithm.h.

      {
        if(theCollection){
          theCollection->InitTraversal();
          while(vtkActor *anAct = theCollection->GetNextActor())
            if(TActor *anActor = dynamic_cast<TActor*>(anAct))
              if(thePredicate(anActor))
                theFun(anActor);
        }
        return theFun;
      }
VTKVIEWER_EXPORT int VTK::GetUniqueId ( const VTK::MarkerMap theMarkerMap)

Definition at line 142 of file VTKViewer_MarkerUtils.cxx.

  {
    int anId = 0;
    while( anId++ < 100 ) {
      bool anOk = true;
      VTK::MarkerMap::const_iterator anIter = theMarkerMap.begin();
      for( ; anIter != theMarkerMap.end(); anIter++ ) {
        if( anId == anIter->first ) {
          anOk = false;
          continue;
        }
      }
      if( anOk )
        return anId;
    }
    return theMarkerMap.size() + 1;
  }
VTKVIEWER_EXPORT bool VTK::LoadTextureData ( const QString &  theFileName,
VTK::MarkerScale  theMarkerScale,
VTK::MarkerTexture theMarkerTexture 
)

Definition at line 33 of file VTKViewer_MarkerUtils.cxx.

  {
    theMarkerTexture.clear();

    QFile aFile( theFileName );
    if( !aFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
      return false;

    bool ok;
    int aWidth = 0, aHeight = 0;

    int aTextureIndex = theMarkerScale == VTK::MS_NONE ? 0 : (int)theMarkerScale-1;
    int aCurrentTexture = 0;

    QTextStream aTextStream( &aFile );
    while( !aTextStream.atEnd() )
    {
      QString aLine = aTextStream.readLine();
      if( aLine.isEmpty() )
      {
        aCurrentTexture++;
        continue;
      }

      if( aCurrentTexture != aTextureIndex )
        continue;

      int aLineSize = aLine.size();
      for( int i = 0; i < aLineSize; i++ )
      {
        ok = false;
        unsigned int aPixel = QString( aLine.at( i ) ).toUInt( &ok );
        if( ok )
          theMarkerTexture.push_back( aPixel );
      }
      if( aWidth == 0 )
        aWidth = aLineSize;
      aHeight++;
    }

    if( theMarkerTexture.size() != aWidth * aHeight )
      return false;

    theMarkerTexture.push_front( aWidth );
    theMarkerTexture.push_front( aHeight );
    return true;
  }
VTKVIEWER_EXPORT vtkSmartPointer< vtkImageData > VTK::MakeVTKImage ( const VTK::MarkerTexture theMarkerTexture,
bool  theWhiteForeground 
)

Definition at line 83 of file VTKViewer_MarkerUtils.cxx.

  {
    VTK::MarkerTexture::const_iterator anIter = theMarkerTexture.begin();

    int aWidth = *anIter++;
    int aHeight = *anIter++;

    vtkSmartPointer<vtkImageData> anImageData = vtkImageData::New();
    anImageData->Delete();

    anImageData->SetExtent( 0, aWidth-1, 0, aHeight-1, 0, 0 );
    anImageData->SetScalarTypeToUnsignedChar();
    anImageData->SetNumberOfScalarComponents( 4 );
    anImageData->AllocateScalars();

    unsigned char* aDataPtr = (unsigned char*)anImageData->GetScalarPointer();

    int anId = 0;
    int aSize = aWidth * aHeight * 4;
    int aCoef = theWhiteForeground ? 1 : 0;
    while( anId < aSize )
    {
      int aValue = (*anIter++) * 255;
      aDataPtr[ anId++ ] = aValue * aCoef;
      aDataPtr[ anId++ ] = aValue * aCoef;
      aDataPtr[ anId++ ] = aValue * aCoef;
      aDataPtr[ anId++ ] = aValue;
    }
    anImageData->Update();

    return anImageData;
  }

Variable Documentation

Definition at line 46 of file VTKViewer_MarkerDef.h.

Definition at line 47 of file VTKViewer_MarkerDef.h.

Definition at line 48 of file VTKViewer_MarkerDef.h.

Definition at line 49 of file VTKViewer_MarkerDef.h.

Definition at line 50 of file VTKViewer_MarkerDef.h.

Definition at line 51 of file VTKViewer_MarkerDef.h.

Definition at line 52 of file VTKViewer_MarkerDef.h.

Definition at line 53 of file VTKViewer_MarkerDef.h.

Definition at line 54 of file VTKViewer_MarkerDef.h.

const MarkerScale VTK::MS_55 = 10

Definition at line 55 of file VTKViewer_MarkerDef.h.

const MarkerScale VTK::MS_60 = 11

Definition at line 56 of file VTKViewer_MarkerDef.h.

const MarkerScale VTK::MS_65 = 12

Definition at line 57 of file VTKViewer_MarkerDef.h.

const MarkerScale VTK::MS_70 = 13

Definition at line 58 of file VTKViewer_MarkerDef.h.

Definition at line 45 of file VTKViewer_MarkerDef.h.

Definition at line 31 of file VTKViewer_MarkerDef.h.

const MarkerType VTK::MT_O = 4

Definition at line 35 of file VTKViewer_MarkerDef.h.

Definition at line 38 of file VTKViewer_MarkerDef.h.

Definition at line 37 of file VTKViewer_MarkerDef.h.

Definition at line 39 of file VTKViewer_MarkerDef.h.

Definition at line 40 of file VTKViewer_MarkerDef.h.

Definition at line 33 of file VTKViewer_MarkerDef.h.

Definition at line 32 of file VTKViewer_MarkerDef.h.

Definition at line 34 of file VTKViewer_MarkerDef.h.

Definition at line 41 of file VTKViewer_MarkerDef.h.

const MarkerType VTK::MT_X = 5

Definition at line 36 of file VTKViewer_MarkerDef.h.