0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / TNaming / TNaming_Selector.hxx
CommitLineData
42cf5bc1 1// Created on: 1999-09-28
2// Created by: Denis PASCAL
3// Copyright (c) 1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _TNaming_Selector_HeaderFile
18#define _TNaming_Selector_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TDF_Label.hxx>
25#include <Standard_Boolean.hxx>
26#include <TDF_LabelMap.hxx>
27#include <TDF_AttributeMap.hxx>
28class TDF_Label;
29class TopoDS_Shape;
30class TNaming_NamedShape;
31
32
33//! This class provides a single API for selection of shapes.
34//! This involves both identification and selection of
35//! shapes in the data framework.
36//! If the selected shape is modified, this selector will
37//! solve its identifications.
38//! This class is the user interface for topological
39//! naming resources.
40//! * The <IsIdentified> method returns (if exists)
41//! the NamedShape which contains a given shape. The
42//! definition of an identified shape is : a Shape
43//! handled by a NamedShape (this shape is the only
44//! one stored) , which has the TNaming_PRImITIVE evolution
45//!
46//! * The <Select> method returns ALWAYS a new
47//! NamedShape at the given label, which contains the
48//! argument selected shape. When calling this
49//! method, the sub-hierarchy of <label> is first cleared,
50//! then a TNaming_NamedShape is ALWAYS created at
51//! this <label>, with the TNaming_SELECTED evolution.
52//! The <Naming attribute> is associated to the selected
53//! shape which store the arguments of the selection .
54//! If the given selected shape was already identified
55//! (method IsIdentified) , this Naming attribute
56//! contains the reference (Identity code) to the
57//! argument shape.
58//!
59//! * The <Solve> method update the current value of
60//! the NamedShape, according to the <Naming> attribute.
61//! A boolean status is returned to say if the
62//! algorithm succeed or not. To read the current
63//! value of the selected Named Shape use the
64//! TNaming_Tool::GetShape method, as for any
65//! NamedShape attribute.
66class TNaming_Selector
67{
68public:
69
70 DEFINE_STANDARD_ALLOC
71
72
73 //! To know if a shape is already identified (not selected)
74 //! =======================================================
75 //!
76 //! The label access defines the point of access to the data framework.
77 //! selection is the shape for which we want to know
78 //! whether it is identified or not.
79 //! If true, NS is returned as the identity of selection.
80 //! If Geometry is true, NS will be the named shape
81 //! containing the first appearance of selection and
82 //! not any other shape. In other words, selection
83 //! must be the only shape stored in NS.
84 Standard_EXPORT static Standard_Boolean IsIdentified (const TDF_Label& access, const TopoDS_Shape& selection, Handle(TNaming_NamedShape)& NS, const Standard_Boolean Geometry = Standard_False);
85
86 //! Create a selector on this label
87 //! to select a shape.
88 //! ==================
89 Standard_EXPORT TNaming_Selector(const TDF_Label& aLabel);
90
91
92 //! Creates a topological naming on the label
93 //! aLabel given as an argument at construction time.
94 //! If successful, the shape Selection - found in the
95 //! shape Context - is now identified in the named
96 //! shape returned in NamedShape.
97 //! If Geometry is true, NamedShape contains the
98 //! first appearance of Selection.
99 //! This syntax is more robust than the previous
100 //! syntax for this method.
101 Standard_EXPORT Standard_Boolean Select (const TopoDS_Shape& Selection, const TopoDS_Shape& Context, const Standard_Boolean Geometry = Standard_False, const Standard_Boolean KeepOrientatation = Standard_False) const;
102
103
104 //! Creates a topological naming on the label
105 //! aLabel given as an argument at construction time.
106 //! If successful, the shape Selection is now
107 //! identified in the named shape returned in NamedShape.
108 //! If Geometry is true, NamedShape contains the
109 //! first appearance of Selection.
110 Standard_EXPORT Standard_Boolean Select (const TopoDS_Shape& Selection, const Standard_Boolean Geometry = Standard_False, const Standard_Boolean KeepOrientatation = Standard_False) const;
111
112
113 //! Updates the topological naming on the label
114 //! aLabel given as an argument at construction time.
115 //! The underlying shape returned in the method
116 //! NamedShape is updated.
117 //! To read this shape, use the method TNaming_Tool::GetShape
118 Standard_EXPORT Standard_Boolean Solve (TDF_LabelMap& Valid) const;
119
120 //! Returns the attribute list args.
121 //! This list contains the named shape on which the topological naming was built.
122 Standard_EXPORT void Arguments (TDF_AttributeMap& args) const;
123
124 //! Returns the NamedShape build or under construction,
125 //! which contains the topological naming..
126 Standard_EXPORT Handle(TNaming_NamedShape) NamedShape() const;
127
128
129
130
131protected:
132
133
134
135
136
137private:
138
139
140
141 TDF_Label myLabel;
142
143
144};
145
146
147
148
149
150
151
152#endif // _TNaming_Selector_HeaderFile