summaryrefslogtreecommitdiff
path: root/src/DsgPrs/DsgPrs_XYZAxisPresentation.cxx
blob: 5a644ff5d588f86cea1796a58aa53192999ae324 (plain)
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
// File:	DsgPrs_XYZAxisPresentation.cdl
// Created:	Mon Feb 10 14:50:11 1997
// Author:	Odile Olivier
//		<odl@sacadox.paris1.matra-dtv.fr>
//Copyright:	 Matra Datavision 1997

#define OCC218	// SAV Enable to compute the triedhron color texts and arrows.


#include <DsgPrs_XYZAxisPresentation.ixx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Arrow.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Array1OfVertex.hxx>


//=======================================================================
//function : Add
//purpose  : 
//=======================================================================

void DsgPrs_XYZAxisPresentation::Add(
		       const Handle(Prs3d_Presentation)& aPresentation,
		       const Handle(Prs3d_LineAspect)& aLineAspect,	     
		       const gp_Dir & aDir, 
		       const Standard_Real aVal,
		       const Standard_CString aText,
		       const gp_Pnt& aPfirst,
		       const gp_Pnt& aPlast)
{


 Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);

 Quantity_Length xo,yo,zo,x,y,z;
  
 aPfirst.Coord(xo,yo,zo);
 aPlast.Coord(x,y,z);
 
 Graphic3d_Array1OfVertex A(1,2);
 A(1).SetCoord(xo,yo,zo);
 A(2).SetCoord(x,y,z);
 
 G->SetPrimitivesAspect(aLineAspect->Aspect());
 G->Polyline(A);
 Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),aDir,PI/180.*10.,aVal/10.);
 Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,A(2),1./81.);

}


void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
				     const Handle(Prs3d_LineAspect)& aLineAspect,
				     const Handle(Prs3d_ArrowAspect)& anArrowAspect,
				     const Handle(Prs3d_TextAspect)& aTextAspect,
				     const gp_Dir & aDir, 
				     const Standard_Real aVal,
				     const Standard_CString aText,
				     const gp_Pnt& aPfirst,
				     const gp_Pnt& aPlast)
{
#ifdef OCC218
  Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);

  Quantity_Length xo,yo,zo,x,y,z;
  
  aPfirst.Coord(xo,yo,zo);
  aPlast.Coord(x,y,z);
 
  Graphic3d_Array1OfVertex A(1,2);
  A(1).SetCoord(xo,yo,zo);
  A(2).SetCoord(x,y,z);
 
  G->SetPrimitivesAspect(aLineAspect->Aspect());
  G->Polyline(A);
  G->SetPrimitivesAspect( anArrowAspect->Aspect() );
  Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),aDir,PI/180.*10.,aVal/10.);
  G->SetPrimitivesAspect(aTextAspect->Aspect());
  Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,A(2),1./81.);
#endif
}