1 // Created on: 1993-02-03
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 #ifndef _BRepSweep_Translation_HeaderFile
18 #define _BRepSweep_Translation_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <gp_Vec.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <BRepSweep_Trsf.hxx>
27 #include <TopAbs_Orientation.hxx>
28 class TopoDS_Shape;
29 class Sweep_NumShape;
30 class TopLoc_Location;
31 
32 
33 //! Provides   an  algorithm   to   build  object   by
34 //! translation sweep.
35 class BRepSweep_Translation  : public BRepSweep_Trsf
36 {
37 public:
38 
39   DEFINE_STANDARD_ALLOC
40 
41 
42   //! Creates  a  topology by  translating <S>  with the
43   //! vector  <V>. If  C  is   true S Sucomponents   are
44   //! copied. If Canonize is true then generated surfaces
45   //! are attempted to be canonized in simple types
46   Standard_EXPORT BRepSweep_Translation(const TopoDS_Shape& S, const Sweep_NumShape& N, const TopLoc_Location& L, const gp_Vec& V, const Standard_Boolean C, const Standard_Boolean Canonize = Standard_True);
47 
48   //! Builds the vertex addressed by [aGenV,aDirV], with its
49   //! geometric part, but without subcomponents.
50   Standard_EXPORT TopoDS_Shape MakeEmptyVertex (const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirV);
51 
52   //! Builds the edge addressed by [aGenV,aDirE], with its
53   //! geometric part, but without subcomponents.
54   Standard_EXPORT TopoDS_Shape MakeEmptyDirectingEdge (const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirE);
55 
56   //! Builds the edge addressed by [aGenE,aDirV], with its
57   //! geometric part, but without subcomponents.
58   Standard_EXPORT TopoDS_Shape MakeEmptyGeneratingEdge (const TopoDS_Shape& aGenE, const Sweep_NumShape& aDirV);
59 
60   //! Sets the  parameters of the new  vertex  on the new
61   //! face. The new face and  new vertex where generated
62   //! from aGenF, aGenV and aDirV .
63   Standard_EXPORT void SetParameters (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewVertex, const TopoDS_Shape& aGenF, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirV);
64 
65   //! Sets the  parameter of the new  vertex  on the new
66   //! edge. The new edge and  new vertex where generated
67   //! from aGenV aDirE, and aDirV.
68   Standard_EXPORT void SetDirectingParameter (const TopoDS_Shape& aNewEdge, TopoDS_Shape& aNewVertex, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirE, const Sweep_NumShape& aDirV);
69 
70   //! Sets the  parameter of the new  vertex  on the new
71   //! edge. The new edge and  new vertex where generated
72   //! from aGenE, aGenV and aDirV .
73   Standard_EXPORT void SetGeneratingParameter (const TopoDS_Shape& aNewEdge, TopoDS_Shape& aNewVertex, const TopoDS_Shape& aGenE, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirV);
74 
75   //! Builds the  face addressed  by [aGenS,aDirS], with
76   //! its geometric part, but without subcomponents. The
77   //! couple aGenS, aDirS can  be a "generating face and
78   //! a  directing  vertex" or  "a generating edge and a
79   //! directing  edge".
80   Standard_EXPORT TopoDS_Shape MakeEmptyFace (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS);
81 
82   //! Sets the PCurve for a new edge on a new face. The
83   //! new edge and  the  new face were generated  using
84   //! aGenF, aGenE and aDirV.
85   Standard_EXPORT void SetPCurve (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewEdge, const TopoDS_Shape& aGenF, const TopoDS_Shape& aGenE, const Sweep_NumShape& aDirV, const TopAbs_Orientation orien);
86 
87   //! Sets the PCurve for a new edge on a new face. The
88   //! new edge and  the  new face were generated  using
89   //! aGenE, aDirE and aDirV.
90   Standard_EXPORT void SetGeneratingPCurve (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewEdge, const TopoDS_Shape& aGenE, const Sweep_NumShape& aDirE, const Sweep_NumShape& aDirV, const TopAbs_Orientation orien);
91 
92   //! Sets the PCurve for a new edge on a new face. The
93   //! new edge and  the  new face were generated  using
94   //! aGenE, aDirE and aGenV.
95   Standard_EXPORT void SetDirectingPCurve (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewEdge, const TopoDS_Shape& aGenE, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirE, const TopAbs_Orientation orien);
96 
97   //! Returns the Orientation of the  shell in the solid
98   //! generated by the face aGenS  with  the edge aDirS.
99   //! It is  REVERSED  if the surface is  swept  in  the
100   //! direction of the normal.
101   Standard_EXPORT TopAbs_Orientation DirectSolid (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS);
102 
103   //! Returns   true   if  aNewSubShape    (addressed by
104   //! aSubGenS  and aDirS)  must  be added  in aNewShape
105   //! (addressed by aGenS and aDirS).
106   Standard_EXPORT Standard_Boolean GGDShapeIsToAdd (const TopoDS_Shape& aNewShape, const TopoDS_Shape& aNewSubShape, const TopoDS_Shape& aGenS, const TopoDS_Shape& aSubGenS, const Sweep_NumShape& aDirS) const;
107 
108   //! Returns   true   if  aNewSubShape    (addressed by
109   //! aGenS  and aSubDirS)  must  be added  in aNewShape
110   //! (addressed by aGenS and aDirS).
111   Standard_EXPORT Standard_Boolean GDDShapeIsToAdd (const TopoDS_Shape& aNewShape, const TopoDS_Shape& aNewSubShape, const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS, const Sweep_NumShape& aSubDirS) const;
112 
113   //! In  some  particular  cases  the   topology  of  a
114   //! generated  face must be  composed  of  independent
115   //! closed wires,  in this case  this function returns
116   //! true.
117   //! Here it always returns false.
118   Standard_EXPORT Standard_Boolean SeparatedWires (const TopoDS_Shape& aNewShape, const TopoDS_Shape& aNewSubShape, const TopoDS_Shape& aGenS, const TopoDS_Shape& aSubGenS, const Sweep_NumShape& aDirS) const;
119 
120   //! Returns true   if aDirS   and aGenS  addresses   a
121   //! resulting Shape. In some  specific cases the shape
122   //! can  be    geometrically   inexsistant,  then this
123   //! function returns false.
124   Standard_EXPORT Standard_Boolean HasShape (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS) const;
125 
126   //! Returns  always     false   because    here    the
127   //! transformation is a translation.
128   Standard_EXPORT Standard_Boolean IsInvariant (const TopoDS_Shape& aGenS) const;
129 
130   //! Returns the Vector of the Prism,  if it is an infinite
131   //! prism the Vec is unitar.
132   Standard_EXPORT gp_Vec Vec() const;
133 
134 
135 
136 
137 protected:
138 
139 
140 
141 
142 
143 private:
144 
145 
146 
147   gp_Vec myVec;
148   Standard_Boolean myCanonize;
149 
150 
151 };
152 
153 
154 
155 
156 
157 
158 
159 #endif // _BRepSweep_Translation_HeaderFile
160