I have problems with ISession_Text class in a V3d_Viewer. I cannot :
- change color
- modify type of alignment
- change scale, width, height ...
Every change has no effect !!!
Thank you for answer.
Jendrik Seiler Tue, 04/23/2013 - 12:23
In case anyone stumbles across this thread in the future with the same problem: I was able to fix the color changing by adding the following line to the ISession_Text.cpp file:
void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
myDrawer->TextAspect()->SetColor(this->myOwnColor); // This one
Prs3d_Text::Draw(aPresentation,myDrawer,MyText,gp_Pnt( MyX ,MyY,MyZ ));
}
myDrawer->TextAspect()->SetColor(this->myOwnColor); // color does not change otherwise
if(this->MyScale != 0) { myDrawer->TextAspect()->SetHeight(this->MyScale); } // size does not change otherwise
myDrawer->TextAspect()->SetFont("Rock"); // size resets font
Possible font types are "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", "Courier", "ZapfChancery-MediumItalic", "Rock", "Symbol", "Iris" and "ZapfDingbats"
Also, any time the ISession_Text is removed and redisplayed in the viewer I have to call the Redisplay() function or the properties reset.
Tue, 04/23/2013 - 12:23
In case anyone stumbles across this thread in the future with the same problem: I was able to fix the color changing by adding the following line to the ISession_Text.cpp file:
void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
myDrawer->TextAspect()->SetColor(this->myOwnColor); // This one
Prs3d_Text::Draw(aPresentation,myDrawer,MyText,gp_Pnt( MyX ,MyY,MyZ ));
}
I had to include the following files as well
#include
#include "Prs3d_TextAspect.hxx"
but now it works just fine.
Tue, 09/17/2013 - 13:35
I added a few more lines of code:
myDrawer->TextAspect()->SetColor(this->myOwnColor); // color does not change otherwise
if(this->MyScale != 0) { myDrawer->TextAspect()->SetHeight(this->MyScale); } // size does not change otherwise
myDrawer->TextAspect()->SetFont("Rock"); // size resets font
Possible font types are "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic", "Courier", "ZapfChancery-MediumItalic", "Rock", "Symbol", "Iris" and "ZapfDingbats"
Also, any time the ISession_Text is removed and redisplayed in the viewer I have to call the Redisplay() function or the properties reset.
Hope this helps someone at some point.