7fd59977 |
1 | // File: DsgPrs_XYZAxisPresentation.cdl |
2 | // Created: Mon Feb 10 14:50:11 1997 |
3 | // Author: Odile Olivier |
4 | // <odl@sacadox.paris1.matra-dtv.fr> |
5 | //Copyright: Matra Datavision 1997 |
6 | |
7 | #define OCC218 // SAV Enable to compute the triedhron color texts and arrows. |
8 | |
9 | |
10 | #include <DsgPrs_XYZAxisPresentation.ixx> |
11 | #include <Prs3d_Root.hxx> |
12 | #include <Prs3d_Arrow.hxx> |
13 | #include <Graphic3d_Group.hxx> |
14 | #include <Graphic3d_Array1OfVertex.hxx> |
15 | |
16 | |
17 | //======================================================================= |
18 | //function : Add |
19 | //purpose : |
20 | //======================================================================= |
21 | |
22 | void DsgPrs_XYZAxisPresentation::Add( |
23 | const Handle(Prs3d_Presentation)& aPresentation, |
24 | const Handle(Prs3d_LineAspect)& aLineAspect, |
25 | const gp_Dir & aDir, |
26 | const Standard_Real aVal, |
27 | const Standard_CString aText, |
28 | const gp_Pnt& aPfirst, |
29 | const gp_Pnt& aPlast) |
30 | { |
31 | |
32 | |
33 | Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation); |
34 | |
35 | Quantity_Length xo,yo,zo,x,y,z; |
36 | |
37 | aPfirst.Coord(xo,yo,zo); |
38 | aPlast.Coord(x,y,z); |
39 | |
40 | Graphic3d_Array1OfVertex A(1,2); |
41 | A(1).SetCoord(xo,yo,zo); |
42 | A(2).SetCoord(x,y,z); |
43 | |
44 | G->SetPrimitivesAspect(aLineAspect->Aspect()); |
45 | G->Polyline(A); |
c6541a0c |
46 | Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),aDir,M_PI/180.*10.,aVal/10.); |
7fd59977 |
47 | Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,A(2),1./81.); |
48 | |
49 | } |
50 | |
51 | |
52 | void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation, |
53 | const Handle(Prs3d_LineAspect)& aLineAspect, |
54 | const Handle(Prs3d_ArrowAspect)& anArrowAspect, |
55 | const Handle(Prs3d_TextAspect)& aTextAspect, |
56 | const gp_Dir & aDir, |
57 | const Standard_Real aVal, |
58 | const Standard_CString aText, |
59 | const gp_Pnt& aPfirst, |
60 | const gp_Pnt& aPlast) |
61 | { |
62 | #ifdef OCC218 |
63 | Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation); |
64 | |
65 | Quantity_Length xo,yo,zo,x,y,z; |
66 | |
67 | aPfirst.Coord(xo,yo,zo); |
68 | aPlast.Coord(x,y,z); |
69 | |
70 | Graphic3d_Array1OfVertex A(1,2); |
71 | A(1).SetCoord(xo,yo,zo); |
72 | A(2).SetCoord(x,y,z); |
73 | |
74 | #ifdef DEB |
75 | Quantity_Length arrowAngle = anArrowAspect->Angle(); |
76 | Quantity_Length textHeight = aTextAspect->Height(); |
77 | #endif |
78 | |
79 | G->SetPrimitivesAspect(aLineAspect->Aspect()); |
80 | G->Polyline(A); |
81 | G->SetPrimitivesAspect( anArrowAspect->Aspect() ); |
c6541a0c |
82 | Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),aDir,M_PI/180.*10.,aVal/10.); |
7fd59977 |
83 | G->SetPrimitivesAspect(aTextAspect->Aspect()); |
84 | Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,A(2),1./81.); |
85 | #endif |
86 | } |