myZones->setEditTriggers( QListWidget::NoEditTriggers );
myZones->setViewMode( QListWidget::ListMode );
- mySplittedZones = new QListWidget( aZonesGroup );
- mySplittedZones->setSelectionMode( QListWidget::SingleSelection );
- mySplittedZones->setEditTriggers( QListWidget::NoEditTriggers );
- mySplittedZones->setViewMode( QListWidget::ListMode );
+ myRegions = new QListWidget( aZonesGroup );
+ myRegions->setSelectionMode( QListWidget::SingleSelection );
+ myRegions->setEditTriggers( QListWidget::NoEditTriggers );
+ myRegions->setViewMode( QListWidget::ListMode );
mySplittedZonesPrefix = new QLineEdit( aZonesGroup );
aZonesLayout->setSpacing( 5 );
aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_REFERENCE_ZONES" ), aZonesGroup ), 0, 0, 1, 2 );
aZonesLayout->addWidget( myZones, 1, 0, 1, 2 );
- aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_SPLITTED_ZONES" ), aZonesGroup ), 2, 0, 1, 2 );
- aZonesLayout->addWidget( mySplittedZones, 3, 0, 1, 2 );
- aZonesLayout->addWidget( new QLabel( tr( "PREFIX_SPLITTED_ZONES" ), aZonesGroup ), 4, 0 );
+ aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_REGIONS" ), aZonesGroup ), 2, 0, 1, 2 );
+ aZonesLayout->addWidget( myRegions, 3, 0, 1, 2 );
+ aZonesLayout->addWidget( new QLabel( tr( "PREFIX_REGIONS" ), aZonesGroup ), 4, 0 );
aZonesLayout->addWidget( mySplittedZonesPrefix, 4, 1 );
aZonesLayout->addWidget( aSplitBtn, 5, 0, 1, 2 );
myBndPolyline->Clear();
myZones->clear();
- mySplittedZones->clear();
+ myRegions->clear();
- setSplitZonesPrefix( tr( "DEFAULT_PREFIX_SPLITTED_ZONES" ) );
+ setSplitZonesPrefix( tr( "DEFAULT_PREFIX_REGIONS" ) );
}
void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
return aResList;
}
-void HYDROGUI_CalculationDlg::setSplittedZones( const QStringList& theZones )
+void HYDROGUI_CalculationDlg::setRegions( const QStringList& theRegions )
{
- mySplittedZones->clear();
+ myRegions->clear();
- for ( int i = 0, n = theZones.length(); i < n; ++i )
+ for ( int i = 0, n = theRegions.length(); i < n; ++i )
{
- QString aZoneName = theZones.at( i );
+ QString aRegionName = theRegions.at( i );
- QListWidgetItem* aListItem = new QListWidgetItem( aZoneName, mySplittedZones );
+ QListWidgetItem* aListItem = new QListWidgetItem( aRegionName, myRegions );
aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
}
}
-QStringList HYDROGUI_CalculationDlg::getSplittedZones() const
+QStringList HYDROGUI_CalculationDlg::getRegions() const
{
QStringList aResList;
- for ( int i = 0, n = mySplittedZones->count(); i < n; ++i )
+ for ( int i = 0, n = myRegions->count(); i < n; ++i )
{
- QListWidgetItem* aListItem = mySplittedZones->item( i );
+ QListWidgetItem* aListItem = myRegions->item( i );
if ( !aListItem )
continue;
- QString aSplittedZoneName = aListItem->text();
- aResList.append( aSplittedZoneName );
+ QString aRegionName = aListItem->text();
+ aResList.append( aRegionName );
}
return aResList;
{
QString aPrefix = mySplittedZonesPrefix->text();
if ( aPrefix.isEmpty() )
- aPrefix = tr( "DEFAULT_PREFIX_SPLITTED_ZONES" );
+ aPrefix = tr( "DEFAULT_PREFIX_REGIONS" );
return aPrefix;
}
#include <HYDROData_Polyline.h>
#include <HYDROData_Iterator.h>
+#include <HYDROData_Zone.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewModel.h>
if ( !aPanel )
return;
- mySplittedZones.clear();
+ myRegionsList.clear();
aPanel->reset();
QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), "Case" );
- QStringList aSelectedZones, aSplittedZones;
+ QStringList aSelectedZones, aRegions;
myEditedObject.Nullify();
if ( myIsEdit )
aSelectedZones.append( aRefZoneName );
}
- HYDROData_SequenceOfObjects aSplitZones = myEditedObject->GetSplittedZones();
- anIter.Init( aSplitZones );
+ HYDROData_SequenceOfObjects aDataRegions = myEditedObject->GetRegions();
+ anIter.Init( aDataRegions );
for ( ; anIter.More(); anIter.Next() )
{
- Handle(HYDROData_Zone) aSplitZone =
- Handle(HYDROData_Zone)::DownCast( anIter.Value() );
- if ( aSplitZone.IsNull() )
+ Handle(HYDROData_Region) aDataRegion =
+ Handle(HYDROData_Region)::DownCast( anIter.Value() );
+ if ( aDataRegion.IsNull() )
continue;
- QString aSplitZoneName = aSplitZone->GetName();
- if ( aSplitZoneName.isEmpty() )
+ QString aRegionName = aDataRegion->GetName();
+ if ( aRegionName.isEmpty() )
continue;
- SplittedZone aSplittedZone;
- aSplittedZone.SplitData.Path = aSplitZone->GetPainterPath();
- // aSplittedZone.SplitData.ZoneNames ???
-
- aSplittedZone.FillingColor = aSplitZone->GetFillingColor();
- aSplittedZone.BorderColor = aSplitZone->GetBorderColor();
+ Region aRegion;
+ // aRegion.SplitData.Path = aSplitZone->GetPainterPath();
+ // aRegion.SplitData.ZoneNames ???
- aSplittedZone.ZoneName = aSplitZoneName;
+ aRegion.FillingColor = aDataRegion->GetFillingColor();
+ aRegion.BorderColor = aDataRegion->GetBorderColor();
- Handle(HYDROData_Polyline) aZonePolyline = aSplitZone->GetPolyline();
- if ( !aZonePolyline.IsNull() )
- aSplittedZone.PolylineName = aZonePolyline->GetName();
+ aRegion.RegionName = aRegionName;
- aSplittedZone.DataZone = aSplitZone;
+ aRegion.DataRegion = aDataRegion;
- mySplittedZones.append( aSplittedZone );
+ myRegionsList.append( aRegion );
- aSplittedZones.append( aSplitZoneName );
+ aRegions.append( aRegionName );
}
}
}
aPanel->setZones( aZones );
aPanel->setSelectedZones( aSelectedZones );
- aPanel->setSplittedZones( aSplittedZones );
+ aPanel->setRegions( aRegions );
createPreview();
}
aCalculObj->SetZones( aRefZones );
- HYDROData_SequenceOfObjects aSplittedZones;
+ HYDROData_SequenceOfObjects aRegions;
- SplittedZonesList::iterator anIter = mySplittedZones.begin();
- for ( ; anIter != mySplittedZones.end(); ++anIter )
+ RegionsList::iterator anIter = myRegionsList.begin();
+ for ( ; anIter != myRegionsList.end(); ++anIter )
{
- const SplittedZone& aSplittedZone = *anIter;
+ const Region& aRegion = *anIter;
- if ( !aSplittedZone.DataZone.IsNull() )
+ if ( !aRegion.DataRegion.IsNull() )
{
//No need to create new but use old zone
- aSplittedZones.Append( aSplittedZone.DataZone );
+ aRegions.Append( aRegion.DataRegion );
continue;
}
- Handle(HYDROData_Polyline) aPolyline =
- Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) );
- Handle(HYDROData_Zone) aDataZone =
- Handle(HYDROData_Zone)::DownCast( aDocument->CreateObject( KIND_ZONE ) );
-
- if( aPolyline.IsNull() || aDataZone.IsNull() )
+ Handle(HYDROData_Region) aDataRegion =
+ Handle(HYDROData_Region)::DownCast( aDocument->CreateObject( KIND_REGION ) );
+ if( aDataRegion.IsNull() )
continue;
- // Fill the polyline data
- aPolyline->SetName( aSplittedZone.PolylineName );
- aPolyline->setDimension( 2 );
-
- QList<PolylineSection> aPolylineData;
- for( int i = 0, n = aSplittedZone.SplitData.Path.elementCount(); i < n; i++ )
- {
- const QPainterPath::Element anElement = aSplittedZone.SplitData.Path.elementAt( i );
- switch( anElement.type )
- {
- case QPainterPath::MoveToElement:
- aPolylineData.append( PolylineSection() );
- break;
- case QPainterPath::LineToElement:
- if( !aPolylineData.isEmpty() )
- {
- PolylineSection& aSection = aPolylineData.last();
- aSection.myCoords << anElement.x;
- aSection.myCoords << anElement.y;
- }
- break;
- case QPainterPath::CurveToElement: // currently not supported
- default:
- break;
- }
- }
- aPolyline->setPolylineData( aPolylineData );
-
// Fill the zone data
- aDataZone->SetName( aSplittedZone.ZoneName );
- aDataZone->SetPolyline( aPolyline );
- aDataZone->SetBorderColor( aSplittedZone.BorderColor );
- aDataZone->SetFillingColor( aSplittedZone.FillingColor );
+ aDataRegion->SetName( aRegion.RegionName );
+ aDataRegion->SetBorderColor( aRegion.BorderColor );
+ aDataRegion->SetFillingColor( aRegion.FillingColor );
- aSplittedZones.Append( aDataZone );
+ aRegions.Append( aDataRegion );
}
- aCalculObj->SetSplittedZones( aSplittedZones );
+ aCalculObj->SetRegions( aRegions );
theUpdateFlags = UF_Model;
void HYDROGUI_CalculationOp::onSplitZones()
{
- mySplittedZones.clear();
+ myRegionsList.clear();
HYDROGUI_CalculationDlg* aPanel =
::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
HYDROGUI_SplitZonesTool::SplitDataListIterator anIter( aSplittedZones );
while( anIter.hasNext() )
{
- SplittedZone aSplittedZone;
- aSplittedZone.SplitData = anIter.next();
+ Region aRegion;
+ aRegion.SplitData = anIter.next();
- aSplittedZone.FillingColor = HYDROGUI_Tool::GenerateFillingColor( module(), aSplittedZone.SplitData.ZoneNames );
- aSplittedZone.BorderColor = QColor( HYDROData_Zone::DefaultBorderColor() );
+ aRegion.FillingColor = HYDROGUI_Tool::GenerateFillingColor( module(), aRegion.SplitData.ZoneNames );
+ aRegion.BorderColor = QColor( HYDROData_Zone::DefaultBorderColor() );
- aSplittedZone.ZoneName = HYDROGUI_Tool::GenerateObjectName( module(), aSplitZonesPrefix + "Zone", aUsedNames );
- aSplittedZone.PolylineName = HYDROGUI_Tool::GenerateObjectName( module(), aSplitZonesPrefix + "Poly", aUsedNames );
+ aRegion.RegionName = HYDROGUI_Tool::GenerateObjectName( module(), aSplitZonesPrefix, aUsedNames );
- aUsedNames.append( aSplittedZone.ZoneName );
- aUsedNames.append( aSplittedZone.PolylineName );
+ aUsedNames.append( aRegion.RegionName );
- aResSplittedZones.append( aSplittedZone.ZoneName );
+ aResSplittedZones.append( aRegion.RegionName );
- mySplittedZones.append( aSplittedZone );
+ myRegionsList.append( aRegion );
}
- aPanel->setSplittedZones( aResSplittedZones );
+ aPanel->setRegions( aResSplittedZones );
createPreview();
if ( !myActiveViewManager )
{
- if ( mySplittedZones.isEmpty() )
+ if ( myRegionsList.isEmpty() )
return;
myActiveViewManager = anApp->activeViewManager();
Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
if ( !aCtx.IsNull() )
{
- SplittedZonesList::iterator anIter = mySplittedZones.begin();
- for ( ; anIter != mySplittedZones.end(); ++anIter )
+ RegionsList::iterator anIter = myRegionsList.begin();
+ for ( ; anIter != myRegionsList.end(); ++anIter )
{
- SplittedZone& aSplittedZone = *anIter;
- if ( aSplittedZone.Shape )
- delete aSplittedZone.Shape;
+ Region& aRegion = *anIter;
+ if ( aRegion.Shape )
+ delete aRegion.Shape;
- aSplittedZone.Shape = new HYDROGUI_Shape( aCtx );
+ aRegion.Shape = new HYDROGUI_Shape( aCtx );
- aSplittedZone.Shape->setFillingColor( aSplittedZone.FillingColor, false );
- aSplittedZone.Shape->setBorderColor( aSplittedZone.BorderColor, false );
- aSplittedZone.Shape->setPath( aSplittedZone.SplitData.Path, true );
+ aRegion.Shape->setFillingColor( aRegion.FillingColor, false );
+ aRegion.Shape->setBorderColor( aRegion.BorderColor, false );
+ aRegion.Shape->setPath( aRegion.SplitData.Path, true );
}
//Process the draw events for viewer
void HYDROGUI_CalculationOp::closePreview()
{
- SplittedZonesList::iterator anIter= mySplittedZones.begin();
- for ( ; anIter != mySplittedZones.end(); ++anIter )
+ RegionsList::iterator anIter= myRegionsList.begin();
+ for ( ; anIter != myRegionsList.end(); ++anIter )
{
- SplittedZone& aSplittedZone = *anIter;
- if ( aSplittedZone.Shape )
+ Region& aRegion = *anIter;
+ if ( aRegion.Shape )
{
- delete aSplittedZone.Shape;
- aSplittedZone.Shape = NULL;
+ delete aRegion.Shape;
+ aRegion.Shape = NULL;
}
}