HYDROData_Region.h
HYDROData_River.h
HYDROData_ShapesGroup.h
+ HYDROData_ShapesTool.h
HYDROData_SplittedShapesGroup.h
HYDROData_SplitToZonesTool.h
HYDROData_Stream.h
HYDROData_Region.cxx
HYDROData_River.cxx
HYDROData_ShapesGroup.cxx
+ HYDROData_ShapesTool.cxx
HYDROData_SplittedShapesGroup.cxx
HYDROData_SplitToZonesTool.cxx
HYDROData_Stream.cxx
#include "HYDROData_Document.h"
#include "HYDROData_ShapesGroup.h"
#include "HYDROData_PolylineXY.h"
-#include "HYDROData_Tool.h"
+#include "HYDROData_ShapesTool.h"
#include <BRepBuilderAPI_MakeFace.hxx>
continue; // Skip the outer wire
TopTools_SequenceOfShape anEdges;
- HYDROData_Tool::ExploreShapeToShapes( aZoneWire, TopAbs_EDGE, anEdges );
+ HYDROData_ShapesTool::ExploreShapeToShapes( aZoneWire, TopAbs_EDGE, anEdges );
anInnerEdges.Append( anEdges );
}
// Create outer edges group
- QString anOutWiresGroupName = GetName() + "_Outer_Wire";
+ QString anOutWiresGroupName = GetName() + "_Outer";
Handle(HYDROData_ShapesGroup) anOutWiresGroup = createGroupObject();
anOutWiresGroup->SetName( anOutWiresGroupName );
TopTools_SequenceOfShape anEdges;
- HYDROData_Tool::ExploreShapeToShapes( aZoneOuterWire, TopAbs_EDGE, anEdges );
+ HYDROData_ShapesTool::ExploreShapeToShapes( aZoneOuterWire, TopAbs_EDGE, anEdges );
anOutWiresGroup->SetShapes( anEdges );
// Create group for inner edges only if edges is not empty
if ( !anInnerEdges.IsEmpty() )
{
- QString anInWiresGroupName = GetName() + "_Inner_Wires";
+ QString anInWiresGroupName = GetName() + "_Inner";
Handle(HYDROData_ShapesGroup) anInWiresGroup = createGroupObject();
anInWiresGroup->SetName( anInWiresGroupName );
#include "HYDROData_Obstacle.h"
#include "HYDROData_Document.h"
-#include "HYDROData_Tool.h"
#include "HYDROData_ShapesGroup.h"
+#include "HYDROData_ShapesTool.h"
#include <Basics_Utils.hxx>
if ( !anObstacleShape.IsNull() )
{
TopTools_SequenceOfShape aWireEdges;
- HYDROData_Tool::ExploreShapeToShapes( anObstacleShape, TopAbs_EDGE, aWireEdges );
+ HYDROData_ShapesTool::ExploreShapeToShapes( anObstacleShape, TopAbs_EDGE, aWireEdges );
if ( !aWireEdges.IsEmpty() )
{
QString aWireGroupName = GetName() + "_Outer_Wire";
--- /dev/null
+
+#include "HYDROData_ShapesTool.h"
+
+#include <BRep_Tool.hxx>
+
+#include <gp_Pnt.hxx>
+
+#include <Precision.hxx>
+
+#include <TopExp.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+
+#include <TopTools_SequenceOfShape.hxx>
+
+#include <TopExp_Explorer.hxx>
+
+void HYDROData_ShapesTool::ExploreShapeToShapes( const TopoDS_Shape& theInShape,
+ const TopAbs_ShapeEnum& theExpType,
+ TopTools_SequenceOfShape& theOutShapes )
+{
+ theOutShapes.Clear();
+
+ if ( theInShape.IsNull() )
+ return;
+
+ TopExp_Explorer anExp( theInShape, theExpType );
+ for ( ; anExp.More(); anExp.Next() )
+ {
+ TopoDS_Shape anExpShape = anExp.Current();
+ theOutShapes.Append( anExpShape );
+ }
+}
+
+bool HYDROData_ShapesTool::IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
+ const TopoDS_Vertex& theSecondVert )
+{
+ gp_Pnt aFirstPoint = BRep_Tool::Pnt( theFirstVert );
+ gp_Pnt aSecondPoint = BRep_Tool::Pnt( theSecondVert );
+ return aFirstPoint.IsEqual( aSecondPoint, Precision::Confusion() );
+}
+
+bool HYDROData_ShapesTool::IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
+ const TopoDS_Edge& theSecondEdge )
+{
+ TopoDS_Vertex aFFirstVert, aFLastVert, aSFirstVert, aSLastVert;
+ TopExp::Vertices( theFirstEdge, aFFirstVert, aFLastVert );
+ TopExp::Vertices( theSecondEdge, aSFirstVert, aSLastVert );
+ return IsVerticesEquals( aFFirstVert, aSFirstVert ) &&
+ IsVerticesEquals( aFLastVert, aSLastVert );
+}
+
+
--- /dev/null
+
+#ifndef HYDROData_ShapesTool_HeaderFile
+#define HYDROData_ShapesTool_HeaderFile
+
+#include "HYDROData.h"
+
+#include <TopAbs_ShapeEnum.hxx>
+
+class TopoDS_Shape;
+class TopoDS_Vertex;
+class TopoDS_Edge;
+class TopTools_SequenceOfShape;
+
+class HYDRODATA_EXPORT HYDROData_ShapesTool {
+
+public:
+
+ /**
+ * \brief Explore the incoming shape to shapes with given type.
+ * \param theInShape object to explore
+ * \param theExpType type to explore
+ * \param theOutShapes[out] list of result shapes if any
+ */
+ static void ExploreShapeToShapes( const TopoDS_Shape& theInShape,
+ const TopAbs_ShapeEnum& theExpType,
+ TopTools_SequenceOfShape& theOutShapes );
+
+ /**
+ * \brief Compare two vertices on coordinates equation.
+ * \param theFirstVert first vertex
+ * \param theSecondVert second vertex
+ * \return \c true if cooredinates of vertices is equals
+ */
+ static bool IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
+ const TopoDS_Vertex& theSecondVert );
+
+ /**
+ * \brief Compare two edges on points coordinates equation.
+ * \param theFirstVert first edge
+ * \param theSecondVert second edge
+ * \return \c true if coordinates of all points of given edges is equals
+ */
+ static bool IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
+ const TopoDS_Edge& theSecondEdge );
+};
+
+
+#endif
+
+
theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) );
}
-void HYDROData_Tool::ExploreShapeToShapes( const TopoDS_Shape& theInShape,
- const TopAbs_ShapeEnum& theExpType,
- TopTools_SequenceOfShape& theOutShapes )
-{
- theOutShapes.Clear();
-
- if ( theInShape.IsNull() )
- return;
-
- TopExp_Explorer anExp( theInShape, theExpType );
- for ( ; anExp.More(); anExp.Next() )
- {
- TopoDS_Shape anExpShape = anExp.Current();
- theOutShapes.Append( anExpShape );
- }
-}
-
*/
static bool IsGeometryObject( const Handle(HYDROData_Entity)& theObject );
- /**
- * \brief Explore the incoming shape to shapes with given type.
- * \param theInShape object to explore
- * \param theExpType type to explore
- * \param theOutShapes[out] list of result shapes if any
- */
- static void ExploreShapeToShapes( const TopoDS_Shape& theInShape,
- const TopAbs_ShapeEnum& theExpType,
- TopTools_SequenceOfShape& theOutShapes );
-
};
inline bool ValuesEquals( const double& theFirst, const double& theSecond )