From bd1a4992da8d54929ec556df6db4e7e0ebbfbbd7 Mon Sep 17 00:00:00 2001 From: adv Date: Thu, 19 Sep 2013 15:04:12 +0000 Subject: [PATCH] Splitting of czlculztion zones. --- src/HYDROData/HYDROData_Calculation.cxx | 81 ++++++ src/HYDROData/HYDROData_Calculation.h | 88 +++++++ src/HYDROData/HYDROData_Object.cxx | 12 + src/HYDROData/HYDROData_Object.h | 8 + src/HYDROGUI/HYDROGUI_CalculationDlg.cxx | 134 ++++++++++ src/HYDROGUI/HYDROGUI_CalculationDlg.h | 18 ++ src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 284 +++++++++++++++++++++- src/HYDROGUI/HYDROGUI_CalculationOp.h | 45 ++++ src/HYDROGUI/HYDROGUI_DataModel.cxx | 62 ++++- src/HYDROGUI/HYDROGUI_DataModel.h | 3 +- src/HYDROGUI/HYDROGUI_Module.h | 2 +- src/HYDROGUI/HYDROGUI_SplitZonesTool.cxx | 32 ++- src/HYDROGUI/HYDROGUI_SplitZonesTool.h | 2 + src/HYDROGUI/HYDROGUI_Tool.cxx | 86 ++++++- src/HYDROGUI/HYDROGUI_Tool.h | 26 +- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 40 +++ 16 files changed, 893 insertions(+), 30 deletions(-) diff --git a/src/HYDROData/HYDROData_Calculation.cxx b/src/HYDROData/HYDROData_Calculation.cxx index c836f548..8b9c94d7 100644 --- a/src/HYDROData/HYDROData_Calculation.cxx +++ b/src/HYDROData/HYDROData_Calculation.cxx @@ -4,6 +4,7 @@ #include "HYDROData_Document.h" #include "HYDROData_Iterator.h" #include "HYDROData_Polyline.h" +#include "HYDROData_Zone.h" #include @@ -53,3 +54,83 @@ Handle(HYDROData_Polyline) HYDROData_Calculation::GetBoundaryPolyline() const return Handle(HYDROData_Polyline)::DownCast( GetReferenceObject( DataTag_BoundaryPolyline ) ); } + +void HYDROData_Calculation::RemoveBoundaryPolyline() +{ + ClearReferenceObjects( DataTag_BoundaryPolyline ); +} + +int HYDROData_Calculation::NbZones() const +{ + return NbReferenceObjects( DataTag_Zone ); +} + +void HYDROData_Calculation::AddZone( const Handle(HYDROData_Zone)& theZone ) +{ + AddReferenceObject( theZone, DataTag_Zone ); +} + +void HYDROData_Calculation::SetZone( const int theIndex, + const Handle(HYDROData_Zone)& theZone ) +{ + SetReferenceObject( theZone, DataTag_Zone, theIndex ); +} + +void HYDROData_Calculation::SetZones( const HYDROData_SequenceOfObjects& theZones ) +{ + SetReferenceObjects( theZones, DataTag_Zone ); +} + +Handle(HYDROData_Zone) HYDROData_Calculation::GetZone( const int theIndex ) const +{ + return Handle(HYDROData_Zone)::DownCast( + GetReferenceObject( DataTag_Zone, theIndex ) ); +} + +HYDROData_SequenceOfObjects HYDROData_Calculation::GetZones() const +{ + return GetReferenceObjects( DataTag_Zone ); +} + +void HYDROData_Calculation::RemoveZones() +{ + ClearReferenceObjects( DataTag_Zone ); +} + +int HYDROData_Calculation::NbSplittedZones() const +{ + return NbReferenceObjects( DataTag_SplittedZone ); +} + +void HYDROData_Calculation::AddSplittedZone( const Handle(HYDROData_Zone)& theZone ) +{ + AddReferenceObject( theZone, DataTag_SplittedZone ); +} + +void HYDROData_Calculation::SetSplittedZone( const int theIndex, + const Handle(HYDROData_Zone)& theZone ) +{ + SetReferenceObject( theZone, DataTag_SplittedZone, theIndex ); +} + +void HYDROData_Calculation::SetSplittedZones( const HYDROData_SequenceOfObjects& theZones ) +{ + SetReferenceObjects( theZones, DataTag_SplittedZone ); +} + +Handle(HYDROData_Zone) HYDROData_Calculation::GetSplittedZone( const int theIndex ) const +{ + return Handle(HYDROData_Zone)::DownCast( + GetReferenceObject( DataTag_SplittedZone, theIndex ) ); +} + +HYDROData_SequenceOfObjects HYDROData_Calculation::GetSplittedZones() const +{ + return GetReferenceObjects( DataTag_SplittedZone ); +} + +void HYDROData_Calculation::RemoveSplittedZones() +{ + ClearReferenceObjects( DataTag_SplittedZone ); +} + diff --git a/src/HYDROData/HYDROData_Calculation.h b/src/HYDROData/HYDROData_Calculation.h index cee923ce..64de389e 100644 --- a/src/HYDROData/HYDROData_Calculation.h +++ b/src/HYDROData/HYDROData_Calculation.h @@ -10,6 +10,7 @@ class QPointF; class QFile; class Handle(HYDROData_Polyline); +class Handle(HYDROData_Zone); DEFINE_STANDARD_HANDLE(HYDROData_Calculation, HYDROData_Object) @@ -31,6 +32,8 @@ protected: { DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve DataTag_BoundaryPolyline, ///< reference boundary polyline + DataTag_Zone, ///< reference zones + DataTag_SplittedZone ///< reference splitted zones }; public: @@ -51,10 +54,95 @@ public: public: // Public methods to work with Calculation + /** + * Sets boundary polyline for calculation case. + */ HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline ); + /** + * Returns boundary polyline of calculation case. + */ HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetBoundaryPolyline() const; + /** + * Removes boundary polyline of calculation case. + */ + HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline(); + + + /** + * Returns number of refrence zones for calculation case. + */ + HYDRODATA_EXPORT virtual int NbZones() const; + + /** + * Add new one refrence zone for calculation case. + */ + HYDRODATA_EXPORT virtual void AddZone( const Handle(HYDROData_Zone)& theZone ); + + /** + * Replace the refrence zone for calculation case. + */ + HYDRODATA_EXPORT virtual void SetZone( const int theIndex, + const Handle(HYDROData_Zone)& theBathymetry ); + + /** + * Sets the refrence zones for calculation case. + */ + HYDRODATA_EXPORT virtual void SetZones( const HYDROData_SequenceOfObjects& theZones ); + + /** + * Returns refrence zone of calculation case by index. + */ + HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZone( const int theIndex ) const; + + /** + * Returns all refrence zone of calculation case. + */ + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetZones() const; + + /** + * Removes all refrence zone of calculation case. + */ + HYDRODATA_EXPORT virtual void RemoveZones(); + + + /** + * Returns number of splitted zones for calculation case. + */ + HYDRODATA_EXPORT virtual int NbSplittedZones() const; + + /** + * Add new one splitted zone for calculation case. + */ + HYDRODATA_EXPORT virtual void AddSplittedZone( const Handle(HYDROData_Zone)& theZone ); + + /** + * Replace the splitted zone for calculation case. + */ + HYDRODATA_EXPORT virtual void SetSplittedZone( const int theIndex, + const Handle(HYDROData_Zone)& theBathymetry ); + + /** + * Sets the refrence zones for calculation case. + */ + HYDRODATA_EXPORT virtual void SetSplittedZones( const HYDROData_SequenceOfObjects& theZones ); + + /** + * Returns splitted zone of calculation case by index. + */ + HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetSplittedZone( const int theIndex ) const; + + /** + * Returns all splitted zone of calculation case. + */ + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedZones() const; + + /** + * Removes all splitted refrence zone of calculation case. + */ + HYDRODATA_EXPORT virtual void RemoveSplittedZones(); + protected: friend class HYDROData_Iterator; diff --git a/src/HYDROData/HYDROData_Object.cxx b/src/HYDROData/HYDROData_Object.cxx index 062be0df..9a971a75 100644 --- a/src/HYDROData/HYDROData_Object.cxx +++ b/src/HYDROData/HYDROData_Object.cxx @@ -175,6 +175,18 @@ void HYDROData_Object::SetReferenceObject( const Handle_HYDROData_Object& theObj } } +void HYDROData_Object::SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects, + const int theTag ) +{ + ClearReferenceObjects( theTag ); + if ( theObjects.IsEmpty() ) + return; + + HYDROData_SequenceOfObjects::Iterator anIter( theObjects ); + for ( ; anIter.More(); anIter.Next() ) + AddReferenceObject( anIter.Value(), theTag ); +} + Handle(HYDROData_Object) HYDROData_Object::GetReferenceObject( const int theTag, const int theIndex ) const { diff --git a/src/HYDROData/HYDROData_Object.h b/src/HYDROData/HYDROData_Object.h index a44ffdb5..caa0b29c 100644 --- a/src/HYDROData/HYDROData_Object.h +++ b/src/HYDROData/HYDROData_Object.h @@ -188,6 +188,14 @@ protected: const int theTag = 0, const int theIndex = 0 ); + /** + * Internal method that used to store the reference object label attribute + * \param theObjects sequence with pointers to reference objects + * \param theTag tag of a label to store attribute (for 0 this is myLab) + */ + void SetReferenceObjects( const HYDROData_SequenceOfObjects& theObjects, + const int theTag = 0 ); + /** * Internal method that used to retreive the reference object(s) attribute * \param theTag tag of a label that keeps the attribute (for 0 this is myLab) diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index b1f88817..90869a48 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -33,7 +33,9 @@ #include #include #include +#include #include +#include #include HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle ) @@ -50,6 +52,8 @@ HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, co aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) ); aNameLayout->addWidget( myObjectName ); + + // Calculation boundary line QGroupBox* aBndGroup = new QGroupBox( tr( "CALCULATION_BOUNDARY" ), mainFrame() ); myBndPolyline = new HYDROGUI_ObjSelector( theModule, KIND_POLYLINE, aBndGroup ); @@ -60,10 +64,44 @@ HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, co aBndLayout->addWidget( new QLabel( tr( "BOUNDARY_POLYLINE" ), aBndGroup ) ); aBndLayout->addWidget( myBndPolyline ); + + // Calculation zones + QGroupBox* aZonesGroup = new QGroupBox( tr( "CALCULATION_ZONES" ), mainFrame() ); + + myZones = new QListWidget( aZonesGroup ); + myZones->setSelectionMode( QListWidget::SingleSelection ); + myZones->setEditTriggers( QListWidget::NoEditTriggers ); + myZones->setViewMode( QListWidget::ListMode ); + + mySplittedZones = new QListWidget( aZonesGroup ); + mySplittedZones->setSelectionMode( QListWidget::SingleSelection ); + mySplittedZones->setEditTriggers( QListWidget::NoEditTriggers ); + mySplittedZones->setViewMode( QListWidget::ListMode ); + + mySplittedZonesPrefix = new QLineEdit( aZonesGroup ); + + QPushButton* aSplitBtn = new QPushButton( tr( "SPLIT_REFERENCE_ZONES" ), aZonesGroup ); + + QGridLayout* aZonesLayout = new QGridLayout( aZonesGroup ); + aZonesLayout->setMargin( 5 ); + 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( mySplittedZonesPrefix, 4, 1 ); + aZonesLayout->addWidget( aSplitBtn, 5, 0, 1, 2 ); + // Common addWidget( myObjectNameGroup ); addWidget( aBndGroup ); + addWidget( aZonesGroup ); addStretch(); + + + // Connect signals and slots + connect( aSplitBtn, SIGNAL( clicked( bool ) ), this, SIGNAL( SplitZones() ) ); } HYDROGUI_CalculationDlg::~HYDROGUI_CalculationDlg() @@ -75,6 +113,11 @@ void HYDROGUI_CalculationDlg::reset() myObjectName->clear(); myBndPolyline->Clear(); + + myZones->clear(); + mySplittedZones->clear(); + + setSplitZonesPrefix( tr( "DEFAULT_PREFIX_SPLITTED_ZONES" ) ); } void HYDROGUI_CalculationDlg::setObjectName( const QString& theName ) @@ -97,5 +140,96 @@ QString HYDROGUI_CalculationDlg::getPolylineName() const return myBndPolyline->GetName(); } +void HYDROGUI_CalculationDlg::setZones( const QStringList& theZones ) +{ + myZones->clear(); + + for ( int i = 0, n = theZones.length(); i < n; ++i ) + { + QString aZoneName = theZones.at( i ); + + QListWidgetItem* aListItem = new QListWidgetItem( aZoneName, myZones ); + aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable ); + aListItem->setCheckState( Qt::Unchecked ); + } +} + +void HYDROGUI_CalculationDlg::setSelectedZones( const QStringList& theZones ) +{ + for ( int i = 0, n = theZones.length(); i < n; ++i ) + { + QString aZoneName = theZones.at( i ); + QList anItems = + myZones->findItems( aZoneName, Qt::MatchFixedString | Qt::MatchCaseSensitive ); + if ( anItems.isEmpty() ) + continue; + + QListWidgetItem* aListItem = anItems.first(); + if ( !aListItem ) + continue; + + aListItem->setCheckState( Qt::Checked ); + } +} + +QStringList HYDROGUI_CalculationDlg::getSelectedZones() const +{ + QStringList aResList; + + for ( int i = 0, n = myZones->count(); i < n; ++i ) + { + QListWidgetItem* aListItem = myZones->item( i ); + if ( !aListItem || aListItem->checkState() != Qt::Checked ) + continue; + + QString aSelZoneName = aListItem->text(); + aResList.append( aSelZoneName ); + } + + return aResList; +} + +void HYDROGUI_CalculationDlg::setSplittedZones( const QStringList& theZones ) +{ + mySplittedZones->clear(); + + for ( int i = 0, n = theZones.length(); i < n; ++i ) + { + QString aZoneName = theZones.at( i ); + + QListWidgetItem* aListItem = new QListWidgetItem( aZoneName, mySplittedZones ); + aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable ); + } +} + +QStringList HYDROGUI_CalculationDlg::getSplittedZones() const +{ + QStringList aResList; + + for ( int i = 0, n = mySplittedZones->count(); i < n; ++i ) + { + QListWidgetItem* aListItem = mySplittedZones->item( i ); + if ( !aListItem ) + continue; + + QString aSplittedZoneName = aListItem->text(); + aResList.append( aSplittedZoneName ); + } + + return aResList; +} + +void HYDROGUI_CalculationDlg::setSplitZonesPrefix( const QString& theName ) +{ + mySplittedZonesPrefix->setText( theName ); +} + +QString HYDROGUI_CalculationDlg::getSplitZonesPrefix() const +{ + QString aPrefix = mySplittedZonesPrefix->text(); + if ( aPrefix.isEmpty() ) + aPrefix = tr( "DEFAULT_PREFIX_SPLITTED_ZONES" ); + return aPrefix; +} diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.h b/src/HYDROGUI/HYDROGUI_CalculationDlg.h index b9a0395c..742bbca9 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.h +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.h @@ -28,6 +28,7 @@ class HYDROGUI_ObjSelector; class QGroupBox; class QLineEdit; +class QListWidget; class HYDROGUI_CalculationDlg : public HYDROGUI_InputPanel { @@ -45,11 +46,28 @@ public: void setPolylineName( const QString& theName ); QString getPolylineName() const; + void setZones( const QStringList& theZones ); + void setSelectedZones( const QStringList& theZones ); + QStringList getSelectedZones() const; + + void setSplittedZones( const QStringList& theZones ); + QStringList getSplittedZones() const; + + void setSplitZonesPrefix( const QString& theName ); + QString getSplitZonesPrefix() const; + +signals: + void SplitZones(); + private: QGroupBox* myObjectNameGroup; QLineEdit* myObjectName; HYDROGUI_ObjSelector* myBndPolyline; + + QListWidget* myZones; + QListWidget* mySplittedZones; + QLineEdit* mySplittedZonesPrefix; }; #endif diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 492b381f..5d4a465b 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -29,19 +29,29 @@ #include "HYDROGUI_UpdateFlags.h" #include +#include +#include + +#include +#include #include #include +#include + HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit ) : HYDROGUI_Operation( theModule ), - myIsEdit( theIsEdit ) + myIsEdit( theIsEdit ), + myActiveViewManager( NULL ), + myPreviewViewManager( NULL ) { setName( myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" ) ); } HYDROGUI_CalculationOp::~HYDROGUI_CalculationOp() { + closePreview(); } void HYDROGUI_CalculationOp::startOperation() @@ -53,10 +63,13 @@ void HYDROGUI_CalculationOp::startOperation() if ( !aPanel ) return; + mySplittedZones.clear(); aPanel->reset(); QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), "Case" ); + QStringList aSelectedZones, aSplittedZones; + myEditedObject.Nullify(); if ( myIsEdit ) { @@ -71,25 +84,87 @@ void HYDROGUI_CalculationOp::startOperation() QString aPolylineName = aBoundaryPolyline->GetName(); aPanel->setPolylineName( aPolylineName ); } + + HYDROData_SequenceOfObjects aRefZones = myEditedObject->GetZones(); + HYDROData_SequenceOfObjects::Iterator anIter( aRefZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if ( aRefZone.IsNull() ) + continue; + + QString aRefZoneName = aRefZone->GetName(); + if ( aRefZoneName.isEmpty() ) + continue; + + aSelectedZones.append( aRefZoneName ); + } + + HYDROData_SequenceOfObjects aSplitZones = myEditedObject->GetSplittedZones(); + anIter.Init( aSplitZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aSplitZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if ( aSplitZone.IsNull() ) + continue; + + QString aSplitZoneName = aSplitZone->GetName(); + if ( aSplitZoneName.isEmpty() ) + continue; + + aSplittedZones.append( aSplitZoneName ); + } } } + // collect information about existing zones + QStringList aZones; + + HYDROData_Iterator anIter( doc(), KIND_ZONE ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aZoneObj = + Handle(HYDROData_Zone)::DownCast( anIter.Current() ); + if ( aZoneObj.IsNull() ) + continue; + + QString aZoneName = aZoneObj->GetName(); + if ( aZoneName.isEmpty() ) + continue; + + aZones.append( aZoneName ); + } + aPanel->setObjectName( anObjectName ); + + aPanel->setZones( aZones ); + aPanel->setSelectedZones( aSelectedZones ); + aPanel->setSplittedZones( aSplittedZones ); } void HYDROGUI_CalculationOp::abortOperation() { + closePreview(); + HYDROGUI_Operation::abortOperation(); } void HYDROGUI_CalculationOp::commitOperation() { + closePreview(); + HYDROGUI_Operation::commitOperation(); } HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const { HYDROGUI_CalculationDlg* aPanel = new HYDROGUI_CalculationDlg( module(), getName() ); + + // Connect signals and slots + connect( aPanel, SIGNAL( SplitZones() ), this, SLOT( onSplitZones() ) ); + return aPanel; } @@ -119,27 +194,220 @@ bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags, } } + Handle(HYDROData_Document) aDocument = doc(); + Handle(HYDROData_Calculation) aCalculObj = myIsEdit ? myEditedObject : - Handle(HYDROData_Calculation)::DownCast( doc()->CreateObject( KIND_CALCULATION ) ); + Handle(HYDROData_Calculation)::DownCast( aDocument->CreateObject( KIND_CALCULATION ) ); if ( aCalculObj.IsNull() ) return false; aCalculObj->SetName( anObjectName ); - Handle(HYDROData_Polyline) aBndPolyline; - QString aPolylineName = aPanel->getPolylineName(); - if ( !aPolylineName.isEmpty() ) - { - aBndPolyline = Handle(HYDROData_Polyline)::DownCast( + Handle(HYDROData_Polyline) aBndPolyline = Handle(HYDROData_Polyline)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) ); - } aCalculObj->SetBoundaryPolyline( aBndPolyline ); + QStringList aRefZoneNames = aPanel->getSelectedZones(); + HYDROData_SequenceOfObjects aRefZones = + HYDROGUI_Tool::FindObjectsByNames( module(), aRefZoneNames, KIND_ZONE ); + + aCalculObj->SetZones( aRefZones ); + + HYDROData_SequenceOfObjects aSplittedZones; + + SplittedZonesList::iterator anIter = mySplittedZones.begin(); + for ( ; anIter != mySplittedZones.end(); ++anIter ) + { + const SplittedZone& aSplittedZone = *anIter; + + Handle(HYDROData_Polyline) aPolyline = + Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) ); + Handle(HYDROData_Zone) aDtaZone = + Handle(HYDROData_Zone)::DownCast( aDocument->CreateObject( KIND_ZONE ) ); + + if( aPolyline.IsNull() || aDtaZone.IsNull() ) + continue; + + // Fill the polyline data + aPolyline->SetName( aSplittedZone.PolylineName ); + aPolyline->setDimension( 2 ); + + QList 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 + aDtaZone->SetName( aSplittedZone.ZoneName ); + aDtaZone->SetPolyline( aPolyline ); + aDtaZone->SetBorderColor( aSplittedZone.BorderColor ); + aDtaZone->SetFillingColor( aSplittedZone.FillingColor ); + + aSplittedZones.Append( aDtaZone ); + } + + aCalculObj->SetSplittedZones( aSplittedZones ); + theUpdateFlags = UF_Model; return true; } +void HYDROGUI_CalculationOp::onSplitZones() +{ + mySplittedZones.clear(); + + HYDROGUI_CalculationDlg* aPanel = + ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return; + + QApplication::setOverrideCursor( Qt::WaitCursor ); + + QString aPolylineName = aPanel->getPolylineName(); + Handle(HYDROData_Polyline) aBndPolyline = Handle(HYDROData_Polyline)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINE ) ); + + QStringList aZoneNames = aPanel->getSelectedZones(); + HYDROData_SequenceOfObjects aZones = + HYDROGUI_Tool::FindObjectsByNames( module(), aZoneNames, KIND_ZONE ); + + QStringList aResSplittedZones; + + HYDROGUI_SplitZonesTool::SplitDataList aSplittedZones = + HYDROGUI_SplitZonesTool::SplitZones( aZones, aBndPolyline ); + + QString aSplitZonesPrefix = aPanel->getSplitZonesPrefix(); + QStringList aUsedNames; + + HYDROGUI_SplitZonesTool::SplitDataListIterator anIter( aSplittedZones ); + while( anIter.hasNext() ) + { + SplittedZone aSplittedZone; + aSplittedZone.SplitData = anIter.next(); + + aSplittedZone.FillingColor = HYDROGUI_Tool::GenerateFillingColor( module(), aSplittedZone.SplitData.ZoneNames ); + aSplittedZone.BorderColor = QColor( HYDROData_Zone::DefaultBorderColor() ); + + aSplittedZone.ZoneName = HYDROGUI_Tool::GenerateObjectName( module(), aSplitZonesPrefix + "Zone", aUsedNames ); + aSplittedZone.PolylineName = HYDROGUI_Tool::GenerateObjectName( module(), aSplitZonesPrefix + "Poly", aUsedNames ); + + aUsedNames.append( aSplittedZone.ZoneName ); + aUsedNames.append( aSplittedZone.PolylineName ); + + aResSplittedZones.append( aSplittedZone.ZoneName ); + + mySplittedZones.append( aSplittedZone ); + } + + aPanel->setSplittedZones( aResSplittedZones ); + + createPreview(); + + QApplication::restoreOverrideCursor(); +} + +void HYDROGUI_CalculationOp::createPreview() +{ + LightApp_Application* anApp = module()->getApp(); + + if ( !myActiveViewManager ) + { + myActiveViewManager = anApp->activeViewManager(); + } + + if ( !myPreviewViewManager ) + { + myPreviewViewManager = ::qobject_cast( + anApp->createViewManager( OCCViewer_Viewer::Type() ) ); + if ( myPreviewViewManager ) + { + connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), + this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); + + module()->setViewManagerRole( myPreviewViewManager, HYDROGUI_Module::VMR_PreviewCaseZones ); + myPreviewViewManager->setTitle( tr( "PREVIEW_CASE_ZONES" ) ); + } + } + + if ( !myPreviewViewManager ) + return; + + if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() ) + { + Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); + if ( !aCtx.IsNull() ) + { + SplittedZonesList::iterator anIter = mySplittedZones.begin(); + for ( ; anIter != mySplittedZones.end(); ++anIter ) + { + SplittedZone& aSplittedZone = *anIter; + if ( aSplittedZone.Shape ) + delete aSplittedZone.Shape; + + aSplittedZone.Shape = new HYDROGUI_Shape( aCtx ); + + aSplittedZone.Shape->setFillingColor( aSplittedZone.FillingColor, false ); + aSplittedZone.Shape->setBorderColor( aSplittedZone.BorderColor, false ); + aSplittedZone.Shape->setPath( aSplittedZone.SplitData.Path, true ); + } + } + } +} + +void HYDROGUI_CalculationOp::onLastViewClosed( SUIT_ViewManager* theViewManager ) +{ + closePreview(); +} + +void HYDROGUI_CalculationOp::closePreview() +{ + SplittedZonesList::iterator anIter= mySplittedZones.begin(); + for ( ; anIter != mySplittedZones.end(); ++anIter ) + { + SplittedZone& aSplittedZone = *anIter; + if ( aSplittedZone.Shape ) + { + delete aSplittedZone.Shape; + aSplittedZone.Shape = NULL; + } + } + + if( myPreviewViewManager ) + { + disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), + this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); + + module()->getApp()->removeViewManager( myPreviewViewManager ); // myPreviewViewManager is deleted here + myPreviewViewManager = NULL; + } + + if( myActiveViewManager ) + { + HYDROGUI_Tool::SetActiveViewManager( module(), myActiveViewManager ); + myActiveViewManager = NULL; + } +} + diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.h b/src/HYDROGUI/HYDROGUI_CalculationOp.h index 0ca60d2f..46ab3bf0 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.h @@ -25,12 +25,45 @@ #include "HYDROGUI_Operation.h" +#include "HYDROGUI_SplitZonesTool.h" +#include "HYDROGUI_Shape.h" + #include +class SUIT_ViewManager; +class OCCViewer_ViewManager; + class HYDROGUI_CalculationOp : public HYDROGUI_Operation { Q_OBJECT + struct SplittedZone + { + QString ZoneName; + QString PolylineName; + QColor FillingColor; + QColor BorderColor; + HYDROGUI_SplitZonesTool::SplitData SplitData; + HYDROGUI_Shape* Shape; + + SplittedZone() + : Shape( NULL ), + FillingColor( Qt::green ), + BorderColor( Qt::transparent ) + { } + + ~SplittedZone() + { + if ( Shape ) + { + delete Shape; + Shape = NULL; + } + } + }; + + typedef QList SplittedZonesList; + public: HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit ); virtual ~HYDROGUI_CalculationOp(); @@ -44,10 +77,22 @@ protected: virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg ); +protected slots: + void onSplitZones(); + void onLastViewClosed( SUIT_ViewManager* ); + +private: + void createPreview(); + void closePreview(); + private: bool myIsEdit; Handle(HYDROData_Calculation) myEditedObject; + SUIT_ViewManager* myActiveViewManager; + + OCCViewer_ViewManager* myPreviewViewManager; + SplittedZonesList mySplittedZones; }; #endif diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index c7b0cedf..ef136fff 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -522,17 +522,23 @@ Handle(HYDROData_Document) HYDROGUI_DataModel::getDocument() const LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParent, Handle(HYDROData_Object) theModelObject, - const QString& theParentEntry ) + const QString& theParentEntry, + const bool theIsBuildTree ) { HYDROGUI_DataObject* aResObj = new HYDROGUI_DataObject( theParent, theModelObject, theParentEntry ); - buildObjectTree( theParent, aResObj, theParentEntry ); + + if ( theIsBuildTree ) + { + buildObjectTree( theParent, aResObj, theParentEntry ); + } + return aResObj; } LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* theParent, const QString& theName, - const QString& theParentEntry ) + const QString& theParentEntry ) { return new HYDROGUI_NamedObject( theParent, theName, theParentEntry ); } @@ -559,7 +565,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, { Handle(HYDROData_Object) aRefObj = anImageObj->Reference( anIndex ); if ( !aRefObj.IsNull() && !aRefObj->IsRemoved() ) - createObject( aGuiObj, aRefObj, aGuiObj->entry() ); + createObject( aGuiObj, aRefObj, aGuiObj->entry(), false ); } } else if ( anObjectKind == KIND_ZONE ) @@ -567,13 +573,15 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, Handle(HYDROData_Zone) aZoneObj = Handle(HYDROData_Zone)::DownCast( aDataObj ); - LightApp_DataObject* aPolylineSect = createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() ); + LightApp_DataObject* aPolylineSect = + createObject( aGuiObj, tr( "ZONE_POLYLINE" ), aGuiObj->entry() ); Handle(HYDROData_Polyline) aPolyline = aZoneObj->GetPolyline(); if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() ) - createObject( aPolylineSect, aPolyline, aGuiObj->entry() ); + createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false ); - LightApp_DataObject* aBathsSect = createObject( aGuiObj, tr( "ZONE_BATHYMETRIES" ), aGuiObj->entry() ); + LightApp_DataObject* aBathsSect = + createObject( aGuiObj, tr( "ZONE_BATHYMETRIES" ), aGuiObj->entry() ); HYDROData_SequenceOfObjects aZoneBaths = aZoneObj->GetBathymetries(); HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths ); @@ -582,7 +590,45 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, Handle(HYDROData_Bathymetry) aRefBath = Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() ); if( !aRefBath.IsNull() && !aRefBath->IsRemoved() ) - createObject( aBathsSect, aRefBath, aGuiObj->entry() ); + createObject( aBathsSect, aRefBath, aGuiObj->entry(), false ); + } + } + else if ( anObjectKind == KIND_CALCULATION ) + { + Handle(HYDROData_Calculation) aCaseObj = + Handle(HYDROData_Calculation)::DownCast( aDataObj ); + + LightApp_DataObject* aPolylineSect = + createObject( aGuiObj, tr( "CASE_BND_POLYLINE" ), aGuiObj->entry() ); + + Handle(HYDROData_Polyline) aPolyline = aCaseObj->GetBoundaryPolyline(); + if ( !aPolyline.IsNull() && !aPolyline->IsRemoved() ) + createObject( aPolylineSect, aPolyline, aGuiObj->entry(), false ); + + LightApp_DataObject* aRefZonesSect = + createObject( aGuiObj, tr( "CASE_REFERENCE_ZONES" ), aGuiObj->entry() ); + + HYDROData_SequenceOfObjects aRefZones = aCaseObj->GetZones(); + HYDROData_SequenceOfObjects::Iterator anIter( aRefZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aRefZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if( !aRefZone.IsNull() && !aRefZone->IsRemoved() ) + createObject( aRefZonesSect, aRefZone, aGuiObj->entry(), false ); + } + + LightApp_DataObject* aSplittedZonesSect = + createObject( aGuiObj, tr( "CASE_SPLITTED_ZONES" ), aGuiObj->entry() ); + + HYDROData_SequenceOfObjects aSplittedZones = aCaseObj->GetSplittedZones(); + anIter.Init( aSplittedZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aSplittedZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if( !aSplittedZone.IsNull() && !aSplittedZone->IsRemoved() ) + createObject( aSplittedZonesSect, aSplittedZone, aGuiObj->entry(), false ); } } } diff --git a/src/HYDROGUI/HYDROGUI_DataModel.h b/src/HYDROGUI/HYDROGUI_DataModel.h index a4216902..1f2f3fb2 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.h +++ b/src/HYDROGUI/HYDROGUI_DataModel.h @@ -236,7 +236,8 @@ protected: */ LightApp_DataObject* createObject( SUIT_DataObject* theParent, Handle(HYDROData_Object) theModelObject, - const QString& theParentEntry = QString() ); + const QString& theParentEntry = QString(), + const bool theIsBuildTree = true ); /** * Creates the GUI data object without corresponding model object: just by name diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index 2950a9fc..fde4689c 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -51,7 +51,7 @@ public: enum ViewManagerRole { VMR_Unknown = 0, VMR_General, VMR_TransformImage, VMR_ObserveImage, - VMR_PreviewZone }; + VMR_PreviewZone, VMR_PreviewCaseZones }; typedef QPair< SUIT_ViewManager*, ViewManagerRole > ViewManagerInfo; typedef QMap < int, ViewManagerInfo > ViewManagerMap; diff --git a/src/HYDROGUI/HYDROGUI_SplitZonesTool.cxx b/src/HYDROGUI/HYDROGUI_SplitZonesTool.cxx index 590f6877..d570f46c 100644 --- a/src/HYDROGUI/HYDROGUI_SplitZonesTool.cxx +++ b/src/HYDROGUI/HYDROGUI_SplitZonesTool.cxx @@ -24,6 +24,27 @@ #include +void printPath( const QString& thePrefix, const QPainterPath& thePath ) +{ + printf( "%s (n=%d) :", qPrintable( thePrefix ), thePath.elementCount() ); + for( int i = 0, n = thePath.elementCount(); i < n; i++ ) + { + const QPainterPath::Element anElement = thePath.elementAt( i ); + switch( anElement.type ) + { + case QPainterPath::MoveToElement: + printf( " M(%.0f,%.0f)", anElement.x, anElement.y ); + break; + case QPainterPath::LineToElement: + printf( " L(%.0f,%.0f)", anElement.x, anElement.y ); + break; + default: + break; + } + } + printf( "\n" ); +} + HYDROGUI_SplitZonesTool::SplitDataList HYDROGUI_SplitZonesTool::SplitZones( const HYDROData_SequenceOfObjects& theZoneList, const Handle(HYDROData_Polyline)& thePolylie ) @@ -86,25 +107,32 @@ HYDROGUI_SplitZonesTool::SplitTwoData( const SplitData& theData1, const QPainterPath& aPath1 = theData1.Path; const QPainterPath& aPath2 = theData2.Path; + printPath( "aPath1", aPath1 ); + printPath( "aPath2", aPath2 ); const QStringList& aZoneNames1 = theData1.ZoneNames; const QStringList& aZoneNames2 = theData2.ZoneNames; QPainterPath anIntersection = aPath1.intersected( aPath2 ); + printPath( "anIntersection", anIntersection ); + anIntersection.closeSubpath(); + printPath( "anIntersection after closing", anIntersection ); if( anIntersection.isEmpty() ) { aSplitDataList.append( theData1 ); - aSplitDataList.append( theData2 ); + //aSplitDataList.append( theData2 ); } else { aSplitDataList.append( SplitData( anIntersection, aZoneNames1 + aZoneNames2 ) ); QPainterPath aPath1Sub = aPath1.subtracted( aPath2 ); + printPath( "aPath1Sub", aPath1Sub ); if( !aPath1Sub.isEmpty() ) aSplitDataList.append( ExtractSeparateData( SplitData( aPath1Sub, aZoneNames1 ) ) ); QPainterPath aPath2Sub = aPath2.subtracted( aPath1 ); + printPath( "aPath2Sub", aPath2Sub ); if( !aPath2Sub.isEmpty() ) aSplitDataList.append( ExtractSeparateData( SplitData( aPath2Sub, aZoneNames2 ) ) ); } @@ -147,6 +175,7 @@ HYDROGUI_SplitZonesTool::ExtractSeparateData( const SplitData& theData ) const QPainterPath& aPath2 = aPathList.last(); if( aPath1.contains( aPath2 ) || aPath2.contains( aPath1 ) ) { + printf( "HOLE CASE!\n" ); aSplitDataList.append( theData ); return aSplitDataList; } @@ -156,6 +185,7 @@ HYDROGUI_SplitZonesTool::ExtractSeparateData( const SplitData& theData ) while( anIter.hasNext() ) { const QPainterPath& aPath = anIter.next(); + printPath( "aPath", aPath ); aSplitDataList.append( SplitData( aPath, aBaseZoneNames ) ); } return aSplitDataList; diff --git a/src/HYDROGUI/HYDROGUI_SplitZonesTool.h b/src/HYDROGUI/HYDROGUI_SplitZonesTool.h index 03aa5381..7a1b3c21 100644 --- a/src/HYDROGUI/HYDROGUI_SplitZonesTool.h +++ b/src/HYDROGUI/HYDROGUI_SplitZonesTool.h @@ -43,6 +43,8 @@ public: QPainterPath Path; QStringList ZoneNames; + SplitData() {} + SplitData( const QPainterPath& thePath, const QStringList& theZoneNames ) : Path( thePath ), ZoneNames( theZoneNames ) {} diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 3e11ed93..4650f24e 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -29,6 +29,7 @@ #include #include +#include #include @@ -301,30 +302,62 @@ ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule ) } Handle(HYDROData_Object) HYDROGUI_Tool::FindObjectByName( HYDROGUI_Module* theModule, - const QString& theName, + const QString& theName, const ObjectKind theObjectKind ) { Handle(HYDROData_Object) anObject; + if ( theName.isEmpty() ) + return anObject; + + QStringList aNamesList; + aNamesList << theName; + + HYDROData_SequenceOfObjects aSeqOfObjs = FindObjectsByNames( theModule, aNamesList, theObjectKind ); + if( aSeqOfObjs.IsEmpty() ) + return anObject; + + anObject = aSeqOfObjs.First(); + return anObject; +} + +HYDROData_SequenceOfObjects HYDROGUI_Tool::FindObjectsByNames( HYDROGUI_Module* theModule, + const QStringList& theNames, + const ObjectKind theObjectKind ) +{ + HYDROData_SequenceOfObjects aResSeq; + if ( theNames.isEmpty() ) + return aResSeq; Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); if( aDocument.IsNull() ) - return anObject; + return aResSeq; + + QStringList aNamesList = theNames; HYDROData_Iterator anIter( aDocument, theObjectKind ); for( ; anIter.More(); anIter.Next() ) { Handle(HYDROData_Object) anObjectRef = anIter.Current(); - if( !anObjectRef.IsNull() && anObjectRef->GetName() == theName ) - { - anObject = anObjectRef; + if( anObjectRef.IsNull() ) + continue; + + QString anObjName = anObjectRef->GetName(); + if ( anObjName.isEmpty() || !aNamesList.contains( anObjName ) ) + continue; + + aResSeq.Append( anObjectRef ); + + aNamesList.removeAll( anObjName ); + if ( aNamesList.isEmpty() ) break; - } } - return anObject; + + return aResSeq; } -QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule, - const QString& thePrefix ) +QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule, + const QString& thePrefix, + const QStringList& theUsedNames ) { QString aName; int anId = 1; @@ -332,6 +365,9 @@ QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule, { aName = QString( "%1_%2" ).arg( thePrefix ).arg( QString::number( anId++ ) ); + if ( theUsedNames.contains( aName ) ) + continue; + // check that there are no other objects with the same name in the document Handle(HYDROData_Object) anObject = FindObjectByName( theModule, aName, KIND_UNKNOWN ); if( anObject.IsNull() ) @@ -444,3 +480,35 @@ QDockWidget* HYDROGUI_Tool::WindowDock( QWidget* wid ) } return dock; } + +QColor HYDROGUI_Tool::GenerateFillingColor( HYDROGUI_Module* theModule, + const QStringList& theZoneNames ) +{ + QColor aFillingColor( HYDROData_Zone::DefaultFillingColor() ); + + int aCounter = 0; + int aR = 0, aG = 0, aB = 0; + QStringListIterator aZoneNameIter( theZoneNames ); + while( aZoneNameIter.hasNext() ) + { + const QString& aZoneName = aZoneNameIter.next(); + Handle(HYDROData_Zone) aRefZone = Handle(HYDROData_Zone)::DownCast( + FindObjectByName( theModule, aZoneName, KIND_ZONE ) ); + if( !aRefZone.IsNull() ) + { + QColor aRefColor = aRefZone->GetFillingColor(); + aR += aRefColor.red(); + aG += aRefColor.green(); + aB += aRefColor.blue(); + aCounter++; + } + } + + if( aCounter > 0 ) + { + aFillingColor = QColor( aR / aCounter, aG / aCounter, aB / aCounter ); + } + + return aFillingColor; +} + diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index c2552ddc..264adbd5 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -176,14 +176,27 @@ public: const QString& theName, const ObjectKind theObjectKind = KIND_UNKNOWN ); + /** + * \brief Find the data objects with the specified names. + * \param theModule module + * \param theNames list of names + * \param theObjectKind kind of object + * \return list of data objects + */ + static HYDROData_SequenceOfObjects FindObjectsByNames( HYDROGUI_Module* theModule, + const QStringList& theNames, + const ObjectKind theObjectKind = KIND_UNKNOWN ); + /** * \brief Generate name for new object. * \param theModule module * \param thePrefix name prefix + * \param theUsedNames list of already used names * \return generated name */ - static QString GenerateObjectName( HYDROGUI_Module* theModule, - const QString& thePrefix ); + static QString GenerateObjectName( HYDROGUI_Module* theModule, + const QString& thePrefix, + const QStringList& theUsedNames = QStringList() ); /** * \brief Get id of the active GraphicsView view. @@ -228,6 +241,15 @@ public: */ static QDockWidget* WindowDock( QWidget* wid ); + /** + * \brief Generates the filling color for intersected zone + * \param theModule module + * \param theZoneNames list of intersected zones + * \return result color + */ + static QColor GenerateFillingColor( HYDROGUI_Module* theModule, + const QStringList& theZoneNames ); + }; #endif diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 10132b31..e006fe79 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -7,6 +7,18 @@ BATHYMETRY_FILTER Bathymetry files (*.xyz);;All files (*.* *) + + CASE_BND_POLYLINE + Boundary polyline + + + CASE_REFERENCE_ZONES + Reference zones + + + CASE_SPLITTED_ZONES + Splitted zones + FILE_NOT_EXISTS_OR_CANT_BE_READ The file '%1' @@ -68,10 +80,34 @@ does not exist or you have not enough permissions to open it. CALCULATION_NAME Calculation case name + + CALCULATION_REFERENCE_ZONES + Reference zones + + + CALCULATION_SPLITTED_ZONES + Splitted zones + + + PREFIX_SPLITTED_ZONES + Prefix of splitted zones + + + CALCULATION_ZONES + Case zones + + + DEFAULT_PREFIX_SPLITTED_ZONES + Splitt + NAME Name + + SPLIT_REFERENCE_ZONES + Split zones + @@ -84,6 +120,10 @@ does not exist or you have not enough permissions to open it. EDIT_CALCULATION Edit calculation case + + PREVIEW_CASE_ZONES + Preview case zones + -- 2.39.2