From: sbh Date: Mon, 27 Oct 2014 15:03:01 +0000 (+0300) Subject: Refactoring: GeomAPI_Wire renamed to GeomAPI_PlanarEdges X-Git-Tag: V_0.5~69^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d2c592943592ae2d6118e1881ea899df81d692dc;p=modules%2Fshaper.git Refactoring: GeomAPI_Wire renamed to GeomAPI_PlanarEdges --- diff --git a/src/GeomAPI/CMakeLists.txt b/src/GeomAPI/CMakeLists.txt index f2e238051..8700473ee 100644 --- a/src/GeomAPI/CMakeLists.txt +++ b/src/GeomAPI/CMakeLists.txt @@ -19,7 +19,7 @@ SET(PROJECT_HEADERS GeomAPI_Pln.h GeomAPI_Shape.h GeomAPI_Edge.h - GeomAPI_Wire.h + GeomAPI_PlanarEdges.h GeomAPI_AISObject.h GeomAPI_IPresentable.h GeomAPI_Curve.h @@ -40,7 +40,7 @@ SET(PROJECT_SOURCES GeomAPI_Pln.cpp GeomAPI_Shape.cpp GeomAPI_Edge.cpp - GeomAPI_Wire.cpp + GeomAPI_PlanarEdges.cpp GeomAPI_AISObject.cpp GeomAPI_Curve.cpp ) diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.cpp b/src/GeomAPI/GeomAPI_PlanarEdges.cpp new file mode 100644 index 000000000..f12d62204 --- /dev/null +++ b/src/GeomAPI/GeomAPI_PlanarEdges.cpp @@ -0,0 +1,50 @@ +// File: GeomAPI_PlanarEdges.cpp +// Created: 06 Oct 2014 +// Author: Sergey BELASH + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +GeomAPI_PlanarEdges::GeomAPI_PlanarEdges() : GeomAPI_Shape() +{ + TopoDS_Compound aBigWireImpl; + BRep_Builder aBuilder; + aBuilder.MakeCompound(aBigWireImpl); + this->setImpl(new TopoDS_Shape(aBigWireImpl)); +} + +void GeomAPI_PlanarEdges::addEdge(boost::shared_ptr theEdge) +{ + const TopoDS_Edge& anEdge = theEdge->impl(); + if (anEdge.ShapeType() != TopAbs_EDGE) + return; + TopoDS_Shape& aWire = const_cast(impl()); + BRep_Builder aBuilder; + aBuilder.Add(aWire, anEdge); +} + +std::list > GeomAPI_PlanarEdges::getEdges() +{ + TopoDS_Shape& aShape = const_cast(impl()); + //BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape)); + TopExp_Explorer aWireExp(aShape, TopAbs_EDGE); + std::list > aResult; + for (; aWireExp.More(); aWireExp.Next()) { + boost::shared_ptr anEdge(new GeomAPI_Shape); + anEdge->setImpl(new TopoDS_Shape(aWireExp.Current())); + aResult.push_back(anEdge); + } + return aResult; +} diff --git a/src/GeomAPI/GeomAPI_PlanarEdges.h b/src/GeomAPI/GeomAPI_PlanarEdges.h new file mode 100644 index 000000000..af8422619 --- /dev/null +++ b/src/GeomAPI/GeomAPI_PlanarEdges.h @@ -0,0 +1,70 @@ +// File: GeomAPI_PlanarEdges.hxx +// Created: 24 Jul 2014 +// Author: Artem ZHIDKOV + +#ifndef GEOMAPI_WIRE_H_ +#define GEOMAPI_WIRE_H_ + +#include "GeomAPI.h" +#include "GeomAPI_Edge.h" +#include "GeomAPI_Pnt.h" +#include "GeomAPI_Dir.h" + +#include + +#include + +/**\class GeomAPI_PlanarEdges + * \ingroup DataModel + * \brief Interface to the edge object + */ + +class GeomAPI_PlanarEdges : public GeomAPI_Shape +{ + public: + /// Creation of empty (null) shape + GEOMAPI_EXPORT GeomAPI_PlanarEdges(); + + GEOMAPI_EXPORT virtual bool isVertex() const + { + return false; + } + + /// Returns whether the shape is an edge + GEOMAPI_EXPORT virtual bool isEdge() const + { + return false; + } + + GEOMAPI_EXPORT void addEdge(boost::shared_ptr theEdge); + GEOMAPI_EXPORT std::list > getEdges(); + + /// Returns True if the wire is defined in a plane + GEOMAPI_EXPORT bool hasPlane() const { return myOrigin && myNorm && myDirX && myDirY; } + + /// Set/Get origin point + GEOMAPI_EXPORT void setOrigin(const boost::shared_ptr& theOrigin) + { myOrigin = theOrigin; } + GEOMAPI_EXPORT boost::shared_ptr origin() const { return myOrigin; } + + /// Set/Get X direction vector + GEOMAPI_EXPORT void setDirX(const boost::shared_ptr& theDirX) { myDirX = theDirX; } + GEOMAPI_EXPORT boost::shared_ptr dirX() const { return myDirX; } + + /// Set/Get Y direction vector + GEOMAPI_EXPORT void setDirY(const boost::shared_ptr& theDirY) { myDirY = theDirY; } + GEOMAPI_EXPORT boost::shared_ptr dirY() const { return myDirY; } + + /// Set/Get Normal direction vector + GEOMAPI_EXPORT void setNorm(const boost::shared_ptr& theNorm) { myNorm = theNorm; } + GEOMAPI_EXPORT boost::shared_ptr norm() const { return myNorm; } + +private: + boost::shared_ptr myOrigin; + boost::shared_ptr myDirX; + boost::shared_ptr myDirY; + boost::shared_ptr myNorm; +}; + +#endif + diff --git a/src/GeomAPI/GeomAPI_Wire.cpp b/src/GeomAPI/GeomAPI_Wire.cpp deleted file mode 100644 index 39da519fe..000000000 --- a/src/GeomAPI/GeomAPI_Wire.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// File: GeomAPI_Wire.cpp -// Created: 06 Oct 2014 -// Author: Sergey BELASH - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -GeomAPI_Wire::GeomAPI_Wire() : GeomAPI_Shape() -{ - TopoDS_Compound aBigWireImpl; - BRep_Builder aBuilder; - aBuilder.MakeCompound(aBigWireImpl); - this->setImpl(new TopoDS_Shape(aBigWireImpl)); -} - -void GeomAPI_Wire::addEdge(boost::shared_ptr theEdge) -{ - const TopoDS_Edge& anEdge = theEdge->impl(); - if (anEdge.ShapeType() != TopAbs_EDGE) - return; - TopoDS_Shape& aWire = const_cast(impl()); - BRep_Builder aBuilder; - aBuilder.Add(aWire, anEdge); -} - -std::list > GeomAPI_Wire::getEdges() -{ - TopoDS_Shape& aShape = const_cast(impl()); - //BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape)); - TopExp_Explorer aWireExp(aShape, TopAbs_EDGE); - std::list > aResult; - for (; aWireExp.More(); aWireExp.Next()) { - boost::shared_ptr anEdge(new GeomAPI_Shape); - anEdge->setImpl(new TopoDS_Shape(aWireExp.Current())); - aResult.push_back(anEdge); - } - return aResult; -} diff --git a/src/GeomAPI/GeomAPI_Wire.h b/src/GeomAPI/GeomAPI_Wire.h deleted file mode 100644 index 86a457830..000000000 --- a/src/GeomAPI/GeomAPI_Wire.h +++ /dev/null @@ -1,70 +0,0 @@ -// File: GeomAPI_Wire.hxx -// Created: 24 Jul 2014 -// Author: Artem ZHIDKOV - -#ifndef GEOMAPI_WIRE_H_ -#define GEOMAPI_WIRE_H_ - -#include "GeomAPI.h" -#include "GeomAPI_Edge.h" -#include "GeomAPI_Pnt.h" -#include "GeomAPI_Dir.h" - -#include - -#include - -/**\class GeomAPI_Wire - * \ingroup DataModel - * \brief Interface to the edge object - */ - -class GeomAPI_Wire : public GeomAPI_Shape -{ - public: - /// Creation of empty (null) shape - GEOMAPI_EXPORT GeomAPI_Wire(); - - GEOMAPI_EXPORT virtual bool isVertex() const - { - return false; - } - - /// Returns whether the shape is an edge - GEOMAPI_EXPORT virtual bool isEdge() const - { - return false; - } - - GEOMAPI_EXPORT void addEdge(boost::shared_ptr theEdge); - GEOMAPI_EXPORT std::list > getEdges(); - - /// Returns True if the wire is defined in a plane - GEOMAPI_EXPORT bool hasPlane() const { return myOrigin && myNorm && myDirX && myDirY; } - - /// Set/Get origin point - GEOMAPI_EXPORT void setOrigin(const boost::shared_ptr& theOrigin) - { myOrigin = theOrigin; } - GEOMAPI_EXPORT boost::shared_ptr origin() const { return myOrigin; } - - /// Set/Get X direction vector - GEOMAPI_EXPORT void setDirX(const boost::shared_ptr& theDirX) { myDirX = theDirX; } - GEOMAPI_EXPORT boost::shared_ptr dirX() const { return myDirX; } - - /// Set/Get Y direction vector - GEOMAPI_EXPORT void setDirY(const boost::shared_ptr& theDirY) { myDirY = theDirY; } - GEOMAPI_EXPORT boost::shared_ptr dirY() const { return myDirY; } - - /// Set/Get Normal direction vector - GEOMAPI_EXPORT void setNorm(const boost::shared_ptr& theNorm) { myNorm = theNorm; } - GEOMAPI_EXPORT boost::shared_ptr norm() const { return myNorm; } - -private: - boost::shared_ptr myOrigin; - boost::shared_ptr myDirX; - boost::shared_ptr myDirY; - boost::shared_ptr myNorm; -}; - -#endif - diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index 0d0fc3418..ddd6d3977 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -3,7 +3,7 @@ // Author: Artem ZHIDKOV #include -#include +#include #include @@ -378,7 +378,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces(const boost::shared_ptr const boost::shared_ptr& theWire, std::list >& theResultFaces) { - boost::shared_ptr aWire = boost::dynamic_pointer_cast(theWire); + boost::shared_ptr aWire = boost::dynamic_pointer_cast(theWire); if(!aWire) return; // Filter wires, return only faces. diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index fd363ae41..54a52a22a 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include @@ -96,7 +96,7 @@ bool Model_AttributeSelection::update() } else if (aContext->groupName() == ModelAPI_ResultConstruction::group()) { // construction: identification by the results indexes, recompute faces and // take the face that more close by the indexes - boost::shared_ptr aWirePtr = boost::dynamic_pointer_cast( + boost::shared_ptr aWirePtr = boost::dynamic_pointer_cast( boost::dynamic_pointer_cast(aContext)->shape()); if (aWirePtr && aWirePtr->hasPlane()) { // If this is a wire with plane defined thin it is a sketch-like object diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index c8eea52c2..b039e9bfd 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -5,7 +5,7 @@ #include "ModuleBase_ResultPrs.h" #include -#include +#include #include #include @@ -20,8 +20,8 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) : AIS_Shape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false) { boost::shared_ptr aShapePtr = ModelAPI_Tools::shape(theResult); - boost::shared_ptr aWirePtr = - boost::dynamic_pointer_cast(aShapePtr); + boost::shared_ptr aWirePtr = + boost::dynamic_pointer_cast(aShapePtr); if (aWirePtr) { if (aWirePtr->hasPlane() ) { // If this is a wire with plane defined thin it is a sketch-like object diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index d0ebbbf8e..a66bd9ffb 100644 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -88,7 +88,7 @@ void SketchPlugin_Sketch::execute() return; // Collect all edges as one big wire - boost::shared_ptr aBigWire(new GeomAPI_Wire); + boost::shared_ptr aBigWire(new GeomAPI_PlanarEdges); std::list >::const_iterator aShapeIt = aFeaturesPreview.begin(); for (; aShapeIt != aFeaturesPreview.end(); ++aShapeIt) { aBigWire->addEdge(*aShapeIt);