*/
void
SALOME_Actor
-::SetNameActorOffset(int theOffset[2])
+::SetNameActorOffset(double theOffset[2])
{
myNameActor->SetOffset(theOffset);
}
*/
void
SALOME_Actor
-::GetNameActorSize(vtkRenderer* theRenderer, int theSize[2]) const
+::GetNameActorSize(vtkRenderer* theRenderer, double theSize[2]) const
{
myNameActor->GetSize(theRenderer, theSize);
}
{
if( vtkRenderer* aRenderer = GetRenderer() )
{
- int anOffset[2] = { 0, 0 };
+ double anOffset[2] = { 0, 0 };
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection* aCollection = aCopy.GetActors();
for( int anIndex = 0, aNbItems = aCollection->GetNumberOfItems(); anIndex < aNbItems; anIndex++ )
anActor->SetNameActorOffset( anOffset );
if( anActor->GetVisibility() )
{
- int aSize[2];
+ double aSize[2];
anActor->GetNameActorSize( aRenderer, aSize );
anOffset[0] = anOffset[0] + aSize[0];
anOffset[1] = anOffset[1] + aSize[1];
//! To set offset of name actor
virtual
void
- SetNameActorOffset(int theOffset[2]);
+ SetNameActorOffset(double theOffset[2]);
//! To get size of name actor
virtual
void
- GetNameActorSize(vtkRenderer* theRenderer, int theSize[2]) const;
+ GetNameActorSize(vtkRenderer* theRenderer, double theSize[2]) const;
//! To update visibility of name actors
virtual
myTextProperty->SetItalic(0);
myTextProperty->SetShadow(1);
myTextProperty->SetFontFamilyToArial();
-
- myTextMapper=vtkTextMapper::New();
- myTextMapper->SetInput("");
- myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
- myTextActor=vtkActor2D::New();
- myTextActor->SetMapper(myTextMapper);
+
+ myTextActor=vtkTextActor::New();
+ myTextActor->SetTextProperty(myTextProperty);
myBarActor->SetVisibility(1);
myTextActor->SetVisibility(1);
VTKViewer_FramedTextActor::~VTKViewer_FramedTextActor()
{
myTextActor->Delete();
- myTextMapper->Delete();
myTextProperty->Delete();
myBarActor->Delete();
myBarMapper->Delete();
// function : GetSize
// purpose :
//==================================================================
-void VTKViewer_FramedTextActor::GetSize(vtkRenderer* theRenderer, int theSize[2]) const
+void VTKViewer_FramedTextActor::GetSize(vtkRenderer* vport, double theSize[2]) const
{
- myTextMapper->GetSize(theRenderer, theSize);
+ myTextActor->GetSize(vport, theSize);
theSize[0] = theSize[0] + 2 * GetTextMargin() + OFFSET_SPACING;
theSize[1] = theSize[1] + 2 * GetTextMargin() + OFFSET_SPACING;
}
const double b)
{
myTextProperty->SetColor(r, g, b);
- myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
+ myTextActor->GetTextProperty()->ShallowCopy(myTextProperty);
Modified();
}
// function : SetOffset
// purpose :
//==================================================================
-void VTKViewer_FramedTextActor::SetOffset(const int theOffset[2])
+void VTKViewer_FramedTextActor::SetOffset(const double theOffset[2])
{
myHorizontalOffset = theOffset[0];
myVerticalOffset = theOffset[1];
{
// remove whitespaces from from the start and the end
// additionally, consider a case of multi-string text
- QString aString(theText);
+ QString aString(QString::fromUtf8(theText));
QStringList aTrimmedStringList;
QStringList aStringList = aString.split("\n");
while(anIter.hasNext())
aTrimmedStringList.append(anIter.next().trimmed());
- myTextMapper->SetInput(aTrimmedStringList.join("\n").toLatin1().constData());
+ myTextActor->SetInput(aTrimmedStringList.join("\n").toUtf8().constData());
Modified();
}
//==================================================================
char* VTKViewer_FramedTextActor::GetText()
{
- return myTextMapper->GetInput();
+ return myTextActor->GetInput();
}
//==================================================================
int VTKViewer_FramedTextActor::RenderOverlay(vtkViewport *viewport)
{
int renderedSomething = 0;
- myBarActor->RenderOverlay(viewport);
renderedSomething +=myTextActor->RenderOverlay(viewport);
+ renderedSomething +=myBarActor->RenderOverlay(viewport);
return renderedSomething;
}
if(aViewPortWidth == 1 || aViewPortHeight == 1)
return anIsRenderedSomething;
- if(!myTextMapper->GetInput())
+ if(!myTextActor->GetInput())
return anIsRenderedSomething;
myBar->Initialize();
myBar->SetPolys(aPolys);
aPolys->Delete();
- int aTextSize[2];
- myTextMapper->GetSize(theViewport, aTextSize);
+ double aTextSize[2];
+ myTextActor->GetSize(theViewport, aTextSize);
int aBarWidth = aTextSize[0];
int aBarHeight = aTextSize[1];
y / (double)aViewPortHeight);
}
+
aPoints->SetPoint(0, xMin, yMax, 0.0);
aPoints->SetPoint(1, xMin, yMin, 0.0);
aPoints->SetPoint(2, xMax, yMax, 0.0);
myTextProperty->SetVerticalJustificationToCentered();
- myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
myBarActor ->GetPositionCoordinate()->SetReferenceCoordinate(PositionCoordinate);
myTextActor->GetPositionCoordinate()->SetReferenceCoordinate(PositionCoordinate);
class vtkTextProperty;
class vtkViewport;
class vtkWindow;
+class vtkTextActor;
class VTKVIEWER_EXPORT VTKViewer_FramedTextActor : public vtkActor2D
{
virtual void SetPickable(int);
virtual int GetPickable();
- virtual void GetSize(vtkRenderer* theRenderer, int theSize[2]) const;
+ virtual void GetSize(vtkRenderer* vport, double theSize[2]) const;
void SetText(const char* theText);
char* GetText();
void SetTextMargin(const int theMargin);
int GetTextMargin() const;
- void SetOffset(const int theOffset[2]);
+ void SetOffset(const double theOffset[2]);
protected:
VTKViewer_FramedTextActor();
vtkActor2D* myBarActor;
vtkTextProperty* myTextProperty;
- vtkTextMapper* myTextMapper;
- vtkActor2D* myTextActor;
+ vtkTextActor* myTextActor;
vtkTimeStamp myBuildTime;
if( !this->ImageData.GetPointer() )
return;
+ glEnable( GL_TEXTURE_2D );
+ if( this->PointSpriteTexture == 0 ) {
+ glGenTextures( 1, &this->PointSpriteTexture );
+ }
+ glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
+ glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
-
+
if(this->BallEnabled) {
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
unsigned char* dataPtr = (unsigned char*)this->ImageData->GetScalarPointer();
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, aSize[0], aSize[1], 0,
GL_RGBA, GL_UNSIGNED_BYTE, dataPtr );
-
- //glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- glEnable( GL_TEXTURE_2D );
- glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
- glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
}
//-----------------------------------------------------------------------------
MAPPER_SUPERCLASS::RenderPiece( ren, act );
if( isUsePointSprites )
this->CleanupPointSprites();
+ glBindTexture( GL_TEXTURE_2D, 0 );
} else {
vtkIdType numPts;
vtkPolyData *input= this->GetInput();
this->TimeToDraw = 0.0001;
vglUseProgramObjectARB( 0 );
-
this->CleanupPointSprites();
+ glBindTexture( GL_TEXTURE_2D, 0 );
}
}