1 // Created on: 1996-03-19
2 // Created by: Flore Lantheaume
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 #include <DsgPrs_Chamf2dPresentation.hxx>
22 #include <Graphic3d_ArrayOfSegments.hxx>
23 #include <Graphic3d_Group.hxx>
24 #include <Prs3d_Arrow.hxx>
25 #include <Prs3d_ArrowAspect.hxx>
26 #include <Prs3d_DimensionAspect.hxx>
27 #include <Prs3d_LineAspect.hxx>
28 #include <Prs3d_Presentation.hxx>
29 #include <Prs3d_Text.hxx>
30 #include <TCollection_ExtendedString.hxx>
32 void 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)
39 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
41 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
43 Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
44 aPrims->AddVertex(aPntAttach);
45 aPrims->AddVertex(aPntEnd);
46 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
48 gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
49 Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
51 Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
55 //==========================================================================
56 // function : DsgPrs_Chamf2dPresentation::Add
57 // purpose : it is possible to choose the symbol of extremities of the face (arrow, point ...)
58 //==========================================================================
60 void 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)
68 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
70 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
72 Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
73 aPrims->AddVertex(aPntAttach);
74 aPrims->AddVertex(aPntEnd);
75 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
77 Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
79 gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
80 gp_Dir ArrowDir1 = ArrowDir;
83 DsgPrs::ComputeSymbol(aPresentation,LA,aPntEnd,aPntAttach,ArrowDir1,ArrowDir,ArrowPrs);