Salome HOME
refs #1830: Progress dialog for the interpolation of bathymetry.
[modules/hydro.git] / src / HYDROData / HYDROData_Tool.h
old mode 100644 (file)
new mode 100755 (executable)
index db72e3f..0047995
 #include "HYDROData.h"
 #include <QStringList>
 #include <Precision.hxx>
+#include <QVector>
+#include <TopTools_SequenceOfShape.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <Message_ProgressIndicator.hxx>
 
-class Handle_HYDROData_Document;
-class Handle_HYDROData_Entity;
+
+class HYDROData_PolylineXY;
+class HYDROData_Document;
+class HYDROData_Entity;
 class HYDROData_SequenceOfObjects;
 class MapOfTreatedObjects;
 class gp_XY;
 class QColor;
 class QFile;
 class TCollection_ExtendedString;
+
 #ifdef WIN32
   enum TopAbs_State;
 #else
@@ -40,22 +47,25 @@ class TopoDS_Edge;
 class TopoDS_Face;
 class TopoDS_Shape;
 class TopoDS_Wire;
-class TopTools_SequenceOfShape;
+class Quantity_Color;
+class QColor;
 
 class HYDRODATA_EXPORT HYDROData_Tool {
 
+public:
+  enum ExecStatus
+  {
+    None,
+    Running,
+    Finished
+  };
+
 public:
 
   static void                           WriteStringsToFile( QFile&             theFile,
                                                             const QStringList& theStrings,
                                                             const QString&     theSep = "\n" );
 
-  /**
-   * Enables "MustBeUpdated" flag for objects that are depended on "MustBeUpdated" objects.
-   * \param theDoc document where this operation is performed
-   */
-  static void                           SetMustBeUpdatedObjects( const Handle_HYDROData_Document& theDoc );
-
   /**
    * \brief Generate name for new object.
    * \param theDoc document
@@ -64,17 +74,20 @@ public:
    * \param theIsTryToUsePurePrefix if true - the prefix will be returned if the name equal to the prefix is not busy
    * \return generated name
    */
-  static QString                        GenerateObjectName( const Handle_HYDROData_Document& theDoc,
+  static QString GenerateObjectName( const Handle(HYDROData_Document)& theDoc,
                                                             const QString&                   thePrefix,
                                                             const QStringList&               theUsedNames = QStringList(),
                                                             const bool                       theIsTryToUsePurePrefix = false );
+  
+
+  static bool ExtractGeneratedObjectName(const QString& theName, int& outValue, QString& thePrefName);
 
   /**
    * \brief Checks the type of object.
    * \param theObject object to check
    * \return true if object is geometry object
    */
-  static bool                           IsGeometryObject( const Handle_HYDROData_Entity& theObject );
+  static bool                           IsGeometryObject( const Handle(HYDROData_Entity)& theObject );
 
   /**
    * \brief Updates the child object name.
@@ -84,7 +97,7 @@ public:
    */
   static void                           UpdateChildObjectName( const QString&                  theOldStr,
                                                                const QString&                  theNewStr,
-                                                               const Handle_HYDROData_Entity& theObject );
+                                                               const Handle(HYDROData_Entity)& theObject );
 
 
   /**
@@ -99,8 +112,8 @@ public:
   * Computes Point State from TopAbs (simplified & limited method).
   */
 
- static TopAbs_State                    ComputePointState( const gp_XY& thePnt2d, 
-                                                              const TopoDS_Face& theFace );
 static TopAbs_State                    ComputePointState( const gp_XY& thePnt2d, 
+                                                           const TopoDS_Face& theFace );
 
   static double GetAltitudeForEdge( const TopoDS_Edge& theEdge,
                                     const gp_XY& thePoint,
@@ -123,6 +136,37 @@ public:
 
   static TCollection_ExtendedString toExtString( const QString& );
   static QString                    toQString( const TCollection_ExtendedString& );
+
+  static Quantity_Color toOccColor( const QColor& );
+  static QColor toQtColor( const Quantity_Color& );
+
+  static QColor GenerateRandColor();
+  static bool GenerateNonRepeatableRandColors(int nbColorsToGen, QVector<QColor>& theColors);
+  static void GenerateRepeatableRandColors(int nbColorsToGen, QVector<QColor>& theColors);
+
+  static bool IsNan( double theValue );
+  static bool IsInf( double theValue );
+
+  /**
+  Rebuilds shape container (like compound/compsolid/shell) which contains faces (shared or nonshared with each other)
+  */
+  static TopoDS_Shape RebuildCmp(const TopoDS_Shape& in);
+
+  static TopoDS_Shape PolyXY2Face(const Handle(HYDROData_PolylineXY)& aPolyline);
+
+  static void SetSIProgress(const Handle(Message_ProgressIndicator)& thePI);
+  static const Handle(Message_ProgressIndicator)& GetSIProgress();
+
+  static void SetZIProgress(const Handle(Message_ProgressIndicator)& thePI);
+  static const Handle(Message_ProgressIndicator)& GetZIProgress();
+
+  static void SetTriangulationStatus(const ExecStatus& theStatus);
+  static const ExecStatus& GetTriangulationStatus();
+
+private:
+  static Handle(Message_ProgressIndicator)& StricklerInterpolationProgress();
+  static Handle(Message_ProgressIndicator)& BathymetryInterpolationProgress();
+  static ExecStatus myTriangulationStatus;
 };
 
 inline bool ValuesEquals( const double& theFirst, const double& theSecond )
@@ -145,6 +189,8 @@ HYDRODATA_EXPORT std::ostream& operator<<( std::ostream& theStream, const QStrin
 HYDRODATA_EXPORT std::ostream& operator<<( std::ostream& theStream, const QColor& theText );
 HYDRODATA_EXPORT std::ostream& operator<<( std::ostream& theStream, const TopoDS_Shape& theShape );
 HYDRODATA_EXPORT std::ostream& operator<<( std::ostream& theStream, const TopoDS_Face& theFace );
+HYDRODATA_EXPORT bool operator == ( const gp_XY& thePoint1, const gp_XY& thePoint2 );
+HYDRODATA_EXPORT std::ostream& operator<<( std::ostream& theStream, const gp_XY& theXY );
 
 #endif