1 // Created on: 1995-11-28
2 // Created by: Jean-Pierre COMBE
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <DsgPrs_PerpenPresentation.ixx>
28 #include <gce_MakeLin.hxx>
29 #include <gce_MakeDir.hxx>
30 #include <Geom_CartesianPoint.hxx>
31 #include <Graphic3d_Group.hxx>
32 #include <Prs3d_Arrow.hxx>
33 #include <Prs3d_Text.hxx>
34 #include <Prs3d_ArrowAspect.hxx>
35 #include <Prs3d_LineAspect.hxx>
36 #include <Prs3d_TextAspect.hxx>
37 #include <Prs3d_PointAspect.hxx>
38 #include <Prs3d_DimensionAspect.hxx>
39 #include <TCollection_AsciiString.hxx>
40 #include <Graphic3d_AspectLine3d.hxx>
41 #include <Graphic3d_ArrayOfSegments.hxx>
42 #include <Graphic3d_ArrayOfPolylines.hxx>
44 #include <StdPrs_Point.hxx>
46 void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
47 const Handle(Prs3d_Drawer)& aDrawer,
52 const gp_Pnt& OffsetPoint,
53 const Standard_Boolean intOut1,
54 const Standard_Boolean intOut2)
56 Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
57 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
58 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
61 Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(6,2);
64 aPrims->AddVertex(OffsetPoint);
65 aPrims->AddVertex(pAx1);
66 aPrims->AddVertex(pAx2);
69 gp_Vec vec1(gce_MakeDir(OffsetPoint,pAx1));
70 gp_Vec vec2(gce_MakeDir(OffsetPoint,pAx2));
71 vec1 *= .2 * OffsetPoint.Distance(pAx1);
72 vec2 *= .2 * OffsetPoint.Distance(pAx2);
74 gp_Pnt pAx11 = OffsetPoint.Translated(vec1);
75 gp_Pnt pAx22 = OffsetPoint.Translated(vec2);
76 gp_Pnt p_symb = pAx22.Translated(vec1);
79 aPrims->AddVertex(pAx11);
80 aPrims->AddVertex(p_symb);
81 aPrims->AddVertex(pAx22);
83 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
86 if (intOut1 || intOut2)
88 LA->LineAspect()->SetTypeOfLine(Aspect_TOL_DOT); // ou DOT ou DOTDASH
89 Prs3d_Root::NewGroup(aPresentation);
90 Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
93 aPrims = new Graphic3d_ArrayOfSegments(2);
94 aPrims->AddVertex(pAx1);
95 aPrims->AddVertex(pnt1);
96 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
99 aPrims = new Graphic3d_ArrayOfSegments(2);
100 aPrims->AddVertex(pAx2);
101 aPrims->AddVertex(pnt2);
102 Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);