WireExplorer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef WIREEXPLORER_H
00025 #define WIREEXPLORER_H
00026
00027 #include <TopoDS_Wire.hxx>
00028 #include <TopoDS_Edge.hxx>
00029 #include <gp_Pnt.hxx>
00030 #include <TopTools_MapOfShape.hxx>
00031 #include <map>
00032 #include <list>
00033 #include <vector>
00034
00035 struct WireExplorer_gp_PntLess
00036 {
00037 bool operator()(const gp_Pnt& _Left, const gp_Pnt& _Right) const
00038 {
00039 Standard_Real x1,y1,z1,x2,y2,z2;
00040 _Left.Coord(x1,y1,z1);
00041 _Right.Coord(x2,y2,z2);
00042 if ( x1 != x2 )
00043 return x1 < x2;
00044 else if ( y1 != y2 )
00045 return y1 < y2;
00046 return z1 < z2;
00047 }
00048 };
00049
00050 typedef std::vector<TopoDS_Edge> tEdgeVector;
00051 typedef std::map<gp_Pnt,tEdgeVector,WireExplorer_gp_PntLess> tMapPntShapes;
00052 typedef std::pair<gp_Pnt,tEdgeVector> tMapPntShapesPair;
00053
00054 class WireExplorer
00055 {
00056 public:
00057 Standard_EXPORT WireExplorer(const TopoDS_Wire& wire);
00058 Standard_EXPORT virtual ~WireExplorer(void);
00059
00060 Standard_EXPORT void Init();
00061 Standard_EXPORT bool More();
00062 Standard_EXPORT bool MoreEdge();
00063 Standard_EXPORT void Next();
00064 Standard_EXPORT const TopoDS_Edge& NextEdge();
00065 Standard_EXPORT const TopoDS_Edge& Current();
00066 private:
00067 void Perform();
00068 void Perform(const TopoDS_Edge& edge);
00069 bool PerformEdges(gp_Pnt& point);
00070 bool IsValidEdge(const TopoDS_Edge& edge);
00071 TopoDS_Wire m_wire;
00072
00073 tMapPntShapes m_vertices;
00074
00075 bool m_done;
00076 tEdgeVector m_edges;
00077 tEdgeVector::const_iterator m_edgeIter;
00078 };
00079
00080 #endif
00081