2 #ifndef HYDROData_Tool_HeaderFile
3 #define HYDROData_Tool_HeaderFile
6 #include "HYDROData_Entity.h"
8 #include <Precision.hxx>
11 #include <QStringList>
14 class Handle(HYDROData_Document);
16 class HYDRODATA_EXPORT HYDROData_Tool {
20 static void WriteStringsToFile( QFile& theFile,
21 const QStringList& theStrings,
22 const QString& theSep = "\n" );
25 * Enables "MustBeUpdated" flag for Images that are depended on "MustBeUpdated" images.
26 * \param theDoc document where this operation is performed
28 static void SetMustBeUpdatedImages( const Handle(HYDROData_Document)& theDoc );
31 * \brief Generate name for new object.
32 * \param theModule module
33 * \param thePrefix name prefix
34 * \param theUsedNames list of already used names
35 * \return generated name
37 static QString GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
38 const QString& thePrefix,
39 const QStringList& theUsedNames = QStringList() );
42 * \brief Find the data object with the specified name.
43 * \param theModule module
45 * \param theObjectKind kind of object
48 static Handle(HYDROData_Entity) FindObjectByName( const Handle(HYDROData_Document)& theDoc,
49 const QString& theName,
50 const ObjectKind theObjectKind = KIND_UNKNOWN );
53 * \brief Find the data objects with the specified names.
54 * \param theModule module
55 * \param theNames list of names
56 * \param theObjectKind kind of object
57 * \return list of data objects
59 static HYDROData_SequenceOfObjects FindObjectsByNames( const Handle(HYDROData_Document)& theDoc,
60 const QStringList& theNames,
61 const ObjectKind theObjectKind = KIND_UNKNOWN );
64 inline bool ValuesEquals( const double& theFirst, const double& theSecond )
66 return theFirst > ( theSecond - Precision::Confusion() ) &&
67 theFirst < ( theSecond + Precision::Confusion() );
70 inline bool ValuesMoreEquals( const double& theFirst, const double& theSecond )
72 return theFirst >= theSecond || ValuesEquals( theFirst, theSecond );
75 inline bool ValuesLessEquals( const double& theFirst, const double& theSecond )
77 return theFirst <= theSecond || ValuesEquals( theFirst, theSecond );