]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Refactoring: GeomAPI_Wire renamed to GeomAPI_PlanarEdges
authorsbh <sergey.belash@opencascade.com>
Mon, 27 Oct 2014 15:03:01 +0000 (18:03 +0300)
committersbh <sergey.belash@opencascade.com>
Mon, 27 Oct 2014 15:03:01 +0000 (18:03 +0300)
src/GeomAPI/CMakeLists.txt
src/GeomAPI/GeomAPI_PlanarEdges.cpp [new file with mode: 0644]
src/GeomAPI/GeomAPI_PlanarEdges.h [new file with mode: 0644]
src/GeomAPI/GeomAPI_Wire.cpp [deleted file]
src/GeomAPI/GeomAPI_Wire.h [deleted file]
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp
src/Model/Model_AttributeSelection.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/SketchPlugin/SketchPlugin_Sketch.cpp

index f2e238051b1a78c16b33e8323d27f0078dd2acaa..8700473eef8ac81a409b9c08a24d6b34631f458e 100644 (file)
@@ -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 (file)
index 0000000..f12d622
--- /dev/null
@@ -0,0 +1,50 @@
+// File:        GeomAPI_PlanarEdges.cpp
+// Created:     06 Oct 2014
+// Author:      Sergey BELASH
+
+#include <GeomAPI_Interface.h>
+#include <GeomAPI_PlanarEdges.h>
+
+#include <Standard_TypeDef.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepTools_WireExplorer.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <list>
+
+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<GeomAPI_Shape> theEdge)
+{
+  const TopoDS_Edge& anEdge = theEdge->impl<TopoDS_Edge>();
+  if (anEdge.ShapeType() != TopAbs_EDGE)
+    return;
+  TopoDS_Shape& aWire = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
+  BRep_Builder aBuilder;
+  aBuilder.Add(aWire, anEdge);
+}
+
+std::list<boost::shared_ptr<GeomAPI_Shape> > GeomAPI_PlanarEdges::getEdges()
+{
+  TopoDS_Shape& aShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
+  //BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape));
+  TopExp_Explorer aWireExp(aShape, TopAbs_EDGE);
+  std::list<boost::shared_ptr<GeomAPI_Shape> > aResult;
+  for (; aWireExp.More(); aWireExp.Next()) {
+    boost::shared_ptr<GeomAPI_Shape> 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 (file)
index 0000000..af84226
--- /dev/null
@@ -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 <boost/smart_ptr/shared_ptr.hpp>
+
+#include <list>
+
+/**\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<GeomAPI_Shape> theEdge);
+  GEOMAPI_EXPORT std::list<boost::shared_ptr<GeomAPI_Shape> > 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<GeomAPI_Pnt>& theOrigin) 
+  { myOrigin = theOrigin; }
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Pnt> origin() const { return myOrigin; }
+
+  /// Set/Get X direction vector
+  GEOMAPI_EXPORT void setDirX(const boost::shared_ptr<GeomAPI_Dir>& theDirX) { myDirX = theDirX; }
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirX() const { return myDirX; }
+
+  /// Set/Get Y direction vector
+  GEOMAPI_EXPORT void setDirY(const boost::shared_ptr<GeomAPI_Dir>& theDirY) { myDirY = theDirY; }
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirY() const { return myDirY; }
+
+  /// Set/Get Normal direction vector
+  GEOMAPI_EXPORT void setNorm(const boost::shared_ptr<GeomAPI_Dir>& theNorm) { myNorm = theNorm; }
+  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> norm() const { return myNorm; }
+
+private:
+  boost::shared_ptr<GeomAPI_Pnt> myOrigin;
+  boost::shared_ptr<GeomAPI_Dir> myDirX;
+  boost::shared_ptr<GeomAPI_Dir> myDirY;
+  boost::shared_ptr<GeomAPI_Dir> myNorm;
+};
+
+#endif
+
diff --git a/src/GeomAPI/GeomAPI_Wire.cpp b/src/GeomAPI/GeomAPI_Wire.cpp
deleted file mode 100644 (file)
index 39da519..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// File:        GeomAPI_Wire.cpp
-// Created:     06 Oct 2014
-// Author:      Sergey BELASH
-
-#include <GeomAPI_Interface.h>
-#include <GeomAPI_Wire.h>
-
-#include <Standard_TypeDef.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepTools_WireExplorer.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <list>
-
-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<GeomAPI_Shape> theEdge)
-{
-  const TopoDS_Edge& anEdge = theEdge->impl<TopoDS_Edge>();
-  if (anEdge.ShapeType() != TopAbs_EDGE)
-    return;
-  TopoDS_Shape& aWire = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
-  BRep_Builder aBuilder;
-  aBuilder.Add(aWire, anEdge);
-}
-
-std::list<boost::shared_ptr<GeomAPI_Shape> > GeomAPI_Wire::getEdges()
-{
-  TopoDS_Shape& aShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
-  //BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape));
-  TopExp_Explorer aWireExp(aShape, TopAbs_EDGE);
-  std::list<boost::shared_ptr<GeomAPI_Shape> > aResult;
-  for (; aWireExp.More(); aWireExp.Next()) {
-    boost::shared_ptr<GeomAPI_Shape> 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 (file)
index 86a4578..0000000
+++ /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 <boost/smart_ptr/shared_ptr.hpp>
-
-#include <list>
-
-/**\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<GeomAPI_Shape> theEdge);
-  GEOMAPI_EXPORT std::list<boost::shared_ptr<GeomAPI_Shape> > 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<GeomAPI_Pnt>& theOrigin) 
-  { myOrigin = theOrigin; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Pnt> origin() const { return myOrigin; }
-
-  /// Set/Get X direction vector
-  GEOMAPI_EXPORT void setDirX(const boost::shared_ptr<GeomAPI_Dir>& theDirX) { myDirX = theDirX; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirX() const { return myDirX; }
-
-  /// Set/Get Y direction vector
-  GEOMAPI_EXPORT void setDirY(const boost::shared_ptr<GeomAPI_Dir>& theDirY) { myDirY = theDirY; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirY() const { return myDirY; }
-
-  /// Set/Get Normal direction vector
-  GEOMAPI_EXPORT void setNorm(const boost::shared_ptr<GeomAPI_Dir>& theNorm) { myNorm = theNorm; }
-  GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> norm() const { return myNorm; }
-
-private:
-  boost::shared_ptr<GeomAPI_Pnt> myOrigin;
-  boost::shared_ptr<GeomAPI_Dir> myDirX;
-  boost::shared_ptr<GeomAPI_Dir> myDirY;
-  boost::shared_ptr<GeomAPI_Dir> myNorm;
-};
-
-#endif
-
index 0d0fc34183ce5cdb61dcc341e98ccc075a8915f3..ddd6d397712e5bcf3aa29e2ae2b38616ad4a71e3 100644 (file)
@@ -3,7 +3,7 @@
 // Author:      Artem ZHIDKOV
 
 #include <GeomAlgoAPI_SketchBuilder.h>
-#include <GeomAPI_Wire.h>
+#include <GeomAPI_PlanarEdges.h>
 
 #include <set>
 
@@ -378,7 +378,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces(const boost::shared_ptr<GeomAPI_Pnt>
                                             const boost::shared_ptr<GeomAPI_Shape>& theWire,
                                             std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces)
 {
-  boost::shared_ptr<GeomAPI_Wire> aWire = boost::dynamic_pointer_cast<GeomAPI_Wire>(theWire);
+  boost::shared_ptr<GeomAPI_PlanarEdges> aWire = boost::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
   if(!aWire)
     return;
   // Filter wires, return only faces.
index fd363ae413821d02fcfa350b68e2a6c2fac68c7a..54a52a22a96386b1f4eb5bea7237dac30ffa1852 100644 (file)
@@ -11,7 +11,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_CompositeFeature.h>
 #include <GeomAPI_Shape.h>
-#include <GeomAPI_Wire.h>
+#include <GeomAPI_PlanarEdges.h>
 #include <GeomAlgoAPI_SketchBuilder.h>
 #include <Events_Error.h>
 
@@ -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<GeomAPI_Wire> aWirePtr = boost::dynamic_pointer_cast<GeomAPI_Wire>(
+    boost::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = boost::dynamic_pointer_cast<GeomAPI_PlanarEdges>(
       boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext)->shape());
     if (aWirePtr && aWirePtr->hasPlane()) {
         // If this is a wire with plane defined thin it is a sketch-like object
index c8eea52c22e4155eaab79d4322e32f145c23351d..b039e9bfd34ee9223d29f27acbf8d207968f362c 100644 (file)
@@ -5,7 +5,7 @@
 #include "ModuleBase_ResultPrs.h"
 
 #include <ModelAPI_Tools.h>
-#include <GeomAPI_Wire.h>
+#include <GeomAPI_PlanarEdges.h>
 #include <GeomAlgoAPI_SketchBuilder.h>
 
 #include <BRep_Builder.hxx>
@@ -20,8 +20,8 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
   : AIS_Shape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false)
 {
   boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
-  boost::shared_ptr<GeomAPI_Wire> aWirePtr = 
-    boost::dynamic_pointer_cast<GeomAPI_Wire>(aShapePtr);
+  boost::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = 
+    boost::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aShapePtr);
   if (aWirePtr) {
     if (aWirePtr->hasPlane() ) {
       // If this is a wire with plane defined thin it is a sketch-like object
index d0ebbbf8e0957c752c1cfb19c5ceafe627efc57f..a66bd9ffb1b6a3040a79c005147862739e5db233 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <GeomAPI_AISObject.h>
 #include <GeomAPI_Dir.h>
-#include <GeomAPI_Wire.h>
+#include <GeomAPI_PlanarEdges.h>
 #include <GeomAPI_XYZ.h>
 
 #include <GeomDataAPI_Dir.h>
@@ -88,7 +88,7 @@ void SketchPlugin_Sketch::execute()
     return;
 
   // Collect all edges as one big wire
-  boost::shared_ptr<GeomAPI_Wire> aBigWire(new GeomAPI_Wire);
+  boost::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
   std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator aShapeIt = aFeaturesPreview.begin();
   for (; aShapeIt != aFeaturesPreview.end(); ++aShapeIt) {
     aBigWire->addEdge(*aShapeIt);