bool HYDROData_CalculationCase::AddGeometryObject( const Handle(HYDROData_Object)& theObject )
{
- if ( theObject.IsNull() )
- return false;
-
- if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) &&
- !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) )
+ if ( !HYDROData_Tool::IsGeometryObject( theObject ) )
return false; // Wrong type of object
if ( HasReference( theObject, DataTag_GeometryObject ) )
#include "HYDROData_Tool.h"
+#include "HYDROData_ArtificialObject.h"
#include "HYDROData_Image.h"
#include "HYDROData_Iterator.h"
+#include "HYDROData_NaturalObject.h"
#include <QFile>
#include <QStringList>
return aResSeq;
}
+bool HYDROData_Tool::IsGeometryObject( const Handle(HYDROData_Entity)& theObject )
+{
+ if ( theObject.IsNull() )
+ return false;
+
+ return theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) ||
+ theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) );
+}
static HYDROData_SequenceOfObjects FindObjectsByNames( const Handle(HYDROData_Document)& theDoc,
const QStringList& theNames,
const ObjectKind theObjectKind = KIND_UNKNOWN );
+
+ /**
+ * \brief Checks the type of object.
+ * \param theObject object to check
+ * \return true if object is geometry object
+ */
+ static bool IsGeometryObject( const Handle(HYDROData_Entity)& theObject );
+
};
inline bool ValuesEquals( const double& theFirst, const double& theSecond )
return NULL;
}
+HYDROData_SequenceOfObjects HYDROGUI_Tool::GetGeometryObjects(
+ const Handle(HYDROData_Document)& theDoc )
+{
+ HYDROData_SequenceOfObjects aResSeq;
+
+ HYDROData_Iterator anIter( theDoc );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Entity) anObj = anIter.Current();
+ if ( !HYDROData_Tool::IsGeometryObject( anObj ) )
+ continue;
+
+ aResSeq.Append( anObj );
+ }
+
+ return aResSeq;
+}
+
ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule )
{
HYDROGUI_DataModel* aModel = theModule->getDataModel();
*/
static Handle(HYDROData_Entity) GetSelectedObject( HYDROGUI_Module* theModule );
+ /**
+ * \brief Get the geometry data objects from document.
+ * \param theDoc document
+ * \return sequence of data objects
+ */
+ static HYDROData_SequenceOfObjects GetGeometryObjects( const Handle(HYDROData_Document)& theDoc );
+
/**
* \brief Get kind of objects the selected partition contains.
* \param theModule module