void HYDROData_CalculationCase::Update()
{
HYDROData_Entity::Update();
+ SetWarning();
// At first we remove previously created objects
RemoveRegions();
const HYDROData_SplitToZonesTool::SplitDataList& theZones )
{
QMap<QString, Handle(HYDROData_Region)> aRegionsMap; //object name to region
+ QMap<QString, QString> aRegionNameToObjNameMap;
QString aZonesPref = CALCULATION_ZONES_PREF;
HYDROData_PriorityQueue aPr( this );
QString aRegName = anObjName + "_reg";
Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegName, false );
aRegionsMap.insert( anObjName, aRegion );
+ aRegionNameToObjNameMap.insert( aRegName, anObjName );
}
// 2. Now for each zone it is necessary to determine the most priority object
}
}
- //TODO: inform if some regions remain empty
+ QStringList anObjectsWithEmptyRegions;
+ QMap<QString, Handle(HYDROData_Region)>::const_iterator
+ anIt = aRegionsMap.begin(), aLast = aRegionsMap.end();
+ for( ; anIt!=aLast; anIt++ )
+ {
+ Handle(HYDROData_Region) aRegion = anIt.value();
+ if( aRegion->GetZones().IsEmpty() )
+ {
+ QString aRegName = aRegion->GetName();
+ QString anObjName = aRegionNameToObjNameMap[aRegName];
+ anObjectsWithEmptyRegions.append( anObjName );
+ }
+ }
+
+ if( !anObjectsWithEmptyRegions.empty() )
+ {
+ QString aData = anObjectsWithEmptyRegions.join( ", " );
+ SetWarning( WARN_EMPTY_REGIONS, aData );
+ }
}
void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
}
-QString HYDROData_CalculationCase::DumpRules()
+QString HYDROData_CalculationCase::DumpRules() const
{
TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
return HYDROData_PriorityQueue::DumpRules( aRulesLab );
TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
HYDROData_PriorityQueue::DumpRulesToPython( aRulesLab, theCalcCaseName, theScript );
}
+
+HYDROData_Warning HYDROData_CalculationCase::GetLastWarning() const
+{
+ return myLastWarning;
+}
+
+void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const QString& theData )
+{
+ myLastWarning.Type = theType;
+ myLastWarning.Data = theData;
+}
#include <HYDROData_SplitToZonesTool.h>
#include <HYDROData_PriorityQueue.h>
#include <HYDROData_Zone.h>
+#include <HYDROData_Warning.h>
// IDL includes
#include <SALOMEconfig.h>
const Handle(HYDROData_Object)& theObject2,
HYDROData_Zone::MergeAltitudesType theMergeType );
- HYDRODATA_EXPORT QString DumpRules();
+ HYDRODATA_EXPORT QString DumpRules() const;
+
+ HYDRODATA_EXPORT HYDROData_Warning GetLastWarning() const;
private:
void DumpRulesToPython( const QString& theCalcCaseName, QStringList& theScript ) const;
+ void SetWarning( HYDROData_WarningType theType = WARN_OK, const QString& theData = "" );
+
protected:
friend class HYDROData_Iterator;
* Destructs properties of the object and object itself, removes it from the document.
*/
HYDRODATA_EXPORT ~HYDROData_CalculationCase();
+
+private:
+ HYDROData_Warning myLastWarning;
};
#endif