HYDROData_VisualState.h
HYDROData_Warning.h
HYDROData_Zone.h
- HYDROData_GeomTool.h
- HYDROData_IProfilesInterpolator.h
- HYDROData_LinearInterpolator.h
- HYDROData_InterpolatorsFactory.h
+ HYDROData_GeomTool.h
+ HYDROData_IProfilesInterpolator.h
+ HYDROData_LinearInterpolator.h
+ HYDROData_InterpolatorsFactory.h
)
set(PROJECT_SOURCES
HYDROData_Transform.cxx
HYDROData_VisualState.cxx
HYDROData_Zone.cxx
- HYDROData_GeomTool.cxx
- HYDROData_IProfilesInterpolator.cxx
- HYDROData_LinearInterpolator.cxx
- HYDROData_InterpolatorsFactory.cxx
+ HYDROData_GeomTool.cxx
+ HYDROData_IProfilesInterpolator.cxx
+ HYDROData_LinearInterpolator.cxx
+ HYDROData_InterpolatorsFactory.cxx
)
add_definitions(
}
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
#include <TDocStd_Document.hxx>
class HYDROData_InterpolatorsFactory;
+class HYDROData_IProfilesInterpolator;
class QFile;
class gp_Pnt2d;
//! Returns interpolator factory instance
HYDRODATA_EXPORT HYDROData_InterpolatorsFactory* GetInterpolatorsFactory();
+ //! Get the appropriate interpolator by the name.
+ HYDRODATA_EXPORT HYDROData_IProfilesInterpolator* GetInterpolator( const TCollection_AsciiString& theName ) const;
+
+ //! Get list of registered interpolator names.
+ HYDRODATA_EXPORT NCollection_Sequence<TCollection_AsciiString> GetInterpolatorNames() const;
+
protected:
friend class HYDROData_Iterator;
#include "HYDROData_IProfilesInterpolator.h"
+#include <gp_XYZ.hxx>
const int DEFAULT_RESULT_PROFILES_NB = 1; ///< default number of results profiles
{
}
-void HYDROData_IProfilesInterpolator::SetProfiles( const std::vector<double> theProfile1, const std::vector<double> theProfile2 )
+void HYDROData_IProfilesInterpolator::SetProfiles( const std::vector<double> theProfile1,
+ const std::vector<double> theProfile2 )
{
myProfile1 = theProfile1;
myProfile2 = theProfile2;
}
-void HYDROData_IProfilesInterpolator::SetParameter( const std::string& theName, const std::string& theValue )
+void HYDROData_IProfilesInterpolator::SetProfiles( const NCollection_Sequence<gp_XYZ>& theProfile1,
+ const NCollection_Sequence<gp_XYZ>& theProfile2 )
{
- myParameters[theName] = theValue;
+ // The first profile
+ for ( int i = theProfile1.Lower(); i <= theProfile1.Upper(); i++ ) {
+ const gp_XYZ& aPnt = theProfile1.Value( i );
+ myProfile1.push_back( aPnt.X() );
+ myProfile1.push_back( aPnt.Y() );
+ myProfile1.push_back( aPnt.Z() );
+ }
+
+ // The second profile
+ for ( int i = theProfile2.Lower(); i <= theProfile2.Upper(); i++ ) {
+ const gp_XYZ& aPnt = theProfile2.Value( i );
+ myProfile2.push_back( aPnt.X() );
+ myProfile2.push_back( aPnt.Y() );
+ myProfile2.push_back( aPnt.Z() );
+ }
+}
+
+void HYDROData_IProfilesInterpolator::SetParameter( const TCollection_AsciiString& theName,
+ const TCollection_AsciiString& theValue )
+{
+ myParameters[theName.ToCString()] = theValue.ToCString();
}
InterpolationError HYDROData_IProfilesInterpolator::GetErrorCode() const
myErrorCode = theError;
}
-std::string HYDROData_IProfilesInterpolator::GetErrorMessage() const
+TCollection_AsciiString HYDROData_IProfilesInterpolator::GetErrorMessage() const
{
- return myErrorMessage;
+ return TCollection_AsciiString(myErrorMessage.c_str());
}
void HYDROData_IProfilesInterpolator::SetErrorMessage( const std::string& theMessage )
return myResultProfiles.size();
}
-std::vector<double> HYDROData_IProfilesInterpolator::GetResultProfile( const int theProfileIndex ) const
+std::vector<double> HYDROData_IProfilesInterpolator::GetResultProfileCoords( const int theProfileIndex ) const
{
std::vector<double> aResultProfile;
return aResultProfile;
}
+NCollection_Sequence<gp_XYZ> HYDROData_IProfilesInterpolator::GetResultProfilePoints( const int theProfileIndex ) const
+{
+ return GetPoints( GetResultProfileCoords( theProfileIndex ) );
+}
+
void HYDROData_IProfilesInterpolator::Reset()
{
// Reset input parameters
ClearResults();
}
-std::vector<double> HYDROData_IProfilesInterpolator::GetFirstProfile() const
+std::vector<double> HYDROData_IProfilesInterpolator::GetFirstProfileCoords() const
{
return myProfile1;
}
-std::vector<double> HYDROData_IProfilesInterpolator::GetSecondProfile() const
+std::vector<double> HYDROData_IProfilesInterpolator::GetSecondProfileCoords() const
{
return myProfile2;
}
void HYDROData_IProfilesInterpolator::InsertResultProfile( const std::vector<double>& theProfile )
{
myResultProfiles.push_back( theProfile );
+}
+
+void HYDROData_IProfilesInterpolator::InsertResultProfile( const NCollection_Sequence<gp_XYZ>& theProfile )
+{
+ std::vector<double> aCoords;
+
+ for ( int i = theProfile.Lower(); i <= theProfile.Upper(); i++ ) {
+ const gp_XYZ& aPnt = theProfile.Value( i );
+ aCoords.push_back( aPnt.X() );
+ aCoords.push_back( aPnt.Y() );
+ aCoords.push_back( aPnt.Z() );
+ }
+
+ myResultProfiles.push_back( aCoords );
+}
+
+NCollection_Sequence<gp_XYZ> HYDROData_IProfilesInterpolator::GetFirstProfilePoints() const
+{
+ return GetPoints( GetFirstProfileCoords() );
+}
+
+NCollection_Sequence<gp_XYZ> HYDROData_IProfilesInterpolator::GetSecondProfilePoints() const
+{
+ return GetPoints( GetSecondProfileCoords() );
+}
+
+NCollection_Sequence<gp_XYZ> HYDROData_IProfilesInterpolator::GetPoints( const std::vector<double>& theCoords ) const
+{
+ NCollection_Sequence<gp_XYZ> aProfilePoints;
+
+ int aNbCoords = (int) theCoords.size();
+ div_t aDiv = std::div( aNbCoords, 3 );
+ if ( aDiv.rem == 0 ) {
+ for ( int i = 0; i < aNbCoords; i += 3 ) {
+ aProfilePoints.Append( gp_XYZ( theCoords[i], theCoords[i+1], theCoords[i+2] ) );
+ }
+ }
+
+ return aProfilePoints;
}
\ No newline at end of file
#include "HYDROData.h"
+#include <TCollection_AsciiString.hxx>
+#include <NCollection_Sequence.hxx>
+
#include <string>
#include <vector>
#include <map>
+class gp_XYZ;
+
/**
* Errors that could appear on interpolation calculations.
* Get description of the interpolation algorithm.
* \return the description string
*/
- HYDRODATA_EXPORT virtual std::string GetDescription() const = 0;
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetDescription() const = 0;
/**
* Set profiles as vectors of point coordinates [x1, y1, z1, x2, y2, z2, ...].
*/
HYDRODATA_EXPORT virtual void SetProfiles( const std::vector<double> theProfile1, const std::vector<double> theProfile2 );
+ /**
+ * Set profiles as sequences of gp_XYZ points.
+ * \param theProfile1 the first profile points
+ * \param theProfile1 the second profile points
+ */
+ HYDRODATA_EXPORT virtual void SetProfiles( const NCollection_Sequence<gp_XYZ>& theProfile1,
+ const NCollection_Sequence<gp_XYZ>& theProfile2 );
+
/**
* Set number of profiles to compute.
* \param theNumber the number of profiles to be computed
* \param the parameter name
* \param the parameter value
*/
- HYDRODATA_EXPORT virtual void SetParameter( const std::string& theName, const std::string& theValue );
+ HYDRODATA_EXPORT virtual void SetParameter( const TCollection_AsciiString& theName,
+ const TCollection_AsciiString& theValue );
/**
* Get the last error code.
* Get string description of the last error.
* \return the string description
*/
- HYDRODATA_EXPORT virtual std::string GetErrorMessage() const;
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetErrorMessage() const;
/**
* Reset interpolator state: both input and output data are reset.
/**
* Get number of calculated profiles ( could be less than the number of profiles to be computed set as a parameter ).
- * @return the number of really calculated profiles
+ * \return the number of really calculated profiles
*/
HYDRODATA_EXPORT virtual int GetCalculatedProfilesNumber() const;
/**
- * Get result profile by index.
+ * Get result profile by index as a vector of point coordinates [x1, y1, z1, x2, y2, z2, ...].
* \param theProfileIndex the profile index [0, <number of profiles to compute>]
* \return the profile with the given index or empty vector if the index is out of range
*/
- HYDRODATA_EXPORT std::vector<double> GetResultProfile( const int theProfileIndex ) const;
+ HYDRODATA_EXPORT std::vector<double> GetResultProfileCoords( const int theProfileIndex ) const;
+
+ /**
+ * Get result profile by index as a sequence of gp_XYZ points.
+ * \param theProfileIndex the profile index [0, <number of profiles to compute>]
+ * \return the profile with the given index or empty sequence if the index is out of range
+ */
+ HYDRODATA_EXPORT NCollection_Sequence<gp_XYZ> GetResultProfilePoints( const int theProfileIndex ) const;
protected:
/**
HYDRODATA_EXPORT virtual void SetErrorMessage( const std::string& theMessage );
/**
- * Get the first profile.
+ * Get the first profile coordinates.
+ * \return the first profile points
+ */
+ HYDRODATA_EXPORT std::vector<double> GetFirstProfileCoords() const;
+
+ /**
+ * Get the second profile coordinates.
+ * \return the second profile points
+ */
+ HYDRODATA_EXPORT std::vector<double> GetSecondProfileCoords() const;
+
+ /**
+ * Get the first profile points.
* \return the first profile points
*/
- HYDRODATA_EXPORT std::vector<double> GetFirstProfile() const;
+ HYDRODATA_EXPORT NCollection_Sequence<gp_XYZ> GetFirstProfilePoints() const;
/**
- * Get the second profile.
+ * Get the second profile points.
* \return the second profile points
*/
- HYDRODATA_EXPORT std::vector<double> GetSecondProfile() const;
+ HYDRODATA_EXPORT NCollection_Sequence<gp_XYZ> GetSecondProfilePoints() const;
/**
* Get number of profiles to compute.
HYDRODATA_EXPORT void ClearResults();
/**
- * Insert the calculated profile to the resuls.
- * \param theProfile the profile to insert
+ * Insert the calculated profile to the resuls as a list of coordinates.
+ * \param theProfile the list of coordinates [x1, y1, z1, x2, y2, z2, ...]
*/
HYDRODATA_EXPORT void InsertResultProfile( const std::vector<double>& theProfile );
+ /**
+ * Insert the calculated profile to the resuls as a list of points.
+ * \param theProfile the list of points gp_XYZ
+ */
+ HYDRODATA_EXPORT void InsertResultProfile( const NCollection_Sequence<gp_XYZ>& theProfile );
+
+private:
+ NCollection_Sequence<gp_XYZ> GetPoints( const std::vector<double>& theCoords ) const;
+
private:
std::vector<double> myProfile1, myProfile2; ///< the two input profiles
int myResultProfilesNumber; ///< the number of profiles to compute
{
}
-HYDROData_IProfilesInterpolator* HYDROData_InterpolatorsFactory::GetInterpolator( const std::string& theName ) const
+HYDROData_IProfilesInterpolator* HYDROData_InterpolatorsFactory::GetInterpolator( const TCollection_AsciiString& theName ) const
{
HYDROData_IProfilesInterpolator* anInterpolator = NULL;
- FactoryInterpolators::const_iterator anIt = myInterpolators.find(theName);
+ FactoryInterpolators::const_iterator anIt = myInterpolators.find(theName.ToCString());
if ( anIt != myInterpolators.end() ) {
anInterpolator = anIt->second;
}
return anInterpolator;
}
-std::vector<std::string> HYDROData_InterpolatorsFactory::GetInterpolatorNames() const
+NCollection_Sequence<TCollection_AsciiString> HYDROData_InterpolatorsFactory::GetInterpolatorNames() const
{
- std::vector<std::string> aNames;
+ NCollection_Sequence<TCollection_AsciiString> aNames;
FactoryInterpolators::const_iterator anIt = myInterpolators.begin();
for ( ; anIt != myInterpolators.end(); anIt++ ) {
- aNames.push_back( anIt->first );
+ aNames.Append( anIt->first.c_str() );
}
return aNames;
#include <HYDROData.h>
+#include <TCollection_AsciiString.hxx>
+#include <NCollection_Sequence.hxx>
+
#include <string>
-#include <vector>
#include <map>
class HYDROData_IProfilesInterpolator;
-/**\class HYDROData_InterpolatorsFactory
+/**
+ * \class HYDROData_InterpolatorsFactory
*
* \brief Profile interpolators factory.
*
{
public:
+ /**
+ * Public constructor.
+ */
HYDROData_InterpolatorsFactory();
+
+ /**
+ * Public virtual destructor.
+ */
virtual ~HYDROData_InterpolatorsFactory();
/**
* Registers the interpolator of a certain type with the given name.
* \param theName the interpolator name used as identifier
*/
- template <class T> /*HYDRODATA_EXPORT */void Register( const std::string& theName )
+ template <class T> /*HYDRODATA_EXPORT */void Register( const TCollection_AsciiString& theName )
{
- myInterpolators[theName] = new T();
+ myInterpolators[theName.ToCString()] = new T();
}
/**
* \param theName name of the interpolator
* \returns the appropriate interpolator or NULL if interpolator with such name is not registered
*/
- HYDRODATA_EXPORT HYDROData_IProfilesInterpolator* GetInterpolator( const std::string& theName ) const;
+ HYDRODATA_EXPORT HYDROData_IProfilesInterpolator* GetInterpolator( const TCollection_AsciiString& theName ) const;
/**
* Get list of registered interpolator names.
* \return the list of unique names
*/
- HYDRODATA_EXPORT std::vector<std::string> GetInterpolatorNames() const;
+ HYDRODATA_EXPORT NCollection_Sequence<TCollection_AsciiString> GetInterpolatorNames() const;
private:
//! Map that stores all interpolators, identified by interpolator name (string)
{
}
-std::string HYDROData_LinearInterpolator::GetDescription() const
+TCollection_AsciiString HYDROData_LinearInterpolator::GetDescription() const
{
- std::string aDescription( "Simple linear interpolator" );
+ TCollection_AsciiString aDescription( "Simple linear interpolator" );
return aDescription;
}
ClearResults();
// Check input data
- std::vector<double> aProfile1 = GetFirstProfile();
- std::vector<double> aProfile2 = GetSecondProfile();
+ std::vector<double> aProfile1 = GetFirstProfileCoords();
+ std::vector<double> aProfile2 = GetSecondProfileCoords();
int aNbProfilesToCompute = GetNbProfilesToCompute();
int aSize1 = aProfile1.size();
/**
*
*/
- HYDRODATA_EXPORT virtual std::string GetDescription() const;
+ HYDRODATA_EXPORT virtual TCollection_AsciiString GetDescription() const;
/**
*
for ( int aProfileInd = 0; aProfileInd < theInterpolator->GetCalculatedProfilesNumber(); aProfileInd++ ) {
// Get calculated point coordinates
- std::vector<double> aResultCoords = theInterpolator->GetResultProfile( aProfileInd );
- div_t aDiv = std::div( aResultCoords.size(), 3 );
- if ( aDiv.rem != 0 ) {
+ HYDROData_Profile::ProfilePoints aResultPoints = theInterpolator->GetResultProfilePoints( aProfileInd );
+ if ( aResultPoints.IsEmpty() ) {
isOK = false;
continue;
}
-
+
// Create profile object
Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast( aDocument->CreateObject( KIND_PROFILE ) );
aProfile->SetName( aName );
// Fill the profile with points
- HYDROData_Profile::ProfilePoints aProfilePoints;
-
- int aPointsNb = aDiv.quot;
- for ( int aPointInd = 0; aPointInd <= aPointsNb - 1; aPointInd++ ) {
- int anXindex = aPointInd * 3;
- double anX = aResultCoords[ anXindex ];
- double anY = aResultCoords[ anXindex + 1 ];
- double aZ = aResultCoords[ anXindex + 2 ];
-
- aProfilePoints.Append( gp_XYZ( anX, anY, aZ ) );
- }
-
- aProfile->SetProfilePoints( aProfilePoints );
+ aProfile->SetProfilePoints( aResultPoints );
// Add profile to the stream
bool isAdded = AddProfile( aProfile );
commitDocOperation();
else
{
- errMessage = tr( "CALCULATE_ERROR" ), QString( anIterp->GetErrorMessage().c_str() );
+ errMessage = tr( "CALCULATE_ERROR" ), QString( HYDROGUI_Tool::ToQString( anIterp->GetErrorMessage() ) );
abortDocOperation();
}
}
theInt->SetResultProfilesNumber( aDlg->profileNumber() );
theInt->SetProfiles( profile( aDlg->profileStart() ), profile( aDlg->profileFinish() ) );
ParamsList aParams = parameters( aDlg->interpolatorParameters() );
- for ( ParamsList::Iterator it = aParams.begin(); it != aParams.end(); ++it )
- theInt->SetParameter( (*it).first.toStdString(), (*it).second.toStdString() );
+ for ( ParamsList::Iterator it = aParams.begin(); it != aParams.end(); ++it ) {
+ theInt->SetParameter( HYDROGUI_Tool::ToAsciiString( (*it).first ),
+ HYDROGUI_Tool::ToAsciiString( (*it).second ) );
+ }
}
-std::vector<double> HYDROGUI_ProfileInterpolateOp::profile( const QString& theName ) const
+HYDROData_Profile::ProfilePoints HYDROGUI_ProfileInterpolateOp::profile( const QString& theName ) const
{
- std::vector<double> aPoints;
+ HYDROData_Profile::ProfilePoints aPoints;
Handle(HYDROData_Profile) aProf = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), theName, KIND_PROFILE ) );
if ( !aProf.IsNull() )
{
- HYDROData_Profile::ProfilePoints aPntList = aProf->GetProfilePoints();
- for ( int i = aPntList.Lower(); i <= aPntList.Upper(); i++ )
- {
- HYDROData_Profile::ProfilePoint aPnt = aPntList.Value( i );
- aPoints.push_back( aPnt.X() );
- aPoints.push_back( aPnt.Y() );
- aPoints.push_back( aPnt.Z() );
- }
+ aPoints = aProf->GetProfilePoints();
}
return aPoints;
}
QStringList aNames;
if ( anIFactory )
{
- std::vector<std::string> iNames = anIFactory->GetInterpolatorNames();
- for ( std::vector<std::string>::iterator it = iNames.begin(); it != iNames.end(); ++it )
- aNames.append( (*it).c_str() );
+ NCollection_Sequence<TCollection_AsciiString> iNames = anIFactory->GetInterpolatorNames();
+ for ( int i = 1, n = iNames.Size(); i <= n; ++i ) {
+ const TCollection_AsciiString& anInterpName = iNames.Value( i );
+ aNames.append( HYDROGUI_Tool::ToQString( anInterpName ) );
+ }
}
return aNames;
HYDROData_IProfilesInterpolator* aRes = 0;
if ( anIFactory )
- aRes = anIFactory->GetInterpolator( theName.toStdString() );
+ aRes = anIFactory->GetInterpolator( HYDROGUI_Tool::ToAsciiString( theName ) );
return aRes;
}
aBuilder.MakeCompound( aPreviewShape );
for ( int i = 0; i < theInterp->GetCalculatedProfilesNumber(); i++ )
{
- NCollection_Sequence<gp_XYZ> pointSeq;
- std::vector<double> aPoints = theInterp->GetResultProfile( i );
- for ( int i = 0; i < (int) aPoints.size(); i += 3 )
- pointSeq.Append( gp_XYZ( aPoints[i], aPoints[i+1], aPoints[i+2] ) );
+ NCollection_Sequence<gp_XYZ> pointSeq = theInterp->GetResultProfilePoints( i );
+
TopoDS_Shape aWire = HYDROData_PolylineXY::BuildWire( HYDROData_IPolyline::SECTION_SPLINE, false, pointSeq );
if ( !aWire.IsNull() )
aBuilder.Add( aPreviewShape, aWire );
if ( !aPanel || !anInterp )
return;
- aPanel->setInterpolatorDescription( QString( anInterp->GetDescription().c_str() ) );
+ aPanel->setInterpolatorDescription( HYDROGUI_Tool::ToQString( anInterp->GetDescription() ) );
updatePreview();
}
QStringList interpolators() const;
HYDROData_IProfilesInterpolator* interpolator( const QString& ) const;
void updateInterpolator( HYDROData_IProfilesInterpolator* );
- std::vector<double> profile( const QString& ) const;
+ HYDROData_Profile::ProfilePoints profile( const QString& ) const;
ParamsList parameters( const QString& ) const;
QString parameters( const ParamsList& ) const;
HYDROData_CalculationCase.sip
HYDROData_Document.sip
HYDROData_Application.sip
+ HYDROData_IProfilesInterpolator.sip
)
# --- sources ---
%Include HYDROData_Zone.sip
%Include HYDROData_Region.sip
%Include HYDROData_CalculationCase.sip
+%Include HYDROData_IProfilesInterpolator.sip
%Include HYDROData_Document.sip
%Include HYDROData_Application.sip
void SetLocalCS( double, double );
+ //! Get the appropriate interpolator by the name.
+ HYDROData_IProfilesInterpolator* GetInterpolator( const TCollection_AsciiString& theName ) const;
+
+ //! Get list of registered interpolator names.
+ NCollection_Sequence<TCollection_AsciiString> GetInterpolatorNames() const;
+
protected:
//! Creates new document: private because "Document" method must be used instead of direct creation.
--- /dev/null
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%ExportedHeaderCode
+#include <HYDROData_IProfilesInterpolator.h>
+%End
+
+/**
+ * Errors that could appear on interpolation calculations.
+ * If there is no error, it is "OK".
+ */
+enum InterpolationError {
+ OK = 0, ///< success
+ InvalidParametersError, ///< input parameters are invalid
+ UnknownError ///< problem has unknown nature
+};
+
+/**\class HYDROData_IProfilesInterpolator
+ * \brief The base class to provide interface for profiles interpolation.
+ */
+class HYDROData_IProfilesInterpolator
+{
+%TypeHeaderCode
+#include <HYDROData_IProfilesInterpolator.h>
+%End
+
+public:
+
+ /**
+ * Public constructor.
+ */
+ HYDROData_IProfilesInterpolator();
+
+ /**
+ * Public virtual destructor.
+ */
+ virtual ~HYDROData_IProfilesInterpolator();
+
+public:
+
+ /**
+ * Get description of the interpolation algorithm.
+ * \return the description string
+ */
+ virtual TCollection_AsciiString GetDescription() const = 0;
+
+ /**
+ * Set profiles as sequences of gp_XYZ points.
+ * \param theProfile1 the first profile points
+ * \param theProfile1 the second profile points
+ */
+ virtual void SetProfiles( const NCollection_Sequence<gp_XYZ>& theProfile1,
+ const NCollection_Sequence<gp_XYZ>& theProfile2 );
+
+ /**
+ * Set number of profiles to compute.
+ * \param theNumber the number of profiles to be computed
+ */
+ virtual void SetResultProfilesNumber( const int theNumber );
+
+ /**
+ * Set the additional parameter.
+ * \param the parameter name
+ * \param the parameter value
+ */
+ virtual void SetParameter( const TCollection_AsciiString& theName, const TCollection_AsciiString& theValue );
+
+ /**
+ * Get the last error code.
+ * \return the error code from InterpolationError enumeration
+ */
+ virtual InterpolationError GetErrorCode() const;
+
+ /**
+ * Get string description of the last error.
+ * \return the string description
+ */
+ virtual TCollection_AsciiString GetErrorMessage() const;
+
+ /**
+ * Reset interpolator state: both input and output data are reset.
+ */
+ virtual void Reset();
+
+public:
+ /**
+ * Perform interpolation calculations.
+ */
+ virtual void Calculate() = 0;
+
+ /**
+ * Get number of calculated profiles ( could be less than the number of profiles to be computed set as a parameter ).
+ * \return the number of really calculated profiles
+ */
+ virtual int GetCalculatedProfilesNumber() const;
+
+ /**
+ * Get result profile by index.
+ * \param theProfileIndex the profile index [0, <number of profiles to compute>]
+ * \return the profile with the given index or empty vector if the index is out of range
+ */
+ NCollection_Sequence<gp_XYZ> GetResultProfilePoints( const int theProfileIndex ) const;
+
+protected:
+
+ /**
+ * Get the first profile points.
+ * \return the first profile points
+ */
+ NCollection_Sequence<gp_XYZ> GetFirstProfilePoints() const;
+
+ /**
+ * Get the second profile points.
+ * \return the second profile points
+ */
+ NCollection_Sequence<gp_XYZ> GetSecondProfilePoints() const;
+
+ /**
+ * Insert the calculated profile to the resuls as a list of points.
+ * \param theProfile the list of points gp_XYZ
+ */
+ void InsertResultProfile( const NCollection_Sequence<gp_XYZ>& theProfile );
+};
}
%End
+ /**
+ * Add interpolated profiles into the stream.
+ * \param theInterpolator the interpolator
+ * \return true in case of success
+ */
+ virtual bool Interpolate( HYDROData_IProfilesInterpolator* theInterpolator );
+
protected:
/**
* Creates new object in the internal data structure. Use higher level objects