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
9 // under the terms of the GNU Lesser General Public 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.
17 #include <DsgPrs_PerpenPresentation.ixx>
22 #include <gce_MakeLin.hxx>
23 #include <gce_MakeDir.hxx>
24 #include <Geom_CartesianPoint.hxx>
25 #include <Graphic3d_Group.hxx>
26 #include <Prs3d_Arrow.hxx>
27 #include <Prs3d_Text.hxx>
28 #include <Prs3d_ArrowAspect.hxx>
29 #include <Prs3d_LineAspect.hxx>
30 #include <Prs3d_TextAspect.hxx>
31 #include <Prs3d_PointAspect.hxx>
32 #include <Prs3d_DimensionAspect.hxx>
33 #include <TCollection_AsciiString.hxx>
34 #include <Graphic3d_AspectLine3d.hxx>
35 #include <Graphic3d_ArrayOfSegments.hxx>
36 #include <Graphic3d_ArrayOfPolylines.hxx>
38 #include <StdPrs_Point.hxx>
40 void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
41 const Handle(Prs3d_Drawer)& aDrawer,
46 const gp_Pnt& OffsetPoint,
47 const Standard_Boolean intOut1,
48 const Standard_Boolean intOut2)
50 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
51 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
52 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
55 Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(6,2);
58 aPrims->AddVertex(OffsetPoint);
59 aPrims->AddVertex(pAx1);
60 aPrims->AddVertex(pAx2);
63 gp_Vec vec1(gce_MakeDir(OffsetPoint,pAx1));
64 gp_Vec vec2(gce_MakeDir(OffsetPoint,pAx2));
65 vec1 *= .2 * OffsetPoint.Distance(pAx1);
66 vec2 *= .2 * OffsetPoint.Distance(pAx2);
68 gp_Pnt pAx11 = OffsetPoint.Translated(vec1);
69 gp_Pnt pAx22 = OffsetPoint.Translated(vec2);
70 gp_Pnt p_symb = pAx22.Translated(vec1);
73 aPrims->AddVertex(pAx11);
74 aPrims->AddVertex(p_symb);
75 aPrims->AddVertex(pAx22);
77 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
80 if (intOut1 || intOut2)
82 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_DOT); // ou DOT ou DOTDASH
83 Prs3d_Root::NewGroup(aPresentation);
84 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
87 aPrims = new Graphic3d_ArrayOfSegments(2);
88 aPrims->AddVertex(pAx1);
89 aPrims->AddVertex(pnt1);
90 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
93 aPrims = new Graphic3d_ArrayOfSegments(2);
94 aPrims->AddVertex(pAx2);
95 aPrims->AddVertex(pnt2);
96 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);