0024510: Remove unused local variables
[occt.git] / src / IFSelect / IFSelect_WorkSession.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 06f5bea..c61bada
@@ -1,3 +1,16 @@
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and / or modify it
+// under the terms of the GNU Lesser General Public version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
 //#1 svv   10.01.00 : porting on DEC 
 //smh#14 17.03.2000 : FRA62479 Clearing of gtool
 #include <Standard_ErrorHandler.hxx>
@@ -78,6 +91,7 @@ IFSelect_WorkSession::IFSelect_WorkSession ()
   thecopier->SetShareOut (theshareout);
   thecheckdone = Standard_False;
   thegtool     = new Interface_GTool;
+  themodelstat = Standard_False;
 }
 
 
@@ -228,7 +242,7 @@ void  IFSelect_WorkSession::SetModel
   if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479
 //  themodel->SetProtocol(theprotocol);
   themodel->SetGTool (thegtool);
-  thegtool->Reservate (themodel->NbEntities()+20,Standard_True);
+  
   thegraph.Nullify();
   ComputeGraph();    // fait qqchose si Protocol present. Sinon, ne fait rien
   ClearData(3);      // RAZ CheckList, a refaire
@@ -244,7 +258,6 @@ void  IFSelect_WorkSession::SetModel
 //function : 
 //purpose  : 
 //=======================================================================
-
 Handle(Interface_InterfaceModel)  IFSelect_WorkSession::Model () const 
 {
   return themodel;
@@ -369,8 +382,7 @@ Standard_Integer IFSelect_WorkSession::NumberFromLabel
   }
   if (cnt == 1) return num;
   num = -num;
-//  if (cnt == 0)  cout<<" Label:"<<val<<" -> 0 ent"<<endl;
-//  if (cnt >  0)  cout<<" Label:"<<val<<" ->"<<cnt<<" ent.s, refus"<<endl;
+
   return num;
 }
 
@@ -513,29 +525,35 @@ Standard_Boolean  IFSelect_WorkSession::ComputeGraph
 {
   if (theprotocol.IsNull()) return Standard_False;
   if (themodel.IsNull()) return Standard_False;
-  if (themodel->NbEntities() == 0) return Standard_False;
+  //if (themodel->NbEntities() == 0) return Standard_False;
   if (enforce) thegraph.Nullify();
   if (!thegraph.IsNull()) {
     if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True;
     thegraph.Nullify();
   }
+  if (themodel->NbEntities() == 0) return Standard_False;
   //  Il faut calculer le graphe pour de bon
-  thegraph = new Interface_HGraph (themodel,thegtool);
+  thegraph = new Interface_HGraph (themodel,themodelstat);
   Standard_Integer nb = themodel->NbEntities();
-  Standard_Integer i; // svv #1
-  for (i = 1; i <= nb; i ++) thegraph->CGraph().SetStatus(i,0);
-  Interface_BitMap& bm = thegraph->CGraph().CBitMap();
-  bm.AddFlag();
-  bm.SetFlagName (Flag_Incorrect,"Incorrect");
-  
+  if(themodelstat)
+  {
+    Standard_Integer i; // svv #1
+    for (i = 1; i <= nb; i ++) thegraph->CGraph().SetStatus(i,0);
+    Interface_BitMap& bm = thegraph->CGraph().CBitMap();
+    bm.AddFlag();
+    bm.SetFlagName (Flag_Incorrect,"Incorrect");
+  }
   ComputeCheck();
   thecheckdone = Standard_True;
-  
-//  Calcul des categories, a present memorisees dans le modele
-  Interface_Category categ(thegtool);
-  Interface_ShareTool sht(thegraph);
-  for (i = 1; i <= nb; i ++) themodel->SetCategoryNumber
-    (i,categ.CatNum(themodel->Value(i),sht));
+  if(themodelstat)
+  {
+    //  Calcul des categories, a present memorisees dans le modele
+    Interface_Category categ(thegtool);
+    Interface_ShareTool sht(thegraph);
+    Standard_Integer i =1;
+    for ( ; i <= nb; i ++) themodel->SetCategoryNumber
+      (i,categ.CatNum(themodel->Value(i),sht));
+  }
 
   return Standard_True;
 }
@@ -629,20 +647,21 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck
   Interface_CheckTool cht(thegraph);
   Interface_CheckIterator checklist = cht.VerifyCheckList();
   themodel->FillSemanticChecks(checklist,Standard_False);
-
-//  Et on met a jour le Graphe (BitMap) !  Flag Incorrect (STX + SEM)
-  Interface_BitMap& BM = CG.CBitMap();
-  BM.Init (Standard_False,Flag_Incorrect);
-  Standard_Integer num, nb = CG.Size();
-  for (checklist.Start(); checklist.More(); checklist.Next()) {
-    const Handle(Interface_Check) chk = checklist.Value();
-    if (!chk->HasFailed()) continue;
-    num = checklist.Number();
-    if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
+  if(themodelstat)
+  {
+    //  Et on met a jour le Graphe (BitMap) !  Flag Incorrect (STX + SEM)
+    Interface_BitMap& BM = CG.CBitMap();
+    BM.Init (Standard_False,Flag_Incorrect);
+    Standard_Integer num, nb = CG.Size();
+    for (checklist.Start(); checklist.More(); checklist.Next()) {
+      const Handle(Interface_Check) chk = checklist.Value();
+      if (!chk->HasFailed()) continue;
+      num = checklist.Number();
+      if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect);
+    }
+    for (num = 1; num <= nb; num ++)
+      if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
   }
-  for (num = 1; num <= nb; num ++)
-    if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect);
-
   return Standard_True;
 }
 
@@ -852,7 +871,6 @@ Standard_Integer IFSelect_WorkSession::AddItem
   if (id > 0) {
     Handle(Standard_Transient)& att = theitems.ChangeFromIndex(id);
     if (att.IsNull()) att = item;
-////    if (theitems.FindFromIndex(id).IsNull()) id0 = theitems.Add(item,item);
   }
   else id = theitems.Add(item,item);
 
@@ -923,17 +941,7 @@ Standard_Boolean IFSelect_WorkSession::SetActive
       return Standard_True;
     }
   }
-/*      UTILISER EXPLICITEMENT  SetAppliedModifier
-  if (item->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier))) {
-    DeclareAndCast(IFSelect_GeneralModifier,modif,item);
-    if (mode) {
-      theshareout->AddModifier(modif,0);
-      return Standard_True;
-    } else {
-      return theshareout->RemoveItem(modif);
-    }
-  }
-*/
+
   return Standard_False;
 }
 
@@ -963,10 +971,7 @@ Standard_Boolean IFSelect_WorkSession::RemoveName
 {
   Handle(Standard_Transient) item = NamedItem(name);
   if (item.IsNull()) return Standard_False;
-#ifdef DEB
-  Standard_Integer bid = 
-#endif
-    theitems.Add(item,item);    // reste mais sans nom
+  theitems.Add(item,item);    // reste mais sans nom
   return thenames->RemoveItem(name);
 }
 
@@ -1362,8 +1367,7 @@ Interface_EntityIterator IFSelect_WorkSession::EvalSelection
   }
 
   if (thegraph.IsNull()) return iter;
-//  if (ItemIdent(sel) != 0) iter = sel->UniqueResult(thegraph->Graph());
-  iter = sel->UniqueResult(thegraph->Graph());
+ iter = sel->UniqueResult(thegraph->Graph());
   return iter;
 }
 
@@ -1444,11 +1448,7 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::SelectionResultFromLi
 //  ssel est la derniere selection auscultee,  deduct son downcast
 //  input son Input (nulle  si sel  pas une deduction)
   deduct = GetCasted(IFSelect_SelectDeduct,ssel);
-/*
-  Handle(IFSelect_SelectPointed) sp = new IFSelect_SelectPointed;
-  sp->AddList(list);
-  deduct->SetInput (sp);
-*/
+
   deduct->Alternate()->SetList (list);
 
 //   On execute puis on nettoie
@@ -2491,7 +2491,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::SendAll
   Handle_Interface_Check aMainFail = checks.CCheck(0);
   if (!aMainFail.IsNull() && aMainFail->HasFailed ())
   {
-        return IFSelect_RetStop;
+    return IFSelect_RetStop;
   }
   if (theloaded.Length() == 0) theloaded.AssignCat(filename);
   thecheckrun = checks;
@@ -2818,7 +2818,7 @@ void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
 {
   if (!IsLoaded()) return;
   Standard_Integer i,nb = themodel->NbEntities();
-  thecheckana = TCollection_AsciiString (' ',nb+1);
+  thecheckana = TCollection_AsciiString (nb+1,' ');
   for (chl.Start(); chl.More(); chl.Next()) {
     Standard_Integer num = chl.Number();
     const Handle(Interface_Check) ach = chl.Value();
@@ -2828,7 +2828,7 @@ void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl)
 //  analyse selon le graphe ... codes : blc = rien
 //  1 W/place  2 F/place  3 Wprop 4Wprop+W/place  5Wprop+F/place
 //  6 Fprop  7 Fprop+W/place  8 Fprop+F/place
-  Interface_IntList list = thegraph->Graph().SharingNums(0);
+  Interface_IntList list;// = thegraph->Graph().SharingNums(0);
 //   deux passes : d abord Warning, puis Fail
   for (i = 1; i <= nb; i ++) {
     char val = thecheckana.Value(i);
@@ -2899,16 +2899,6 @@ Standard_Integer IFSelect_WorkSession::QueryParent
     Standard_Integer stat = QueryParent ( entdad,list->Value(i) );
     if (stat >= 0) return stat+1;
   }
-/*
-  Interface_IntList sharings = thegraph->Graph().SharingNums (nson);
-  Standard_Integer i, nb = sharings.Length();
-  for (i = 1; i <= nb; i ++) {
-    if (sharings.Value(i) == nson) return 1;
-    Standard_Integer stat = QueryParent
-      ( entson,StartingEntity(sharings.Value(i)) );
-    if (stat >= 0) return stat+1;
-  }
-*/
   return -1;  // not yet implemented ...
 }
 
@@ -3444,8 +3434,6 @@ void IFSelect_WorkSession::DumpModel
     if (level == 5 || level ==  8) mode = IFSelect_CountByItem;
     if (level == 6 || level ==  9) mode = IFSelect_ListByItem;
     if (level == 7 || level == 10) mode = IFSelect_EntitiesByItem;
-    Standard_Boolean failsonly = Standard_False;
-    if (level < 8 && level != 4) failsonly = Standard_True;
     PrintCheckList (ModelCheckList(),Standard_False, mode);
   } else {
     if (level == 3) S << "        ********  Check Model (Fails)  ********"<<endl;
@@ -3602,7 +3590,7 @@ void IFSelect_WorkSession::PrintCheckList
     Interface_CheckIterator chks = checklist;
     Handle(IFSelect_CheckCounter) counter =
       new IFSelect_CheckCounter (mode>1 && mode != IFSelect_CountSummary);
-    counter->Analyse (chks,themodel,Standard_False,failsonly);
+    counter->Analyse (chks,themodel,Standard_True,failsonly);
     counter->PrintList  (sout,themodel,mode);
   }
 }
@@ -3884,3 +3872,13 @@ void IFSelect_WorkSession::ListEntities
     sout<<"\n    Abandon"<<endl;
   }
 }
+
+void IFSelect_WorkSession::SetModeStat( Standard_Boolean theStatMode)
+{
+  themodelstat = theStatMode;
+}
+
+Standard_Boolean IFSelect_WorkSession::GetModeStat() const
+{
+  return themodelstat;
+}