1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include <HYDROData_Document.h>
20 #include <HYDROData_Application.h>
21 #include <HYDROData_Iterator.h>
22 #include <HYDROData_Tool.h>
23 #include <HYDROData_InterpolatorsFactory.h>
25 #include <TDataStd_Real.hxx>
26 #include <TDataStd_Integer.hxx>
27 #include <TDataXtd_Position.hxx>
29 #include <TDF_Delta.hxx>
34 #include <QStringList>
35 #include <QTextStream>
37 IMPLEMENT_STANDARD_HANDLE(HYDROData_Document,MMgt_TShared)
38 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Document,MMgt_TShared)
40 #define PYTHON_DOC_NAME "hydro_doc"
42 static const int UNDO_LIMIT = 10; // number of possible undo operations in the module
44 static const int TAG_PROPS = 1; // general properties tag
45 static const int TAG_PROPS_NEW_ID = 1; // general properties: tag for storage of the new object ID
46 static const int TAG_OBJECTS = 2; // tag of the objects sub-tree
47 static const int TAG_HISTORY = 3; // tag of the history sub-tree (Root for History)
48 static const int TAG_LOCAL_CS = 4; // tag of local coordinate system information
49 static const int TAG_DEF_STRICKLER_COEFF = 5; // tag of default strickler coefficient
50 static const gp_Pnt2d DEFAULT_LOCAL_CS( 0, 0 );
54 typedef QMap<Standard_Integer,Handle_HYDROData_Entity> MapOfOrdered;
55 typedef QMap<QString,Handle_HYDROData_Entity> MapOfUnordered;
57 Handle(HYDROData_Document) HYDROData_Document::Document(const int theStudyID)
59 Handle(HYDROData_Document) aResult =
60 HYDROData_Application::GetApplication()->GetDocument(theStudyID);
61 if (aResult.IsNull()) {
62 aResult = new HYDROData_Document();
63 HYDROData_Application::GetApplication()->AddDocument(theStudyID, aResult);
68 Handle(HYDROData_Document) HYDROData_Document::Document(
69 const TDF_Label& theObjectLabel )
71 Handle(HYDROData_Document) aResDoc;
72 if ( theObjectLabel.IsNull() )
75 Handle(TDocStd_Document) anObjDoc;
78 anObjDoc = TDocStd_Document::Get( theObjectLabel );
84 if ( anObjDoc.IsNull() )
87 HYDROData_Application* anApp = HYDROData_Application::GetApplication();
89 DataMapOfStudyIDDocument::Iterator aMapIt( anApp->myDocuments );
90 for ( ; aMapIt.More(); aMapIt.Next() )
92 Handle(HYDROData_Document) anAppDoc = aMapIt.Value();
93 if ( anAppDoc.IsNull() || anAppDoc->myDoc != anObjDoc )
103 bool HYDROData_Document::HasDocument(const int theStudyID)
105 Handle(HYDROData_Document) aResult =
106 HYDROData_Application::GetApplication()->GetDocument(theStudyID);
107 return !aResult.IsNull();
110 bool HYDROData_Document::DocumentId(const Handle(HYDROData_Document)& theDocument,
113 return HYDROData_Application::GetApplication()->GetDocumentId(theDocument, theDocId);
116 Data_DocError HYDROData_Document::Load(const char* theFileName, const int theStudyID)
118 Handle(TDocStd_Document) aResult;
119 TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
120 PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
123 aStatus = HYDROData_Application::GetApplication()->Open (aPath, aResult);
125 catch (Standard_Failure)
127 if (!aResult.IsNull()) {
128 aResult->SetUndoLimit(UNDO_LIMIT);
129 HYDROData_Application::GetApplication()->AddDocument(theStudyID, new HYDROData_Document(aResult));
132 Data_DocError anError;
135 anError = DocError_OK;
137 case PCDM_RS_NoDriver:
138 case PCDM_RS_UnknownFileDriver:
139 case PCDM_RS_NoSchema:
140 case PCDM_RS_DriverFailure:
141 case PCDM_RS_WrongResource:
142 anError = DocError_ResourcesProblem;
144 case PCDM_RS_OpenError:
145 case PCDM_RS_NoDocument:
146 case PCDM_RS_WrongStreamMode:
147 case PCDM_RS_PermissionDenied:
148 anError = DocError_CanNotOpen;
150 case PCDM_RS_NoVersion:
151 anError = DocError_InvalidVersion;
153 case PCDM_RS_ExtensionFailure:
154 case PCDM_RS_FormatFailure:
155 case PCDM_RS_TypeFailure:
156 case PCDM_RS_TypeNotFoundInSchema:
157 case PCDM_RS_UnrecognizedFileFormat:
158 anError = DocError_InvalidFormat;
160 case PCDM_RS_MakeFailure:
162 anError = DocError_UnknownProblem;
168 Data_DocError HYDROData_Document::Save(const char* theFileName)
170 TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
171 PCDM_StoreStatus aStatus;
173 aStatus = HYDROData_Application::GetApplication()->SaveAs (myDoc, aPath);
175 catch (Standard_Failure) {}
176 myTransactionsAfterSave = 0;
177 Standard::Purge(); // Release free memory
180 Data_DocError anError;
183 anError = DocError_OK;
185 case PCDM_SS_DriverFailure:
186 anError = DocError_ResourcesProblem;
188 case PCDM_SS_WriteFailure:
189 //case PCDM_SS_DiskWritingFailure:
190 //case PCDM_SS_UserRightsFailure:
191 anError = DocError_CanNotOpen;
194 anError = DocError_UnknownProblem;
200 void HYDROData_Document::Close()
203 HYDROData_Application::GetApplication()->RemoveDocument(this);
206 double HYDROData_Document::GetDefaultStricklerCoefficient() const
209 TDF_Label aLabel = myDoc->Main().FindChild(TAG_DEF_STRICKLER_COEFF, Standard_False);
210 if ( !aLabel.IsNull() )
212 Handle(TDataStd_Real) anAttr;
213 if ( aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
214 aRes = anAttr->Get();
220 void HYDROData_Document::SetDefaultStricklerCoefficient( double theCoeff ) const
222 TDF_Label aLabel = myDoc->Main().FindChild(TAG_DEF_STRICKLER_COEFF);
223 if ( !aLabel.IsNull() )
225 Handle(TDataStd_Real) anAttr;
226 if ( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
227 aLabel.AddAttribute( anAttr = new TDataStd_Real() );
228 anAttr->Set( theCoeff );
232 bool HYDROData_Document::DumpToPython( const QString& theFileName,
233 const bool theIsMultiFile ) const
235 // Try to open the file
236 QFile aFile( theFileName );
237 if ( !aFile.open( QIODevice::WriteOnly ) )
240 MapOfTreatedObjects aTreatedObjects;
242 // Dump header for python script
243 QStringList aHeaderDump = DumpToPython( aTreatedObjects, theIsMultiFile );
244 if ( aHeaderDump.isEmpty() )
247 HYDROData_Tool::WriteStringsToFile( aFile, aHeaderDump );
251 // Dump the local CS data to Python
253 QString aLCS = QString( "%1.SetLocalCS( %2, %3 )" ).arg( GetDocPyName() ).arg( myLX ).arg( myLY );
256 HYDROData_Tool::WriteStringsToFile( aFile, QStringList() << aLCS );
258 // Dump all model objects to Python script
259 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_IMAGE );
260 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_STRICKLER_TABLE );
261 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_POLYLINEXY );
262 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_BATHYMETRY );
263 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_PROFILE );
264 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_POLYLINE );
265 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_IMMERSIBLE_ZONE );
266 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_STREAM );
267 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_CHANNEL );
268 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_DIGUE );
269 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_OBSTACLE );
270 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_LAND_COVER_MAP );
271 aRes = aRes && dumpPartitionToPython( aFile, theIsMultiFile, aTreatedObjects, KIND_CALCULATION );
273 // Dump code to close python fuction
274 if ( aRes && theIsMultiFile )
276 QStringList aFooterScript;
277 aFooterScript << QString( "" );
278 aFooterScript << QString( " pass" );
279 HYDROData_Tool::WriteStringsToFile( aFile, aFooterScript );
285 QString HYDROData_Document::GetDocPyName() const
287 QString aDocName = PYTHON_DOC_NAME;
291 if ( DocumentId( this, aDocId ) )
292 aDocName += "_" + QString::number( aDocId );
298 QStringList HYDROData_Document::DumpToPython( MapOfTreatedObjects& theTreatedObjects,
299 const bool theIsMultiFile ) const
301 QString aDocName = GetDocPyName();
303 // Append document in to the map of treated objects to prevent names overlaping
304 theTreatedObjects.insert( aDocName, this );
307 if ( !DocumentId( this, aDocId ) )
310 QStringList aResScript;
312 aResScript << QString( "from HYDROPy import *" );
313 aResScript << QString( "from PyQt4.QtCore import *" );
314 aResScript << QString( "from PyQt4.QtGui import *" );
316 if ( theIsMultiFile )
318 aResScript << QString( "import salome" );
319 aResScript << QString( "" );
320 aResScript << QString( "def RebuildData( theStudy ):" );
321 aResScript << QString( " %1 = HYDROData_Document.Document( theStudy._get_StudyId() );" ).arg( aDocName );
325 aResScript << QString( "" );
326 aResScript << QString( "%1 = HYDROData_Document.Document( theStudy._get_StudyId() );" ).arg( aDocName );
332 bool HYDROData_Document::dumpPartitionToPython( QFile& theFile,
333 const bool theIsMultiFile,
334 MapOfTreatedObjects& theTreatedObjects,
335 const ObjectKind& theObjectKind ) const
337 if ( !theFile.isOpen() )
340 QTextStream anOutStream( &theFile );
344 HYDROData_Iterator anIterator( this, theObjectKind );
345 for( ; anIterator.More(); anIterator.Next() )
347 Handle(HYDROData_Entity) anObject = anIterator.Current();
348 if ( anObject.IsNull() )
351 QString anObjName = anObject->GetName();
352 if ( theTreatedObjects.contains( anObjName ) )
355 theTreatedObjects.insert( anObjName, anObject );
357 QStringList anObjDump = anObject->DumpToPython( theTreatedObjects );
359 if ( theIsMultiFile )
361 // For multifile dump we use the function, see the document dump header
362 QStringList::iterator anIt = anObjDump.begin();
363 for ( ; anIt != anObjDump.end(); ++anIt )
364 anIt->prepend( " " );
367 HYDROData_Tool::WriteStringsToFile( theFile, anObjDump );
373 bool takeLastDigits( QString& theStr, int& aRes )
378 for ( int i = theStr.length() - 1; i >= 0; --i )
380 const QChar& aChar = theStr.at( i );
381 if ( !aChar.isDigit() )
384 anStrNum.prepend( aChar );
387 if ( anStrNum.isEmpty() )
390 theStr.remove( theStr.length() - anStrNum.length(), anStrNum.length() );
391 aRes = anStrNum.toInt();
396 bool isObjectNameLessThan( const QString& theStr1, const QString& theStr2 )
398 QString aStr1 = theStr1, aStr2 = theStr2;
400 int aNum1 = -1, aNum2 = -1;
401 if ( takeLastDigits( aStr1, aNum1 ) && takeLastDigits( aStr2, aNum2 ) )
403 if ( aStr1 == aStr2 )
404 return aNum1 < aNum2;
407 return theStr1 < theStr2;
410 HYDROData_SequenceOfObjects HYDROData_Document::GetObjectsLayerOrder(
411 const Standard_Boolean theIsAll ) const
413 HYDROData_SequenceOfObjects anOrder;
415 MapOfOrdered aMapOfOrdered;
416 MapOfUnordered aMapOfUnordered;
418 HYDROData_Iterator anIter( this );
419 for ( ; anIter.More(); anIter.Next() )
421 Handle(HYDROData_Entity) anObject = anIter.Current();
422 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
425 Standard_Integer anObjZLevel = -1;
426 if ( anObject->GetZLevel( anObjZLevel ) )
428 aMapOfOrdered.insert( anObjZLevel, anObject );
432 QString anObjName = anObject->GetName();
433 if ( anObjName.isEmpty() )
436 aMapOfUnordered.insert( anObjName, anObject );
440 MapOfOrdered::const_iterator anOrderedMapIt = aMapOfOrdered.constBegin();
441 for ( ; anOrderedMapIt != aMapOfOrdered.constEnd(); anOrderedMapIt++ )
443 const Handle(HYDROData_Entity)& anObject = anOrderedMapIt.value();
444 anOrder.Prepend( anObject );
449 QStringList aSortedNames = aMapOfUnordered.keys();
450 qSort( aSortedNames.begin(), aSortedNames.end(), isObjectNameLessThan );
452 for ( int i = 0; i < aSortedNames.length(); ++i )
454 QString anObjName = aSortedNames.value( i );
456 const Handle(HYDROData_Entity)& anObject = aMapOfUnordered.value( anObjName );
457 anOrder.Append( anObject );
464 void HYDROData_Document::SetObjectsLayerOrder( const HYDROData_SequenceOfObjects& theOrder )
466 // At first we remove previous model order
467 RemoveObjectsLayerOrder();
469 // Make new objects order
470 Standard_Integer aLevel = 0;
471 for ( int i = theOrder.Length(), n = 1; i >= n; --i )
473 const Handle(HYDROData_Entity)& anObject = theOrder.Value( i );
474 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
477 anObject->SetZLevel( aLevel++ );
481 void HYDROData_Document::Show( const Handle_HYDROData_Entity& theObject )
483 HYDROData_SequenceOfObjects anOrder;
484 anOrder.Append( theObject );
488 void HYDROData_Document::Show( const HYDROData_SequenceOfObjects& theObjects )
490 MapOfUnordered aMapOfUnordered;
492 for ( int i = 1, n = theObjects.Length(); i <= n; ++i )
494 const Handle(HYDROData_Entity)& anObject = theObjects.Value( i );
495 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
498 Standard_Integer anObjZLevel = -1;
499 if ( anObject->GetZLevel( anObjZLevel ) )
501 continue; // Skip objects that already have the z-level
505 QString anObjName = anObject->GetName();
506 if ( anObjName.isEmpty() )
509 aMapOfUnordered.insert( anObjName, anObject );
513 if ( aMapOfUnordered.isEmpty() )
514 return; // Nothing to show
516 Standard_Integer aTopId = 0;
518 HYDROData_SequenceOfObjects aModelOrder = GetObjectsLayerOrder( Standard_False );
519 if ( !aModelOrder.IsEmpty() )
521 const Handle(HYDROData_Entity)& anObject = aModelOrder.First();
522 anObject->GetZLevel( aTopId );
526 aTopId += aMapOfUnordered.size() - 1;
528 QStringList aSortedNames = aMapOfUnordered.keys();
529 qSort( aSortedNames.begin(), aSortedNames.end(), isObjectNameLessThan );
531 for ( int i = 0; i < aSortedNames.length(); ++i )
533 QString anObjName = aSortedNames.value( i );
535 const Handle(HYDROData_Entity)& anObject = aMapOfUnordered.value( anObjName );
536 anObject->SetZLevel( aTopId-- );
540 void HYDROData_Document::RemoveObjectsLayerOrder()
542 HYDROData_Iterator anIter( this );
543 for ( ; anIter.More(); anIter.Next() )
545 Handle(HYDROData_Entity) anObject = anIter.Current();
546 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
549 anObject->RemoveZLevel();
553 void HYDROData_Document::StartOperation()
558 void HYDROData_Document::CommitOperation(const TCollection_ExtendedString& theName)
560 if( !myDoc->CommitCommand() ) // it means that there were no modifications done
563 NewID(); // workaround: do something just to modify the document
564 myDoc->CommitCommand();
566 myTransactionsAfterSave++;
568 if( theName.Length() != 0 )
570 const TDF_DeltaList& aList = GetUndos();
571 if( !aList.IsEmpty() )
573 Handle(TDF_Delta) aDelta = aList.Last();
574 if( !aDelta.IsNull() )
575 aDelta->SetName( theName );
580 void HYDROData_Document::AbortOperation()
582 myDoc->AbortCommand();
585 bool HYDROData_Document::IsOperation()
587 return myDoc->HasOpenCommand() != 0;
590 bool HYDROData_Document::IsModified()
592 return myTransactionsAfterSave != 0;
595 bool HYDROData_Document::CanUndo()
597 return myDoc->GetAvailableUndos() > 0;
600 const TDF_DeltaList& HYDROData_Document::GetUndos()
602 return myDoc->GetUndos();
605 void HYDROData_Document::ClearUndos()
607 return myDoc->ClearUndos();
610 void HYDROData_Document::Undo()
613 myTransactionsAfterSave--;
616 bool HYDROData_Document::CanRedo()
618 return myDoc->GetAvailableRedos() > 0;
621 const TDF_DeltaList& HYDROData_Document::GetRedos()
623 return myDoc->GetRedos();
626 void HYDROData_Document::ClearRedos()
628 return myDoc->ClearRedos();
631 void HYDROData_Document::Redo()
634 myTransactionsAfterSave++;
637 Handle(HYDROData_Entity) HYDROData_Document::CreateObject( const ObjectKind theKind )
639 return HYDROData_Iterator::CreateObject( this, theKind );
642 Handle(HYDROData_Entity) HYDROData_Document::FindObjectByName(
643 const QString& theName,
644 const ObjectKind theObjectKind ) const
646 Handle(HYDROData_Entity) anObject;
647 if ( theName.isEmpty() )
650 QStringList aNamesList;
651 aNamesList << theName;
653 HYDROData_SequenceOfObjects aSeqOfObjs = FindObjectsByNames( aNamesList, theObjectKind );
654 if( aSeqOfObjs.IsEmpty() )
657 anObject = aSeqOfObjs.First();
661 HYDROData_SequenceOfObjects HYDROData_Document::FindObjectsByNames(
662 const QStringList& theNames,
663 const ObjectKind theObjectKind ) const
665 HYDROData_SequenceOfObjects aResSeq;
667 QStringList aNamesList = theNames;
669 HYDROData_Iterator anIter( this, theObjectKind );
670 for( ; anIter.More(); anIter.Next() )
672 Handle(HYDROData_Entity) anObject = anIter.Current();
673 if( anObject.IsNull() )
676 QString anObjName = anObject->GetName();
677 if ( anObjName.isEmpty() || !aNamesList.contains( anObjName ) )
680 aResSeq.Append( anObject );
682 aNamesList.removeAll( anObjName );
683 if ( aNamesList.isEmpty() )
690 HYDROData_Document::HYDROData_Document()
692 HYDROData_Application::GetApplication()->NewDocument("BinOcaf", myDoc);
693 myDoc->SetUndoLimit(UNDO_LIMIT);
694 NewID(); // needed to have at least one attribute in initial document to avoid errors
695 myTransactionsAfterSave = 0;
699 myInterpolatorsFactory = 0;
702 HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
705 myTransactionsAfterSave = 0;
709 myInterpolatorsFactory = 0;
712 HYDROData_Document::~HYDROData_Document()
716 int HYDROData_Document::NewID()
718 TDF_Label anIDLab = myDoc->Main().FindChild(TAG_PROPS).
719 FindChild(TAG_PROPS_NEW_ID);
720 Handle(TDataStd_Integer) anInt;
721 if (!anIDLab.FindAttribute(TDataStd_Integer::GetID(), anInt)) {
722 anInt = TDataStd_Integer::Set(anIDLab, 0);
724 // just increment value and return
725 anInt->Set(anInt->Get() + 1);
729 TDF_Label HYDROData_Document::LabelOfObjects()
731 return myDoc->Main().FindChild(TAG_OBJECTS);
734 TDF_Label HYDROData_Document::LabelOfLocalCS() const
736 return myDoc->Main().FindChild(TAG_LOCAL_CS);
739 void HYDROData_Document::GetLocalCS( double& theLX, double& theLY ) const
741 TDF_Label aLocalCSLab = LabelOfLocalCS();
743 Handle( TDataXtd_Position ) aLocalCS;
744 if( aLocalCSLab.FindAttribute( TDataXtd_Position::GetID(), aLocalCS ) )
746 gp_Pnt aLocalCS3d = aLocalCS->GetPosition();
747 theLX = aLocalCS3d.X();
748 theLY = aLocalCS3d.Y();
752 theLX = DEFAULT_LOCAL_CS.X();
753 theLY = DEFAULT_LOCAL_CS.Y();
757 void HYDROData_Document::SetLocalCS( double theLX, double theLY )
761 // update the local CS data in attribute
762 TDF_Label aLocalCSLab = LabelOfLocalCS();
763 Handle( TDataXtd_Position ) aLocalCS;
764 if( !aLocalCSLab.FindAttribute( TDataXtd_Position::GetID(), aLocalCS ) )
765 aLocalCS = TDataXtd_Position::Set( aLocalCSLab );
767 gp_Pnt aLocalCS3d( theLX, theLY, 0 );
768 aLocalCS->SetPosition( aLocalCS3d );
770 // calculate delta for coordinates
771 double aDX = myLX - theLX;
772 double aDY = myLY - theLY;
774 // update the local CS data in internal fields
778 //update all objects in the document
779 HYDROData_Iterator anIterator( this, KIND_UNKNOWN );
780 for( ; anIterator.More(); anIterator.Next() )
781 anIterator.Current()->UpdateLocalCS( aDX, aDY );
784 void HYDROData_Document::UpdateLCSFields() const
786 if( myLX >= 0 && myLY >= 0 )
790 GetLocalCS( aLX, aLY );
791 HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
796 void HYDROData_Document::Transform( double& X, double& Y, bool IsToLocalCS ) const
811 void HYDROData_Document::Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const
813 double X = thePnt.X();
814 double Y = thePnt.Y();
815 double Z = thePnt.Z();
816 Transform( X, Y, IsToLocalCS );
817 thePnt = gp_Pnt( X, Y, Z );
820 void HYDROData_Document::Transform( gp_XYZ& thePnt, bool IsToLocalCS ) const
822 double X = thePnt.X();
823 double Y = thePnt.Y();
824 double Z = thePnt.Z();
825 Transform( X, Y, IsToLocalCS );
826 thePnt = gp_XYZ( X, Y, Z );
829 void HYDROData_Document::Transform( gp_XY& thePnt, bool IsToLocalCS ) const
831 double X = thePnt.X();
832 double Y = thePnt.Y();
833 Transform( X, Y, IsToLocalCS );
834 thePnt = gp_XY( X, Y );
837 HYDROData_InterpolatorsFactory* HYDROData_Document::GetInterpolatorsFactory()
839 if ( !myInterpolatorsFactory ) {
840 myInterpolatorsFactory = new HYDROData_InterpolatorsFactory();
843 return myInterpolatorsFactory;
846 HYDROData_IProfilesInterpolator* HYDROData_Document::GetInterpolator( const TCollection_AsciiString& theName ) const
848 HYDROData_IProfilesInterpolator* anInterpolator = NULL;
850 HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
851 HYDROData_InterpolatorsFactory* aFactory = aThat->GetInterpolatorsFactory();
853 anInterpolator = aFactory->GetInterpolator( theName );
856 return anInterpolator;
859 NCollection_Sequence<TCollection_AsciiString> HYDROData_Document::GetInterpolatorNames() const
861 NCollection_Sequence<TCollection_AsciiString> aNames;
863 HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
864 HYDROData_InterpolatorsFactory* aFactory = aThat->GetInterpolatorsFactory();
866 aNames = aFactory->GetInterpolatorNames();