Salome HOME
Another try to change the selection principles. Initial implementation of the base...
[modules/shaper.git] / src / Selector / Selector_Selector.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef Selector_Selector_H_
22 #define Selector_Selector_H_
23
24 #include "Selector.h"
25
26 #include <TDF_Label.hxx>
27 #include <TDF_LabelList.hxx>
28 #include <TopoDS_Shape.hxx>
29
30 /**\class Selector_Selector
31  * \ingroup DataModel
32  * \brief Main object for selection of the sub-shapes in the parametrically updated
33  * shapes using topological naming mechanism.
34  */
35
36 class Selector_Selector
37 {
38   /// Type of a selector: on this type depends what is stored in this label and how to
39   /// restore it on update.
40   enum Selector_Type {
41     SELTYPE_CONTAINER, ///< just a container of sub-elements, keeps the shape type of container
42     SELTYPE_INTERSECT, ///< sub-shape is intersection of higher level objects
43     SELTYPE_PRIMITIVE, ///< sub-shape found as a primitive on some label
44     SELTYPE_MODIFICATION,
45   };
46
47   Selector_Type myType; ///< Type of this selector.
48   TopAbs_ShapeEnum myShapeType; ///< type of this shape: container or result of intersection
49   TDF_Label myFinal; ///< final label of the primitive or generation, where the value is
50   TDF_LabelList myBases; ///< initial labels that contain shapes that produce the modification
51
52   TDF_Label myLab; ///< main label where selector is performed
53
54  public:
55   /// Initializes selector on the label
56   Selector_Selector(TDF_Label theLab);
57   /// Returns label of this selector
58   TDF_Label label();
59
60   /// Initializes the selector structure on the label.
61   /// Stores the name data to restore after modification.
62   bool Select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
63
64   /// Stores the name to the label and sub-labels tree
65   void Store();
66
67   /// Restores the selected shape by the topological naming kept in the data structure
68   //TopoDS_Shape Restore();
69 };
70
71 #endif