#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_PointAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <Prs3d_ShadingAspect.hxx>
myTrihDispMode (Prs3d_DM_WireFrame),
myComponent (theComponent)
{
+ myAutoHilight = Standard_False;
+
// selection priorities
mySelectionPriority.Bind (Prs3d_DP_None, 5); // complete triedron: priority 5 (same as faces)
mySelectionPriority.Bind (Prs3d_DP_Origin, 8); // origin: priority 8
{
mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 5); // planes: priority: 5
}
+ myHiddenLineAspect = new Graphic3d_AspectLine3d (Quantity_NOC_WHITE, Aspect_TOL_EMPTY, 1.0f);
// trihedron labels
myLabel.Bind (Prs3d_DP_XAxis, "X");
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
SetToUpdate();
- UpdatePresentations();
UpdateSelection();
}
else
{
SetToUpdate();
- UpdatePresentations();
}
UpdateSelection();
}
aPresentation->Clear();
const Prs3d_DatumParts aPart = anOwner->DatumPart();
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
- Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis)
{
// planes selection is equal in both shading and wireframe mode
- aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
+ aGroup->SetGroupPrimitivesAspect (theStyle->LineAspect()->Aspect());
}
else
{
if (myTrihDispMode == Prs3d_DM_Shaded)
{
- aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect(aPart)->Aspect());
+ aGroup->SetGroupPrimitivesAspect (theStyle->ShadingAspect()->Aspect());
}
else
{
if (aPart == Prs3d_DP_Origin)
{
- aGroup->SetGroupPrimitivesAspect (getHighlightPointAspect()->Aspect());
+ aGroup->SetGroupPrimitivesAspect (theStyle->PointAspect()->Aspect());
}
else
{
- aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect(aPart)->Aspect());
+ aGroup->SetGroupPrimitivesAspect(theStyle->LineAspect()->Aspect());
}
}
}
aGroup->AddPrimitiveArray (arrayOfPrimitives(aPart));
- if (aPresentation->GetZLayer() != theStyle->ZLayer())
+ const Graphic3d_ZLayerId aLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : myDrawer->ZLayer();
+ if (aPresentation->GetZLayer() != aLayer)
{
- aPresentation->SetZLayer (theStyle->ZLayer());
+ aPresentation->SetZLayer (aLayer);
}
+
aPresentation->Highlight (theStyle);
thePM->AddToImmediateList (aPresentation);
}
return;
}
- Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded;
- const Handle(Prs3d_Drawer)& aContextSelStyle = GetContext()->SelectionStyle();
- const Quantity_Color& aSelectionColor = aContextSelStyle->Color();
+ Handle(Prs3d_Drawer) anAspect = !myHilightDrawer.IsNull() ? myHilightDrawer : GetContext()->SelectionStyle();
for (SelectMgr_SequenceOfOwner::Iterator anIterator (theOwners); anIterator.More(); anIterator.Next())
{
const Handle(SelectMgr_EntityOwner)& anOwner = anIterator.Value();
Handle(AIS_TrihedronOwner) aTrihedronOwner = Handle(AIS_TrihedronOwner)::DownCast(anOwner);
if (aTrihedronOwner.IsNull())
{
- thePM->Color (this, aContextSelStyle, 0);
+ thePM->Color (this, anAspect, 0);
continue;
}
const Prs3d_DatumParts aPart = aTrihedronOwner->DatumPart();
Handle(Graphic3d_Group) aGroup;
- if (mySelectedParts.Contains (aPart)
- || !myPartToGroup.Find (aPart, aGroup))
+ if (mySelectedParts.Contains (aPart) || !myPartToGroup.Find (aPart, aGroup))
{
continue;
}
if (aPart >= Prs3d_DP_XOYAxis
&& aPart <= Prs3d_DP_XOZAxis)
{
- getHighlightLineAspect()->SetColor (aSelectionColor);
- aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
+ aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect()->Aspect());
}
else
{
if (isShadingMode)
{
- getHighlightAspect()->SetColor (aSelectionColor);
- aGroup->SetGroupPrimitivesAspect (getHighlightAspect()->Aspect());
+ aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect()->Aspect());
}
else
{
if (aPart == Prs3d_DP_Origin)
{
- getHighlightPointAspect()->SetColor (aSelectionColor);
- aGroup->SetGroupPrimitivesAspect (getHighlightPointAspect()->Aspect());
+ aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect());
}
else
{
- getHighlightLineAspect()->SetColor (aSelectionColor);
- aGroup->SetGroupPrimitivesAspect (getHighlightLineAspect()->Aspect());
+ aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect()->Aspect());
}
}
}
if (aPart >= Prs3d_DP_XOYAxis
&& aPart <= Prs3d_DP_XOZAxis)
{
- aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (aPart)->Aspect());
+ aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
}
- if (isShadingMode)
+ else if (isShadingMode)
{
aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect());
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
myPartToGroup.Bind (aPart, aGroup);
- const Handle(Graphic3d_AspectLine3d)& aLineAspect = anAspect->LineAspect (aPart)->Aspect();
- aLineAspect->SetType (Aspect_TOL_EMPTY);
-
aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
- aGroup->SetGroupPrimitivesAspect (aLineAspect);
+ aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
}
}
myPrimitives.Bind(aPart, aPrims);
}
}
-
-// =======================================================================
-// function : getHighlightAspect
-// purpose :
-// =======================================================================
-Handle(Prs3d_ShadingAspect) AIS_Trihedron::getHighlightAspect()
-{
- if (!myHighlightAspect.IsNull())
- return myHighlightAspect;
-
- Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
- if (!myHilightDrawer.IsNull())
- aHighlightColor = myHilightDrawer->Color();
-
- myHighlightAspect = new Prs3d_ShadingAspect();
- myHighlightAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
- myHighlightAspect->SetColor (aHighlightColor);
-
- Graphic3d_MaterialAspect aHighlightMaterial;
- aHighlightMaterial.SetColor (aHighlightColor);
- myHighlightAspect->SetMaterial (aHighlightMaterial);
-
- return myHighlightAspect;
-}
-
-// =======================================================================
-// function : getHighlightLineAspect
-// purpose :
-// =======================================================================
-Handle(Prs3d_LineAspect) AIS_Trihedron::getHighlightLineAspect()
-{
- if (!myHighlightLineAspect.IsNull())
- return myHighlightLineAspect;
-
- Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
- if (!myHilightDrawer.IsNull())
- aHighlightColor = myHilightDrawer->Color();
-
- Handle(Prs3d_DatumAspect) aDatumAspect = Attributes()->DatumAspect();
- Handle(Prs3d_LineAspect) aLineAspect = aDatumAspect->LineAspect(Prs3d_DP_XAxis);
- myHighlightLineAspect = new Prs3d_LineAspect (aHighlightColor, aLineAspect->Aspect()->Type(),
- aLineAspect->Aspect()->Width());
-
- return myHighlightLineAspect;
-}
-
-// =======================================================================
-// function : getHighlightPointAspect
-// purpose :
-// =======================================================================
-Handle(Prs3d_PointAspect) AIS_Trihedron::getHighlightPointAspect()
-{
- if (!myHighlightPointAspect.IsNull())
- return myHighlightPointAspect;
-
- Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
- if (!myHilightDrawer.IsNull())
- aHighlightColor = myHilightDrawer->Color();
- myHighlightPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, aHighlightColor, 1.0);
-
- return myHighlightPointAspect;
-}