1 // Created on: 1991-02-21 2 // Created by: Remi Lequette 3 // Copyright (c) 1991-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 _TopoDS_Builder_HeaderFile 18 #define _TopoDS_Builder_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 class Standard_NullObject; 25 class TopoDS_FrozenShape; 26 class TopoDS_UnCompatibleShapes; 27 class TopoDS_Shape; 28 class TopoDS_TShape; 29 class TopoDS_Wire; 30 class TopoDS_Shell; 31 class TopoDS_Solid; 32 class TopoDS_CompSolid; 33 class TopoDS_Compound; 34 35 36 //! A Builder is used to create Topological Data 37 //! Structures.It is the root of the Builder class hierarchy. 38 //! 39 //! There are three groups of methods in the Builder : 40 //! 41 //! The Make methods create Shapes. 42 //! 43 //! The Add method includes a Shape in another Shape. 44 //! 45 //! The Remove method removes a Shape from an other 46 //! Shape. 47 //! 48 //! The methods in Builder are not static. They can be 49 //! redefined in inherited builders. 50 //! 51 //! This Builder does not provide methods to Make 52 //! Vertices, Edges, Faces, Shells or Solids. These 53 //! methods are provided in the inherited Builders 54 //! as they must provide the geometry. 55 //! 56 //! The Add method check for the following rules : 57 //! 58 //! - Any SHAPE can be added in a COMPOUND. 59 //! 60 //! - Only SOLID can be added in a COMPSOLID. 61 //! 62 //! - Only SHELL, EDGE and VERTEX can be added in a SOLID. 63 //! EDGE and VERTEX as to be INTERNAL or EXTERNAL. 64 //! 65 //! - Only FACE can be added in a SHELL. 66 //! 67 //! - Only WIRE and VERTEX can be added in a FACE. 68 //! VERTEX as to be INTERNAL or EXTERNAL. 69 //! 70 //! - Only EDGE can be added in a WIRE. 71 //! 72 //! - Only VERTEX can be added in an EDGE. 73 //! 74 //! - Nothing can be added in a VERTEX. 75 class TopoDS_Builder 76 { 77 public: 78 79 DEFINE_STANDARD_ALLOC 80 81 82 //! Make an empty Wire. 83 void MakeWire (TopoDS_Wire& W) const; 84 85 //! Make an empty Shell. 86 void MakeShell (TopoDS_Shell& S) const; 87 88 //! Make a Solid covering the whole 3D space. 89 void MakeSolid (TopoDS_Solid& S) const; 90 91 //! Make an empty Composite Solid. 92 void MakeCompSolid (TopoDS_CompSolid& C) const; 93 94 //! Make an empty Compound. 95 void MakeCompound (TopoDS_Compound& C) const; 96 97 //! Add the Shape C in the Shape S. 98 //! Exceptions 99 //! - TopoDS_FrozenShape if S is not free and cannot be modified. 100 //! - TopoDS__UnCompatibleShapes if S and C are not compatible. 101 Standard_EXPORT void Add (TopoDS_Shape& S, const TopoDS_Shape& C) const; 102 103 //! Remove the Shape C from the Shape S. 104 //! Exceptions 105 //! TopoDS_FrozenShape if S is frozen and cannot be modified. 106 Standard_EXPORT void Remove (TopoDS_Shape& S, const TopoDS_Shape& C) const; 107 108 109 110 111 protected: 112 113 114 //! The basic method to make a Shape, used by all the 115 //! Make methods. 116 Standard_EXPORT void MakeShape (TopoDS_Shape& S, const Handle(TopoDS_TShape)& T) const; 117 118 119 120 121 private: 122 123 124 125 126 127 }; 128 129 130 #include <TopoDS_Builder.lxx> 131 132 133 134 135 136 #endif // _TopoDS_Builder_HeaderFile 137