0024624: Lost word in license statement in source files
[occt.git] / src / DsgPrs / DsgPrs_Chamf2dPresentation.cxx
CommitLineData
b311480e 1// Created on: 1996-03-19
2// Created by: Flore Lantheaume
3// Copyright (c) 1996-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <DsgPrs_Chamf2dPresentation.ixx>
18
19#include <Graphic3d_Group.hxx>
b8ddfc2f 20#include <Graphic3d_ArrayOfSegments.hxx>
7fd59977 21#include <Prs3d_Arrow.hxx>
22#include <Prs3d_ArrowAspect.hxx>
23#include <Prs3d_LineAspect.hxx>
a6eb515f 24#include <Prs3d_DimensionAspect.hxx>
7fd59977 25#include <Prs3d_Text.hxx>
26
27#include <gp_Dir.hxx>
28#include <gp_Pnt.hxx>
29
30#include <DsgPrs.hxx>
31
32void DsgPrs_Chamf2dPresentation::Add(
33 const Handle(Prs3d_Presentation)& aPresentation,
34 const Handle(Prs3d_Drawer)& aDrawer,
35 const gp_Pnt& aPntAttach,
36 const gp_Pnt& aPntEnd,
37 const TCollection_ExtendedString& aText)
38{
a6eb515f 39 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
7fd59977 40
b8ddfc2f 41 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
7fd59977 42
b8ddfc2f 43 Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
44 aPrims->AddVertex(aPntAttach);
45 aPrims->AddVertex(aPntEnd);
46 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
7fd59977 47
48 gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
a6eb515f 49 Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
7fd59977 50
51 Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
7fd59977 52}
53
54
55//==========================================================================
56// function : DsgPrs_Chamf2dPresentation::Add
81bba717 57// purpose : it is possible to choose the symbol of extremities of the face (arrow, point ...)
7fd59977 58//==========================================================================
59
60void DsgPrs_Chamf2dPresentation::Add(
61 const Handle(Prs3d_Presentation)& aPresentation,
62 const Handle(Prs3d_Drawer)& aDrawer,
63 const gp_Pnt& aPntAttach,
64 const gp_Pnt& aPntEnd,
65 const TCollection_ExtendedString& aText,
66 const DsgPrs_ArrowSide ArrowPrs)
67{
a6eb515f 68 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
7fd59977 69
b8ddfc2f 70 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
7fd59977 71
b8ddfc2f 72 Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
73 aPrims->AddVertex(aPntAttach);
74 aPrims->AddVertex(aPntEnd);
75 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
7fd59977 76
77 Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
78
79 gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
7fd59977 80 gp_Dir ArrowDir1 = ArrowDir;
81 ArrowDir1.Reverse();
82
83 DsgPrs::ComputeSymbol(aPresentation,LA,aPntEnd,aPntAttach,ArrowDir1,ArrowDir,ArrowPrs);
7fd59977 84}