myLastWarning.Type = theType;
myLastWarning.Data = theData;
}
+
+int HYDROData_CalculationCase::GetRulesCount() const
+{
+ TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
+ return HYDROData_PriorityQueue::GetRulesCount( aRulesLab );
+}
+
+bool HYDROData_CalculationCase::GetRule( int theIndex,
+ Handle(HYDROData_Object)& theObject1,
+ HYDROData_PriorityType& thePriority,
+ Handle(HYDROData_Object)& theObject2,
+ HYDROData_Zone::MergeAltitudesType& theMergeType ) const
+{
+ TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
+ return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
+ theObject1, thePriority, theObject2, theMergeType );
+}
HYDROData_PriorityType thePriority,
const Handle(HYDROData_Object)& theObject2,
HYDROData_Zone::MergeAltitudesType theMergeType );
+ HYDRODATA_EXPORT int GetRulesCount() const;
+ HYDRODATA_EXPORT bool GetRule( int theIndex,
+ Handle(HYDROData_Object)& theObject1,
+ HYDROData_PriorityType& thePriority,
+ Handle(HYDROData_Object)& theObject2,
+ HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
HYDRODATA_EXPORT QString DumpRules() const;
theScript << aRule;
}
}
+
+int HYDROData_PriorityQueue::GetRulesCount( const TDF_Label& theRulesLab )
+{
+ return theRulesLab.NbChildren();
+}
+
+bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab,
+ int theIndex,
+ Handle(HYDROData_Object)& theObject1,
+ HYDROData_PriorityType& thePriority,
+ Handle(HYDROData_Object)& theObject2,
+ HYDROData_Zone::MergeAltitudesType& theMergeType )
+{
+ TDF_Label aRuleLabel = theRulesLab.FindChild( theIndex );
+
+ Handle(TDataStd_ReferenceList) aRefs1, aRefs2;
+ Handle(TDataStd_Integer) aPriorityAttr, aMergeAttr;
+
+ bool isObj1OK = aRuleLabel.FindChild ( Object1_Tag ). FindAttribute( TDataStd_ReferenceList::GetID(), aRefs1 );
+ bool isPriorityOK = aRuleLabel.FindChild( Priority_Tag ).FindAttribute( TDataStd_Integer::GetID(), aPriorityAttr );
+ bool isObj2OK = aRuleLabel.FindChild ( Object2_Tag ). FindAttribute( TDataStd_ReferenceList::GetID(), aRefs2 );
+ bool isMergeOK = aRuleLabel.FindChild ( Merge_Tag ). FindAttribute( TDataStd_Integer::GetID(), aMergeAttr );
+
+ bool isOK = isObj1OK && isPriorityOK && isObj2OK && isMergeOK;
+ if( isOK )
+ {
+ theObject1 = Handle_HYDROData_Object::DownCast( HYDROData_Iterator::Object( aRefs1->First() ) );
+ thePriority = ( HYDROData_PriorityType ) aPriorityAttr->Get();
+ theObject2 = Handle_HYDROData_Object::DownCast( HYDROData_Iterator::Object( aRefs2->First() ) );
+ theMergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
+ }
+ return isOK;
+}
static void DumpRulesToPython( const TDF_Label& theRulesLab,
const QString& theCalcCaseName,
QStringList& theScript );
-
+ static int GetRulesCount( const TDF_Label& theRulesLab );
+ static bool GetRule( const TDF_Label& theRulesLab,
+ int theIndex,
+ Handle(HYDROData_Object)& theObject1,
+ HYDROData_PriorityType& thePriority,
+ Handle(HYDROData_Object)& theObject2,
+ HYDROData_Zone::MergeAltitudesType& theMergeType );
private:
typedef QMap<QString, Handle(HYDROData_Object)> MapNameToObject;