Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-31 09:13:15

0001 // Created on: 1993-06-14
0002 // Created by: Jean Yves LEBEY
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TopOpeBRepBuild_HBuilder_HeaderFile
0018 #define _TopOpeBRepBuild_HBuilder_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopOpeBRepBuild_Builder1.hxx>
0024 #include <TopTools_DataMapOfShapeInteger.hxx>
0025 #include <TColStd_DataMapOfIntegerListOfInteger.hxx>
0026 #include <TopoDS_Shape.hxx>
0027 #include <TColStd_ListOfInteger.hxx>
0028 #include <Standard_Transient.hxx>
0029 #include <TopAbs_State.hxx>
0030 #include <TopTools_ListOfShape.hxx>
0031 #include <Standard_Integer.hxx>
0032 class TopOpeBRepDS_BuildTool;
0033 class TopOpeBRepDS_HDataStructure;
0034 class TopOpeBRepBuild_Builder;
0035 
0036 class TopOpeBRepBuild_HBuilder;
0037 DEFINE_STANDARD_HANDLE(TopOpeBRepBuild_HBuilder, Standard_Transient)
0038 
0039 //! The HBuilder  algorithm    constructs   topological
0040 //! objects  from   an    existing  topology  and  new
0041 //! geometries attached to the topology. It is used to
0042 //! construct the result of a topological operation;
0043 //! the existing  topologies are the parts involved in
0044 //! the  topological  operation and the new geometries
0045 //! are the intersection lines and points.
0046 class TopOpeBRepBuild_HBuilder : public Standard_Transient
0047 {
0048 
0049 public:
0050   Standard_EXPORT TopOpeBRepBuild_HBuilder(const TopOpeBRepDS_BuildTool& BT);
0051 
0052   Standard_EXPORT const TopOpeBRepDS_BuildTool& BuildTool() const;
0053 
0054   //! Stores the data structure <HDS>,
0055   //! Create shapes from the new geometries described in <HDS>.
0056   Standard_EXPORT void Perform(const Handle(TopOpeBRepDS_HDataStructure)& HDS);
0057 
0058   //! Same as previous + evaluates if an operation performed on shapes S1,S2
0059   //! is a particular case.
0060   Standard_EXPORT void Perform(const Handle(TopOpeBRepDS_HDataStructure)& HDS,
0061                                const TopoDS_Shape&                        S1,
0062                                const TopoDS_Shape&                        S2);
0063 
0064   //! Removes all split and merge already performed.
0065   //! Does NOT clear the handled DS.
0066   Standard_EXPORT void Clear();
0067 
0068   //! returns the DS handled by this builder
0069   Standard_EXPORT Handle(TopOpeBRepDS_HDataStructure) DataStructure() const;
0070 
0071   Standard_EXPORT TopOpeBRepDS_BuildTool& ChangeBuildTool();
0072 
0073   //! Merges the two shapes <S1> and <S2> keeping the
0074   //! parts of states <TB1>,<TB2> in <S1>,<S2>.
0075   Standard_EXPORT void MergeShapes(const TopoDS_Shape& S1,
0076                                    const TopAbs_State  TB1,
0077                                    const TopoDS_Shape& S2,
0078                                    const TopAbs_State  TB2);
0079 
0080   //! Merges  the two solids <S1>   and <S2> keeping the
0081   //! parts in each solid of states <TB1> and <TB2>.
0082   Standard_EXPORT void MergeSolids(const TopoDS_Shape& S1,
0083                                    const TopAbs_State  TB1,
0084                                    const TopoDS_Shape& S2,
0085                                    const TopAbs_State  TB2);
0086 
0087   //! Merges the solid <S>  keeping the
0088   //! parts of state <TB>.
0089   Standard_EXPORT void MergeSolid(const TopoDS_Shape& S, const TopAbs_State TB);
0090 
0091   //! Returns True if the shape <S> has been split.
0092   Standard_EXPORT Standard_Boolean IsSplit(const TopoDS_Shape& S, const TopAbs_State ToBuild) const;
0093 
0094   //! Returns the split parts <ToBuild> of shape <S>.
0095   Standard_EXPORT const TopTools_ListOfShape& Splits(const TopoDS_Shape& S,
0096                                                      const TopAbs_State  ToBuild) const;
0097 
0098   //! Returns True if the shape <S> has been merged.
0099   Standard_EXPORT Standard_Boolean IsMerged(const TopoDS_Shape& S,
0100                                             const TopAbs_State  ToBuild) const;
0101 
0102   //! Returns the merged parts <ToBuild> of shape <S>.
0103   Standard_EXPORT const TopTools_ListOfShape& Merged(const TopoDS_Shape& S,
0104                                                      const TopAbs_State  ToBuild) const;
0105 
0106   //! Returns the vertex created on point <I>.
0107   Standard_EXPORT const TopoDS_Shape& NewVertex(const Standard_Integer I) const;
0108 
0109   //! Returns the edges created on curve <I>.
0110   Standard_EXPORT const TopTools_ListOfShape& NewEdges(const Standard_Integer I) const;
0111 
0112   //! Returns the edges created on curve <I>.
0113   Standard_EXPORT TopTools_ListOfShape& ChangeNewEdges(const Standard_Integer I);
0114 
0115   //! Returns the faces created on surface <I>.
0116   Standard_EXPORT const TopTools_ListOfShape& NewFaces(const Standard_Integer I) const;
0117 
0118   Standard_EXPORT const TopTools_ListOfShape& Section();
0119 
0120   Standard_EXPORT void InitExtendedSectionDS(const Standard_Integer k = 3);
0121 
0122   Standard_EXPORT void InitSection(const Standard_Integer k = 3);
0123 
0124   Standard_EXPORT Standard_Boolean MoreSection() const;
0125 
0126   Standard_EXPORT void NextSection();
0127 
0128   Standard_EXPORT const TopoDS_Shape& CurrentSection() const;
0129 
0130   Standard_EXPORT Standard_Integer GetDSEdgeFromSectEdge(const TopoDS_Shape&    E,
0131                                                          const Standard_Integer rank);
0132 
0133   Standard_EXPORT TColStd_ListOfInteger& GetDSFaceFromDSEdge(const Standard_Integer indexEdg,
0134                                                              const Standard_Integer rank);
0135 
0136   Standard_EXPORT Standard_Integer GetDSCurveFromSectEdge(const TopoDS_Shape& SectEdge);
0137 
0138   Standard_EXPORT Standard_Integer GetDSFaceFromDSCurve(const Standard_Integer indexCur,
0139                                                         const Standard_Integer rank);
0140 
0141   Standard_EXPORT Standard_Integer GetDSPointFromNewVertex(const TopoDS_Shape& NewVert);
0142 
0143   //! search for the couple of face F1,F2
0144   //! (from arguments of supra Perform(S1,S2,HDS)) method which
0145   //! intersection gives section edge E built on an intersection curve.
0146   //! returns True if F1,F2 have been valued.
0147   //! returns False if E is not a section edge built
0148   //! on intersection curve IC.
0149   Standard_EXPORT Standard_Boolean EdgeCurveAncestors(const TopoDS_Shape& E,
0150                                                       TopoDS_Shape&       F1,
0151                                                       TopoDS_Shape&       F2,
0152                                                       Standard_Integer&   IC);
0153 
0154   //! search for the couple of face F1,F2
0155   //! (from arguments of supra Perform(S1,S2,HDS)) method which
0156   //! intersection gives section edge E built on at least one edge .
0157   //! returns True if F1,F2 have been valued.
0158   //! returns False if E is not a section edge built
0159   //! on at least one edge of S1 and/or S2.
0160   //! LE1,LE2 are edges of S1,S2 which common part is edge E.
0161   //! LE1 or LE2 may be empty() but not both.
0162   Standard_EXPORT Standard_Boolean EdgeSectionAncestors(const TopoDS_Shape&   E,
0163                                                         TopTools_ListOfShape& LF1,
0164                                                         TopTools_ListOfShape& LF2,
0165                                                         TopTools_ListOfShape& LE1,
0166                                                         TopTools_ListOfShape& LE2);
0167 
0168   //! Returns 0 is standard operation, != 0 if particular case
0169   Standard_EXPORT Standard_Integer IsKPart();
0170 
0171   Standard_EXPORT void MergeKPart(const TopAbs_State TB1, const TopAbs_State TB2);
0172 
0173   Standard_EXPORT TopOpeBRepBuild_Builder& ChangeBuilder();
0174 
0175   DEFINE_STANDARD_RTTIEXT(TopOpeBRepBuild_HBuilder, Standard_Transient)
0176 
0177 protected:
0178   TopOpeBRepBuild_Builder1 myBuilder;
0179 
0180 private:
0181   Standard_EXPORT void MakeEdgeAncestorMap();
0182 
0183   Standard_EXPORT void MakeCurveAncestorMap();
0184 
0185   TopTools_DataMapOfShapeInteger        mySectEdgeDSEdges1;
0186   TopTools_DataMapOfShapeInteger        mySectEdgeDSEdges2;
0187   TColStd_DataMapOfIntegerListOfInteger myDSEdgesDSFaces1;
0188   TColStd_DataMapOfIntegerListOfInteger myDSEdgesDSFaces2;
0189   Standard_Boolean                      myMakeEdgeAncestorIsDone;
0190   TopTools_DataMapOfShapeInteger        mySectEdgeDSCurve;
0191   Standard_Boolean                      myMakeCurveAncestorIsDone;
0192   TopTools_DataMapOfShapeInteger        myNewVertexDSPoint;
0193   Standard_Boolean                      myMakePointAncestorIsDone;
0194   TopoDS_Shape                          myEmptyShape;
0195   TColStd_ListOfInteger                 myEmptyIntegerList;
0196 };
0197 
0198 #endif // _TopOpeBRepBuild_HBuilder_HeaderFile