myTextHeight (20)
{
SetDisplayMode (0);
+ myDrawer->SetupOwnShadingAspect();
+ myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
+ myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
+ myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (Quantity_NOC_WHITE);
}
//=======================================================================
const Standard_Integer aBarTop = myYPos + myHeight - aTitleOffset - aBarYOffset;
const Standard_Integer aBarHeight = aBarTop - aBarBottom;
- // draw title
- if (!myTitle.IsEmpty())
- {
- drawText (Prs3d_Root::CurrentGroup (thePrs), myTitle,
- myXPos + mySpacing,
- aBarTop + aBarYOffset,
- Graphic3d_VTA_BOTTOM);
- }
-
TColStd_SequenceOfExtendedString aLabels;
if (myLabelType == Aspect_TOCSD_USER)
{
aColorBreadth += aTextWidth;
}
+ // draw title
+ Handle(Graphic3d_Group) aLabelsGroup;
+ if (!myTitle.IsEmpty()
+ || !aLabels.IsEmpty())
+ {
+ aLabelsGroup = thePrs->NewGroup();
+ aLabelsGroup->SetGroupPrimitivesAspect (myDrawer->TextAspect()->Aspect());
+ }
+ if (!myTitle.IsEmpty())
+ {
+ drawText (aLabelsGroup, myTitle,
+ myXPos + mySpacing,
+ aBarTop + aBarYOffset,
+ Graphic3d_VTA_BOTTOM);
+ }
+
// draw colors
drawColorBar (thePrs, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
// draw Labels
- drawLabels (thePrs, aLabels, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
+ drawLabels (aLabelsGroup, aLabels, aBarBottom, aBarHeight, aTextWidth, aColorBreadth);
}
//=======================================================================
}
}
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
+ Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
+ aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (aTriangles);
const Quantity_Color aFgColor (hasOwnColor ? myDrawer->Color() : Quantity_NOC_WHITE);
//function : drawLabels
//purpose :
//=======================================================================
-void AIS_ColorScale::drawLabels (const Handle(Prs3d_Presentation)& thePrs,
+void AIS_ColorScale::drawLabels (const Handle(Graphic3d_Group)& theGroup,
const TColStd_SequenceOfExtendedString& theLabels,
const Standard_Integer theBarBottom,
const Standard_Integer theBarHeight,
Standard_Integer aPos2 = aNbLabels - 1 - i2;
if (aFilter && !(aPos1 % aFilter))
{
- drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i1 + 1),
+ drawText (theGroup, theLabels.Value (i1 + 1),
anXLeft, anYBottom + Standard_Integer(i1 * aStepY + anAscent),
Graphic3d_VTA_CENTER);
aLast1 = i1;
}
if (aFilter && !(aPos2 % aFilter))
{
- drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i2 + 1),
+ drawText (theGroup, theLabels.Value (i2 + 1),
anXLeft, anYBottom + Standard_Integer(i2 * aStepY + anAscent),
Graphic3d_VTA_CENTER);
aLast2 = i2;
if (i0 != -1)
{
- drawText (Prs3d_Root::CurrentGroup (thePrs), theLabels.Value (i0 + 1),
+ drawText (theGroup, theLabels.Value (i0 + 1),
anXLeft, anYBottom + Standard_Integer(i0 * aStepY + anAscent),
Graphic3d_VTA_CENTER);
}
aPrim->AddVertex (theX, theY, 0.0);
Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d (theColor, Aspect_TOL_SOLID, 1.0);
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePrs);
- aGroup->SetPrimitivesAspect (anAspect);
+ Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
+ aGroup->SetGroupPrimitivesAspect (anAspect);
aGroup->AddPrimitiveArray (aPrim);
}
const Graphic3d_VerticalTextAlignment theVertAlignment)
{
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
- theGroup->SetPrimitivesAspect (anAspect->Aspect());
theGroup->Text (theText,
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
anAspect->Height(),