Methods AddTool(), SetTools(), Tools() have been moved to BOPAlgo_ToolsProvider class;
BOPAlgo_BOP and BOPAlgo_Splitter are now successors of BOPAlgo_ToolsProvider
//purpose :
//=======================================================================
BOPAlgo_BOP::BOPAlgo_BOP()
-:
- BOPAlgo_Builder(),
- myTools(myAllocator),
- myMapTools(100, myAllocator)
+: BOPAlgo_ToolsProvider()
{
Clear();
}
//function :
//purpose :
//=======================================================================
-BOPAlgo_BOP::BOPAlgo_BOP
- (const Handle(NCollection_BaseAllocator)& theAllocator)
-:
- BOPAlgo_Builder(theAllocator),
- myTools(myAllocator),
- myMapTools(100, myAllocator)
+BOPAlgo_BOP::BOPAlgo_BOP(const Handle(NCollection_BaseAllocator)& theAllocator)
+: BOPAlgo_ToolsProvider(theAllocator)
{
Clear();
}
void BOPAlgo_BOP::Clear()
{
myOperation=BOPAlgo_UNKNOWN;
- myTools.Clear();
- myMapTools.Clear();
myDims[0]=-1;
myDims[1]=-1;
- //
- BOPAlgo_Builder::Clear();
+
+ BOPAlgo_ToolsProvider::Clear();
}
//=======================================================================
//function : SetOperation
return myOperation;
}
//=======================================================================
-//function : AddTool
-//purpose :
-//=======================================================================
-void BOPAlgo_BOP::AddTool(const TopoDS_Shape& theShape)
-{
- if (myMapTools.Add(theShape)) {
- myTools.Append(theShape);
- }
-}
-//=======================================================================
-//function : SetTools
-//purpose :
-//=======================================================================
-void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
-{
- BOPCol_ListIteratorOfListOfShape aIt;
- //
- myTools.Clear();
- aIt.Initialize(theShapes);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aS = aIt.Value();
- AddTool(aS);
- }
-}
-//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
#include <TopoDS_Shape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPCol_MapOfShape.hxx>
-#include <BOPAlgo_Builder.hxx>
+#include <BOPAlgo_ToolsProvider.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Boolean.hxx>
//! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
//! produce the Fused solid.
//!
-class BOPAlgo_BOP : public BOPAlgo_Builder
+class BOPAlgo_BOP : public BOPAlgo_ToolsProvider
{
public:
//! Empty constructor
Standard_EXPORT BOPAlgo_BOP();
-Standard_EXPORT virtual ~BOPAlgo_BOP();
+ Standard_EXPORT virtual ~BOPAlgo_BOP();
Standard_EXPORT BOPAlgo_BOP(const BOPCol_BaseAllocator& theAllocator);
//! Clears internal fields and arguments
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
- //! Adds Tool argument of the operation
- Standard_EXPORT virtual void AddTool (const TopoDS_Shape& theShape);
-
- Standard_EXPORT virtual void SetTools (const BOPCol_ListOfShape& theShapes);
-
Standard_EXPORT void SetOperation (const BOPAlgo_Operation theOperation);
Standard_EXPORT BOPAlgo_Operation Operation() const;
//! all shapes in one of the groups are empty shapes.
Standard_EXPORT Standard_Boolean TreatEmptyShape();
+protected:
BOPAlgo_Operation myOperation;
- Standard_Integer myDims[2];
- TopoDS_Shape myRC;
- BOPCol_ListOfShape myTools;
- BOPCol_MapOfShape myMapTools;
-
-
-private:
-
+ Standard_Integer myDims[2];
+ TopoDS_Shape myRC;
};
#endif // _BOPAlgo_BOP_HeaderFile
//purpose :
//=======================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter()
-:
- BOPAlgo_Builder(),
- myTools(myAllocator),
- myMapTools(100, myAllocator)
+: BOPAlgo_ToolsProvider()
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
-BOPAlgo_Splitter::BOPAlgo_Splitter
- (const Handle(NCollection_BaseAllocator)& theAllocator)
-:
- BOPAlgo_Builder(theAllocator),
- myTools(myAllocator),
- myMapTools(100, myAllocator)
+BOPAlgo_Splitter::BOPAlgo_Splitter(const Handle(NCollection_BaseAllocator)& theAllocator)
+: BOPAlgo_ToolsProvider(theAllocator)
{
}
//=======================================================================
BOPAlgo_Splitter::~BOPAlgo_Splitter()
{
}
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-void BOPAlgo_Splitter::Clear()
-{
- BOPAlgo_Builder::Clear();
- myTools.Clear();
- myMapTools.Clear();
-}
-//=======================================================================
-//function : AddTool
-//purpose :
-//=======================================================================
-void BOPAlgo_Splitter::AddTool(const TopoDS_Shape& theShape)
-{
- if (myMapTools.Add(theShape)) {
- myTools.Append(theShape);
- }
-}
-//=======================================================================
-//function : SetTools
-//purpose :
-//=======================================================================
-void BOPAlgo_Splitter::SetTools(const BOPCol_ListOfShape& theShapes)
-{
- myTools.Clear();
- BOPCol_ListIteratorOfListOfShape aIt(theShapes);
- for (; aIt.More(); aIt.Next()) {
- AddTool(aIt.Value());
- }
-}
-
//=======================================================================
// function: CheckData
// purpose:
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <BOPAlgo_Builder.hxx>
+#include <BOPAlgo_ToolsProvider.hxx>
//! The **Splitter algorithm** is the algorithm for splitting a group of
//! arbitrary shapes by the other group of arbitrary shapes.<br>
//! into result, does not have to be overridden, because its native implementation
//! performs the necessary actions for the Splitter algorithm - it adds
//! the split parts of only Objects into result, avoiding the split parts of Tools.
-class BOPAlgo_Splitter : public BOPAlgo_Builder
+class BOPAlgo_Splitter : public BOPAlgo_ToolsProvider
{
public:
Standard_EXPORT BOPAlgo_Splitter(const BOPCol_BaseAllocator& theAllocator);
- //! Clears internal fields and arguments
- Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
-
- //! Adds Tool argument of the operation
- Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape);
-
- //! Adds the Tool arguments of the operation
- Standard_EXPORT virtual void SetTools(const BOPCol_ListOfShape& theShapes);
-
- //! Returns the Tool arguments of the operation
- const BOPCol_ListOfShape& Tools() const
- {
- return myTools;
- }
-
//! Performs the operation
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
-
protected:
//! Checks the input data
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
-
- BOPCol_ListOfShape myTools;
- BOPCol_MapOfShape myMapTools;
-
-private:
-
};
#endif // _BOPAlgo_Splitter_HeaderFile
--- /dev/null
+// Created by: Oleg AGASHIN
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <BOPAlgo_ToolsProvider.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+#include <BOPAlgo_Alerts.hxx>
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider()
+:
+ BOPAlgo_Builder(),
+ myTools(myAllocator),
+ myMapTools(100, myAllocator)
+{
+}
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//=======================================================================
+BOPAlgo_ToolsProvider::BOPAlgo_ToolsProvider
+ (const Handle(NCollection_BaseAllocator)& theAllocator)
+:
+ BOPAlgo_Builder(theAllocator),
+ myTools(myAllocator),
+ myMapTools(100, myAllocator)
+{
+}
+
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void BOPAlgo_ToolsProvider::Clear()
+{
+ BOPAlgo_Builder::Clear();
+ myTools.Clear();
+ myMapTools.Clear();
+}
+
+//=======================================================================
+//function : AddTool
+//purpose :
+//=======================================================================
+void BOPAlgo_ToolsProvider::AddTool(const TopoDS_Shape& theShape)
+{
+ if (myMapTools.Add(theShape))
+ myTools.Append(theShape);
+}
+
+//=======================================================================
+//function : SetTools
+//purpose :
+//=======================================================================
+void BOPAlgo_ToolsProvider::SetTools(const BOPCol_ListOfShape& theShapes)
+{
+ myTools.Clear();
+ BOPCol_ListIteratorOfListOfShape aIt(theShapes);
+ for (; aIt.More(); aIt.Next())
+ AddTool(aIt.Value());
+}
--- /dev/null
+// Created by: Oleg AGASHIN
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _BOPAlgo_ToolsProvider_HeaderFile
+#define _BOPAlgo_ToolsProvider_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Handle.hxx>
+
+#include <BOPAlgo_Builder.hxx>
+
+//! Auxiliary class providing API to operate tool arguments.
+class BOPAlgo_ToolsProvider : public BOPAlgo_Builder
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ //! Empty constructor
+ Standard_EXPORT BOPAlgo_ToolsProvider();
+
+ Standard_EXPORT BOPAlgo_ToolsProvider(const BOPCol_BaseAllocator& theAllocator);
+
+ //! Clears internal fields and arguments
+ Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
+
+ //! Adds Tool argument of the operation
+ Standard_EXPORT virtual void AddTool(const TopoDS_Shape& theShape);
+
+ //! Adds the Tool arguments of the operation
+ Standard_EXPORT virtual void SetTools(const BOPCol_ListOfShape& theShapes);
+
+ //! Returns the Tool arguments of the operation
+ const BOPCol_ListOfShape& Tools() const
+ {
+ return myTools;
+ }
+
+protected:
+
+ BOPCol_ListOfShape myTools;
+ BOPCol_MapOfShape myMapTools;
+};
+
+#endif // _BOPAlgo_ToolsProvider_HeaderFile
BOPAlgo_ArgumentAnalyzer.cxx
BOPAlgo_ArgumentAnalyzer.hxx
BOPAlgo_ArgumentAnalyzer.lxx
+BOPAlgo_ToolsProvider.cxx
+BOPAlgo_ToolsProvider.hxx
BOPAlgo_BOP.cxx
BOPAlgo_BOP.hxx
BOPAlgo_Builder.cxx