
Tue, 12/06/2005 - 18:45
Hi all,
I try to use AIS2D and text in OCC 5.2. I could create and display the text. But I have no chance to change the values for height and color and so on and bring them back to AIS2D. Anyone has a hint for me?
Thanks Patrik
AISResult = new AIS2D_InteractiveObject();
TCollection_ExtendedString theTextCollection((Standard_ExtString)tmpText->GetText().c_str());
Handle(Graphic2d_Text) theText = new Graphic2d_Text(AISResult,
theTextCollection, tmpText->GetXPos(), mpText->GetYPos());
if (tmpText->GetAlignment() == POS_DEF_MIDDLE_BOTTOM)
theText->SetAlignment(Graphic2d_TOA_BOTTOMCENTER);
else if (tmpText->GetAlignment() == POS_DEF_RIGHT_BOTTOM)
theText->SetAlignment(Graphic2d_TOA_BOTTOMRIGHT);
GetAISContext2D()->Display(AISResult, Standard_False);
if (!AISResult->HasAspect(theText))
{
Quantity_Color aColor = BuildColor(actLineStyle->GetColor());
Handle(Prs2d_AspectText) theTextAspect = new Prs2d_AspectText();
Standard_Integer colorInd = AISResult->GetContext()->InitializeColor( aColor );
theTextAspect->SetColor( aColor );
theTextAspect->SetColorIndex( colorInd );
try
{
theTextAspect->SetHeight(tmpText->GetHeight(), Standard_True);
}
catch (...)
{}
AISResult->SetContext(GetAISContext2D());
AISResult->SetAspect(theTextAspect, theText);
}
Fri, 12/09/2005 - 10:47
Hi,
I solved it...
Greets,
Patrik