#include <AIS_InteractiveContext.hxx>
#include <AIS_TrihedronOwner.hxx>
#include <Geom_Axis2Placement.hxx>
-#include <Geom_Transformation.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#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>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Select3D_SensitivePrimitiveArray.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveTriangle.hxx>
-#include <SelectBasics_EntityOwner.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_Type.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");
void AIS_Trihedron::SetComponent (const Handle(Geom_Axis2Placement)& theComponent)
{
myComponent = theComponent;
- LoadRecomputable (AIS_WireFrame);
+ SetToUpdate();
}
//=======================================================================
if (myDrawer->Link().IsNull())
return;
+ myDrawer->DatumAspect()->SetDrawArrows (myDrawer->Link()->DatumAspect()->ToDrawArrows());
+ myDrawer->DatumAspect()->SetDrawLabels (myDrawer->Link()->DatumAspect()->ToDrawLabels());
*myDrawer->DatumAspect()->TextAspect()->Aspect() =
*myDrawer->Link()->DatumAspect()->TextAspect()->Aspect();
*myDrawer->DatumAspect()->PointAspect()->Aspect() =
setOwnDatumAspect();
myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue);
- Update();
+ SetToUpdate();
UpdateSelection();
}
}
else
{
- Update();
+ SetToUpdate();
}
UpdateSelection();
}
computePresentation (thePrsMgr, thePrs);
}
-//=======================================================================
-//function : Compute
-//purpose :
-//=======================================================================
-void AIS_Trihedron::Compute (const Handle(Prs3d_Projector)& theProjector,
- const Handle(Geom_Transformation)& theTrsf,
- const Handle(Prs3d_Presentation)& thePrs)
-{
- PrsMgr_PresentableObject::Compute (theProjector, theTrsf, thePrs);
-}
-
//=======================================================================
//function : ComputeSelection
//purpose :
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));
+ const Graphic3d_ZLayerId aLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : myDrawer->ZLayer();
+ if (aPresentation->GetZLayer() != aLayer)
+ {
+ 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());
}
anAxisGroup->AddPrimitiveArray (arrayOfPrimitives (aPart));
// draw arrow
- Handle(Graphic3d_Group) anArrowGroup = Prs3d_Root::NewGroup (thePrs);
- anArrowGroup->SetPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
-
Prs3d_DatumParts anArrowPart = anAspect->ArrowPartForAxis (aPart);
if (!anAspect->DrawDatumPart (anArrowPart))
{
continue;
}
+
+ Handle(Graphic3d_Group) anArrowGroup = Prs3d_Root::NewGroup (thePrs);
+ anArrowGroup->SetGroupPrimitivesAspect (anAspect->ArrowAspect()->Aspect());
anArrowGroup->AddPrimitiveArray (arrayOfPrimitives (anArrowPart));
}
}
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);
- }
-}
-
-//=======================================================================
-//function : LoadRecomputable
-//purpose :
-//=======================================================================
-void AIS_Trihedron::LoadRecomputable (const Standard_Integer theMode)
-{
- myRecomputeEveryPrs = Standard_False;
- if (!myToRecomputeModes.Contains (theMode))
- {
- myToRecomputeModes.Append (theMode);
+ aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect);
}
}
}
}
+//=======================================================================
+//function : ToDrawArrows
+//purpose :
+//=======================================================================
+Standard_Boolean AIS_Trihedron::ToDrawArrows() const
+{
+ return myDrawer->DatumAspect()->ToDrawArrows();
+}
+
+//=======================================================================
+//function : SetDrawArrows
+//purpose :
+//=======================================================================
+void AIS_Trihedron::SetDrawArrows (const Standard_Boolean theToDraw)
+{
+ setOwnDatumAspect();
+ myDrawer->DatumAspect()->SetDrawArrows (theToDraw);
+}
+
//=======================================================================
//function : createSensitiveEntity
//purpose :
//=======================================================================
-Handle(SelectBasics_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
- const Handle(SelectBasics_EntityOwner)& theOwner) const
+Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs3d_DatumParts thePart,
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
{
Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect();
Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives (thePart);
if (aPrimitives.IsNull())
{
- return Handle(SelectBasics_SensitiveEntity)();
+ return Handle(Select3D_SensitiveEntity)();
}
if (thePart >= Prs3d_DP_XOYAxis
const gp_Pnt anXYZ2 = aSegments->Vertice (2);
return new Select3D_SensitiveSegment (theOwner, anXYZ1, anXYZ2);
}
- return Handle(SelectBasics_SensitiveEntity)();
+ return Handle(Select3D_SensitiveEntity)();
}
// =======================================================================
}
}
-// =======================================================================
-// 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()
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void AIS_Trihedron::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
- if (!myHighlightPointAspect.IsNull())
- return myHighlightPointAspect;
+ OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
- Quantity_Color aHighlightColor = Quantity_NOC_GRAY80;
- if (!myHilightDrawer.IsNull())
- aHighlightColor = myHilightDrawer->Color();
- myHighlightPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, aHighlightColor, 1.0);
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, AIS_InteractiveObject)
- return myHighlightPointAspect;
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSize)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextColor)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowColor)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTrihDispMode)
}