Salome HOME
#refs 522 (very draft) //import only
[modules/hydro.git] / src / HYDROData / HYDROData_Document.cxx
index eed420ed5ee83edfae6b908d96071406125c579b..7c9773ba065bbda794f090dc6bd689c2ba954a04 100644 (file)
@@ -24,6 +24,7 @@
 #include <HYDROData_Application.h>
 #include <HYDROData_Iterator.h>
 #include <HYDROData_Tool.h>
+#include <HYDROData_InterpolatorsFactory.h>
 
 #include <TDataStd_Integer.hxx>
 #include <TDataXtd_Position.hxx>
@@ -668,6 +669,8 @@ HYDROData_Document::HYDROData_Document()
   myTransactionsAfterSave = 0;
   myLX = -1;
   myLY = -1;
+
+  myInterpolatorsFactory = 0;
 }
 
 HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
@@ -676,6 +679,8 @@ HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
   myTransactionsAfterSave = 0;
   myLX = -1;
   myLY = -1;
+
+  myInterpolatorsFactory = 0;
 }
 
 HYDROData_Document::~HYDROData_Document()
@@ -802,3 +807,38 @@ void HYDROData_Document::Transform( gp_XY& thePnt, bool IsToLocalCS ) const
   Transform( X, Y, IsToLocalCS );
   thePnt = gp_XY( X, Y ); 
 }
+
+HYDROData_InterpolatorsFactory* HYDROData_Document::GetInterpolatorsFactory()
+{
+  if ( !myInterpolatorsFactory ) {
+    myInterpolatorsFactory = new HYDROData_InterpolatorsFactory();
+  }
+
+  return myInterpolatorsFactory;
+}
+
+HYDROData_IProfilesInterpolator* HYDROData_Document::GetInterpolator( const TCollection_AsciiString& theName ) const
+{
+  HYDROData_IProfilesInterpolator* anInterpolator = NULL;
+
+  HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
+  HYDROData_InterpolatorsFactory* aFactory = aThat->GetInterpolatorsFactory();
+  if ( aFactory ) {
+    anInterpolator = aFactory->GetInterpolator( theName );
+  }
+
+  return anInterpolator;
+}
+NCollection_Sequence<TCollection_AsciiString> HYDROData_Document::GetInterpolatorNames() const
+{
+  NCollection_Sequence<TCollection_AsciiString> aNames;
+
+  HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
+  HYDROData_InterpolatorsFactory* aFactory = aThat->GetInterpolatorsFactory();
+  if ( aFactory ) {
+    aNames = aFactory->GetInterpolatorNames();
+  }
+
+  return aNames;
+}
\ No newline at end of file