1 #define IMP120100 // YFR/GG 10/01/2000
2 // Enable to compute the triedhron color texts and arrows.
4 #include <Graphic3d_Group.hxx>
5 #include <Graphic3d_AspectMarker3d.hxx>
6 #include <Graphic3d_AspectLine3d.hxx>
7 #include <Prs3d_Arrow.hxx>
11 #include <Prs3d_LineAspect.hxx>
12 #include <Prs3d_DatumAspect.hxx>
13 #include <Prs3d_TextAspect.hxx>
14 #include <Prs3d_ArrowAspect.hxx>
15 #include <Graphic3d_Array1OfVertex.hxx>
17 void Prs3d_Datum::Add( const Handle(Prs3d_Presentation)& aPresentation,
18 const anyDatum& aDatum,
19 const Handle(Prs3d_Drawer)& aDrawer ) {
21 Handle(Prs3d_DatumAspect) DA = aDrawer->DatumAspect();
23 Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
25 Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
26 DA->FirstAxisAspect()->Aspect()->Values(Col,Tol,W);
28 Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d
29 (Aspect_TOM_BALL,Col,.1);
31 gp_Ax2 Axis = DatumTool::Ax2(aDatum);
32 gp_Pnt Orig = Axis.Location();
33 gp_Dir oX = Axis.XDirection();
34 gp_Dir oY = Axis.YDirection();
35 gp_Dir oZ = Axis.Direction();
38 // Trace d'une petite sphere au debut du vecteur:
41 Quantity_Length xo,yo,zo,x,y,z;
44 G->SetPrimitivesAspect(Asp);
45 G->Marker(Graphic3d_Vertex (xo,yo,zo));
48 Graphic3d_Array1OfVertex A(1,2);
49 A(1).SetCoord(xo,yo,zo);
54 Quantity_Length arrowAngle = aDrawer->ArrowAspect()->Angle();
55 Quantity_Length textHeight = aDrawer->TextAspect()->Height();
58 if (DA->DrawFirstAndSecondAxis()) {
60 DS = DA->FirstAxisLength();
61 x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
63 G->SetPrimitivesAspect(DA->FirstAxisAspect()->Aspect());
66 G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
67 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,arrowAngle,DS/10.);
68 G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
69 G->Text(Standard_CString("X"),A(2),16.);
71 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,PI/180.*10.,DS/10.);
72 Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("X"),A(2),1./81.);
75 if (DA->DrawFirstAndSecondAxis()) {
77 DS = DA->SecondAxisLength();
78 x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
80 G->SetPrimitivesAspect(DA->SecondAxisAspect()->Aspect());
83 G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
84 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,arrowAngle,DS/10.);
85 G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
86 G->Text(Standard_CString("Y"),A(2),16.);
88 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,PI/180.*10.,DS/10.);
89 Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Y"),A(2),1./81.);
92 if (DA->DrawThirdAxis()) {
94 DS = DA->ThirdAxisLength();
95 x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
97 G->SetPrimitivesAspect(DA->ThirdAxisAspect()->Aspect());
100 G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
101 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,arrowAngle,DS/10.);
102 G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
103 G->Text(Standard_CString("Z"),A(2),16.);
105 Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Z"),A(2),1./81.);
106 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,PI/180.*10.,DS/10.);