LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Zone.cc)
SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Zone.cc)
+ LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_IInterpolator.cc)
+ SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_IInterpolator.cc)
+
LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPygp_XYZ.cc)
SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPygp_XYZ.cc)
HYDROData_DummyObject3D.h
HYDROData_Entity.h
HYDROData_IAltitudeObject.h
+ HYDROData_IInterpolator.h
HYDROData_Image.h
HYDROData_ImmersibleZone.h
HYDROData_IPolyline.h
HYDROData_DummyObject3D.cxx
HYDROData_Entity.cxx
HYDROData_IAltitudeObject.cxx
+ HYDROData_IInterpolator.cxx
HYDROData_Image.cxx
HYDROData_ImmersibleZone.cxx
HYDROData_IPolyline.cxx
return aResAltitude;
}
+ HYDROData_IInterpolator* aZoneInterpolator = theZone->GetInterpolator();
if ( aZoneMergeType == HYDROData_Zone::Merge_Object )
{
Handle(HYDROData_IAltitudeObject) aMergeAltitude = theZone->GetMergeAltitude();
if ( !aMergeAltitude.IsNull() )
- aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+ {
+ if ( aZoneInterpolator != NULL )
+ {
+ aZoneInterpolator->SetAltitudeObject( aMergeAltitude );
+ aResAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
+ }
+ else
+ aResAltitude = aMergeAltitude->GetAltitudeForPoint( thePoint );
+ }
}
else
{
if ( anObjAltitude.IsNull() )
continue;
- double aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
+ double aPointAltitude = 0.0;
+ if ( aZoneInterpolator != NULL )
+ {
+ aZoneInterpolator->SetAltitudeObject( anObjAltitude );
+ aPointAltitude = aZoneInterpolator->GetAltitudeForPoint( thePoint );
+ }
+ else
+ aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
+
if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
continue;
--- /dev/null
+
+#include "HYDROData_IInterpolator.h"
+
+#include <gp_XY.hxx>
+
+HYDROData_IInterpolator::HYDROData_IInterpolator()
+{
+}
+
+HYDROData_IInterpolator::~HYDROData_IInterpolator()
+{
+}
+
+void HYDROData_IInterpolator::SetAltitudeObject(
+ const Handle(HYDROData_IAltitudeObject)& theAltitude )
+{
+ myAltitudeObject = theAltitude;
+}
+
+Handle(HYDROData_IAltitudeObject) HYDROData_IInterpolator::GetAltitudeObject() const
+{
+ return myAltitudeObject;
+}
+
+double HYDROData_IInterpolator::GetAltitudeForPoint(
+ const double theCoordX, const double theCoordY ) const
+{
+ return myAltitudeObject.IsNull() ? HYDROData_IAltitudeObject::GetInvalidAltitude() :
+ myAltitudeObject->GetAltitudeForPoint( gp_XY( theCoordX, theCoordY ) );
+}
+
+double HYDROData_IInterpolator::GetAltitudeForPoint( const gp_XY& thePoint ) const
+{
+ return GetAltitudeForPoint( thePoint.X(), thePoint.Y() );
+}
\ No newline at end of file
--- /dev/null
+
+#ifndef HYDROData_IInterpolator_HeaderFile
+#define HYDROData_IInterpolator_HeaderFile
+
+#include "HYDROData_IAltitudeObject.h"
+
+class gp_XY;
+
+/**\class HYDROData_IInterpolator
+ * \brief The base class to provide interface for interpolation.
+ */
+class HYDROData_IInterpolator
+{
+public:
+
+ /**
+ * Public empty constructor.
+ */
+ HYDRODATA_EXPORT HYDROData_IInterpolator();
+
+ /**
+ * Public virtual destructor.
+ */
+ virtual HYDRODATA_EXPORT ~HYDROData_IInterpolator();
+
+public:
+
+ /**
+ * Returns the altitude value for given point.
+ * Reimplement this method in order to change the interpolation algorithm.
+ */
+ virtual HYDRODATA_EXPORT double GetAltitudeForPoint(
+ const double theCoordX, const double theCoordY ) const;
+
+ /**
+ * Returns the altitude value for given point.
+ */
+ HYDRODATA_EXPORT double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+
+
+public:
+
+ /**
+ * Sets the altitude object for interpolation.
+ */
+ HYDRODATA_EXPORT void SetAltitudeObject(
+ const Handle(HYDROData_IAltitudeObject)& theAltitude );
+
+ /**
+ * Returns the altitude object for interpolation.
+ */
+ HYDRODATA_EXPORT Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const;
+
+private:
+ Handle(HYDROData_IAltitudeObject) myAltitudeObject;
+};
+
+#endif
HYDROData_Zone::HYDROData_Zone()
: HYDROData_Entity()
{
+ myInterpolator = NULL;
}
HYDROData_Zone::~HYDROData_Zone()
return false;
}
+void HYDROData_Zone::SetInterpolator( HYDROData_IInterpolator* theInter )
+{
+ myInterpolator = theInter;
+}
+
+HYDROData_IInterpolator* HYDROData_Zone::GetInterpolator() const
+{
+ return myInterpolator;
+}
+
void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType )
{
- Handle(TDataStd_Integer) anInt;
- if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) )
- {
- anInt->Set( (int)theType );
- }
- else
- {
- anInt = TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
- }
+ TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType );
}
HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const
#ifndef HYDROData_Zone_HeaderFile
#define HYDROData_Zone_HeaderFile
-#include <HYDROData_Entity.h>
+#include "HYDROData_Entity.h"
+#include "HYDROData_IInterpolator.h"
class Handle(HYDROData_Object);
class Handle(HYDROData_IAltitudeObject);
HYDRODATA_EXPORT virtual bool IsMergingNeed() const;
+ /**
+ * Sets the interpolator for zone. By default it is NULL and original
+ * interpolation algorithms are used to calculate points altitudes.
+ * If you set interpolator it won't be stored in the data model structure,
+ * it will be deleted during that time as this zone will be freed.
+ */
+ HYDRODATA_EXPORT virtual void SetInterpolator( HYDROData_IInterpolator* theInter );
+
+ /**
+ * * Returns the interpolator of zone object.
+ */
+ HYDRODATA_EXPORT virtual HYDROData_IInterpolator* GetInterpolator() const;
+
+
/**
* Sets the merging type for conflict altitudes.
* By default it is set to Merge_UNKNOWN.
*/
HYDRODATA_EXPORT ~HYDROData_Zone();
+private:
+ HYDROData_IInterpolator* myInterpolator;
+
};
#endif
CAS/TCollection_AsciiString.sip
CAS/NCollection_Sequence.sip
HYDROData_SequenceOfObjects.sip
+ HYDROData_IInterpolator.sip
HYDROData_Entity.sip
HYDROData_ShapesGroup.sip
HYDROData_SplittedShapesGroup.sip
%Include CAS/TCollection_AsciiString.sip
%Include CAS/NCollection_Sequence.sip
%Include HYDROData_SequenceOfObjects.sip
+%Include HYDROData_IInterpolator.sip
%Include HYDROData_Entity.sip
%Include HYDROData_ShapesGroup.sip
%Include HYDROData_SplittedShapesGroup.sip
* Returns altitude points list.
* \return points list
*/
- static double GetInvalidAltitude();
+ static double GetInvalidAltitude();
/**
* Returns altitude for given point.
* \param thePoint the point to examine
* \return altitude value
*/
- virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const = 0;
+ virtual double GetAltitudeForPoint( const double theCoordX,
+ const double theCoordX ) const = 0 [double ( const gp_XY& )];
+ %MethodCode
+ gp_XY aPnt( a0, a1 );
+
+ Py_BEGIN_ALLOW_THREADS
+ sipRes = sipCpp->GetAltitudeForPoint( aPnt );
+ Py_END_ALLOW_THREADS
+ %End
+ %VirtualCatcherCode
+ PyObject *sipResObj = sipCallMethod(0, sipMethod, "dd",a0.X(),a0.Y());
+ sipParseResultEx(sipGILState, sipErrorHandler, sipPySelf, sipMethod, sipResObj, "d", &sipRes);
+ %End
+
protected:
/**
--- /dev/null
+// Copyright (C) 2007-2013 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.
+//
+// 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_IInterpolator.h>
+%End
+
+/**\class HYDROData_IInterpolator
+ * \brief The base class to provide interface for interpolation.
+ */
+class HYDROData_IInterpolator
+{
+%TypeHeaderCode
+#include <HYDROData_IInterpolator.h>
+%End
+
+public:
+
+ /**
+ * Public empty constructor.
+ */
+ HYDROData_IInterpolator();
+
+ /**
+ * Public virtual destructor.
+ */
+ virtual ~HYDROData_IInterpolator();
+
+public:
+
+ /**
+ * Returns the altitude value for given point.
+ * Reimplement this method in order to change the interpolation algorithm.
+ */
+ virtual double GetAltitudeForPoint( const double theCoordX,
+ const double theCoordY ) const;
+
+public:
+
+ /**
+ * Sets the altitude object for interpolation.
+ */
+ void SetAltitudeObject( HYDROData_IAltitudeObject theAltitude )
+ [void ( const Handle_HYDROData_IAltitudeObject& )];
+ %MethodCode
+ Handle(HYDROData_IAltitudeObject) anAltitude =
+ Handle(HYDROData_IAltitudeObject)::DownCast( createHandle( a0 ) );
+ if ( !anAltitude.IsNull() )
+ {
+ Py_BEGIN_ALLOW_THREADS
+ sipSelfWasArg ? sipCpp->HYDROData_IInterpolator::SetAltitudeObject( anAltitude ):
+ sipCpp->SetAltitudeObject( anAltitude );
+ Py_END_ALLOW_THREADS
+
+ }
+ %End
+
+
+ /**
+ * Returns the altitude object for interpolation.
+ */
+ HYDROData_IAltitudeObject GetAltitudeObject() const [Handle_HYDROData_IAltitudeObject ()];
+ %MethodCode
+ Handle(HYDROData_IAltitudeObject) aRes;
+
+ Py_BEGIN_ALLOW_THREADS
+ aRes = sipSelfWasArg ? sipCpp->HYDROData_IInterpolator::GetAltitudeObject() :
+ sipCpp->GetAltitudeObject();
+ Py_END_ALLOW_THREADS
+
+ sipRes = (HYDROData_IAltitudeObject*)createPointer( aRes );
+ %End
+};
*/
void RemoveGeometryObjects();
+
+ /**
+ * Sets the interpolator for zone. By default it is NULL and original
+ * interpolation algorithms are used to calculate points altitudes.
+ * If you set interpolator it won't be stored in the data model structure,
+ * it will be deleted during that time as this zone will be freed.
+ */
+ void SetInterpolator( HYDROData_IInterpolator* theInter );
+
+ /**
+ * * Returns the interpolator of zone object.
+ */
+ HYDROData_IInterpolator* GetInterpolator() const;
+
protected:
/**