#include "HYDROGUI_Zone.h"
#include "HYDROGUI_Region.h"
-#include <HYDROData_Polyline.h>
+#include <HYDROData_PolylineXY.h>
#include <HYDROData_Iterator.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Object.h>
// Get all polylines
aList.clear();
anEntryList.clear();
- HYDROData_Iterator anIter( doc(), KIND_POLYLINE );
- Handle(HYDROData_Polyline) aPolylineObj;
+ HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY );
+ Handle(HYDROData_PolylineXY) aPolylineObj;
QString aPolylineName;
for ( ; anIter.More(); anIter.Next() )
{
- aPolylineObj = Handle(HYDROData_Polyline)::DownCast( anIter.Current() );
+ aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() );
if ( !aPolylineObj.IsNull() && aPolylineObj->IsClosed() )
- {
- aPolylineName = aPolylineObj->GetName();
- if ( !aPolylineName.isEmpty() )
- {
- aList.append( aPolylineName );
- anEntryList.append( HYDROGUI_DataObject::dataObjectEntry( aPolylineObj ) );
+ {
+ // Check the polyline shape
+ TopoDS_Shape aPolylineShape = aPolylineObj->GetShape();
+ if ( !aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE ) {
+ aPolylineName = aPolylineObj->GetName();
+ if ( !aPolylineName.isEmpty() )
+ {
+ aList.append( aPolylineName );
+ anEntryList.append( HYDROGUI_DataObject::dataObjectEntry( aPolylineObj ) );
+ }
}
}
}
anEntity = anIter.Value();
if ( !anEntity.IsNull() )
{
- anObject = Handle(HYDROData_Object)::DownCast( anEntity );
+ // Temporary solution will be revised later
+ //anObject = Handle(HYDROData_Object)::DownCast( anEntity );
+ anObject = Handle(HYDROData_ImmersibleZone)::DownCast( anEntity );
if ( !anObject.IsNull() )
{
theNames.append( anObject->GetName() );
void HYDROGUI_CalculationOp::onBoundarySelected ( const QString & theObjName )
{
// Set the selected boundary polyline to the calculation case
- Handle(HYDROData_Polyline) anObject;
+ Handle(HYDROData_PolylineXY) anObject;
Handle(AIS_InteractiveContext) aCtx;
if ( myPreviewViewManager )
{
else
{
Handle(HYDROData_Entity) anEntity =
- HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINE );
+ HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINEXY );
if ( !anEntity.IsNull() )
{
- anObject = Handle(HYDROData_Polyline)::DownCast( anEntity );
+ anObject = Handle(HYDROData_PolylineXY)::DownCast( anEntity );
if ( !anObject.IsNull() )
{
myEditedObject->SetBoundaryPolyline( anObject );
void HYDROGUI_CalculationOp::onSplitZones()
{
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
QApplication::setOverrideCursor( Qt::WaitCursor );
+ QString aNewCaseName = aPanel->getObjectName();
+ QString anOldCaseName = myEditedObject->GetName();
+
+ bool anIsToUpdateOb = myIsEdit && anOldCaseName != aNewCaseName;
+
+ // At first we must to update the case name because of
+ // automatic names generation for regions and zones
+ myEditedObject->SetName( aNewCaseName );
+
if ( myEditedObject->IsMustBeUpdated() )
{
myShowZones = true;
myEditedObject->SplitGeometryObjects();
- HYDROGUI_CalculationDlg* aPanel =
- ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
- if ( aPanel )
- {
- aPanel->setEditedObject( myEditedObject );
- }
+ aPanel->setEditedObject( myEditedObject );
createPreview();
}
setZonesVisible( true );
}
+ if ( anIsToUpdateOb )
+ module()->getApp()->updateObjectBrowser( false );
+
QApplication::restoreOverrideCursor();
}