]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
operators are moved to the tool class
authorasl <asl@opencascade.com>
Wed, 14 Oct 2015 08:27:56 +0000 (11:27 +0300)
committerasl <asl@opencascade.com>
Wed, 14 Oct 2015 08:27:56 +0000 (11:27 +0300)
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Entity.h
src/HYDROData/HYDROData_Tool.cxx
src/HYDROData/HYDROData_Tool.h
src/HYDRO_tests/test_HYDROData_Main.cxx
src/HYDRO_tests/test_HYDROData_StricklerTable.cxx

index eb977ea8270007301a696b820b4db1db93fac6ed..2086ccf10f3e8dd03fa9e5f4a360c0e963e81de5 100644 (file)
 #include <QStringList>
 #include <QVariant>
 
+HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects()
+  : NCollection_Sequence<Handle_HYDROData_Entity>()
+{
+}
+
+HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects( const HYDROData_SequenceOfObjects& theSequence )
+  : NCollection_Sequence<Handle_HYDROData_Entity>( theSequence )
+{
+}
+
+HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects( const NCollection_Sequence<Handle_HYDROData_Entity>& theSequence )
+  : NCollection_Sequence<Handle_HYDROData_Entity>( theSequence )
+{
+}
+
+
 static const Standard_GUID GUID_MUST_BE_UPDATED("80f2bb81-3873-4631-8ddd-940d2119f000");
 
 IMPLEMENT_STANDARD_HANDLE(HYDROData_Entity,MMgt_TShared)
index 9b715c18ea53064829f98f47a15b3a488389fffa..243a41a271e649ed337e21f73f21441a55de7a51 100644 (file)
@@ -70,9 +70,17 @@ const ObjectKind KIND_LAST              = KIND_LAND_COVER;
 
 DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared)
 
-typedef QMap<QString,Handle(Standard_Transient)> MapOfTreatedObjects;
+class MapOfTreatedObjects : public QMap<QString,Handle(Standard_Transient)>
+{
+};
 
-typedef NCollection_Sequence<Handle_HYDROData_Entity> HYDROData_SequenceOfObjects;
+class HYDRODATA_EXPORT HYDROData_SequenceOfObjects : public NCollection_Sequence<Handle_HYDROData_Entity>
+{
+public:
+  HYDROData_SequenceOfObjects();
+  HYDROData_SequenceOfObjects( const HYDROData_SequenceOfObjects& );
+  HYDROData_SequenceOfObjects( const NCollection_Sequence<Handle_HYDROData_Entity>& );
+};
 
 ///! Is Equal for HYDROData_Entity mapping
 HYDRODATA_EXPORT bool IsEqual(const Handle_HYDROData_Entity& theObj1, const Handle_HYDROData_Entity& theObj2);
index 48b9340f1593568871997f6892d3ea3375a6bc2a..404e19aa44a688de5ada8e1e5d67d511cfbc3d06 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#include "HYDROData_Tool.h"
-
-#include "HYDROData_ArtificialObject.h"
-#include "HYDROData_Image.h"
-#include "HYDROData_Iterator.h"
-#include "HYDROData_NaturalObject.h"
-#include "HYDROData_ShapesGroup.h"
-
+#include <HYDROData_Tool.h>
+#include <HYDROData_ArtificialObject.h>
+#include <HYDROData_Document.h>
+#include <HYDROData_Entity.h>
+#include <HYDROData_Iterator.h>
+#include <HYDROData_NaturalObject.h>
+#include <HYDROData_ShapesGroup.h>
+#include <QColor>
 #include <QFile>
 #include <QStringList>
 #include <QTextStream>
-
-#include <limits>
-#include <gp_Pnt.hxx>
-#include <gp_Pln.hxx>
-#include <ElSLib.hxx>
-#include <TopAbs_State.hxx>
+#include <BRep_Tool.hxx>
 #include <BRepAdaptor_Surface.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
-#include <BRep_Tool.hxx>
+#include <ElSLib.hxx>
 #include <Geom_Curve.hxx>
+#include <gp_Pln.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
 #include <TopoDS_Wire.hxx>
-#include <TopExp_Explorer.hxx>
 
 static int aMaxNameId = std::numeric_limits<int>::max();
 
@@ -304,3 +302,29 @@ QString HYDROData_Tool::toQString( const TCollection_ExtendedString& theStr )
 {
   return QString( (QChar*)theStr.ToExtString(), theStr.Length() );
 }
+
+std::ostream& operator<<( std::ostream& theStream, const QString& theText )
+{
+  theStream << theText.toStdString();
+  return theStream;
+}
+
+std::ostream& operator<<( std::ostream& theStream, const QColor& theColor )
+{
+  theStream << "[" << theColor.red() << ", " << theColor.green() << ", " << theColor.blue() << "]";
+  return theStream;
+}
+
+std::ostream& operator<<( std::ostream& theStream, const TopoDS_Shape& theShape )
+{
+  theStream << "[" << theShape.TShape().operator->() << "]";
+  return theStream;
+}
+
+std::ostream& operator<<( std::ostream& theStream, const TopoDS_Face& theFace )
+{
+  theStream << "[" << theFace.TShape().operator->() << "]";
+  return theStream;
+}
+
+
index 93de80d564f435a431112d557bb2733749b32179..761f9ec86e7134db9010be51f1ce817948647db2 100644 (file)
 #define HYDROData_Tool_HeaderFile
 
 #include "HYDROData.h"
-#include "HYDROData_Entity.h"
-
-#include <Precision.hxx>
-
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <QString>
 #include <QStringList>
-#include <gp_XY.hxx>
-#include <TopoDS_Face.hxx>
+#include <Precision.hxx>
 
+class Handle_HYDROData_Document;
+class Handle_HYDROData_Entity;
+class HYDROData_SequenceOfObjects;
+class MapOfTreatedObjects;
+class gp_XY;
+class QColor;
 class QFile;
-class TopoDS_Shape;
-class TopTools_SequenceOfShape;
-class Handle(HYDROData_Document);
+class TCollection_ExtendedString;
+enum TopAbs_State;
 class TopoDS_Edge;
+class TopoDS_Face;
+class TopoDS_Shape;
 class TopoDS_Wire;
+class TopTools_SequenceOfShape;
 
 class HYDRODATA_EXPORT HYDROData_Tool {
 
@@ -50,7 +50,7 @@ public:
    * 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 );
+  static void                           SetMustBeUpdatedObjects( const Handle_HYDROData_Document& theDoc );
 
   /**
    * \brief Generate name for new object.
@@ -60,17 +60,17 @@ 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,
-                                                            const QString&                    thePrefix,
-                                                            const QStringList&                theUsedNames = QStringList(),
-                                                            const bool                        theIsTryToUsePurePrefix = false );
+  static QString                        GenerateObjectName( const Handle_HYDROData_Document& theDoc,
+                                                            const QString&                   thePrefix,
+                                                            const QStringList&               theUsedNames = QStringList(),
+                                                            const bool                       theIsTryToUsePurePrefix = false );
 
   /**
    * \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.
@@ -80,7 +80,7 @@ public:
    */
   static void                           UpdateChildObjectName( const QString&                  theOldStr,
                                                                const QString&                  theNewStr,
-                                                               const Handle(HYDROData_Entity)& theObject );
+                                                               const Handle_HYDROData_Entity& theObject );
 
 
   /**
@@ -137,8 +137,10 @@ inline  bool ValuesLessEquals( const double& theFirst, const double& theSecond )
   return theFirst <= theSecond || ValuesEquals( theFirst, theSecond );
 }
 
-
-
+HYDRODATA_EXPORT std::ostream& operator<<( std::ostream& theStream, const QString& theText );
+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 );
 
 #endif
 
index 66fcdafc3fee9f735325afc6ae630f190ed154f7..157fee69a0e2cf241ddc35421b9a77624b0ee465 100644 (file)
 #include <SUIT_Session.h>
 #include <QApplication>
 #include <QColor>
-
-std::ostream& operator<<( std::ostream& theStream, const QString& theText )
-{
-  theStream << theText.toStdString();
-  return theStream;
-}
-
-std::ostream& operator<<( std::ostream& theStream, const QColor& theColor )
-{
-  theStream << "[" << theColor.red() << ", " << theColor.green() << ", " << theColor.blue() << "]";
-  return theStream;
-}
 #include <time.h>
 
 int main( int argc, char* argv[] )
@@ -90,6 +78,6 @@ int main( int argc, char* argv[] )
     return 0;
   }
 
-  //anApp.exec();
+  anApp.exec();
   return result.wasSuccessful() ? 0 : 1;
 }
index 4c0b5f80a3e17f4bcb607bd901e79d839737a635..f59a19122998a49061d8f8517c194b2e9d8e83bf 100644 (file)
 #include <test_HYDROData_StricklerTable.h>
 #include <HYDROData_Document.h>
 #include <HYDROData_StricklerTable.h>
+#include <HYDROData_Tool.h>
 #include <QStringList>
 #include <QColor>
 #include <QDir>
-#include <operators.h>
 
 const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt";