1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#define IMP120100 // YFR/GG 10/01/2000
// Enable to compute the triedhron color texts and arrows.
#include <Graphic3d_Group.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Arrow.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <gp_Ax2.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
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
}
}
|