-// Copyright (C) 2017-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2017-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "Selector.h"
#include <TopoDS_Shape.hxx>
-#include <TopoDS_ListOfShape.hxx>
+
+#include <memory>
+
+class GeomAlgoAPI_NExplode;
/// \class Selector_NExplode
/// \ingroup DataModel
{
public:
/// \brief Initializes the sorted list of shapes by the shapes list.
- SELECTOR_EXPORT Selector_NExplode(const TopoDS_ListOfShape& theShapes);
+ SELECTOR_EXPORT Selector_NExplode(const TopoDS_ListOfShape& theShapes,
+ const bool theOldOrder = false);
/// \brief Initializes the sorted list of shapes by the context shape and type of sub-shapes.
- SELECTOR_EXPORT Selector_NExplode(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType);
+ SELECTOR_EXPORT Selector_NExplode(const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum theType,
+ const bool theOldOrder = false);
/// Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found.
SELECTOR_EXPORT int index(const TopoDS_Shape& theSubShape);
/// Returns a shape by an index (started from one). Returns null if not found.
- SELECTOR_EXPORT TopoDS_Shape shape(const int theIndex);
+ /// Recompute the index if the old order was used. The value will contain the new ordered index.
+ SELECTOR_EXPORT TopoDS_Shape shape(int& theIndex);
protected:
- TopoDS_ListOfShape mySorted; ///< keep the ordered list of shapes
+ std::shared_ptr<GeomAlgoAPI_NExplode> mySorted; ///< keep the ordered list of shapes
+ bool myToBeReordered; ///< the list has to be reordered
};
#endif