#include <memory>
#include <GeomAPI_Interface.h>
-class GeomAPI_Pnt;
-class GeomAPI_Dir;
+#include <GeomAPI_Shape.h>
/**\class GeomAPI_DataMapOfShapeShape
* \ingroup DataModel
class GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface
{
public:
- /// Creation of plane by the point and normal
- GEOMAPI_EXPORT
+ /// Constructor.
+ GEOMAPI_EXPORT
GeomAPI_DataMapOfShapeShape();
- /// Clear
- GEOMAPI_EXPORT
+ /// Clears map.
+ GEOMAPI_EXPORT
void clear();
- /// Size of the map
- GEOMAPI_EXPORT
+ /// Size of the map.
+ GEOMAPI_EXPORT
int size();
- /// Adds \a theKey to me with \a theItem. Returns True if the Key was not already in the map
- GEOMAPI_EXPORT
- bool bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem);
+ /// Adds \a theKey to me with \a theItem. Returns True if the Key was not already in the map.
+ GEOMAPI_EXPORT
+ bool bind (const std::shared_ptr<GeomAPI_Shape> theKey, const std::shared_ptr<GeomAPI_Shape> theItem);
- /// Merges two maps
+ /// Merges two maps.
GEOMAPI_EXPORT void merge(const GeomAPI_DataMapOfShapeShape& theDataMap);
- /// Merges two maps
+ /// Merges two maps.
GEOMAPI_EXPORT void merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap);
- /// Returns true if theKey is stored in the map.
- GEOMAPI_EXPORT
- bool isBound (std::shared_ptr<GeomAPI_Shape> theKey);
+ /// \return true if theKey is stored in the map.
+ GEOMAPI_EXPORT
+ bool isBound (const std::shared_ptr<GeomAPI_Shape> theKey);
- /// Returns the Item stored with the Key in the Map.
- GEOMAPI_EXPORT
- const std::shared_ptr<GeomAPI_Shape> find(std::shared_ptr<GeomAPI_Shape> theKey);
-
- /// Removes the Key from the map. Returns true if the Key was in the Map
- GEOMAPI_EXPORT
- bool unBind(std::shared_ptr<GeomAPI_Shape> theKey);
+ /// \return the Item stored with the Key in the Map.
+ GEOMAPI_EXPORT
+ const std::shared_ptr<GeomAPI_Shape> find(const std::shared_ptr<GeomAPI_Shape> theKey);
+
+ /// \brief Removes the Key from the map.
+ /// \return true if the Key was in the Map.
+ GEOMAPI_EXPORT
+ bool unBind(const std::shared_ptr<GeomAPI_Shape> theKey);
/// Destructor
- GEOMAPI_EXPORT
+ GEOMAPI_EXPORT
~GeomAPI_DataMapOfShapeShape();
};
GeomAlgoAPI_MakeShape.h
GeomAlgoAPI_MakeShapeCustom.h
GeomAlgoAPI_MakeShapeList.h
+ GeomAlgoAPI_MakeSweep.h
GeomAlgoAPI_DFLoader.h
GeomAlgoAPI_Placement.h
GeomAlgoAPI_BREPImport.h
GeomAlgoAPI_MakeShape.cpp
GeomAlgoAPI_MakeShapeCustom.cpp
GeomAlgoAPI_MakeShapeList.cpp
+ GeomAlgoAPI_MakeSweep.cpp
GeomAlgoAPI_DFLoader.cpp
GeomAlgoAPI_Placement.cpp
GeomAlgoAPI_BREPImport.cpp
#include "GeomAlgoAPI_MakeShape.h"
#include "GeomAlgoAPI_MakeShapeCustom.h"
#include "GeomAlgoAPI_MakeShapeList.h"
+ #include "GeomAlgoAPI_MakeSweep.h"
#include "GeomAlgoAPI_Translation.h"
#include "GeomAlgoAPI_Placement.h"
#include "GeomAlgoAPI_PointBuilder.h"
%include "GeomAlgoAPI_MakeShape.h"
%include "GeomAlgoAPI_MakeShapeCustom.h"
%include "GeomAlgoAPI_MakeShapeList.h"
+%include "GeomAlgoAPI_MakeSweep.h"
%include "GeomAlgoAPI_Translation.h"
%include "GeomAlgoAPI_Placement.h"
%include "GeomAlgoAPI_PointBuilder.h"
#include <TopTools_ListIteratorOfListOfShape.hxx>
//=================================================================================================
-GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape(void* theMkShape, const AlgoType theAlgoType)
+GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape(void* theMkShape, const BuilderType theBuilderType)
: GeomAPI_Interface(theMkShape),
- myAlgoType(theAlgoType),
+ myBuilderType(theBuilderType),
myShape(new GeomAPI_Shape())
{
- switch (myAlgoType) {
- case MakeShape: {
+ switch (myBuilderType) {
+ case OCCT_BRepBuilderAPI_MakeShape: {
+ myDone = implPtr<BRepBuilderAPI_MakeShape>()->IsDone() == Standard_True;
myShape->setImpl(new TopoDS_Shape(implPtr<BRepBuilderAPI_MakeShape>()->Shape()));
break;
}
- case BOPAlgoBuilder: {
+ case OCCT_BOPAlgo_Builder: {
+ myDone = true;
myShape->setImpl(new TopoDS_Shape(implPtr<BOPAlgo_Builder>()->Shape()));
break;
}
}
}
+//=================================================================================================
+bool GeomAlgoAPI_MakeShape::isDone() const
+{
+ return myDone;
+}
+
//=================================================================================================
const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
{
ListOfShape& theHistory)
{
TopTools_ListOfShape aList;
- if(myAlgoType == MakeShape) {
+ if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
aList = aMakeShape->Generated(theShape->impl<TopoDS_Shape>());
- } else if(myAlgoType == BOPAlgoBuilder) {
+ } else if(myBuilderType == OCCT_BOPAlgo_Builder) {
BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
aList = aBOPBuilder->Generated(theShape->impl<TopoDS_Shape>());
}
ListOfShape& theHistory)
{
TopTools_ListOfShape aList;
- if(myAlgoType == MakeShape) {
+ if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
aList = aMakeShape->Modified(theShape->impl<TopoDS_Shape>());
- } else if(myAlgoType == BOPAlgoBuilder) {
+ } else if(myBuilderType == OCCT_BOPAlgo_Builder) {
BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
aList = aBOPBuilder->Modified(theShape->impl<TopoDS_Shape>());
}
bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
{
bool isDeleted = false;
- if(myAlgoType == MakeShape) {
+ if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
isDeleted = aMakeShape->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
- } else if(myAlgoType == BOPAlgoBuilder) {
+ } else if(myBuilderType == OCCT_BOPAlgo_Builder) {
BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
isDeleted = aBOPBuilder->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
}
return isDeleted;
}
+
+
+//=================================================================================================
+GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape()
+: myBuilderType(OCCT_BRepBuilderAPI_MakeShape),
+ myDone(false),
+ myShape(new GeomAPI_Shape())
+{
+}
+
+//=================================================================================================
+void GeomAlgoAPI_MakeShape::setBuilderType(const BuilderType theBuilderType)
+{
+ myBuilderType = theBuilderType;
+}
+
+//=================================================================================================
+void GeomAlgoAPI_MakeShape::setDone(const bool theFlag)
+{
+ myDone = theFlag;
+}
+
+//=================================================================================================
+void GeomAlgoAPI_MakeShape::setShape(const std::shared_ptr<GeomAPI_Shape> theShape)
+{
+ myShape = theShape;
+}
#ifndef GeomAlgoAPI_MakeShape_H_
#define GeomAlgoAPI_MakeShape_H_
-#include <GeomAPI_Shape.h>
#include <GeomAlgoAPI.h>
+#include <GeomAPI_DataMapOfShapeShape.h>
#include <list>
#include <memory>
-/**\class GeomAlgoAPI_MakeShape
- * \ingroup DataAlgo
- * \brief Interface to the root class of all topological shapes constructions
+/** \class GeomAlgoAPI_MakeShape
+ * \ingroup DataAlgo
+ * \brief Interface to the root class of all topological shapes constructions
*/
class GeomAlgoAPI_MakeShape : public GeomAPI_Interface
{
public:
- /// Algo type enum
- enum AlgoType {
- MakeShape,
- BOPAlgoBuilder
+ /// Builder type enum
+ enum BuilderType {
+ OCCT_BRepBuilderAPI_MakeShape,
+ OCCT_BOPAlgo_Builder
};
public:
- /// Constructor by the already stored builder in the interface
- GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder, const AlgoType theAlgoType = MakeShape);
+ /** \brief Constructor by builder and builder type.
+ * \param[in] theBuilder pointer to the builder.
+ * \param[in] theBuilderType builder type.
+ */
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder, const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape);
- /// Returns a shape built by the shape construction algorithm
+ /// \return status of builder.
+ GEOMALGOAPI_EXPORT bool isDone() const;
+
+ /// \return a shape built by the shape construction algorithm.
GEOMALGOAPI_EXPORT virtual const std::shared_ptr<GeomAPI_Shape> shape() const;
- /// Returns the list of shapes generated from the shape \a theShape
- GEOMALGOAPI_EXPORT virtual void generated(
- const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
+ /** \return the list of shapes generated from the shape \a theShape.
+ * \param[in] theShape base shape.
+ * \param[out] theHistory generated shapes.
+ */
+ GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
+ ListOfShape& theHistory);
- /// Returns the list of shapes modified from the shape \a theShape
- GEOMALGOAPI_EXPORT virtual void modified(
- const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
+ /** \return the list of shapes modified from the shape \a theShape.
+ * \param[in] theShape base shape.
+ * \param[out] theHistory modified shapes.
+ */
+ GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
+ ListOfShape& theHistory);
- /// Returns whether the shape is deleted
+ /** \return true if theShape was deleted.
+ * \param[in] theShape base shape.
+ */
GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
protected:
- GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(){};
+ /// \brief Default constructor.
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape();
-protected:
- GeomAlgoAPI_MakeShape::AlgoType myAlgoType; ///< Type of make shape algo.
+ /** \brief Sets builder type.
+ * \param[in] theBuilderType new builder type.
+ */
+ GEOMALGOAPI_EXPORT void setBuilderType(const BuilderType theBuilderType);
+
+ /** \brief Sets status of builder.
+ * \param[in] theFlag new status.
+ */
+ GEOMALGOAPI_EXPORT void setDone(const bool theFlag);
+
+ /** \brief Sets result shape.
+ * \param[in] theShape new shape.
+ */
+ GEOMALGOAPI_EXPORT void setShape(const std::shared_ptr<GeomAPI_Shape> theShape);
+
+private:
+ GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder.
+ bool myDone; ///< Builder status.
std::shared_ptr<GeomAPI_Shape> myShape; ///< Resulting shape.
- std::shared_ptr<GeomAPI_Shape> myWire; ///< Wire for pipe algo.
- std::shared_ptr<GeomAPI_Shape> myBaseShape; ///< Base shape of algo.
+ std::shared_ptr<GeomAPI_DataMapOfShapeShape> myMap; ///< Data map to keep correct orientation of sub-shapes.
};
typedef std::list<std::shared_ptr<GeomAlgoAPI_MakeShape> > ListOfMakeShape;
//=================================================================================================
GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom()
-: GeomAlgoAPI_MakeShape()
{}
//=================================================================================================
void GeomAlgoAPI_MakeShapeCustom::setResult(const std::shared_ptr<GeomAPI_Shape> theShape)
{
- myShape = theShape;
+ setShape(theShape);
}
//=================================================================================================
return myDeleted.bind(theShape, theShape);
}
-//=================================================================================================
-const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShapeCustom::shape() const
-{
- return myShape;
-}
-
//=================================================================================================
void GeomAlgoAPI_MakeShapeCustom::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
ListOfShape& theHistory)
/// Adds deleted shape.
GEOMALGOAPI_EXPORT bool addDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
- /// \return a shape built by the shape construction algorithms
- GEOMALGOAPI_EXPORT virtual const std::shared_ptr<GeomAPI_Shape> shape() const;
-
/// \return the list of shapes generated from the shape theShape
- GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
+ GEOMALGOAPI_EXPORT void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
ListOfShape& theHistory);
/// \return the list of shapes modified from the shape theShape
- GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
+ GEOMALGOAPI_EXPORT void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
ListOfShape& theHistory);
/// \return whether the shape is deleted
- GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+ GEOMALGOAPI_EXPORT bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
private:
- std::shared_ptr<GeomAPI_Shape> myShape;
GeomAPI_DataMapOfShapeMapOfShapes myGenerated;
GeomAPI_DataMapOfShapeMapOfShapes myModified;
GeomAPI_DataMapOfShapeShape myDeleted;
void GeomAlgoAPI_MakeShapeList::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
ListOfShape& theHistory)
{
- result(theShape, theHistory, GeomAlgoAPI_MakeShapeList::Generated);
+ result(theShape, GeomAlgoAPI_MakeShapeList::Generated, theHistory);
}
//=================================================================================================
void GeomAlgoAPI_MakeShapeList::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
ListOfShape& theHistory)
{
- result(theShape, theHistory, GeomAlgoAPI_MakeShapeList::Modified);
+ result(theShape, GeomAlgoAPI_MakeShapeList::Modified, theHistory);
}
bool GeomAlgoAPI_MakeShapeList::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
}
void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory,
- OperationType theOperationType)
+ OperationType theOperationType,
+ ListOfShape& theHistory)
{
if(myListOfMakeShape.empty()) {
return;
std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
ListOfShape aGeneratedShapes;
- const TopoDS_Shape& aSh = aShape->impl<TopoDS_Shape>();
aMakeShape->generated(aShape, aGeneratedShapes);
for(ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin(); anIt != aGeneratedShapes.cend(); anIt++) {
- TopoDS_Shape aSh = (*anIt)->impl<TopoDS_Shape>();
aTempShapes.Add((*anIt)->impl<TopoDS_Shape>());
aResultShapes.Add((*anIt)->impl<TopoDS_Shape>());
hasResults = true;
ListOfShape aModifiedShapes;
aMakeShape->modified(aShape, aModifiedShapes);
for(ListOfShape::const_iterator anIt = aModifiedShapes.cbegin(); anIt != aModifiedShapes.cend(); anIt++) {
- TopoDS_Shape aSH = (*anIt)->impl<TopoDS_Shape>();
aTempShapes.Add((*anIt)->impl<TopoDS_Shape>());
aResultShapes.Add((*anIt)->impl<TopoDS_Shape>());
hasResults = true;
private:
void result(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory,
- OperationType theOperationType);
-
+ OperationType theOperationType,
+ ListOfShape& theHistory);
protected:
ListOfMakeShape myListOfMakeShape; ///< List of make shape algos.
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: GeomAlgoAPI_MakeSweep.cpp
+// Created: 23 November 2015
+// Author: Dmitry Bobylev
+
+#include <GeomAlgoAPI_MakeSweep.h>
+
+//=================================================================================================
+const ListOfShape& GeomAlgoAPI_MakeSweep::fromFaces() const
+{
+ return myFromFaces;
+}
+
+//=================================================================================================
+const ListOfShape& GeomAlgoAPI_MakeSweep::toFaces() const
+{
+ return myToFaces;
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: GeomAlgoAPI_MakeSweep.h
+// Created: 23 November 2015
+// Author: Dmitry Bobylev
+#ifndef GeomAlgoAPI_MakeSweep_H_
+#define GeomAlgoAPI_MakeSweep_H_
+
+#include <GeomAlgoAPI.h>
+
+#include <GeomAlgoAPI_MakeShapeList.h>
+
+/**\class GeomAlgoAPI_MakeSweep
+ * \ingroup DataAlgo
+ * \brief The abstract class MakeSweep is the root class of swept primitives.
+ * Sweeps are objects you obtain by sweeping a profile along a path.
+ * The profile can be any topology and the path is usually a curve or
+ * a wire. The profile generates objects according to the following rules:
+ * - Vertices generate Edges.
+ * - Edges generate Faces.
+ * - Wires generate Shells.
+ * - Faces generate Solids.
+ * - Shells generate Composite Solids.
+ * You are not allowed to sweep Solids and Composite Solids.
+ */
+class GeomAlgoAPI_MakeSweep : public GeomAlgoAPI_MakeShapeList
+{
+public:
+ /// \returns the list of from faces.
+ GEOMALGOAPI_EXPORT const ListOfShape& fromFaces() const;
+
+ /// \return the list of to faces.
+ GEOMALGOAPI_EXPORT const ListOfShape& toFaces() const;
+
+protected:
+ GeomAlgoAPI_MakeSweep(){};
+
+protected:
+ ListOfShape myFromFaces;
+ ListOfShape myToFaces;
+};
+
+#endif
// Creating partition operation.
GEOMAlgo_Splitter* anOperation = new GEOMAlgo_Splitter;
- myMkShape.reset(new GeomAlgoAPI_MakeShape(anOperation, GeomAlgoAPI_MakeShape::BOPAlgoBuilder));
+ myMkShape.reset(new GeomAlgoAPI_MakeShape(anOperation, GeomAlgoAPI_MakeShape::OCCT_BOPAlgo_Builder));
// Getting objects.
for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) {
}
BOPAlgo_Builder* aBuilder = new BOPAlgo_Builder();
- myMkShape.reset(new GeomAlgoAPI_MakeShape(aBuilder, GeomAlgoAPI_MakeShape::BOPAlgoBuilder));
+ myMkShape.reset(new GeomAlgoAPI_MakeShape(aBuilder, GeomAlgoAPI_MakeShape::OCCT_BOPAlgo_Builder));
aBuilder->SetArguments(aListOfShape);
aBuilder->PerformWithFiller(aPaveFiller);
iErr = aBuilder->ErrorStatus();