1 // Created on: 1995-11-28
2 // Created by: Jean-Pierre COMBE
3 // Copyright (c) 1995-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.
18 #include <DsgPrs_PerpenPresentation.hxx>
20 #include <gce_MakeDir.hxx>
21 #include <gce_MakeLin.hxx>
22 #include <Geom_CartesianPoint.hxx>
26 #include <Graphic3d_ArrayOfPolylines.hxx>
27 #include <Graphic3d_ArrayOfSegments.hxx>
28 #include <Graphic3d_AspectLine3d.hxx>
29 #include <Graphic3d_Group.hxx>
30 #include <Prs3d_Arrow.hxx>
31 #include <Prs3d_ArrowAspect.hxx>
32 #include <Prs3d_DimensionAspect.hxx>
33 #include <Prs3d_LineAspect.hxx>
34 #include <Prs3d_PointAspect.hxx>
35 #include <Prs3d_Presentation.hxx>
36 #include <Prs3d_Text.hxx>
37 #include <Prs3d_TextAspect.hxx>
38 #include <StdPrs_Point.hxx>
39 #include <TCollection_AsciiString.hxx>
41 void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
42 const Handle(Prs3d_Drawer)& aDrawer,
47 const gp_Pnt& OffsetPoint,
48 const Standard_Boolean intOut1,
49 const Standard_Boolean intOut2)
51 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
52 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
53 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
56 Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(6,2);
59 aPrims->AddVertex(OffsetPoint);
60 aPrims->AddVertex(pAx1);
61 aPrims->AddVertex(pAx2);
64 gp_Vec vec1(gce_MakeDir(OffsetPoint,pAx1));
65 gp_Vec vec2(gce_MakeDir(OffsetPoint,pAx2));
66 vec1 *= .2 * OffsetPoint.Distance(pAx1);
67 vec2 *= .2 * OffsetPoint.Distance(pAx2);
69 gp_Pnt pAx11 = OffsetPoint.Translated(vec1);
70 gp_Pnt pAx22 = OffsetPoint.Translated(vec2);
71 gp_Pnt p_symb = pAx22.Translated(vec1);
74 aPrims->AddVertex(pAx11);
75 aPrims->AddVertex(p_symb);
76 aPrims->AddVertex(pAx22);
78 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
81 if (intOut1 || intOut2)
83 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_DOT); // ou DOT ou DOTDASH
84 Prs3d_Root::NewGroup(aPresentation);
85 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
88 aPrims = new Graphic3d_ArrayOfSegments(2);
89 aPrims->AddVertex(pAx1);
90 aPrims->AddVertex(pnt1);
91 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
94 aPrims = new Graphic3d_ArrayOfSegments(2);
95 aPrims->AddVertex(pAx2);
96 aPrims->AddVertex(pnt2);
97 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);