20 #ifndef Selector_Algo_H_
21 #define Selector_Algo_H_
25 #include <Standard_GUID.hxx>
26 #include <TDF_Label.hxx>
27 #include <TDF_LabelList.hxx>
28 #include <TopoDS_Shape.hxx>
38 TopAbs_ShapeEnum myShapeType;
41 TDF_Label myBaseDocumentLab;
42 bool myGeometricalNaming;
43 bool myAlwaysGeometricalNaming;
45 bool myUseIntersections;
72 const TopoDS_Shape theContext,
const TopoDS_Shape theValue,
73 const TDF_Label theAccess,
const TDF_Label theBaseDocument,
74 const bool theGeometricalNaming =
false,
75 const bool theUseNeighbors =
true,
const bool theUseIntersections =
true,
76 const bool theAlwaysGeometricalNaming =
false);
79 SELECTOR_EXPORT
virtual void store() = 0;
83 SELECTOR_EXPORT
virtual bool restore() = 0;
91 SELECTOR_EXPORT
virtual bool solve(
const TopoDS_Shape& theContext) = 0;
96 SELECTOR_EXPORT TopoDS_Shape
value();
102 TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName,
103 const TopAbs_ShapeEnum theShapeType,
const bool theGeomNaming,
107 static bool sameGeometry(
const TopoDS_Shape theShape1,
const TopoDS_Shape theShape2);
114 {myGeometricalNaming =
true;}
121 void storeBaseArray(
const TDF_LabelList& theRef,
const TDF_Label& theLast);
125 void store(
const TopoDS_Shape theShape);
128 {
return myBaseDocumentLab;}
131 {
return myGeometricalNaming;}
134 {
return myAlwaysGeometricalNaming;}
137 {
return myUseNeighbors;}
140 {
return myUseIntersections;}
144 static const Standard_GUID kWEAK_INDEX(
"e9373a61-cabc-4ee8-aabf-aea47c62ed87");
150 static const Standard_GUID kSHAPE_TYPE(
"864b3267-cb9d-4107-bf58-c3ce1775b171");
156 static const std::wstring kWEAK_NAME_IDENTIFIER = L
"weak_name_";
157 return kWEAK_NAME_IDENTIFIER;
162 static const std::wstring kPURE_WEAK_NAME_IDENTIFIER = L
"_weak_name_";
163 return kPURE_WEAK_NAME_IDENTIFIER;
168 static const std::wstring kWEAK_NAME_IDENTIFIER = std::wstring(L
"new_") +
oldWeakNameID();
169 return kWEAK_NAME_IDENTIFIER;
174 static const std::wstring kPURE_WEAK_NAME_IDENTIFIER =
176 return kPURE_WEAK_NAME_IDENTIFIER;
183 bool findNewVersion(
const TopoDS_Shape& theContext, TopoDS_Shape& theResult)
const;
Definition: Selector_Algo.h:37
const TDF_Label & baseDocument() const
Returns an access-label of the document that may contain initial shapes.
Definition: Selector_Algo.h:127
virtual void store()=0
Stores the name to the label and sub-labels tree.
static const Standard_GUID & weakID()
Returns GUID for the weak index (integer attribute) of the sub-shape.
Definition: Selector_Algo.h:142
void setGeometricalNaming()
Sets geometrical naming flag to true.
Definition: Selector_Algo.h:113
virtual bool solve(const TopoDS_Shape &theContext)=0
Updates the current shape by the stored topological name.
bool useNeighbors() const
Returns use neighbors flag.
Definition: Selector_Algo.h:136
Selector_Algo()
Initializes the algorithm.
Definition: Selector_Algo.cpp:63
bool geometricalNaming() const
Returns the geometrical naming flag.
Definition: Selector_Algo.h:130
virtual TDF_Label restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator *theNameGenerator)=0
Restores the selected shape by the topological name string.
static const Standard_GUID & shapeTypeID()
Returns GUID for the type of the shape, stored in case it is intersection or container.
Definition: Selector_Algo.h:148
static Selector_Algo * restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab)
Restores sub-algorithm of a given type by the storage-label.
Definition: Selector_Algo.cpp:365
bool findNewVersion(const TopoDS_Shape &theContext, TopoDS_Shape &theResult) const
Searches the newer version of the shape in the document if the base shape does not belong to context.
Definition: Selector_Algo.cpp:472
bool useIntersections() const
Returns use intersections flag.
Definition: Selector_Algo.h:139
bool alwaysGeometricalNaming() const
Returns always geometrical naming flag.
Definition: Selector_Algo.h:133
virtual bool restore()=0
Restores the selected shape by the topological naming kept in the data structure Returns true if it c...
TopoDS_Shape value()
Returns the current sub-shape value (null if can not resolve)
Definition: Selector_Algo.cpp:357
static const std::wstring & pureWeakNameID()
string identifier of the pure weak name
Definition: Selector_Algo.h:172
const TDF_Label & label() const
Returns label where this algorithm is attached to, or just an access label to the document.
Definition: Selector_Algo.h:118
bool restoreBaseArray(TDF_LabelList &theRef, TDF_Label &theLast)
Restores references to the labels: references to elements of ref-list, then the last.
Definition: Selector_Algo.cpp:294
static bool sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2)
Returns true if the given shapes are based on the same geometry.
Definition: Selector_Algo.cpp:334
void storeBaseArray(const TDF_LabelList &theRef, const TDF_Label &theLast)
Stores the array of references to theLab: references to elements of ref-list, then the last.
Definition: Selector_Algo.cpp:268
static Selector_Algo * select(const TopoDS_Shape theContext, const TopoDS_Shape theValue, const TDF_Label theAccess, const TDF_Label theBaseDocument, const bool theGeometricalNaming=false, const bool theUseNeighbors=true, const bool theUseIntersections=true, const bool theAlwaysGeometricalNaming=false)
Initializes the selector structure on the label.
Definition: Selector_Algo.cpp:113
static const std::wstring & oldPureWeakNameID()
old string identifier of the pure weak name
Definition: Selector_Algo.h:160
static const std::wstring & weakNameID()
string identifier of the weak name in modification or intersection types of algorithm
Definition: Selector_Algo.h:166
void storeType(const Selector_Type theType)
Stores the type of an algorithm in the data tree (in myLab)
Definition: Selector_Algo.cpp:455
static const std::wstring & oldWeakNameID()
old string identifier of the weak name in modification or intersection types of algorithm
Definition: Selector_Algo.h:154
virtual std::wstring name(Selector_NameGenerator *theNameGenerator)=0
Returns the naming name of the selection.
static Selector_Algo * relesectWithAllGeometry(Selector_Algo *theOldAlgo, const TopoDS_Shape theContext)
Creates a new selection algorithm for selection of all topology based on the same geometry.
Definition: Selector_Algo.cpp:261
Selector_Type
Type of a selector algorithm: on this type depends what is stored in this label and how to restore it...
Definition: Selector_Algo.h:50
@ SELTYPE_FILTER_BY_NEIGHBOR
identification by neighbor shapes in context
Definition: Selector_Algo.h:55
@ SELTYPE_CONTAINER
just a container of sub-elements, keeps the shape type of container
Definition: Selector_Algo.h:51
@ SELTYPE_PRIMITIVE
sub-shape found as a primitive on some label
Definition: Selector_Algo.h:53
@ SELTYPE_MODIFICATION
modification of base shapes to the final label
Definition: Selector_Algo.h:54
@ SELTYPE_WEAK_NAMING
pure weak naming by weak index in context
Definition: Selector_Algo.h:56
@ SELTYPE_INTERSECT
sub-shape is intersection of higher level objects
Definition: Selector_Algo.h:52
An interface for generation of the naming name basing on the current selection and document informati...
Definition: Selector_NameGenerator.h:34