#include "Selector.h"
#include <TDF_Label.hxx>
-#include <TDF_LabelList.hxx>
#include <TopoDS_Shape.hxx>
+class Selector_NameGenerator;
+class Selector_Algo;
+
/**\class Selector_Selector
* \ingroup DataModel
* \brief Main object for selection of the sub-shapes in the parametrically updated
* shapes using topological naming mechanism.
*/
-
class Selector_Selector
{
- /// Type of a selector: on this type depends what is stored in this label and how to
- /// restore it on update.
- enum Selector_Type {
- SELTYPE_CONTAINER, ///< just a container of sub-elements, keeps the shape type of container
- SELTYPE_INTERSECT, ///< sub-shape is intersection of higher level objects
- SELTYPE_PRIMITIVE, ///< sub-shape found as a primitive on some label
- SELTYPE_MODIFICATION,
- };
-
- Selector_Type myType; ///< Type of this selector.
- TopAbs_ShapeEnum myShapeType; ///< type of this shape: container or result of intersection
- TDF_Label myFinal; ///< final label of the primitive or generation, where the value is
- TDF_LabelList myBases; ///< initial labels that contain shapes that produce the modification
-
TDF_Label myLab; ///< main label where selector is performed
+ TDF_Label myBaseDocumentLab; ///< an access-label to the document that may contain initial shapes
+ Selector_Algo* myAlgo; ///< root algorithm of the selector
- public:
+public:
/// Initializes selector on the label
- Selector_Selector(TDF_Label theLab);
- /// Returns label of this selector
- TDF_Label label();
+ SELECTOR_EXPORT Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab = TDF_Label());
+
+ /// Destructor
+ SELECTOR_EXPORT ~Selector_Selector();
/// Initializes the selector structure on the label.
/// Stores the name data to restore after modification.
- bool Select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+ /// \param theContext whole shape that contains the selected sub-shape
+ /// \param theValue selected subshape
+ /// \param theGeometricalNaming treats selection with equal surfaces as one
+ /// \param theUseNeighbors enables searching algorithm by neighbors
+ /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes
+ SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+ const bool theGeometricalNaming = false);
/// Stores the name to the label and sub-labels tree
- void Store();
+ SELECTOR_EXPORT bool store(const TopoDS_Shape theContext);
/// Restores the selected shape by the topological naming kept in the data structure
- //TopoDS_Shape Restore();
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT bool restore(const TopoDS_Shape theContext);
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT TDF_Label restoreByName(
+ std::string theName, const TopAbs_ShapeEnum theShapeType,
+ Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming = false);
+
+ /// Returns the current sub-shape value (null if can not resolve)
+ SELECTOR_EXPORT TopoDS_Shape value();
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT std::string name(Selector_NameGenerator* theNameGenerator);
+
+ /// Makes the current local selection becomes all sub-shapes with same base geometry.
+ SELECTOR_EXPORT void combineGeometrical(const TopoDS_Shape theContext);
+
+ /// Stores the selected shape in he tree and returns true if shape found correctly
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape theContext);
};
#endif