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_CALCULATION );
272 // Dump code to close python fuction
273 if ( aRes && theIsMultiFile )
275 QStringList aFooterScript;
276 aFooterScript << QString( "" );
277 aFooterScript << QString( " pass" );
278 HYDROData_Tool::WriteStringsToFile( aFile, aFooterScript );
284 QString HYDROData_Document::GetDocPyName() const
286 QString aDocName = PYTHON_DOC_NAME;
290 if ( DocumentId( this, aDocId ) )
291 aDocName += "_" + QString::number( aDocId );
297 QStringList HYDROData_Document::DumpToPython( MapOfTreatedObjects& theTreatedObjects,
298 const bool theIsMultiFile ) const
300 QString aDocName = GetDocPyName();
302 // Append document in to the map of treated objects to prevent names overlaping
303 theTreatedObjects.insert( aDocName, this );
306 if ( !DocumentId( this, aDocId ) )
309 QStringList aResScript;
311 aResScript << QString( "from HYDROPy import *" );
312 aResScript << QString( "from PyQt4.QtCore import *" );
313 aResScript << QString( "from PyQt4.QtGui import *" );
315 if ( theIsMultiFile )
317 aResScript << QString( "import salome" );
318 aResScript << QString( "" );
319 aResScript << QString( "def RebuildData( theStudy ):" );
320 aResScript << QString( " %1 = HYDROData_Document.Document( theStudy._get_StudyId() );" ).arg( aDocName );
324 aResScript << QString( "" );
325 aResScript << QString( "%1 = HYDROData_Document.Document( theStudy._get_StudyId() );" ).arg( aDocName );
331 bool HYDROData_Document::dumpPartitionToPython( QFile& theFile,
332 const bool theIsMultiFile,
333 MapOfTreatedObjects& theTreatedObjects,
334 const ObjectKind& theObjectKind ) const
336 if ( !theFile.isOpen() )
339 QTextStream anOutStream( &theFile );
343 HYDROData_Iterator anIterator( this, theObjectKind );
344 for( ; anIterator.More(); anIterator.Next() )
346 Handle(HYDROData_Entity) anObject = anIterator.Current();
347 if ( anObject.IsNull() )
350 QString anObjName = anObject->GetName();
351 if ( theTreatedObjects.contains( anObjName ) )
354 theTreatedObjects.insert( anObjName, anObject );
356 QStringList anObjDump = anObject->DumpToPython( theTreatedObjects );
358 if ( theIsMultiFile )
360 // For multifile dump we use the function, see the document dump header
361 QStringList::iterator anIt = anObjDump.begin();
362 for ( ; anIt != anObjDump.end(); ++anIt )
363 anIt->prepend( " " );
366 HYDROData_Tool::WriteStringsToFile( theFile, anObjDump );
372 bool takeLastDigits( QString& theStr, int& aRes )
377 for ( int i = theStr.length() - 1; i >= 0; --i )
379 const QChar& aChar = theStr.at( i );
380 if ( !aChar.isDigit() )
383 anStrNum.prepend( aChar );
386 if ( anStrNum.isEmpty() )
389 theStr.remove( theStr.length() - anStrNum.length(), anStrNum.length() );
390 aRes = anStrNum.toInt();
395 bool isObjectNameLessThan( const QString& theStr1, const QString& theStr2 )
397 QString aStr1 = theStr1, aStr2 = theStr2;
399 int aNum1 = -1, aNum2 = -1;
400 if ( takeLastDigits( aStr1, aNum1 ) && takeLastDigits( aStr2, aNum2 ) )
402 if ( aStr1 == aStr2 )
403 return aNum1 < aNum2;
406 return theStr1 < theStr2;
409 HYDROData_SequenceOfObjects HYDROData_Document::GetObjectsLayerOrder(
410 const Standard_Boolean theIsAll ) const
412 HYDROData_SequenceOfObjects anOrder;
414 MapOfOrdered aMapOfOrdered;
415 MapOfUnordered aMapOfUnordered;
417 HYDROData_Iterator anIter( this );
418 for ( ; anIter.More(); anIter.Next() )
420 Handle(HYDROData_Entity) anObject = anIter.Current();
421 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
424 Standard_Integer anObjZLevel = -1;
425 if ( anObject->GetZLevel( anObjZLevel ) )
427 aMapOfOrdered.insert( anObjZLevel, anObject );
431 QString anObjName = anObject->GetName();
432 if ( anObjName.isEmpty() )
435 aMapOfUnordered.insert( anObjName, anObject );
439 MapOfOrdered::const_iterator anOrderedMapIt = aMapOfOrdered.constBegin();
440 for ( ; anOrderedMapIt != aMapOfOrdered.constEnd(); anOrderedMapIt++ )
442 const Handle(HYDROData_Entity)& anObject = anOrderedMapIt.value();
443 anOrder.Prepend( anObject );
448 QStringList aSortedNames = aMapOfUnordered.keys();
449 qSort( aSortedNames.begin(), aSortedNames.end(), isObjectNameLessThan );
451 for ( int i = 0; i < aSortedNames.length(); ++i )
453 QString anObjName = aSortedNames.value( i );
455 const Handle(HYDROData_Entity)& anObject = aMapOfUnordered.value( anObjName );
456 anOrder.Append( anObject );
463 void HYDROData_Document::SetObjectsLayerOrder( const HYDROData_SequenceOfObjects& theOrder )
465 // At first we remove previous model order
466 RemoveObjectsLayerOrder();
468 // Make new objects order
469 Standard_Integer aLevel = 0;
470 for ( int i = theOrder.Length(), n = 1; i >= n; --i )
472 const Handle(HYDROData_Entity)& anObject = theOrder.Value( i );
473 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
476 anObject->SetZLevel( aLevel++ );
480 void HYDROData_Document::Show( const Handle_HYDROData_Entity& theObject )
482 HYDROData_SequenceOfObjects anOrder;
483 anOrder.Append( theObject );
487 void HYDROData_Document::Show( const HYDROData_SequenceOfObjects& theObjects )
489 MapOfUnordered aMapOfUnordered;
491 for ( int i = 1, n = theObjects.Length(); i <= n; ++i )
493 const Handle(HYDROData_Entity)& anObject = theObjects.Value( i );
494 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
497 Standard_Integer anObjZLevel = -1;
498 if ( anObject->GetZLevel( anObjZLevel ) )
500 continue; // Skip objects that already have the z-level
504 QString anObjName = anObject->GetName();
505 if ( anObjName.isEmpty() )
508 aMapOfUnordered.insert( anObjName, anObject );
512 if ( aMapOfUnordered.isEmpty() )
513 return; // Nothing to show
515 Standard_Integer aTopId = 0;
517 HYDROData_SequenceOfObjects aModelOrder = GetObjectsLayerOrder( Standard_False );
518 if ( !aModelOrder.IsEmpty() )
520 const Handle(HYDROData_Entity)& anObject = aModelOrder.First();
521 anObject->GetZLevel( aTopId );
525 aTopId += aMapOfUnordered.size() - 1;
527 QStringList aSortedNames = aMapOfUnordered.keys();
528 qSort( aSortedNames.begin(), aSortedNames.end(), isObjectNameLessThan );
530 for ( int i = 0; i < aSortedNames.length(); ++i )
532 QString anObjName = aSortedNames.value( i );
534 const Handle(HYDROData_Entity)& anObject = aMapOfUnordered.value( anObjName );
535 anObject->SetZLevel( aTopId-- );
539 void HYDROData_Document::RemoveObjectsLayerOrder()
541 HYDROData_Iterator anIter( this );
542 for ( ; anIter.More(); anIter.Next() )
544 Handle(HYDROData_Entity) anObject = anIter.Current();
545 if ( anObject.IsNull() || !anObject->IsHas2dPrs() )
548 anObject->RemoveZLevel();
552 void HYDROData_Document::StartOperation()
557 void HYDROData_Document::CommitOperation(const TCollection_ExtendedString& theName)
559 if( !myDoc->CommitCommand() ) // it means that there were no modifications done
562 NewID(); // workaround: do something just to modify the document
563 myDoc->CommitCommand();
565 myTransactionsAfterSave++;
567 if( theName.Length() != 0 )
569 const TDF_DeltaList& aList = GetUndos();
570 if( !aList.IsEmpty() )
572 Handle(TDF_Delta) aDelta = aList.Last();
573 if( !aDelta.IsNull() )
574 aDelta->SetName( theName );
579 void HYDROData_Document::AbortOperation()
581 myDoc->AbortCommand();
584 bool HYDROData_Document::IsOperation()
586 return myDoc->HasOpenCommand() != 0;
589 bool HYDROData_Document::IsModified()
591 return myTransactionsAfterSave != 0;
594 bool HYDROData_Document::CanUndo()
596 return myDoc->GetAvailableUndos() > 0;
599 const TDF_DeltaList& HYDROData_Document::GetUndos()
601 return myDoc->GetUndos();
604 void HYDROData_Document::ClearUndos()
606 return myDoc->ClearUndos();
609 void HYDROData_Document::Undo()
612 myTransactionsAfterSave--;
615 bool HYDROData_Document::CanRedo()
617 return myDoc->GetAvailableRedos() > 0;
620 const TDF_DeltaList& HYDROData_Document::GetRedos()
622 return myDoc->GetRedos();
625 void HYDROData_Document::ClearRedos()
627 return myDoc->ClearRedos();
630 void HYDROData_Document::Redo()
633 myTransactionsAfterSave++;
636 Handle(HYDROData_Entity) HYDROData_Document::CreateObject( const ObjectKind theKind )
638 return HYDROData_Iterator::CreateObject( this, theKind );
641 Handle(HYDROData_Entity) HYDROData_Document::FindObjectByName(
642 const QString& theName,
643 const ObjectKind theObjectKind ) const
645 Handle(HYDROData_Entity) anObject;
646 if ( theName.isEmpty() )
649 QStringList aNamesList;
650 aNamesList << theName;
652 HYDROData_SequenceOfObjects aSeqOfObjs = FindObjectsByNames( aNamesList, theObjectKind );
653 if( aSeqOfObjs.IsEmpty() )
656 anObject = aSeqOfObjs.First();
660 HYDROData_SequenceOfObjects HYDROData_Document::FindObjectsByNames(
661 const QStringList& theNames,
662 const ObjectKind theObjectKind ) const
664 HYDROData_SequenceOfObjects aResSeq;
666 QStringList aNamesList = theNames;
668 HYDROData_Iterator anIter( this, theObjectKind );
669 for( ; anIter.More(); anIter.Next() )
671 Handle(HYDROData_Entity) anObject = anIter.Current();
672 if( anObject.IsNull() )
675 QString anObjName = anObject->GetName();
676 if ( anObjName.isEmpty() || !aNamesList.contains( anObjName ) )
679 aResSeq.Append( anObject );
681 aNamesList.removeAll( anObjName );
682 if ( aNamesList.isEmpty() )
689 HYDROData_Document::HYDROData_Document()
691 HYDROData_Application::GetApplication()->NewDocument("BinOcaf", myDoc);
692 myDoc->SetUndoLimit(UNDO_LIMIT);
693 NewID(); // needed to have at least one attribute in initial document to avoid errors
694 myTransactionsAfterSave = 0;
698 myInterpolatorsFactory = 0;
701 HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
704 myTransactionsAfterSave = 0;
708 myInterpolatorsFactory = 0;
711 HYDROData_Document::~HYDROData_Document()
715 int HYDROData_Document::NewID()
717 TDF_Label anIDLab = myDoc->Main().FindChild(TAG_PROPS).
718 FindChild(TAG_PROPS_NEW_ID);
719 Handle(TDataStd_Integer) anInt;
720 if (!anIDLab.FindAttribute(TDataStd_Integer::GetID(), anInt)) {
721 anInt = TDataStd_Integer::Set(anIDLab, 0);
723 // just increment value and return
724 anInt->Set(anInt->Get() + 1);
728 TDF_Label HYDROData_Document::LabelOfObjects()
730 return myDoc->Main().FindChild(TAG_OBJECTS);
733 TDF_Label HYDROData_Document::LabelOfLocalCS() const
735 return myDoc->Main().FindChild(TAG_LOCAL_CS);
738 void HYDROData_Document::GetLocalCS( double& theLX, double& theLY ) const
740 TDF_Label aLocalCSLab = LabelOfLocalCS();
742 Handle( TDataXtd_Position ) aLocalCS;
743 if( aLocalCSLab.FindAttribute( TDataXtd_Position::GetID(), aLocalCS ) )
745 gp_Pnt aLocalCS3d = aLocalCS->GetPosition();
746 theLX = aLocalCS3d.X();
747 theLY = aLocalCS3d.Y();
751 theLX = DEFAULT_LOCAL_CS.X();
752 theLY = DEFAULT_LOCAL_CS.Y();
756 void HYDROData_Document::SetLocalCS( double theLX, double theLY )
760 // update the local CS data in attribute
761 TDF_Label aLocalCSLab = LabelOfLocalCS();
762 Handle( TDataXtd_Position ) aLocalCS;
763 if( !aLocalCSLab.FindAttribute( TDataXtd_Position::GetID(), aLocalCS ) )
764 aLocalCS = TDataXtd_Position::Set( aLocalCSLab );
766 gp_Pnt aLocalCS3d( theLX, theLY, 0 );
767 aLocalCS->SetPosition( aLocalCS3d );
769 // calculate delta for coordinates
770 double aDX = myLX - theLX;
771 double aDY = myLY - theLY;
773 // update the local CS data in internal fields
777 //update all objects in the document
778 HYDROData_Iterator anIterator( this, KIND_UNKNOWN );
779 for( ; anIterator.More(); anIterator.Next() )
780 anIterator.Current()->UpdateLocalCS( aDX, aDY );
783 void HYDROData_Document::UpdateLCSFields() const
785 if( myLX >= 0 && myLY >= 0 )
789 GetLocalCS( aLX, aLY );
790 HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
795 void HYDROData_Document::Transform( double& X, double& Y, bool IsToLocalCS ) const
810 void HYDROData_Document::Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const
812 double X = thePnt.X();
813 double Y = thePnt.Y();
814 double Z = thePnt.Z();
815 Transform( X, Y, IsToLocalCS );
816 thePnt = gp_Pnt( X, Y, Z );
819 void HYDROData_Document::Transform( gp_XYZ& thePnt, bool IsToLocalCS ) const
821 double X = thePnt.X();
822 double Y = thePnt.Y();
823 double Z = thePnt.Z();
824 Transform( X, Y, IsToLocalCS );
825 thePnt = gp_XYZ( X, Y, Z );
828 void HYDROData_Document::Transform( gp_XY& thePnt, bool IsToLocalCS ) const
830 double X = thePnt.X();
831 double Y = thePnt.Y();
832 Transform( X, Y, IsToLocalCS );
833 thePnt = gp_XY( X, Y );
836 HYDROData_InterpolatorsFactory* HYDROData_Document::GetInterpolatorsFactory()
838 if ( !myInterpolatorsFactory ) {
839 myInterpolatorsFactory = new HYDROData_InterpolatorsFactory();
842 return myInterpolatorsFactory;
845 HYDROData_IProfilesInterpolator* HYDROData_Document::GetInterpolator( const TCollection_AsciiString& theName ) const
847 HYDROData_IProfilesInterpolator* anInterpolator = NULL;
849 HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
850 HYDROData_InterpolatorsFactory* aFactory = aThat->GetInterpolatorsFactory();
852 anInterpolator = aFactory->GetInterpolator( theName );
855 return anInterpolator;
858 NCollection_Sequence<TCollection_AsciiString> HYDROData_Document::GetInterpolatorNames() const
860 NCollection_Sequence<TCollection_AsciiString> aNames;
862 HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
863 HYDROData_InterpolatorsFactory* aFactory = aThat->GetInterpolatorsFactory();
865 aNames = aFactory->GetInterpolatorNames();