+
+/**
+ Check if the given pair of objects is already used.
+ @return true if the pair is used
+ */
+bool HYDROGUI_PriorityTableModel::isUsed( const Handle(HYDROData_Entity)& theObj1,
+ const Handle(HYDROData_Entity)& theObj2 ) const
+{
+ bool isUsed = false;
+
+ foreach ( const HYDROData_CustomRule& aRule, myRules ) {
+ if ( ( aRule.Object1->GetName() == theObj1->GetName() &&
+ aRule.Object2->GetName() == theObj2->GetName() ) ||
+ ( aRule.Object1->GetName() == theObj2->GetName() &&
+ aRule.Object2->GetName() == theObj1->GetName() ) ) {
+ isUsed = true;
+ break;
+ }
+ }
+
+ return isUsed;
+}
+
+/**
+ Get available object names.
+ @return the list of object names
+ */
+QStringList HYDROGUI_PriorityTableModel::getAvailableObjectNames() const
+{
+ QStringList aNames;
+
+ foreach ( const Handle(HYDROData_Entity) anObj, myObjects ) {
+ if ( !anObj.IsNull() ) {
+ aNames << anObj->GetName();
+ }
+ }
+
+ return aNames;
+}
+
+/**
+ Set number of columns in the table.
+ @param theColumnCount the number of columns
+ */
+void HYDROGUI_PriorityTableModel::setColumnCount( int theColumnCount )
+{
+ myColumnCount = theColumnCount;
+}
+
+/**
+ Undo last change in the list of priority rules.
+ */
+void HYDROGUI_PriorityTableModel::undoLastChange()
+{
+ beginResetModel();
+ myRules = myPrevRules;
+ endResetModel();
+}
+
+/**
+ Get type of objects for which rules are defined assuming,
+ that all objects in the list have the same type.
+ @return the type of objects
+ */
+const ObjectKind HYDROGUI_PriorityTableModel::getObjectsKind() const
+{
+ if ( myObjects.isEmpty() )
+ return KIND_UNKNOWN;
+
+ return myObjects.at( 0 )->GetKind();
+}