mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0029988: AIS_Shape - SetWidth() and SetColor() has no effect for FaceBoundary
AIS_Shape SetWidth and SetColor methods now propagate modifications to FaceBoundary aspect.
This commit is contained in:
parent
c60ec7f521
commit
7604a15365
@ -77,6 +77,7 @@ AIS_ColoredShape::AIS_ColoredShape (const TopoDS_Shape& theShape)
|
|||||||
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
|
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
|
||||||
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
|
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
|
||||||
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
|
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
|
||||||
|
myDrawer->SetFaceBoundaryAspect (myDrawer->LineAspect());
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -90,6 +91,7 @@ AIS_ColoredShape::AIS_ColoredShape (const Handle(AIS_Shape)& theShape)
|
|||||||
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
|
myDrawer->SetFreeBoundaryAspect (myDrawer->LineAspect());
|
||||||
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
|
myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
|
||||||
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
|
myDrawer->SetSeenLineAspect (myDrawer->LineAspect());
|
||||||
|
myDrawer->SetFaceBoundaryAspect (myDrawer->LineAspect());
|
||||||
if (theShape->HasMaterial())
|
if (theShape->HasMaterial())
|
||||||
{
|
{
|
||||||
SetMaterial (theShape->Material());
|
SetMaterial (theShape->Material());
|
||||||
@ -236,6 +238,10 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor)
|
|||||||
{
|
{
|
||||||
aDrawer->WireAspect()->SetColor (theColor);
|
aDrawer->WireAspect()->SetColor (theColor);
|
||||||
}
|
}
|
||||||
|
if (aDrawer->HasOwnFaceBoundaryAspect())
|
||||||
|
{
|
||||||
|
aDrawer->FaceBoundaryAspect()->SetColor (theColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,6 +272,10 @@ void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth)
|
|||||||
{
|
{
|
||||||
aDrawer->WireAspect()->SetWidth (theLineWidth);
|
aDrawer->WireAspect()->SetWidth (theLineWidth);
|
||||||
}
|
}
|
||||||
|
if (aDrawer->HasOwnFaceBoundaryAspect())
|
||||||
|
{
|
||||||
|
aDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,43 +31,34 @@
|
|||||||
static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
|
static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
|
||||||
const AIS_TypeOfAttribute Att)
|
const AIS_TypeOfAttribute Att)
|
||||||
{
|
{
|
||||||
switch(Att){
|
switch(Att)
|
||||||
|
{
|
||||||
case AIS_TOA_Line:
|
case AIS_TOA_Line:
|
||||||
return Dr->LineAspect();
|
return Dr->LineAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Dimension:
|
case AIS_TOA_Dimension:
|
||||||
return Dr->DimensionAspect()->LineAspect();
|
return Dr->DimensionAspect()->LineAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Wire:
|
case AIS_TOA_Wire:
|
||||||
return Dr->WireAspect();
|
return Dr->WireAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Plane:
|
case AIS_TOA_Plane:
|
||||||
return Dr->PlaneAspect()->EdgesAspect();
|
return Dr->PlaneAspect()->EdgesAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Vector:
|
case AIS_TOA_Vector:
|
||||||
return Dr->VectorAspect();
|
return Dr->VectorAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_UIso:
|
case AIS_TOA_UIso:
|
||||||
return Handle(Prs3d_LineAspect) (Dr->UIsoAspect());
|
return Handle(Prs3d_LineAspect) (Dr->UIsoAspect());
|
||||||
break;
|
|
||||||
case AIS_TOA_VIso:
|
case AIS_TOA_VIso:
|
||||||
return Handle(Prs3d_LineAspect) (Dr->VIsoAspect());
|
return Handle(Prs3d_LineAspect) (Dr->VIsoAspect());
|
||||||
break;
|
|
||||||
case AIS_TOA_Free:
|
case AIS_TOA_Free:
|
||||||
return Dr->FreeBoundaryAspect();
|
return Dr->FreeBoundaryAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_UnFree:
|
case AIS_TOA_UnFree:
|
||||||
return Dr->UnFreeBoundaryAspect();
|
return Dr->UnFreeBoundaryAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Section:
|
case AIS_TOA_Section:
|
||||||
return Dr->SectionAspect();
|
return Dr->SectionAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Hidden:
|
case AIS_TOA_Hidden:
|
||||||
return Dr->HiddenLineAspect();
|
return Dr->HiddenLineAspect();
|
||||||
break;
|
|
||||||
case AIS_TOA_Seen:
|
case AIS_TOA_Seen:
|
||||||
return Dr->SeenLineAspect();
|
return Dr->SeenLineAspect();
|
||||||
break;
|
case AIS_TOA_FaceBoundary:
|
||||||
|
return Dr->FaceBoundaryAspect();
|
||||||
case AIS_TOA_FirstAxis:
|
case AIS_TOA_FirstAxis:
|
||||||
return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis);
|
return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis);
|
||||||
case AIS_TOA_SecondAxis:
|
case AIS_TOA_SecondAxis:
|
||||||
|
@ -346,11 +346,13 @@ Standard_Real AIS_Shape::Transparency() const {
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
bool AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
||||||
const Quantity_Color& theColor) const
|
const Quantity_Color& theColor) const
|
||||||
{
|
{
|
||||||
|
bool toRecompute = false;
|
||||||
if (!theDrawer->HasOwnShadingAspect())
|
if (!theDrawer->HasOwnShadingAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -359,6 +361,7 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnLineAspect())
|
if (!theDrawer->HasOwnLineAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -367,6 +370,7 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnWireAspect())
|
if (!theDrawer->HasOwnWireAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -375,6 +379,7 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnPointAspect())
|
if (!theDrawer->HasOwnPointAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
|
theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -383,6 +388,7 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnFreeBoundaryAspect())
|
if (!theDrawer->HasOwnFreeBoundaryAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -391,6 +397,7 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
|
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -399,12 +406,22 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnSeenLineAspect())
|
if (!theDrawer->HasOwnSeenLineAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
|
*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
|
// override color
|
||||||
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
|
theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
|
||||||
@ -414,6 +431,8 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
theDrawer->FreeBoundaryAspect()->SetColor (theColor);
|
theDrawer->FreeBoundaryAspect()->SetColor (theColor);
|
||||||
theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
|
theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
|
||||||
theDrawer->SeenLineAspect()->SetColor (theColor);
|
theDrawer->SeenLineAspect()->SetColor (theColor);
|
||||||
|
theDrawer->FaceBoundaryAspect()->SetColor (theColor);
|
||||||
|
return toRecompute;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -423,9 +442,16 @@ void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
|
|
||||||
void AIS_Shape::SetColor (const Quantity_Color& theColor)
|
void AIS_Shape::SetColor (const Quantity_Color& theColor)
|
||||||
{
|
{
|
||||||
setColor (myDrawer, theColor);
|
const bool toRecompute = setColor (myDrawer, theColor);
|
||||||
myDrawer->SetColor (theColor);
|
myDrawer->SetColor (theColor);
|
||||||
hasOwnColor = Standard_True;
|
hasOwnColor = Standard_True;
|
||||||
|
if (!toRecompute)
|
||||||
|
{
|
||||||
|
myToRecomputeModes.Clear();
|
||||||
|
myRecomputeEveryPrs = false;
|
||||||
|
SynchronizeAspects();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// modify shading presentation without re-computation
|
// modify shading presentation without re-computation
|
||||||
const PrsMgr_Presentations& aPrsList = Presentations();
|
const PrsMgr_Presentations& aPrsList = Presentations();
|
||||||
@ -477,8 +503,10 @@ void AIS_Shape::UnsetColor()
|
|||||||
if (!HasColor())
|
if (!HasColor())
|
||||||
{
|
{
|
||||||
myToRecomputeModes.Clear();
|
myToRecomputeModes.Clear();
|
||||||
|
myRecomputeEveryPrs = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasOwnColor = Standard_False;
|
hasOwnColor = Standard_False;
|
||||||
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
|
myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
|
||||||
|
|
||||||
@ -490,6 +518,7 @@ void AIS_Shape::UnsetColor()
|
|||||||
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
||||||
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
||||||
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
||||||
|
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -522,6 +551,12 @@ void AIS_Shape::UnsetColor()
|
|||||||
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor);
|
AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor);
|
||||||
}
|
}
|
||||||
myDrawer->SeenLineAspect()->SetColor (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())
|
if (!myDrawer->HasOwnShadingAspect())
|
||||||
@ -568,40 +603,7 @@ void AIS_Shape::UnsetColor()
|
|||||||
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
|
||||||
}
|
}
|
||||||
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
|
||||||
|
myRecomputeEveryPrs = true;
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -609,11 +611,13 @@ void AIS_Shape::UnsetColor()
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
bool AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
||||||
const Standard_Real theLineWidth) const
|
const Standard_Real theLineWidth) const
|
||||||
{
|
{
|
||||||
|
bool toRecompute = false;
|
||||||
if (!theDrawer->HasOwnLineAspect())
|
if (!theDrawer->HasOwnLineAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -622,6 +626,7 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnWireAspect())
|
if (!theDrawer->HasOwnWireAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -630,6 +635,7 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnFreeBoundaryAspect())
|
if (!theDrawer->HasOwnFreeBoundaryAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -638,6 +644,7 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
|
if (!theDrawer->HasOwnUnFreeBoundaryAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
@ -646,12 +653,22 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
}
|
}
|
||||||
if (!theDrawer->HasOwnSeenLineAspect())
|
if (!theDrawer->HasOwnSeenLineAspect())
|
||||||
{
|
{
|
||||||
|
toRecompute = true;
|
||||||
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
|
||||||
if (theDrawer->HasLink())
|
if (theDrawer->HasLink())
|
||||||
{
|
{
|
||||||
*theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
|
*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
|
// override width
|
||||||
theDrawer->LineAspect()->SetWidth (theLineWidth);
|
theDrawer->LineAspect()->SetWidth (theLineWidth);
|
||||||
@ -659,6 +676,8 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
theDrawer->FreeBoundaryAspect()->SetWidth (theLineWidth);
|
theDrawer->FreeBoundaryAspect()->SetWidth (theLineWidth);
|
||||||
theDrawer->UnFreeBoundaryAspect()->SetWidth (theLineWidth);
|
theDrawer->UnFreeBoundaryAspect()->SetWidth (theLineWidth);
|
||||||
theDrawer->SeenLineAspect()->SetWidth (theLineWidth);
|
theDrawer->SeenLineAspect()->SetWidth (theLineWidth);
|
||||||
|
theDrawer->FaceBoundaryAspect()->SetWidth (theLineWidth);
|
||||||
|
return toRecompute;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -668,10 +687,17 @@ void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
|
|||||||
|
|
||||||
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
|
void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
|
||||||
{
|
{
|
||||||
setWidth (myDrawer, theLineWidth);
|
|
||||||
myOwnWidth = theLineWidth;
|
myOwnWidth = theLineWidth;
|
||||||
LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
|
if (setWidth (myDrawer, theLineWidth))
|
||||||
LoadRecomputable (2); // and the bounding box...
|
{
|
||||||
|
myRecomputeEveryPrs = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myRecomputeEveryPrs = false;
|
||||||
|
myToRecomputeModes.Clear();
|
||||||
|
SynchronizeAspects();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -684,20 +710,21 @@ void AIS_Shape::UnsetWidth()
|
|||||||
if (myOwnWidth == 0.0)
|
if (myOwnWidth == 0.0)
|
||||||
{
|
{
|
||||||
myToRecomputeModes.Clear();
|
myToRecomputeModes.Clear();
|
||||||
|
myRecomputeEveryPrs = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
myOwnWidth = 0.0;
|
myOwnWidth = 0.0;
|
||||||
|
|
||||||
Handle(Prs3d_LineAspect) anEmptyAsp;
|
|
||||||
|
|
||||||
if (!HasColor())
|
if (!HasColor())
|
||||||
{
|
{
|
||||||
|
const Handle(Prs3d_LineAspect) anEmptyAsp;
|
||||||
myDrawer->SetLineAspect (anEmptyAsp);
|
myDrawer->SetLineAspect (anEmptyAsp);
|
||||||
myDrawer->SetWireAspect (anEmptyAsp);
|
myDrawer->SetWireAspect (anEmptyAsp);
|
||||||
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
|
||||||
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
|
||||||
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
myDrawer->SetSeenLineAspect (anEmptyAsp);
|
||||||
|
myDrawer->SetFaceBoundaryAspect (anEmptyAsp);
|
||||||
|
myRecomputeEveryPrs = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -711,8 +738,12 @@ void AIS_Shape::UnsetWidth()
|
|||||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.);
|
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.);
|
||||||
myDrawer->SeenLineAspect() ->SetWidth (myDrawer->HasLink() ?
|
myDrawer->SeenLineAspect() ->SetWidth (myDrawer->HasLink() ?
|
||||||
AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen) : 1.);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -174,8 +174,7 @@ public:
|
|||||||
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
|
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Sets the value aValue for line width in the reconstructed compound shape.
|
//! Sets the value aValue for line width in the reconstructed compound shape.
|
||||||
//! Changes line aspects for lines-only presentation modes like Wireframe and Bounding Box.
|
//! Changes line aspects for lines presentation.
|
||||||
//! Doesn't change face boundary line aspect.
|
|
||||||
Standard_EXPORT virtual void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
|
Standard_EXPORT virtual void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Removes the setting for line width in the reconstructed compound shape.
|
//! Removes the setting for line width in the reconstructed compound shape.
|
||||||
@ -305,9 +304,13 @@ protected:
|
|||||||
|
|
||||||
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
||||||
|
|
||||||
Standard_EXPORT void setColor (const Handle(Prs3d_Drawer)& theDrawer, const Quantity_Color& theColor) const;
|
//! Create own aspects (if they do not exist) and set color to them.
|
||||||
|
//! @return TRUE if new aspects have been created
|
||||||
|
Standard_EXPORT bool setColor (const Handle(Prs3d_Drawer)& theDrawer, const Quantity_Color& theColor) const;
|
||||||
|
|
||||||
Standard_EXPORT void setWidth (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theWidth) const;
|
//! Create own aspects (if they do not exist) and set width to them.
|
||||||
|
//! @return TRUE if new aspects have been created
|
||||||
|
Standard_EXPORT bool setWidth (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theWidth) const;
|
||||||
|
|
||||||
Standard_EXPORT void setTransparency (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theValue) const;
|
Standard_EXPORT void setTransparency (const Handle(Prs3d_Drawer)& theDrawer, const Standard_Real theValue) const;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ AIS_TOA_UnFree,
|
|||||||
AIS_TOA_Section,
|
AIS_TOA_Section,
|
||||||
AIS_TOA_Hidden,
|
AIS_TOA_Hidden,
|
||||||
AIS_TOA_Seen,
|
AIS_TOA_Seen,
|
||||||
|
AIS_TOA_FaceBoundary,
|
||||||
AIS_TOA_FirstAxis,
|
AIS_TOA_FirstAxis,
|
||||||
AIS_TOA_SecondAxis,
|
AIS_TOA_SecondAxis,
|
||||||
AIS_TOA_ThirdAxis
|
AIS_TOA_ThirdAxis
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
puts "============"
|
puts "============"
|
||||||
puts "CR23407"
|
puts "CR23407: Draw face outlines for XDE objects"
|
||||||
puts "============"
|
puts "============"
|
||||||
puts ""
|
puts ""
|
||||||
#######################################################################
|
|
||||||
# Draw face outlines for XDE objects
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
box b 10 10 10
|
box b 10 10 10
|
||||||
vinit
|
vclear
|
||||||
|
vinit View1
|
||||||
vdisplay b
|
vdisplay b
|
||||||
vsetdispmode 1
|
vsetdispmode 1
|
||||||
vshowfaceboundary b 1 255 0 0 10 1
|
vshowfaceboundary b 1 255 0 0 5 1
|
||||||
vfit
|
vfit
|
||||||
vaspects -setwidth 5
|
vaspects -setwidth 10
|
||||||
|
|
||||||
if { "[vreadpixel 314 344 rgb name]" != "RED" ||
|
if { "[vreadpixel 314 344 rgb name]" != "RED" ||
|
||||||
"[vreadpixel 26 267 rgb name]" != "RED" } {
|
"[vreadpixel 26 267 rgb name]" != "RED" } {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user