SHAPER  9.12.0
FeaturesPlugin_VersionedBoolean.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef FeaturesPlugin_VersionedBoolean_H_
21 #define FeaturesPlugin_VersionedBoolean_H_
22 
23 #include "FeaturesPlugin.h"
24 #include "FeaturesPlugin_Tools.h"
25 
26 #include <GeomAPI_ShapeHierarchy.h>
27 #include <GeomAlgoAPI_Tools.h>
28 
29 #include <ModelAPI_Feature.h>
30 #include <ModelAPI_Tools.h>
31 
32 class ModelAPI_Attribute;
33 class ModelAPI_Result;
35 
40 {
41 protected:
42  static const std::string& BOP_VERSION_9_4()
43  {
44  static const std::string VERSION("v9.4");
45  return VERSION;
46  }
47 
50 
54  void initVersion(const std::string& theVersion,
55  const std::shared_ptr<ModelAPI_Attribute> theObjectsAttr
56  = std::shared_ptr<ModelAPI_Attribute>(),
57  const std::shared_ptr<ModelAPI_Attribute> theToolsAttr
58  = std::shared_ptr<ModelAPI_Attribute>());
59 
61  bool processAttribute(const std::string& theAttributeName,
62  GeomAPI_ShapeHierarchy& theObjects,
63  ListOfShape& thePlanesList);
64 
69  bool processObject(const GeomAlgoAPI_Tools::BOPType theBooleanType,
70  const GeomShapePtr& theObject,
71  const ListOfShape& theTools,
72  const ListOfShape& thePlanes,
73  const double theFuzzy,
74  int& theResultIndex,
75  std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
76  ListOfShape& theResultShapesList,
77  GeomShapePtr theResulCompound = GeomShapePtr());
78 
83  bool processCompsolid(const GeomAlgoAPI_Tools::BOPType theBooleanType,
84  GeomAPI_ShapeHierarchy& theCompsolidHierarchy,
85  const GeomShapePtr& theCompsolid,
86  const ListOfShape& theTools,
87  const ListOfShape& thePlanes,
88  const double theFuzzy,
89  int& theResultIndex,
90  std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
91  ListOfShape& theResultShapesList,
92  GeomShapePtr theResulCompound = GeomShapePtr());
93 
98  bool processCompound(const GeomAlgoAPI_Tools::BOPType theBooleanType,
99  GeomAPI_ShapeHierarchy& theCompoundHierarchy,
100  const GeomShapePtr& theCompound,
101  const ListOfShape& theTools,
102  const double theFuzzy,
103  int& theResultIndex,
104  std::vector<ModelAPI_Tools::ResultBaseAlgo>& theResultBaseAlgoList,
105  ListOfShape& theResultShapesList,
106  GeomShapePtr theResulCompound = GeomShapePtr());
107 
109  static void resizePlanes(const ListOfShape& theObjects,
110  ListOfShape& thePlanes,
111  std::shared_ptr<GeomAlgoAPI_MakeShapeList>& theMakeShapeList);
112 
116  GeomShapePtr keepUnusedSubsOfCompound(
117  const GeomShapePtr& theResult,
118  const GeomAPI_ShapeHierarchy& theObjectsHierarchy,
119  const GeomAPI_ShapeHierarchy& theToolsHierarchy,
120  std::shared_ptr<GeomAlgoAPI_MakeShapeList> theMakeShapeList);
121 };
122 
123 #endif
Feature controls a version of Boolean operations.
Definition: FeaturesPlugin_VersionedBoolean.h:40
GeomShapePtr keepUnusedSubsOfCompound(const GeomShapePtr &theResult, const GeomAPI_ShapeHierarchy &theObjectsHierarchy, const GeomAPI_ShapeHierarchy &theToolsHierarchy, std::shared_ptr< GeomAlgoAPI_MakeShapeList > theMakeShapeList)
Process unused sub-shapes of compounds.
Definition: FeaturesPlugin_VersionedBoolean.cpp:402
bool processAttribute(const std::string &theAttributeName, GeomAPI_ShapeHierarchy &theObjects, ListOfShape &thePlanesList)
Process SelectionList attribute and fill the objects hierarchy.
Definition: FeaturesPlugin_VersionedBoolean.cpp:95
bool processObject(const GeomAlgoAPI_Tools::BOPType theBooleanType, const GeomShapePtr &theObject, const ListOfShape &theTools, const ListOfShape &thePlanes, const double theFuzzy, int &theResultIndex, std::vector< ModelAPI_Tools::ResultBaseAlgo > &theResultBaseAlgoList, ListOfShape &theResultShapesList, GeomShapePtr theResulCompound=GeomShapePtr())
Perform Boolean operation of the object with the tools.
Definition: FeaturesPlugin_VersionedBoolean.cpp:123
static void resizePlanes(const ListOfShape &theObjects, ListOfShape &thePlanes, std::shared_ptr< GeomAlgoAPI_MakeShapeList > &theMakeShapeList)
Resize planes to fit them to the bounding box of the given lins of objects.
Definition: FeaturesPlugin_VersionedBoolean.cpp:425
bool processCompound(const GeomAlgoAPI_Tools::BOPType theBooleanType, GeomAPI_ShapeHierarchy &theCompoundHierarchy, const GeomShapePtr &theCompound, const ListOfShape &theTools, const double theFuzzy, int &theResultIndex, std::vector< ModelAPI_Tools::ResultBaseAlgo > &theResultBaseAlgoList, ListOfShape &theResultShapesList, GeomShapePtr theResulCompound=GeomShapePtr())
Perform Boolean operation of the Compound with the tools In case of theResultCompound is not empty,...
Definition: FeaturesPlugin_VersionedBoolean.cpp:312
void initVersion(const std::string &theVersion, const std::shared_ptr< ModelAPI_Attribute > theObjectsAttr=std::shared_ptr< ModelAPI_Attribute >(), const std::shared_ptr< ModelAPI_Attribute > theToolsAttr=std::shared_ptr< ModelAPI_Attribute >())
Initialize version field of the Boolean feature.
Definition: FeaturesPlugin_VersionedBoolean.cpp:77
FeaturesPlugin_VersionedBoolean()
Use plugin manager for features creation.
Definition: FeaturesPlugin_VersionedBoolean.h:49
bool processCompsolid(const GeomAlgoAPI_Tools::BOPType theBooleanType, GeomAPI_ShapeHierarchy &theCompsolidHierarchy, const GeomShapePtr &theCompsolid, const ListOfShape &theTools, const ListOfShape &thePlanes, const double theFuzzy, int &theResultIndex, std::vector< ModelAPI_Tools::ResultBaseAlgo > &theResultBaseAlgoList, ListOfShape &theResultShapesList, GeomShapePtr theResulCompound=GeomShapePtr())
Perform Boolean operation of the Compsolid with the tools In case of theResultCompound is not empty,...
Definition: FeaturesPlugin_VersionedBoolean.cpp:216
Storage for the hierarchy of shapes and their parents (compounds or compsolids)
Definition: GeomAPI_ShapeHierarchy.h:34
List of topological shapes constructions.
Definition: GeomAlgoAPI_MakeShapeList.h:33
Generic attribute of the Object.
Definition: ModelAPI_Attribute.h:34
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
The result of a feature.
Definition: ModelAPI_Result.h:35