#define IMP120100 // YFR/GG 10/01/2000 // Enable to compute the triedhron color texts and arrows. #include #include #include #include #include #include #include #include #include #include #include #include void Prs3d_Datum::Add( const Handle(Prs3d_Presentation)& aPresentation, const anyDatum& aDatum, const Handle(Prs3d_Drawer)& aDrawer ) { Handle(Prs3d_DatumAspect) DA = aDrawer->DatumAspect(); Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation); Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W; DA->FirstAxisAspect()->Aspect()->Values(Col,Tol,W); Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d (Aspect_TOM_BALL,Col,.1); gp_Ax2 Axis = DatumTool::Ax2(aDatum); gp_Pnt Orig = Axis.Location(); gp_Dir oX = Axis.XDirection(); gp_Dir oY = Axis.YDirection(); gp_Dir oZ = Axis.Direction(); // // Trace d'une petite sphere au debut du vecteur: // Quantity_Length xo,yo,zo,x,y,z; Orig.Coord(xo,yo,zo); G->SetPrimitivesAspect(Asp); G->Marker(Graphic3d_Vertex (xo,yo,zo)); Graphic3d_Array1OfVertex A(1,2); A(1).SetCoord(xo,yo,zo); Quantity_Length DS; #ifdef IMP120100 Quantity_Length arrowAngle = aDrawer->ArrowAspect()->Angle(); #endif if (DA->DrawFirstAndSecondAxis()) { oX.Coord(x,y,z); DS = DA->FirstAxisLength(); x = xo + x*DS; y = yo + y*DS; z = zo + z*DS; A(2).SetCoord(x,y,z); G->SetPrimitivesAspect(DA->FirstAxisAspect()->Aspect()); G->Polyline(A); #ifdef IMP120100 G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect()); Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,arrowAngle,DS/10.); G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect()); G->Text(Standard_CString("X"),A(2),16.); #else Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,PI/180.*10.,DS/10.); Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("X"),A(2),1./81.); #endif } if (DA->DrawFirstAndSecondAxis()) { oY.Coord(x,y,z); DS = DA->SecondAxisLength(); x = xo + x*DS; y = yo + y*DS; z = zo + z*DS; A(2).SetCoord(x,y,z); G->SetPrimitivesAspect(DA->SecondAxisAspect()->Aspect()); G->Polyline(A); #ifdef IMP120100 G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect()); Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,arrowAngle,DS/10.); G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect()); G->Text(Standard_CString("Y"),A(2),16.); #else Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,PI/180.*10.,DS/10.); Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Y"),A(2),1./81.); #endif } if (DA->DrawThirdAxis()) { oZ.Coord(x,y,z); DS = DA->ThirdAxisLength(); x = xo + x*DS; y = yo + y*DS; z = zo + z*DS; A(2).SetCoord(x,y,z); G->SetPrimitivesAspect(DA->ThirdAxisAspect()->Aspect()); G->Polyline(A); #ifdef IMP120100 G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect()); Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,arrowAngle,DS/10.); G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect()); G->Text(Standard_CString("Z"),A(2),16.); #else Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Z"),A(2),1./81.); Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,PI/180.*10.,DS/10.); #endif } }