-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef Selector_Algo_H_
/// Initializes the algorithm
SELECTOR_EXPORT Selector_Algo();
+ virtual ~Selector_Algo() {}
+
/// Initializes the selector structure on the label.
/// Stores the name data to restore after modification.
/// \param theContext whole shape that contains the selected sub-shape
/// Restores the selected shape by the topological name string.
/// Returns not empty label of the context.
- SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::wstring theName,
const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) = 0;
/// Updates the current shape by the stored topological name
SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) = 0;
/// Returns the naming name of the selection
- SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) = 0;
+ SELECTOR_EXPORT virtual std::wstring name(Selector_NameGenerator* theNameGenerator) = 0;
/// Returns the current sub-shape value (null if can not resolve)
SELECTOR_EXPORT TopoDS_Shape value();
/// Restores sub-algorithm of a given type by the storage-label
- SELECTOR_EXPORT Selector_Algo* restoreByLab(TDF_Label theLab);
+ SELECTOR_EXPORT static Selector_Algo* restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab);
/// Restores the selected sub-algorithm by the naming name.
/// Returns not empty label of the context.
SELECTOR_EXPORT static Selector_Algo* restoreByName(
- TDF_Label theLab, TDF_Label theBaseDocLab, std::string theName,
- const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator,
- TDF_Label& theContextLab);
+ TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName,
+ const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
+ Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab);
/// Returns true if the given shapes are based on the same geometry
static bool sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2);
/// Creates a new selection algorithm for selection of all topology based on the same geometry
SELECTOR_EXPORT static Selector_Algo* relesectWithAllGeometry(
Selector_Algo* theOldAlgo, const TopoDS_Shape theContext);
+ /// Sets geometrical naming flag to true
+ void setGeometricalNaming()
+ {myGeometricalNaming = true;}
protected:
/// Returns label where this algorithm is attached to, or just an access label to the document
static const Standard_GUID kSHAPE_TYPE("864b3267-cb9d-4107-bf58-c3ce1775b171");
return kSHAPE_TYPE;
}
+ /// old string identifier of the weak name in modification or intersection types of algorithm
+ static const std::wstring& oldWeakNameID()
+ {
+ static const std::wstring kWEAK_NAME_IDENTIFIER = L"weak_name_";
+ return kWEAK_NAME_IDENTIFIER;
+ }
+ /// old string identifier of the pure weak name
+ static const std::wstring& oldPureWeakNameID()
+ {
+ static const std::wstring kPURE_WEAK_NAME_IDENTIFIER = L"_weak_name_";
+ return kPURE_WEAK_NAME_IDENTIFIER;
+ }
/// string identifier of the weak name in modification or intersection types of algorithm
- static const std::string& weakNameID()
+ static const std::wstring& weakNameID()
{
- static const std::string kWEAK_NAME_IDENTIFIER = "weak_name_";
+ static const std::wstring kWEAK_NAME_IDENTIFIER = std::wstring(L"new_") + oldWeakNameID();
return kWEAK_NAME_IDENTIFIER;
}
/// string identifier of the pure weak name
- static const std::string& pureWeakNameID()
+ static const std::wstring& pureWeakNameID()
{
- static const std::string kPURE_WEAK_NAME_IDENTIFIER = "_weak_name_";
+ static const std::wstring kPURE_WEAK_NAME_IDENTIFIER =
+ std::wstring(L"_new") + oldPureWeakNameID();
return kPURE_WEAK_NAME_IDENTIFIER;
}
/// Stores the type of an algorithm in the data tree (in myLab)
void storeType(const Selector_Type theType);
+
+ /// Searches the newer version of the shape in the document if the base shape does not
+ /// belong to context. Returns it in theResult (if any). Returns true is theResult is changed.
+ bool findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const;
};
#endif