#include "HYDROData_Calculation.h"
#include "HYDROData_Document.h"
+#include "HYDROData_Iterator.h"
+#include "HYDROData_Polyline.h"
+
+#include <TDataStd_ReferenceList.hxx>
#include <QStringList>
return aResList;
}
+
+void HYDROData_Calculation::SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline )
+{
+ Handle(TDataStd_ReferenceList) aRefs;
+ myLab.FindChild( DataTag_BoundaryPolyline ).FindAttribute( TDataStd_ReferenceList::GetID(), aRefs );
+ if ( aRefs.IsNull() )
+ aRefs = TDataStd_ReferenceList::Set( myLab.FindChild( DataTag_BoundaryPolyline ) );
+
+ aRefs->Clear();
+
+ if ( thePolyline.IsNull() )
+ return;
+
+ aRefs->Append( thePolyline->Label() );
+}
+
+Handle(HYDROData_Polyline) HYDROData_Calculation::GetBoundaryPolyline() const
+{
+ Handle(HYDROData_Polyline) aRes;
+
+ Handle(TDataStd_ReferenceList) aRefs;
+ myLab.FindChild( DataTag_BoundaryPolyline ).FindAttribute( TDataStd_ReferenceList::GetID(), aRefs );
+ if ( !aRefs.IsNull() && !aRefs->IsEmpty() )
+ {
+ aRes = Handle(HYDROData_Polyline)::DownCast( HYDROData_Iterator::Object( aRefs->First() ) );
+ }
+
+ return aRes;
+}
class QPointF;
class QFile;
+class Handle(HYDROData_Polyline);
+
DEFINE_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Object)
enum DataTag
{
DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
+ DataTag_BoundaryPolyline, ///< reference boundary polyline
};
public:
public:
// Public methods to work with Calculation
+ HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline );
+
+ HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetBoundaryPolyline() const;
protected:
friend class HYDROData_Document;
friend class HYDROData_Image;
+ friend class HYDROData_Calculation;
/**
* Creates object in the document, call HYDROData_Document method to create
#include "HYDROGUI_CalculationDlg.h"
+#include "HYDROGUI_ObjSelector.h"
#include "HYDROGUI_Tool.h"
#include <SUIT_FileDlg.h>
: HYDROGUI_InputPanel( theModule, theTitle )
{
// Calculation name
- myObjectNameGroup = new QGroupBox( tr( "CALCULATION_NAME" ) );
+ myObjectNameGroup = new QGroupBox( tr( "CALCULATION_NAME" ), mainFrame() );
myObjectName = new QLineEdit( myObjectNameGroup );
aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
aNameLayout->addWidget( myObjectName );
+ QGroupBox* aBndGroup = new QGroupBox( tr( "CALCULATION_BOUNDARY" ), mainFrame() );
+
+ myBndPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINE, aBndGroup );
+
+ QBoxLayout* aBndLayout = new QHBoxLayout( aBndGroup );
+ aBndLayout->setMargin( 5 );
+ aBndLayout->setSpacing( 5 );
+ aBndLayout->addWidget( new QLabel( tr( "BOUNDARY_POLYLINE" ), aBndGroup ) );
+ aBndLayout->addWidget( myBndPolyline );
+
// Common
addWidget( myObjectNameGroup );
+ addWidget( aBndGroup );
addStretch();
}
void HYDROGUI_CalculationDlg::reset()
{
myObjectName->clear();
+
+ myBndPolyline->Clear();
}
void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
return myObjectName->text();
}
+void HYDROGUI_CalculationDlg::setPolylineName( const QString& theName )
+{
+ myBndPolyline->SetName( theName );
+}
+
+QString HYDROGUI_CalculationDlg::getPolylineName() const
+{
+ return myBndPolyline->GetName();
+}
#include "HYDROGUI_InputPanel.h"
+class HYDROGUI_ObjSelector;
class QGroupBox;
class QLineEdit;
void setObjectName( const QString& theName );
QString getObjectName() const;
+ void setPolylineName( const QString& theName );
+ QString getPolylineName() const;
+
private:
QGroupBox* myObjectNameGroup;
QLineEdit* myObjectName;
+ HYDROGUI_ObjSelector* myBndPolyline;
};
#endif
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
+#include <HYDROData_Polyline.h>
+
#include <LightApp_Application.h>
#include <LightApp_UpdateFlags.h>
{
myEditedObject = Handle(HYDROData_Calculation)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
if ( !myEditedObject.IsNull() )
+ {
anObjectName = myEditedObject->GetName();
+
+ Handle(HYDROData_Polyline) aBoundaryPolyline = myEditedObject->GetBoundaryPolyline();
+ if ( !aBoundaryPolyline.IsNull() )
+ {
+ QString aPolylineName = aBoundaryPolyline->GetName();
+ aPanel->setPolylineName( aPolylineName );
+ }
+ }
}
aPanel->setObjectName( anObjectName );
aCalculObj->SetName( anObjectName );
+ Handle(HYDROData_Polyline) aBndPolyline;
+
+ QString aPolylineName = aPanel->getPolylineName();
+ if ( !aPolylineName.isEmpty() )
+ {
+ aBndPolyline = Handle(HYDROData_Polyline)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) );
+ }
+
+ aCalculObj->SetBoundaryPolyline( aBndPolyline );
+
theUpdateFlags = UF_Model;
return true;
QBoxLayout* aMainLayout = dynamic_cast<QBoxLayout*>( myMainFrame->layout() );
aMainLayout->addStretch();
}
+
+QFrame* HYDROGUI_InputPanel::mainFrame() const
+{
+ return myMainFrame;
+}
+
void onCancel();
void onHelp();
+protected:
+ QFrame* mainFrame() const;
+
private:
HYDROGUI_Module* myModule;
QFrame* myMainFrame;
<context>
<name>HYDROGUI_CalculationDlg</name>
+ <message>
+ <source>BOUNDARY_POLYLINE</source>
+ <translation>Polyline</translation>
+ </message>
+ <message>
+ <source>CALCULATION_BOUNDARY</source>
+ <translation>Domain of calculation Case</translation>
+ </message>
<message>
<source>CALCULATION_NAME</source>
<translation>Calculation Case name</translation>