0024624: Lost word in license statement in source files
[occt.git] / src / DsgPrs / DsgPrs_TangentPresentation.cxx
1 // Created on: 1996-01-16
2 // Created by: Jean-Pierre COMBE
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <DsgPrs_TangentPresentation.ixx>
18
19 #include <Graphic3d_Group.hxx>
20 #include <Graphic3d_ArrayOfSegments.hxx>
21 #include <Prs3d_Arrow.hxx>
22 #include <Prs3d_ArrowAspect.hxx>
23 #include <Prs3d_LineAspect.hxx>
24 #include <Prs3d_DimensionAspect.hxx>
25 #include <Graphic3d_AspectLine3d.hxx>
26 #include <Prs3d_PointAspect.hxx>
27 #include <Geom_CartesianPoint.hxx>
28 #include <StdPrs_Point.hxx>
29 #include <gp_Vec.hxx>
30 #include <Prs3d_Arrow.hxx>
31
32 void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
33                                       const Handle(Prs3d_Drawer)& aDrawer,
34                                       const gp_Pnt& OffsetPoint,
35                                       const gp_Dir& aDirection,
36                                       const Standard_Real length)
37 {
38   gp_Vec vec(aDirection);
39   gp_Vec vec1 = vec.Multiplied(length);
40   gp_Vec vec2 = vec.Multiplied(-length);
41   gp_Pnt p1 = OffsetPoint.Translated(vec1);
42   gp_Pnt p2 = OffsetPoint.Translated(vec2);
43   
44   // Aspect
45   Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
46   LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
47   Handle(Prs3d_ArrowAspect) ARR1 = LA->ArrowAspect();
48   Handle(Prs3d_ArrowAspect) ARR2 = LA->ArrowAspect();
49   ARR1->SetLength(length/5);
50   ARR2->SetLength(length/5);
51
52   // Array1OfVertex
53   Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
54
55   Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
56   aPrims->AddVertex(p1);
57   aPrims->AddVertex(p2);
58   Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
59
60   // fleche 1 : 
61   Prs3d_Root::NewGroup(aPresentation);
62   Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
63   Prs3d_Arrow::Draw(aPresentation,p1,aDirection,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
64
65   // fleche 2
66   Prs3d_Root::NewGroup(aPresentation);
67   Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
68   Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
69 }