| 1 | // Created on: 1993-10-14 |
| 2 | // Created by: Remi LEQUETTE |
| 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 | // Modified by skv - Fri Mar 4 15:50:09 2005 |
| 18 | // Add methods for supporting history. |
| 19 | |
| 20 | #include <BRepLib.hxx> |
| 21 | #include <BRepPrimAPI_MakePrism.hxx> |
| 22 | #include <BRepSweep_Prism.hxx> |
| 23 | #include <gp_Dir.hxx> |
| 24 | #include <gp_Vec.hxx> |
| 25 | #include <TopoDS_Shape.hxx> |
| 26 | |
| 27 | // perform checks on the argument |
| 28 | static const TopoDS_Shape& check(const TopoDS_Shape& S) |
| 29 | { |
| 30 | BRepLib::BuildCurves3d(S); |
| 31 | return S; |
| 32 | } |
| 33 | |
| 34 | //======================================================================= |
| 35 | //function : BRepPrimAPI_MakePrism |
| 36 | //purpose : |
| 37 | //======================================================================= |
| 38 | |
| 39 | BRepPrimAPI_MakePrism::BRepPrimAPI_MakePrism(const TopoDS_Shape& S, |
| 40 | const gp_Vec& V, |
| 41 | const Standard_Boolean Copy, |
| 42 | const Standard_Boolean Canonize) : |
| 43 | myPrism(check(S),V,Copy,Canonize) |
| 44 | { |
| 45 | Build(); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | //======================================================================= |
| 50 | //function : BRepPrimAPI_MakePrism |
| 51 | //purpose : |
| 52 | //======================================================================= |
| 53 | |
| 54 | BRepPrimAPI_MakePrism::BRepPrimAPI_MakePrism(const TopoDS_Shape& S, |
| 55 | const gp_Dir& D, |
| 56 | const Standard_Boolean Inf, |
| 57 | const Standard_Boolean Copy, |
| 58 | const Standard_Boolean Canonize) : |
| 59 | myPrism(check(S),D,Inf,Copy,Canonize) |
| 60 | { |
| 61 | Build(); |
| 62 | } |
| 63 | |
| 64 | |
| 65 | //======================================================================= |
| 66 | //function : Prism |
| 67 | //purpose : |
| 68 | //======================================================================= |
| 69 | |
| 70 | const BRepSweep_Prism& BRepPrimAPI_MakePrism::Prism()const |
| 71 | { |
| 72 | return myPrism; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | //======================================================================= |
| 77 | //function : Build |
| 78 | //purpose : |
| 79 | //======================================================================= |
| 80 | |
| 81 | void BRepPrimAPI_MakePrism::Build() |
| 82 | { |
| 83 | myShape = myPrism.Shape(); |
| 84 | Done(); |
| 85 | } |
| 86 | |
| 87 | //======================================================================= |
| 88 | //function : FirstShape |
| 89 | //purpose : |
| 90 | //======================================================================= |
| 91 | |
| 92 | TopoDS_Shape BRepPrimAPI_MakePrism::FirstShape() |
| 93 | { |
| 94 | return myPrism.FirstShape(); |
| 95 | } |
| 96 | |
| 97 | |
| 98 | //======================================================================= |
| 99 | //function : LastShape |
| 100 | //purpose : |
| 101 | //======================================================================= |
| 102 | |
| 103 | TopoDS_Shape BRepPrimAPI_MakePrism::LastShape() |
| 104 | { |
| 105 | return myPrism.LastShape(); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | //======================================================================= |
| 110 | //function : Generated |
| 111 | //purpose : |
| 112 | //======================================================================= |
| 113 | |
| 114 | const TopTools_ListOfShape& BRepPrimAPI_MakePrism::Generated (const TopoDS_Shape& S) |
| 115 | { |
| 116 | myGenerated.Clear(); |
| 117 | if (myPrism.IsUsed(S) && myPrism.GenIsUsed(S)) |
| 118 | { |
| 119 | myGenerated.Append(myPrism.Shape(S)); |
| 120 | } |
| 121 | return myGenerated; |
| 122 | |
| 123 | } |
| 124 | |
| 125 | |
| 126 | // Modified by skv - Fri Mar 4 15:50:09 2005 Begin |
| 127 | |
| 128 | //======================================================================= |
| 129 | //function : FirstShape |
| 130 | //purpose : This method returns the bottom shape of the prism, generated |
| 131 | // with theShape (subShape of the generating shape) |
| 132 | //======================================================================= |
| 133 | |
| 134 | TopoDS_Shape BRepPrimAPI_MakePrism::FirstShape(const TopoDS_Shape &theShape) |
| 135 | { |
| 136 | return myPrism.FirstShape(theShape); |
| 137 | } |
| 138 | |
| 139 | |
| 140 | //======================================================================= |
| 141 | //function : LastShape |
| 142 | //purpose : This method returns the top shape of the prism, generated |
| 143 | // with theShape (subShape of the generating shape) |
| 144 | //======================================================================= |
| 145 | |
| 146 | TopoDS_Shape BRepPrimAPI_MakePrism::LastShape(const TopoDS_Shape &theShape) |
| 147 | { |
| 148 | return myPrism.LastShape(theShape); |
| 149 | } |
| 150 | |
| 151 | // Modified by skv - Fri Mar 4 15:50:09 2005 End |
| 152 | |
| 153 | //======================================================================= |
| 154 | //function : IsDeleted |
| 155 | //purpose : |
| 156 | //======================================================================= |
| 157 | Standard_Boolean BRepPrimAPI_MakePrism::IsDeleted(const TopoDS_Shape& S) |
| 158 | { |
| 159 | return !myPrism.IsUsed(S); |
| 160 | } |
| 161 | |