//purpose :
//=======================================================================
-void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
+bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColor) const
{
+ bool toRecompute = false;
if (!theDrawer->HasOwnShadingAspect())
{
+ toRecompute = true;
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnLineAspect())
{
+ toRecompute = true;
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnWireAspect())
{
+ toRecompute = true;
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnPointAspect())
{
+ toRecompute = true;
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
+ toRecompute = true;
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
+ toRecompute = true;
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnSeenLineAspect())
{
+ toRecompute = true;
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
}
}
+ if (!theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ toRecompute = true;
+ theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+ if (theDrawer->HasLink())
+ {
+ *theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
+ }
+ }
// override color
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
theDrawer->FreeBoundaryAspect()->SetColor (theColor);
theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
theDrawer->SeenLineAspect()->SetColor (theColor);
+ theDrawer->FaceBoundaryAspect()->SetColor (theColor);
+ return toRecompute;
}
//=======================================================================
void AIS_Shape::SetColor (const Quantity_Color& theColor)
{
- setColor (myDrawer, theColor);
+ const bool toRecompute = setColor (myDrawer, theColor);
myDrawer->SetColor (theColor);
hasOwnColor = Standard_True;
+ if (!toRecompute)
+ {
+ myToRecomputeModes.Clear();
+ myRecomputeEveryPrs = false;
+ SynchronizeAspects();
+ return;
+ }
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
if (!HasColor())
{
myToRecomputeModes.Clear();
+ myRecomputeEveryPrs = false;
return;
}
+
hasOwnColor = Standard_False;
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
+ myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
}
else
{
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor);
}
myDrawer->SeenLineAspect()->SetColor (aColor);
+ aColor = Quantity_NOC_BLACK;
+ if (myDrawer->HasLink())
+ {
+ AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_FaceBoundary, aColor);
+ }
+ myDrawer->FaceBoundaryAspect()->SetColor (aColor);
}
if (!myDrawer->HasOwnShadingAspect())
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
}
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
-
- // modify shading presentation without re-computation
- const PrsMgr_Presentations& aPrsList = Presentations();
- Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
- Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->LineAspect()->Aspect();
- for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
- {
- const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
- if (aPrsModed.Mode() != AIS_Shaded)
- {
- continue;
- }
-
- const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
- for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
- {
- const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
-
- // Check if aspect of given type is set for the group,
- // because setting aspect for group with no already set aspect
- // can lead to loss of presentation data
- if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
- {
- aGroup->SetGroupPrimitivesAspect (anAreaAsp);
- }
- if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
- {
- aGroup->SetGroupPrimitivesAspect (aLineAsp);
- }
- }
- }
-
- LoadRecomputable (AIS_WireFrame);
- LoadRecomputable (2);
+ myRecomputeEveryPrs = true;
}
//=======================================================================
//purpose :
//=======================================================================
-void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
+bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theLineWidth) const
{
+ bool toRecompute = false;
if (!theDrawer->HasOwnLineAspect())
{
+ toRecompute = true;
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnWireAspect())
{
+ toRecompute = true;
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnFreeBoundaryAspect())
{
+ toRecompute = true;
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
{
+ toRecompute = true;
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
}
if (!theDrawer->HasOwnSeenLineAspect())
{
+ toRecompute = true;
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
if (theDrawer->HasLink())
{
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
}
}
+ if (!theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ toRecompute = true;
+ theDrawer->SetFaceBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+ if (theDrawer->HasLink())
+ {
+ *theDrawer->FaceBoundaryAspect()->Aspect() = *theDrawer->Link()->FaceBoundaryAspect()->Aspect();
+ }
+ }
// override width
theDrawer->LineAspect()->SetWidth (theLineWidth);
theDrawer->FreeBoundaryAspect()->SetWidth (theLineWidth);
theDrawer->UnFreeBoundaryAspect()->SetWidth (theLineWidth);
theDrawer->SeenLineAspect()->SetWidth (theLineWidth);
+ theDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
+ return toRecompute;
}
//=======================================================================
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
{
- setWidth (myDrawer, theLineWidth);
myOwnWidth = theLineWidth;
- LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
- LoadRecomputable (2); // and the bounding box...
+ if (setWidth (myDrawer, theLineWidth))
+ {
+ myRecomputeEveryPrs = true;
+ }
+ else
+ {
+ myRecomputeEveryPrs = false;
+ myToRecomputeModes.Clear();
+ SynchronizeAspects();
+ }
}
//=======================================================================
if (myOwnWidth == 0.0)
{
myToRecomputeModes.Clear();
+ myRecomputeEveryPrs = false;
return;
}
myOwnWidth = 0.0;
-
- Handle(Prs3d_LineAspect) anEmptyAsp;
-
if (!HasColor())
{
+ const Handle(Prs3d_LineAspect) anEmptyAsp;
myDrawer->SetLineAspect (anEmptyAsp);
myDrawer->SetWireAspect (anEmptyAsp);
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
myDrawer->SetSeenLineAspect (anEmptyAsp);
+ myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
+ myRecomputeEveryPrs = true;
}
else
{
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.);
myDrawer->SeenLineAspect() ->SetWidth (myDrawer->HasLink() ?
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen) : 1.);
+ myDrawer->FaceBoundaryAspect() ->SetWidth (myDrawer->HasLink() ?
+ AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_FaceBoundary) : 1.);
+ SynchronizeAspects();
+ myToRecomputeModes.Clear();
+ myRecomputeEveryPrs = false;
}
- LoadRecomputable (AIS_WireFrame);
}
//=======================================================================