From 232697ee8e2e35dde4272544561222e37abf368e Mon Sep 17 00:00:00 2001 From: szy Date: Tue, 28 Oct 2014 15:35:27 +0300 Subject: [PATCH] New data type - DataMapOfShapeShape is added. --- src/GeomAPI/CMakeLists.txt | 3 ++ src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp | 53 +++++++++++++++++++++ src/GeomAPI/GeomAPI_DataMapOfShapeShape.h | 42 ++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp create mode 100644 src/GeomAPI/GeomAPI_DataMapOfShapeShape.h diff --git a/src/GeomAPI/CMakeLists.txt b/src/GeomAPI/CMakeLists.txt index 8700473ee..2718fa980 100644 --- a/src/GeomAPI/CMakeLists.txt +++ b/src/GeomAPI/CMakeLists.txt @@ -23,6 +23,7 @@ SET(PROJECT_HEADERS GeomAPI_AISObject.h GeomAPI_IPresentable.h GeomAPI_Curve.h + GeomAPI_DataMapOfShapeShape.h ) SET(PROJECT_SOURCES @@ -43,6 +44,7 @@ SET(PROJECT_SOURCES GeomAPI_PlanarEdges.cpp GeomAPI_AISObject.cpp GeomAPI_Curve.cpp + GeomAPI_DataMapOfShapeShape.cpp ) SET(PROJECT_LIBRARIES @@ -50,6 +52,7 @@ SET(PROJECT_LIBRARIES ${CAS_MODELER} ${CAS_VIEWER} ${CAS_SHAPE} + ${CAS_TKTopAlgo} ) ADD_DEFINITIONS(-DGEOMAPI_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp new file mode 100644 index 000000000..b573c5a0a --- /dev/null +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp @@ -0,0 +1,53 @@ +// File: GeomAPI_DataMapOfShapeShape.cpp +// Created: 28 Oct 2014 +// Author: Sergey Zaritchny + +#include +#include +#include +using namespace std; + + +GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape() + :GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){} + +/// Clear +void GeomAPI_DataMapOfShapeShape::clear() +{ + implPtr()->Clear(); +} + +/// Adds the Key to the Map with the Item. Returns True if the Key was not already in the map +bool GeomAPI_DataMapOfShapeShape::bind (const boost::shared_ptr& theKey, const boost::shared_ptr& theItem) +{ + bool flag(false); + if(implPtr()->Bind(theKey->impl(), theItem->impl())) + flag = true; + return flag; +} + +/// Returns true if theKey is stored in the map. +bool GeomAPI_DataMapOfShapeShape::isBound (const boost::shared_ptr& theKey) +{ + bool flag(false); + if(impl().IsBound(theKey->impl())) + flag = true; + return flag; +} + +/// Returns the Item stored with the Key in the Map. To be checked before with isBound() +const boost::shared_ptr GeomAPI_DataMapOfShapeShape::find(const boost::shared_ptr& theKey) +{ + boost::shared_ptr aShape(new GeomAPI_Shape()); + aShape->setImpl((void *)&(impl().Find(theKey->impl()))); + return aShape; +} + +/// Removes the Key from the map. Returns true if the Key was in the Map +bool GeomAPI_DataMapOfShapeShape::unBind(const boost::shared_ptr& theKey) +{ + bool flag(false); + if(implPtr()->UnBind(theKey->impl())) + flag = true; + return flag; +} \ No newline at end of file diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h new file mode 100644 index 000000000..119cfda0e --- /dev/null +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeShape.h @@ -0,0 +1,42 @@ +// File: GeomAPI_DataMapOfShapeShape.h +// Created: 28 Oct 2014 +// Author: Sergey Zaritchny + +#ifndef GeomAPI_DataMapOfShapeShape_H_ +#define GeomAPI_DataMapOfShapeShape_H_ + +#include +#include + +class GeomAPI_Pnt; +class GeomAPI_Dir; + +/**\class GeomAPI_DataMapOfShapeShape + * \ingroup DataModel + * \brief DataMap of Shape - Shape defined by TopoDS_Shapes + */ + +class GEOMAPI_EXPORT GeomAPI_DataMapOfShapeShape : public GeomAPI_Interface +{ + public: + /// Creation of plane by the point and normal + GeomAPI_DataMapOfShapeShape(); + + /// Clear + void clear(); + + /// Adds the Key to the Map with the Item. Returns True if the Key was not already in the map + bool bind (const boost::shared_ptr& theKey, const boost::shared_ptr& theItem); + + /// Returns true if theKey is stored in the map. + bool isBound (const boost::shared_ptr& theKey); + + /// Returns the Item stored with the Key in the Map. + const boost::shared_ptr find(const boost::shared_ptr& theKey); + + /// Removes the Key from the map. Returns true if the Key was in the Map + bool unBind(const boost::shared_ptr& theKey); +}; + +#endif + -- 2.39.2