Salome HOME
Fix pb with OCCT 6.8.0 patch master
authorvsr <vsr@opencascade.com>
Mon, 25 May 2015 08:10:44 +0000 (11:10 +0300)
committervsr <vsr@opencascade.com>
Mon, 25 May 2015 08:10:44 +0000 (11:10 +0300)
config_files/patches/OCCT-6.8.0.patch [new file with mode: 0644]
config_files/patches/OCCT-6.8.0_SRC.patch [deleted file]

diff --git a/config_files/patches/OCCT-6.8.0.patch b/config_files/patches/OCCT-6.8.0.patch
new file mode 100644 (file)
index 0000000..667301a
--- /dev/null
@@ -0,0 +1,10480 @@
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/drv/BRepBlend/BRepBlend_Walking_0.cxx OCCT-6.8.0_SRC-patch/drv/BRepBlend/BRepBlend_Walking_0.cxx
+--- OCCT-6.8.0_SRC/drv/BRepBlend/BRepBlend_Walking_0.cxx       2014-11-11 17:53:30.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/drv/BRepBlend/BRepBlend_Walking_0.cxx 2015-01-16 14:33:41.000000000 +0300
+@@ -22,6 +22,7 @@
+ #include <Blend_Point.hxx>
+ #include <Blend_Function.hxx>
+ #include <Blend_FuncInv.hxx>
++#include <ChFiDS_HElSpine.hxx>
+ #include <gp_Pnt2d.hxx>
+ #include <IntSurf_Transition.hxx>
+  
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/AIS_InteractiveContext.hxx OCCT-6.8.0_SRC-patch/inc/AIS_InteractiveContext.hxx
+--- OCCT-6.8.0_SRC/inc/AIS_InteractiveContext.hxx      2014-11-11 17:54:39.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/AIS_InteractiveContext.hxx        2015-01-16 14:34:51.000000000 +0300
+@@ -239,13 +239,6 @@
+   //! Local Context opened.
+   Standard_EXPORT   Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1) ;
+   
+-  //! Removes the interactive object aniobj from all viewers.
+-  //! If a local context is open and if updateviewer equals
+-  //! Standard_False, the presentation of the Interactive
+-  //! Object activates the selection mode; the object is
+-  //! displayed but no viewer will be updated.
+-  Standard_EXPORT   void Clear (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True) ;
+-  
+   //! Empties the graphic presentation of the mode
+   //! indexed by aMode.
+   //! If a local context is open and if updateviewer equals
+@@ -1633,6 +1626,12 @@
+   Standard_EXPORT   void InitAttributes() ;
+   
+   Standard_EXPORT   Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr) ;
++  
++  //! UNKNOWN
++  Standard_EXPORT   void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True) ;
++  
++  //! UNKNOWN
++  Standard_EXPORT   void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True) ;
+   AIS_DataMapOfIOStatus myObjects;
+   Handle(SelectMgr_SelectionManager) mgrSelector;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Blend_Walking_1.gxx OCCT-6.8.0_SRC-patch/inc/Blend_Walking_1.gxx
+--- OCCT-6.8.0_SRC/inc/Blend_Walking_1.gxx     2014-11-11 17:46:43.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/Blend_Walking_1.gxx       2015-01-16 12:59:38.000000000 +0300
+@@ -56,6 +56,7 @@
+ void Blend_Walking::Perform(Blend_Function& Func,
+                           Blend_FuncInv& FuncInv,
++                            const Handle(ChFiDS_HElSpine)& HGuide,
+                           const Standard_Real Pdep,   
+                           const Standard_Real Pmax,
+                           const Standard_Real MaxStep,
+@@ -154,7 +155,7 @@
+     }
+   }
+-  InternalPerform(Func,FuncInv,Pmax);
++  InternalPerform(Func,FuncInv,HGuide,Pmax);
+   done = Standard_True;
+ }
+@@ -461,7 +462,8 @@
+   previousP.ParametersOnS1(sol(1),sol(2));
+   previousP.ParametersOnS2(sol(3),sol(4));
+-  InternalPerform(Func,FuncInv,P);
++  Handle(ChFiDS_HElSpine) anHGuide;
++  InternalPerform(Func,FuncInv,anHGuide,P);
+   return Standard_True;
+ }
+@@ -502,7 +504,8 @@
+   if(OnS1) clasonS1 = Standard_False;
+   else clasonS2 = Standard_False;
+-  InternalPerform(Func,FuncInv,P);
++  Handle(ChFiDS_HElSpine) anHGuide;
++  InternalPerform(Func,FuncInv,anHGuide,P);
+   clasonS1 = Standard_True;
+   clasonS2 = Standard_True;
+@@ -548,7 +551,8 @@
+   previousP.ParametersOnS1(sol(1),sol(2));
+   previousP.ParametersOnS2(sol(3),sol(4));
+-  InternalPerform(Func,FuncInv,Pmin);
++  Handle(ChFiDS_HElSpine) anHGuide;
++  InternalPerform(Func,FuncInv,anHGuide,Pmin);
+   iscomplete = Standard_True;
+   return Standard_True;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Blend_Walking_4.gxx OCCT-6.8.0_SRC-patch/inc/Blend_Walking_4.gxx
+--- OCCT-6.8.0_SRC/inc/Blend_Walking_4.gxx     2014-11-11 17:46:43.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/Blend_Walking_4.gxx       2015-01-16 12:59:38.000000000 +0300
+@@ -12,6 +12,8 @@
+ // Alternatively, this file may be used under the terms of Open CASCADE
+ // commercial license or contractual agreement.
++#include <gce_MakePln.hxx>
++
+ static void evalpinit(math_Vector& parinit,
+                     const Blend_Point& previousP,
+                     const Standard_Real parprec,
+@@ -65,6 +67,7 @@
+ void Blend_Walking::InternalPerform(Blend_Function& Func,
+                                   Blend_FuncInv& FuncInv,
++                                    const Handle(ChFiDS_HElSpine)& HGuide,
+                                   const Standard_Real Bound)
+ {
+@@ -251,12 +254,64 @@
+         // avec les surfaces periodiques.
+         State = Blend_OnRst12;
+         param =  (w1+w2)/2;
++          gp_Pnt Pnt1, Pnt2;
+         p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
+         sol(1) = p2d.X();
+         sol(2) = p2d.Y();
++          Pnt1 = TheSurfaceTool::Value(surf1,sol(1),sol(2));
+         p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
+         sol(3) = p2d.X();
+         sol(4) = p2d.Y();
++          Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
++          if (!HGuide.IsNull())
++          {
++            const Standard_Real TolProd = 1.e-5;
++            Standard_Real SavedParams [2];
++            Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
++            ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
++            SavedParams[0] = theElSpine.GetSavedFirstParameter();
++            SavedParams[1] = theElSpine.GetSavedLastParameter();
++            for (Standard_Integer ind = 0; ind < 2; ind++)
++            {
++              if (!Precision::IsInfinite(SavedParams[ind]))
++              {
++                //Check the original first and last parameters of guide curve
++                //for equality to found parameter <param>:
++                //check equality of tangent to guide curve and
++                //normal to plane built on 3 points:
++                //point on guide curve and points on restrictions of adjacent
++                //surfaces.
++                gp_Pnt Pnt0;
++                gp_Vec Dir0;
++                HGuide->D1(SavedParams[ind], Pnt0, Dir0);
++                Standard_Real Length = Dir0.Magnitude();
++                if (Length <= gp::Resolution())
++                  continue;
++                Dir0 /= Length;
++                gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
++                if (!PlaneBuilder.IsDone())
++                  continue;
++                gp_Pln thePlane = PlaneBuilder.Value();
++                gp_Dir DirPlane = thePlane.Axis().Direction();
++                gp_Vec theProd = Dir0 ^ DirPlane;
++                Standard_Real ProdMod = theProd.Magnitude();
++                if (ProdMod <= TolProd)
++                  SameDirs[ind] = Standard_True;
++              }
++            }
++            Standard_Real theParam = Precision::Infinite();
++            //Choose the closest parameter
++            if (SameDirs[0] && SameDirs[1])
++              theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
++                SavedParams[0] : SavedParams[1];
++            else if (SameDirs[0])
++              theParam = SavedParams[0];
++            else if (SameDirs[1])
++              theParam = SavedParams[1];
++            
++            if (!Precision::IsInfinite(theParam))
++              param = theParam;
++          }
+       }
+       else if (recad1) {
+         // sol sur 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/BRepBlend_Walking.hxx OCCT-6.8.0_SRC-patch/inc/BRepBlend_Walking.hxx
+--- OCCT-6.8.0_SRC/inc/BRepBlend_Walking.hxx   2014-11-11 17:53:30.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/BRepBlend_Walking.hxx     2015-01-16 14:33:41.000000000 +0300
+@@ -22,6 +22,7 @@
+ #include <Handle_Adaptor2d_HCurve2d.hxx>
+ #include <Handle_Adaptor3d_HCurve.hxx>
+ #include <Standard_Integer.hxx>
++#include <Handle_ChFiDS_HElSpine.hxx>
+ #include <TopAbs_State.hxx>
+ #include <Blend_Status.hxx>
+ class BRepBlend_Line;
+@@ -41,6 +42,7 @@
+ class Blend_Point;
+ class Blend_Function;
+ class Blend_FuncInv;
++class ChFiDS_HElSpine;
+ class gp_Pnt2d;
+ class IntSurf_Transition;
+@@ -59,7 +61,7 @@
+   
+   Standard_EXPORT   void AddSingularPoint (const Blend_Point& P) ;
+   
+-  Standard_EXPORT   void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False) ;
++  Standard_EXPORT   void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False) ;
+   
+   Standard_EXPORT   Standard_Boolean PerformFirstSection (Blend_Function& F, const Standard_Real Pdep, math_Vector& ParDep, const Standard_Real Tolesp, const Standard_Real TolGuide, TopAbs_State& Pos1, TopAbs_State& Pos2) ;
+   
+@@ -99,7 +101,7 @@
+ private:
+   
+-  Standard_EXPORT   void InternalPerform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Bound) ;
++  Standard_EXPORT   void InternalPerform (Blend_Function& F, Blend_FuncInv& FInv, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Real Bound) ;
+   
+   Standard_EXPORT   Standard_Integer ArcToRecadre (const Standard_Boolean OnFirst, const math_Vector& Sol, const Standard_Integer PrevIndex, gp_Pnt2d& lpt2d, gp_Pnt2d& pt2d, Standard_Real& ponarc) ;
+   
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/ChFiDS_ElSpine.hxx OCCT-6.8.0_SRC-patch/inc/ChFiDS_ElSpine.hxx
+--- OCCT-6.8.0_SRC/inc/ChFiDS_ElSpine.hxx      2014-11-11 17:53:46.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/ChFiDS_ElSpine.hxx        2015-01-16 14:33:58.000000000 +0300
+@@ -56,6 +56,10 @@
+   
+   Standard_EXPORT virtual   Standard_Real LastParameter()  const;
+   
++  Standard_EXPORT   Standard_Real GetSavedFirstParameter()  const;
++  
++  Standard_EXPORT   Standard_Real GetSavedLastParameter()  const;
++  
+   Standard_EXPORT   GeomAbs_Shape Continuity()  const;
+   
+   Standard_EXPORT   Standard_Integer NbIntervals (const GeomAbs_Shape S) ;
+@@ -91,6 +95,10 @@
+   
+   Standard_EXPORT   void LastParameter (const Standard_Real P) ;
+   
++  Standard_EXPORT   void SaveFirstParameter() ;
++  
++  Standard_EXPORT   void SaveLastParameter() ;
++  
+   Standard_EXPORT   void SetOrigin (const Standard_Real O) ;
+   
+   Standard_EXPORT   void FirstPointAndTgt (gp_Pnt& P, gp_Vec& T)  const;
+@@ -149,6 +157,8 @@
+   Standard_Real plast;
+   Standard_Real period;
+   Standard_Boolean periodic;
++  Standard_Real pfirstsav;
++  Standard_Real plastsav;
+ };
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Graphic3d_GraphicDriver.hxx OCCT-6.8.0_SRC-patch/inc/Graphic3d_GraphicDriver.hxx
+--- OCCT-6.8.0_SRC/inc/Graphic3d_GraphicDriver.hxx     2014-11-11 17:54:46.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/Graphic3d_GraphicDriver.hxx       2015-01-16 14:34:57.000000000 +0300
+@@ -130,9 +130,6 @@
+   //! call_togl_setvisualisation
+   Standard_EXPORT virtual   void SetVisualisation (const Graphic3d_CView& ACView)  = 0;
+   
+-  //! call_togl_transparency
+-  Standard_EXPORT virtual   void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)  = 0;
+-  
+   //! call_togl_view
+   Standard_EXPORT virtual   Standard_Boolean View (Graphic3d_CView& ACView)  = 0;
+   
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntPatch_ImpImpIntersection_4.gxx OCCT-6.8.0_SRC-patch/inc/IntPatch_ImpImpIntersection_4.gxx
+--- OCCT-6.8.0_SRC/inc/IntPatch_ImpImpIntersection_4.gxx       2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/IntPatch_ImpImpIntersection_4.gxx 2015-01-16 13:01:24.000000000 +0300
+@@ -1151,6 +1151,7 @@
+                                         const Standard_Real theUlSurf1,
+                                         const Standard_Real thePeriodOfSurf1,
+                                         const Handle(IntSurf_LineOn2S)& theLine,
++                                        const Standard_Real theTol3D,
+                                         const Standard_Real theTol2D,
+                                         const Standard_Boolean theFlForce)
+ {
+@@ -1177,6 +1178,32 @@
+                         thePntOnSurf2.X(), thePntOnSurf2.Y());
+   }
++  const Standard_Integer aNbPnts = theLine->NbPoints();
++  if(aNbPnts > 0)
++  {
++    Standard_Real aUl = 0.0, aVl = 0.0;
++    const IntSurf_PntOn2S aPlast = theLine->Value(aNbPnts);
++    if(isTheReverse)
++      aPlast.ParametersOnS2(aUl, aVl);
++    else
++      aPlast.ParametersOnS1(aUl, aVl);
++
++    if(anUpar <= aUl)
++    {//Parameter value will be always increased.
++      return Standard_False;
++    }
++
++    //theTol2D is minimal step along parameter changed. 
++    //Therefore, if we apply this minimal step two 
++    //neighbour points will be always "same". Consequently,
++    //we should reduce tolerance for IsSame checking.
++    const Standard_Real aDTol = 1.0-Epsilon(1.0);
++    if(aPnt.IsSame(aPlast, theTol3D*aDTol, theTol2D*aDTol))
++    {
++      theLine->RemovePoint(aNbPnts);
++    }
++  }
++
+   theLine->Add(aPnt);
+   return Standard_True;
+ }
+@@ -1191,6 +1218,7 @@
+                                           const stCoeffsValue& theCoeffs,
+                                           const Bnd_Box2d& theUVSurf1,
+                                           const Bnd_Box2d& theUVSurf2,
++                                          const Standard_Real theTol3D,
+                                           const Standard_Real theTol2D,
+                                           const Standard_Real thePeriod,
+                                           const Standard_Real theNulValue,
+@@ -1281,7 +1309,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+                           gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
+                           aUSurf1f, aUSurf1l, thePeriod,
+-                          theWL->Curve(), theTol2D, theFlForce);
++                          theWL->Curve(), theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1313,7 +1341,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
+                         aUSurf1f, aUSurf1l, thePeriod,
+-                        theWL->Curve(), theTol2D, theFlForce);
++                        theWL->Curve(),theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1346,7 +1374,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
+                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
+                         aUSurf1f, aUSurf1l, thePeriod,
+-                        theWL->Curve(), theTol2D, theFlForce);
++                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1376,7 +1404,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+                         gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
+                         aUSurf1f, aUSurf1l, thePeriod,
+-                        theWL->Curve(), theTol2D, theFlForce);
++                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1545,7 +1573,8 @@
+   {
+     Standard_Real &a = theU1crit[i],
+                   &b = theU1crit[i-1];
+-    if(Abs(a - b) < theTol2D)
++    const Standard_Real aRemain = fmod(Abs(a - b), thePeriod); // >= 0, because Abs(a - b) >= 0
++    if((Abs(a - b) < theTol2D) || (aRemain < theTol2D) || (Abs(aRemain - thePeriod) < theTol2D))
+     {
+       a = (a + b)/2.0;
+       b = Precision::Infinite();
+@@ -1817,6 +1846,7 @@
+     Standard_Boolean isAddedIntoWL1 = Standard_False, isAddedIntoWL2 = Standard_False;
+     Standard_Real anUf = aU1f[aCurInterval], anUl = aU1l[aCurInterval];
++    const Standard_Boolean isDeltaPeriod  = IsEqual(anUl-anUf, aPeriod);
+     //Inscribe and sort critical points
+     InscribeAndSortArray(anU1crit, aNbCritPointsMax, anUf, anUl, theTol2D, aPeriod);
+@@ -1830,6 +1860,8 @@
+       Handle(IntPatch_WLine) aWLine2 = new IntPatch_WLine(aL2S2, Standard_False);
+       Standard_Integer aWL1FindStatus = 0, aWL2FindStatus = 0;
++      Standard_Boolean  isAddingWL1Enabled = Standard_True,
++                        isAddingWL2Enabled = Standard_True;
+       Standard_Real anU1 = anUf;
+@@ -1845,6 +1877,23 @@
+       while(anU1 <= anUl)
+       {
++        if(isDeltaPeriod)
++        {
++          if(IsEqual(anU1, anUl))
++          {
++            //if isAddedIntoWL* == TRUE WLine contains only one point
++            //(which was end point of previous WLine). If we will
++            //add point found on the current step WLine will contain only
++            //two points. At that both these points will be equal to the
++            //points found earlier. Therefore, new WLine will repeat 
++            //already existing WLine. Consequently, it is necessary 
++            //to forbid building new line in this case.
++
++            isAddingWL1Enabled = !isAddedIntoWL1;
++            isAddingWL2Enabled = !isAddedIntoWL2;
++          }
++        }
++
+         for(Standard_Integer i = 0; i < aNbCritPointsMax; i++)
+         {
+           if((anU1 - anU1crit[i])*aCriticalDelta[i] < 0.0)
+@@ -1995,123 +2044,129 @@
+           isFirst = Standard_False;
+         }
+-        if( ((aUSurf2f-aU21) <= theTol2D) && 
+-            ((aU21-aUSurf2l) <= theTol2D) &&
+-            ((aVSurf1f - aV11) <= theTol2D) && 
+-            ((aV11 - aVSurf1l) <= theTol2D) &&
+-            ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
++        if(isAddingWL1Enabled)
+         {
+-          Standard_Boolean isForce = Standard_False;
+-          if(!aWL1FindStatus)
++          if( ((aUSurf2f-aU21) <= theTol2D) && 
++              ((aU21-aUSurf2l) <= theTol2D) &&
++              ((aVSurf1f - aV11) <= theTol2D) && 
++              ((aV11 - aVSurf1l) <= theTol2D) &&
++              ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-
+-            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++            Standard_Boolean isForce = Standard_False;
++            if(!aWL1FindStatus)
+             {
+-              isForce = Standard_True;
+-            }
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU21, aV11, aV11Prev,
+-                              aV21, aV21Prev, isTheReverse,
+-                              1.0, isForce, isFound1, isFound2);
++              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++              {
++                isForce = Standard_True;
++              }
++
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU21, aV11, aV11Prev,
++                                aV21, aV21Prev, isTheReverse,
++                                1.0, isForce, isFound1, isFound2);
+               
+-            if(isFound1 || isFound2)
+-            {
+-              aWL1FindStatus = 1;
++              if(isFound1 || isFound2)
++              {
++                aWL1FindStatus = 1;
++              }
+             }
+-          }
+-          if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
+-          {
+-            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
+-                  gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
+-                  aUSurf1f, aUSurf1l, aPeriod,
+-                  aWLine1->Curve(), theTol2D, isForce))
++            if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
+             {
+-              if(!aWL1FindStatus)
++              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
++                    gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
++                    aUSurf1f, aUSurf1l, aPeriod,
++                    aWLine1->Curve(), theTol3D, theTol2D, isForce))
+               {
+-                aWL1FindStatus = 1;
++                if(!aWL1FindStatus)
++                {
++                  aWL1FindStatus = 1;
++                }
+               }
+             }
+           }
+-        }
+-        else
+-        {
+-          if(aWL1FindStatus == 1)
++          else
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
++            if(aWL1FindStatus == 1)
++            {
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU21, aV11, aV11Prev,
+-                              aV21, aV21Prev, isTheReverse,
+-                              1.0, Standard_False, isFound1, isFound2);
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU21, aV11, aV11Prev,
++                                aV21, aV21Prev, isTheReverse,
++                                1.0, Standard_False, isFound1, isFound2);
+-            if(isFound1 || isFound2)
+-              aWL1FindStatus = 2; //start a new line
++              if(isFound1 || isFound2)
++                aWL1FindStatus = 2; //start a new line
++            }
+           }
+         }
+-      
+-        if( ((aUSurf2f-aU22) <= theTol2D) &&
+-            ((aU22-aUSurf2l) <= theTol2D) && 
+-            ((aVSurf1f - aV12) <= theTol2D) &&
+-            ((aV12 - aVSurf1l) <= theTol2D) &&
+-            ((aVSurf2f - aV22) <= theTol2D) &&
+-            ((aV22 - aVSurf2l) <= theTol2D))
++        
++        if(isAddingWL2Enabled)
+         {
+-          Standard_Boolean isForce = Standard_False;
+-
+-          if(!aWL2FindStatus)
++          if( ((aUSurf2f-aU22) <= theTol2D) &&
++              ((aU22-aUSurf2l) <= theTol2D) && 
++              ((aVSurf1f - aV12) <= theTol2D) &&
++              ((aV12 - aVSurf1l) <= theTol2D) &&
++              ((aVSurf2f - aV22) <= theTol2D) &&
++              ((aV22 - aVSurf2l) <= theTol2D))
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
++            Standard_Boolean isForce = Standard_False;
+-            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++            if(!aWL2FindStatus)
+             {
+-              isForce = Standard_True;
+-            }
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU22, aV12, aV12Prev,
+-                              aV22, aV22Prev, isTheReverse,
+-                              -1.0, isForce, isFound1, isFound2);
++              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++              {
++                isForce = Standard_True;
++              }
++
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU22, aV12, aV12Prev,
++                                aV22, aV22Prev, isTheReverse,
++                                -1.0, isForce, isFound1, isFound2);
+               
+-            if(isFound1 || isFound2)
+-            {
+-              aWL2FindStatus = 1;
++              if(isFound1 || isFound2)
++              {
++                aWL2FindStatus = 1;
++              }
+             }
+-          }
+-          if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
+-          {
+-            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+-                  gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
+-                  aUSurf1f, aUSurf1l, aPeriod,
+-                  aWLine2->Curve(), theTol2D, isForce))
++            if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
+             {
+-              if(!aWL2FindStatus)
++              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
++                    gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
++                    aUSurf1f, aUSurf1l, aPeriod,
++                    aWLine2->Curve(), theTol3D, theTol2D, isForce))
+               {
+-                aWL2FindStatus = 1;
++                if(!aWL2FindStatus)
++                {
++                  aWL2FindStatus = 1;
++                }
+               }
+             }
+           }
+-        }
+-        else
+-        {
+-          if(aWL2FindStatus == 1)
++          else
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
++            if(aWL2FindStatus == 1)
++            {
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU22, aV12, aV12Prev,
+-                              aV22, aV22Prev, isTheReverse,
+-                              -1.0, Standard_False, isFound1, isFound2);
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU22, aV12, aV12Prev,
++                                aV22, aV22Prev, isTheReverse,
++                                -1.0, Standard_False, isFound1, isFound2);
+-            if(isFound1 || isFound2)
+-              aWL2FindStatus = 2; //start a new line
++              if(isFound1 || isFound2)
++                aWL2FindStatus = 2; //start a new line
++            }
+           }
+         }
+@@ -2237,15 +2292,29 @@
+       }
+       else if(aWLine1->NbPnts() > 1)
+       {
+-        isTheEmpty = Standard_False;
+-        isAddedIntoWL1 = Standard_True;
++        Standard_Boolean isGood = Standard_True;
++
++        if(aWLine1->NbPnts() == 2)
++        {
++          const IntSurf_PntOn2S& aPf = aWLine1->Point(1);
++          const IntSurf_PntOn2S& aPl = aWLine1->Point(2);
+-        SeekAdditionalPoints(theQuad1, theQuad2, aWLine1->Curve(), 
+-                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
+-                              theTol2D, aPeriod, 1.0, isTheReverse);
++          if(aPf.IsSame(aPl, Precision::Confusion()))
++            isGood = Standard_False;
++        }
+-        aWLine1->ComputeVertexParameters(theTol3D);
+-        theSlin.Append(aWLine1);
++        if(isGood)
++        {
++          isTheEmpty = Standard_False;
++          isAddedIntoWL1 = Standard_True;
++
++          SeekAdditionalPoints( theQuad1, theQuad2, aWLine1->Curve(), 
++                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
++                                theTol2D, aPeriod, 1.0, isTheReverse);
++
++          aWLine1->ComputeVertexParameters(theTol3D);
++          theSlin.Append(aWLine1);
++        }
+       }
+       else
+       {
+@@ -2267,15 +2336,28 @@
+       }
+       else if(aWLine2->NbPnts() > 1)
+       {
+-        isTheEmpty = Standard_False;
+-        isAddedIntoWL2 = Standard_True;
++        Standard_Boolean isGood = Standard_True;
++        if(aWLine2->NbPnts() == 2)
++        {
++          const IntSurf_PntOn2S& aPf = aWLine2->Point(1);
++          const IntSurf_PntOn2S& aPl = aWLine2->Point(2);
++
++          if(aPf.IsSame(aPl, Precision::Confusion()))
++            isGood = Standard_False;
++        }
+-        SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
+-                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
+-                              theTol2D, aPeriod, -1.0, isTheReverse);
++        if(isGood)
++        {
++          isTheEmpty = Standard_False;
++          isAddedIntoWL2 = Standard_True;
+-        aWLine2->ComputeVertexParameters(theTol3D);
+-        theSlin.Append(aWLine2);
++          SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
++                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
++                                theTol2D, aPeriod, -1.0, isTheReverse);
++
++          aWLine2->ComputeVertexParameters(theTol3D);
++          theSlin.Append(aWLine2);
++        }
+       }
+       else
+       {
+@@ -2284,6 +2366,203 @@
+     }
+   }
++  if(theSlin.Length() > 0)
++  {
++    for(Standard_Integer aNumOfLine = 2; aNumOfLine <= theSlin.Length(); aNumOfLine++)
++    {
++      const Handle(IntPatch_WLine)& aWLine = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine));
++
++      const IntSurf_PntOn2S& aPntFWL = aWLine->Point(1);
++
++      Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
++      aPntFWL.Parameters(aU1, aV1, aU2, aV2);
++
++      if( IsEqual(aU1, 0.0) || IsEqual(aU1, aPeriod))
++      {
++        theSlin.Exchange(1, aNumOfLine);
++        break;
++      }
++    }
++
++    for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
++    {
++      const Handle(IntPatch_WLine)& aWLine1 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine1));
++
++      const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
++      const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
++      const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
++
++      for(Standard_Integer aNPt = 1; aNPt <= theSPnt.Length(); aNPt++)
++      {
++        const IntSurf_PntOn2S aPntCur = theSPnt.Value(aNPt).PntOn2S();
++
++        if( aPntCur.IsSame(aPntFWL1, Precision::Confusion()) ||
++            aPntCur.IsSame(aPntLWL1, Precision::Confusion()))
++        {
++          theSPnt.Remove(aNPt);
++          aNPt--;
++        }
++      }
++
++      Standard_Boolean hasBeenRemoved = Standard_False;
++      for(Standard_Integer aNumOfLine2 = aNumOfLine1 + 1; aNumOfLine2 <= theSlin.Length(); aNumOfLine2++)
++      {
++        const Handle(IntPatch_WLine)& aWLine2 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine2));
++
++        const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
++        const Standard_Integer aNbPntsWL2 = aWLine2->NbPnts();
++
++        const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
++        const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
++
++        const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
++        const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
++
++        if(aPntFWL1.IsSame(aPntFWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->InsertBefore(1, aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++
++        if(aPntFWL1.IsSame(aPntLWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->InsertBefore(1, aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++
++        if(aPntLWL1.IsSame(aPntFWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->Add(aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++
++        if(aPntLWL1.IsSame(aPntLWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->Add(aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++      }
++
++      if(hasBeenRemoved)
++        aNumOfLine1--;
++
++      //aWLine1->ComputeVertexParameters(theTol3D);
++    }
++  }//if(theSlin.Length() > 0)
++
++
+   return Standard_True;
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntPatch_WLine.hxx OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.hxx
+--- OCCT-6.8.0_SRC/inc/IntPatch_WLine.hxx      2014-11-11 17:54:07.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.hxx        2015-01-16 14:34:19.000000000 +0300
+@@ -138,6 +138,12 @@
+   
+   Standard_EXPORT  const  Handle(Adaptor2d_HCurve2d)& GetArcOnS2()  const;
+   
++  Standard_EXPORT   void ClearVertexes() ;
++  
++  Standard_EXPORT   void RemoveVertex (const Standard_Integer theIndex) ;
++  
++  Standard_EXPORT   void InsertVertexBefore (const Standard_Integer theIndex, const IntPatch_Point& thePnt) ;
++  
+   Standard_EXPORT   void Dump()  const;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntPatch_WLine.lxx OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.lxx
+--- OCCT-6.8.0_SRC/inc/IntPatch_WLine.lxx      2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.lxx        2015-01-16 12:59:50.000000000 +0300
+@@ -97,3 +97,27 @@
+ {
+   return svtx(Index);
+ }
++
++inline void IntPatch_WLine::ClearVertexes()
++{
++  svtx.Clear();
++}
++
++inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
++{
++  if((theIndex < 1) || (theIndex > NbVertex()))
++    Standard_OutOfRange::Raise("Cannot delete not existing vertex");
++  svtx.Remove(theIndex);
++}
++
++inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
++                                                const IntPatch_Point& thePnt)
++{
++  const Standard_Integer aNbVertexes = NbVertex();
++  Standard_Integer anIndex = Max(theIndex, 1);
++
++  if(anIndex > aNbVertexes)
++    svtx.Append(thePnt);
++  else
++    svtx.InsertBefore(theIndex, thePnt);
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntSurf_PntOn2S.hxx OCCT-6.8.0_SRC-patch/inc/IntSurf_PntOn2S.hxx
+--- OCCT-6.8.0_SRC/inc/IntSurf_PntOn2S.hxx     2014-11-11 17:54:10.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/IntSurf_PntOn2S.hxx       2015-01-16 14:34:22.000000000 +0300
+@@ -60,6 +60,11 @@
+   
+   //! Returns the parameters of the point on both surfaces.
+       void Parameters (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2)  const;
++  
++  //! Returns TRUE if 2D- and 3D-coordinates of theOterPoint are equal to
++  //! corresponding coordinates of me (with given tolerance).
++  //! If theTol2D == 0.0 we will compare 3D-points only.
++  Standard_EXPORT   Standard_Boolean IsSame (const IntSurf_PntOn2S& theOterPoint, const Standard_Real theTol3D = 0.0, const Standard_Real theTol2D = 0.0)  const;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/OpenGl_GraphicDriver.hxx OCCT-6.8.0_SRC-patch/inc/OpenGl_GraphicDriver.hxx
+--- OCCT-6.8.0_SRC/inc/OpenGl_GraphicDriver.hxx        2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/OpenGl_GraphicDriver.hxx  2015-01-16 13:01:24.000000000 +0300
+@@ -167,7 +167,6 @@
+   Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
+   Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView);
+   Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
+-  Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
+   Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
+   Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
+   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/OpenGl_Workspace.hxx OCCT-6.8.0_SRC-patch/inc/OpenGl_Workspace.hxx
+--- OCCT-6.8.0_SRC/inc/OpenGl_Workspace.hxx    2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/OpenGl_Workspace.hxx      2015-01-16 13:01:24.000000000 +0300
+@@ -184,7 +184,6 @@
+                                Image_PixMap&               theImage,
+                                const Graphic3d_BufferType& theBufferType);
+-  void UseTransparency (const Standard_Boolean theFlag);
+   Standard_Boolean& UseZBuffer()   { return myUseZBuffer; }
+   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
+   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
+@@ -671,7 +670,6 @@
+   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
+   Standard_Boolean       myBackBufferRestored;
+   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
+-  Standard_Boolean       myUseTransparency;
+   Standard_Boolean       myUseZBuffer;
+   Standard_Boolean       myUseDepthTest;
+   Standard_Boolean       myUseGLLight;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/ShapeFix_Shape.hxx OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.hxx
+--- OCCT-6.8.0_SRC/inc/ShapeFix_Shape.hxx      2014-11-11 17:54:25.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.hxx        2015-01-16 14:34:37.000000000 +0300
+@@ -116,6 +116,10 @@
+   //! Returns (modifiable) the mode for applying
+   //! ShapeFix::FixVertexPosition before all fixes, by default False.
+       Standard_Integer& FixVertexPositionMode() ;
++  
++  //! Returns (modifiable) the mode for fixing tolerances of vertices on whole shape
++  //! after performing all fixes
++      Standard_Integer& FixVertexTolMode() ;
+@@ -139,6 +143,7 @@
+   Standard_Integer myFixWireMode;
+   Standard_Integer myFixSameParameterMode;
+   Standard_Integer myFixVertexPositionMode;
++  Standard_Integer myFixVertexTolMode;
+   Standard_Integer myStatus;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/ShapeFix_Shape.lxx OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.lxx
+--- OCCT-6.8.0_SRC/inc/ShapeFix_Shape.lxx      2014-11-11 17:47:05.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.lxx        2015-01-16 13:00:03.000000000 +0300
+@@ -122,3 +122,13 @@
+ {
+   return myFixVertexPositionMode;
+ }
++
++//=======================================================================
++//function : FixVertexTolMode
++//purpose  : 
++//=======================================================================
++
++inline Standard_Integer& ShapeFix_Shape::FixVertexTolMode() 
++{
++  return myFixVertexTolMode;
++}
+\ No newline at end of file
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/V3d_View.hxx OCCT-6.8.0_SRC-patch/inc/V3d_View.hxx
+--- OCCT-6.8.0_SRC/inc/V3d_View.hxx    2014-11-11 17:54:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/V3d_View.hxx      2015-01-16 14:35:09.000000000 +0300
+@@ -308,9 +308,6 @@
+   //! Returns TRUE when the light is active in this view.
+   Standard_EXPORT   Standard_Boolean IsActiveLight (const Handle(V3d_Light)& aLight)  const;
+   
+-  //! Activate/Deactivate the transparency in this view.
+-  Standard_EXPORT   void SetTransparency (const Standard_Boolean AnActivity = Standard_False) ;
+-  
+   //! sets the immediate update mode and returns the previous one.
+   Standard_EXPORT   Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate) ;
+   
+@@ -704,9 +701,6 @@
+   
+   Standard_EXPORT   Handle(Graphic3d_TextureEnv) TextureEnv()  const;
+   
+-  //! Returns the transparency activity.
+-  Standard_EXPORT   Standard_Boolean Transparency()  const;
+-  
+   //! Returns the current visualisation mode.
+   Standard_EXPORT   V3d_TypeOfVisualization Visualization()  const;
+   
+@@ -1075,7 +1069,6 @@
+   TColStd_Array2OfReal MyTrsf;
+   Handle(Graphic3d_Structure) MyGridEchoStructure;
+   Handle(Graphic3d_Group) MyGridEchoGroup;
+-  Standard_Boolean MyTransparencyFlag;
+   Graphic3d_Vector myXscreenAxis;
+   Graphic3d_Vector myYscreenAxis;
+   Graphic3d_Vector myZscreenAxis;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Visual3d_View.hxx OCCT-6.8.0_SRC-patch/inc/Visual3d_View.hxx
+--- OCCT-6.8.0_SRC/inc/Visual3d_View.hxx       2014-11-11 17:54:59.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/Visual3d_View.hxx 2015-01-16 14:35:10.000000000 +0300
+@@ -478,11 +478,6 @@
+   //! Warning: Works only under Windows.
+   Standard_EXPORT   Standard_Boolean Print (const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0)  const;
+   
+-  //! if <AFlag> is Standard_True then the transparency
+-  //! is managed in the view <me>.
+-  //! Default Standard_False
+-  Standard_EXPORT   void SetTransparency (const Standard_Boolean AFlag) ;
+-  
+   //! Returns Standard_True if the ZBuffer is activated
+   //! in the view <me> and Standard_False if not.
+   Standard_EXPORT   Standard_Boolean ZBufferIsActivated()  const;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Visual3d_ViewManager.hxx OCCT-6.8.0_SRC-patch/inc/Visual3d_ViewManager.hxx
+--- OCCT-6.8.0_SRC/inc/Visual3d_ViewManager.hxx        2014-11-11 17:54:59.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/inc/Visual3d_ViewManager.hxx  2015-01-16 14:35:10.000000000 +0300
+@@ -200,16 +200,6 @@
+   //! if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
+   Standard_EXPORT   void ReCompute (const Handle(Graphic3d_Structure)& AStructure, const Handle(Graphic3d_DataStructureManager)& AProjector) ;
+   
+-  //! Returns Standard_True if the transparency
+-  //! is activated in all activated views.
+-  //! Default Standard_False
+-  Standard_EXPORT   Standard_Boolean Transparency()  const;
+-  
+-  //! if <AFlag> is Standard_True then the transparency
+-  //! is managed.
+-  //! Default Standard_False
+-  Standard_EXPORT   void SetTransparency (const Standard_Boolean AFlag) ;
+-  
+   //! Returns Standard_True if the zbuffer activity
+   //! is managed automatically.
+   //! Default Standard_False
+@@ -251,7 +241,6 @@
+   Aspect_GenId MyViewGenId;
+   Handle(Graphic3d_GraphicDriver) MyGraphicDriver;
+   Standard_Boolean MyZBufferAuto;
+-  Standard_Boolean MyTransparency;
+   TColStd_MapOfInteger myLayerIds;
+   TColStd_SequenceOfInteger myLayerSeq;
+   Visual3d_MapOfZLayerSettings myMapOfZLayerSettings;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/samples/qt/VoxelDemo/src/Viewer.cpp OCCT-6.8.0_SRC-patch/samples/qt/VoxelDemo/src/Viewer.cpp
+--- OCCT-6.8.0_SRC/samples/qt/VoxelDemo/src/Viewer.cpp 2014-11-11 17:46:38.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/samples/qt/VoxelDemo/src/Viewer.cpp   2015-01-16 12:59:32.000000000 +0300
+@@ -51,7 +51,6 @@
+     myView->MustBeResized();
+     myView->SetSurfaceDetail(V3d_TEX_NONE);
+-    myView->SetTransparency(Standard_True);
+     myView->SetSize(10000.0);
+     myView->SetZSize(10000.0);
+     myView->SetViewMappingDefault();
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cdl OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cdl
+--- OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cdl  2014-11-11 17:46:38.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cdl    2015-01-16 13:01:23.000000000 +0300
+@@ -268,15 +268,6 @@
+ -- inWhichLocal gives the local context in which anIObj
+ -- is displayed. By default, the index -1 refers to the last
+ -- Local Context opened.
+- 
+-    Clear(me : mutable;
+-        aniobj         : InteractiveObject from AIS;
+-        updateviewer   : Boolean from Standard = Standard_True);
+----Purpose: Removes the interactive object aniobj from all viewers.
+--- If a local context is open and if updateviewer equals
+--- Standard_False, the presentation of the Interactive
+--- Object activates the selection mode; the object is
+--- displayed but no viewer will be updated.
+     ClearPrs( me           :mutable;
+             aniobj       : InteractiveObject from AIS;
+@@ -2046,6 +2037,16 @@
+     PurgeViewer(me:mutable;Vwr:Viewer from V3d) 
+     returns Integer from Standard is static private;
++    redisplayPrsModes (me                : mutable;
++                       theIObj           : InteractiveObject from AIS;
++                       theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
++   ---Purpose: UNKNOWN
++
++    redisplayPrsRecModes (me                : mutable;
++                          theIObj           : InteractiveObject from AIS;
++                          theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
++   ---Purpose: UNKNOWN
++
+ fields
+     myObjects    : DataMapOfIOStatus from AIS;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cxx OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cxx
+--- OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cxx  2014-11-11 17:46:38.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cxx    2015-01-16 13:01:23.000000000 +0300
+@@ -16,27 +16,6 @@
+ // Modified by  XAB & Serguei Dec 97 (angle &deviation coeffts)
+-#define BUC60577        //GG_101099     Enable to compute correctly
+-//                      transparency with more than one object in the view.
+-
+-#define BUC60632        //GG 15/03/00 Add protection on SetDisplayMode()
+-//                      method, compute only authorized presentation.
+-
+-#define BUC60688        //GG 25/05/00 Add SetSensitivity() methods.
+-
+-#define BUC60722  //GG 04/09/00 Always enable viewer update when erasing something
+-
+-#define IMP051001       //GG Adds SetZDetected() and ZDetected() methods
+-
+-#define OCC172          //SAV clear static map before destroying context.
+-
+-#define OCC204          //SAV 26/02/02 : pass <updateviewer> flag to 
+-// AddOrRemoveCurrentObject method from ClearGlobal.
+-
+-#define OCC4373         //SAN 10/11/03 : improve display mode management in
+-// Display( IO, updateviewer ) and 
+-// SetDisplayMode( IO, mode, updateviewer ) methods
+-
+ #include <AIS_InteractiveContext.ixx>
+ //#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
+@@ -71,28 +50,6 @@
+ #include <AIS_ListIteratorOfListOfInteractive.hxx>
+-// In the method GetDefModes() the returned value of the selection mode 
+-// is always equal to 0 if it is -1.
+-#define BUC61051
+-
+-// The local context is closed the method ::ResetOriginalState() sets the selection mode equal to 0
+-// in spite of the selection mode of the interactive object in Natural Point.
+-#define OCC166
+-
+-static Standard_Boolean AISDebugModeOn()
+-{
+-//  static OSD_Environment aisdb("AISDEBUGMODE");
+-//  return !aisdb.Value().IsEmpty();
+-  static Standard_Integer isDebugMode(-1);
+-  if (isDebugMode < 0) {
+-    isDebugMode = 1;
+-    OSD_Environment aisdb("AISDEBUGMODE");
+-    if (aisdb.Value().IsEmpty())
+-      isDebugMode = 0;
+-  }
+-  return (isDebugMode != 0);
+-}
+-
+ namespace
+ {
+   static volatile Standard_Integer THE_AIS_INDEX_SEL = 0;
+@@ -109,7 +66,7 @@
+     return TCollection_AsciiString ("AIS_CurContext_")
+          + TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_CUR));
+   }
+-};
++}
+ //=======================================================================
+ //function : AIS_InteractiveContext
+@@ -131,9 +88,7 @@
+ mySubIntensity(Quantity_NOC_GRAY40),
+ myDisplayMode(0),
+ myCurLocalIndex(0),
+-#ifdef IMP051001
+ myZDetectionFlag(0),
+-#endif
+ myIsAutoActivateSelMode( Standard_True )
+ { 
+   InitAttributes();
+@@ -141,31 +96,30 @@
+ void AIS_InteractiveContext::Delete() const
+ {
+-  //Clear the static current selection. Else the memory
+-  //is not release
++  // clear the static current selection
+   AIS_Selection::ClearCurrentSelection();
+-#ifdef OCC172
++
+   // to avoid an exception
+-  if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
+-    AIS_Selection::Remove( mySelectionName.ToCString() );
++  if (AIS_Selection::Find (mySelectionName.ToCString()))
++  {
++    AIS_Selection::Remove (mySelectionName.ToCString());
++  }
+   // to avoid an exception
+-  if ( AIS_Selection::Find( myCurrentName.ToCString() ) )
+-    AIS_Selection::Remove( myCurrentName.ToCString() );
++  if (AIS_Selection::Find (myCurrentName.ToCString()))
++  {
++    AIS_Selection::Remove (myCurrentName.ToCString());
++  }
+   // let's remove one reference explicitly. this operation's supposed to
+   // be performed when mgrSelector will be destroyed but anyway...
+-  mgrSelector->Remove( myMainSel );
+-#endif
+-  AIS_ListOfInteractive aList;
+-  
+-  AIS_DataMapIteratorOfDataMapOfIOStatus anIt(myObjects);
++  mgrSelector->Remove (myMainSel);
++
+   Handle(AIS_InteractiveContext) aNullContext;
+-  for(; anIt.More() ; anIt.Next())
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
+   {
+-    Handle(AIS_InteractiveObject) anObj = anIt.Key();
+-    anObj->SetContext(aNullContext);
+-    
++    Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
++    anObj->SetContext (aNullContext);
+   }
+   MMgt_TShared::Delete();
+ }
+@@ -209,494 +163,466 @@
+ //=======================================================================
+ //function : DisplayedObjects
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::DisplayedObjects(AIS_ListOfInteractive& aListOfIO,
+-                                              const Standard_Boolean OnlyFromNeutral) const 
++void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfIO,
++                                               const Standard_Boolean theOnlyFromNeutral) const
+ {
+-#ifdef OCCT_DEBUG
+-  cout<<"AIS_IC::DisplayedObjects"<<endl;
+-#endif
+-
+-  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
+-  if(!HasOpenedContext() || OnlyFromNeutral){
+-    for(;It.More();It.Next()){
+-      if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
+-        aListOfIO.Append(It.Key());
+-    }
+-  }
+-  else{
+-    TColStd_MapOfTransient theMap;
+-    // neutral point
+-    for(;It.More();It.Next()){
+-      if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
+-        theMap.Add(It.Key());
+-    }
+-
+-    //parse all local contexts...
+-#ifdef OCCT_DEBUG
+-    cout<<"\tFrom Neutral Point : "<<theMap.Extent()<<endl;
+-    Standard_Integer NbDisp;
+-    for(AIS_DataMapIteratorOfDataMapOfILC it1(myLocalContexts);it1.More();it1.Next()){
+-      const Handle(AIS_LocalContext)& LC = it1.Value();
+-      NbDisp =  LC->DisplayedObjects(theMap);
+-      cout<<"\tIn Local Context "<<it1.Key()<<" : "<<NbDisp<<endl;
+-    }
+-#endif
+-    Handle(AIS_InteractiveObject) curIO;
+-    Handle(Standard_Transient) Tr;
+-      for(TColStd_MapIteratorOfMapOfTransient it2(theMap);it2.More();it2.Next()){
+-        Tr = it2.Key();
+-        curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
+-        aListOfIO.Append(curIO);
++  if (!HasOpenedContext()
++   || theOnlyFromNeutral)
++  {
++    for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++    {
++      if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
++      {
++        theListOfIO.Append (anObjIter.Key());
+       }
+     }
++    return;
++  }
++
++  // neutral point
++  TColStd_MapOfTransient aDispMap;
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
++    {
++      aDispMap.Add (anObjIter.Key());
++    }
++  }
++
++  // parse all local contexts...
++  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
++  {
++    const Handle(AIS_LocalContext)& aLocCtx = aCtxIter.Value();
++    aLocCtx->DisplayedObjects (aDispMap);
++  }
++
++  Handle(AIS_InteractiveObject) anObj;
++  for (TColStd_MapIteratorOfMapOfTransient aDispMapIter (aDispMap); aDispMapIter.More(); aDispMapIter.Next())
++  {
++    const Handle(Standard_Transient)& aTransient = aDispMapIter.Key();
++    anObj = *((Handle(AIS_InteractiveObject)* )&aTransient);
++    theListOfIO.Append (anObj);
++  }
+ }
++
+ //=======================================================================
+ //function : DisplayedObjects
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::DisplayedObjects(const AIS_KindOfInteractive TheKind,
+-                                              const Standard_Integer TheSign,
+-                                              AIS_ListOfInteractive& aListOfIO,
+-                                              const Standard_Boolean /*OnlyFromNeutral*/) const 
++void AIS_InteractiveContext::DisplayedObjects (const AIS_KindOfInteractive theKind,
++                                               const Standard_Integer      theSign,
++                                               AIS_ListOfInteractive&      theListOfIO,
++                                               const Standard_Boolean /*OnlyFromNeutral*/) const
+ {
+-  ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Displayed, aListOfIO );
++  ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Displayed, theListOfIO);
+ }
+ //=======================================================================
+ //function : ErasedObjects
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::ErasedObjects(AIS_ListOfInteractive& theListOfIO) const 
++void AIS_InteractiveContext::ErasedObjects (AIS_ListOfInteractive& theListOfIO) const
+ {
+-  ObjectsByDisplayStatus( AIS_DS_Erased, theListOfIO );
++  ObjectsByDisplayStatus (AIS_DS_Erased, theListOfIO);
+ }
+ //=======================================================================
+ //function : ErasedObjects
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::ErasedObjects(const AIS_KindOfInteractive TheKind,
+-                                           const Standard_Integer TheSign,
+-                                           AIS_ListOfInteractive& theListOfIO) const 
++void AIS_InteractiveContext::ErasedObjects (const AIS_KindOfInteractive theKind,
++                                            const Standard_Integer      theSign,
++                                            AIS_ListOfInteractive&      theListOfIO) const
+ {
+-  ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, theListOfIO );
++  ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Erased, theListOfIO);
+ }
+ //=======================================================================
+ //function : ObjectsByDisplayStatus
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_DisplayStatus theStatus,
+-                                                    AIS_ListOfInteractive&  theListOfIO) const 
++void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus,
++                                                     AIS_ListOfInteractive&  theListOfIO) const
+ {
+-  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
+-  for(;It.More();It.Next()){
+-    if(It.Value()->GraphicStatus() == theStatus)
+-      theListOfIO.Append(It.Key());
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    if (anObjIter.Value()->GraphicStatus() == theStatus)
++    {
++      theListOfIO.Append (anObjIter.Key());
++    }
+   }
+ }
+ //=======================================================================
+ //function : ObjectsByDisplayStatus
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive theKind,
++                                                     const Standard_Integer      theSign,
++                                                     const AIS_DisplayStatus     theStatus,
++                                                     AIS_ListOfInteractive&      theListOfIO) const
++{
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    if (anObjIter.Value()->GraphicStatus() != theStatus
++     || anObjIter.Key()->Type() != theKind)
++    {
++      continue;
++    }
+-void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_KindOfInteractive TheKind,
+-                                                    const Standard_Integer TheSign,
+-                                                    const AIS_DisplayStatus theStatus,
+-                                                    AIS_ListOfInteractive& theListOfIO) const 
+-{
+-  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
+-  for(;It.More();It.Next()){
+-    if(It.Value()->GraphicStatus()==theStatus){
+-      if(It.Key()->Type()==TheKind){
+-        if(TheSign ==-1)
+-          theListOfIO.Append(It.Key());
+-        else{
+-          if(It.Key()->Signature()==TheSign)
+-            theListOfIO.Append(It.Key());
+-        }
+-      }
++    if (theSign == -1
++     || anObjIter.Key()->Signature() == theSign)
++    {
++      theListOfIO.Append (anObjIter.Key());
+     }
+   }
+ }
+ //=======================================================================
+ //function : ObjectsInside
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive&      theListOfIO,
++                                            const AIS_KindOfInteractive theKind,
++                                            const Standard_Integer      theSign) const
++{
++  if (theKind == AIS_KOI_None
++   && theSign == -1)
++  {
++    for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++    {
++      theListOfIO.Append (anObjIter.Key());
++    }
++    return;
++  }
+-void AIS_InteractiveContext::ObjectsInside(AIS_ListOfInteractive& aListOfIO,
+-                                           const AIS_KindOfInteractive TheKind,
+-                                           const Standard_Integer TheSign) const 
+-{
+-  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
+-  if(TheKind==AIS_KOI_None && TheSign ==-1){
+-    for(;It.More();It.Next()){
+-        aListOfIO.Append(It.Key());
+-    }
+-  }
+-  else{
+-    for(;It.More();It.Next()){
+-      if(It.Key()->Type()==TheKind){
+-        if(TheSign ==-1)
+-          aListOfIO.Append(It.Key());
+-        else{
+-          if(It.Key()->Signature()==TheSign)
+-            aListOfIO.Append(It.Key());
+-        }
+-      }
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    if (anObjIter.Key()->Type() != theKind)
++    {
++      continue;
++    }
++
++    if (theSign == -1
++     || anObjIter.Key()->Signature() == theSign)
++    {
++      theListOfIO.Append (anObjIter.Key());
+     }
+   }
+ }
+ //=======================================================================
+ //function : Display
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIObj,
++                                      const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++
++  Standard_Integer aDispMode = 0, aHiMod = -1, aSelMode = -1;
++  GetDefModes (theIObj, aDispMode, aHiMod, aSelMode);
+-void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
+-                                     const Standard_Boolean updateviewer )
++  Display (theIObj, aDispMode, myIsAutoActivateSelMode ? aSelMode : -1,
++           theToUpdateViewer, theIObj->AcceptShapeDecomposition());
++}
++
++//=======================================================================
++//function : Display
++//purpose  :
++//=======================================================================
++void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIObj,
++                                      const Standard_Integer               theDispMode,
++                                      const Standard_Integer               theSelectionMode,
++                                      const Standard_Boolean               theToUpdateViewer,
++                                      const Standard_Boolean               theToAllowDecomposition)
+ {
+-  if(anIObj.IsNull()) return;
+-  
+-  Standard_Integer DispMode,HiMod,SelMode;
+-  
+-  GetDefModes(anIObj,DispMode,HiMod,SelMode);
+-  
+-  Handle (AIS_InteractiveContext) aThis = this;
+-  if(!anIObj->HasInteractiveContext()) 
+-    anIObj->SetContext(aThis);
+-  
+-  //NO LOCAL CONTEXT OPEN
+-  if(!HasOpenedContext()) {
+-#ifndef OCC4373
+-    // SAN : Do not return here. Perform advanced display mode analysis a bit later...
+-    if(IsDisplayed(anIObj)) return;
+-#endif
+-
+-    // it did not yet exist
+-    if(!myObjects.IsBound(anIObj)){
+-      
+-      Handle(AIS_GlobalStatus) STATUS= 
+-#ifdef OCC166
+-        new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,SelMode);
+-#else
+-      new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,0);
+-#endif
+-      myObjects.Bind (anIObj,STATUS);
+-      myMainPM->Display(anIObj,DispMode);
+-      if( myIsAutoActivateSelMode )
+-      {
+-        if(!mgrSelector->Contains(anIObj))
+-           mgrSelector->Load(anIObj);
+-        mgrSelector->Activate(anIObj,SelMode,myMainSel);
+-      }
+-        
+-     if(updateviewer) myMainVwr->Update();
+-    }
+-    // it is somewhere else...
+-    else {
+-      // CLE
+-      // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-      Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-      // ENDCLE
+-      if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
+-      {
+-        // SAN : erase presentations for all display modes different from <DispMode>;
+-        //       then make sure <DispMode> is displayed and maybe highlighted;
+-        //       Finally, activate selection mode <SelMode> if not yet activated.
+-        TColStd_ListOfInteger aModesToRemove;
+-        TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
+-        for(;ItL.More();ItL.Next()){
+-
+-          Standard_Integer OldMode = ItL.Value();
+-
+-          if(OldMode!=DispMode){
+-            aModesToRemove.Append(OldMode);
+-            if(myMainPM->IsHighlighted(anIObj,OldMode))
+-              myMainPM->Unhighlight(anIObj,OldMode);
+-            myMainPM->Erase(anIObj,OldMode);
+-          }
+-        }
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-        for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
+-          STATUS->RemoveDisplayMode(ItL.Value());
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+-        if(!STATUS->IsDModeIn(DispMode))
+-          STATUS->AddDisplayMode(DispMode);
++  if (HasOpenedContext())
++  {
++    myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
++    if (theToUpdateViewer)
++    {
++      myMainVwr->Update();
++    }
++    return;
++  }
+-        myMainPM->Display(anIObj,DispMode);
+-        if (STATUS->GraphicStatus() == AIS_DS_Erased)
+-        {
+-          STATUS->SetGraphicStatus(AIS_DS_Displayed);
+-        }
+-        if(STATUS->IsHilighted()){
+-          myMainPM->Highlight(anIObj,HiMod);
+-        }
+-        if( myIsAutoActivateSelMode )
+-        {
+-           if(!mgrSelector->Contains(anIObj))
+-              mgrSelector->Load(anIObj);
+-           if(!mgrSelector->IsActivated(anIObj,SelMode))
+-              mgrSelector->Activate(anIObj,SelMode,myMainSel);
+-        }
++  if (!myObjects.IsBound (theIObj))
++  {
++    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
++    myObjects.Bind   (theIObj, aStatus);
++    myMainPM->Display(theIObj, theDispMode);
++    if (theSelectionMode != -1)
++    {
++      if (!mgrSelector->Contains (theIObj))
++      {
++        mgrSelector->Load (theIObj);
+       }
+-    } 
+-    
+-    if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
+-      myMainVwr->Viewer()->SetTransparency(Standard_True);
+-    if(updateviewer) myMainVwr->Update();
++      mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
++    }
+   }
+-  
+-  //  LOCAL CONTEXT OPEN
+   else
+   {
+-    myLocalContexts(myCurLocalIndex)->Display(anIObj,DispMode,anIObj->AcceptShapeDecomposition(),SelMode);
+-    
+-    if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
+-      myMainVwr->Viewer()->SetTransparency(Standard_True);
+-    
+-    
+-    if(updateviewer) myMainVwr->Update();
+-  }
+-}
++    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++    if (aStatus->GraphicStatus() != AIS_DS_Displayed
++     && aStatus->GraphicStatus() != AIS_DS_Erased)
++    {
++      return;
++    }
+-//=======================================================================
+-//function : Display
+-//purpose  : 
+-//=======================================================================
++    // Erase presentations for all display modes different from aDispMode.
++    // Then make sure aDispMode is displayed and maybe highlighted.
++    // Finally, activate selection mode <SelMode> if not yet activated.
++    TColStd_ListOfInteger aModesToRemove;
++    for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
++    {
++      const Standard_Integer anOldMode = aDispModeIter.Value();
++      if (anOldMode != theDispMode)
++      {
++        aModesToRemove.Append (anOldMode);
++        if(myMainPM->IsHighlighted (theIObj, anOldMode))
++        {
++          myMainPM->Unhighlight (theIObj, anOldMode);
++        }
++        myMainPM->Erase (theIObj, anOldMode);
++      }
++    }
+-void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
+-                                    const Standard_Integer aDisplayMode, 
+-                                    const Standard_Integer aSelectionMode, 
+-                                    const Standard_Boolean updateviewer, 
+-                                    const Standard_Boolean allowdecomposition)
+-{
+-  if(anIObj.IsNull()) return;
++    for (TColStd_ListIteratorOfListOfInteger aRemModeIter (aModesToRemove); aRemModeIter.More(); aRemModeIter.Next())
++    {
++      aStatus->RemoveDisplayMode (aRemModeIter.Value());
++    }
+-  if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
+-  
+-  // if no local context...
+-  if(!HasOpenedContext()) {
+-    //    if(!anIObj->HasDisplayMode())
+-    //      anIObj->SetDisplayMode(aDisplayMode);
+-  
+-    if(!myObjects.IsBound(anIObj)){
+-      Handle(AIS_GlobalStatus) STATUS= 
+-        new AIS_GlobalStatus(AIS_DS_Displayed,aDisplayMode,aSelectionMode);
+-      myObjects.Bind (anIObj,STATUS);
+-      myMainPM->Display(anIObj,aDisplayMode);
+-      if(aSelectionMode!=-1){
+-        if(!mgrSelector->Contains(anIObj))
+-          mgrSelector->Load(anIObj,aSelectionMode);
+-        mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
+-      }
+-      if(updateviewer) myMainVwr->Update();
++    if (!aStatus->IsDModeIn (theDispMode))
++    {
++      aStatus->AddDisplayMode (theDispMode);
++    }
++
++    myMainPM->Display (theIObj, theDispMode);
++    if (aStatus->GraphicStatus() == AIS_DS_Erased)
++    {
++      aStatus->SetGraphicStatus (AIS_DS_Displayed);
++    }
++    if (aStatus->IsHilighted())
++    {
++      const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
++      myMainPM->Highlight (theIObj, aHiMod);
+     }
+-    //    anIObj->SelectionMode(aSelectionMode);
+-    else{
+-      // CLE
+-      // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-      Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-      // ENDCLE
+-      if(!STATUS->IsDModeIn(aDisplayMode)){
+-        myMainPM->Display(anIObj,aDisplayMode);
+-        STATUS->AddDisplayMode(aDisplayMode);
+-        if(STATUS->IsSubIntensityOn())
+-          myMainPM->Color(anIObj,mySubIntensity,aDisplayMode);
++    if (theSelectionMode != -1)
++    {
++      if (!mgrSelector->Contains (theIObj))
++      {
++        mgrSelector->Load (theIObj);
+       }
+-      if(aSelectionMode!=-1){
+-        STATUS->AddSelectionMode(aSelectionMode);
+-        mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
++      if (!mgrSelector->IsActivated (theIObj, theSelectionMode))
++      {
++        mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
+       }
+-      if(updateviewer) myMainVwr->Update();
+-      
+     }
+   }
+-  else
+-    {
+-      myLocalContexts(myCurLocalIndex)->Display(anIObj,aDisplayMode,allowdecomposition,aSelectionMode);
+-      if(updateviewer) myMainVwr->Update();
+-    }  
+-}
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
++}
+ //=======================================================================
+ //function : Load
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::Load(const Handle(AIS_InteractiveObject)& anIObj,
+-                                  const Standard_Integer SelMode,
+-                                  const Standard_Boolean AllowDecomposition)
++void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
++                                   const Standard_Integer               theSelMode,
++                                   const Standard_Boolean               theToAllowDecomposition)
+ {
+-  if(anIObj.IsNull()) return;
+-  if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
+-  
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  if(!HasOpenedContext()) {
+-    if(SelMode==-1 && !AllowDecomposition){
+-      Standard_Integer DispMode,HiMod,SelModeDef;
+-      
+-      GetDefModes(anIObj,DispMode,HiMod,SelModeDef);
+-      Handle(AIS_GlobalStatus) STATUS= 
+-        new AIS_GlobalStatus(AIS_DS_Erased,DispMode,SelModeDef);
+-      myObjects.Bind (anIObj,STATUS);      
+-      return;
+-    }
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++
++  if (HasOpenedContext())
++  {
++    myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
++    return;
+   }
+-  myLocalContexts(myCurLocalIndex)->Load(anIObj,AllowDecomposition,SelMode);
+-}
++  if (theSelMode == -1
++  && !theToAllowDecomposition
++  && !myObjects.IsBound (theIObj))
++  {
++    Standard_Integer aDispMode, aHiMod, aSelModeDef;
++    GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
++    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
++    myObjects.Bind (theIObj, aStatus);
++  }
++}
+ //=======================================================================
+ //function : Erase
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                   const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::Erase (const Handle(AIS_InteractiveObject)& theIObj,
++                                    const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return;
+-  
+-  if ( !anIObj->IsAutoHilight() )
+-    anIObj->ClearSelected();
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+   
+-  if(!HasOpenedContext()){
+-    EraseGlobal(anIObj,updateviewer);
++  if (!theIObj->IsAutoHilight())
++  {
++    theIObj->ClearSelected();
+   }
+-  else
++
++  Standard_Boolean wasInCtx = Standard_False;
++  if (HasOpenedContext())
++  {
++    // First it is checked if it is possible to remove in the current local context
++    // then one tries to remove in other local contexts, if they allow it...
++    wasInCtx = myLocalContexts (myCurLocalIndex)->Erase (theIObj);
++    for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
+     {
+-      // First it is checked if it is possible to remove in the current local context
+-      // then one tries to remove in other local contexts, if they allow it...
+-      
+-      Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Erase(anIObj);
+-//      if(!WasInCtx) {
+-      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
+-      for (;It.More();It.Next()){
+-        if(It.Value()->AcceptErase())
+-#ifdef BUC60722
+-          WasInCtx |= It.Value()->Erase(anIObj);
+-#else
+-          WasInCtx = It.Value()->Erase(anIObj);
+-#endif
++      if (aCtxIter.Value()->AcceptErase())
++      {
++        wasInCtx = aCtxIter.Value()->Erase (theIObj) || wasInCtx;
+       }
+-      
+-      if(!WasInCtx)
+-        EraseGlobal(anIObj,updateviewer);
+-      else
+-        if(updateviewer) myMainVwr->Update();
+     }
++  }
++
++  if (!wasInCtx)
++  {
++    EraseGlobal (theIObj, Standard_False);
++  }
++
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
+ }
+ //=======================================================================
+ //function : EraseAll
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::EraseAll(const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
+ {
+-  if(!HasOpenedContext())
++  if (HasOpenedContext())
+   {
+-    for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects); ItM.More(); ItM.Next())
+-    {
+-      if(ItM.Value()->GraphicStatus() == AIS_DS_Displayed)
+-        Erase(ItM.Key(),Standard_False);
+-    }
+-    if(updateviewer)
++    return;
++  }
++
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
+     {
+-      myMainVwr->Update();
++      Erase (anObjIter.Key(), Standard_False);
+     }
+   }
++
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
+ }
+ //=======================================================================
+ //function : DisplayAll
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::DisplayAll(const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewer)
+ {
+-  if(!HasOpenedContext()){
+-
+-    AIS_DisplayStatus aStatus;
++  if (HasOpenedContext())
++  {
++    return;
++  }
+-    if (!HasOpenedContext())
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    const AIS_DisplayStatus aStatus = anObjIter.Value()->GraphicStatus();
++    if (aStatus == AIS_DS_Erased)
+     {
+-      for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM (myObjects); ItM.More(); ItM.Next())
+-      {
+-        aStatus = ItM.Value()->GraphicStatus();
+-        if (aStatus == AIS_DS_Erased)
+-          Display(ItM.Key(),Standard_False);
+-      }
+-      if(updateviewer)
+-      {
+-        myMainVwr->Update();
+-      }
++      Display (anObjIter.Key(), Standard_False);
+     }
+   }
+-  
++
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
+ }
+ //=======================================================================
+ //function : DisplaySelected
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdateViewer)
+ {
+-  
+-  if (!HasOpenedContext())
++  if (HasOpenedContext())
+   {
+-    Standard_Boolean found = Standard_False;
+-    Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
+-    Handle(AIS_InteractiveObject) iObj;
+-    for (sel->Init(); sel->More(); sel->Next())
+-    {
+-      iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
+-      Display(iObj,Standard_False);
+-      found = Standard_True;
+-    }
+-    if (found && updateviewer)
+-    {
+-      myMainVwr->Update();
+-    }
++    return;
++  }
++
++  Standard_Boolean      isFound  = Standard_False;
++  Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
++  for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
++  {
++    Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
++    Display (anObj, Standard_False);
++    isFound = Standard_True;
+   }
+-}
++  if (isFound && theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
++}
+ //=======================================================================
+ //function : EraseSelected
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::EraseSelected(const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateViewer)
+ {
+-  if (!HasOpenedContext())
++  if (HasOpenedContext())
+   {
+-    Standard_Boolean found = Standard_False;
+-    Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
+-    Handle(AIS_InteractiveObject) iObj;
+-    for (sel->Init();sel->More();sel->Next())
+-    {
+-      iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
+-      Erase(iObj,Standard_False);
+-      found = Standard_True;
+-    }
+-    if(found && updateviewer)
+-    {
+-      myMainVwr->Update();
+-    }
++    return;
++  }
++
++  Standard_Boolean      isFound  = Standard_False;
++  Handle(AIS_Selection) aSelIter = AIS_Selection::Selection(myCurrentName.ToCString());
++  for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
++  {
++    Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
++    Erase (anObj, Standard_False);
++    isFound = Standard_True;
++  }
++
++  if (isFound && theToUpdateViewer)
++  {
++    myMainVwr->Update();
+   }
+ }
++
+ //=======================================================================
+ //function : 
+ //purpose  : 
+@@ -761,187 +687,163 @@
+   return Standard_True;
+ }
+-
+ //=======================================================================
+-//purpose  : 
++//function : DisplayStatus
++//purpose  :
+ //=======================================================================
+-
+-AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus(const Handle(AIS_InteractiveObject)& anIObj) const 
++AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  if(anIObj.IsNull()) return AIS_DS_None;
+-
+-  if(myObjects.IsBound(anIObj))
+-    return myObjects(anIObj)->GraphicStatus();
++  if (theIObj.IsNull())
++  {
++    return AIS_DS_None;
++  }
++  else if (myObjects.IsBound (theIObj))
++  {
++    return myObjects (theIObj)->GraphicStatus();
++  }
+-  AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
+-  for(;ItM.More();ItM.Next()){
+-    if(ItM.Value()->IsIn(anIObj))
++  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
++  {
++    if (aCtxIter.Value()->IsIn (theIObj))
++    {
+       return AIS_DS_Temporary;
++    }
+   }
+-  
+   return AIS_DS_None;
+-  
+ }
+-
+-
+-
+ //=======================================================================
+ //function : DisplayedModes
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-const TColStd_ListOfInteger& AIS_InteractiveContext::
+-DisplayedModes(const Handle(AIS_InteractiveObject)& anIObj) const 
++const TColStd_ListOfInteger& AIS_InteractiveContext::DisplayedModes (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  return myObjects(anIObj)->DisplayedModes();
++  return myObjects (theIObj)->DisplayedModes();
+ }
+-
+ //=======================================================================
+ //function : Remove
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::Remove(const Handle(AIS_InteractiveObject)& anIObj,
+-                                    const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::Remove (const Handle(AIS_InteractiveObject)& theIObj,
++                                     const Standard_Boolean               theToUpdateViewer)
+ {
+-
+-  if(anIObj.IsNull()) return;
+-
+-  if(!HasOpenedContext()){ 
+-    ClearGlobal(anIObj,updateviewer);
++  if (theIObj.IsNull())
++  {
++    return;
+   }
+-  else
++
++  if (HasOpenedContext())
++  {
++    myLocalContexts (myCurLocalIndex)->Remove (theIObj);
++    for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
+     {
+-      myLocalContexts(myCurLocalIndex)->Remove(anIObj);
+-      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
+-      for (;It.More() ;It.Next()){
+-        if(It.Value()->AcceptErase())
+-          It.Value()->Remove(anIObj);
+-        
++      if (aCtxIter.Value()->AcceptErase())
++      {
++        aCtxIter.Value()->Remove (theIObj);
+       }
+-      //      if(!WasInCtx)
+-      ClearGlobal(anIObj,updateviewer);
+-//      else
+-//      if(updateviewer) myMainVwr->Update();
+     }
++  }
++
++  ClearGlobal (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : RemoveAll
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::RemoveAll(const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::RemoveAll (const Standard_Boolean theToUpdateViewer)
+ {
+   AIS_ListOfInteractive aList;
+-  ObjectsInside(aList);
+-  AIS_ListIteratorOfListOfInteractive aListIterator;
+-  for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
+-    Remove(aListIterator.Value(), Standard_False);
++  ObjectsInside (aList);
++  for (AIS_ListIteratorOfListOfInteractive aListIterator (aList); aListIterator.More(); aListIterator.Next())
++  {
++    Remove (aListIterator.Value(), Standard_False);
+   }
+-      
+-  if(updateviewer)
+-    myMainVwr->Update();
+-}
+-
+-//=======================================================================
+-//function : Clear
+-//purpose  : 
+-//=======================================================================
+-
+-void AIS_InteractiveContext::Clear(const Handle(AIS_InteractiveObject)& anIObj,
+-                                   const Standard_Boolean updateviewer)
+-{
+-  if(anIObj.IsNull()) return;
+-  if(!HasOpenedContext()){ 
+-    ClearGlobal(anIObj,updateviewer);
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
+   }
+-  else
+-    {
+-      
+-      Standard_Boolean  WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
+-      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
+-      for (;It.More() ;It.Next()){
+-        if(It.Value()->AcceptErase())
+-          WasInCtx = It.Value()->Remove(anIObj);
+-        
+-      }
+-      if(!WasInCtx)
+-        ClearGlobal(anIObj,updateviewer);
+-      else
+-        if(updateviewer) myMainVwr->Update();
+-    }
+ }
+-
+-
+-
+ //=======================================================================
+ //function : ClearPrs
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::ClearPrs(const Handle(AIS_InteractiveObject)& anIObj,
+-                                      const Standard_Integer aMode,
+-                                      const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
++                                       const Standard_Integer               theMode,
++                                       const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return;
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  if(!HasOpenedContext()){
+-    ClearGlobalPrs(anIObj,aMode,updateviewer);
++  if (!HasOpenedContext())
++  {
++    ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
++    return;
+   }
+-  else
++
++  Standard_Boolean wasInCtx = myLocalContexts (myCurLocalIndex)->ClearPrs (theIObj, theMode);
++  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
++  {
++    if (aCtxIter.Value()->AcceptErase())
+     {
+-      Standard_Boolean  WasInCtx = myLocalContexts(myCurLocalIndex)->ClearPrs(anIObj,aMode);
+-      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
+-      for (;It.More() ;It.Next()){
+-        if(It.Value()->AcceptErase())
+-          WasInCtx = It.Value()->ClearPrs(anIObj,aMode);
+-      }
+-      if(!WasInCtx)
+-        ClearGlobalPrs(anIObj,aMode,updateviewer);
+-      else
+-        if(updateviewer) myMainVwr->Update();
+-      
++      wasInCtx = aCtxIter.Value()->ClearPrs (theIObj, theMode) || wasInCtx;
+     }
++  }
++  if (!wasInCtx)
++  {
++    ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
++  }
++  else if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
+ }
+ //=======================================================================
+ //function : Hilight
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::Hilight(const Handle(AIS_InteractiveObject)& anIObj,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::Hilight (const Handle(AIS_InteractiveObject)& theIObj,
++                                      const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return;
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+   if (!HasOpenedContext())
+   {
+-    if(!myObjects.IsBound(anIObj)) return;
+-
+-    // CLE
+-    // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-    // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes();
+-    Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-
+-    // ENDCLE
+-    STATUS->SetHilightStatus (Standard_True);
++    if (!myObjects.IsBound (theIObj))
++    {
++      return;
++    }
+-    if (STATUS->GraphicStatus() == AIS_DS_Displayed)
++    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++    aStatus->SetHilightStatus (Standard_True);
++    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
+     {
+-      Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
+-      myMainPM->Highlight (anIObj, aHilightMode);
++      Standard_Integer aHilightMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
++      myMainPM->Highlight (theIObj, aHilightMode);
+     }
+   }
+   else
+   {
+-    myLocalContexts(myCurLocalIndex)->Hilight(anIObj);
++    myLocalContexts (myCurLocalIndex)->Hilight (theIObj);
+   }
+-  if(updateviewer) myMainVwr->Update();
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
+ }
+ //=======================================================================
+ //function : Hilight
+@@ -1086,153 +988,165 @@
+ //=======================================================================
+ //function : IsDisplayed
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::
+-IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj,
+-            const Standard_Integer aMode) const 
++Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_InteractiveObject)& theIObj,
++                                                      const Standard_Integer               theMode) const
+ {
+-  if(anIObj.IsNull()) return Standard_False;
+-  if(myObjects.IsBound(anIObj)) {
+-    if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed &&
+-       myObjects(anIObj)->IsDModeIn(aMode)) 
++  if (theIObj.IsNull())
++  {
++    return Standard_False;
++  }
++
++  if (myObjects.IsBound (theIObj))
++  {
++    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++    if (aStatus->GraphicStatus() == AIS_DS_Displayed
++     && aStatus->IsDModeIn (theMode))
++    {
+       return Standard_True;
++    }
+   }
+-  
+-  AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
+-  for(;ItM.More();ItM.Next()){
+-    if(ItM.Value()->IsDisplayed(anIObj,aMode))
++
++  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
++  {
++    if (aCtxIter.Value()->IsDisplayed (theIObj, theMode))
++    {
+       return Standard_True;
++    }
+   }
+   return Standard_False;
+ }
+-
+ //=======================================================================
+ //function : DisplayPriority
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Integer AIS_InteractiveContext::
+-DisplayPriority(const Handle(AIS_InteractiveObject)& anIObj) const 
++Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  if(anIObj.IsNull()) return -1;
++  if (theIObj.IsNull())
++  {
++    return -1;
++  }
++  else if (!myObjects.IsBound (theIObj))
++  {
++    return 0;
++  }
+-  if (myObjects.IsBound(anIObj))
++  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++  if (aStatus->GraphicStatus() == AIS_DS_Displayed
++   || aStatus->GraphicStatus() == AIS_DS_Erased)
+   {
+-    Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-    if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
+-    {
+-      Standard_Integer aDispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : 
+-                                   (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
+-      return myMainPM->DisplayPriority (anIObj, aDispMode);
+-    }
++    Standard_Integer aDispMode = theIObj->HasDisplayMode()
++                               ? theIObj->DisplayMode()
++                               : (theIObj->AcceptDisplayMode (myDisplayMode)
++                                ? myDisplayMode
++                                : 0);
++    return myMainPM->DisplayPriority (theIObj, aDispMode);
+   }
+   return 0;
+ }
++
+ //=======================================================================
+ //function : SetDisplayPriority
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetDisplayPriority(const Handle(AIS_InteractiveObject)& anIObj,
+-                                               const Standard_Integer aPriority)
++void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
++                                                 const Standard_Integer               thePriority)
+ {
+-  if(anIObj.IsNull())
++  if (theIObj.IsNull())
++  {
+     return;
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  if(myObjects.IsBound(anIObj))
++  }
++
++  if (!theIObj->HasInteractiveContext())
+   {
+-    Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
++    theIObj->SetContext (this);
++  }
+-    if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
+-    {
+-      Standard_Integer aDisplayMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : 
+-                                      (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
+-      myMainPM->SetDisplayPriority (anIObj, aDisplayMode, aPriority);
++  if (myObjects.IsBound (theIObj))
++  {
++    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++    if (aStatus->GraphicStatus() == AIS_DS_Displayed
++     || aStatus->GraphicStatus() == AIS_DS_Erased)
++    {
++      Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
++                                    ? theIObj->DisplayMode()
++                                    : (theIObj->AcceptDisplayMode (myDisplayMode)
++                                     ? myDisplayMode
++                                     : 0);
++      myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
+     }
+   }
+   else if (HasOpenedContext())
+   {
+-    myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);
++    myLocalContexts (myCurLocalIndex)->SetDisplayPriority (theIObj, thePriority);
+   }
+ }
+ //=======================================================================
+ //function : Redisplay
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::Redisplay(const Handle(AIS_InteractiveObject)& anIObj,
+-                                      const Standard_Boolean updateviewer,
+-                                      const Standard_Boolean allmodes)
++void AIS_InteractiveContext::Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
++                                        const Standard_Boolean               theToUpdateViewer,
++                                        const Standard_Boolean               theAllModes)
+ {
+-  if(AISDebugModeOn()){
+-    cout<<"===>AIS_InteractiveContext::Redisplay de :";
+-    cout<<anIObj->DynamicType()->Name()<<endl;
+-  }
+-
+-  RecomputePrsOnly(anIObj,updateviewer,allmodes);
+-  RecomputeSelectionOnly(anIObj);
++  RecomputePrsOnly (theIObj, theToUpdateViewer, theAllModes);
++  RecomputeSelectionOnly (theIObj);
+ }
+ //=======================================================================
+ //function : Redisplay
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::Redisplay(const AIS_KindOfInteractive KOI,
+-                                       const Standard_Integer /*Sign*/,
+-                                      const Standard_Boolean updateviewer)
+-{
+-  Standard_Boolean found_viewer(Standard_False);
+-  // update
+-  for(AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);It.More();It.Next()){
+-    // CLE
+-    // const Handle(AIS_InteractiveObject)& IO = It.Key();
+-    Handle(AIS_InteractiveObject) IO = It.Key();
+-    // ENDCLE
+-    if(IO->Type()== KOI){ 
+-#ifdef OCCT_DEBUG
+-//      Standard_Boolean good = (Sign==-1)? Standard_True : 
+-//        ((IO->Signature()==Sign)? Standard_True:Standard_False);
+-#endif
+-      Redisplay(IO,Standard_False);
+-      if (It.Value()->GraphicStatus() == AIS_DS_Displayed)
+-      {
+-        found_viewer = Standard_True;
+-      }
++void AIS_InteractiveContext::Redisplay (const AIS_KindOfInteractive theKOI,
++                                        const Standard_Integer    /*theSign*/,
++                                        const Standard_Boolean      theToUpdateViewer)
++{
++  Standard_Boolean isRedisplayed = Standard_False;
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
++    if (anObj->Type() != theKOI)
++    {
++      continue;
+     }
++
++    Redisplay (anObj, Standard_False);
++    isRedisplayed = anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed
++                 || isRedisplayed;
+   }
+-  // update viewer...
+-  if(updateviewer && found_viewer)
++
++  if (theToUpdateViewer
++   && isRedisplayed)
+   {
+     myMainVwr->Update();
+   }
+ }
+-
+ //=======================================================================
+ //function : RecomputePrsOnly
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::RecomputePrsOnly(const Handle(AIS_InteractiveObject)& anIObj,
+-                                              const Standard_Boolean updateviewer,
+-                                              const Standard_Boolean allmodes)
++void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
++                                               const Standard_Boolean               theToUpdateViewer,
++                                               const Standard_Boolean               theAllModes)
+ {
+-  if(anIObj.IsNull()) return;
+-  anIObj->Update(allmodes);
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  if (!updateviewer)
++  theIObj->Update (theAllModes);
++  if (!theToUpdateViewer)
+   {
+     return;
+   }
+-  if (HasOpenedContext() ||
+-     (myObjects.IsBound(anIObj) && myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed))
++  if (HasOpenedContext()
++   || (myObjects.IsBound (theIObj)
++    && myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed))
+   {
+     myMainVwr->Update();
+   }
+@@ -1276,21 +1190,19 @@
+ //=======================================================================
+ //function : Update
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+ void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIObj,
+-                                     const Standard_Boolean theUpdateViewer)
++                                     const Standard_Boolean               theUpdateViewer)
+ {
+   if (theIObj.IsNull())
+   {
+     return;
+   }
+-  TColStd_ListOfInteger aListOfFlaggedPrsModes;
+-  theIObj->ToBeUpdated (aListOfFlaggedPrsModes);
+-
+-  TColStd_ListIteratorOfListOfInteger aPrsModesIt (aListOfFlaggedPrsModes);
+-  for ( ; aPrsModesIt.More(); aPrsModesIt.Next())
++  TColStd_ListOfInteger aPrsModes;
++  theIObj->ToBeUpdated (aPrsModes);
++  for (TColStd_ListIteratorOfListOfInteger aPrsModesIt (aPrsModes); aPrsModesIt.More(); aPrsModesIt.Next())
+   {
+     theIObj->Update (aPrsModesIt.Value(), Standard_False);
+   }
+@@ -1323,138 +1235,142 @@
+ //=======================================================================
+ //function : SetLocation
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetLocation(const Handle(AIS_InteractiveObject)& anIObj,
+-                                         const TopLoc_Location& aLoc)
++void AIS_InteractiveContext::SetLocation (const Handle(AIS_InteractiveObject)& theIObj,
++                                          const TopLoc_Location&               theLoc)
+ {
+-  if(anIObj.IsNull()) return;
+-
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  if(anIObj->HasTransformation() && aLoc.IsIdentity()){
+-    anIObj->ResetTransformation();
+-    mgrSelector->Update(anIObj,Standard_False);
++  if (theIObj->HasTransformation()
++   && theLoc.IsIdentity())
++  {
++    theIObj->ResetTransformation();
++    mgrSelector->Update (theIObj, Standard_False);
++    return;
++  }
++  else if (theLoc.IsIdentity())
++  {
+     return;
+   }
+-  if(aLoc.IsIdentity()) return ;
+   // first reset the previous location to properly clean everything...
+-  if(anIObj->HasTransformation())
+-    anIObj->ResetTransformation();
++  if (theIObj->HasTransformation())
++  {
++    theIObj->ResetTransformation();
++  }
++  theIObj->SetLocalTransformation (theLoc.Transformation());
+-  anIObj->SetLocalTransformation (aLoc.Transformation());
+-  
+-  if(!HasOpenedContext())
+-    mgrSelector->Update(anIObj,Standard_False);
++  if (!HasOpenedContext())
++  {
++    mgrSelector->Update (theIObj, Standard_False);
++  }
+   else
+-    {
+-      // CLE
+-      // const Handle(StdSelect_ViewerSelector3d)& tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
+-      Handle(StdSelect_ViewerSelector3d) tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
+-      // ENDCLE
+-      mgrSelector->Update(anIObj,tempSel,Standard_False);
+-    }
++  {
++    Handle(StdSelect_ViewerSelector3d) aTempSel = myLocalContexts (myCurLocalIndex)->MainSelector();
++    mgrSelector->Update (theIObj, aTempSel, Standard_False);
++  }
+ }
++
+ //=======================================================================
+ //function : ResetLocation
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::ResetLocation(const Handle(AIS_InteractiveObject)& anIObj)
++void AIS_InteractiveContext::ResetLocation (const Handle(AIS_InteractiveObject)& theIObj)
+ {
+-  if(anIObj.IsNull()) return;
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  anIObj->ResetTransformation();
+-  mgrSelector->Update(anIObj,Standard_False);
++  theIObj->ResetTransformation();
++  mgrSelector->Update (theIObj, Standard_False);
+ }
+ //=======================================================================
+ //function : HasLocation
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::
+-HasLocation(const Handle(AIS_InteractiveObject)& anIObj) const
++Standard_Boolean AIS_InteractiveContext::HasLocation (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  if(anIObj.IsNull()) return Standard_False;
+-
+-  return anIObj->HasTransformation();
++  return !theIObj.IsNull()
++       && theIObj->HasTransformation();
+ }
+-TopLoc_Location AIS_InteractiveContext::
+-Location(const Handle(AIS_InteractiveObject)& anIObj) const
++//=======================================================================
++//function : Location
++//purpose  :
++//=======================================================================
++TopLoc_Location AIS_InteractiveContext::Location (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  return anIObj->Transformation();
++  return theIObj->Transformation();
+ }
+ //=======================================================================
+ //function : SetDeviationCoefficient
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetDeviationCoefficient(const Standard_Real aCoefficient)
++void AIS_InteractiveContext::SetDeviationCoefficient (const Standard_Real theCoefficient)
+ {
+-  myDefaultDrawer->SetDeviationCoefficient(aCoefficient);
++  myDefaultDrawer->SetDeviationCoefficient (theCoefficient);
+ }
++
+ //=======================================================================
+ //function : SetDeviationAngle
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetDeviationAngle(const Standard_Real anAngle)
++void AIS_InteractiveContext::SetDeviationAngle (const Standard_Real theAngle)
+ {
+-  myDefaultDrawer->SetDeviationCoefficient(anAngle);
++  myDefaultDrawer->SetDeviationCoefficient (theAngle);
+ }
+ //=======================================================================
+ //function : DeviationAngle
+ //purpose  : Gets  deviationAngle
+ //=======================================================================
+-
+ Standard_Real AIS_InteractiveContext::DeviationAngle() const
+ {
+-  //return M_PI/180.0e0 ;
+-    return myDefaultDrawer->DeviationAngle();
++  return myDefaultDrawer->DeviationAngle();
+ }
+ //=======================================================================
+ //function : DeviationCoefficient
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Real AIS_InteractiveContext::DeviationCoefficient() const 
++Standard_Real AIS_InteractiveContext::DeviationCoefficient() const
+ {
+   return myDefaultDrawer->DeviationCoefficient();
+ }
++
+ //=======================================================================
+ //function : SetHLRDeviationCoefficient
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetHLRDeviationCoefficient(const Standard_Real aCoefficient)
++void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Standard_Real theCoefficient)
+ {
+-  myDefaultDrawer->SetHLRDeviationCoefficient(aCoefficient);
++  myDefaultDrawer->SetHLRDeviationCoefficient (theCoefficient);
+ }
+ //=======================================================================
+ //function : HLRDeviationCoefficient
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const 
++Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const
+ {
+   return myDefaultDrawer->HLRDeviationCoefficient();
+ }
+ //=======================================================================
+ //function : SetHLRAngle
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetHLRAngle(const Standard_Real anAngle)
++void AIS_InteractiveContext::SetHLRAngle (const Standard_Real theAngle)
+ {
+-  myDefaultDrawer->SetHLRAngle(anAngle);
++  myDefaultDrawer->SetHLRAngle (theAngle);
+ }
+ //=======================================================================
+@@ -1463,23 +1379,19 @@
+ //           and set them in myHLRAngle and in myHLRDeviationCoefficient
+ //           of myDefaultDrawer 
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetHLRAngleAndDeviation(const Standard_Real anAngle)
++void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Standard_Real theAngle)
+ {
++  Standard_Real anOutAngl, anOutDefl;
++  HLRBRep::PolyHLRAngleAndDeflection (theAngle, anOutAngl, anOutDefl);
+-  Standard_Real OutAngl,OutDefl;
+-  HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
+-
+-  myDefaultDrawer->SetHLRAngle(OutAngl);
+-  myDefaultDrawer->SetHLRDeviationCoefficient(OutDefl);
+-
++  myDefaultDrawer->SetHLRAngle                (anOutAngl);
++  myDefaultDrawer->SetHLRDeviationCoefficient (anOutDefl);
+ }
+ //=======================================================================
+ //function : HLRAngle
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+ Standard_Real AIS_InteractiveContext::HLRAngle() const 
+ {
+   return myDefaultDrawer->HLRAngle();
+@@ -1487,1348 +1399,1320 @@
+ //=======================================================================
+ //function : SetDisplayMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetDisplayMode(const AIS_DisplayMode aMode,
+-                                           const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode  theMode,
++                                             const Standard_Boolean theToUpdateViewer)
+ {
+-  if(aMode==myDisplayMode) return;
+-  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
++  if (theMode == myDisplayMode)
++  {
++    return;
++  }
+-  for(;It.More();It.Next()){
+-    // CLE
+-    // const Handle(AIS_InteractiveObject)& anObj = It.Key();
+-    Handle(AIS_InteractiveObject) anObj = It.Key();
+-    // ENDCLE
+-    Standard_Boolean Processed = (anObj->IsKind(STANDARD_TYPE(AIS_Shape)) ||
+-                                  anObj->IsKind(STANDARD_TYPE(AIS_ConnectedInteractive)) ||
+-                                  anObj->IsKind(STANDARD_TYPE(AIS_MultipleConnectedInteractive)) );
++  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
++  {
++    Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
++    Standard_Boolean toProcess = anObj->IsKind (STANDARD_TYPE(AIS_Shape))
++                              || anObj->IsKind (STANDARD_TYPE(AIS_ConnectedInteractive))
++                              || anObj->IsKind (STANDARD_TYPE(AIS_MultipleConnectedInteractive));
+     
+-    if ((!anObj->HasDisplayMode()) && Processed) 
++    if (!toProcess
++     ||  anObj->HasDisplayMode()
++     || !anObj->AcceptDisplayMode (theMode))
++    {
++      continue;
++    }
++
++    Handle(AIS_GlobalStatus) aStatus = anObjIter.Value();
++    if (aStatus->IsDModeIn (myDisplayMode))
++    {
++      aStatus->RemoveDisplayMode (myDisplayMode);
++    }
++
++    aStatus->AddDisplayMode (theMode);
++    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
++    {
++      myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
++      myMainPM->Display (anObj, theMode);
++      if (aStatus->IsSubIntensityOn())
+       {
+-        if(anObj->AcceptDisplayMode(aMode)){
+-          // CLE
+-          // const Handle(AIS_GlobalStatus)& STATUS = It.Value();
+-          Handle(AIS_GlobalStatus) STATUS = It.Value();
+-          // ENDCLE
+-          if(STATUS->IsDModeIn(myDisplayMode))
+-            STATUS->RemoveDisplayMode(myDisplayMode);
+-          
+-          STATUS->AddDisplayMode(aMode);
+-          
+-          if(STATUS->GraphicStatus()== AIS_DS_Displayed){
+-            myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
+-            myMainPM->Display(anObj, aMode);
+-            if(STATUS->IsSubIntensityOn())
+-              myMainPM->Color(anObj,mySubIntensity,aMode);
+-          }
+-          //  myDisplayMode = aMode;
+-        }
++        myMainPM->Color (anObj, mySubIntensity, theMode);
+       }
+-    
+-  } 
+-  myDisplayMode = aMode;
+-  if(updateviewer) myMainVwr->Update();
+-}
+-
++    }
++  }
++
++  myDisplayMode = theMode;
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
++}
++
+ //=======================================================================
+ //function : SetDisplayMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                           const Standard_Integer aMode,
+-                                           const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
++                                             const Standard_Integer               theMode,
++                                             const Standard_Boolean               theToUpdateViewer)
+ {
+-  
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  if(!HasOpenedContext()){
+-    
+-    if(!myObjects.IsBound(anIObj)) 
+-      anIObj->SetDisplayMode(aMode);
+-    else if( anIObj->AcceptDisplayMode(aMode) ) 
+-    {
+-      // CLE
+-      // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-      Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-      // ENDCLE
+-      // SAN : erase presentations for all display modes different from <aMode>
+-      if(STATUS->GraphicStatus()==AIS_DS_Displayed){
+-        TColStd_ListOfInteger aModesToRemove;
+-        TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
+-        for(;ItL.More();ItL.Next()){
+-
+-          Standard_Integer OldMode = ItL.Value();
+-
+-          if(OldMode!=aMode){
+-            aModesToRemove.Append(OldMode);
+-            if(myMainPM->IsHighlighted(anIObj,OldMode))
+-              myMainPM->Unhighlight(anIObj,OldMode);
+-            myMainPM->SetVisibility (anIObj, OldMode, Standard_False);
+-          }
+-        }
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext(this);
++  }
++
++  if (HasOpenedContext())
++  {
++    return;
++  }
+-        for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
+-          STATUS->RemoveDisplayMode(ItL.Value());
++  if (!myObjects.IsBound (theIObj))
++  {
++    theIObj->SetDisplayMode (theMode);
++    return;
++  }
++  else if (!theIObj->AcceptDisplayMode (theMode))
++  {
++    return;
++  }
+-        if(!STATUS->IsDModeIn(aMode))
+-          STATUS->AddDisplayMode(aMode);
++  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++  if (aStatus->GraphicStatus() != AIS_DS_Displayed)
++  {
++    theIObj->SetDisplayMode (theMode);
++    return;
++  }
+-        myMainPM->Display(anIObj,aMode);
+-        Standard_Integer DM,HM,SM;
+-        GetDefModes(anIObj,DM,HM,SM);
+-        if(STATUS->IsHilighted()){
+-          myMainPM->Highlight(anIObj,HM);
+-        }
+-        if(STATUS->IsSubIntensityOn()){
+-          myMainPM->Color(anIObj,mySubIntensity,aMode);
+-        }
+-        if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
+-          myMainVwr->Viewer()->SetTransparency(Standard_True);
+-        
+-        if(updateviewer) myMainVwr->Update();
++  // erase presentations for all display modes different from <aMode>
++  TColStd_ListOfInteger aModesToRemove;
++  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
++  {
++    const Standard_Integer anOldMode = aDispModeIter.Value();
++    if (anOldMode != theMode)
++    {
++      aModesToRemove.Append (anOldMode);
++      if (myMainPM->IsHighlighted (theIObj, anOldMode))
++      {
++        myMainPM->Unhighlight (theIObj, anOldMode);
+       }
+-      anIObj->SetDisplayMode(aMode);
++      myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
+     }
+   }
++
++  for (TColStd_ListIteratorOfListOfInteger aRemModeIter (aModesToRemove); aRemModeIter.More(); aRemModeIter.Next())
++  {
++    aStatus->RemoveDisplayMode (aRemModeIter.Value());
++  }
++
++  if (!aStatus->IsDModeIn (theMode))
++  {
++    aStatus->AddDisplayMode (theMode);
++  }
++
++  myMainPM->Display (theIObj, theMode);
++  Standard_Integer aDispMode, aHiMode, aSelMode;
++  GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
++  if (aStatus->IsHilighted())
++  {
++    myMainPM->Highlight (theIObj, aHiMode);
++  }
++  if (aStatus->IsSubIntensityOn())
++  {
++    myMainPM->Color (theIObj, mySubIntensity, theMode);
++  }
++
++  if (theToUpdateViewer)
++  {
++    myMainVwr->Update();
++  }
++  theIObj->SetDisplayMode (theMode);
+ }
+ //=======================================================================
+ //function : UnsetDisplayMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::
+-UnsetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
+-                 const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
++                                               const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-  if(!anIObj->HasDisplayMode()) return;
+-  
+-  if(!myObjects.IsBound(anIObj))
+-    anIObj->UnsetDisplayMode();
+-  else
++  if (theIObj.IsNull()
++  || !theIObj->HasDisplayMode())
++  {
++    return;
++  }
++
++  if (!myObjects.IsBound (theIObj))
++  {
++    theIObj->UnsetDisplayMode();
++    return;
++  }
++
++  const Standard_Integer anOldMode = theIObj->DisplayMode();
++  if (myDisplayMode == anOldMode)
++  {
++    return;
++  }
++
++  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
++  aStatus->RemoveDisplayMode (anOldMode);
++  if (!aStatus->IsDModeIn(myDisplayMode))
++  {
++    aStatus->AddDisplayMode (myDisplayMode);
++  }
++
++  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
++  {
++    if (myMainPM->IsHighlighted (theIObj, anOldMode))
+     {
+-      Standard_Integer OldMode = anIObj->DisplayMode();
+-      if(myDisplayMode==OldMode) return;
+-      const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-      STATUS->RemoveDisplayMode(OldMode);
+-      if(!STATUS->IsDModeIn(myDisplayMode))
+-        STATUS->AddDisplayMode(myDisplayMode);
+-      if(STATUS->GraphicStatus()==AIS_DS_Displayed){
+-        if(myMainPM->IsHighlighted(anIObj,OldMode))
+-          myMainPM->Unhighlight(anIObj,OldMode);
+-        myMainPM->SetVisibility (anIObj, OldMode, Standard_False);
+-        myMainPM->Display(anIObj,myDisplayMode);
+-        Standard_Integer DM,HM,SM;
+-        GetDefModes(anIObj,DM,HM,SM);
+-        if(STATUS->IsHilighted()){
+-          myMainPM->Highlight(anIObj,HM);
+-        }
+-        if(STATUS->IsSubIntensityOn()){
+-          myMainPM->Color(anIObj,mySubIntensity,myDisplayMode);
+-        }
+-        if(updateviewer) myMainVwr->Update();
+-      }
+-      anIObj->UnsetDisplayMode();
+-      
++      myMainPM->Unhighlight (theIObj, anOldMode);
+     }
++    myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
++    myMainPM->Display (theIObj, myDisplayMode);
++
++    Standard_Integer aDispMode, aHiMode, aSelMode;
++    GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
++    if (aStatus->IsHilighted())
++    {
++      myMainPM->Highlight (theIObj, aHiMode);
++    }
++    if (aStatus->IsSubIntensityOn())
++    {
++      myMainPM->Color (theIObj, mySubIntensity, myDisplayMode);
++    }
++
++    if (theToUpdateViewer)
++    {
++      myMainVwr->Update();
++    }
++  }
++
++  theIObj->UnsetDisplayMode();
+ }
+ //=======================================================================
+ //function : SetCurrentFacingModel
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetCurrentFacingModel(
+-                        const Handle(AIS_InteractiveObject)& anIObj,
+-                        const Aspect_TypeOfFacingModel aModel)
++void AIS_InteractiveContext::SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& theIObj,
++                                                    const Aspect_TypeOfFacingModel       theModel)
+ {
+-  if (  !anIObj.IsNull ()  )
+-    anIObj->SetCurrentFacingModel(aModel);
++  if (!theIObj.IsNull())
++  {
++    theIObj->SetCurrentFacingModel (theModel);
++  }
+ }
+ //=======================================================================
+-//function : SetColor
+-//purpose  : 
++//function : redisplayPrsRecModes
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Quantity_NameOfColor aColor,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
++                                                   const Standard_Boolean               theToUpdateViewer)
+ {
+-  SetColor(anIObj,Quantity_Color(aColor),updateviewer);
++  if (theIObj->RecomputeEveryPrs())
++  {
++    theIObj->Redisplay();
++  }
++  else
++  {
++    for (TColStd_ListIteratorOfListOfInteger aModes (theIObj->ListOfRecomputeModes()); aModes.More(); aModes.Next())
++    {
++      theIObj->Update (aModes.Value(), Standard_False);
++    }
++    theIObj->SetRecomputeOk();
++  }
++
++  if (theToUpdateViewer)
++  {
++    UpdateCurrentViewer();
++  }
+ }
+-void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Quantity_Color &aColor,
+-                                     const Standard_Boolean updateviewer)
++//=======================================================================
++//function : redisplayPrsModes
++//purpose  :
++//=======================================================================
++void AIS_InteractiveContext::redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
++                                                const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+- 
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  anIObj->SetColor(aColor);
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
++  if (theIObj->RecomputeEveryPrs())
++  {
++    theIObj->Redisplay();
++  }
+   else
++  {
++    TColStd_ListOfInteger aModes;
++    theIObj->ToBeUpdated (aModes);
++    for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
+     {
+-      Standard_Integer NbDisp=0;
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-      anIObj->SetRecomputeOk();
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
++      theIObj->Update (aModeIter.Value(), Standard_False);
+     }
++    theIObj->SetRecomputeOk();
++  }
+-
+-#ifdef OCCT_DEBUG
+-//   // pour isg
+-//   if(anIObj->Type()==AIS_KOI_Datum && anIObj->Signature()==3){
+-//     Handle(AIS_Trihedron) Tr = *((Handle(AIS_Trihedron)*)&anIObj);
+-//     Standard_Real Lx = myDefaultDrawer->DatumAspect()->FirstAxisLength();
+-//     gp_Trsf T; 
+-//     gp_Dir D =Tr->Component()->XDirection();
+-//     gp_Pnt O = Tr->Component()->Location();
+-//     gp_Vec V(D);V*=Lx/5.;
+-//     T.SetRotation(gp_Ax1(O,D),M_PI/6.);
+-//     T.SetTranslationPart(V);
+-//     TopLoc_Location L,IncLoc(T);
+-   
+-//     for(Standard_Integer I=1;I<90;I++){
+-//       if(anIObj->HasLocation())
+-//      L = anIObj->Location() * IncLoc;
+-//       else
+-//      L = IncLoc;
+-//       SetLocation(anIObj,L);
+-//       UpdateCurrentViewer();
+-//     }
+-//      for(I=1;I<90;I++){
+-//        L = anIObj->Location() /IncLoc;
+-//       SetLocation(anIObj,L);
+-//       UpdateCurrentViewer();
+-//     }
+-//    ResetLocation(anIObj);
+-//   }
+- #endif
+-  if(updateviewer) UpdateCurrentViewer();
++  if (theToUpdateViewer)
++  {
++    UpdateCurrentViewer();
++  }
+ }
+ //=======================================================================
+-//function : SetDeviationCoefficient
+-//purpose  : 
++//function : SetColor
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theIObj,
++                                       const Quantity_NameOfColor           theColor,
++                                       const Standard_Boolean               theToUpdateViewer)
++{
++  SetColor (theIObj, Quantity_Color(theColor), theToUpdateViewer);
++}
+-void AIS_InteractiveContext::SetDeviationCoefficient(
+-                                     const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Standard_Real   aCoefficient,
+-                                     const Standard_Boolean updateviewer)
++//=======================================================================
++//function : SetColor
++//purpose  :
++//=======================================================================
++void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theIObj,
++                                       const Quantity_Color&                theColor,
++                                       const Standard_Boolean               theToUpdateViewer)
+ {
+-//  cout<<" Coefficient:"<< aCoefficient <<endl;
+-  if(anIObj.IsNull()) return ;
+- 
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-  // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+-  if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
+-  if(anIObj->Signature()!=0) return;
+-  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationCoefficient(aCoefficient);
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++  theIObj->SetColor (theColor);
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
++}
++//=======================================================================
++//function : SetDeviationCoefficient
++//purpose  :
++//=======================================================================
++void AIS_InteractiveContext::SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
++                                                      const Standard_Real                  theCoefficient,
++                                                      const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp=0;
+-      TColStd_ListOfInteger LL;
+-      anIObj->ToBeUpdated(LL);
+-      TColStd_ListIteratorOfListOfInteger ITI(LL);
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-      anIObj->SetRecomputeOk();
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-    }
+-  if(updateviewer) UpdateCurrentViewer();
++  // to be modified after the related methods of AIS_Shape are passed to InteractiveObject
++  if (theIObj->Type() != AIS_KOI_Object
++   && theIObj->Type() != AIS_KOI_Shape)
++  {
++    return;
++  }
++  else if (theIObj->Signature() != 0)
++  {
++    return;
++  }
++
++  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
++  aShape->SetOwnDeviationCoefficient (theCoefficient);
++  redisplayPrsModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : SetHLRDeviationCoefficient
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetHLRDeviationCoefficient(
+-                                     const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Standard_Real    aCoefficient,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
++                                                         const Standard_Real                  theCoefficient,
++                                                         const Standard_Boolean               theToUpdateViewer)
+ {
+-//  cout<<" HLRCoefficient:"<< aCoefficient <<endl;
+-  if(anIObj.IsNull()) return ;
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+  
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+-  if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
+-  if(anIObj->Signature()!=0) return;
+-  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationCoefficient(aCoefficient);
+-
+-
+-
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp=0;
++  if (theIObj->Type() != AIS_KOI_Object
++   && theIObj->Type() != AIS_KOI_Shape)
++  {
++    return;
++  }
++  else if (theIObj->Signature() != 0)
++  {
++    return;
++  }
+-      TColStd_ListOfInteger LL;
+-      anIObj->ToBeUpdated(LL);
+-      TColStd_ListIteratorOfListOfInteger ITI(LL);
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-      anIObj->SetRecomputeOk();
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-    }
+-  if(updateviewer) UpdateCurrentViewer();
++  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
++  aShape->SetOwnHLRDeviationCoefficient (theCoefficient);
++  redisplayPrsModes (theIObj, theToUpdateViewer);
+ }
+-
+ //=======================================================================
+ //function : SetDeviationAngle
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetDeviationAngle(
+-                                     const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Standard_Real   anAngle,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
++                                                const Standard_Real                  theAngle,
++                                                const Standard_Boolean               theToUpdateViewer)
+ {
+-//  cout<<" Angle:"<< anAngle <<endl;
+-  if(anIObj.IsNull()) return ;
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+  
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+-  if(anIObj->Type()!=AIS_KOI_Shape) return;
+-  if(anIObj->Signature()!=0) return;
+-  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationAngle(anAngle);
+-
++  if (theIObj->Type() != AIS_KOI_Shape)
++  {
++    return;
++  }
++  else if (theIObj->Signature() != 0)
++  {
++    return;
++  }
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp=0;
+-      TColStd_ListOfInteger LL;
+-      anIObj->ToBeUpdated(LL);
+-      TColStd_ListIteratorOfListOfInteger ITI(LL);
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-      anIObj->SetRecomputeOk();
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-    }
+-  if(updateviewer) UpdateCurrentViewer();
++  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
++  aShape->SetOwnDeviationAngle (theAngle);
++  redisplayPrsModes (theIObj, theToUpdateViewer);
+ }
++
+ //=======================================================================
+-//function : SetDeviationAngle
+-//purpose  : 
++//function : SetAngleAndDeviation
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
++                                                   const Standard_Real                  theAngle,
++                                                   const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-void AIS_InteractiveContext::SetAngleAndDeviation(
+-                                     const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Standard_Real   anAngle,
+-                                     const Standard_Boolean updateviewer)
+-{
+-//  cout<<" Angle:"<< anAngle <<endl;
+-  if(anIObj.IsNull()) return ;
+-//   Standard_Real anAngleRad = M_PI*anAngle/180; test rob...
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+-  if(anIObj->Type()!=AIS_KOI_Shape) return;
+-  if(anIObj->Signature()!=0) return;
+-  (*((Handle(AIS_Shape)*)&anIObj))->SetAngleAndDeviation(anAngle);
++  if (theIObj->Type() != AIS_KOI_Shape)
++  {
++    return;
++  }
++  if (theIObj->Signature() != 0)
++  {
++    return;
++  }
++  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
++  aShape->SetAngleAndDeviation (theAngle);
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
++  if (theIObj->RecomputeEveryPrs())
++  {
++    theIObj->Redisplay();
++  }
+   else
+-    Update(anIObj,updateviewer);
++  {
++    Update (theIObj, theToUpdateViewer);
++  }
+ }
+ //=======================================================================
+-//function : SetDeviationAngle
+-//purpose  : 
++//function : SetHLRAngleAndDeviation
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
++                                                      const Standard_Real                  theAngle,
++                                                      const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-void AIS_InteractiveContext::SetHLRAngleAndDeviation(
+-                                     const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Standard_Real   anAngle,
+-                                     const Standard_Boolean updateviewer)
+-{
+-//  cout<<" Angle:"<< anAngle <<endl;
+-
+-  if(anIObj.IsNull()) return ;
+-   if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+-  if(anIObj->Type()!=AIS_KOI_Shape) return;
+-  if(anIObj->Signature()!=0) return;
+-  (*((Handle(AIS_Shape)*)&anIObj))->SetHLRAngleAndDeviation(anAngle);
+-
+-
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp=0;
+-
+-      TColStd_ListOfInteger LL;
+-      anIObj->ToBeUpdated(LL);
+-      TColStd_ListIteratorOfListOfInteger ITI(LL);
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-      anIObj->SetRecomputeOk();
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-    }
+-  if(updateviewer) UpdateCurrentViewer();
++  if (theIObj->Type() != AIS_KOI_Shape)
++  {
++    return;
++  }
++  if (theIObj->Signature() != 0)
++  {
++    return;
++  }
++  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
++  aShape->SetHLRAngleAndDeviation (theAngle);
++  redisplayPrsModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : SetHLRDeviationAngle
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetHLRDeviationAngle(
+-                                     const Handle(AIS_InteractiveObject)& anIObj, 
+-                                     const Standard_Real   anAngle,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
++                                                   const Standard_Real                  theAngle,
++                                                   const Standard_Boolean               theToUpdateViewer)
+ {
+-//  cout<<" HLRAngle:"<< anAngle <<endl;
+-  if(anIObj.IsNull()) return ;
+- 
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
+-  if( anIObj->Type()!=AIS_KOI_Shape) return;
+-  if(anIObj->Signature()!=0) return;
+-  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationAngle(anAngle);
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp=0;
+-      TColStd_ListOfInteger LL;
+-      anIObj->ToBeUpdated(LL);
+-      TColStd_ListIteratorOfListOfInteger ITI(LL);
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-      anIObj->SetRecomputeOk();
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-    }
+-  if(updateviewer) UpdateCurrentViewer();
++  // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
++  if (theIObj->Type() != AIS_KOI_Shape)
++  {
++    return;
++  }
++  if (theIObj->Signature() != 0)
++  {
++    return;
++  }
++  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
++  aShape->SetOwnHLRDeviationAngle (theAngle);
++  redisplayPrsModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : UnsetColor
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::UnsetColor(const Handle(AIS_InteractiveObject)& anIObj,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
++                                         const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-   anIObj->UnsetColor();
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp =0;
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-      anIObj->SetRecomputeOk();
+-    }
+-  if(updateviewer) 
+-    UpdateCurrentViewer();
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++
++  theIObj->UnsetColor();
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : HasColor
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::HasColor(const Handle(AIS_InteractiveObject)& anIObj) const 
++Standard_Boolean AIS_InteractiveContext::HasColor (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  return anIObj->HasColor();
+-
++  return theIObj->HasColor();
+ }
+ //=======================================================================
+ //function : Color
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Quantity_NameOfColor AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj) const 
++Quantity_NameOfColor AIS_InteractiveContext::Color (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  return anIObj->Color();
++  return theIObj->Color();
+ }
+-void AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj,
+-                                   Quantity_Color &aColor) const
++//=======================================================================
++//function : Color
++//purpose  :
++//=======================================================================
++void AIS_InteractiveContext::Color (const Handle(AIS_InteractiveObject)& theIObj,
++                                    Quantity_Color&                      theColor) const
+ {
+-  anIObj->Color(aColor);
++  theIObj->Color (theColor);
+ }
+ //=======================================================================
+ //function : Width
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Real AIS_InteractiveContext::Width(const Handle(AIS_InteractiveObject)& anIObj) const 
++Standard_Real AIS_InteractiveContext::Width (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  return anIObj->Width();
++  return theIObj->Width();
+ }
+ //=======================================================================
+ //function : SetWidth
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetWidth(const Handle(AIS_InteractiveObject)& anIObj,
+-                                     const Standard_Real aValue,
+-                                     const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
++                                       const Standard_Real                  theWidth,
++                                       const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+- 
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  anIObj->SetWidth(aValue);
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      Standard_Integer NbDisp=0;
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-          NbDisp++;
+-        }
+-#ifdef OCCT_DEBUG
+-      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
+-#endif
+-      anIObj->SetRecomputeOk();
+-    }
+-   if(updateviewer) 
+-    UpdateCurrentViewer();
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++
++  theIObj->SetWidth (theWidth);
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : UnsetWidth
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::UnsetWidth(const Handle(AIS_InteractiveObject)& anIObj,
+-                                       const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
++                                         const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-   anIObj->UnsetWidth();
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-        }
+-      anIObj->SetRecomputeOk();
+-    }
+-   if(updateviewer) 
+-    UpdateCurrentViewer();
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++
++  theIObj->UnsetWidth();
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : SetMaterial
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
++                                          const Graphic3d_NameOfMaterial       theName,
++                                          const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-void AIS_InteractiveContext::SetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
+-//POP pour K4L
+-                                        const Graphic3d_NameOfMaterial aName,
+-//                                      const Graphic3d_NameOfPhysicalMaterial aName,
+-                                        const Standard_Boolean updateviewer)
+-{
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  anIObj->SetMaterial(aName);
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-        }
+-      anIObj->SetRecomputeOk();
+-    }
+-   if(updateviewer)
+-    UpdateCurrentViewer();
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++  theIObj->SetMaterial (theName);
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : UnsetMaterial
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::UnsetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
+-                                          const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
++                                            const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-  anIObj->UnsetMaterial();
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-        }
+-      anIObj->SetRecomputeOk();
+-    }
+-  if(updateviewer)
+-    UpdateCurrentViewer();
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++  theIObj->UnsetMaterial();
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : SetTransparency
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
++                                              const Standard_Real                  theValue,
++                                              const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-void AIS_InteractiveContext::SetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
+-                                            const Standard_Real aValue,
+-                                            const Standard_Boolean updateviewer)
+-{
+-  if(anIObj.IsNull()) return ;
+-   if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-
+-#ifdef BUC60577 //right optimization
+-  if(!anIObj->IsTransparent() && aValue<=0.05) return;
+-#else  
+-//  if(!anIObj->IsTransparent() && aValue<=0.05) return;
+-#endif
+-  if(aValue<=0.05){
+-    UnsetTransparency(anIObj,updateviewer);
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++
++  if (!theIObj->IsTransparent()
++    && theValue <= 0.05)
++  {
+     return;
+   }
+-  
+-  if(!myMainVwr->Viewer()->Transparency())
+-    myMainVwr->Viewer()->SetTransparency(Standard_True);
+-  anIObj->SetTransparency(aValue);
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-        }
+-      anIObj->SetRecomputeOk();
+-    }
+-   if(updateviewer)
+-    UpdateCurrentViewer();
++
++  if (theValue <= 0.05)
++  {
++    UnsetTransparency (theIObj, theToUpdateViewer);
++    return;
++  }
++
++  theIObj->SetTransparency (theValue);
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : UnsetTransparency
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::UnsetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
+-                                              const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
++                                                const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-   anIObj->UnsetTransparency();
+-  if(anIObj->RecomputeEveryPrs())
+-    anIObj->Redisplay();
+-  else
+-    {
+-      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
+-      for (;ITI.More();ITI.Next())
+-        {
+-          anIObj->Update(ITI.Value(),Standard_False);
+-        }
+-      anIObj->SetRecomputeOk();
+-    }
+-
+-  // To Unset transparency in the viewer, if no other object is transparent ...(Speed)
+-  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
+-  Standard_Boolean FoundTransp(Standard_False);
+-  for(;It.More() && !FoundTransp ;It.Next()){
+-    if(It.Key()->IsTransparent())
+-      FoundTransp = Standard_True;
++  if (theIObj.IsNull())
++  {
++    return;
+   }
+-  if(!FoundTransp)
+-    myMainVwr->Viewer()->SetTransparency(Standard_False);
+-  
+-  
+-  if(updateviewer)
+-    UpdateCurrentViewer();
++
++  theIObj->UnsetTransparency();
++  redisplayPrsRecModes (theIObj, theToUpdateViewer);
+ }
+-//=======================================================================
+-//function : SetSelectedAspect
+-//purpose  : 
+-//=======================================================================
+-void AIS_InteractiveContext::SetSelectedAspect(
+-                                const Handle(Prs3d_BasicAspect)& anAspect,
+-                                const Standard_Boolean globalChange,
+-                                const Standard_Boolean updateViewer)
+-{
+-  if( !HasOpenedContext() ) {
+-    Standard_Boolean found = Standard_False;
+-    Handle(AIS_Selection) sel = 
+-                AIS_Selection::Selection(myCurrentName.ToCString());
+-    Handle(AIS_InteractiveObject) object;
+-    for( sel->Init() ; sel->More() ; sel->Next()) {
+-      found = Standard_True;
+-      object = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
+-      object->SetAspect(anAspect,globalChange);
+-    }
+-    if( found && updateViewer) {
+-      myMainVwr->Update();
+-    }
++//=======================================================================
++//function : SetSelectedAspect
++//purpose  :
++//=======================================================================
++void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
++                                                const Standard_Boolean           theIsGlobalChange,
++                                                const Standard_Boolean           theToUpdateViewer)
++{
++  if (HasOpenedContext())
++  {
++    return;
++  }
++
++  Standard_Boolean isFound = Standard_False;
++  Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
++  for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
++  {
++    isFound = Standard_True;
++    Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
++    anObj->SetAspect (theAspect, theIsGlobalChange);
++  }
++
++  if (isFound
++   && theToUpdateViewer)
++  {
++    myMainVwr->Update();
+   }
+ }
+ //=======================================================================
+ //function : SetLocalAttributes
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
++                                                 const Handle(AIS_Drawer)&            theDrawer,
++                                                 const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-void AIS_InteractiveContext::SetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                                const Handle(AIS_Drawer)& aDrawer,
+-                                                const Standard_Boolean updateviewer)
+-{
+-  if(anIObj.IsNull()) return ;
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  anIObj->SetAttributes(aDrawer);
+-  Update(anIObj,updateviewer);
+-  
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++
++  theIObj->SetAttributes (theDrawer);
++  Update (theIObj, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : UnsetLocalAttributes
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::UnsetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj,
+-                                                  const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
++                                                   const Standard_Boolean               theToUpdateViewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-  if(!anIObj->HasInteractiveContext())
+-    anIObj->SetContext(this);
+-  anIObj->UnsetAttributes();
+-  Update(anIObj,updateviewer);
+-}
++  if (theIObj.IsNull())
++  {
++    return;
++  }
++  if (!theIObj->HasInteractiveContext())
++  {
++    theIObj->SetContext (this);
++  }
++  theIObj->UnsetAttributes();
++  Update (theIObj, theToUpdateViewer);
++}
+ //=======================================================================
+ //function : Status
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::Status(const Handle(AIS_InteractiveObject)& anIObj, TCollection_ExtendedString& astatus) const 
++void AIS_InteractiveContext::Status (const Handle(AIS_InteractiveObject)& theIObj,
++                                     TCollection_ExtendedString&          theStatus) const
+ {
+-  astatus = "";
++  theStatus = "";
++  if (theIObj.IsNull()
++  || !myObjects.IsBound (theIObj))
++  {
++    return;
++  }
+-  if(anIObj.IsNull()) return ;
+-  if(myObjects.IsBound(anIObj)){
+-    astatus += "\t ____________________________________________";
+-    astatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
+-    const Handle(AIS_GlobalStatus)& ST = myObjects(anIObj);
+-    switch(ST->GraphicStatus()){
++  theStatus += "\t ____________________________________________";
++  theStatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
++  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
++  switch (aStatus->GraphicStatus())
++  {
+     case AIS_DS_Displayed:
+-      {
+-        astatus +="\t| -->Displayed\n";
+-        break;
+-      }
+-    case AIS_DS_Erased:
+-      {
+-        astatus +="\t| -->Erased\n";
+-        break;
+-      }
+-    default:
++    {
++      theStatus += "\t| -->Displayed\n";
+       break;
+     }
+-    astatus += "\t| Active Display Modes in the MainViewer :\n";
+-    TColStd_ListIteratorOfListOfInteger ItL (ST->DisplayedModes());
+-    for(;ItL.More();ItL.Next()){
+-      astatus += "\t|\t Mode ";
+-      astatus += TCollection_AsciiString(ItL.Value());
+-      astatus+="\n";
+-    }   
+-    if(IsCurrent(anIObj)) astatus +="\t| Current\n";
+-    if(IsSelected(anIObj)) astatus +="\t| Selected\n";
+-
+-    astatus += "\t| Active Selection Modes in the MainViewer :\n";
+-    for(ItL.Initialize(ST->SelectionModes());ItL.More();ItL.Next()){
+-      astatus += "\t\t Mode ";
+-      astatus += TCollection_AsciiString(ItL.Value());
+-      astatus+="\n";
+-    }   
+-    astatus += "\t ____________________________________________";
+-      
++    case AIS_DS_Erased:
++    {
++      theStatus += "\t| -->Erased\n";
++      break;
+     }
+-}
++    default:
++      break;
++  }
++  theStatus += "\t| Active Display Modes in the MainViewer :\n";
++  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
++  {
++    theStatus += "\t|\t Mode ";
++    theStatus += TCollection_AsciiString (aDispModeIter.Value());
++    theStatus += "\n";
++  }
++  if (IsCurrent (theIObj))  theStatus +="\t| Current\n";
++  if (IsSelected(theIObj)) theStatus +="\t| Selected\n";
++
++  theStatus += "\t| Active Selection Modes in the MainViewer :\n";
++  for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
++  {
++    theStatus += "\t\t Mode ";
++    theStatus += TCollection_AsciiString (aSelModeIter.Value());
++    theStatus += "\n";
++  }
++  theStatus += "\t ____________________________________________";
++}
+ //=======================================================================
+ //function : GetDefModes
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::GetDefModes (const Handle(AIS_InteractiveObject)& theIObj,
++                                          Standard_Integer&                    theDispMode,
++                                          Standard_Integer&                    theHiMode,
++                                          Standard_Integer&                    theSelMode) const
++{
++  if (theIObj.IsNull())
++  {
++    return;
++  }
+-void AIS_InteractiveContext::GetDefModes(const Handle(AIS_InteractiveObject)& anIObj,
+-                                     Standard_Integer& DispMode,
+-                                     Standard_Integer& HiMode,
+-                                     Standard_Integer& SelMode) const 
+-{
+-  if(anIObj.IsNull()) return ;
+-  DispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : 
+-  (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
+-  
+-  HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():DispMode;
+-#ifdef BUC61051
+-  SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : -1;
+-#else
+-  SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : 0;
+-#endif
++  theDispMode = theIObj->HasDisplayMode()
++              ? theIObj->DisplayMode()
++              : (theIObj->AcceptDisplayMode (myDisplayMode)
++               ? myDisplayMode
++               : 0);
++  theHiMode  = theIObj->HasHilightMode()   ? theIObj->HilightMode()   : theDispMode;
++  theSelMode = theIObj->HasSelectionMode() ? theIObj->SelectionMode() : -1;
+ }
+-
+ //=======================================================================
+ //function : EraseGlobal
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                         const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
++                                          const Standard_Boolean               theToUpdateviewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-  if(!myObjects.IsBound(anIObj)) return;
++  if (theIObj.IsNull()
++  || !myObjects.IsBound (theIObj))
++  {
++    return;
++  }
+-  // CLE
+-  // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-  Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-  // ENDCLE
+-  Standard_Integer Dmode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
+-  if(STATUS->GraphicStatus()==AIS_DS_Displayed){
+-    
+-    TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
+-    for(;ItL.More();ItL.Next()){
+-      if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
+-        myMainPM->Unhighlight(anIObj,ItL.Value());
+-      myMainPM->SetVisibility (anIObj, ItL.Value(), Standard_False);
++  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++
++  Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
++  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
++  {
++    for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
++    {
++      if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
++      {
++        myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
++      }
++      myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
++    }
++
++    if (IsCurrent (theIObj)
++    && !aStatus->IsDModeIn (aDispMode))
++    {
++      myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
++    }
++
++    for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
++    {
++      mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
++    }
++
++    if (theToUpdateviewer)
++    {
++      myMainVwr->Update();
+     }
+-    if(IsCurrent(anIObj) && !STATUS->IsDModeIn(Dmode))
+-      myMainPM->SetVisibility (anIObj, Dmode, Standard_False);
+-    
+-    for(ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
+-      mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
+-    if(updateviewer) myMainVwr->Update();
+   }
+-  STATUS->SetGraphicStatus(AIS_DS_Erased);
+-  
++  aStatus->SetGraphicStatus (AIS_DS_Erased);
+ }
+ //=======================================================================
+ //function : ClearGlobal
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                         const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
++                                          const Standard_Boolean               theToUpdateviewer)
+ {
+-  if(anIObj.IsNull()) return ;
+-  if(!myObjects.IsBound(anIObj)) return;
+-  // CLE
+-  // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-  Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
+-  // ENDCLE
+-   TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
+-   for(;ItL.More();ItL.Next()){
+-     if(STATUS->IsHilighted()){
+-       if(IsCurrent(anIObj))
+-#ifdef OCC204
+-         AddOrRemoveCurrentObject( anIObj, updateviewer );
+-#else
+-         AddOrRemoveCurrentObject(anIObj);
+-#endif
+-       else if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
+-         myMainPM->Unhighlight(anIObj,ItL.Value());
+-     }
+-     myMainPM->Erase(anIObj,ItL.Value());
+-     myMainPM->Clear(anIObj,ItL.Value());
+-     if(anIObj->HasHilightMode()){
+-       Standard_Integer im = anIObj->HilightMode();
+-       myMainPM->Unhighlight(anIObj,im);
+-       myMainPM->Erase(anIObj,im);
+-  
+-     }
+-   }
++  if (theIObj.IsNull()
++  || !myObjects.IsBound (theIObj))
++  {
++    return;
++  }
++
++  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
++  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
++  {
++    if (aStatus->IsHilighted())
++    {
++      if (IsCurrent (theIObj))
++      {
++        AddOrRemoveCurrentObject (theIObj, theToUpdateviewer);
++      }
++      else if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
++      {
++        myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
++      }
++    }
++    myMainPM->Erase (theIObj, aDispModeIter.Value());
++    myMainPM->Clear (theIObj, aDispModeIter.Value());
++    if (theIObj->HasHilightMode())
++    {
++      Standard_Integer im = theIObj->HilightMode();
++      myMainPM->Unhighlight (theIObj, im);
++      myMainPM->Erase       (theIObj, im);
++    }
++  }
+-  //Object removes from Detected sequence
+-  Standard_Integer i = 1;
+-  for(i = 1; i < myAISDetectedSeq.Length(); i++)
++  // Object removes from Detected sequence
++  for(Standard_Integer aDetIter = 1; aDetIter < myAISDetectedSeq.Length(); ++aDetIter)
+   {
+     Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
+-    if( !anObj.IsNull() && anObj != anIObj )
+-      myAISDetectedSeq.Remove( i );
++    if (!anObj.IsNull()
++      && anObj != theIObj)
++    {
++      myAISDetectedSeq.Remove (aDetIter);
++    }
+   }
+-  if(myLastinMain == anIObj)
++  if (myLastinMain == theIObj)
++  {
+     myLastinMain.Nullify();
+-
+-  if(myLastPicked == anIObj)
++  }
++  if (myLastPicked == theIObj)
++  {
+     myLastPicked.Nullify();
++  }
++
++  // remove IO from the selection manager to avoid memory leaks
++  mgrSelector->Remove (theIObj);
+-  // OCC21671: Remove IO from the selection manager in any case
+-  // to avoid memory leaks
+-  mgrSelector->Remove(anIObj);
++  myObjects.UnBind (theIObj);
+-  if (updateviewer && (STATUS->GraphicStatus() == AIS_DS_Displayed))
++  if (theToUpdateviewer
++   && aStatus->GraphicStatus() == AIS_DS_Displayed)
+   {
+     myMainVwr->Update();
+   }
+-
+-  myObjects.UnBind(anIObj);
+-  
+ }
+ //=======================================================================
+ //function : ClearGlobalPrs
+-//purpose  : 
++//purpose  :
+ //=======================================================================
++void AIS_InteractiveContext::ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theIObj,
++                                             const Standard_Integer               theMode,
++                                             const Standard_Boolean               theToUpdateViewer)
++{
++  if (theIObj.IsNull()
++  || !myObjects.IsBound (theIObj))
++  {
++    return;
++  }
+-void AIS_InteractiveContext::ClearGlobalPrs(const Handle(AIS_InteractiveObject)& anIObj, 
+-                                            const Standard_Integer aMode,
+-                                            const Standard_Boolean updateviewer)
+-{
+-  if(anIObj.IsNull()) return ;
+-  if(!myObjects.IsBound(anIObj)) return;
+-  const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
+-  
+-  Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0; 
+-  if(STATUS->IsDModeIn(aMode)){
+-    if(DM==aMode && myMainPM->IsHighlighted(anIObj,aMode))
+-      myMainPM->Unhighlight(anIObj,aMode);
+-    
+-    myMainPM->Erase(anIObj,aMode);
+-    myMainPM->Clear(anIObj,aMode);
++  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
++  if (aStatus->IsDModeIn (theMode))
++  {
++    const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
++    if (aDispMode == theMode
++     && myMainPM->IsHighlighted (theIObj, theMode))
++    {
++      myMainPM->Unhighlight (theIObj, theMode);
++    }
++
++    myMainPM->Erase (theIObj, theMode);
++    myMainPM->Clear (theIObj, theMode);
+   }
+-  
+-  if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer)
++  if (aStatus->GraphicStatus() == AIS_DS_Displayed
++   && theToUpdateViewer)
++  {
+     myMainVwr->Update();
++  }
+ }
+ //=======================================================================
+ //function : DrawHiddenLine
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::DrawHiddenLine () const {
+-
++Standard_Boolean AIS_InteractiveContext::DrawHiddenLine() const
++{
+   return myDefaultDrawer->DrawHiddenLine();
+ }
+ //=======================================================================
+ //function : EnableDrawHiddenLine
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::EnableDrawHiddenLine () const {
++void AIS_InteractiveContext::EnableDrawHiddenLine() const
++{
+   myDefaultDrawer->EnableDrawHiddenLine();
+ }
+ //=======================================================================
+ //function : DisableDrawHiddenLine 
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::DisableDrawHiddenLine () const {
++void AIS_InteractiveContext::DisableDrawHiddenLine() const
++{
+   myDefaultDrawer->DisableDrawHiddenLine();
+ }
+ //=======================================================================
+ //function : HiddenLineAspect
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Handle (Prs3d_LineAspect) AIS_InteractiveContext::HiddenLineAspect () const  {
++Handle (Prs3d_LineAspect) AIS_InteractiveContext::HiddenLineAspect() const
++{
+   return myDefaultDrawer->HiddenLineAspect();
+ }
+ //=======================================================================
+ //function : SetHiddenLineAspect
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) const {
+-  myDefaultDrawer->SetHiddenLineAspect(anAspect);
++void AIS_InteractiveContext::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) const
++{
++  myDefaultDrawer->SetHiddenLineAspect (theAspect);
+ }
+ //=======================================================================
+ //function : SetIsoNumber
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetIsoNumber(const Standard_Integer Nb,const AIS_TypeOfIso Type)
++void AIS_InteractiveContext::SetIsoNumber (const Standard_Integer theNb,
++                                           const AIS_TypeOfIso    theType)
+ {
+-  switch(Type){
+-  case AIS_TOI_IsoU:
+-    myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
+-    break;
+-  case AIS_TOI_IsoV:
+-    myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
+-    break;
+-  case AIS_TOI_Both:
+-    myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
+-    myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
+-    break;
+- 
++  switch (theType)
++  {
++    case AIS_TOI_IsoU:
++      myDefaultDrawer->UIsoAspect()->SetNumber (theNb);
++      break;
++    case AIS_TOI_IsoV:
++      myDefaultDrawer->VIsoAspect()->SetNumber (theNb);
++      break;
++    case AIS_TOI_Both:
++      myDefaultDrawer->UIsoAspect()->SetNumber (theNb);
++      myDefaultDrawer->VIsoAspect()->SetNumber (theNb);
++      break;
+   }
+ }
++
+ //=======================================================================
+ //function : IsoNumber
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Integer AIS_InteractiveContext::IsoNumber(const AIS_TypeOfIso Type)
++Standard_Integer AIS_InteractiveContext::IsoNumber (const AIS_TypeOfIso theType)
+ {
+-  
+-  switch(Type){
+-  case AIS_TOI_IsoU:
+-    return myDefaultDrawer->UIsoAspect()->Number();
+-  case AIS_TOI_IsoV:
+-    return myDefaultDrawer->VIsoAspect()->Number();
+-  case AIS_TOI_Both:
+-    return (myDefaultDrawer->UIsoAspect()->Number()==
+-            myDefaultDrawer->VIsoAspect()->Number()) ? 
+-              myDefaultDrawer->UIsoAspect()->Number(): -1;
++  switch (theType)
++  {
++    case AIS_TOI_IsoU: return myDefaultDrawer->UIsoAspect()->Number();
++    case AIS_TOI_IsoV: return myDefaultDrawer->VIsoAspect()->Number();
++    case AIS_TOI_Both: return myDefaultDrawer->UIsoAspect()->Number() == myDefaultDrawer->VIsoAspect()->Number()
++                            ? myDefaultDrawer->UIsoAspect()->Number()
++                            : -1;
+   }
+   return 0;
+ }
+ //=======================================================================
+ //function : IsoOnPlane
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::IsoOnPlane(const Standard_Boolean SwitchOn)
++void AIS_InteractiveContext::IsoOnPlane (const Standard_Boolean theToSwitchOn)
+ {
+-  myDefaultDrawer->SetIsoOnPlane(SwitchOn);
++  myDefaultDrawer->SetIsoOnPlane (theToSwitchOn);
+ }
+ //=======================================================================
+ //function : IsoOnPlane
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const 
++Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const
+ {
+   return myDefaultDrawer->IsoOnPlane();
+ }
+ //=======================================================================
+ //function : SetSelectionMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetSelectionMode(const Handle(AIS_InteractiveObject)&, const Standard_Integer )
++void AIS_InteractiveContext::SetSelectionMode (const Handle(AIS_InteractiveObject)& ,
++                                               const Standard_Integer )
+ {
++  //
+ }
+ //=======================================================================
+ //function : UnsetSelectionMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::UnsetSelectionMode(const Handle(AIS_InteractiveObject)&)
++void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObject)& )
+ {
++  //
+ }
+ //=======================================================================
+ //function : SetSensitivityMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetSensitivityMode(const StdSelect_SensitivityMode aMode) {
+-
+-  if( HasOpenedContext() )
+-        myLocalContexts(myCurLocalIndex)->SetSensitivityMode(aMode);
+-  else {
+-    myMainSel->SetSensitivityMode(aMode);
++void AIS_InteractiveContext::SetSensitivityMode (const StdSelect_SensitivityMode theMode)
++{
++  if (HasOpenedContext())
++  {
++    myLocalContexts (myCurLocalIndex)->SetSensitivityMode (theMode);
++  }
++  else
++  {
++    myMainSel->SetSensitivityMode (theMode);
+   }
+ }
+ //=======================================================================
+ //function : SensitivityMode
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const {
+-
+-  if( HasOpenedContext() )
+-        return myLocalContexts(myCurLocalIndex)->SensitivityMode();
+-  return myMainSel->SensitivityMode();
++StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const
++{
++  return HasOpenedContext()
++       ? myLocalContexts (myCurLocalIndex)->SensitivityMode()
++       : myMainSel->SensitivityMode();
+ }
+ //=======================================================================
+ //function : SetSensitivity
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetSensitivity(const Standard_Real aPrecision) {
+-
+-  if( HasOpenedContext() )
+-        myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
+-  else {
+-    myMainSel->SetSensitivity(aPrecision);
++void AIS_InteractiveContext::SetSensitivity (const Standard_Real thePrecision)
++{
++  if (HasOpenedContext())
++  {
++    myLocalContexts(myCurLocalIndex)->SetSensitivity (thePrecision);
++  }
++  else
++  {
++    myMainSel->SetSensitivity (thePrecision);
+   }
+ }
+ //=======================================================================
+ //function : Sensitivity
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Real AIS_InteractiveContext::Sensitivity() const {
+-
+-  if( HasOpenedContext() )
+-        return myLocalContexts(myCurLocalIndex)->Sensitivity();
+-  return myMainSel->Sensitivity();
++Standard_Real AIS_InteractiveContext::Sensitivity() const
++{
++  return HasOpenedContext()
++       ? myLocalContexts(myCurLocalIndex)->Sensitivity()
++       : myMainSel->Sensitivity();
+ }
+ //=======================================================================
+ //function : SetPixelTolerance
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetPixelTolerance(const Standard_Integer aPrecision) {
+-
+-  if( HasOpenedContext() )
+-        myLocalContexts(myCurLocalIndex)->SetPixelTolerance(aPrecision);
+-  else {
+-    myMainSel->SetPixelTolerance(aPrecision);
++void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
++{
++  if (HasOpenedContext())
++  {
++    myLocalContexts (myCurLocalIndex)->SetPixelTolerance (thePrecision);
++  }
++  else
++  {
++    myMainSel->SetPixelTolerance (thePrecision);
+   }
+ }
+ //=======================================================================
+ //function : PixelTolerance
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Integer AIS_InteractiveContext::PixelTolerance() const {
+-
+-  if( HasOpenedContext() )
+-        return myLocalContexts(myCurLocalIndex)->PixelTolerance();
+-  return myMainSel->PixelTolerance();
++Standard_Integer AIS_InteractiveContext::PixelTolerance() const
++{
++  return HasOpenedContext()
++       ? myLocalContexts (myCurLocalIndex)->PixelTolerance()
++       : myMainSel->PixelTolerance();
+ }
+ //=======================================================================
+ //function : IsInLocal
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::IsInLocal(const Handle(AIS_InteractiveObject)& anIObj,
+-                                                   Standard_Integer& TheIndex) const 
++Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_InteractiveObject)& theIObj,
++                                                    Standard_Integer&                    theIndex) const
+ {
+-  if(anIObj.IsNull()) return Standard_False;
++  if (theIObj.IsNull())
++  {
++    return Standard_False;
++  }
++
+   // if it exists at neutral point 0 index is returned
+-  if(myObjects.IsBound(anIObj)) {
+-    TheIndex = 0;
++  if (myObjects.IsBound (theIObj))
++  {
++    theIndex = 0;
+     return Standard_False;
+   }
+-  for(Standard_Integer I=1;I<=myLocalContexts.Extent();I++){
+-    if(myLocalContexts.IsBound(I)){
+-      if(myLocalContexts(I)->IsIn(anIObj)){
+-        TheIndex = I;
++
++  for (Standard_Integer aCtxIter = 1; aCtxIter <= myLocalContexts.Extent(); ++aCtxIter)
++  {
++    if (myLocalContexts.IsBound (aCtxIter))
++    {
++      if(myLocalContexts (aCtxIter)->IsIn (theIObj))
++      {
++        theIndex = aCtxIter;
+         return Standard_True;
+-        
+       }
+     }
+   }
+-  TheIndex =-1;
++  theIndex = -1;
+   return Standard_False;
+-}  
+-  
++}
++
+ //=======================================================================
+ //function : InitAttributes
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+ void AIS_InteractiveContext::InitAttributes()
+ {
+-
+-  mgrSelector->Add(myMainSel);
++  mgrSelector->Add (myMainSel);
+   myCurrentName   = AIS_Context_NewCurName();
+   mySelectionName = AIS_Context_NewSelName();
+-  AIS_Selection::CreateSelection(mySelectionName.ToCString());
+-  AIS_Selection::CreateSelection(myCurrentName.ToCString());
++  AIS_Selection::CreateSelection (mySelectionName.ToCString());
++  AIS_Selection::CreateSelection (myCurrentName.ToCString());
+-  
+-  myDefaultDrawer->SetShadingAspectGlobal(Standard_False);
+-  Graphic3d_MaterialAspect aMat(Graphic3d_NOM_BRASS);
+-  myDefaultDrawer->ShadingAspect()->SetMaterial(aMat);
++  myDefaultDrawer->SetShadingAspectGlobal (Standard_False);
++  Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
++  myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);
+ //  myDefaultDrawer->ShadingAspect()->SetColor(Quantity_NOC_GRAY70);
+-  Handle (Prs3d_LineAspect) HLA = myDefaultDrawer->HiddenLineAspect();
+-  HLA->SetColor(Quantity_NOC_GRAY20);
+-  HLA->SetWidth(1);
+-  HLA->SetTypeOfLine(Aspect_TOL_DASH);
++  Handle(Prs3d_LineAspect) aLineAspect = myDefaultDrawer->HiddenLineAspect();
++  aLineAspect->SetColor      (Quantity_NOC_GRAY20);
++  aLineAspect->SetWidth      (1.0);
++  aLineAspect->SetTypeOfLine (Aspect_TOL_DASH);
+   // tolerance to 4 pixels...
+   SetPixelTolerance();
+   // Customizing the drawer for trihedrons and planes...
+-
+-  Handle (Prs3d_DatumAspect) DA = myDefaultDrawer->DatumAspect();
+-  Standard_Real aLength(100.);
+-  DA->SetAxisLength(aLength,aLength,aLength);
+-  Quantity_NameOfColor col = Quantity_NOC_LIGHTSTEELBLUE4;
+-  DA->FirstAxisAspect()->SetColor(col);
+-  DA->SecondAxisAspect()->SetColor(col);
+-  DA->ThirdAxisAspect()->SetColor(col);
+-
+-  Handle(Prs3d_PlaneAspect)PA = myDefaultDrawer->PlaneAspect();
+-  aLength =200.;
+-  PA->SetPlaneLength(aLength,aLength);
+-  PA->EdgesAspect()->SetColor(Quantity_NOC_SKYBLUE);
+-  
+-
++  Handle(Prs3d_DatumAspect) aTrihAspect = myDefaultDrawer->DatumAspect();
++  const Standard_Real aLength = 100.0;
++  aTrihAspect->SetAxisLength (aLength, aLength, aLength);
++  const Quantity_NameOfColor aColor = Quantity_NOC_LIGHTSTEELBLUE4;
++  aTrihAspect->FirstAxisAspect() ->SetColor (aColor);
++  aTrihAspect->SecondAxisAspect()->SetColor (aColor);
++  aTrihAspect->ThirdAxisAspect() ->SetColor (aColor);
++
++  Handle(Prs3d_PlaneAspect) aPlaneAspect = myDefaultDrawer->PlaneAspect();
++  const Standard_Real aPlaneLength = 200.0;
++  aPlaneAspect->SetPlaneLength (aPlaneLength, aPlaneLength);
++  aPlaneAspect->EdgesAspect()->SetColor (Quantity_NOC_SKYBLUE);
+ }
+-
+ //=======================================================================
+ //function : TrihedronSize
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+ Standard_Real AIS_InteractiveContext::TrihedronSize() const
+ {
+   return myDefaultDrawer->DatumAspect()->FirstAxisLength();
+ }
++
+ //=======================================================================
+ //function : SetTrihedronSize
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::SetTrihedronSize(const Standard_Real aVal,const Standard_Boolean /*updateviewer*/)
++void AIS_InteractiveContext::SetTrihedronSize (const Standard_Real    theVal,
++                                               const Standard_Boolean /*updateviewer*/)
+ {
+-  myDefaultDrawer->DatumAspect()->SetAxisLength(aVal,aVal,aVal);
+-  Redisplay(AIS_KOI_Datum,3,Standard_False);
+-  Redisplay(AIS_KOI_Datum,4,Standard_True);
++  myDefaultDrawer->DatumAspect()->SetAxisLength (theVal, theVal, theVal);
++  Redisplay (AIS_KOI_Datum, 3, Standard_False);
++  Redisplay (AIS_KOI_Datum, 4, Standard_True);
+ }
+-
+-
+ //=======================================================================
+ //function : SetPlaneSize
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aValX,
+-                                          const Standard_Real aValY,
++void AIS_InteractiveContext::SetPlaneSize(const Standard_Real    theValX,
++                                          const Standard_Real    theValY,
+                                           const Standard_Boolean /*updateviewer*/)
+ {
+-  myDefaultDrawer->PlaneAspect()->SetPlaneLength(aValX,aValY);
+-  Redisplay(AIS_KOI_Datum,7);
++  myDefaultDrawer->PlaneAspect()->SetPlaneLength (theValX, theValY);
++  Redisplay (AIS_KOI_Datum, 7);
+ }
+ //=======================================================================
+ //function : SetPlaneSize
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aVal,
+-                                          const Standard_Boolean updateviewer)
++void AIS_InteractiveContext::SetPlaneSize (const Standard_Real    theVal,
++                                           const Standard_Boolean theToUpdateViewer)
+ {
+-  SetPlaneSize(aVal,aVal,updateviewer);
++  SetPlaneSize (theVal, theVal, theToUpdateViewer);
+ }
+ //=======================================================================
+ //function : PlaneSize
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+-Standard_Boolean AIS_InteractiveContext::PlaneSize(Standard_Real& LX,Standard_Real& LY) const
++Standard_Boolean AIS_InteractiveContext::PlaneSize (Standard_Real& theX,
++                                                    Standard_Real& theY) const
+ {
+-  LX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
+-  LY =  myDefaultDrawer->PlaneAspect()->PlaneYLength();
+-  return (Abs(LX-LY)<=Precision::Confusion());
++  theX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
++  theY = myDefaultDrawer->PlaneAspect()->PlaneYLength();
++  return (Abs (theX - theY) <= Precision::Confusion());
+ }
+-
+-
+ //=======================================================================
+-//function :
+-//purpose  : 
++//function : SetAutoActivateSelection
++//purpose  :
+ //=======================================================================
+-void AIS_InteractiveContext::SetAutoActivateSelection( const Standard_Boolean Auto )
++void AIS_InteractiveContext::SetAutoActivateSelection (const Standard_Boolean theIsAuto)
+ {
+-  myIsAutoActivateSelMode = Auto;
++  myIsAutoActivateSelMode = theIsAuto;
+ }
+ //=======================================================================
+-//function :
+-//purpose  : 
++//function : GetAutoActivateSelection
++//purpose  :
+ //=======================================================================
+ Standard_Boolean AIS_InteractiveContext::GetAutoActivateSelection() const
+ {
+@@ -2837,13 +2721,12 @@
+ //=======================================================================
+ //function : SetZLayer
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+ void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& theIObj,
+                                         const Standard_Integer theLayerId)
+ {
+-  if (theIObj.IsNull ())
++  if (theIObj.IsNull())
+     return;
+   if (myObjects.IsBound (theIObj))
+@@ -2853,7 +2736,7 @@
+       theIObj->SetZLayer (myMainPM, theLayerId);
+     }
+   }
+-  else if (HasOpenedContext ())
++  else if (HasOpenedContext())
+   {
+     myLocalContexts (myCurLocalIndex)->SetZLayer (theIObj, theLayerId);
+   }
+@@ -2861,19 +2744,18 @@
+ //=======================================================================
+ //function : GetZLayer
+-//purpose  : 
++//purpose  :
+ //=======================================================================
+-
+ Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
+ {
+-  if (theIObj.IsNull ())
++  if (theIObj.IsNull())
+     return -1;
+   if (myObjects.IsBound (theIObj))
+   {
+     return theIObj->GetZLayer (myMainPM);
+   }
+-  else if (HasOpenedContext ())
++  else if (HasOpenedContext())
+   {
+     return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
+   }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext_1.cxx OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext_1.cxx
+--- OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext_1.cxx      2014-11-11 17:46:38.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext_1.cxx        2015-01-16 13:01:23.000000000 +0300
+@@ -153,6 +153,7 @@
+   {
+     if (mylastindex != 0 && mylastindex <= myMapOfOwner.Extent())
+     {
++      myMainPM->ClearImmediateDraw();
+       Unhilight (myMapOfOwner (mylastindex), theView);
+       if (theToRedrawImmediate)
+       {
+@@ -376,6 +377,7 @@
+     if(myAutoHilight)
+     {
++      myMainPM->ClearImmediateDraw();
+       const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
+       for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
+       {
+@@ -545,7 +547,6 @@
+     return;
+   }
+-  myMainPM->ClearImmediateDraw();
+   const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
+   if (IsSelected (theOwner))
+   {
+@@ -1044,6 +1045,10 @@
+   myMapOfOwner.Clear();
+   myMapOfOwner.Assign (anOwnersToKeep);
+   mylastindex = myMapOfOwner.FindIndex (aLastPicked);
++  if (!IsValidIndex (mylastindex))
++  {
++    myMainPM->ClearImmediateDraw();
++  }
+   if (!isAISRemainsDetected)
+   {
+@@ -1197,6 +1202,7 @@
+ {
+   if (thePickOwner.IsNull())
+   {
++    myMainPM->ClearImmediateDraw();
+     if (theToRedrawImmediate)
+     {
+       theView->RedrawImmediate();
+@@ -1248,6 +1254,7 @@
+   if (aNewIndex != mylastindex
+    || thePickOwner->IsForcedHilight())
+   {
++    myMainPM->ClearImmediateDraw();
+     if (mylastindex != 0
+      && mylastindex <= myMapOfOwner.Extent())
+     {
+@@ -1270,7 +1277,7 @@
+     mylastindex = aNewIndex;
+   }
+-  if (mylastindex)
++  if (mylastindex != 0)
+   {
+     mylastgood = mylastindex;
+   }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext.cxx OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext.cxx
+--- OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext.cxx        2014-11-11 17:46:38.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext.cxx  2015-01-16 12:59:32.000000000 +0300
+@@ -445,65 +445,67 @@
+ Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& aSelectable)
+ {
+-  if(!myActiveObjects.IsBound(aSelectable)) return Standard_False;
++  if(!myActiveObjects.IsBound (aSelectable))
++  {
++    return Standard_False;
++  }
++
++  if (IsSelected (aSelectable))
++  {
++    AddOrRemoveSelected (aSelectable, Standard_False);
++  }
++
++  const Handle(AIS_LocalStatus)& Att = myActiveObjects (aSelectable);
+-  if(IsSelected(aSelectable))
+-    AddOrRemoveSelected(aSelectable,Standard_False);
+-    
+-  const Handle(AIS_LocalStatus)& Att = myActiveObjects(aSelectable);
+-  
+   TColStd_ListIteratorOfListOfInteger It;
+-  // it is checked which were the temporary attributes 
+-  // and they are set to 0
+-  // desactivate standard modes
+-  if(Att->Decomposed()){
+-    for(It.Initialize(myListOfStandardMode);It.More();It.Next()){
+-      mySM->Deactivate(aSelectable,It.Value(),myMainVS);
++  // Deactivate standard modes
++  if (Att->Decomposed())
++  {
++    for (It.Initialize (myListOfStandardMode); It.More(); It.Next())
++    {
++      mySM->Deactivate (aSelectable, It.Value(), myMainVS);
+     }
+   }
+-  
+-  // if object or temporary presentations...
+-  if(Att->IsTemporary())
++
++  // If object or temporary presentations
++  if (Att->IsTemporary())
++  {
++    if (Att->IsSubIntensityOn())
+     {
+-      if(Att->IsSubIntensityOn())
+-      myMainPM->Unhighlight(aSelectable,Att->HilightMode());
+-      
+-      // remove if bug on clear correct...
+-      myMainPM->Erase(aSelectable,Att->DisplayMode());
+-      myMainPM->Clear(aSelectable,Att->DisplayMode());
+-      if(myMainPM->IsDisplayed(aSelectable,Att->HilightMode()))
+-      myMainPM->Erase(aSelectable,Att->HilightMode());
+-      //      myMainPM->Clear(aSelectable,Att->HilightMode());
++      myMainPM->Unhighlight (aSelectable, Att->HilightMode());
+     }
+-  // if below intensity
+-  else
++
++    myMainPM->Erase (aSelectable, Att->DisplayMode());
++    myMainPM->Clear (aSelectable, Att->DisplayMode());
++    if (myMainPM->IsDisplayed (aSelectable, Att->HilightMode()))
+     {
+-      if(Att->IsSubIntensityOn())
+-      myCTX->SubIntensityOff(aSelectable);
++      myMainPM->Erase (aSelectable, Att->HilightMode());
+     }
+-  // desactivate stored proper modes
+-  for(It.Initialize(Att->SelectionModes());It.More();It.Next()){
+-    mySM->Deactivate(aSelectable,It.Value(),myMainVS);
+-  }
+-// pop : si je laisses cela plantes dans les elements de construction  
+-//       alors a toi de jouer ROB
+-//  RemoveSelected(aSelectable);
+-
+-  if(IsSelected(aSelectable))
+-    AddOrRemoveSelected(aSelectable);
+-  myActiveObjects.UnBind(aSelectable);
++  }
++  // If subintensity used
++  else if (Att->IsSubIntensityOn())
++  {
++    myCTX->SubIntensityOff (aSelectable);
++  }
++
++  // Deactivate stored selection modes
++  for (It.Initialize (Att->SelectionModes()); It.More(); It.Next())
++  {
++    mySM->Deactivate (aSelectable, It.Value(), myMainVS);
++  }
+   // Remove the interactive object from selection manager
+   if (mySM->Contains (aSelectable))
+   {
+     mySM->Remove (aSelectable);
+   }
+-
+   UpdateSort();
+-
+   ClearOutdatedSelection (aSelectable, Standard_True);
++  // This should be done at the very end because most methods use
++  // myActiveObjects even during clean-up
++  myActiveObjects.UnBind (aSelectable);
+   return Standard_True;
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Blend/Blend_Walking_1.gxx OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_1.gxx
+--- OCCT-6.8.0_SRC/src/Blend/Blend_Walking_1.gxx       2014-11-11 17:46:43.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_1.gxx 2015-01-16 12:59:38.000000000 +0300
+@@ -56,6 +56,7 @@
+ void Blend_Walking::Perform(Blend_Function& Func,
+                           Blend_FuncInv& FuncInv,
++                            const Handle(ChFiDS_HElSpine)& HGuide,
+                           const Standard_Real Pdep,   
+                           const Standard_Real Pmax,
+                           const Standard_Real MaxStep,
+@@ -154,7 +155,7 @@
+     }
+   }
+-  InternalPerform(Func,FuncInv,Pmax);
++  InternalPerform(Func,FuncInv,HGuide,Pmax);
+   done = Standard_True;
+ }
+@@ -461,7 +462,8 @@
+   previousP.ParametersOnS1(sol(1),sol(2));
+   previousP.ParametersOnS2(sol(3),sol(4));
+-  InternalPerform(Func,FuncInv,P);
++  Handle(ChFiDS_HElSpine) anHGuide;
++  InternalPerform(Func,FuncInv,anHGuide,P);
+   return Standard_True;
+ }
+@@ -502,7 +504,8 @@
+   if(OnS1) clasonS1 = Standard_False;
+   else clasonS2 = Standard_False;
+-  InternalPerform(Func,FuncInv,P);
++  Handle(ChFiDS_HElSpine) anHGuide;
++  InternalPerform(Func,FuncInv,anHGuide,P);
+   clasonS1 = Standard_True;
+   clasonS2 = Standard_True;
+@@ -548,7 +551,8 @@
+   previousP.ParametersOnS1(sol(1),sol(2));
+   previousP.ParametersOnS2(sol(3),sol(4));
+-  InternalPerform(Func,FuncInv,Pmin);
++  Handle(ChFiDS_HElSpine) anHGuide;
++  InternalPerform(Func,FuncInv,anHGuide,Pmin);
+   iscomplete = Standard_True;
+   return Standard_True;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Blend/Blend_Walking_4.gxx OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_4.gxx
+--- OCCT-6.8.0_SRC/src/Blend/Blend_Walking_4.gxx       2014-11-11 17:46:43.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_4.gxx 2015-01-16 12:59:38.000000000 +0300
+@@ -12,6 +12,8 @@
+ // Alternatively, this file may be used under the terms of Open CASCADE
+ // commercial license or contractual agreement.
++#include <gce_MakePln.hxx>
++
+ static void evalpinit(math_Vector& parinit,
+                     const Blend_Point& previousP,
+                     const Standard_Real parprec,
+@@ -65,6 +67,7 @@
+ void Blend_Walking::InternalPerform(Blend_Function& Func,
+                                   Blend_FuncInv& FuncInv,
++                                    const Handle(ChFiDS_HElSpine)& HGuide,
+                                   const Standard_Real Bound)
+ {
+@@ -251,12 +254,64 @@
+         // avec les surfaces periodiques.
+         State = Blend_OnRst12;
+         param =  (w1+w2)/2;
++          gp_Pnt Pnt1, Pnt2;
+         p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
+         sol(1) = p2d.X();
+         sol(2) = p2d.Y();
++          Pnt1 = TheSurfaceTool::Value(surf1,sol(1),sol(2));
+         p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
+         sol(3) = p2d.X();
+         sol(4) = p2d.Y();
++          Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
++          if (!HGuide.IsNull())
++          {
++            const Standard_Real TolProd = 1.e-5;
++            Standard_Real SavedParams [2];
++            Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
++            ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
++            SavedParams[0] = theElSpine.GetSavedFirstParameter();
++            SavedParams[1] = theElSpine.GetSavedLastParameter();
++            for (Standard_Integer ind = 0; ind < 2; ind++)
++            {
++              if (!Precision::IsInfinite(SavedParams[ind]))
++              {
++                //Check the original first and last parameters of guide curve
++                //for equality to found parameter <param>:
++                //check equality of tangent to guide curve and
++                //normal to plane built on 3 points:
++                //point on guide curve and points on restrictions of adjacent
++                //surfaces.
++                gp_Pnt Pnt0;
++                gp_Vec Dir0;
++                HGuide->D1(SavedParams[ind], Pnt0, Dir0);
++                Standard_Real Length = Dir0.Magnitude();
++                if (Length <= gp::Resolution())
++                  continue;
++                Dir0 /= Length;
++                gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
++                if (!PlaneBuilder.IsDone())
++                  continue;
++                gp_Pln thePlane = PlaneBuilder.Value();
++                gp_Dir DirPlane = thePlane.Axis().Direction();
++                gp_Vec theProd = Dir0 ^ DirPlane;
++                Standard_Real ProdMod = theProd.Magnitude();
++                if (ProdMod <= TolProd)
++                  SameDirs[ind] = Standard_True;
++              }
++            }
++            Standard_Real theParam = Precision::Infinite();
++            //Choose the closest parameter
++            if (SameDirs[0] && SameDirs[1])
++              theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
++                SavedParams[0] : SavedParams[1];
++            else if (SameDirs[0])
++              theParam = SavedParams[0];
++            else if (SameDirs[1])
++              theParam = SavedParams[1];
++            
++            if (!Precision::IsInfinite(theParam))
++              param = theParam;
++          }
+       }
+       else if (recad1) {
+         // sol sur 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Blend/Blend_Walking.cdl OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking.cdl
+--- OCCT-6.8.0_SRC/src/Blend/Blend_Walking.cdl 2014-11-11 17:46:43.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking.cdl   2015-01-16 12:59:38.000000000 +0300
+@@ -45,6 +45,7 @@
+      Transition       from IntSurf,
+      Function         from Blend,
+      FuncInv          from Blend,
++     HElSpine         from ChFiDS,
+      State            from TopAbs
+@@ -66,6 +67,7 @@
+     Perform(me: in out; F       : in out Function from Blend;
+                         FInv    : in out FuncInv  from Blend;
++                      HGuide  : HElSpine from ChFiDS;
+                         Pdep    : Real from Standard;
+                         Pmax    : Real from Standard;
+                       MaxStep : Real from Standard;
+@@ -164,6 +166,7 @@
+     InternalPerform (me: in out;F       : in out Function from Blend;
+                                 FInv    : in out FuncInv  from Blend;
++                              HGuide  : HElSpine from ChFiDS;
+                                 Bound   : Real from Standard)
+                       
+     is static private;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx
+--- OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx        2014-11-11 17:46:39.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx  2015-01-16 12:59:34.000000000 +0300
+@@ -684,8 +684,8 @@
+       }
+       //
+       if (aInOutMap.IsBound (aHole)){
+-        const TopoDS_Shape& aHole2=aInOutMap(aHole);
+-        if (IsInside(aHole, aHole2, myContext)) {
++        const TopoDS_Shape& aSolidWas=aInOutMap(aHole);
++        if (IsInside(aSolid, aSolidWas, myContext)) {
+           aInOutMap.UnBind(aHole);
+           aInOutMap.Bind (aHole, aSolid);
+         }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
+--- OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx        2014-11-11 17:46:39.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx  2015-01-16 12:59:34.000000000 +0300
+@@ -267,7 +267,6 @@
+     aPB->Indices(nV[0], nV[1]);
+     //
+     BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
+-    ////const BOPDS_IndexedMapOfPaveBlock& aMPBF=aFI.PaveBlocksOn();
+     const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
+     const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
+     //~~~
+@@ -305,7 +304,9 @@
+               aEF.SetIndices(nE, nF);
+               aEF.SetCommonPart(aCP);
+               myDS->AddInterf(nE, nF);
+-              // 3          
++              //
++              aMIEFC.Add(nF);
++              //           
+               BOPAlgo_Tools::FillMap(aPB, nF, aMPBLI, aAllocator);
+               break;
+             }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools_1.cxx OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools_1.cxx
+--- OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools_1.cxx       2014-11-11 17:46:40.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools_1.cxx 2015-01-16 13:01:24.000000000 +0300
+@@ -344,6 +344,8 @@
+                                  Standard_Real& theFVal) {
+     try {
+       const Standard_Real aPar = theX(1);
++      if (!CheckParameter(aPar))
++        return Standard_False;
+       gp_Pnt aP1, aP2;
+       gp_Pnt2d aP2d;
+       my3DCurve->D0(aPar, aP1);
+@@ -367,7 +369,8 @@
+                                     math_Vector& theGrad) {
+     try {
+       const Standard_Real aPar = theX(1);
+-      
++      if (!CheckParameter(aPar))
++        return Standard_False;
+       gp_Pnt aP1, aP2;
+       gp_Vec aDC3D, aDSU, aDSV;
+       gp_Pnt2d aP2d;
+@@ -417,6 +420,19 @@
+   }
+   //
+  private:
++
++  Standard_Boolean CheckParameter(const Standard_Real theParam)
++  {
++    if (theParam < my3DCurve->FirstParameter() ||
++        theParam > my3DCurve->LastParameter()  ||
++        theParam < my2DCurve->FirstParameter() ||
++        theParam > my2DCurve->LastParameter() )
++    {
++      return Standard_False;
++    }
++    return Standard_True;
++  }
++
+   Handle(Geom_Curve) my3DCurve;
+   Handle(Geom2d_Curve) my2DCurve;
+   Handle(Geom_Surface) mySurf;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools.cxx OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools.cxx
+--- OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools.cxx 2014-11-11 17:46:40.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools.cxx   2015-01-16 13:01:24.000000000 +0300
+@@ -99,7 +99,8 @@
+                                    gp_Pnt& aPOut,
+                                    Handle(IntTools_Context)& theContext,
+                                    GeomAPI_ProjectPointOnSurf& aProjPL,
+-                                   const Standard_Real aDt);
++                                   const Standard_Real aDt,
++                                   const Standard_Real aTolE);
+ static 
+   Standard_Real MinStep3D(const TopoDS_Edge& theE1,
+                           const TopoDS_Face& theF1,
+@@ -1825,14 +1826,18 @@
+                 GeomAPI_ProjectPointOnSurf& aProjPL,
+                 const Standard_Real aDt)
+ {
++  Standard_Real aTolE;
++  gp_Pnt aPx;
++  //
+   BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN);
+   if (aF.Orientation()==TopAbs_REVERSED){
+     aDN.Reverse();
+   }
++  //
++  aTolE=BRep_Tool::Tolerance(aE); 
+   aDB = aDN^aDTgt;
+   //
+-  gp_Pnt aPx;
+-  if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt)) {
++  if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt, aTolE)) {
+     BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aE, aF, aT, aPx, 
+                                                       aDN, theContext);
+     aProjPL.Perform(aPx);
+@@ -1841,7 +1846,6 @@
+     aDB.SetXYZ(aVec.XYZ());
+   }
+ }
+-
+ //=======================================================================
+ //function : FindPointInFace
+ //purpose  : Find a point in the face in direction of <aDB>
+@@ -1852,12 +1856,13 @@
+                                  gp_Pnt& aPOut,
+                                  Handle(IntTools_Context)& theContext,
+                                  GeomAPI_ProjectPointOnSurf& aProjPL,
+-                                 const Standard_Real aDt)
++                                 const Standard_Real aDt,
++                                 const Standard_Real aTolE)
+ {
+   Standard_Integer aNbItMax;
+   Standard_Real aDist, aDTol, aPM;
+   Standard_Boolean bRet;
+-  gp_Pnt aP1;
++  gp_Pnt aP1, aPS;
+   //
+   aDTol = Precision::Angular();
+   aPM = aP.XYZ().Modulus();
+@@ -1869,10 +1874,27 @@
+   //
+   GeomAPI_ProjectPointOnSurf& aProj=theContext->ProjPS(aF);
+   //
++  aPS=aP;
++  aProj.Perform(aPS);
++  if (!aProj.IsDone()) {
++    return bRet;
++  }
++  aPS=aProj.NearestPoint();
++  aProjPL.Perform(aPS);
++  aPS=aProjPL.NearestPoint();
++  //
++  aPS.SetXYZ(aPS.XYZ()+2.*aTolE*aDB.XYZ());
++   aProj.Perform(aPS);
++  if (!aProj.IsDone()) {
++    return bRet;
++  }
++  aPS=aProj.NearestPoint();
++  aProjPL.Perform(aPS);
++  aPS=aProjPL.NearestPoint();
++  //
++  //
+   do {
+-    aP1.SetCoord(aP.X()+aDt*aDB.X(),
+-                 aP.Y()+aDt*aDB.Y(),
+-                 aP.Z()+aDt*aDB.Z());
++    aP1.SetXYZ(aPS.XYZ()+aDt*aDB.XYZ());
+     //
+     aProj.Perform(aP1);
+     if (!aProj.IsDone()) {
+@@ -1884,7 +1906,7 @@
+     aProjPL.Perform(aPOut);
+     aPOut = aProjPL.NearestPoint();
+     //
+-    gp_Vec aV(aP, aPOut);
++    gp_Vec aV(aPS, aPOut);
+     aDB.SetXYZ(aV.XYZ());
+   } while (aDist > aDTol && --aNbItMax);
+   //
+@@ -2006,8 +2028,8 @@
+ //function : IsInvertedSolid
+ //purpose  : 
+ //=======================================================================
+-Standard_Boolean 
+-  BOPTools_AlgoTools::IsInvertedSolid(const TopoDS_Solid& aSolid)
++Standard_Boolean BOPTools_AlgoTools::IsInvertedSolid
++  (const TopoDS_Solid& aSolid)
+ {
+   Standard_Real aTolS;
+   TopAbs_State aState;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BRepFill/BRepFill_Pipe.cxx OCCT-6.8.0_SRC-patch/src/BRepFill/BRepFill_Pipe.cxx
+--- OCCT-6.8.0_SRC/src/BRepFill/BRepFill_Pipe.cxx      2014-11-11 17:46:41.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/BRepFill/BRepFill_Pipe.cxx        2015-01-16 12:59:36.000000000 +0300
+@@ -274,18 +274,9 @@
+   }
+   ShapeUpgrade_RemoveLocations RemLoc;
++  RemLoc.SetRemoveLevel(TopAbs_COMPOUND);
+   RemLoc.Remove(myFirst);
+   myFirst = RemLoc.GetResult();
+-  TopLoc_Location theLoc = myFirst.Location();
+-  if (!theLoc.IsIdentity())
+-  {
+-    TopoDS_Shape NewMyFirst = BRepBuilderAPI_Copy(myFirst);
+-    RemLoc.Remove(NewMyFirst);
+-    NewMyFirst = RemLoc.GetResult();
+-    TopLoc_Location theIdentity;
+-    NewMyFirst.Location(theIdentity);
+-    myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation(), Standard_True);
+-  }
+   
+   myLoc->Law(myLoc->NbLaw())->GetDomain(first, last);
+   myLoc->Law(myLoc->NbLaw())->D0(last,M, V);
+@@ -308,16 +299,6 @@
+   RemLoc.Remove(myLast);
+   myLast = RemLoc.GetResult();
+-  theLoc = myLast.Location();
+-  if (!theLoc.IsIdentity())
+-  {
+-    TopoDS_Shape NewMyLast = BRepBuilderAPI_Copy(myLast);
+-    RemLoc.Remove(NewMyLast);
+-    NewMyLast = RemLoc.GetResult();
+-    TopLoc_Location theIdentity;
+-    NewMyLast.Location(theIdentity);
+-    myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation(), Standard_True);
+-  }
+   
+ #if DRAW
+   if (Affich) {
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_2.cxx OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_2.cxx
+--- OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_2.cxx     2014-11-11 17:46:44.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_2.cxx       2015-01-16 12:59:39.000000000 +0300
+@@ -1862,10 +1862,13 @@
+   Standard_Real wl = Guide.LastParameter();
+   Standard_Real locfleche = (wl - wf) * fleche;
+   Standard_Real wfsav = wf, wlsav = wl;
+-  //Now the ElSpine is artificially extended to help rsnld.
+-  Standard_Real prab = 0.01;
+-  Guide.FirstParameter(wf-prab*(wl-wf));
+-  Guide.LastParameter (wl+prab*(wl-wf));
++  if (!Guide.IsPeriodic())
++  {
++    //Now the ElSpine is artificially extended to help rsnld.
++    Standard_Real prab = 0.01;
++    Guide.FirstParameter(wf-prab*(wl-wf));
++    Guide.LastParameter (wl+prab*(wl-wf));
++  }
+   Handle(ChFiDS_Spine)&  Spine = Stripe->ChangeSpine();
+   Standard_Integer ii, nbed = Spine->NbEdges();
+   Standard_Real lastedlastp = Spine->LastParameter(nbed);
+@@ -1920,7 +1923,9 @@
+     Last = wf;
+     if(Guide.IsPeriodic()) {
+       Last = First - Guide.Period();
++      Guide.SaveFirstParameter();
+       Guide.FirstParameter(Last);
++      Guide.SaveLastParameter();
+       Guide.LastParameter (First * 1.1);//Extension to help rsnld.
+     }
+   }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_6.cxx OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_6.cxx
+--- OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_6.cxx     2014-11-11 17:46:44.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_6.cxx       2015-01-16 12:59:39.000000000 +0300
+@@ -1573,7 +1573,7 @@
+       if (5*TolGuide > MS) TolGuide = MS/5;
+       if (5*TolEsp > MS) TolEsp = MS/5;
+     }
+-    TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
++    TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
+                   ParSol,TolEsp,Fleche,Appro);
+     if (!TheWalk.IsDone()) {
+ #ifdef OCCT_DEBUG
+@@ -2113,7 +2113,7 @@
+       if (5*TolEsp > MS) TolEsp = MS/5;
+     }
+       
+-    TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
++    TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
+                   ParSol,TolEsp,Fleche,Appro);
+     
+     if (!TheWalk.IsDone()) {
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_C1.cxx OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_C1.cxx
+--- OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_C1.cxx    2014-11-11 17:46:44.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_C1.cxx      2015-01-16 13:01:24.000000000 +0300
+@@ -371,8 +371,7 @@
+     pared = ponc1.Parameter();
+     parltg = ponc2.Parameter();
+     if ((parltg > f) && (parltg < l)) {
+-#ifdef OCC23139
+-      ////modified by jgv, 10.05.2012 for the bug 23139////
++      ////modified by jgv, 10.05.2012 for the bug 23139, 25657////
+       Handle(Geom2d_Curve) PConF = fi.PCurveOnFace();
+       if (!PConF.IsNull())
+       {
+@@ -393,7 +392,6 @@
+         }
+       }
+       /////////////////////////////////////////////////////
+-#endif
+       fi.SetParameter(parltg,isfirst);
+       cp.SetArc(cp.Tolerance(),cp.Arc(),pared,cp.TransitionOnArc());
+       return Standard_True;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cdl OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cdl
+--- OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cdl       2014-11-11 17:46:44.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cdl 2015-01-16 12:59:39.000000000 +0300
+@@ -50,6 +50,10 @@
+     LastParameter(me) returns Real from Standard
+     is redefined;
+     
++    GetSavedFirstParameter(me) returns Real from Standard;
++    
++    GetSavedLastParameter(me)  returns Real from Standard;
++    
+     Continuity(me) returns Shape from GeomAbs
+     is redefined static;
+@@ -102,6 +106,10 @@
+     LastParameter(me : in out; P : Real from Standard);
++    SaveFirstParameter(me : in out);
++
++    SaveLastParameter(me : in out);
++
+     SetOrigin(me : in out; O : Real from Standard);
+     FirstPointAndTgt(me; P : out Pnt from gp; T : out Vec from gp);
+@@ -188,5 +196,7 @@
+ period    : Real     from Standard;
+ periodic  : Boolean  from Standard; 
++pfirstsav : Real     from Standard;
++plastsav  : Real     from Standard;
+ end ElSpine;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cxx OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cxx
+--- OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cxx       2014-11-11 17:46:44.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cxx 2015-01-16 12:59:39.000000000 +0300
+@@ -27,6 +27,8 @@
+ ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
+ {
++  pfirstsav = Precision::Infinite();
++  plastsav  = Precision::Infinite();
+ }
+@@ -52,6 +54,26 @@
+ }
+ //=======================================================================
++//function : GetSavedFirstParameter
++//purpose  : 
++//=======================================================================
++
++Standard_Real ChFiDS_ElSpine::GetSavedFirstParameter() const
++{
++  return pfirstsav;
++}
++
++//=======================================================================
++//function : GetSavedLastParameter
++//purpose  : 
++//=======================================================================
++
++Standard_Real ChFiDS_ElSpine::GetSavedLastParameter() const
++{
++  return plastsav;
++}
++
++//=======================================================================
+ //function : Continuity
+ //purpose  : 
+ //=======================================================================
+@@ -229,6 +251,26 @@
+   plast = P;
+ }
++//=======================================================================
++//function : SaveFirstParameter
++//purpose  : 
++//=======================================================================
++
++void ChFiDS_ElSpine::SaveFirstParameter()
++{
++  pfirstsav = pfirst;
++}
++
++//=======================================================================
++//function : SaveLastParameter
++//purpose  : 
++//=======================================================================
++
++void ChFiDS_ElSpine::SaveLastParameter()
++{
++  plastsav = plast;
++}
++
+ //=======================================================================
+ //function : SetOrigin
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Graphic3d/Graphic3d_GraphicDriver.cdl OCCT-6.8.0_SRC-patch/src/Graphic3d/Graphic3d_GraphicDriver.cdl
+--- OCCT-6.8.0_SRC/src/Graphic3d/Graphic3d_GraphicDriver.cdl   2014-11-11 17:46:49.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Graphic3d/Graphic3d_GraphicDriver.cdl     2015-01-16 13:01:24.000000000 +0300
+@@ -261,12 +261,6 @@
+         is deferred;
+     ---Purpose: call_togl_setvisualisation
+-    Transparency ( me       : mutable;
+-                   ACView   : CView from Graphic3d;
+-                   AFlag    : Boolean from Standard )
+-        is deferred;
+-    ---Purpose: call_togl_transparency
+-
+     View ( me   : mutable;
+            ACView   : in out CView from Graphic3d )
+         returns Boolean from Standard
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx
+--- OCCT-6.8.0_SRC/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx      2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx        2015-01-16 13:01:24.000000000 +0300
+@@ -1151,6 +1151,7 @@
+                                         const Standard_Real theUlSurf1,
+                                         const Standard_Real thePeriodOfSurf1,
+                                         const Handle(IntSurf_LineOn2S)& theLine,
++                                        const Standard_Real theTol3D,
+                                         const Standard_Real theTol2D,
+                                         const Standard_Boolean theFlForce)
+ {
+@@ -1177,6 +1178,32 @@
+                         thePntOnSurf2.X(), thePntOnSurf2.Y());
+   }
++  const Standard_Integer aNbPnts = theLine->NbPoints();
++  if(aNbPnts > 0)
++  {
++    Standard_Real aUl = 0.0, aVl = 0.0;
++    const IntSurf_PntOn2S aPlast = theLine->Value(aNbPnts);
++    if(isTheReverse)
++      aPlast.ParametersOnS2(aUl, aVl);
++    else
++      aPlast.ParametersOnS1(aUl, aVl);
++
++    if(anUpar <= aUl)
++    {//Parameter value will be always increased.
++      return Standard_False;
++    }
++
++    //theTol2D is minimal step along parameter changed. 
++    //Therefore, if we apply this minimal step two 
++    //neighbour points will be always "same". Consequently,
++    //we should reduce tolerance for IsSame checking.
++    const Standard_Real aDTol = 1.0-Epsilon(1.0);
++    if(aPnt.IsSame(aPlast, theTol3D*aDTol, theTol2D*aDTol))
++    {
++      theLine->RemovePoint(aNbPnts);
++    }
++  }
++
+   theLine->Add(aPnt);
+   return Standard_True;
+ }
+@@ -1191,6 +1218,7 @@
+                                           const stCoeffsValue& theCoeffs,
+                                           const Bnd_Box2d& theUVSurf1,
+                                           const Bnd_Box2d& theUVSurf2,
++                                          const Standard_Real theTol3D,
+                                           const Standard_Real theTol2D,
+                                           const Standard_Real thePeriod,
+                                           const Standard_Real theNulValue,
+@@ -1281,7 +1309,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+                           gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
+                           aUSurf1f, aUSurf1l, thePeriod,
+-                          theWL->Curve(), theTol2D, theFlForce);
++                          theWL->Curve(), theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1313,7 +1341,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
+                         aUSurf1f, aUSurf1l, thePeriod,
+-                        theWL->Curve(), theTol2D, theFlForce);
++                        theWL->Curve(),theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1346,7 +1374,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
+                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
+                         aUSurf1f, aUSurf1l, thePeriod,
+-                        theWL->Curve(), theTol2D, theFlForce);
++                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1376,7 +1404,7 @@
+         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+                         gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
+                         aUSurf1f, aUSurf1l, thePeriod,
+-                        theWL->Curve(), theTol2D, theFlForce);
++                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
+       }
+       else
+       {
+@@ -1545,7 +1573,8 @@
+   {
+     Standard_Real &a = theU1crit[i],
+                   &b = theU1crit[i-1];
+-    if(Abs(a - b) < theTol2D)
++    const Standard_Real aRemain = fmod(Abs(a - b), thePeriod); // >= 0, because Abs(a - b) >= 0
++    if((Abs(a - b) < theTol2D) || (aRemain < theTol2D) || (Abs(aRemain - thePeriod) < theTol2D))
+     {
+       a = (a + b)/2.0;
+       b = Precision::Infinite();
+@@ -1817,6 +1846,7 @@
+     Standard_Boolean isAddedIntoWL1 = Standard_False, isAddedIntoWL2 = Standard_False;
+     Standard_Real anUf = aU1f[aCurInterval], anUl = aU1l[aCurInterval];
++    const Standard_Boolean isDeltaPeriod  = IsEqual(anUl-anUf, aPeriod);
+     //Inscribe and sort critical points
+     InscribeAndSortArray(anU1crit, aNbCritPointsMax, anUf, anUl, theTol2D, aPeriod);
+@@ -1830,6 +1860,8 @@
+       Handle(IntPatch_WLine) aWLine2 = new IntPatch_WLine(aL2S2, Standard_False);
+       Standard_Integer aWL1FindStatus = 0, aWL2FindStatus = 0;
++      Standard_Boolean  isAddingWL1Enabled = Standard_True,
++                        isAddingWL2Enabled = Standard_True;
+       Standard_Real anU1 = anUf;
+@@ -1845,6 +1877,23 @@
+       while(anU1 <= anUl)
+       {
++        if(isDeltaPeriod)
++        {
++          if(IsEqual(anU1, anUl))
++          {
++            //if isAddedIntoWL* == TRUE WLine contains only one point
++            //(which was end point of previous WLine). If we will
++            //add point found on the current step WLine will contain only
++            //two points. At that both these points will be equal to the
++            //points found earlier. Therefore, new WLine will repeat 
++            //already existing WLine. Consequently, it is necessary 
++            //to forbid building new line in this case.
++
++            isAddingWL1Enabled = !isAddedIntoWL1;
++            isAddingWL2Enabled = !isAddedIntoWL2;
++          }
++        }
++
+         for(Standard_Integer i = 0; i < aNbCritPointsMax; i++)
+         {
+           if((anU1 - anU1crit[i])*aCriticalDelta[i] < 0.0)
+@@ -1995,123 +2044,129 @@
+           isFirst = Standard_False;
+         }
+-        if( ((aUSurf2f-aU21) <= theTol2D) && 
+-            ((aU21-aUSurf2l) <= theTol2D) &&
+-            ((aVSurf1f - aV11) <= theTol2D) && 
+-            ((aV11 - aVSurf1l) <= theTol2D) &&
+-            ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
++        if(isAddingWL1Enabled)
+         {
+-          Standard_Boolean isForce = Standard_False;
+-          if(!aWL1FindStatus)
++          if( ((aUSurf2f-aU21) <= theTol2D) && 
++              ((aU21-aUSurf2l) <= theTol2D) &&
++              ((aVSurf1f - aV11) <= theTol2D) && 
++              ((aV11 - aVSurf1l) <= theTol2D) &&
++              ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-
+-            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++            Standard_Boolean isForce = Standard_False;
++            if(!aWL1FindStatus)
+             {
+-              isForce = Standard_True;
+-            }
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU21, aV11, aV11Prev,
+-                              aV21, aV21Prev, isTheReverse,
+-                              1.0, isForce, isFound1, isFound2);
++              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++              {
++                isForce = Standard_True;
++              }
++
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU21, aV11, aV11Prev,
++                                aV21, aV21Prev, isTheReverse,
++                                1.0, isForce, isFound1, isFound2);
+               
+-            if(isFound1 || isFound2)
+-            {
+-              aWL1FindStatus = 1;
++              if(isFound1 || isFound2)
++              {
++                aWL1FindStatus = 1;
++              }
+             }
+-          }
+-          if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
+-          {
+-            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
+-                  gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
+-                  aUSurf1f, aUSurf1l, aPeriod,
+-                  aWLine1->Curve(), theTol2D, isForce))
++            if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
+             {
+-              if(!aWL1FindStatus)
++              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
++                    gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
++                    aUSurf1f, aUSurf1l, aPeriod,
++                    aWLine1->Curve(), theTol3D, theTol2D, isForce))
+               {
+-                aWL1FindStatus = 1;
++                if(!aWL1FindStatus)
++                {
++                  aWL1FindStatus = 1;
++                }
+               }
+             }
+           }
+-        }
+-        else
+-        {
+-          if(aWL1FindStatus == 1)
++          else
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
++            if(aWL1FindStatus == 1)
++            {
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU21, aV11, aV11Prev,
+-                              aV21, aV21Prev, isTheReverse,
+-                              1.0, Standard_False, isFound1, isFound2);
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU21, aV11, aV11Prev,
++                                aV21, aV21Prev, isTheReverse,
++                                1.0, Standard_False, isFound1, isFound2);
+-            if(isFound1 || isFound2)
+-              aWL1FindStatus = 2; //start a new line
++              if(isFound1 || isFound2)
++                aWL1FindStatus = 2; //start a new line
++            }
+           }
+         }
+-      
+-        if( ((aUSurf2f-aU22) <= theTol2D) &&
+-            ((aU22-aUSurf2l) <= theTol2D) && 
+-            ((aVSurf1f - aV12) <= theTol2D) &&
+-            ((aV12 - aVSurf1l) <= theTol2D) &&
+-            ((aVSurf2f - aV22) <= theTol2D) &&
+-            ((aV22 - aVSurf2l) <= theTol2D))
++        
++        if(isAddingWL2Enabled)
+         {
+-          Standard_Boolean isForce = Standard_False;
+-
+-          if(!aWL2FindStatus)
++          if( ((aUSurf2f-aU22) <= theTol2D) &&
++              ((aU22-aUSurf2l) <= theTol2D) && 
++              ((aVSurf1f - aV12) <= theTol2D) &&
++              ((aV12 - aVSurf1l) <= theTol2D) &&
++              ((aVSurf2f - aV22) <= theTol2D) &&
++              ((aV22 - aVSurf2l) <= theTol2D))
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
++            Standard_Boolean isForce = Standard_False;
+-            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++            if(!aWL2FindStatus)
+             {
+-              isForce = Standard_True;
+-            }
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU22, aV12, aV12Prev,
+-                              aV22, aV22Prev, isTheReverse,
+-                              -1.0, isForce, isFound1, isFound2);
++              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
++              {
++                isForce = Standard_True;
++              }
++
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU22, aV12, aV12Prev,
++                                aV22, aV22Prev, isTheReverse,
++                                -1.0, isForce, isFound1, isFound2);
+               
+-            if(isFound1 || isFound2)
+-            {
+-              aWL2FindStatus = 1;
++              if(isFound1 || isFound2)
++              {
++                aWL2FindStatus = 1;
++              }
+             }
+-          }
+-          if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
+-          {
+-            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
+-                  gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
+-                  aUSurf1f, aUSurf1l, aPeriod,
+-                  aWLine2->Curve(), theTol2D, isForce))
++            if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
+             {
+-              if(!aWL2FindStatus)
++              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
++                    gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
++                    aUSurf1f, aUSurf1l, aPeriod,
++                    aWLine2->Curve(), theTol3D, theTol2D, isForce))
+               {
+-                aWL2FindStatus = 1;
++                if(!aWL2FindStatus)
++                {
++                  aWL2FindStatus = 1;
++                }
+               }
+             }
+           }
+-        }
+-        else
+-        {
+-          if(aWL2FindStatus == 1)
++          else
+           {
+-            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
++            if(aWL2FindStatus == 1)
++            {
++              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
+-            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
+-                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
+-                              aNulValue, anU1, aU22, aV12, aV12Prev,
+-                              aV22, aV22Prev, isTheReverse,
+-                              -1.0, Standard_False, isFound1, isFound2);
++              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
++                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
++                                aNulValue, anU1, aU22, aV12, aV12Prev,
++                                aV22, aV22Prev, isTheReverse,
++                                -1.0, Standard_False, isFound1, isFound2);
+-            if(isFound1 || isFound2)
+-              aWL2FindStatus = 2; //start a new line
++              if(isFound1 || isFound2)
++                aWL2FindStatus = 2; //start a new line
++            }
+           }
+         }
+@@ -2237,15 +2292,29 @@
+       }
+       else if(aWLine1->NbPnts() > 1)
+       {
+-        isTheEmpty = Standard_False;
+-        isAddedIntoWL1 = Standard_True;
++        Standard_Boolean isGood = Standard_True;
++
++        if(aWLine1->NbPnts() == 2)
++        {
++          const IntSurf_PntOn2S& aPf = aWLine1->Point(1);
++          const IntSurf_PntOn2S& aPl = aWLine1->Point(2);
+-        SeekAdditionalPoints(theQuad1, theQuad2, aWLine1->Curve(), 
+-                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
+-                              theTol2D, aPeriod, 1.0, isTheReverse);
++          if(aPf.IsSame(aPl, Precision::Confusion()))
++            isGood = Standard_False;
++        }
+-        aWLine1->ComputeVertexParameters(theTol3D);
+-        theSlin.Append(aWLine1);
++        if(isGood)
++        {
++          isTheEmpty = Standard_False;
++          isAddedIntoWL1 = Standard_True;
++
++          SeekAdditionalPoints( theQuad1, theQuad2, aWLine1->Curve(), 
++                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
++                                theTol2D, aPeriod, 1.0, isTheReverse);
++
++          aWLine1->ComputeVertexParameters(theTol3D);
++          theSlin.Append(aWLine1);
++        }
+       }
+       else
+       {
+@@ -2267,15 +2336,28 @@
+       }
+       else if(aWLine2->NbPnts() > 1)
+       {
+-        isTheEmpty = Standard_False;
+-        isAddedIntoWL2 = Standard_True;
++        Standard_Boolean isGood = Standard_True;
++        if(aWLine2->NbPnts() == 2)
++        {
++          const IntSurf_PntOn2S& aPf = aWLine2->Point(1);
++          const IntSurf_PntOn2S& aPl = aWLine2->Point(2);
++
++          if(aPf.IsSame(aPl, Precision::Confusion()))
++            isGood = Standard_False;
++        }
+-        SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
+-                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
+-                              theTol2D, aPeriod, -1.0, isTheReverse);
++        if(isGood)
++        {
++          isTheEmpty = Standard_False;
++          isAddedIntoWL2 = Standard_True;
+-        aWLine2->ComputeVertexParameters(theTol3D);
+-        theSlin.Append(aWLine2);
++          SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
++                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
++                                theTol2D, aPeriod, -1.0, isTheReverse);
++
++          aWLine2->ComputeVertexParameters(theTol3D);
++          theSlin.Append(aWLine2);
++        }
+       }
+       else
+       {
+@@ -2284,6 +2366,203 @@
+     }
+   }
++  if(theSlin.Length() > 0)
++  {
++    for(Standard_Integer aNumOfLine = 2; aNumOfLine <= theSlin.Length(); aNumOfLine++)
++    {
++      const Handle(IntPatch_WLine)& aWLine = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine));
++
++      const IntSurf_PntOn2S& aPntFWL = aWLine->Point(1);
++
++      Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
++      aPntFWL.Parameters(aU1, aV1, aU2, aV2);
++
++      if( IsEqual(aU1, 0.0) || IsEqual(aU1, aPeriod))
++      {
++        theSlin.Exchange(1, aNumOfLine);
++        break;
++      }
++    }
++
++    for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
++    {
++      const Handle(IntPatch_WLine)& aWLine1 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine1));
++
++      const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
++      const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
++      const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
++
++      for(Standard_Integer aNPt = 1; aNPt <= theSPnt.Length(); aNPt++)
++      {
++        const IntSurf_PntOn2S aPntCur = theSPnt.Value(aNPt).PntOn2S();
++
++        if( aPntCur.IsSame(aPntFWL1, Precision::Confusion()) ||
++            aPntCur.IsSame(aPntLWL1, Precision::Confusion()))
++        {
++          theSPnt.Remove(aNPt);
++          aNPt--;
++        }
++      }
++
++      Standard_Boolean hasBeenRemoved = Standard_False;
++      for(Standard_Integer aNumOfLine2 = aNumOfLine1 + 1; aNumOfLine2 <= theSlin.Length(); aNumOfLine2++)
++      {
++        const Handle(IntPatch_WLine)& aWLine2 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine2));
++
++        const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
++        const Standard_Integer aNbPntsWL2 = aWLine2->NbPnts();
++
++        const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
++        const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
++
++        const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
++        const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
++
++        if(aPntFWL1.IsSame(aPntFWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->InsertBefore(1, aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++
++        if(aPntFWL1.IsSame(aPntLWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->InsertBefore(1, aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++
++        if(aPntLWL1.IsSame(aPntFWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->Add(aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++
++        if(aPntLWL1.IsSame(aPntLWL2, Precision::Confusion()))
++        {
++          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
++          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
++
++          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
++          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
++
++          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
++                IsEqual(fmod(aU12, aPeriod), 0.0) ||
++                IsEqual(fmod(aU21, aPeriod), 0.0) ||
++                IsEqual(fmod(aU22, aPeriod), 0.0) ||
++                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
++                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
++                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
++                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
++          {
++            aWLine1->ClearVertexes();
++            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
++            {
++              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
++              aWLine1->Curve()->Add(aPt);
++            }
++
++            aWLine1->ComputeVertexParameters(theTol3D);
++
++            theSlin.Remove(aNumOfLine2);
++            aNumOfLine2--;
++            hasBeenRemoved = Standard_True;
++
++            continue;
++          }
++        }
++      }
++
++      if(hasBeenRemoved)
++        aNumOfLine1--;
++
++      //aWLine1->ComputeVertexParameters(theTol3D);
++    }
++  }//if(theSlin.Length() > 0)
++
++
+   return Standard_True;
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.cdl OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.cdl
+--- OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.cdl     2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.cdl       2015-01-16 12:59:50.000000000 +0300
+@@ -309,9 +309,21 @@
+       ---C++: return const&
+         returns HCurve2d from Adaptor2d;
+-    Dump(me)
++    ClearVertexes(me: mutable)
++      is static;
+     
+-      is static;
++    RemoveVertex(me: mutable;
++                  theIndex : Integer from Standard)
++      is static;
++      
++    InsertVertexBefore(me: mutable;
++                        theIndex : Integer from Standard;
++                        thePnt   : Point from IntPatch)
++      is static;
++    
++        Dump(me)
++    
++      is static;
+  
+ fields
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.lxx OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.lxx
+--- OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.lxx     2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.lxx       2015-01-16 12:59:50.000000000 +0300
+@@ -97,3 +97,27 @@
+ {
+   return svtx(Index);
+ }
++
++inline void IntPatch_WLine::ClearVertexes()
++{
++  svtx.Clear();
++}
++
++inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
++{
++  if((theIndex < 1) || (theIndex > NbVertex()))
++    Standard_OutOfRange::Raise("Cannot delete not existing vertex");
++  svtx.Remove(theIndex);
++}
++
++inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
++                                                const IntPatch_Point& thePnt)
++{
++  const Standard_Integer aNbVertexes = NbVertex();
++  Standard_Integer anIndex = Max(theIndex, 1);
++
++  if(anIndex > aNbVertexes)
++    svtx.Append(thePnt);
++  else
++    svtx.InsertBefore(theIndex, thePnt);
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cdl OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cdl
+--- OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cdl     2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cdl       2015-01-16 13:01:24.000000000 +0300
+@@ -119,6 +119,15 @@
+       is static;
++    IsSame(me; theOterPoint : PntOn2S from IntSurf;
++            theTol3D, theTol2D: Real from Standard = 0.0)
++            
++  ---Purpose: Returns TRUE if 2D- and 3D-coordinates of theOterPoint are equal to
++   --         corresponding coordinates of me (with given tolerance).
++   --         If theTol2D == 0.0 we will compare 3D-points only.
++   
++        returns Boolean from Standard;
++  
+ fields
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cxx OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cxx
+--- OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cxx     2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cxx       2015-01-16 12:59:51.000000000 +0300
+@@ -49,4 +49,31 @@
+ }
++Standard_Boolean IntSurf_PntOn2S::IsSame( const IntSurf_PntOn2S& theOterPoint,
++                                          const Standard_Real theTol3D,
++                                          const Standard_Real theTol2D) const
++{
++  if(pt.SquareDistance(theOterPoint.Value()) > theTol3D*theTol3D)
++    return Standard_False;
++  if(IsEqual(theTol2D, 0.0))
++  {//We need not compare 2D-coordinates of the points
++    return Standard_True;
++  }
++
++  Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
++  theOterPoint.Parameters(aU1, aV1, aU2, aV2);
++
++  gp_Pnt2d aP1(u1, v1), aP2(aU1, aV1);
++
++  if(!aP1.IsEqual(aP2, theTol2D))
++    return Standard_False;
++
++  aP1.SetCoord(u2, v2);
++  aP2.SetCoord(aU2, aV2);
++
++  if(!aP1.IsEqual(aP2, theTol2D))
++    return Standard_False;
++
++  return Standard_True;
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntTools/IntTools_EdgeFace.cxx OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_EdgeFace.cxx
+--- OCCT-6.8.0_SRC/src/IntTools/IntTools_EdgeFace.cxx  2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_EdgeFace.cxx    2015-01-16 12:59:51.000000000 +0300
+@@ -1365,20 +1365,27 @@
+   (const IntTools_CommonPrt& aCP,
+    Standard_Real& aTx) 
+ {
+-  Standard_Real aTF, aTL, Tol, U1f,U1l,V1f,V1l, af, al,aDist2, aMinDist2, aTm, aDist2New;
+-  Standard_Real aEpsT;
++  Standard_Real aTF, aTL, Tol, U1f,U1l,V1f,V1l;
++  Standard_Real aEpsT, af, al,aDist2, aMinDist2, aTm, aDist2New;
+   Standard_Boolean theflag=Standard_False;
+   Standard_Integer aNbExt, i, iLower ;
+-
++  GeomAbs_CurveType aType;
++  //
+   aCP.Range1(aTF, aTL);
++  aType=myC.GetType();
++  //
+   aEpsT=8.e-5;
++  if (aType==GeomAbs_Line) {
++    aEpsT=9.e-5;
++  }
++  //
+   aTm=0.5*(aTF+aTL);
+   aDist2=DistanceFunction(aTm);
+   aDist2 *= aDist2;
+   Tol = Precision::PConfusion();
+-  const Handle(Geom_Curve)&  Curve   =BRep_Tool::Curve  (myC.Edge(), af, al);
++  const Handle(Geom_Curve)&  Curve =BRep_Tool::Curve  (myC.Edge(), af, al);
+   const Handle(Geom_Surface)& Surface=BRep_Tool::Surface(myS.Face());
+   Surface->Bounds(U1f,U1l,V1f,V1l);
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntTools/IntTools_FaceFace.cxx OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_FaceFace.cxx
+--- OCCT-6.8.0_SRC/src/IntTools/IntTools_FaceFace.cxx  2014-11-11 17:46:54.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_FaceFace.cxx    2015-01-16 12:59:51.000000000 +0300
+@@ -1243,10 +1243,9 @@
+       return;
+     }
+   }
++  //
+   // Do the Curve
+-  
+-  
+-  typl=L->ArcType();
++  //
+   switch (typl) {
+   //########################################  
+   // Line, Parabola, Hyperbola
+@@ -1276,10 +1275,14 @@
+     //
+     aNbParts=myLConstruct.NbParts();
+     for (i=1; i<=aNbParts; i++) {
++      Standard_Boolean bFNIt, bLPIt;
++      //
+       myLConstruct.Part(i, fprm, lprm);
+-      
+-      if (!Precision::IsNegativeInfinite(fprm) && 
+-          !Precision::IsPositiveInfinite(lprm)) {
++      //
++      bFNIt=Precision::IsNegativeInfinite(fprm);
++      bLPIt=Precision::IsPositiveInfinite(lprm);
++      //
++      if (!bFNIt && !bLPIt) {
+         //
+         IntTools_Curve aCurve;
+         //
+@@ -1309,7 +1312,7 @@
+             //
+             aCurve.SetFirstCurve2d(H1);
+           }
+-        
++        //
+         if(myApprox2) { 
+           Handle (Geom2d_Curve) C2d;
+           BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
+@@ -1325,25 +1328,24 @@
+           aCurve.SetSecondCurve2d(H1);
+         }
+         mySeqOfCurve.Append(aCurve);
+-      } // end of if (!Precision::IsNegativeInfinite(fprm) &&  !Precision::IsPositiveInfinite(lprm))
++      } //if (!bFNIt && !bLPIt) {
+       else {
+         //  on regarde si on garde
+         //
+-        Standard_Boolean bFNIt, bLPIt;
+         Standard_Real aTestPrm, dT=100.;
+-
+-        bFNIt=Precision::IsNegativeInfinite(fprm);
+-        bLPIt=Precision::IsPositiveInfinite(lprm);
+-        
++        //
+         aTestPrm=0.;
+-        
+         if (bFNIt && !bLPIt) {
+           aTestPrm=lprm-dT;
+         }
+         else if (!bFNIt && bLPIt) {
+           aTestPrm=fprm+dT;
+         }
+-        
++        else {
++          // i.e, if (bFNIt && bLPIt)
++          aTestPrm=IntTools_Tools::IntermediatePoint(-dT, dT);
++        }
++        //
+         gp_Pnt ptref(newc->Value(aTestPrm));
+         //
+         GeomAbs_SurfaceType typS1 = myHS1->GetType();
+@@ -1353,8 +1355,7 @@
+             typS1 == GeomAbs_SurfaceOfRevolution ||
+             typS2 == GeomAbs_SurfaceOfExtrusion ||
+             typS2 == GeomAbs_OffsetSurface ||
+-            typS2 == GeomAbs_SurfaceOfRevolution) 
+-        {
++            typS2 == GeomAbs_SurfaceOfRevolution) {
+           Handle(Geom2d_BSplineCurve) H1;
+           mySeqOfCurve.Append(IntTools_Curve(newc, H1, H1));
+           continue;
+@@ -1373,7 +1374,7 @@
+           mySeqOfCurve.Append(IntTools_Curve(newc, H1, H1));
+         }
+       }
+-    }// end of for (i=1; i<=myLConstruct.NbParts(); i++)
++    }// for (i=1; i<=aNbParts; i++) {
+   }// case IntPatch_Lin:  case IntPatch_Parabola:  case IntPatch_Hyperbola:
+     break;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/math/math_Recipes.cxx OCCT-6.8.0_SRC-patch/src/math/math_Recipes.cxx
+--- OCCT-6.8.0_SRC/src/math/math_Recipes.cxx   2014-11-11 17:47:18.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/math/math_Recipes.cxx     2015-01-16 13:01:25.000000000 +0300
+@@ -177,7 +177,7 @@
+                      math_Vector& vv,
+                      Standard_Real    TINY) { 
+-     Standard_Integer i, imax=0, j, k;
++     Standard_Integer i, imax=1, j, k;
+      Standard_Real big, dum, sum, temp;
+      Standard_Integer n = a.RowNumber();
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver_7.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver_7.cxx
+--- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver_7.cxx       2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver_7.cxx 2015-01-16 13:01:24.000000000 +0300
+@@ -470,13 +470,6 @@
+   }
+ }
+-void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
+-{
+-  const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
+-  if (aCView)
+-    aCView->WS->UseTransparency(AFlag);
+-}
+-
+ // =======================================================================
+ // function : InvalidateBVHData
+ // purpose  :
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver.hxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver.hxx
+--- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver.hxx 2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver.hxx   2015-01-16 13:01:24.000000000 +0300
+@@ -167,7 +167,6 @@
+   Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
+   Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView);
+   Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
+-  Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
+   Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
+   Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
+   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_View.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_View.cxx
+--- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_View.cxx  2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_View.cxx    2015-01-16 12:59:55.000000000 +0300
+@@ -54,7 +54,7 @@
+ OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext,
+                           OpenGl_StateCounter*       theCounter)
+-: mySurfaceDetail(Visual3d_TOD_NONE),
++: mySurfaceDetail(Visual3d_TOD_ALL),
+   myBackfacing(0),
+   myBgTexture(myDefaultBgTexture),
+   myBgGradient(myDefaultBgGradient),
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace_5.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace_5.cxx
+--- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace_5.cxx   2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace_5.cxx     2015-01-16 13:01:24.000000000 +0300
+@@ -119,7 +119,7 @@
+       NamedStatus |= OPENGL_NS_2NDPASSNEED;
+     }
+-    if (myUseTransparency && aProps->trans != 1.0f)
++    if (aProps->trans != 1.0f)
+     {
+       // render transparent
+       myMatTmp.Diffuse.a() = aProps->trans;
+@@ -349,7 +349,7 @@
+                              ? TelCullNone
+                              : (TelCullMode )AspectFace_set->CullingMode();
+     if (aCullingMode != TelCullNone
+-     && myUseTransparency && !(NamedStatus & OPENGL_NS_2NDPASSDO))
++     && !(NamedStatus & OPENGL_NS_2NDPASSDO))
+     {
+       // disable culling in case of translucent shading aspect
+       if (AspectFace_set->IntFront().trans != 1.0f)
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.cxx
+--- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.cxx     2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.cxx       2015-01-16 13:01:24.000000000 +0300
+@@ -156,7 +156,6 @@
+   myTransientDrawToFront (Standard_True),
+   myBackBufferRestored   (Standard_False),
+   myIsImmediateDrawn     (Standard_False),
+-  myUseTransparency (Standard_False),
+   myUseZBuffer (Standard_False),
+   myUseDepthTest (Standard_True),
+   myUseGLLight (Standard_True),
+@@ -255,15 +254,6 @@
+   return Standard_True;
+ }
+-// =======================================================================
+-// function : UseTransparency
+-// purpose  : call_togl_transparency
+-// =======================================================================
+-void OpenGl_Workspace::UseTransparency (const Standard_Boolean theFlag)
+-{
+-  myUseTransparency = theFlag;
+-}
+-
+ //=======================================================================
+ //function : ResetAppliedAspect
+ //purpose  : Sets default values of GL parameters in accordance with default aspects
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.hxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.hxx
+--- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.hxx     2014-11-11 17:46:58.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.hxx       2015-01-16 13:01:24.000000000 +0300
+@@ -184,7 +184,6 @@
+                                Image_PixMap&               theImage,
+                                const Graphic3d_BufferType& theBufferType);
+-  void UseTransparency (const Standard_Boolean theFlag);
+   Standard_Boolean& UseZBuffer()   { return myUseZBuffer; }
+   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
+   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
+@@ -671,7 +670,6 @@
+   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
+   Standard_Boolean       myBackBufferRestored;
+   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
+-  Standard_Boolean       myUseTransparency;
+   Standard_Boolean       myUseZBuffer;
+   Standard_Boolean       myUseDepthTest;
+   Standard_Boolean       myUseGLLight;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ProjLib/ProjLib_ProjectedCurve.cxx OCCT-6.8.0_SRC-patch/src/ProjLib/ProjLib_ProjectedCurve.cxx
+--- OCCT-6.8.0_SRC/src/ProjLib/ProjLib_ProjectedCurve.cxx      2014-11-11 17:47:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ProjLib/ProjLib_ProjectedCurve.cxx        2015-01-16 12:59:57.000000000 +0300
+@@ -53,6 +53,7 @@
+ #include <Geom2d_TrimmedCurve.hxx>
+ #include <ElCLib.hxx>
+ #include <GeomLib.hxx>
++#include <Extrema_ExtPC.hxx>
+ //=======================================================================
+ //function : IsoIsDeg
+@@ -482,7 +483,16 @@
+             IsTrimmed[0] = Standard_True;
+             f = f + dt;
+             myCurve = myCurve->Trim(f, l, Precision::Confusion());
+-            Vsingular[0] = ElCLib::Parameter(L, P);
++            // Searching the parameter on the basis curve for surface of revolution
++            Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
++            if (anExtr.IsDone())
++            {
++              Standard_Integer anIndex = 1;
++              while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
++              Vsingular[0] = anExtr.Point(anIndex).Parameter();
++            }
++            else
++              Vsingular[0] = ElCLib::Parameter(L, P);
+             //SingularCase[0] = 3;
+           }
+@@ -492,7 +502,16 @@
+             IsTrimmed[1] = Standard_True;
+             l = l - dt;
+             myCurve = myCurve->Trim(f, l, Precision::Confusion());
+-            Vsingular[1] = ElCLib::Parameter(L, P);
++            // Searching the parameter on the basis curve for surface of revolution
++            Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
++            if (anExtr.IsDone())
++            {
++              Standard_Integer anIndex = 1;
++              while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
++              Vsingular[1] = anExtr.Point(anIndex).Parameter();
++            }
++            else
++              Vsingular[1] = ElCLib::Parameter(L, P);
+             //SingularCase[1] = 4;
+           }
+         }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/QABugs/QABugs_11.cxx OCCT-6.8.0_SRC-patch/src/QABugs/QABugs_11.cxx
+--- OCCT-6.8.0_SRC/src/QABugs/QABugs_11.cxx    2014-11-11 17:47:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/QABugs/QABugs_11.cxx      2015-01-16 13:01:24.000000000 +0300
+@@ -236,10 +236,10 @@
+   anAISCtx->AddOrRemoveCurrentObject(aSh4);
+   //remove all this objects from context
+-  anAISCtx->Clear(aSh1, Standard_False);
+-  anAISCtx->Clear(aSh2, Standard_False);
+-  anAISCtx->Clear(aSh3, Standard_False);
+-  anAISCtx->Clear(aSh4, Standard_False);
++  anAISCtx->Remove (aSh1, Standard_False);
++  anAISCtx->Remove (aSh2, Standard_False);
++  anAISCtx->Remove (aSh3, Standard_False);
++  anAISCtx->Remove (aSh4, Standard_False);
+   return 0;
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/SelectMgr/SelectMgr_EntityOwner.cxx OCCT-6.8.0_SRC-patch/src/SelectMgr/SelectMgr_EntityOwner.cxx
+--- OCCT-6.8.0_SRC/src/SelectMgr/SelectMgr_EntityOwner.cxx     2014-11-11 17:47:04.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/SelectMgr/SelectMgr_EntityOwner.cxx       2015-01-16 13:00:02.000000000 +0300
+@@ -129,7 +129,7 @@
+ TopLoc_Location SelectMgr_EntityOwner::Location() const
+ {
+-  return !HasSelectable() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
++  return !HasLocation() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
+ }
+ void SelectMgr_EntityOwner::ResetLocation()
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cdl OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cdl
+--- OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cdl     2014-11-11 17:47:05.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cdl       2015-01-16 13:00:03.000000000 +0300
+@@ -135,6 +135,12 @@
+       ---C++: inline
+         ---Purpose: Returns (modifiable) the mode for applying 
+         --          ShapeFix::FixVertexPosition before all fixes, by default False.
++        
++        FixVertexTolMode (me: mutable) returns Integer;
++      ---C++: return &
++      ---C++: inline
++        ---Purpose: Returns (modifiable) the mode for fixing tolerances of vertices on whole shape 
++        --         after performing all fixes
+ fields  
+     myResult    : Shape from TopoDS is protected;
+@@ -147,6 +153,7 @@
+     myFixWireMode          : Integer is protected;
+     myFixSameParameterMode : Integer is protected;
+     myFixVertexPositionMode : Integer is protected;
++    myFixVertexTolMode      : Integer is protected;
+     myStatus    : Integer is protected;
+ end Shape;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cxx OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cxx
+--- OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cxx     2014-11-11 17:47:05.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cxx       2015-01-16 13:00:03.000000000 +0300
+@@ -53,6 +53,7 @@
+   myFixWireMode  = -1;
+   myFixSameParameterMode = -1;
+   myFixVertexPositionMode =0;
++  myFixVertexTolMode = -1;
+   myFixSolid = new ShapeFix_Solid;
+ }
+@@ -71,6 +72,7 @@
+   myFixSameParameterMode = -1;
+   myFixSolid = new ShapeFix_Solid;
+   myFixVertexPositionMode =0;
++  myFixVertexTolMode = -1;
+   Init(shape);
+ }
+@@ -97,7 +99,7 @@
+ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)& theProgress) 
+ {
+   Standard_Integer savFixSmallAreaWireMode = 0;
+-
++  Standard_Integer savFixVertexTolMode =  myFixVertexTolMode;
+   Handle(ShapeFix_Face) fft = Handle(ShapeFix_Face)::DownCast( FixFaceTool() );
+   if ( !fft.IsNull() ) {
+     savFixSmallAreaWireMode = fft->FixSmallAreaWireMode();
+@@ -142,7 +144,7 @@
+     TopoDS_Shape shape = myShape;
+     Standard_Boolean savFixSameParameterMode = myFixSameParameterMode;
+     myFixSameParameterMode = Standard_False;
+-
++    myFixVertexTolMode = Standard_False;
+     Standard_Integer aShapesNb = 0;
+     for ( TopoDS_Iterator anIter(S); anIter.More(); anIter.Next() )
+       ++aShapesNb;
+@@ -159,6 +161,7 @@
+       return Standard_False; // aborted execution
+     myFixSameParameterMode = savFixSameParameterMode;
++    myFixVertexTolMode = savFixVertexTolMode;
+     myShape = shape;
+     break;
+   }
+@@ -242,6 +245,26 @@
+   {
+     SameParameter(myResult, Standard_False, theProgress);
+   }
++  if( NeedFix( myFixVertexTolMode))
++  {
++    Standard_Integer nbF = 0;
++    TopExp_Explorer anExpF(myResult, TopAbs_FACE);
++    for( ; anExpF.More() && nbF <= 1; anExpF.Next())
++      nbF++;
++    if( nbF > 1)
++    {
++      //fix for bug  0025455 
++      // for case when vertex belong to the different faces it is necessary to check vertices tolerances
++      //after all fixes.
++      //This fix it should be performed for example for case when cutting edge was performed.
++
++      Handle(ShapeFix_Edge) sfe = FixEdgeTool();
++      TopExp_Explorer anExpE (myResult, TopAbs_EDGE);
++      for ( ; anExpE.More(); anExpE.Next()) 
++        sfe->FixVertexTolerance( TopoDS::Edge (anExpE.Current()));
++
++    }
++  }
+   if ( !fft.IsNull() )
+     fft->FixSmallAreaWireMode() = savFixSmallAreaWireMode;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.lxx OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.lxx
+--- OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.lxx     2014-11-11 17:47:05.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.lxx       2015-01-16 13:00:03.000000000 +0300
+@@ -122,3 +122,13 @@
+ {
+   return myFixVertexPositionMode;
+ }
++
++//=======================================================================
++//function : FixVertexTolMode
++//purpose  : 
++//=======================================================================
++
++inline Standard_Integer& ShapeFix_Shape::FixVertexTolMode() 
++{
++  return myFixVertexTolMode;
++}
+\ No newline at end of file
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_Plane.cxx OCCT-6.8.0_SRC-patch/src/V3d/V3d_Plane.cxx
+--- OCCT-6.8.0_SRC/src/V3d/V3d_Plane.cxx       2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_Plane.cxx 2015-01-16 13:00:15.000000000 +0300
+@@ -70,7 +70,6 @@
+   Graphic3d_MaterialAspect aPlastic (Graphic3d_NOM_PLASTIC);
+   aPlastic.SetColor (theColor);
+   aPlastic.SetTransparency (0.5);
+-  theView->SetTransparency (Standard_True);
+   anAsp->SetFrontMaterial (aPlastic);
+   anAsp->SetInteriorStyle (Aspect_IS_HATCH);
+   anAsp->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_View_2.cxx OCCT-6.8.0_SRC-patch/src/V3d/V3d_View_2.cxx
+--- OCCT-6.8.0_SRC/src/V3d/V3d_View_2.cxx      2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_View_2.cxx        2015-01-16 13:01:25.000000000 +0300
+@@ -21,7 +21,6 @@
+      --------------------------------
+       00-09-92 : GG  ; Creation.
+       24-12-97 : FMN ; Suppression de GEOMLITE
+-      21-02-00 : GG  ; Add Transparency() method
+       23-11-00 : GG  ; Add IsActiveLight() and IsActivePlane() methods
+ ************************************************************************/
+@@ -102,18 +101,6 @@
+ }
+-void V3d_View::SetTransparency(const Standard_Boolean AnActivity) {
+-
+-  MyTransparencyFlag = AnActivity;
+-  MyView->SetTransparency(AnActivity);
+-}
+-
+-
+-Standard_Boolean V3d_View::Transparency() const {
+-
+-  return MyTransparencyFlag;
+-}
+-
+ void V3d_View::InitActiveLights() {
+ myActiveLightsIterator.Initialize(MyActiveLights);
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_View.cdl OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cdl
+--- OCCT-6.8.0_SRC/src/V3d/V3d_View.cdl        2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cdl  2015-01-16 13:01:25.000000000 +0300
+@@ -35,8 +35,6 @@
+ --              -> Add SetProjModel() method.
+ --      VKH - 15/11/99 : G004
+ --              -> Add method Dump()
+---      GG  - IMP210200
+---              -> Add Transparency() method
+ --      THA  - 17/08/00 Thomas HARTL <t-hartl@muenchen.matra-dtv.fr>
+ --              -> Add Print method (works only under Windows).
+ --      GG  - IMP231100
+@@ -415,10 +413,6 @@
+         ---Level: Public
+         ---Purpose: Returns TRUE when the light is active in this view.
+-        SetTransparency( me : mutable ; AnActivity : Boolean = Standard_False);
+-        ---Level: Public
+-        ---Purpose: Activate/Deactivate the transparency in this view.
+-
+         SetImmediateUpdate(me: mutable; theImmediateUpdate: Boolean from Standard)
+         returns Boolean from Standard;
+         ---Purpose: sets the immediate update mode and returns the previous one.
+@@ -1141,10 +1135,6 @@
+         ---Level: Public
+         -- purpose: return the current environment texture used
+-        Transparency(me) returns Boolean from Standard;
+-        ---Level: Public
+-        ---Purpose: Returns the transparency activity.
+-
+         Visualization ( me ) returns TypeOfVisualization from V3d;
+         ---Level: Public
+         ---Purpose: Returns the current visualisation mode.
+@@ -1638,7 +1628,6 @@
+         MyGridEchoStructure             :       Structure from Graphic3d;
+         MyGridEchoGroup                 :       Group from Graphic3d;
+-        MyTransparencyFlag      : Boolean from Standard;
+         myImmediateUpdate: Boolean from Standard is protected;
+         myXscreenAxis           : Vector from Graphic3d;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_View.cxx OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cxx
+--- OCCT-6.8.0_SRC/src/V3d/V3d_View.cxx        2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cxx  2015-01-16 13:00:15.000000000 +0300
+@@ -251,8 +251,6 @@
+   aCamera->SetProjectionType ((Type == V3d_ORTHOGRAPHIC)
+     ? Graphic3d_Camera::Projection_Orthographic
+     : Graphic3d_Camera::Projection_Perspective);
+-
+-  MyTransparencyFlag = Standard_False;
+ }
+ //=============================================================================
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ViewerTest/ViewerTest.cxx OCCT-6.8.0_SRC-patch/src/ViewerTest/ViewerTest.cxx
+--- OCCT-6.8.0_SRC/src/ViewerTest/ViewerTest.cxx       2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/ViewerTest/ViewerTest.cxx 2015-01-16 13:01:25.000000000 +0300
+@@ -241,7 +241,7 @@
+        Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theName));
+     if (!anOldObj.IsNull())
+-      aContextAIS->Clear (anOldObj, Standard_True);
++      aContextAIS->Remove (anOldObj, Standard_True);
+     // remove name and old object from map
+     aMap.UnBind2 (theName);
+@@ -2751,7 +2751,7 @@
+   }
+   else
+   {
+-    anAISContext->Clear (anIO, Standard_False);
++    anAISContext->Remove (anIO, Standard_False);
+     aTexturedIO = new AIS_TexturedShape (DBRep::Get (theArgv[1]));
+     GetMapOfAIS().UnBind1 (anIO);
+     GetMapOfAIS().UnBind2 (aShapeName);
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ContextView.cxx OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ContextView.cxx
+--- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ContextView.cxx       2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ContextView.cxx 2015-01-16 13:00:15.000000000 +0300
+@@ -57,7 +57,7 @@
+ MyVisual (Visual3d_TOV_WIREFRAME),
+ MyLights (),
+ MyTextureEnv(),
+-MySurfaceDetail(Visual3d_TOD_NONE),
++MySurfaceDetail(Visual3d_TOD_ALL),
+ myClipPlanes()
+ {
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cdl OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cdl
+--- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cdl      2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cdl        2015-01-16 13:00:15.000000000 +0300
+@@ -1045,15 +1045,6 @@
+         -- or insufficient memory.
+       --  Warning: Works only under Windows.
+-      SetTransparency ( me : mutable;
+-              AFlag : Boolean from Standard )
+-              is static;
+-      ---Level: Advanced
+-      ---Purpose: if <AFlag> is Standard_True then the transparency
+-      --          is managed in the view <me>.
+-      --          Default Standard_False
+-      ---Category: Internal methods
+-
+       ZBufferIsActivated ( me )
+               returns Boolean from Standard
+               is static;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cxx OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cxx
+--- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cxx      2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cxx        2015-01-16 13:00:15.000000000 +0300
+@@ -805,7 +805,6 @@
+   {
+     myGraphicDriver->ActivateView (MyCView);
+     myGraphicDriver->Background   (MyCView);
+-    myGraphicDriver->Transparency (MyCView, myViewManager->Transparency());
+     MyCView.Active = 1;
+@@ -1801,22 +1800,6 @@
+ }
+ // =======================================================================
+-// function : SetTransparency
+-// purpose  :
+-// =======================================================================
+-void Visual3d_View::SetTransparency (const Standard_Boolean theActivity)
+-{
+-  if (IsDeleted()
+-  || !IsDefined()
+-  || !IsActive())
+-  {
+-    return;
+-  }
+-
+-  myGraphicDriver->Transparency (MyCView, theActivity);
+-}
+-
+-// =======================================================================
+ // function : SetZBufferActivity
+ // purpose  :
+ // =======================================================================
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cdl OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cdl
+--- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cdl       2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cdl 2015-01-16 13:00:15.000000000 +0300
+@@ -411,24 +411,6 @@
+       --          if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
+       ---Category: Private methods
+-      Transparency ( me )
+-              returns Boolean from Standard
+-              is static;
+-      ---Level: Advanced
+-      ---Purpose: Returns Standard_True if the transparency
+-      --          is activated in all activated views.
+-      --          Default Standard_False
+-      ---Category: Internal methods
+-
+-      SetTransparency ( me : mutable;
+-              AFlag : Boolean from Standard )
+-              is static;
+-      ---Level: Advanced
+-      ---Purpose: if <AFlag> is Standard_True then the transparency
+-      --          is managed.
+-      --          Default Standard_False
+-      ---Category: Internal methods
+-
+       ZBufferAuto ( me )
+               returns Boolean from Standard
+               is static;
+@@ -473,7 +455,6 @@
+       -- advanced
+       MyZBufferAuto                   :       Boolean from Standard;
+-      MyTransparency                  :       Boolean from Standard;
+         -- Z layer indexes
+         myLayerIds                      :       MapOfInteger from TColStd;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cxx OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cxx
+--- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cxx       2014-11-11 17:47:15.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cxx 2015-01-16 13:01:25.000000000 +0300
+@@ -83,8 +83,7 @@
+ Graphic3d_StructureManager (theDriver),
+ MyDefinedView (),
+ MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1),
+-MyZBufferAuto (Standard_False),
+-MyTransparency (Standard_False)
++MyZBufferAuto (Standard_False)
+ {
+   // default layer is always presented in display layer sequence
+   // it can not be removed
+@@ -558,24 +557,6 @@
+   MyViewGenId.Free(aViewId);
+ }
+-void Visual3d_ViewManager::SetTransparency (const Standard_Boolean AFlag)
+-{
+-  if (MyTransparency && AFlag) return;
+-  if (! MyTransparency && ! AFlag) return;
+-
+-  for(int i=1; i<=MyDefinedView.Length(); i++)
+-  {
+-    (MyDefinedView.Value(i))->SetTransparency(AFlag);
+-  }
+-
+-  MyTransparency = AFlag;
+-}
+-
+-Standard_Boolean Visual3d_ViewManager::Transparency () const
+-{
+-  return (MyTransparency);
+-}
+-
+ void Visual3d_ViewManager::SetZBufferAuto (const Standard_Boolean AFlag)
+ {
+   if (MyZBufferAuto && AFlag) return;
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/boolean/bcut_complex/N9 OCCT-6.8.0_SRC-patch/tests/boolean/bcut_complex/N9
+--- OCCT-6.8.0_SRC/tests/boolean/bcut_complex/N9       2014-11-11 17:47:21.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/boolean/bcut_complex/N9 2015-01-16 13:00:21.000000000 +0300
+@@ -1,8 +1,8 @@
+ # Original bug : pro14942
+ # Date : 26Aout98
+-#CR23958 puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
+-#CR23958 puts "TODO #22911 ALL: Error : The area of the resulting shape is"
++puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
++puts "TODO #22911 ALL: Error : The area of the resulting shape is"
+ restore [locate_data_file CTO904_pro14942a.rle] a 
+ restore [locate_data_file pro14942b.rle] b
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/boolean/bfuse_complex/P1 OCCT-6.8.0_SRC-patch/tests/boolean/bfuse_complex/P1
+--- OCCT-6.8.0_SRC/tests/boolean/bfuse_complex/P1      2014-11-11 17:47:22.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/boolean/bfuse_complex/P1        2015-01-16 13:00:23.000000000 +0300
+@@ -1,4 +1,5 @@
+ puts "TODO ?OCC24157 ALL: Error : The area of the resulting shape is"
++puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
+ # cts17861
+ restore [locate_data_file CTO900_cts17861a.rle] a
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/boolean/bopcommon_complex/J1 OCCT-6.8.0_SRC-patch/tests/boolean/bopcommon_complex/J1
+--- OCCT-6.8.0_SRC/tests/boolean/bopcommon_complex/J1  2014-11-11 17:47:23.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/boolean/bopcommon_complex/J1    2015-01-16 13:00:24.000000000 +0300
+@@ -1,3 +1,6 @@
++puts "TODO #22911 ALL: Error : The bopcommon is not valid. The area is"
++puts "TODO #22911 ALL: Error : The area of the resulting shape is"
++
+ restore [locate_data_file a158] a
+ restore [locate_data_file b148] b
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/begin OCCT-6.8.0_SRC-patch/tests/bugs/begin
+--- OCCT-6.8.0_SRC/tests/bugs/begin    2014-11-11 17:47:29.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/begin      2015-01-16 13:01:25.000000000 +0300
+@@ -253,7 +253,7 @@
+ }
+ # Check if list of xdistcs-command is valid
+-proc checkList {List Tolerance D_good} {
++proc checkList {List Tolerance D_good Limit_Tol} {
+    set L1 [llength ${List}]
+    set L2 10
+    set L3 5
+@@ -266,7 +266,14 @@
+       set D [lindex ${List} ${j2}]
+       #puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
+       if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
+-         puts "Error: i=${i} T=${T} D=${D}"
++         puts "Error : T=${T} D=${D}"
++      }
++      
++      if { ${Tolerance} > ${Limit_Tol} } {
++        if { [expr abs(${D} - ${D_good})] > ${Limit_Tol} 
++             && [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
++           puts "Attention (critical value of tolerance) : T=${T} D=${D}"
++        }
+       }
+    }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/heal/bug25455 OCCT-6.8.0_SRC-patch/tests/bugs/heal/bug25455
+--- OCCT-6.8.0_SRC/tests/bugs/heal/bug25455    1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/heal/bug25455      2015-01-16 13:00:32.000000000 +0300
+@@ -0,0 +1,21 @@
++puts "============"
++puts "OCC25455"
++puts "============"
++puts ""
++######################################################
++# fixshape works at the second attempt
++######################################################
++
++restore [locate_data_file bug25455_rx.brep] rx
++
++fixshape rx rx
++
++set info [checkshape rx]
++
++# Resume
++puts ""
++if { [regexp {This shape seems to be valid} ${info}] } {
++   puts "OK: fixshape works properly"
++} else {
++   puts "Error: fixshape works bad"
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_1 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_1
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_1      2014-11-11 17:47:31.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_1        2015-01-16 13:01:25.000000000 +0300
+@@ -22,16 +22,16 @@
+   renamevar p_1 result
+   set status 0
+-  set length 110.161
+-  set nb_v_good 4
+-  set nb_e_good 4
++  set length 110.167
++  set nb_v_good 1
++  set nb_e_good 1
+   set nb_w_good 1
+   set nb_f_good 0
+   set nb_sh_good 0
+   set nb_sol_good 0
+   set nb_compsol_good 0
+   set nb_compound_good 0
+-  set nb_shape_good 9
++  set nb_shape_good 3
+ }
+ if { ${mistake} != 0 } {
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_2 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_2
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_2      2014-11-11 17:47:31.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_2        2015-01-16 13:01:25.000000000 +0300
+@@ -22,16 +22,16 @@
+   renamevar p_2 result
+   set status 0
+-  set length 110.171
+-  set nb_v_good 4
+-  set nb_e_good 4
++  set length 110.167
++  set nb_v_good 1
++  set nb_e_good 1
+   set nb_w_good 1
+   set nb_f_good 0
+   set nb_sh_good 0
+   set nb_sol_good 0
+   set nb_compsol_good 0
+   set nb_compound_good 0
+-  set nb_shape_good 9
++  set nb_shape_good 3
+ }
+ # Resume
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22864 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22864
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22864        2014-11-11 17:47:32.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22864  2015-01-16 13:00:34.000000000 +0300
+@@ -18,15 +18,15 @@
+ #
+ set status 0
+ #
+-set nb_v_good 8
+-set nb_e_good 12
+-set nb_w_good 4
+-set nb_f_good 4
++set nb_v_good 2
++set nb_e_good 3
++set nb_w_good 1
++set nb_f_good 1
+ set nb_sh_good 0
+ set nb_sol_good 0
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 29
++set nb_shape_good 8
+ #
+ set Numbers 11
+ #
+@@ -95,7 +95,7 @@
+     puts "Faulty ${BugNumber}"
+ }
+-set square 8444.76
++set square 6606.88
+ set 2dviewer 0
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22967 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22967
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22967        2014-11-11 17:47:32.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22967  2015-01-16 13:00:34.000000000 +0300
+@@ -7,7 +7,7 @@
+ ###########################################################################################################
+ set BugNumber OCC22967
+-set check_value 3.46945e-006
++set check_value 8.46459e-006
+ restore [locate_data_file bug22967_Cylinder_1.brep] b1 
+ restore [locate_data_file bug22967_Scale_1.brep] b2 
+@@ -54,6 +54,6 @@
+    puts "OK ${BugNumber}"
+ }
+-set square 669221
++set square 668843
+ set 2dviewer 0
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug23218 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug23218
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug23218        2014-11-11 17:47:32.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug23218  2015-01-16 13:00:35.000000000 +0300
+@@ -19,7 +19,7 @@
+ puts $result
+ puts "Finish project operation ..."
+-set GoodToleranceReached 2.4950140688989345e-006
++set GoodToleranceReached 6.3315853638232248e-007
+ regexp {Tolerance Reached=([-0-9.+eE]+)} $result full ToleranceReached
+ proc GetPercent {Value GoodValue} {
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug472_3 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug472_3
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug472_3        2014-11-11 17:47:32.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug472_3  2015-01-16 13:00:35.000000000 +0300
+@@ -1,7 +1,7 @@
+ #puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_"
+ #puts "TODO OCC12345 ALL: Error : The square of result shape is"
+-puts "TODO OCC12345 ALL: Error : The command is not valid"
+-puts "TODO OCC12345 ALL: Error : Result shape is WRONG because it must contains"
++#puts "TODO OCC12345 ALL: Error : The command is not valid"
++#puts "TODO OCC12345 ALL: Error : Result shape is WRONG because it must contains"
+ puts "========================"
+ puts " OCC472 "
+@@ -20,8 +20,8 @@
+ bfuse result b1 b2
+-set nb_v_good 5
+-set nb_e_edge 7
+-set square 0
++set nb_v_good 66
++set nb_e_edge 107
++set square 31657.5
+ set 2dviewer 0
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug497_3 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug497_3
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug497_3        2014-11-11 17:47:32.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug497_3  2015-01-16 13:00:35.000000000 +0300
+@@ -15,5 +15,5 @@
+ bcut result a_1 a_2
+-set square 1773.6
++set square 2471.48
+ set 2dviewer 0
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24154 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24154
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24154        2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24154  2015-01-16 13:01:25.000000000 +0300
+@@ -12,18 +12,19 @@
+ bop b1 b2
+ bopcut result
+-set square 2.68434e+06
++#set square 2.68434e+06
++set square 5.21269e+06
+ set volume 7.35468e+07
+ # Analysis of "nbshapes res"
+ set nb_v_good 18
+-set nb_e_good 27
+-set nb_w_good 11
+-set nb_f_good 11
++set nb_e_good 36
++set nb_w_good 18
++set nb_f_good 18
+ set nb_sh_good 1
+ set nb_sol_good 1
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 70
++set nb_shape_good 93
+ set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24798 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24798
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24798        2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24798  2015-01-16 13:00:37.000000000 +0300
+@@ -12,17 +12,17 @@
+ bop b1 b2
+ bopcut result
+-set square 1826.15
++set square 1826.16
+ # Analysis of "nbshapes res"
+-set nb_v_good 49
+-set nb_e_good 72
++set nb_v_good 44
++set nb_e_good 67
+ set nb_w_good 29
+ set nb_f_good 22
+ set nb_sh_good 1
+ set nb_sol_good 1
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 175
++set nb_shape_good 165
+ set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_common OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_common
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_common 2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_common   2015-01-16 13:00:37.000000000 +0300
+@@ -43,16 +43,16 @@
+ bfillds
+ bbop result 0
+-set square 10008.5
++set square 10008.9
+-set nb_v_good 260
+-set nb_e_good 306
++set nb_v_good 140
++set nb_e_good 186
+ set nb_w_good 126
+ set nb_f_good 126
+ set nb_sh_good 40
+ set nb_sol_good 40
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 899
++set nb_shape_good 659
+ set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_cut OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_cut
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_cut    2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_cut      2015-01-16 13:00:37.000000000 +0300
+@@ -45,14 +45,14 @@
+ set square 103838
+-set nb_v_good 280
+-set nb_e_good 338
++set nb_v_good 160
++set nb_e_good 218
+ set nb_w_good 142
+ set nb_f_good 80
+ set nb_sh_good 3
+ set nb_sol_good 3
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 847
++set nb_shape_good 607
+ set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_fuse OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_fuse
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_fuse   2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_fuse     2015-01-16 13:00:37.000000000 +0300
+@@ -46,14 +46,14 @@
+ set square 157211
+-set nb_v_good 280
+-set nb_e_good 338
++set nb_v_good 160
++set nb_e_good 218
+ set nb_w_good 142
+ set nb_f_good 80
+ set nb_sh_good 1
+ set nb_sol_good 1
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 843
++set nb_shape_good 603
+ set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24981 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24981
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24981        2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24981  2015-01-16 13:00:37.000000000 +0300
+@@ -20,14 +20,14 @@
+ bfillds
+ bbuild result
+-set nb_v_good 268
+-set nb_e_good 366
++set nb_v_good 170
++set nb_e_good 268
+ set nb_w_good 243
+ set nb_f_good 195
+ set nb_sh_good 75
+ set nb_sol_good 75
+ set nb_compsol_good 0
+ set nb_compound_good  1
+-set nb_shape_good 1223
++set nb_shape_good 1027
+ set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_11 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_11
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_11     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_11       2015-01-16 13:00:37.000000000 +0300
+@@ -6,6 +6,12 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # bopcurves command
+ restore [locate_data_file bug25292_Input_0.brep] b1
+@@ -21,11 +27,17 @@
+ #############################
+ regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
++
++#This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid. 
+ set MaxTol 1.e-7
++
++#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 4
++
+ if {${Toler} > ${MaxTol}} {
+   puts "Error: Tolerance is too big!"
+ }
+-set GoodNbCurv 7
++
+ if {${NbCurv} != ${GoodNbCurv}} {
+   puts "Error: Curve Number is bad!"
+ }
+@@ -34,105 +46,54 @@
+ # 1
+ puts ""
+-puts "First curve"
+ mksurface s1 f1
+ mksurface s2 f2
+-dlog reset
+-dlog on
+-xdistcs c_1 s1 0 1 10
+-set Log1 [dlog get]
+-
+-set List1 [split ${Log1} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List1} ${Tolerance} ${D_good}
+-
+-# 2
+-puts ""
+-puts "Second curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_2 s1 0 1 10
+-set Log2 [dlog get]
+-
+-set List2 [split ${Log2} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List2} ${Tolerance} ${D_good}
+-
+-# 3
+-puts ""
+-puts "Third curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_3 s1 0 1 10
+-set Log3 [dlog get]
+-
+-set List3 [split ${Log3} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List3} ${Tolerance} ${D_good}
+-
+-# 4
+-puts ""
+-puts "Fourth curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_4 s1 0 1 10
+-set Log4 [dlog get]
+-
+-set List4 [split ${Log4} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List4} ${Tolerance} ${D_good}
+-
+-# 5
+-puts ""
+-puts "Fifth curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_5 s1 0 1 10
+-set Log5 [dlog get]
+-
+-set List5 [split ${Log5} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List5} ${Tolerance} ${D_good}
+-
+-# 6
+-puts ""
+-puts "Sixth curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_6 s1 0 1 10
+-set Log6 [dlog get]
+-
+-set List6 [split ${Log6} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List6} ${Tolerance} ${D_good}
+-
+-# 7
+-puts ""
+-puts "Seventh curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_7 s1 0 1 10
+-set Log7 [dlog get]
+-
+-set List7 [split ${Log7} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List7} ${Tolerance} ${D_good}
+-
++for {set i 1} {$i <= ${NbCurv}} {incr i} {
++  set log [dump c_$i]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++
++  puts "U1=${U1}"
++  puts "U2=${U2}"
++  
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s1 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s2 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++}
+ v2d
+ 2dfit
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_12 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_12
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_12     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_12       2015-01-16 13:00:37.000000000 +0300
+@@ -1,5 +1,3 @@
+-puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
+-
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -8,6 +6,12 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # bopcurves command
+ restore [locate_data_file bug25292_Input_0.brep] b1
+@@ -23,11 +27,17 @@
+ #############################
+ regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
++
++#This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid. 
+ set MaxTol 1.e-7
++
++#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 4
++
+ if {${Toler} > ${MaxTol}} {
+   puts "Error: Tolerance is too big!"
+ }
+-set GoodNbCurv 7
++
+ if {${NbCurv} != ${GoodNbCurv}} {
+   puts "Error: Curve Number is bad!"
+ }
+@@ -36,112 +46,55 @@
+ # 1
+ puts ""
+-puts "First curve"
+ mksurface s1 f1
+ mksurface s2 f2
+-dlog reset
+-dlog on
+-xdistcs c_1 s1 0 1 10
+-set Log1 [dlog get]
+-
+-set List1 [split ${Log1} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List1} ${Tolerance} ${D_good}
+-
+-# 2
+-puts ""
+-puts "Second curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_2 s1 0 1 10
+-set Log2 [dlog get]
+-
+-set List2 [split ${Log2} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List2} ${Tolerance} ${D_good}
+-
+-# 3
+-puts ""
+-puts "Third curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_3 s1 0 1 10
+-set Log3 [dlog get]
+-
+-set List3 [split ${Log3} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List3} ${Tolerance} ${D_good}
+-
+-# 4
+-puts ""
+-puts "Fourth curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_4 s1 0 1 10
+-set Log4 [dlog get]
+-
+-set List4 [split ${Log4} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List4} ${Tolerance} ${D_good}
+-
+-# 5
+-if { [info exist c_5] } {
+-puts ""
+-puts "Fifth curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_5 s1 0 1 10
+-set Log5 [dlog get]
+-
+-set List5 [split ${Log5} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List5} ${Tolerance} ${D_good}
+-}
+-
+-# 6
+-if { [info exist c_6] } {
+-puts ""
+-puts "Sixth curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_6 s1 0 1 10
+-set Log6 [dlog get]
+-
+-set List6 [split ${Log6} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List6} ${Tolerance} ${D_good}
++for {set i 1} {$i <= ${NbCurv}} {incr i} {
++  set log [dump c_$i]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++
++  puts "U1=${U1}"
++  puts "U2=${U2}"
++  
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s1 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s2 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
+ }
+-# 7
+-if { [info exist c_7] } {
+-puts ""
+-puts "Seventh curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_7 s1 0 1 10
+-set Log7 [dlog get]
+-
+-set List7 [split ${Log7} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List7} ${Tolerance} ${D_good}
+-}
+-
+-
+ v2d
+ 2dfit
+ set only_screen_axo 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_13 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_13
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_13     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_13       2015-01-16 13:00:37.000000000 +0300
+@@ -23,14 +23,14 @@
+ set square 289.348
+-set nb_v_good 12
+-set nb_e_good 18
++set nb_v_good 9
++set nb_e_good 15
+ set nb_w_good 10
+ set nb_f_good 10
+ set nb_sh_good 3
+ set nb_sol_good 3
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 57
++set nb_shape_good 51
+ set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_14 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_14
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_14     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_14       2015-01-16 13:00:37.000000000 +0300
+@@ -1,7 +1,3 @@
+-puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 12 vertices instead of 9"
+-puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 18 edges instead of 15"
+-puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 57 shapes instead of 51"
+-
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -27,14 +23,14 @@
+ set square 289.348
+-set nb_v_good 12
+-set nb_e_good 18
++set nb_v_good 9
++set nb_e_good 15
+ set nb_w_good 10
+ set nb_f_good 10
+ set nb_sh_good 3
+ set nb_sol_good 3
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 57
++set nb_shape_good 51
+ set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_15 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_15
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_15     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_15       2015-01-16 13:01:25.000000000 +0300
+@@ -6,8 +6,37 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++
+ # intersect command
++#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 4
++
+ restore [locate_data_file bug25292_Input_0.brep] b1
+ restore [locate_data_file bug25292_Input_1.brep] b2
+@@ -20,11 +49,98 @@
+ mksurface s2 f2
+ #################
+-intersect i s1 s2
++intersect res s1 s2
+ #################
+-
+-if { [info exist i_7] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_16 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_16
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_16     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_16       2015-01-16 13:01:25.000000000 +0300
+@@ -1,5 +1,3 @@
+-puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
+-
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -8,8 +6,37 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++
+ # intersect command
++#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 4
++
+ restore [locate_data_file bug25292_Input_0.brep] b1
+ restore [locate_data_file bug25292_Input_1.brep] b2
+@@ -22,11 +49,99 @@
+ mksurface s2 f2
+ #################
+-intersect i s2 s1
++intersect res s2 s1
+ #################
+-if { [info exist i_7] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_21 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_21
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_21     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_21       2015-01-16 13:00:37.000000000 +0300
+@@ -6,6 +6,12 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # bopcurves command
+ restore [locate_data_file bug25292_Input_3.brep] b1
+@@ -17,66 +23,74 @@
+ copy b2_1 f2
+ #########################
+-set log [bopcurves f1 f2]
++set log [bopcurves f1 f2 -2d]
+ #########################
+ regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
++
++#This value must be equal to the analogical value in bug25292_21 and bug25292_22 of "bugs modalg_5" testgrid. 
+ set MaxTol 1.e-7
++
++#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 2
++
+ if {${Toler} > ${MaxTol}} {
+   puts "Error: Tolerance is too big!"
+ }
+-set GoodNbCurv 3
++
+ if {${NbCurv} != ${GoodNbCurv}} {
+   puts "Error: Curve Number is bad!"
+ }
+ #-------------
+-# 1
+-puts ""
+-puts "First curve"
+-
+ mksurface s1 f1
+ mksurface s2 f2
+-dlog reset
+-dlog on
+-xdistcs c_1 s1 0 1 10
+-set Log1 [dlog get]
+-
+-set List1 [split ${Log1} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List1} ${Tolerance} ${D_good}
+-
+-# 2
+-puts ""
+-puts "Second curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_2 s1 0 1 10
+-set Log2 [dlog get]
+-
+-set List2 [split ${Log2} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List2} ${Tolerance} ${D_good}
+-
+-# 3
+-puts ""
+-puts "Third curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_3 s1 0 1 10
+-set Log3 [dlog get]
+-
+-set List3 [split ${Log3} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List3} ${Tolerance} ${D_good}
+-
++for {set i 1} {$i <= ${NbCurv}} {incr i} {
++  set log [dump c_$i]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++
++  puts "U1=${U1}"
++  puts "U2=${U2}"
++  
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s1 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s2 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++}
+ smallview
+ fit
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_22 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_22
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_22     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_22       2015-01-16 13:00:37.000000000 +0300
+@@ -1,5 +1,3 @@
+-puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
+-
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -8,6 +6,12 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # bopcurves command
+ restore [locate_data_file bug25292_Input_3.brep] b1
+@@ -19,69 +23,75 @@
+ copy b2_1 f2
+ #########################
+-set log [bopcurves f2 f1]
++set log [bopcurves f2 f1 -2d]
+ #########################
+ regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
++
++#This value must be equal to the analogical value in bug25292_21 and bug25292_22 of "bugs modalg_5" testgrid. 
+ set MaxTol 1.e-7
++
++#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 2
++
+ if {${Toler} > ${MaxTol}} {
+   puts "Error: Tolerance is too big!"
+ }
+-set GoodNbCurv 3
++
+ if {${NbCurv} != ${GoodNbCurv}} {
+   puts "Error: Curve Number is bad!"
+ }
+ #-------------
+-# 1
+-puts ""
+-puts "First curve"
+-
+ mksurface s1 f1
+ mksurface s2 f2
+-dlog reset
+-dlog on
+-xdistcs c_1 s1 0 1 10
+-set Log1 [dlog get]
+-
+-set List1 [split ${Log1} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List1} ${Tolerance} ${D_good}
+-
+-# 2
+-puts ""
+-puts "Second curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_2 s1 0 1 10
+-set Log2 [dlog get]
+-
+-set List2 [split ${Log2} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List2} ${Tolerance} ${D_good}
+-
+-# 3
+-if { [info exist c_3] } {
+-puts ""
+-puts "Third curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_3 s1 0 1 10
+-set Log3 [dlog get]
+-
+-set List3 [split ${Log3} {TD= \t\n}]
+-set Tolerance 1.0e-7
+-set D_good 0.
+-checkList ${List3} ${Tolerance} ${D_good}
++for {set i 1} {$i <= ${NbCurv}} {incr i} {
++  set log [dump c_$i]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++
++  puts "U1=${U1}"
++  puts "U2=${U2}"
++  
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s1 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s2 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance 1.0e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
+ }
+-
+ smallview
+ fit
+ set only_screen_axo 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_23 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_23
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_23     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_23       2015-01-16 13:00:37.000000000 +0300
+@@ -21,16 +21,17 @@
+ bfillds
+ bbuild result
++#These values must be equal to the analogical values in bug25292_23 and bug25292_24 of "bugs modalg_5" testgrid. 
+ set square 31.6797
+-set nb_v_good 11
+-set nb_e_good 20
++set nb_v_good 10
++set nb_e_good 19
+ set nb_w_good 13
+ set nb_f_good 13
+ set nb_sh_good 3
+ set nb_sol_good 3
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 64
++set nb_shape_good 62
+ set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_24 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_24
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_24     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_24       2015-01-16 13:00:37.000000000 +0300
+@@ -1,8 +1,3 @@
+-puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 11 vertices instead of 10"
+-puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 20 edges instead of 19"
+-puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 64 shapes instead of 62"
+-
+-
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -26,16 +21,17 @@
+ bfillds
+ bbuild result
++#These values must be equal to the analogical values in bug25292_23 and bug25292_24 of "bugs modalg_5" testgrid. 
+ set square 31.6797
+-set nb_v_good 11
+-set nb_e_good 20
++set nb_v_good 10
++set nb_e_good 19
+ set nb_w_good 13
+ set nb_f_good 13
+ set nb_sh_good 3
+ set nb_sol_good 3
+ set nb_compsol_good 0
+ set nb_compound_good 1
+-set nb_shape_good 64
++set nb_shape_good 62
+ set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_25 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_25
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_25     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_25       2015-01-16 13:01:25.000000000 +0300
+@@ -6,8 +6,37 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++
+ # intersect command
++#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 2
++
+ restore [locate_data_file bug25292_Input_3.brep] b1
+ restore [locate_data_file bug25292_Input_11.brep] b2
+@@ -20,11 +49,100 @@
+ mksurface s2 f2
+ #################
+-intersect i s1 s2
++intersect res s1 s2
+ #################
+-if { [info exist i_3] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.1e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.1e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.1e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.1e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
++
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_26 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_26
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_26     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_26       2015-01-16 13:01:25.000000000 +0300
+@@ -1,5 +1,3 @@
+-puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
+-
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -8,8 +6,37 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++
+ # intersect command
++#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 2
++
+ restore [locate_data_file bug25292_Input_3.brep] b1
+ restore [locate_data_file bug25292_Input_11.brep] b2
+@@ -22,12 +49,99 @@
+ mksurface s2 f2
+ #################
+-intersect i s2 s1
++intersect res s2 s1
+ #################
+-if { [info exist i_3] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.1e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.1e-7
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.1e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.1e-7
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+-
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_31 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_31
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_31     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_31       2015-01-16 13:01:25.000000000 +0300
+@@ -6,6 +6,12 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # bopcurves command
+ restore [locate_data_file bug25292_f1.brep] f1
+@@ -16,48 +22,69 @@
+ #############################
+ regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+-set MaxTol 1.e-3
++
++#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
++set MaxTol 3.e-4
++
++#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 1
++
+ if {${Toler} > ${MaxTol}} {
+   puts "Error: Tolerance is too big!"
+ }
+-set GoodNbCurv 2
+ if {${NbCurv} != ${GoodNbCurv}} {
+   puts "Error: Curve Number is bad!!"
+ }
+ #-------------
+-# 1
+-puts ""
+-puts "First curve"
+-
+ mksurface s1 f1
+ mksurface s2 f2
+-dlog reset
+-dlog on
+-xdistcs c_1 s1 0 1 10
+-set Log1 [dlog get]
+-
+-set List1 [split ${Log1} {TD= \t\n}]
+-set Tolerance 1.0e-4
+-set D_good 0.
+-checkList ${List1} ${Tolerance} ${D_good}
+-
+-# 2
+-puts ""
+-puts "Second curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_2 s1 0 1 10
+-set Log2 [dlog get]
+-
+-set List2 [split ${Log2} {TD= \t\n}]
+-set Tolerance 1.0e-4
+-set D_good 0.
+-checkList ${List2} ${Tolerance} ${D_good}
+-
++for {set i 1} {$i <= ${NbCurv}} {incr i} {
++  set log [dump c_$i]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++
++  puts "U1=${U1}"
++  puts "U2=${U2}"
++  
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s1 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance MaxTol
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s2 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance MaxTol
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++}
+ smallview
+ fit
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_32 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_32
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_32     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_32       2015-01-16 13:01:25.000000000 +0300
+@@ -1,3 +1,5 @@
++puts "TODO OCC25331 Debian60-64: Error: Tolerance is too big!"
++
+ puts "================"
+ puts "OCC25292"
+ puts "================"
+@@ -6,6 +8,12 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # bopcurves command
+ restore [locate_data_file bug25292_f1.brep] f1
+@@ -16,48 +24,69 @@
+ #############################
+ regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
+-set MaxTol 1.e-3
++
++#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
++set MaxTol 3.e-4
++
++#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 1
++
+ if {${Toler} > ${MaxTol}} {
+   puts "Error: Tolerance is too big!"
+ }
+-set GoodNbCurv 2
+ if {${NbCurv} != ${GoodNbCurv}} {
+   puts "Error: Curve Number is bad!!"
+ }
+ #-------------
+-# 1
+-puts ""
+-puts "First curve"
+-
+ mksurface s1 f1
+ mksurface s2 f2
+-dlog reset
+-dlog on
+-xdistcs c_1 s1 0 1 10
+-set Log1 [dlog get]
+-
+-set List1 [split ${Log1} {TD= \t\n}]
+-set Tolerance 1.0e-4
+-set D_good 0.
+-checkList ${List1} ${Tolerance} ${D_good}
+-
+-# 2
+-puts ""
+-puts "Second curve"
+-
+-dlog reset
+-dlog on
+-xdistcs c_2 s1 0 1 10
+-set Log2 [dlog get]
+-
+-set List2 [split ${Log2} {TD= \t\n}]
+-set Tolerance 1.0e-4
+-set D_good 0.
+-checkList ${List2} ${Tolerance} ${D_good}
+-
++for {set i 1} {$i <= ${NbCurv}} {incr i} {
++  set log [dump c_$i]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++
++  puts "U1=${U1}"
++  puts "U2=${U2}"
++  
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s1 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance MaxTol
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++
++  dlog reset
++  dlog on
++  xdistcs c_$i s2 ${U1} ${U2} 10
++  set Log2 [dlog get]
++  set List2 [split ${Log2} {TD= \t\n}]
++  set Tolerance MaxTol
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
++}
+ smallview
+ fit
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_33 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_33
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_33     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_33       2015-01-16 13:00:37.000000000 +0300
+@@ -6,8 +6,37 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++
+ # intersect command
++#This value must be equal to the analogical value in bug25292_33 and bug25292_34 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 1
++
+ restore [locate_data_file bug25292_f1.brep] f1
+ restore [locate_data_file bug25292_f2.brep] f2
+@@ -15,11 +44,99 @@
+ mksurface s2 f2
+ #################
+-intersect i s1 s2
++intersect res s1 s2
+ #################
+-if { [info exist i] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.0e-6
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.0e-6
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.0e-6
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.0e-6
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_34 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_34
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_34     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_34       2015-01-16 13:00:37.000000000 +0300
+@@ -6,8 +6,37 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++
+ # intersect command
++#This value must be equal to the analogical value in bug25292_33 and bug25292_34 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 1
++
+ restore [locate_data_file bug25292_f1.brep] f1
+ restore [locate_data_file bug25292_f2.brep] f2
+@@ -15,11 +44,99 @@
+ mksurface s2 f2
+ #################
+-intersect i s2 s1
++intersect res s2 s1
+ #################
+-if { [info exist i] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.0e-6
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 1.0e-6
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.0e-6
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 1.0e-6
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_35 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_35
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_35     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_35       2015-01-16 13:01:25.000000000 +0300
+@@ -6,8 +6,38 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # intersect command for trimmed surfaces
++#This value must be equal to the analogical value in bug25292_35 and bug25292_36 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 2
++
+ restore [locate_data_file bug25292_f1.brep] f1
+ restore [locate_data_file bug25292_f2.brep] f2
+@@ -21,11 +51,99 @@
+ trim s2t s2 0. 1.570796326795 -275 275
+ ###################
+-intersect k s1t s2t
++intersect res s1t s2t
+ ###################
+-if { [info exist k_2] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-4
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-4
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-4
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-4
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_36 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_36
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_36     2014-11-11 17:47:34.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_36       2015-01-16 13:01:25.000000000 +0300
+@@ -6,8 +6,38 @@
+ # Face/Face intersection algorithm gives different results for different order of the arguments
+ #######################################################################
++proc GetRange { curve } {
++  global U1
++  global U2
++  
++  set log [uplevel dump $curve]
++  
++  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
++  puts "Degree=${Degree}"
++  puts "Poles=${Poles}"
++  puts "KnotsPoles=${KnotsPoles}"
++  puts ""
++
++  set Knot 1
++  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U1 Mult1
++
++  set Knot ${KnotsPoles}
++  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
++  regexp ${exp_string} ${log} full U2 Mult2
++}
++
++puts "##############################"
++puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
++puts "##############################"
++puts ""
++puts ""
++
+ # intersect command for trimmed surfaces
++#This value must be equal to the analogical value in bug25292_35 and bug25292_36 of "bugs modalg_5" testgrid. 
++set GoodNbCurv 2
++
+ restore [locate_data_file bug25292_f1.brep] f1
+ restore [locate_data_file bug25292_f2.brep] f2
+@@ -21,11 +51,99 @@
+ trim s2t s2 0. 1.570796326795 -275 275
+ ###################
+-intersect k s2t s1t
++intersect res s2t s1t
+ ###################
+-if { [info exist k_2] } {
+-  puts "OK: Curve Number is good!"
++set che [whatis res]
++set ind [string first "3d curve" $che]
++if {${ind} >= 0} {
++  #Only variable "res" exists
++  
++  if { $GoodNbCurv == 1 } {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
++  
++  set U1 0.0
++  set U2 0.0
++  
++  GetRange res
++
++  puts "U1 = ${U1}"
++  puts "U2 = ${U2}"
++
++  if {[expr {$U2 - $U1}] < 1.0e-20} {
++    puts "Error: Wrong curve's range!"
++  }
++  
++  dlog reset
++  dlog on
++  xdistcs res s1 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-4
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++  
++  dlog reset
++  dlog on
++  xdistcs res s2 ${U1} ${U2} 10
++  set Log1 [dlog get]
++  set List1 [split ${Log1} {TD= \t\n}]
++  set Tolerance 3.0e-4
++  set Limit_Tol 1.0e-7
++  set D_good 0.
++  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
+ } else {
+-  puts "Error: Curve Number is bad!"
++  set ic 1
++  set AllowRepeate 1
++  while { $AllowRepeate != 0 } {
++    set che [whatis res_$ic]
++    set ind [string first "3d curve" $che]
++    if {${ind} < 0} {
++      set AllowRepeate 0
++    } else {
++      set U1 0.0
++      set U2 0.0
++      
++      GetRange res_$ic
++      
++      puts "U1 = ${U1}"
++      puts "U2 = ${U2}"
++      
++      if {[expr {$U2 - $U1}] < 1.0e-20} {
++        puts "Error: Wrong curve's range!"
++      }
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s1 ${U1} ${U2} 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-4
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      dlog reset
++      dlog on
++      xdistcs res_$ic s2 0 1 10
++      set Log1 [dlog get]
++      set List1 [split ${Log1} {TD= \t\n}]
++      set Tolerance 3.0e-4
++      set Limit_Tol 1.0e-7
++      set D_good 0.
++      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
++      
++      incr ic
++    }
++  }
++  
++  if {[expr {$ic - 1}] == $GoodNbCurv} {
++    puts "OK: Curve Number is good!"
++  } else {
++    puts "Error: Curve Number is bad!"
++  }
+ }
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25432 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25432
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25432        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25432  2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,33 @@
++puts "============"
++puts "OCC25432"
++puts "============"
++puts ""
++#########################################################################
++# Wrong result obtained by MakerVolume operator.
++#########################################################################
++
++restore [locate_data_file bug25432_qz.brep] q
++
++explode q f
++mkvolume result q_1 q_2 q_3 q_4 q_5 q_6 q_7 q_8 q_9 q_10 q_11 -ni
++
++regexp {Mass +: +([-0-9.+eE]+)} [vprops result] full volume
++
++set expected_volume 0.26776
++set tol_abs_volume 1.0e-4
++set tol_rel_volume 0.0001
++checkreal "Volume" ${volume} ${expected_volume} ${tol_abs_volume} ${tol_rel_volume}
++
++set square 3.59972
++
++set nb_v_good 12
++set nb_e_good 20
++set nb_w_good 11
++set nb_f_good 11
++set nb_sh_good 2
++set nb_sol_good 2
++set nb_compsol_good 0
++set nb_compound_good 1
++set nb_shape_good 59
++
++set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25449 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25449
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25449        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25449  2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,31 @@
++puts "================"
++puts "OCC25449"
++puts "================"
++puts ""
++#######################################################################
++# Excess vertex in result of General Fuse operation.
++#######################################################################
++
++restore [locate_data_file bug25449_fz351.brep] b1
++restore [locate_data_file bug25449_ez679.brep] b2
++
++bclearobjects
++bcleartools
++baddobjects b1 b2
++
++bfillds -t
++bbuild result
++
++set square 21.1115
++
++set nb_v_good 4
++set nb_e_good 4
++set nb_w_good 1
++set nb_f_good 1
++set nb_sh_good 0
++set nb_sol_good 0
++set nb_compsol_good 0
++set nb_compound_good 1
++set nb_shape_good 11
++
++set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_1 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_1
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_1      1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_1        2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,26 @@
++puts "================"
++puts "OCC25450"
++puts "================"
++puts ""
++####################################
++# Common operation returns wrong shape
++####################################
++
++restore [locate_data_file bug25450_Shape.brep] a
++
++explode a
++bcommon result a_1 a_2
++
++set square 142153
++
++set nb_v_good 8
++set nb_e_good 12
++set nb_w_good 4
++set nb_f_good 4
++set nb_sh_good 1
++set nb_sol_good 0
++set nb_compsol_good 0
++set nb_compound_good 1
++set nb_shape_good 30
++
++set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_2 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_2
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_2      1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_2        2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,27 @@
++puts "================"
++puts "OCC25450"
++puts "================"
++puts ""
++####################################
++# Common operation returns wrong shape
++####################################
++
++restore [locate_data_file bug25450_b1.brep] b1
++restore [locate_data_file bug25450_b2.brep] b2
++
++bop b1 b2
++bopcommon result
++
++set square 35538.3
++
++set nb_v_good 4
++set nb_e_good 4
++set nb_w_good 1
++set nb_f_good 1
++set nb_sh_good 1
++set nb_sol_good 0
++set nb_compsol_good 0
++set nb_compound_good 1
++set nb_shape_good 12
++
++set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25456 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25456
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25456        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25456  2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,17 @@
++puts "============"
++puts "OCC25456"
++puts "============"
++puts ""
++###############################
++## BOPAlgo_CheckerSI reports an error on the given shape
++###############################
++
++restore [locate_data_file bug25456_shape.brep] a
++
++set info [bopcheck a]
++
++if {[string compare ${info} " This shape seems to be OK.\n"] == 0} {
++    puts "OK: BOPAlgo_CheckerSI report is good"
++} else {
++    puts "Error : BOPAlgo_CheckerSI report is wrong"
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_1 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_1
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_1      1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_1        2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,31 @@
++puts "========"
++puts "OCC25465"
++puts "========"
++puts ""
++################################################
++# Excess vertex in the result of CUT operation
++################################################
++
++restore [locate_data_file OCC25465_Gorivo.brep] b1
++restore [locate_data_file OCC25465_Translation_1.brep] b2
++
++explode b1 f
++explode b2 f
++set bug_info [bopcurves b1_3 b2_4]
++bop b1 b2
++bopcut result
++
++# It is strictly forbidden to change nb_v_good and nb_e_good values (see OCC25465)
++set nb_v_good 11
++set nb_e_good 17
++set nb_w_good 8
++set nb_f_good 8
++set nb_sh_good 1
++set nb_sol_good 1
++set nb_compsol_good 0
++set nb_compound_good 1
++set nb_shape_good 47
++
++if {[lindex $bug_info 2] != 3} {
++  puts "ERROR: OCC25465 is reproduced."
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_2 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_2
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_2      1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_2        2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,31 @@
++puts "========"
++puts "OCC25465"
++puts "========"
++puts ""
++################################################
++# Excess vertex in the result of CUT operation
++################################################
++
++restore [locate_data_file OCC25465_t_boite1.brep] b1
++restore [locate_data_file OCC25465_c_cyl.brep] b2
++
++explode b1 f
++explode b2 f
++set bug_info [bopcurves b1_6 b2_1]
++bop b1 b2
++bopcut result
++
++# It is strictly forbidden to change nb_v_good and nb_e_good values (see OCC25465)
++set nb_v_good 13
++set nb_e_good 20
++set nb_w_good 11
++set nb_f_good 8
++set nb_sh_good 1
++set nb_sol_good 1
++set nb_compsol_good 0
++set nb_compound_good 1
++set nb_shape_good 55
++
++if {[lindex $bug_info 2] != 2} {
++  puts "ERROR: OCC25465 is reproduced."
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25480 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25480
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25480        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25480  2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,26 @@
++puts "============"
++puts "OCC25480"
++puts "============"
++puts ""
++#######################################################################
++# Incorrect result of BRepOffsetAPI_MakePipe
++#######################################################################
++
++restore [locate_data_file bug25480_part1.brep] a
++restore [locate_data_file bug25480_part2.brep] b
++
++pipe result b a 1
++
++set square 48441
++
++set nb_v_good 224
++set nb_e_good 392
++set nb_w_good 196
++set nb_f_good 196
++set nb_sh_good 14
++set nb_sol_good 14
++set nb_compsol_good 0
++set nb_compound_good 8
++set nb_shape_good 1044
++
++set 2dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25488 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25488
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25488        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25488  2015-01-16 13:01:25.000000000 +0300
+@@ -0,0 +1,34 @@
++puts "========"
++puts "OCC25488"
++puts "========"
++puts ""
++######################################################
++# Wrong result of two trimmed cylinders intersection
++######################################################
++
++set Tolerance 3.0e-7
++set D_good 0.
++set Limit_Tol 1.0e-7
++
++restore [locate_data_file OCC25488_sb1_1t.draw] sb1
++restore [locate_data_file OCC25488_sb2_1t.draw] sb2
++
++set bug_info [intersect res sb1 sb2]
++
++set i 0
++while {$i != [llength $bug_info]} {
++  set res_i [lindex $bug_info $i]
++  dlog reset
++  dlog on
++  xdistcs ${res_i} sb1 0 1 10
++  set BugLog [dlog get]
++  set BugList [split ${BugLog} {TD= \t\n}]
++  checkList ${BugList} ${Tolerance} ${D_good} ${Limit_Tol}
++  dlog reset
++  dlog on
++  xdistcs ${res_i} sb2 0 1 10
++  set BugLog [dlog get]
++  set BugList [split ${BugLog} {TD= \t\n}]
++  checkList ${BugList} ${Tolerance} ${D_good} ${Limit_Tol}
++  set i [expr {$i + 1}]
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25505 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25505
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25505        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25505  2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,39 @@
++puts "============"
++puts "OCC25505"
++puts "============"
++puts ""
++###############################
++## General Fuse produces self-intersection shape
++###############################
++
++restore [locate_data_file bug25505_q.brep] q
++
++explode q
++
++bclearobjects
++bcleartools
++baddobjects q_1 q_2 q_3 q_4
++bfillds
++bbuild result
++
++set info [bopcheck result]
++
++if {[string compare ${info} " This shape seems to be OK.\n"] == 0} {
++    puts "OK: General Fuse produces good shape"
++} else {
++    puts "Error : General Fuse produces self-intersection shape"
++}
++
++set square 68796.4
++
++set nb_v_good 14
++set nb_e_good 21
++set nb_w_good 9
++set nb_f_good 9
++set nb_sh_good 7
++set nb_sol_good 4
++set nb_compsol_good 0
++set nb_compound_good  1
++set nb_shape_good 65
++
++set 3dviewer 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25592 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25592
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25592        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25592  2015-01-16 13:00:38.000000000 +0300
+@@ -0,0 +1,50 @@
++puts "============"
++puts "OCC25592"
++puts "============"
++puts ""
++######################################################
++# Bad result of Fillet operation
++######################################################
++
++restore [locate_data_file bug25592_tshape.brep] t
++explode t e
++shape c c
++add t_4 c
++add t_6 c
++fillet r t 30 c
++explode r f
++
++set info1 [bopargcheck r_2 #f]
++if { [regexp "to be valid for BOP" ${info1}] == 1 } {
++    puts "1. OK : Good result of Fillet operation\n"
++} else {
++    puts "1. Error : Bad result of Fillet operation\n"
++}
++
++set info2 [bopargcheck r_1 #f]
++if { [regexp "to be valid for BOP" ${info2}] == 1 } {
++    puts "2. OK : Good result of Fillet operation\n"
++} else {
++    puts "2. Error : Bad result of Fillet operation\n"
++}
++
++set info3 [bopargcheck r_6 #f]
++if { [regexp "to be valid for BOP" ${info3}] == 1 } {
++    puts "3. OK : Good result of Fillet operation\n"
++} else {
++    puts "3. Error : Bad result of Fillet operation\n"
++}
++
++set info4 [bopargcheck r_7 #f]
++if { [regexp "to be valid for BOP" ${info4}] == 1 } {
++    puts "4. OK : Good result of Fillet operation\n"
++} else {
++    puts "4. Error : Bad result of Fillet operation\n"
++}
++
++set info5 [bopargcheck r_9 #f]
++if { [regexp "to be valid for BOP" ${info5}] == 1 } {
++    puts "5. OK : Good result of Fillet operation\n"
++} else {
++    puts "5. Error : Bad result of Fillet operation\n"
++}
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25657 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25657
+--- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25657        1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25657  2015-01-16 13:01:25.000000000 +0300
+@@ -0,0 +1,25 @@
++puts "========"
++puts "OCC25657"
++puts "========"
++puts ""
++###########################################################################################
++#  Bad result of Fillet operation
++###########################################################################################
++
++restore [locate_data_file bug25657_r4.brep] r4
++explode r4 e
++shape c c
++add r4_15 c
++fillet res r4 20 c
++
++explode res f
++
++pcurve res_2
++# exception
++
++pcurve res_5
++# exception
++
++smallview
++fit
++set only_screen_axo 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_1 OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_1
+--- OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_1        2014-11-11 17:47:35.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_1  2015-01-16 13:00:39.000000000 +0300
+@@ -1,3 +1,5 @@
++puts "TODO CR25432 ALL: Error : The square of result shape is"
++
+ puts "================"
+ puts "OCC26"
+ puts "================"
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_2 OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_2
+--- OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_2        2014-11-11 17:47:35.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_2  2015-01-16 13:00:39.000000000 +0300
+@@ -1,3 +1,5 @@
++puts "TODO CR25432 ALL: Error : The square of result shape is"
++
+ puts "================"
+ puts "OCC26"
+ puts "================"
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/moddata_3/bug25494 OCCT-6.8.0_SRC-patch/tests/bugs/moddata_3/bug25494
+--- OCCT-6.8.0_SRC/tests/bugs/moddata_3/bug25494       1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/moddata_3/bug25494 2015-01-16 13:00:40.000000000 +0300
+@@ -0,0 +1,14 @@
++puts "================"
++puts "OCC25494"
++puts "================"
++puts ""
++#######################################################################
++# Wrong result obtained by projection algorithm
++#######################################################################
++
++restore [locate_data_file bug25494_s.draw] s
++restore [locate_data_file bug25494_c.draw] c
++
++project c2d c s
++
++dump c2d
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/vis/bug25492 OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25492
+--- OCCT-6.8.0_SRC/tests/bugs/vis/bug25492     1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25492       2015-01-16 13:00:41.000000000 +0300
+@@ -0,0 +1,32 @@
++puts "============"
++puts "CR25492"
++puts "============"
++puts ""
++#######################################################################
++# The selected subshape does not have topological relationship
++# with orginal shape in OCC680
++#######################################################################
++pload ALL
++
++set isEqual 0
++vinit
++box aShape 5 5 5 3 3 3
++vdisplay aShape
++vfit
++vselmode 4 1
++vselect 100 200
++vpickselected aSub
++explode aShape F
++
++
++for {set i 1} {$i <= 6 } {incr i} {
++  set aRes [compare aShape_$i aSub];
++  if { [lsearch $aRes equal] != -1} {
++    set isEqual 1
++  }
++}
++
++if {$isEqual == 0} {
++puts "Error: No selected sub-shape was found in exploded sub-shapes"
++}
++set only_screen 1
+diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/vis/bug25528 OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25528
+--- OCCT-6.8.0_SRC/tests/bugs/vis/bug25528     1970-01-01 03:00:00.000000000 +0300
++++ OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25528       2015-01-16 13:00:41.000000000 +0300
+@@ -0,0 +1,25 @@
++puts "============"
++puts "OCC25528"
++puts "============"
++puts ""
++####################################################################################
++# Visualization - Exception on removing an interactive object from 
++# a local context
++# vremove -local <obj_name> crashes if there is an opened local context
++####################################################################################
++
++pload ALL
++box b 1 2 3
++vinit
++vdisplay b
++vfit
++
++# opening a local context for local selection
++vselmode b 4 1
++# Select a face just to simulate the scenario used in a real application
++vselect 200 200
++# This line should not lead to exception
++vremove -local b
++
++# Screenshot should be empty (box removed successfully)
++vdump ${imagedir}/${casename}.png
diff --git a/config_files/patches/OCCT-6.8.0_SRC.patch b/config_files/patches/OCCT-6.8.0_SRC.patch
deleted file mode 100644 (file)
index 667301a..0000000
+++ /dev/null
@@ -1,10480 +0,0 @@
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/drv/BRepBlend/BRepBlend_Walking_0.cxx OCCT-6.8.0_SRC-patch/drv/BRepBlend/BRepBlend_Walking_0.cxx
---- OCCT-6.8.0_SRC/drv/BRepBlend/BRepBlend_Walking_0.cxx       2014-11-11 17:53:30.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/drv/BRepBlend/BRepBlend_Walking_0.cxx 2015-01-16 14:33:41.000000000 +0300
-@@ -22,6 +22,7 @@
- #include <Blend_Point.hxx>
- #include <Blend_Function.hxx>
- #include <Blend_FuncInv.hxx>
-+#include <ChFiDS_HElSpine.hxx>
- #include <gp_Pnt2d.hxx>
- #include <IntSurf_Transition.hxx>
-  
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/AIS_InteractiveContext.hxx OCCT-6.8.0_SRC-patch/inc/AIS_InteractiveContext.hxx
---- OCCT-6.8.0_SRC/inc/AIS_InteractiveContext.hxx      2014-11-11 17:54:39.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/AIS_InteractiveContext.hxx        2015-01-16 14:34:51.000000000 +0300
-@@ -239,13 +239,6 @@
-   //! Local Context opened.
-   Standard_EXPORT   Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1) ;
-   
--  //! Removes the interactive object aniobj from all viewers.
--  //! If a local context is open and if updateviewer equals
--  //! Standard_False, the presentation of the Interactive
--  //! Object activates the selection mode; the object is
--  //! displayed but no viewer will be updated.
--  Standard_EXPORT   void Clear (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True) ;
--  
-   //! Empties the graphic presentation of the mode
-   //! indexed by aMode.
-   //! If a local context is open and if updateviewer equals
-@@ -1633,6 +1626,12 @@
-   Standard_EXPORT   void InitAttributes() ;
-   
-   Standard_EXPORT   Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr) ;
-+  
-+  //! UNKNOWN
-+  Standard_EXPORT   void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True) ;
-+  
-+  //! UNKNOWN
-+  Standard_EXPORT   void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True) ;
-   AIS_DataMapOfIOStatus myObjects;
-   Handle(SelectMgr_SelectionManager) mgrSelector;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Blend_Walking_1.gxx OCCT-6.8.0_SRC-patch/inc/Blend_Walking_1.gxx
---- OCCT-6.8.0_SRC/inc/Blend_Walking_1.gxx     2014-11-11 17:46:43.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/Blend_Walking_1.gxx       2015-01-16 12:59:38.000000000 +0300
-@@ -56,6 +56,7 @@
- void Blend_Walking::Perform(Blend_Function& Func,
-                           Blend_FuncInv& FuncInv,
-+                            const Handle(ChFiDS_HElSpine)& HGuide,
-                           const Standard_Real Pdep,   
-                           const Standard_Real Pmax,
-                           const Standard_Real MaxStep,
-@@ -154,7 +155,7 @@
-     }
-   }
--  InternalPerform(Func,FuncInv,Pmax);
-+  InternalPerform(Func,FuncInv,HGuide,Pmax);
-   done = Standard_True;
- }
-@@ -461,7 +462,8 @@
-   previousP.ParametersOnS1(sol(1),sol(2));
-   previousP.ParametersOnS2(sol(3),sol(4));
--  InternalPerform(Func,FuncInv,P);
-+  Handle(ChFiDS_HElSpine) anHGuide;
-+  InternalPerform(Func,FuncInv,anHGuide,P);
-   return Standard_True;
- }
-@@ -502,7 +504,8 @@
-   if(OnS1) clasonS1 = Standard_False;
-   else clasonS2 = Standard_False;
--  InternalPerform(Func,FuncInv,P);
-+  Handle(ChFiDS_HElSpine) anHGuide;
-+  InternalPerform(Func,FuncInv,anHGuide,P);
-   clasonS1 = Standard_True;
-   clasonS2 = Standard_True;
-@@ -548,7 +551,8 @@
-   previousP.ParametersOnS1(sol(1),sol(2));
-   previousP.ParametersOnS2(sol(3),sol(4));
--  InternalPerform(Func,FuncInv,Pmin);
-+  Handle(ChFiDS_HElSpine) anHGuide;
-+  InternalPerform(Func,FuncInv,anHGuide,Pmin);
-   iscomplete = Standard_True;
-   return Standard_True;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Blend_Walking_4.gxx OCCT-6.8.0_SRC-patch/inc/Blend_Walking_4.gxx
---- OCCT-6.8.0_SRC/inc/Blend_Walking_4.gxx     2014-11-11 17:46:43.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/Blend_Walking_4.gxx       2015-01-16 12:59:38.000000000 +0300
-@@ -12,6 +12,8 @@
- // Alternatively, this file may be used under the terms of Open CASCADE
- // commercial license or contractual agreement.
-+#include <gce_MakePln.hxx>
-+
- static void evalpinit(math_Vector& parinit,
-                     const Blend_Point& previousP,
-                     const Standard_Real parprec,
-@@ -65,6 +67,7 @@
- void Blend_Walking::InternalPerform(Blend_Function& Func,
-                                   Blend_FuncInv& FuncInv,
-+                                    const Handle(ChFiDS_HElSpine)& HGuide,
-                                   const Standard_Real Bound)
- {
-@@ -251,12 +254,64 @@
-         // avec les surfaces periodiques.
-         State = Blend_OnRst12;
-         param =  (w1+w2)/2;
-+          gp_Pnt Pnt1, Pnt2;
-         p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
-         sol(1) = p2d.X();
-         sol(2) = p2d.Y();
-+          Pnt1 = TheSurfaceTool::Value(surf1,sol(1),sol(2));
-         p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
-         sol(3) = p2d.X();
-         sol(4) = p2d.Y();
-+          Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
-+          if (!HGuide.IsNull())
-+          {
-+            const Standard_Real TolProd = 1.e-5;
-+            Standard_Real SavedParams [2];
-+            Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
-+            ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
-+            SavedParams[0] = theElSpine.GetSavedFirstParameter();
-+            SavedParams[1] = theElSpine.GetSavedLastParameter();
-+            for (Standard_Integer ind = 0; ind < 2; ind++)
-+            {
-+              if (!Precision::IsInfinite(SavedParams[ind]))
-+              {
-+                //Check the original first and last parameters of guide curve
-+                //for equality to found parameter <param>:
-+                //check equality of tangent to guide curve and
-+                //normal to plane built on 3 points:
-+                //point on guide curve and points on restrictions of adjacent
-+                //surfaces.
-+                gp_Pnt Pnt0;
-+                gp_Vec Dir0;
-+                HGuide->D1(SavedParams[ind], Pnt0, Dir0);
-+                Standard_Real Length = Dir0.Magnitude();
-+                if (Length <= gp::Resolution())
-+                  continue;
-+                Dir0 /= Length;
-+                gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
-+                if (!PlaneBuilder.IsDone())
-+                  continue;
-+                gp_Pln thePlane = PlaneBuilder.Value();
-+                gp_Dir DirPlane = thePlane.Axis().Direction();
-+                gp_Vec theProd = Dir0 ^ DirPlane;
-+                Standard_Real ProdMod = theProd.Magnitude();
-+                if (ProdMod <= TolProd)
-+                  SameDirs[ind] = Standard_True;
-+              }
-+            }
-+            Standard_Real theParam = Precision::Infinite();
-+            //Choose the closest parameter
-+            if (SameDirs[0] && SameDirs[1])
-+              theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
-+                SavedParams[0] : SavedParams[1];
-+            else if (SameDirs[0])
-+              theParam = SavedParams[0];
-+            else if (SameDirs[1])
-+              theParam = SavedParams[1];
-+            
-+            if (!Precision::IsInfinite(theParam))
-+              param = theParam;
-+          }
-       }
-       else if (recad1) {
-         // sol sur 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/BRepBlend_Walking.hxx OCCT-6.8.0_SRC-patch/inc/BRepBlend_Walking.hxx
---- OCCT-6.8.0_SRC/inc/BRepBlend_Walking.hxx   2014-11-11 17:53:30.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/BRepBlend_Walking.hxx     2015-01-16 14:33:41.000000000 +0300
-@@ -22,6 +22,7 @@
- #include <Handle_Adaptor2d_HCurve2d.hxx>
- #include <Handle_Adaptor3d_HCurve.hxx>
- #include <Standard_Integer.hxx>
-+#include <Handle_ChFiDS_HElSpine.hxx>
- #include <TopAbs_State.hxx>
- #include <Blend_Status.hxx>
- class BRepBlend_Line;
-@@ -41,6 +42,7 @@
- class Blend_Point;
- class Blend_Function;
- class Blend_FuncInv;
-+class ChFiDS_HElSpine;
- class gp_Pnt2d;
- class IntSurf_Transition;
-@@ -59,7 +61,7 @@
-   
-   Standard_EXPORT   void AddSingularPoint (const Blend_Point& P) ;
-   
--  Standard_EXPORT   void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False) ;
-+  Standard_EXPORT   void Perform (Blend_Function& F, Blend_FuncInv& FInv, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Real Pdep, const Standard_Real Pmax, const Standard_Real MaxStep, const Standard_Real TolGuide, const math_Vector& Soldep, const Standard_Real Tolesp, const Standard_Real Fleche, const Standard_Boolean Appro = Standard_False) ;
-   
-   Standard_EXPORT   Standard_Boolean PerformFirstSection (Blend_Function& F, const Standard_Real Pdep, math_Vector& ParDep, const Standard_Real Tolesp, const Standard_Real TolGuide, TopAbs_State& Pos1, TopAbs_State& Pos2) ;
-   
-@@ -99,7 +101,7 @@
- private:
-   
--  Standard_EXPORT   void InternalPerform (Blend_Function& F, Blend_FuncInv& FInv, const Standard_Real Bound) ;
-+  Standard_EXPORT   void InternalPerform (Blend_Function& F, Blend_FuncInv& FInv, const Handle(ChFiDS_HElSpine)& HGuide, const Standard_Real Bound) ;
-   
-   Standard_EXPORT   Standard_Integer ArcToRecadre (const Standard_Boolean OnFirst, const math_Vector& Sol, const Standard_Integer PrevIndex, gp_Pnt2d& lpt2d, gp_Pnt2d& pt2d, Standard_Real& ponarc) ;
-   
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/ChFiDS_ElSpine.hxx OCCT-6.8.0_SRC-patch/inc/ChFiDS_ElSpine.hxx
---- OCCT-6.8.0_SRC/inc/ChFiDS_ElSpine.hxx      2014-11-11 17:53:46.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/ChFiDS_ElSpine.hxx        2015-01-16 14:33:58.000000000 +0300
-@@ -56,6 +56,10 @@
-   
-   Standard_EXPORT virtual   Standard_Real LastParameter()  const;
-   
-+  Standard_EXPORT   Standard_Real GetSavedFirstParameter()  const;
-+  
-+  Standard_EXPORT   Standard_Real GetSavedLastParameter()  const;
-+  
-   Standard_EXPORT   GeomAbs_Shape Continuity()  const;
-   
-   Standard_EXPORT   Standard_Integer NbIntervals (const GeomAbs_Shape S) ;
-@@ -91,6 +95,10 @@
-   
-   Standard_EXPORT   void LastParameter (const Standard_Real P) ;
-   
-+  Standard_EXPORT   void SaveFirstParameter() ;
-+  
-+  Standard_EXPORT   void SaveLastParameter() ;
-+  
-   Standard_EXPORT   void SetOrigin (const Standard_Real O) ;
-   
-   Standard_EXPORT   void FirstPointAndTgt (gp_Pnt& P, gp_Vec& T)  const;
-@@ -149,6 +157,8 @@
-   Standard_Real plast;
-   Standard_Real period;
-   Standard_Boolean periodic;
-+  Standard_Real pfirstsav;
-+  Standard_Real plastsav;
- };
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Graphic3d_GraphicDriver.hxx OCCT-6.8.0_SRC-patch/inc/Graphic3d_GraphicDriver.hxx
---- OCCT-6.8.0_SRC/inc/Graphic3d_GraphicDriver.hxx     2014-11-11 17:54:46.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/Graphic3d_GraphicDriver.hxx       2015-01-16 14:34:57.000000000 +0300
-@@ -130,9 +130,6 @@
-   //! call_togl_setvisualisation
-   Standard_EXPORT virtual   void SetVisualisation (const Graphic3d_CView& ACView)  = 0;
-   
--  //! call_togl_transparency
--  Standard_EXPORT virtual   void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)  = 0;
--  
-   //! call_togl_view
-   Standard_EXPORT virtual   Standard_Boolean View (Graphic3d_CView& ACView)  = 0;
-   
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntPatch_ImpImpIntersection_4.gxx OCCT-6.8.0_SRC-patch/inc/IntPatch_ImpImpIntersection_4.gxx
---- OCCT-6.8.0_SRC/inc/IntPatch_ImpImpIntersection_4.gxx       2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/IntPatch_ImpImpIntersection_4.gxx 2015-01-16 13:01:24.000000000 +0300
-@@ -1151,6 +1151,7 @@
-                                         const Standard_Real theUlSurf1,
-                                         const Standard_Real thePeriodOfSurf1,
-                                         const Handle(IntSurf_LineOn2S)& theLine,
-+                                        const Standard_Real theTol3D,
-                                         const Standard_Real theTol2D,
-                                         const Standard_Boolean theFlForce)
- {
-@@ -1177,6 +1178,32 @@
-                         thePntOnSurf2.X(), thePntOnSurf2.Y());
-   }
-+  const Standard_Integer aNbPnts = theLine->NbPoints();
-+  if(aNbPnts > 0)
-+  {
-+    Standard_Real aUl = 0.0, aVl = 0.0;
-+    const IntSurf_PntOn2S aPlast = theLine->Value(aNbPnts);
-+    if(isTheReverse)
-+      aPlast.ParametersOnS2(aUl, aVl);
-+    else
-+      aPlast.ParametersOnS1(aUl, aVl);
-+
-+    if(anUpar <= aUl)
-+    {//Parameter value will be always increased.
-+      return Standard_False;
-+    }
-+
-+    //theTol2D is minimal step along parameter changed. 
-+    //Therefore, if we apply this minimal step two 
-+    //neighbour points will be always "same". Consequently,
-+    //we should reduce tolerance for IsSame checking.
-+    const Standard_Real aDTol = 1.0-Epsilon(1.0);
-+    if(aPnt.IsSame(aPlast, theTol3D*aDTol, theTol2D*aDTol))
-+    {
-+      theLine->RemovePoint(aNbPnts);
-+    }
-+  }
-+
-   theLine->Add(aPnt);
-   return Standard_True;
- }
-@@ -1191,6 +1218,7 @@
-                                           const stCoeffsValue& theCoeffs,
-                                           const Bnd_Box2d& theUVSurf1,
-                                           const Bnd_Box2d& theUVSurf2,
-+                                          const Standard_Real theTol3D,
-                                           const Standard_Real theTol2D,
-                                           const Standard_Real thePeriod,
-                                           const Standard_Real theNulValue,
-@@ -1281,7 +1309,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-                           gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
-                           aUSurf1f, aUSurf1l, thePeriod,
--                          theWL->Curve(), theTol2D, theFlForce);
-+                          theWL->Curve(), theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1313,7 +1341,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
-                         aUSurf1f, aUSurf1l, thePeriod,
--                        theWL->Curve(), theTol2D, theFlForce);
-+                        theWL->Curve(),theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1346,7 +1374,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
-                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
-                         aUSurf1f, aUSurf1l, thePeriod,
--                        theWL->Curve(), theTol2D, theFlForce);
-+                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1376,7 +1404,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-                         gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
-                         aUSurf1f, aUSurf1l, thePeriod,
--                        theWL->Curve(), theTol2D, theFlForce);
-+                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1545,7 +1573,8 @@
-   {
-     Standard_Real &a = theU1crit[i],
-                   &b = theU1crit[i-1];
--    if(Abs(a - b) < theTol2D)
-+    const Standard_Real aRemain = fmod(Abs(a - b), thePeriod); // >= 0, because Abs(a - b) >= 0
-+    if((Abs(a - b) < theTol2D) || (aRemain < theTol2D) || (Abs(aRemain - thePeriod) < theTol2D))
-     {
-       a = (a + b)/2.0;
-       b = Precision::Infinite();
-@@ -1817,6 +1846,7 @@
-     Standard_Boolean isAddedIntoWL1 = Standard_False, isAddedIntoWL2 = Standard_False;
-     Standard_Real anUf = aU1f[aCurInterval], anUl = aU1l[aCurInterval];
-+    const Standard_Boolean isDeltaPeriod  = IsEqual(anUl-anUf, aPeriod);
-     //Inscribe and sort critical points
-     InscribeAndSortArray(anU1crit, aNbCritPointsMax, anUf, anUl, theTol2D, aPeriod);
-@@ -1830,6 +1860,8 @@
-       Handle(IntPatch_WLine) aWLine2 = new IntPatch_WLine(aL2S2, Standard_False);
-       Standard_Integer aWL1FindStatus = 0, aWL2FindStatus = 0;
-+      Standard_Boolean  isAddingWL1Enabled = Standard_True,
-+                        isAddingWL2Enabled = Standard_True;
-       Standard_Real anU1 = anUf;
-@@ -1845,6 +1877,23 @@
-       while(anU1 <= anUl)
-       {
-+        if(isDeltaPeriod)
-+        {
-+          if(IsEqual(anU1, anUl))
-+          {
-+            //if isAddedIntoWL* == TRUE WLine contains only one point
-+            //(which was end point of previous WLine). If we will
-+            //add point found on the current step WLine will contain only
-+            //two points. At that both these points will be equal to the
-+            //points found earlier. Therefore, new WLine will repeat 
-+            //already existing WLine. Consequently, it is necessary 
-+            //to forbid building new line in this case.
-+
-+            isAddingWL1Enabled = !isAddedIntoWL1;
-+            isAddingWL2Enabled = !isAddedIntoWL2;
-+          }
-+        }
-+
-         for(Standard_Integer i = 0; i < aNbCritPointsMax; i++)
-         {
-           if((anU1 - anU1crit[i])*aCriticalDelta[i] < 0.0)
-@@ -1995,123 +2044,129 @@
-           isFirst = Standard_False;
-         }
--        if( ((aUSurf2f-aU21) <= theTol2D) && 
--            ((aU21-aUSurf2l) <= theTol2D) &&
--            ((aVSurf1f - aV11) <= theTol2D) && 
--            ((aV11 - aVSurf1l) <= theTol2D) &&
--            ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
-+        if(isAddingWL1Enabled)
-         {
--          Standard_Boolean isForce = Standard_False;
--          if(!aWL1FindStatus)
-+          if( ((aUSurf2f-aU21) <= theTol2D) && 
-+              ((aU21-aUSurf2l) <= theTol2D) &&
-+              ((aVSurf1f - aV11) <= theTol2D) && 
-+              ((aV11 - aVSurf1l) <= theTol2D) &&
-+              ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--
--            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+            Standard_Boolean isForce = Standard_False;
-+            if(!aWL1FindStatus)
-             {
--              isForce = Standard_True;
--            }
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU21, aV11, aV11Prev,
--                              aV21, aV21Prev, isTheReverse,
--                              1.0, isForce, isFound1, isFound2);
-+              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+              {
-+                isForce = Standard_True;
-+              }
-+
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU21, aV11, aV11Prev,
-+                                aV21, aV21Prev, isTheReverse,
-+                                1.0, isForce, isFound1, isFound2);
-               
--            if(isFound1 || isFound2)
--            {
--              aWL1FindStatus = 1;
-+              if(isFound1 || isFound2)
-+              {
-+                aWL1FindStatus = 1;
-+              }
-             }
--          }
--          if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
--          {
--            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
--                  gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
--                  aUSurf1f, aUSurf1l, aPeriod,
--                  aWLine1->Curve(), theTol2D, isForce))
-+            if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
-             {
--              if(!aWL1FindStatus)
-+              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
-+                    gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
-+                    aUSurf1f, aUSurf1l, aPeriod,
-+                    aWLine1->Curve(), theTol3D, theTol2D, isForce))
-               {
--                aWL1FindStatus = 1;
-+                if(!aWL1FindStatus)
-+                {
-+                  aWL1FindStatus = 1;
-+                }
-               }
-             }
-           }
--        }
--        else
--        {
--          if(aWL1FindStatus == 1)
-+          else
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
-+            if(aWL1FindStatus == 1)
-+            {
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU21, aV11, aV11Prev,
--                              aV21, aV21Prev, isTheReverse,
--                              1.0, Standard_False, isFound1, isFound2);
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU21, aV11, aV11Prev,
-+                                aV21, aV21Prev, isTheReverse,
-+                                1.0, Standard_False, isFound1, isFound2);
--            if(isFound1 || isFound2)
--              aWL1FindStatus = 2; //start a new line
-+              if(isFound1 || isFound2)
-+                aWL1FindStatus = 2; //start a new line
-+            }
-           }
-         }
--      
--        if( ((aUSurf2f-aU22) <= theTol2D) &&
--            ((aU22-aUSurf2l) <= theTol2D) && 
--            ((aVSurf1f - aV12) <= theTol2D) &&
--            ((aV12 - aVSurf1l) <= theTol2D) &&
--            ((aVSurf2f - aV22) <= theTol2D) &&
--            ((aV22 - aVSurf2l) <= theTol2D))
-+        
-+        if(isAddingWL2Enabled)
-         {
--          Standard_Boolean isForce = Standard_False;
--
--          if(!aWL2FindStatus)
-+          if( ((aUSurf2f-aU22) <= theTol2D) &&
-+              ((aU22-aUSurf2l) <= theTol2D) && 
-+              ((aVSurf1f - aV12) <= theTol2D) &&
-+              ((aV12 - aVSurf1l) <= theTol2D) &&
-+              ((aVSurf2f - aV22) <= theTol2D) &&
-+              ((aV22 - aVSurf2l) <= theTol2D))
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
-+            Standard_Boolean isForce = Standard_False;
--            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+            if(!aWL2FindStatus)
-             {
--              isForce = Standard_True;
--            }
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU22, aV12, aV12Prev,
--                              aV22, aV22Prev, isTheReverse,
--                              -1.0, isForce, isFound1, isFound2);
-+              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+              {
-+                isForce = Standard_True;
-+              }
-+
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU22, aV12, aV12Prev,
-+                                aV22, aV22Prev, isTheReverse,
-+                                -1.0, isForce, isFound1, isFound2);
-               
--            if(isFound1 || isFound2)
--            {
--              aWL2FindStatus = 1;
-+              if(isFound1 || isFound2)
-+              {
-+                aWL2FindStatus = 1;
-+              }
-             }
--          }
--          if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
--          {
--            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
--                  gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
--                  aUSurf1f, aUSurf1l, aPeriod,
--                  aWLine2->Curve(), theTol2D, isForce))
-+            if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
-             {
--              if(!aWL2FindStatus)
-+              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-+                    gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
-+                    aUSurf1f, aUSurf1l, aPeriod,
-+                    aWLine2->Curve(), theTol3D, theTol2D, isForce))
-               {
--                aWL2FindStatus = 1;
-+                if(!aWL2FindStatus)
-+                {
-+                  aWL2FindStatus = 1;
-+                }
-               }
-             }
-           }
--        }
--        else
--        {
--          if(aWL2FindStatus == 1)
-+          else
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
-+            if(aWL2FindStatus == 1)
-+            {
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU22, aV12, aV12Prev,
--                              aV22, aV22Prev, isTheReverse,
--                              -1.0, Standard_False, isFound1, isFound2);
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU22, aV12, aV12Prev,
-+                                aV22, aV22Prev, isTheReverse,
-+                                -1.0, Standard_False, isFound1, isFound2);
--            if(isFound1 || isFound2)
--              aWL2FindStatus = 2; //start a new line
-+              if(isFound1 || isFound2)
-+                aWL2FindStatus = 2; //start a new line
-+            }
-           }
-         }
-@@ -2237,15 +2292,29 @@
-       }
-       else if(aWLine1->NbPnts() > 1)
-       {
--        isTheEmpty = Standard_False;
--        isAddedIntoWL1 = Standard_True;
-+        Standard_Boolean isGood = Standard_True;
-+
-+        if(aWLine1->NbPnts() == 2)
-+        {
-+          const IntSurf_PntOn2S& aPf = aWLine1->Point(1);
-+          const IntSurf_PntOn2S& aPl = aWLine1->Point(2);
--        SeekAdditionalPoints(theQuad1, theQuad2, aWLine1->Curve(), 
--                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
--                              theTol2D, aPeriod, 1.0, isTheReverse);
-+          if(aPf.IsSame(aPl, Precision::Confusion()))
-+            isGood = Standard_False;
-+        }
--        aWLine1->ComputeVertexParameters(theTol3D);
--        theSlin.Append(aWLine1);
-+        if(isGood)
-+        {
-+          isTheEmpty = Standard_False;
-+          isAddedIntoWL1 = Standard_True;
-+
-+          SeekAdditionalPoints( theQuad1, theQuad2, aWLine1->Curve(), 
-+                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
-+                                theTol2D, aPeriod, 1.0, isTheReverse);
-+
-+          aWLine1->ComputeVertexParameters(theTol3D);
-+          theSlin.Append(aWLine1);
-+        }
-       }
-       else
-       {
-@@ -2267,15 +2336,28 @@
-       }
-       else if(aWLine2->NbPnts() > 1)
-       {
--        isTheEmpty = Standard_False;
--        isAddedIntoWL2 = Standard_True;
-+        Standard_Boolean isGood = Standard_True;
-+        if(aWLine2->NbPnts() == 2)
-+        {
-+          const IntSurf_PntOn2S& aPf = aWLine2->Point(1);
-+          const IntSurf_PntOn2S& aPl = aWLine2->Point(2);
-+
-+          if(aPf.IsSame(aPl, Precision::Confusion()))
-+            isGood = Standard_False;
-+        }
--        SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
--                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
--                              theTol2D, aPeriod, -1.0, isTheReverse);
-+        if(isGood)
-+        {
-+          isTheEmpty = Standard_False;
-+          isAddedIntoWL2 = Standard_True;
--        aWLine2->ComputeVertexParameters(theTol3D);
--        theSlin.Append(aWLine2);
-+          SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
-+                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
-+                                theTol2D, aPeriod, -1.0, isTheReverse);
-+
-+          aWLine2->ComputeVertexParameters(theTol3D);
-+          theSlin.Append(aWLine2);
-+        }
-       }
-       else
-       {
-@@ -2284,6 +2366,203 @@
-     }
-   }
-+  if(theSlin.Length() > 0)
-+  {
-+    for(Standard_Integer aNumOfLine = 2; aNumOfLine <= theSlin.Length(); aNumOfLine++)
-+    {
-+      const Handle(IntPatch_WLine)& aWLine = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine));
-+
-+      const IntSurf_PntOn2S& aPntFWL = aWLine->Point(1);
-+
-+      Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
-+      aPntFWL.Parameters(aU1, aV1, aU2, aV2);
-+
-+      if( IsEqual(aU1, 0.0) || IsEqual(aU1, aPeriod))
-+      {
-+        theSlin.Exchange(1, aNumOfLine);
-+        break;
-+      }
-+    }
-+
-+    for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
-+    {
-+      const Handle(IntPatch_WLine)& aWLine1 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine1));
-+
-+      const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
-+      const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
-+      const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
-+
-+      for(Standard_Integer aNPt = 1; aNPt <= theSPnt.Length(); aNPt++)
-+      {
-+        const IntSurf_PntOn2S aPntCur = theSPnt.Value(aNPt).PntOn2S();
-+
-+        if( aPntCur.IsSame(aPntFWL1, Precision::Confusion()) ||
-+            aPntCur.IsSame(aPntLWL1, Precision::Confusion()))
-+        {
-+          theSPnt.Remove(aNPt);
-+          aNPt--;
-+        }
-+      }
-+
-+      Standard_Boolean hasBeenRemoved = Standard_False;
-+      for(Standard_Integer aNumOfLine2 = aNumOfLine1 + 1; aNumOfLine2 <= theSlin.Length(); aNumOfLine2++)
-+      {
-+        const Handle(IntPatch_WLine)& aWLine2 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine2));
-+
-+        const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
-+        const Standard_Integer aNbPntsWL2 = aWLine2->NbPnts();
-+
-+        const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
-+        const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
-+
-+        const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
-+        const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
-+
-+        if(aPntFWL1.IsSame(aPntFWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->InsertBefore(1, aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+
-+        if(aPntFWL1.IsSame(aPntLWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->InsertBefore(1, aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+
-+        if(aPntLWL1.IsSame(aPntFWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->Add(aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+
-+        if(aPntLWL1.IsSame(aPntLWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->Add(aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+      }
-+
-+      if(hasBeenRemoved)
-+        aNumOfLine1--;
-+
-+      //aWLine1->ComputeVertexParameters(theTol3D);
-+    }
-+  }//if(theSlin.Length() > 0)
-+
-+
-   return Standard_True;
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntPatch_WLine.hxx OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.hxx
---- OCCT-6.8.0_SRC/inc/IntPatch_WLine.hxx      2014-11-11 17:54:07.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.hxx        2015-01-16 14:34:19.000000000 +0300
-@@ -138,6 +138,12 @@
-   
-   Standard_EXPORT  const  Handle(Adaptor2d_HCurve2d)& GetArcOnS2()  const;
-   
-+  Standard_EXPORT   void ClearVertexes() ;
-+  
-+  Standard_EXPORT   void RemoveVertex (const Standard_Integer theIndex) ;
-+  
-+  Standard_EXPORT   void InsertVertexBefore (const Standard_Integer theIndex, const IntPatch_Point& thePnt) ;
-+  
-   Standard_EXPORT   void Dump()  const;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntPatch_WLine.lxx OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.lxx
---- OCCT-6.8.0_SRC/inc/IntPatch_WLine.lxx      2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/IntPatch_WLine.lxx        2015-01-16 12:59:50.000000000 +0300
-@@ -97,3 +97,27 @@
- {
-   return svtx(Index);
- }
-+
-+inline void IntPatch_WLine::ClearVertexes()
-+{
-+  svtx.Clear();
-+}
-+
-+inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
-+{
-+  if((theIndex < 1) || (theIndex > NbVertex()))
-+    Standard_OutOfRange::Raise("Cannot delete not existing vertex");
-+  svtx.Remove(theIndex);
-+}
-+
-+inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
-+                                                const IntPatch_Point& thePnt)
-+{
-+  const Standard_Integer aNbVertexes = NbVertex();
-+  Standard_Integer anIndex = Max(theIndex, 1);
-+
-+  if(anIndex > aNbVertexes)
-+    svtx.Append(thePnt);
-+  else
-+    svtx.InsertBefore(theIndex, thePnt);
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/IntSurf_PntOn2S.hxx OCCT-6.8.0_SRC-patch/inc/IntSurf_PntOn2S.hxx
---- OCCT-6.8.0_SRC/inc/IntSurf_PntOn2S.hxx     2014-11-11 17:54:10.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/IntSurf_PntOn2S.hxx       2015-01-16 14:34:22.000000000 +0300
-@@ -60,6 +60,11 @@
-   
-   //! Returns the parameters of the point on both surfaces.
-       void Parameters (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2)  const;
-+  
-+  //! Returns TRUE if 2D- and 3D-coordinates of theOterPoint are equal to
-+  //! corresponding coordinates of me (with given tolerance).
-+  //! If theTol2D == 0.0 we will compare 3D-points only.
-+  Standard_EXPORT   Standard_Boolean IsSame (const IntSurf_PntOn2S& theOterPoint, const Standard_Real theTol3D = 0.0, const Standard_Real theTol2D = 0.0)  const;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/OpenGl_GraphicDriver.hxx OCCT-6.8.0_SRC-patch/inc/OpenGl_GraphicDriver.hxx
---- OCCT-6.8.0_SRC/inc/OpenGl_GraphicDriver.hxx        2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/OpenGl_GraphicDriver.hxx  2015-01-16 13:01:24.000000000 +0300
-@@ -167,7 +167,6 @@
-   Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
-   Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView);
-   Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
--  Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
-   Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
-   Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
-   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/OpenGl_Workspace.hxx OCCT-6.8.0_SRC-patch/inc/OpenGl_Workspace.hxx
---- OCCT-6.8.0_SRC/inc/OpenGl_Workspace.hxx    2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/OpenGl_Workspace.hxx      2015-01-16 13:01:24.000000000 +0300
-@@ -184,7 +184,6 @@
-                                Image_PixMap&               theImage,
-                                const Graphic3d_BufferType& theBufferType);
--  void UseTransparency (const Standard_Boolean theFlag);
-   Standard_Boolean& UseZBuffer()   { return myUseZBuffer; }
-   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
-   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
-@@ -671,7 +670,6 @@
-   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
-   Standard_Boolean       myBackBufferRestored;
-   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
--  Standard_Boolean       myUseTransparency;
-   Standard_Boolean       myUseZBuffer;
-   Standard_Boolean       myUseDepthTest;
-   Standard_Boolean       myUseGLLight;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/ShapeFix_Shape.hxx OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.hxx
---- OCCT-6.8.0_SRC/inc/ShapeFix_Shape.hxx      2014-11-11 17:54:25.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.hxx        2015-01-16 14:34:37.000000000 +0300
-@@ -116,6 +116,10 @@
-   //! Returns (modifiable) the mode for applying
-   //! ShapeFix::FixVertexPosition before all fixes, by default False.
-       Standard_Integer& FixVertexPositionMode() ;
-+  
-+  //! Returns (modifiable) the mode for fixing tolerances of vertices on whole shape
-+  //! after performing all fixes
-+      Standard_Integer& FixVertexTolMode() ;
-@@ -139,6 +143,7 @@
-   Standard_Integer myFixWireMode;
-   Standard_Integer myFixSameParameterMode;
-   Standard_Integer myFixVertexPositionMode;
-+  Standard_Integer myFixVertexTolMode;
-   Standard_Integer myStatus;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/ShapeFix_Shape.lxx OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.lxx
---- OCCT-6.8.0_SRC/inc/ShapeFix_Shape.lxx      2014-11-11 17:47:05.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/ShapeFix_Shape.lxx        2015-01-16 13:00:03.000000000 +0300
-@@ -122,3 +122,13 @@
- {
-   return myFixVertexPositionMode;
- }
-+
-+//=======================================================================
-+//function : FixVertexTolMode
-+//purpose  : 
-+//=======================================================================
-+
-+inline Standard_Integer& ShapeFix_Shape::FixVertexTolMode() 
-+{
-+  return myFixVertexTolMode;
-+}
-\ No newline at end of file
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/V3d_View.hxx OCCT-6.8.0_SRC-patch/inc/V3d_View.hxx
---- OCCT-6.8.0_SRC/inc/V3d_View.hxx    2014-11-11 17:54:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/V3d_View.hxx      2015-01-16 14:35:09.000000000 +0300
-@@ -308,9 +308,6 @@
-   //! Returns TRUE when the light is active in this view.
-   Standard_EXPORT   Standard_Boolean IsActiveLight (const Handle(V3d_Light)& aLight)  const;
-   
--  //! Activate/Deactivate the transparency in this view.
--  Standard_EXPORT   void SetTransparency (const Standard_Boolean AnActivity = Standard_False) ;
--  
-   //! sets the immediate update mode and returns the previous one.
-   Standard_EXPORT   Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate) ;
-   
-@@ -704,9 +701,6 @@
-   
-   Standard_EXPORT   Handle(Graphic3d_TextureEnv) TextureEnv()  const;
-   
--  //! Returns the transparency activity.
--  Standard_EXPORT   Standard_Boolean Transparency()  const;
--  
-   //! Returns the current visualisation mode.
-   Standard_EXPORT   V3d_TypeOfVisualization Visualization()  const;
-   
-@@ -1075,7 +1069,6 @@
-   TColStd_Array2OfReal MyTrsf;
-   Handle(Graphic3d_Structure) MyGridEchoStructure;
-   Handle(Graphic3d_Group) MyGridEchoGroup;
--  Standard_Boolean MyTransparencyFlag;
-   Graphic3d_Vector myXscreenAxis;
-   Graphic3d_Vector myYscreenAxis;
-   Graphic3d_Vector myZscreenAxis;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Visual3d_View.hxx OCCT-6.8.0_SRC-patch/inc/Visual3d_View.hxx
---- OCCT-6.8.0_SRC/inc/Visual3d_View.hxx       2014-11-11 17:54:59.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/Visual3d_View.hxx 2015-01-16 14:35:10.000000000 +0300
-@@ -478,11 +478,6 @@
-   //! Warning: Works only under Windows.
-   Standard_EXPORT   Standard_Boolean Print (const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0)  const;
-   
--  //! if <AFlag> is Standard_True then the transparency
--  //! is managed in the view <me>.
--  //! Default Standard_False
--  Standard_EXPORT   void SetTransparency (const Standard_Boolean AFlag) ;
--  
-   //! Returns Standard_True if the ZBuffer is activated
-   //! in the view <me> and Standard_False if not.
-   Standard_EXPORT   Standard_Boolean ZBufferIsActivated()  const;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/inc/Visual3d_ViewManager.hxx OCCT-6.8.0_SRC-patch/inc/Visual3d_ViewManager.hxx
---- OCCT-6.8.0_SRC/inc/Visual3d_ViewManager.hxx        2014-11-11 17:54:59.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/inc/Visual3d_ViewManager.hxx  2015-01-16 14:35:10.000000000 +0300
-@@ -200,16 +200,6 @@
-   //! if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
-   Standard_EXPORT   void ReCompute (const Handle(Graphic3d_Structure)& AStructure, const Handle(Graphic3d_DataStructureManager)& AProjector) ;
-   
--  //! Returns Standard_True if the transparency
--  //! is activated in all activated views.
--  //! Default Standard_False
--  Standard_EXPORT   Standard_Boolean Transparency()  const;
--  
--  //! if <AFlag> is Standard_True then the transparency
--  //! is managed.
--  //! Default Standard_False
--  Standard_EXPORT   void SetTransparency (const Standard_Boolean AFlag) ;
--  
-   //! Returns Standard_True if the zbuffer activity
-   //! is managed automatically.
-   //! Default Standard_False
-@@ -251,7 +241,6 @@
-   Aspect_GenId MyViewGenId;
-   Handle(Graphic3d_GraphicDriver) MyGraphicDriver;
-   Standard_Boolean MyZBufferAuto;
--  Standard_Boolean MyTransparency;
-   TColStd_MapOfInteger myLayerIds;
-   TColStd_SequenceOfInteger myLayerSeq;
-   Visual3d_MapOfZLayerSettings myMapOfZLayerSettings;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/samples/qt/VoxelDemo/src/Viewer.cpp OCCT-6.8.0_SRC-patch/samples/qt/VoxelDemo/src/Viewer.cpp
---- OCCT-6.8.0_SRC/samples/qt/VoxelDemo/src/Viewer.cpp 2014-11-11 17:46:38.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/samples/qt/VoxelDemo/src/Viewer.cpp   2015-01-16 12:59:32.000000000 +0300
-@@ -51,7 +51,6 @@
-     myView->MustBeResized();
-     myView->SetSurfaceDetail(V3d_TEX_NONE);
--    myView->SetTransparency(Standard_True);
-     myView->SetSize(10000.0);
-     myView->SetZSize(10000.0);
-     myView->SetViewMappingDefault();
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cdl OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cdl
---- OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cdl  2014-11-11 17:46:38.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cdl    2015-01-16 13:01:23.000000000 +0300
-@@ -268,15 +268,6 @@
- -- inWhichLocal gives the local context in which anIObj
- -- is displayed. By default, the index -1 refers to the last
- -- Local Context opened.
-- 
--    Clear(me : mutable;
--        aniobj         : InteractiveObject from AIS;
--        updateviewer   : Boolean from Standard = Standard_True);
-----Purpose: Removes the interactive object aniobj from all viewers.
---- If a local context is open and if updateviewer equals
---- Standard_False, the presentation of the Interactive
---- Object activates the selection mode; the object is
---- displayed but no viewer will be updated.
-     ClearPrs( me           :mutable;
-             aniobj       : InteractiveObject from AIS;
-@@ -2046,6 +2037,16 @@
-     PurgeViewer(me:mutable;Vwr:Viewer from V3d) 
-     returns Integer from Standard is static private;
-+    redisplayPrsModes (me                : mutable;
-+                       theIObj           : InteractiveObject from AIS;
-+                       theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
-+   ---Purpose: UNKNOWN
-+
-+    redisplayPrsRecModes (me                : mutable;
-+                          theIObj           : InteractiveObject from AIS;
-+                          theToUpdateViewer : Boolean from Standard = Standard_True) is static private;
-+   ---Purpose: UNKNOWN
-+
- fields
-     myObjects    : DataMapOfIOStatus from AIS;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cxx OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cxx
---- OCCT-6.8.0_SRC/src/AIS/AIS_InteractiveContext.cxx  2014-11-11 17:46:38.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_InteractiveContext.cxx    2015-01-16 13:01:23.000000000 +0300
-@@ -16,27 +16,6 @@
- // Modified by  XAB & Serguei Dec 97 (angle &deviation coeffts)
--#define BUC60577        //GG_101099     Enable to compute correctly
--//                      transparency with more than one object in the view.
--
--#define BUC60632        //GG 15/03/00 Add protection on SetDisplayMode()
--//                      method, compute only authorized presentation.
--
--#define BUC60688        //GG 25/05/00 Add SetSensitivity() methods.
--
--#define BUC60722  //GG 04/09/00 Always enable viewer update when erasing something
--
--#define IMP051001       //GG Adds SetZDetected() and ZDetected() methods
--
--#define OCC172          //SAV clear static map before destroying context.
--
--#define OCC204          //SAV 26/02/02 : pass <updateviewer> flag to 
--// AddOrRemoveCurrentObject method from ClearGlobal.
--
--#define OCC4373         //SAN 10/11/03 : improve display mode management in
--// Display( IO, updateviewer ) and 
--// SetDisplayMode( IO, mode, updateviewer ) methods
--
- #include <AIS_InteractiveContext.ixx>
- //#include <AIS_DataMapIteratorOfDataMapOfInteractiveInteger.hxx>
-@@ -71,28 +50,6 @@
- #include <AIS_ListIteratorOfListOfInteractive.hxx>
--// In the method GetDefModes() the returned value of the selection mode 
--// is always equal to 0 if it is -1.
--#define BUC61051
--
--// The local context is closed the method ::ResetOriginalState() sets the selection mode equal to 0
--// in spite of the selection mode of the interactive object in Natural Point.
--#define OCC166
--
--static Standard_Boolean AISDebugModeOn()
--{
--//  static OSD_Environment aisdb("AISDEBUGMODE");
--//  return !aisdb.Value().IsEmpty();
--  static Standard_Integer isDebugMode(-1);
--  if (isDebugMode < 0) {
--    isDebugMode = 1;
--    OSD_Environment aisdb("AISDEBUGMODE");
--    if (aisdb.Value().IsEmpty())
--      isDebugMode = 0;
--  }
--  return (isDebugMode != 0);
--}
--
- namespace
- {
-   static volatile Standard_Integer THE_AIS_INDEX_SEL = 0;
-@@ -109,7 +66,7 @@
-     return TCollection_AsciiString ("AIS_CurContext_")
-          + TCollection_AsciiString (Standard_Atomic_Increment (&THE_AIS_INDEX_CUR));
-   }
--};
-+}
- //=======================================================================
- //function : AIS_InteractiveContext
-@@ -131,9 +88,7 @@
- mySubIntensity(Quantity_NOC_GRAY40),
- myDisplayMode(0),
- myCurLocalIndex(0),
--#ifdef IMP051001
- myZDetectionFlag(0),
--#endif
- myIsAutoActivateSelMode( Standard_True )
- { 
-   InitAttributes();
-@@ -141,31 +96,30 @@
- void AIS_InteractiveContext::Delete() const
- {
--  //Clear the static current selection. Else the memory
--  //is not release
-+  // clear the static current selection
-   AIS_Selection::ClearCurrentSelection();
--#ifdef OCC172
-+
-   // to avoid an exception
--  if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
--    AIS_Selection::Remove( mySelectionName.ToCString() );
-+  if (AIS_Selection::Find (mySelectionName.ToCString()))
-+  {
-+    AIS_Selection::Remove (mySelectionName.ToCString());
-+  }
-   // to avoid an exception
--  if ( AIS_Selection::Find( myCurrentName.ToCString() ) )
--    AIS_Selection::Remove( myCurrentName.ToCString() );
-+  if (AIS_Selection::Find (myCurrentName.ToCString()))
-+  {
-+    AIS_Selection::Remove (myCurrentName.ToCString());
-+  }
-   // let's remove one reference explicitly. this operation's supposed to
-   // be performed when mgrSelector will be destroyed but anyway...
--  mgrSelector->Remove( myMainSel );
--#endif
--  AIS_ListOfInteractive aList;
--  
--  AIS_DataMapIteratorOfDataMapOfIOStatus anIt(myObjects);
-+  mgrSelector->Remove (myMainSel);
-+
-   Handle(AIS_InteractiveContext) aNullContext;
--  for(; anIt.More() ; anIt.Next())
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-   {
--    Handle(AIS_InteractiveObject) anObj = anIt.Key();
--    anObj->SetContext(aNullContext);
--    
-+    Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
-+    anObj->SetContext (aNullContext);
-   }
-   MMgt_TShared::Delete();
- }
-@@ -209,494 +163,466 @@
- //=======================================================================
- //function : DisplayedObjects
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::DisplayedObjects(AIS_ListOfInteractive& aListOfIO,
--                                              const Standard_Boolean OnlyFromNeutral) const 
-+void AIS_InteractiveContext::DisplayedObjects (AIS_ListOfInteractive& theListOfIO,
-+                                               const Standard_Boolean theOnlyFromNeutral) const
- {
--#ifdef OCCT_DEBUG
--  cout<<"AIS_IC::DisplayedObjects"<<endl;
--#endif
--
--  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
--  if(!HasOpenedContext() || OnlyFromNeutral){
--    for(;It.More();It.Next()){
--      if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
--        aListOfIO.Append(It.Key());
--    }
--  }
--  else{
--    TColStd_MapOfTransient theMap;
--    // neutral point
--    for(;It.More();It.Next()){
--      if(It.Value()->GraphicStatus()==AIS_DS_Displayed)
--        theMap.Add(It.Key());
--    }
--
--    //parse all local contexts...
--#ifdef OCCT_DEBUG
--    cout<<"\tFrom Neutral Point : "<<theMap.Extent()<<endl;
--    Standard_Integer NbDisp;
--    for(AIS_DataMapIteratorOfDataMapOfILC it1(myLocalContexts);it1.More();it1.Next()){
--      const Handle(AIS_LocalContext)& LC = it1.Value();
--      NbDisp =  LC->DisplayedObjects(theMap);
--      cout<<"\tIn Local Context "<<it1.Key()<<" : "<<NbDisp<<endl;
--    }
--#endif
--    Handle(AIS_InteractiveObject) curIO;
--    Handle(Standard_Transient) Tr;
--      for(TColStd_MapIteratorOfMapOfTransient it2(theMap);it2.More();it2.Next()){
--        Tr = it2.Key();
--        curIO = *((Handle(AIS_InteractiveObject)*) &Tr);
--        aListOfIO.Append(curIO);
-+  if (!HasOpenedContext()
-+   || theOnlyFromNeutral)
-+  {
-+    for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+    {
-+      if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
-+      {
-+        theListOfIO.Append (anObjIter.Key());
-       }
-     }
-+    return;
-+  }
-+
-+  // neutral point
-+  TColStd_MapOfTransient aDispMap;
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
-+    {
-+      aDispMap.Add (anObjIter.Key());
-+    }
-+  }
-+
-+  // parse all local contexts...
-+  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
-+  {
-+    const Handle(AIS_LocalContext)& aLocCtx = aCtxIter.Value();
-+    aLocCtx->DisplayedObjects (aDispMap);
-+  }
-+
-+  Handle(AIS_InteractiveObject) anObj;
-+  for (TColStd_MapIteratorOfMapOfTransient aDispMapIter (aDispMap); aDispMapIter.More(); aDispMapIter.Next())
-+  {
-+    const Handle(Standard_Transient)& aTransient = aDispMapIter.Key();
-+    anObj = *((Handle(AIS_InteractiveObject)* )&aTransient);
-+    theListOfIO.Append (anObj);
-+  }
- }
-+
- //=======================================================================
- //function : DisplayedObjects
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::DisplayedObjects(const AIS_KindOfInteractive TheKind,
--                                              const Standard_Integer TheSign,
--                                              AIS_ListOfInteractive& aListOfIO,
--                                              const Standard_Boolean /*OnlyFromNeutral*/) const 
-+void AIS_InteractiveContext::DisplayedObjects (const AIS_KindOfInteractive theKind,
-+                                               const Standard_Integer      theSign,
-+                                               AIS_ListOfInteractive&      theListOfIO,
-+                                               const Standard_Boolean /*OnlyFromNeutral*/) const
- {
--  ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Displayed, aListOfIO );
-+  ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Displayed, theListOfIO);
- }
- //=======================================================================
- //function : ErasedObjects
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::ErasedObjects(AIS_ListOfInteractive& theListOfIO) const 
-+void AIS_InteractiveContext::ErasedObjects (AIS_ListOfInteractive& theListOfIO) const
- {
--  ObjectsByDisplayStatus( AIS_DS_Erased, theListOfIO );
-+  ObjectsByDisplayStatus (AIS_DS_Erased, theListOfIO);
- }
- //=======================================================================
- //function : ErasedObjects
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::ErasedObjects(const AIS_KindOfInteractive TheKind,
--                                           const Standard_Integer TheSign,
--                                           AIS_ListOfInteractive& theListOfIO) const 
-+void AIS_InteractiveContext::ErasedObjects (const AIS_KindOfInteractive theKind,
-+                                            const Standard_Integer      theSign,
-+                                            AIS_ListOfInteractive&      theListOfIO) const
- {
--  ObjectsByDisplayStatus( TheKind, TheSign, AIS_DS_Erased, theListOfIO );
-+  ObjectsByDisplayStatus (theKind, theSign, AIS_DS_Erased, theListOfIO);
- }
- //=======================================================================
- //function : ObjectsByDisplayStatus
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_DisplayStatus theStatus,
--                                                    AIS_ListOfInteractive&  theListOfIO) const 
-+void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus,
-+                                                     AIS_ListOfInteractive&  theListOfIO) const
- {
--  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
--  for(;It.More();It.Next()){
--    if(It.Value()->GraphicStatus() == theStatus)
--      theListOfIO.Append(It.Key());
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    if (anObjIter.Value()->GraphicStatus() == theStatus)
-+    {
-+      theListOfIO.Append (anObjIter.Key());
-+    }
-   }
- }
- //=======================================================================
- //function : ObjectsByDisplayStatus
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::ObjectsByDisplayStatus (const AIS_KindOfInteractive theKind,
-+                                                     const Standard_Integer      theSign,
-+                                                     const AIS_DisplayStatus     theStatus,
-+                                                     AIS_ListOfInteractive&      theListOfIO) const
-+{
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    if (anObjIter.Value()->GraphicStatus() != theStatus
-+     || anObjIter.Key()->Type() != theKind)
-+    {
-+      continue;
-+    }
--void AIS_InteractiveContext::ObjectsByDisplayStatus(const AIS_KindOfInteractive TheKind,
--                                                    const Standard_Integer TheSign,
--                                                    const AIS_DisplayStatus theStatus,
--                                                    AIS_ListOfInteractive& theListOfIO) const 
--{
--  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
--  for(;It.More();It.Next()){
--    if(It.Value()->GraphicStatus()==theStatus){
--      if(It.Key()->Type()==TheKind){
--        if(TheSign ==-1)
--          theListOfIO.Append(It.Key());
--        else{
--          if(It.Key()->Signature()==TheSign)
--            theListOfIO.Append(It.Key());
--        }
--      }
-+    if (theSign == -1
-+     || anObjIter.Key()->Signature() == theSign)
-+    {
-+      theListOfIO.Append (anObjIter.Key());
-     }
-   }
- }
- //=======================================================================
- //function : ObjectsInside
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::ObjectsInside (AIS_ListOfInteractive&      theListOfIO,
-+                                            const AIS_KindOfInteractive theKind,
-+                                            const Standard_Integer      theSign) const
-+{
-+  if (theKind == AIS_KOI_None
-+   && theSign == -1)
-+  {
-+    for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+    {
-+      theListOfIO.Append (anObjIter.Key());
-+    }
-+    return;
-+  }
--void AIS_InteractiveContext::ObjectsInside(AIS_ListOfInteractive& aListOfIO,
--                                           const AIS_KindOfInteractive TheKind,
--                                           const Standard_Integer TheSign) const 
--{
--  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
--  if(TheKind==AIS_KOI_None && TheSign ==-1){
--    for(;It.More();It.Next()){
--        aListOfIO.Append(It.Key());
--    }
--  }
--  else{
--    for(;It.More();It.Next()){
--      if(It.Key()->Type()==TheKind){
--        if(TheSign ==-1)
--          aListOfIO.Append(It.Key());
--        else{
--          if(It.Key()->Signature()==TheSign)
--            aListOfIO.Append(It.Key());
--        }
--      }
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    if (anObjIter.Key()->Type() != theKind)
-+    {
-+      continue;
-+    }
-+
-+    if (theSign == -1
-+     || anObjIter.Key()->Signature() == theSign)
-+    {
-+      theListOfIO.Append (anObjIter.Key());
-     }
-   }
- }
- //=======================================================================
- //function : Display
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIObj,
-+                                      const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+
-+  Standard_Integer aDispMode = 0, aHiMod = -1, aSelMode = -1;
-+  GetDefModes (theIObj, aDispMode, aHiMod, aSelMode);
--void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
--                                     const Standard_Boolean updateviewer )
-+  Display (theIObj, aDispMode, myIsAutoActivateSelMode ? aSelMode : -1,
-+           theToUpdateViewer, theIObj->AcceptShapeDecomposition());
-+}
-+
-+//=======================================================================
-+//function : Display
-+//purpose  :
-+//=======================================================================
-+void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIObj,
-+                                      const Standard_Integer               theDispMode,
-+                                      const Standard_Integer               theSelectionMode,
-+                                      const Standard_Boolean               theToUpdateViewer,
-+                                      const Standard_Boolean               theToAllowDecomposition)
- {
--  if(anIObj.IsNull()) return;
--  
--  Standard_Integer DispMode,HiMod,SelMode;
--  
--  GetDefModes(anIObj,DispMode,HiMod,SelMode);
--  
--  Handle (AIS_InteractiveContext) aThis = this;
--  if(!anIObj->HasInteractiveContext()) 
--    anIObj->SetContext(aThis);
--  
--  //NO LOCAL CONTEXT OPEN
--  if(!HasOpenedContext()) {
--#ifndef OCC4373
--    // SAN : Do not return here. Perform advanced display mode analysis a bit later...
--    if(IsDisplayed(anIObj)) return;
--#endif
--
--    // it did not yet exist
--    if(!myObjects.IsBound(anIObj)){
--      
--      Handle(AIS_GlobalStatus) STATUS= 
--#ifdef OCC166
--        new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,SelMode);
--#else
--      new AIS_GlobalStatus(AIS_DS_Displayed,DispMode,0);
--#endif
--      myObjects.Bind (anIObj,STATUS);
--      myMainPM->Display(anIObj,DispMode);
--      if( myIsAutoActivateSelMode )
--      {
--        if(!mgrSelector->Contains(anIObj))
--           mgrSelector->Load(anIObj);
--        mgrSelector->Activate(anIObj,SelMode,myMainSel);
--      }
--        
--     if(updateviewer) myMainVwr->Update();
--    }
--    // it is somewhere else...
--    else {
--      // CLE
--      // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--      Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--      // ENDCLE
--      if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
--      {
--        // SAN : erase presentations for all display modes different from <DispMode>;
--        //       then make sure <DispMode> is displayed and maybe highlighted;
--        //       Finally, activate selection mode <SelMode> if not yet activated.
--        TColStd_ListOfInteger aModesToRemove;
--        TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
--        for(;ItL.More();ItL.Next()){
--
--          Standard_Integer OldMode = ItL.Value();
--
--          if(OldMode!=DispMode){
--            aModesToRemove.Append(OldMode);
--            if(myMainPM->IsHighlighted(anIObj,OldMode))
--              myMainPM->Unhighlight(anIObj,OldMode);
--            myMainPM->Erase(anIObj,OldMode);
--          }
--        }
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--        for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
--          STATUS->RemoveDisplayMode(ItL.Value());
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
--        if(!STATUS->IsDModeIn(DispMode))
--          STATUS->AddDisplayMode(DispMode);
-+  if (HasOpenedContext())
-+  {
-+    myLocalContexts (myCurLocalIndex)->Display (theIObj, theDispMode, theToAllowDecomposition, theSelectionMode);
-+    if (theToUpdateViewer)
-+    {
-+      myMainVwr->Update();
-+    }
-+    return;
-+  }
--        myMainPM->Display(anIObj,DispMode);
--        if (STATUS->GraphicStatus() == AIS_DS_Erased)
--        {
--          STATUS->SetGraphicStatus(AIS_DS_Displayed);
--        }
--        if(STATUS->IsHilighted()){
--          myMainPM->Highlight(anIObj,HiMod);
--        }
--        if( myIsAutoActivateSelMode )
--        {
--           if(!mgrSelector->Contains(anIObj))
--              mgrSelector->Load(anIObj);
--           if(!mgrSelector->IsActivated(anIObj,SelMode))
--              mgrSelector->Activate(anIObj,SelMode,myMainSel);
--        }
-+  if (!myObjects.IsBound (theIObj))
-+  {
-+    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Displayed, theDispMode, theSelectionMode);
-+    myObjects.Bind   (theIObj, aStatus);
-+    myMainPM->Display(theIObj, theDispMode);
-+    if (theSelectionMode != -1)
-+    {
-+      if (!mgrSelector->Contains (theIObj))
-+      {
-+        mgrSelector->Load (theIObj);
-       }
--    } 
--    
--    if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
--      myMainVwr->Viewer()->SetTransparency(Standard_True);
--    if(updateviewer) myMainVwr->Update();
-+      mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
-+    }
-   }
--  
--  //  LOCAL CONTEXT OPEN
-   else
-   {
--    myLocalContexts(myCurLocalIndex)->Display(anIObj,DispMode,anIObj->AcceptShapeDecomposition(),SelMode);
--    
--    if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
--      myMainVwr->Viewer()->SetTransparency(Standard_True);
--    
--    
--    if(updateviewer) myMainVwr->Update();
--  }
--}
-+    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+    if (aStatus->GraphicStatus() != AIS_DS_Displayed
-+     && aStatus->GraphicStatus() != AIS_DS_Erased)
-+    {
-+      return;
-+    }
--//=======================================================================
--//function : Display
--//purpose  : 
--//=======================================================================
-+    // Erase presentations for all display modes different from aDispMode.
-+    // Then make sure aDispMode is displayed and maybe highlighted.
-+    // Finally, activate selection mode <SelMode> if not yet activated.
-+    TColStd_ListOfInteger aModesToRemove;
-+    for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
-+    {
-+      const Standard_Integer anOldMode = aDispModeIter.Value();
-+      if (anOldMode != theDispMode)
-+      {
-+        aModesToRemove.Append (anOldMode);
-+        if(myMainPM->IsHighlighted (theIObj, anOldMode))
-+        {
-+          myMainPM->Unhighlight (theIObj, anOldMode);
-+        }
-+        myMainPM->Erase (theIObj, anOldMode);
-+      }
-+    }
--void AIS_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anIObj,
--                                    const Standard_Integer aDisplayMode, 
--                                    const Standard_Integer aSelectionMode, 
--                                    const Standard_Boolean updateviewer, 
--                                    const Standard_Boolean allowdecomposition)
--{
--  if(anIObj.IsNull()) return;
-+    for (TColStd_ListIteratorOfListOfInteger aRemModeIter (aModesToRemove); aRemModeIter.More(); aRemModeIter.Next())
-+    {
-+      aStatus->RemoveDisplayMode (aRemModeIter.Value());
-+    }
--  if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
--  
--  // if no local context...
--  if(!HasOpenedContext()) {
--    //    if(!anIObj->HasDisplayMode())
--    //      anIObj->SetDisplayMode(aDisplayMode);
--  
--    if(!myObjects.IsBound(anIObj)){
--      Handle(AIS_GlobalStatus) STATUS= 
--        new AIS_GlobalStatus(AIS_DS_Displayed,aDisplayMode,aSelectionMode);
--      myObjects.Bind (anIObj,STATUS);
--      myMainPM->Display(anIObj,aDisplayMode);
--      if(aSelectionMode!=-1){
--        if(!mgrSelector->Contains(anIObj))
--          mgrSelector->Load(anIObj,aSelectionMode);
--        mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
--      }
--      if(updateviewer) myMainVwr->Update();
-+    if (!aStatus->IsDModeIn (theDispMode))
-+    {
-+      aStatus->AddDisplayMode (theDispMode);
-+    }
-+
-+    myMainPM->Display (theIObj, theDispMode);
-+    if (aStatus->GraphicStatus() == AIS_DS_Erased)
-+    {
-+      aStatus->SetGraphicStatus (AIS_DS_Displayed);
-+    }
-+    if (aStatus->IsHilighted())
-+    {
-+      const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
-+      myMainPM->Highlight (theIObj, aHiMod);
-     }
--    //    anIObj->SelectionMode(aSelectionMode);
--    else{
--      // CLE
--      // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--      Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--      // ENDCLE
--      if(!STATUS->IsDModeIn(aDisplayMode)){
--        myMainPM->Display(anIObj,aDisplayMode);
--        STATUS->AddDisplayMode(aDisplayMode);
--        if(STATUS->IsSubIntensityOn())
--          myMainPM->Color(anIObj,mySubIntensity,aDisplayMode);
-+    if (theSelectionMode != -1)
-+    {
-+      if (!mgrSelector->Contains (theIObj))
-+      {
-+        mgrSelector->Load (theIObj);
-       }
--      if(aSelectionMode!=-1){
--        STATUS->AddSelectionMode(aSelectionMode);
--        mgrSelector->Activate(anIObj,aSelectionMode,myMainSel);
-+      if (!mgrSelector->IsActivated (theIObj, theSelectionMode))
-+      {
-+        mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
-       }
--      if(updateviewer) myMainVwr->Update();
--      
-     }
-   }
--  else
--    {
--      myLocalContexts(myCurLocalIndex)->Display(anIObj,aDisplayMode,allowdecomposition,aSelectionMode);
--      if(updateviewer) myMainVwr->Update();
--    }  
--}
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
-+}
- //=======================================================================
- //function : Load
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::Load(const Handle(AIS_InteractiveObject)& anIObj,
--                                  const Standard_Integer SelMode,
--                                  const Standard_Boolean AllowDecomposition)
-+void AIS_InteractiveContext::Load (const Handle(AIS_InteractiveObject)& theIObj,
-+                                   const Standard_Integer               theSelMode,
-+                                   const Standard_Boolean               theToAllowDecomposition)
- {
--  if(anIObj.IsNull()) return;
--  if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
--  
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  if(!HasOpenedContext()) {
--    if(SelMode==-1 && !AllowDecomposition){
--      Standard_Integer DispMode,HiMod,SelModeDef;
--      
--      GetDefModes(anIObj,DispMode,HiMod,SelModeDef);
--      Handle(AIS_GlobalStatus) STATUS= 
--        new AIS_GlobalStatus(AIS_DS_Erased,DispMode,SelModeDef);
--      myObjects.Bind (anIObj,STATUS);      
--      return;
--    }
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+
-+  if (HasOpenedContext())
-+  {
-+    myLocalContexts (myCurLocalIndex)->Load (theIObj, theToAllowDecomposition, theSelMode);
-+    return;
-   }
--  myLocalContexts(myCurLocalIndex)->Load(anIObj,AllowDecomposition,SelMode);
--}
-+  if (theSelMode == -1
-+  && !theToAllowDecomposition
-+  && !myObjects.IsBound (theIObj))
-+  {
-+    Standard_Integer aDispMode, aHiMod, aSelModeDef;
-+    GetDefModes (theIObj, aDispMode, aHiMod, aSelModeDef);
-+    Handle(AIS_GlobalStatus) aStatus = new AIS_GlobalStatus (AIS_DS_Erased, aDispMode, aSelModeDef);
-+    myObjects.Bind (theIObj, aStatus);
-+  }
-+}
- //=======================================================================
- //function : Erase
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anIObj, 
--                                   const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::Erase (const Handle(AIS_InteractiveObject)& theIObj,
-+                                    const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return;
--  
--  if ( !anIObj->IsAutoHilight() )
--    anIObj->ClearSelected();
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-   
--  if(!HasOpenedContext()){
--    EraseGlobal(anIObj,updateviewer);
-+  if (!theIObj->IsAutoHilight())
-+  {
-+    theIObj->ClearSelected();
-   }
--  else
-+
-+  Standard_Boolean wasInCtx = Standard_False;
-+  if (HasOpenedContext())
-+  {
-+    // First it is checked if it is possible to remove in the current local context
-+    // then one tries to remove in other local contexts, if they allow it...
-+    wasInCtx = myLocalContexts (myCurLocalIndex)->Erase (theIObj);
-+    for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
-     {
--      // First it is checked if it is possible to remove in the current local context
--      // then one tries to remove in other local contexts, if they allow it...
--      
--      Standard_Boolean WasInCtx = myLocalContexts(myCurLocalIndex)->Erase(anIObj);
--//      if(!WasInCtx) {
--      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
--      for (;It.More();It.Next()){
--        if(It.Value()->AcceptErase())
--#ifdef BUC60722
--          WasInCtx |= It.Value()->Erase(anIObj);
--#else
--          WasInCtx = It.Value()->Erase(anIObj);
--#endif
-+      if (aCtxIter.Value()->AcceptErase())
-+      {
-+        wasInCtx = aCtxIter.Value()->Erase (theIObj) || wasInCtx;
-       }
--      
--      if(!WasInCtx)
--        EraseGlobal(anIObj,updateviewer);
--      else
--        if(updateviewer) myMainVwr->Update();
-     }
-+  }
-+
-+  if (!wasInCtx)
-+  {
-+    EraseGlobal (theIObj, Standard_False);
-+  }
-+
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
- }
- //=======================================================================
- //function : EraseAll
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::EraseAll(const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::EraseAll (const Standard_Boolean theToUpdateViewer)
- {
--  if(!HasOpenedContext())
-+  if (HasOpenedContext())
-   {
--    for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM(myObjects); ItM.More(); ItM.Next())
--    {
--      if(ItM.Value()->GraphicStatus() == AIS_DS_Displayed)
--        Erase(ItM.Key(),Standard_False);
--    }
--    if(updateviewer)
-+    return;
-+  }
-+
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    if (anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed)
-     {
--      myMainVwr->Update();
-+      Erase (anObjIter.Key(), Standard_False);
-     }
-   }
-+
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
- }
- //=======================================================================
- //function : DisplayAll
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::DisplayAll(const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::DisplayAll (const Standard_Boolean theToUpdateViewer)
- {
--  if(!HasOpenedContext()){
--
--    AIS_DisplayStatus aStatus;
-+  if (HasOpenedContext())
-+  {
-+    return;
-+  }
--    if (!HasOpenedContext())
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    const AIS_DisplayStatus aStatus = anObjIter.Value()->GraphicStatus();
-+    if (aStatus == AIS_DS_Erased)
-     {
--      for (AIS_DataMapIteratorOfDataMapOfIOStatus ItM (myObjects); ItM.More(); ItM.Next())
--      {
--        aStatus = ItM.Value()->GraphicStatus();
--        if (aStatus == AIS_DS_Erased)
--          Display(ItM.Key(),Standard_False);
--      }
--      if(updateviewer)
--      {
--        myMainVwr->Update();
--      }
-+      Display (anObjIter.Key(), Standard_False);
-     }
-   }
--  
-+
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
- }
- //=======================================================================
- //function : DisplaySelected
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::DisplaySelected(const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::DisplaySelected (const Standard_Boolean theToUpdateViewer)
- {
--  
--  if (!HasOpenedContext())
-+  if (HasOpenedContext())
-   {
--    Standard_Boolean found = Standard_False;
--    Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
--    Handle(AIS_InteractiveObject) iObj;
--    for (sel->Init(); sel->More(); sel->Next())
--    {
--      iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
--      Display(iObj,Standard_False);
--      found = Standard_True;
--    }
--    if (found && updateviewer)
--    {
--      myMainVwr->Update();
--    }
-+    return;
-+  }
-+
-+  Standard_Boolean      isFound  = Standard_False;
-+  Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
-+  for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
-+  {
-+    Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
-+    Display (anObj, Standard_False);
-+    isFound = Standard_True;
-   }
--}
-+  if (isFound && theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
-+}
- //=======================================================================
- //function : EraseSelected
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::EraseSelected(const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::EraseSelected (const Standard_Boolean theToUpdateViewer)
- {
--  if (!HasOpenedContext())
-+  if (HasOpenedContext())
-   {
--    Standard_Boolean found = Standard_False;
--    Handle(AIS_Selection) sel = AIS_Selection::Selection(myCurrentName.ToCString());
--    Handle(AIS_InteractiveObject) iObj;
--    for (sel->Init();sel->More();sel->Next())
--    {
--      iObj = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
--      Erase(iObj,Standard_False);
--      found = Standard_True;
--    }
--    if(found && updateviewer)
--    {
--      myMainVwr->Update();
--    }
-+    return;
-+  }
-+
-+  Standard_Boolean      isFound  = Standard_False;
-+  Handle(AIS_Selection) aSelIter = AIS_Selection::Selection(myCurrentName.ToCString());
-+  for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
-+  {
-+    Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
-+    Erase (anObj, Standard_False);
-+    isFound = Standard_True;
-+  }
-+
-+  if (isFound && theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-   }
- }
-+
- //=======================================================================
- //function : 
- //purpose  : 
-@@ -761,187 +687,163 @@
-   return Standard_True;
- }
--
- //=======================================================================
--//purpose  : 
-+//function : DisplayStatus
-+//purpose  :
- //=======================================================================
--
--AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus(const Handle(AIS_InteractiveObject)& anIObj) const 
-+AIS_DisplayStatus AIS_InteractiveContext::DisplayStatus (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  if(anIObj.IsNull()) return AIS_DS_None;
--
--  if(myObjects.IsBound(anIObj))
--    return myObjects(anIObj)->GraphicStatus();
-+  if (theIObj.IsNull())
-+  {
-+    return AIS_DS_None;
-+  }
-+  else if (myObjects.IsBound (theIObj))
-+  {
-+    return myObjects (theIObj)->GraphicStatus();
-+  }
--  AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
--  for(;ItM.More();ItM.Next()){
--    if(ItM.Value()->IsIn(anIObj))
-+  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
-+  {
-+    if (aCtxIter.Value()->IsIn (theIObj))
-+    {
-       return AIS_DS_Temporary;
-+    }
-   }
--  
-   return AIS_DS_None;
--  
- }
--
--
--
- //=======================================================================
- //function : DisplayedModes
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--const TColStd_ListOfInteger& AIS_InteractiveContext::
--DisplayedModes(const Handle(AIS_InteractiveObject)& anIObj) const 
-+const TColStd_ListOfInteger& AIS_InteractiveContext::DisplayedModes (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  return myObjects(anIObj)->DisplayedModes();
-+  return myObjects (theIObj)->DisplayedModes();
- }
--
- //=======================================================================
- //function : Remove
--//purpose  : 
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::Remove(const Handle(AIS_InteractiveObject)& anIObj,
--                                    const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::Remove (const Handle(AIS_InteractiveObject)& theIObj,
-+                                     const Standard_Boolean               theToUpdateViewer)
- {
--
--  if(anIObj.IsNull()) return;
--
--  if(!HasOpenedContext()){ 
--    ClearGlobal(anIObj,updateviewer);
-+  if (theIObj.IsNull())
-+  {
-+    return;
-   }
--  else
-+
-+  if (HasOpenedContext())
-+  {
-+    myLocalContexts (myCurLocalIndex)->Remove (theIObj);
-+    for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
-     {
--      myLocalContexts(myCurLocalIndex)->Remove(anIObj);
--      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
--      for (;It.More() ;It.Next()){
--        if(It.Value()->AcceptErase())
--          It.Value()->Remove(anIObj);
--        
-+      if (aCtxIter.Value()->AcceptErase())
-+      {
-+        aCtxIter.Value()->Remove (theIObj);
-       }
--      //      if(!WasInCtx)
--      ClearGlobal(anIObj,updateviewer);
--//      else
--//      if(updateviewer) myMainVwr->Update();
-     }
-+  }
-+
-+  ClearGlobal (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : RemoveAll
--//purpose  : 
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::RemoveAll(const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::RemoveAll (const Standard_Boolean theToUpdateViewer)
- {
-   AIS_ListOfInteractive aList;
--  ObjectsInside(aList);
--  AIS_ListIteratorOfListOfInteractive aListIterator;
--  for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
--    Remove(aListIterator.Value(), Standard_False);
-+  ObjectsInside (aList);
-+  for (AIS_ListIteratorOfListOfInteractive aListIterator (aList); aListIterator.More(); aListIterator.Next())
-+  {
-+    Remove (aListIterator.Value(), Standard_False);
-   }
--      
--  if(updateviewer)
--    myMainVwr->Update();
--}
--
--//=======================================================================
--//function : Clear
--//purpose  : 
--//=======================================================================
--
--void AIS_InteractiveContext::Clear(const Handle(AIS_InteractiveObject)& anIObj,
--                                   const Standard_Boolean updateviewer)
--{
--  if(anIObj.IsNull()) return;
--  if(!HasOpenedContext()){ 
--    ClearGlobal(anIObj,updateviewer);
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-   }
--  else
--    {
--      
--      Standard_Boolean  WasInCtx = myLocalContexts(myCurLocalIndex)->Remove(anIObj);
--      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
--      for (;It.More() ;It.Next()){
--        if(It.Value()->AcceptErase())
--          WasInCtx = It.Value()->Remove(anIObj);
--        
--      }
--      if(!WasInCtx)
--        ClearGlobal(anIObj,updateviewer);
--      else
--        if(updateviewer) myMainVwr->Update();
--    }
- }
--
--
--
- //=======================================================================
- //function : ClearPrs
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::ClearPrs(const Handle(AIS_InteractiveObject)& anIObj,
--                                      const Standard_Integer aMode,
--                                      const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
-+                                       const Standard_Integer               theMode,
-+                                       const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return;
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  if(!HasOpenedContext()){
--    ClearGlobalPrs(anIObj,aMode,updateviewer);
-+  if (!HasOpenedContext())
-+  {
-+    ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
-+    return;
-   }
--  else
-+
-+  Standard_Boolean wasInCtx = myLocalContexts (myCurLocalIndex)->ClearPrs (theIObj, theMode);
-+  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
-+  {
-+    if (aCtxIter.Value()->AcceptErase())
-     {
--      Standard_Boolean  WasInCtx = myLocalContexts(myCurLocalIndex)->ClearPrs(anIObj,aMode);
--      AIS_DataMapIteratorOfDataMapOfILC It(myLocalContexts);
--      for (;It.More() ;It.Next()){
--        if(It.Value()->AcceptErase())
--          WasInCtx = It.Value()->ClearPrs(anIObj,aMode);
--      }
--      if(!WasInCtx)
--        ClearGlobalPrs(anIObj,aMode,updateviewer);
--      else
--        if(updateviewer) myMainVwr->Update();
--      
-+      wasInCtx = aCtxIter.Value()->ClearPrs (theIObj, theMode) || wasInCtx;
-     }
-+  }
-+  if (!wasInCtx)
-+  {
-+    ClearGlobalPrs (theIObj, theMode, theToUpdateViewer);
-+  }
-+  else if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
- }
- //=======================================================================
- //function : Hilight
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::Hilight(const Handle(AIS_InteractiveObject)& anIObj,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::Hilight (const Handle(AIS_InteractiveObject)& theIObj,
-+                                      const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return;
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  if(!anIObj->HasInteractiveContext()) anIObj->SetContext(this);
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-   if (!HasOpenedContext())
-   {
--    if(!myObjects.IsBound(anIObj)) return;
--
--    // CLE
--    // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--    // const TColStd_ListOfInteger& LL = STATUS->DisplayedModes();
--    Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--
--    // ENDCLE
--    STATUS->SetHilightStatus (Standard_True);
-+    if (!myObjects.IsBound (theIObj))
-+    {
-+      return;
-+    }
--    if (STATUS->GraphicStatus() == AIS_DS_Displayed)
-+    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+    aStatus->SetHilightStatus (Standard_True);
-+    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
-     {
--      Standard_Integer aHilightMode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
--      myMainPM->Highlight (anIObj, aHilightMode);
-+      Standard_Integer aHilightMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
-+      myMainPM->Highlight (theIObj, aHilightMode);
-     }
-   }
-   else
-   {
--    myLocalContexts(myCurLocalIndex)->Hilight(anIObj);
-+    myLocalContexts (myCurLocalIndex)->Hilight (theIObj);
-   }
--  if(updateviewer) myMainVwr->Update();
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
- }
- //=======================================================================
- //function : Hilight
-@@ -1086,153 +988,165 @@
- //=======================================================================
- //function : IsDisplayed
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::
--IsDisplayed(const Handle(AIS_InteractiveObject)& anIObj,
--            const Standard_Integer aMode) const 
-+Standard_Boolean AIS_InteractiveContext::IsDisplayed (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                      const Standard_Integer               theMode) const
- {
--  if(anIObj.IsNull()) return Standard_False;
--  if(myObjects.IsBound(anIObj)) {
--    if(myObjects(anIObj)->GraphicStatus()==AIS_DS_Displayed &&
--       myObjects(anIObj)->IsDModeIn(aMode)) 
-+  if (theIObj.IsNull())
-+  {
-+    return Standard_False;
-+  }
-+
-+  if (myObjects.IsBound (theIObj))
-+  {
-+    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+    if (aStatus->GraphicStatus() == AIS_DS_Displayed
-+     && aStatus->IsDModeIn (theMode))
-+    {
-       return Standard_True;
-+    }
-   }
--  
--  AIS_DataMapIteratorOfDataMapOfILC ItM(myLocalContexts);
--  for(;ItM.More();ItM.Next()){
--    if(ItM.Value()->IsDisplayed(anIObj,aMode))
-+
-+  for (AIS_DataMapIteratorOfDataMapOfILC aCtxIter (myLocalContexts); aCtxIter.More(); aCtxIter.Next())
-+  {
-+    if (aCtxIter.Value()->IsDisplayed (theIObj, theMode))
-+    {
-       return Standard_True;
-+    }
-   }
-   return Standard_False;
- }
--
- //=======================================================================
- //function : DisplayPriority
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Integer AIS_InteractiveContext::
--DisplayPriority(const Handle(AIS_InteractiveObject)& anIObj) const 
-+Standard_Integer AIS_InteractiveContext::DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  if(anIObj.IsNull()) return -1;
-+  if (theIObj.IsNull())
-+  {
-+    return -1;
-+  }
-+  else if (!myObjects.IsBound (theIObj))
-+  {
-+    return 0;
-+  }
--  if (myObjects.IsBound(anIObj))
-+  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+  if (aStatus->GraphicStatus() == AIS_DS_Displayed
-+   || aStatus->GraphicStatus() == AIS_DS_Erased)
-   {
--    Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--    if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
--    {
--      Standard_Integer aDispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : 
--                                   (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
--      return myMainPM->DisplayPriority (anIObj, aDispMode);
--    }
-+    Standard_Integer aDispMode = theIObj->HasDisplayMode()
-+                               ? theIObj->DisplayMode()
-+                               : (theIObj->AcceptDisplayMode (myDisplayMode)
-+                                ? myDisplayMode
-+                                : 0);
-+    return myMainPM->DisplayPriority (theIObj, aDispMode);
-   }
-   return 0;
- }
-+
- //=======================================================================
- //function : SetDisplayPriority
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetDisplayPriority(const Handle(AIS_InteractiveObject)& anIObj,
--                                               const Standard_Integer aPriority)
-+void AIS_InteractiveContext::SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                 const Standard_Integer               thePriority)
- {
--  if(anIObj.IsNull())
-+  if (theIObj.IsNull())
-+  {
-     return;
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  if(myObjects.IsBound(anIObj))
-+  }
-+
-+  if (!theIObj->HasInteractiveContext())
-   {
--    Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
-+    theIObj->SetContext (this);
-+  }
--    if (STATUS->GraphicStatus() == AIS_DS_Displayed || STATUS->GraphicStatus() == AIS_DS_Erased)
--    {
--      Standard_Integer aDisplayMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : 
--                                      (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
--      myMainPM->SetDisplayPriority (anIObj, aDisplayMode, aPriority);
-+  if (myObjects.IsBound (theIObj))
-+  {
-+    Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+    if (aStatus->GraphicStatus() == AIS_DS_Displayed
-+     || aStatus->GraphicStatus() == AIS_DS_Erased)
-+    {
-+      Standard_Integer aDisplayMode = theIObj->HasDisplayMode()
-+                                    ? theIObj->DisplayMode()
-+                                    : (theIObj->AcceptDisplayMode (myDisplayMode)
-+                                     ? myDisplayMode
-+                                     : 0);
-+      myMainPM->SetDisplayPriority (theIObj, aDisplayMode, thePriority);
-     }
-   }
-   else if (HasOpenedContext())
-   {
--    myLocalContexts(myCurLocalIndex)->SetDisplayPriority(anIObj,aPriority);
-+    myLocalContexts (myCurLocalIndex)->SetDisplayPriority (theIObj, thePriority);
-   }
- }
- //=======================================================================
- //function : Redisplay
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::Redisplay(const Handle(AIS_InteractiveObject)& anIObj,
--                                      const Standard_Boolean updateviewer,
--                                      const Standard_Boolean allmodes)
-+void AIS_InteractiveContext::Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
-+                                        const Standard_Boolean               theToUpdateViewer,
-+                                        const Standard_Boolean               theAllModes)
- {
--  if(AISDebugModeOn()){
--    cout<<"===>AIS_InteractiveContext::Redisplay de :";
--    cout<<anIObj->DynamicType()->Name()<<endl;
--  }
--
--  RecomputePrsOnly(anIObj,updateviewer,allmodes);
--  RecomputeSelectionOnly(anIObj);
-+  RecomputePrsOnly (theIObj, theToUpdateViewer, theAllModes);
-+  RecomputeSelectionOnly (theIObj);
- }
- //=======================================================================
- //function : Redisplay
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::Redisplay(const AIS_KindOfInteractive KOI,
--                                       const Standard_Integer /*Sign*/,
--                                      const Standard_Boolean updateviewer)
--{
--  Standard_Boolean found_viewer(Standard_False);
--  // update
--  for(AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);It.More();It.Next()){
--    // CLE
--    // const Handle(AIS_InteractiveObject)& IO = It.Key();
--    Handle(AIS_InteractiveObject) IO = It.Key();
--    // ENDCLE
--    if(IO->Type()== KOI){ 
--#ifdef OCCT_DEBUG
--//      Standard_Boolean good = (Sign==-1)? Standard_True : 
--//        ((IO->Signature()==Sign)? Standard_True:Standard_False);
--#endif
--      Redisplay(IO,Standard_False);
--      if (It.Value()->GraphicStatus() == AIS_DS_Displayed)
--      {
--        found_viewer = Standard_True;
--      }
-+void AIS_InteractiveContext::Redisplay (const AIS_KindOfInteractive theKOI,
-+                                        const Standard_Integer    /*theSign*/,
-+                                        const Standard_Boolean      theToUpdateViewer)
-+{
-+  Standard_Boolean isRedisplayed = Standard_False;
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
-+    if (anObj->Type() != theKOI)
-+    {
-+      continue;
-     }
-+
-+    Redisplay (anObj, Standard_False);
-+    isRedisplayed = anObjIter.Value()->GraphicStatus() == AIS_DS_Displayed
-+                 || isRedisplayed;
-   }
--  // update viewer...
--  if(updateviewer && found_viewer)
-+
-+  if (theToUpdateViewer
-+   && isRedisplayed)
-   {
-     myMainVwr->Update();
-   }
- }
--
- //=======================================================================
- //function : RecomputePrsOnly
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::RecomputePrsOnly(const Handle(AIS_InteractiveObject)& anIObj,
--                                              const Standard_Boolean updateviewer,
--                                              const Standard_Boolean allmodes)
-+void AIS_InteractiveContext::RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
-+                                               const Standard_Boolean               theToUpdateViewer,
-+                                               const Standard_Boolean               theAllModes)
- {
--  if(anIObj.IsNull()) return;
--  anIObj->Update(allmodes);
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  if (!updateviewer)
-+  theIObj->Update (theAllModes);
-+  if (!theToUpdateViewer)
-   {
-     return;
-   }
--  if (HasOpenedContext() ||
--     (myObjects.IsBound(anIObj) && myObjects(anIObj)->GraphicStatus() == AIS_DS_Displayed))
-+  if (HasOpenedContext()
-+   || (myObjects.IsBound (theIObj)
-+    && myObjects (theIObj)->GraphicStatus() == AIS_DS_Displayed))
-   {
-     myMainVwr->Update();
-   }
-@@ -1276,21 +1190,19 @@
- //=======================================================================
- //function : Update
--//purpose  : 
-+//purpose  :
- //=======================================================================
- void AIS_InteractiveContext::Update (const Handle(AIS_InteractiveObject)& theIObj,
--                                     const Standard_Boolean theUpdateViewer)
-+                                     const Standard_Boolean               theUpdateViewer)
- {
-   if (theIObj.IsNull())
-   {
-     return;
-   }
--  TColStd_ListOfInteger aListOfFlaggedPrsModes;
--  theIObj->ToBeUpdated (aListOfFlaggedPrsModes);
--
--  TColStd_ListIteratorOfListOfInteger aPrsModesIt (aListOfFlaggedPrsModes);
--  for ( ; aPrsModesIt.More(); aPrsModesIt.Next())
-+  TColStd_ListOfInteger aPrsModes;
-+  theIObj->ToBeUpdated (aPrsModes);
-+  for (TColStd_ListIteratorOfListOfInteger aPrsModesIt (aPrsModes); aPrsModesIt.More(); aPrsModesIt.Next())
-   {
-     theIObj->Update (aPrsModesIt.Value(), Standard_False);
-   }
-@@ -1323,138 +1235,142 @@
- //=======================================================================
- //function : SetLocation
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetLocation(const Handle(AIS_InteractiveObject)& anIObj,
--                                         const TopLoc_Location& aLoc)
-+void AIS_InteractiveContext::SetLocation (const Handle(AIS_InteractiveObject)& theIObj,
-+                                          const TopLoc_Location&               theLoc)
- {
--  if(anIObj.IsNull()) return;
--
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  if(anIObj->HasTransformation() && aLoc.IsIdentity()){
--    anIObj->ResetTransformation();
--    mgrSelector->Update(anIObj,Standard_False);
-+  if (theIObj->HasTransformation()
-+   && theLoc.IsIdentity())
-+  {
-+    theIObj->ResetTransformation();
-+    mgrSelector->Update (theIObj, Standard_False);
-+    return;
-+  }
-+  else if (theLoc.IsIdentity())
-+  {
-     return;
-   }
--  if(aLoc.IsIdentity()) return ;
-   // first reset the previous location to properly clean everything...
--  if(anIObj->HasTransformation())
--    anIObj->ResetTransformation();
-+  if (theIObj->HasTransformation())
-+  {
-+    theIObj->ResetTransformation();
-+  }
-+  theIObj->SetLocalTransformation (theLoc.Transformation());
--  anIObj->SetLocalTransformation (aLoc.Transformation());
--  
--  if(!HasOpenedContext())
--    mgrSelector->Update(anIObj,Standard_False);
-+  if (!HasOpenedContext())
-+  {
-+    mgrSelector->Update (theIObj, Standard_False);
-+  }
-   else
--    {
--      // CLE
--      // const Handle(StdSelect_ViewerSelector3d)& tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
--      Handle(StdSelect_ViewerSelector3d) tempSel = myLocalContexts(myCurLocalIndex)->MainSelector();
--      // ENDCLE
--      mgrSelector->Update(anIObj,tempSel,Standard_False);
--    }
-+  {
-+    Handle(StdSelect_ViewerSelector3d) aTempSel = myLocalContexts (myCurLocalIndex)->MainSelector();
-+    mgrSelector->Update (theIObj, aTempSel, Standard_False);
-+  }
- }
-+
- //=======================================================================
- //function : ResetLocation
--//purpose  : 
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::ResetLocation(const Handle(AIS_InteractiveObject)& anIObj)
-+void AIS_InteractiveContext::ResetLocation (const Handle(AIS_InteractiveObject)& theIObj)
- {
--  if(anIObj.IsNull()) return;
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  anIObj->ResetTransformation();
--  mgrSelector->Update(anIObj,Standard_False);
-+  theIObj->ResetTransformation();
-+  mgrSelector->Update (theIObj, Standard_False);
- }
- //=======================================================================
- //function : HasLocation
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::
--HasLocation(const Handle(AIS_InteractiveObject)& anIObj) const
-+Standard_Boolean AIS_InteractiveContext::HasLocation (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  if(anIObj.IsNull()) return Standard_False;
--
--  return anIObj->HasTransformation();
-+  return !theIObj.IsNull()
-+       && theIObj->HasTransformation();
- }
--TopLoc_Location AIS_InteractiveContext::
--Location(const Handle(AIS_InteractiveObject)& anIObj) const
-+//=======================================================================
-+//function : Location
-+//purpose  :
-+//=======================================================================
-+TopLoc_Location AIS_InteractiveContext::Location (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  return anIObj->Transformation();
-+  return theIObj->Transformation();
- }
- //=======================================================================
- //function : SetDeviationCoefficient
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetDeviationCoefficient(const Standard_Real aCoefficient)
-+void AIS_InteractiveContext::SetDeviationCoefficient (const Standard_Real theCoefficient)
- {
--  myDefaultDrawer->SetDeviationCoefficient(aCoefficient);
-+  myDefaultDrawer->SetDeviationCoefficient (theCoefficient);
- }
-+
- //=======================================================================
- //function : SetDeviationAngle
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetDeviationAngle(const Standard_Real anAngle)
-+void AIS_InteractiveContext::SetDeviationAngle (const Standard_Real theAngle)
- {
--  myDefaultDrawer->SetDeviationCoefficient(anAngle);
-+  myDefaultDrawer->SetDeviationCoefficient (theAngle);
- }
- //=======================================================================
- //function : DeviationAngle
- //purpose  : Gets  deviationAngle
- //=======================================================================
--
- Standard_Real AIS_InteractiveContext::DeviationAngle() const
- {
--  //return M_PI/180.0e0 ;
--    return myDefaultDrawer->DeviationAngle();
-+  return myDefaultDrawer->DeviationAngle();
- }
- //=======================================================================
- //function : DeviationCoefficient
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Real AIS_InteractiveContext::DeviationCoefficient() const 
-+Standard_Real AIS_InteractiveContext::DeviationCoefficient() const
- {
-   return myDefaultDrawer->DeviationCoefficient();
- }
-+
- //=======================================================================
- //function : SetHLRDeviationCoefficient
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetHLRDeviationCoefficient(const Standard_Real aCoefficient)
-+void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Standard_Real theCoefficient)
- {
--  myDefaultDrawer->SetHLRDeviationCoefficient(aCoefficient);
-+  myDefaultDrawer->SetHLRDeviationCoefficient (theCoefficient);
- }
- //=======================================================================
- //function : HLRDeviationCoefficient
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const 
-+Standard_Real AIS_InteractiveContext::HLRDeviationCoefficient() const
- {
-   return myDefaultDrawer->HLRDeviationCoefficient();
- }
- //=======================================================================
- //function : SetHLRAngle
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetHLRAngle(const Standard_Real anAngle)
-+void AIS_InteractiveContext::SetHLRAngle (const Standard_Real theAngle)
- {
--  myDefaultDrawer->SetHLRAngle(anAngle);
-+  myDefaultDrawer->SetHLRAngle (theAngle);
- }
- //=======================================================================
-@@ -1463,23 +1379,19 @@
- //           and set them in myHLRAngle and in myHLRDeviationCoefficient
- //           of myDefaultDrawer 
- //=======================================================================
--
--void AIS_InteractiveContext::SetHLRAngleAndDeviation(const Standard_Real anAngle)
-+void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Standard_Real theAngle)
- {
-+  Standard_Real anOutAngl, anOutDefl;
-+  HLRBRep::PolyHLRAngleAndDeflection (theAngle, anOutAngl, anOutDefl);
--  Standard_Real OutAngl,OutDefl;
--  HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
--
--  myDefaultDrawer->SetHLRAngle(OutAngl);
--  myDefaultDrawer->SetHLRDeviationCoefficient(OutDefl);
--
-+  myDefaultDrawer->SetHLRAngle                (anOutAngl);
-+  myDefaultDrawer->SetHLRDeviationCoefficient (anOutDefl);
- }
- //=======================================================================
- //function : HLRAngle
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
- Standard_Real AIS_InteractiveContext::HLRAngle() const 
- {
-   return myDefaultDrawer->HLRAngle();
-@@ -1487,1348 +1399,1320 @@
- //=======================================================================
- //function : SetDisplayMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetDisplayMode(const AIS_DisplayMode aMode,
--                                           const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetDisplayMode (const AIS_DisplayMode  theMode,
-+                                             const Standard_Boolean theToUpdateViewer)
- {
--  if(aMode==myDisplayMode) return;
--  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
-+  if (theMode == myDisplayMode)
-+  {
-+    return;
-+  }
--  for(;It.More();It.Next()){
--    // CLE
--    // const Handle(AIS_InteractiveObject)& anObj = It.Key();
--    Handle(AIS_InteractiveObject) anObj = It.Key();
--    // ENDCLE
--    Standard_Boolean Processed = (anObj->IsKind(STANDARD_TYPE(AIS_Shape)) ||
--                                  anObj->IsKind(STANDARD_TYPE(AIS_ConnectedInteractive)) ||
--                                  anObj->IsKind(STANDARD_TYPE(AIS_MultipleConnectedInteractive)) );
-+  for (AIS_DataMapIteratorOfDataMapOfIOStatus anObjIter (myObjects); anObjIter.More(); anObjIter.Next())
-+  {
-+    Handle(AIS_InteractiveObject) anObj = anObjIter.Key();
-+    Standard_Boolean toProcess = anObj->IsKind (STANDARD_TYPE(AIS_Shape))
-+                              || anObj->IsKind (STANDARD_TYPE(AIS_ConnectedInteractive))
-+                              || anObj->IsKind (STANDARD_TYPE(AIS_MultipleConnectedInteractive));
-     
--    if ((!anObj->HasDisplayMode()) && Processed) 
-+    if (!toProcess
-+     ||  anObj->HasDisplayMode()
-+     || !anObj->AcceptDisplayMode (theMode))
-+    {
-+      continue;
-+    }
-+
-+    Handle(AIS_GlobalStatus) aStatus = anObjIter.Value();
-+    if (aStatus->IsDModeIn (myDisplayMode))
-+    {
-+      aStatus->RemoveDisplayMode (myDisplayMode);
-+    }
-+
-+    aStatus->AddDisplayMode (theMode);
-+    if (aStatus->GraphicStatus() == AIS_DS_Displayed)
-+    {
-+      myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
-+      myMainPM->Display (anObj, theMode);
-+      if (aStatus->IsSubIntensityOn())
-       {
--        if(anObj->AcceptDisplayMode(aMode)){
--          // CLE
--          // const Handle(AIS_GlobalStatus)& STATUS = It.Value();
--          Handle(AIS_GlobalStatus) STATUS = It.Value();
--          // ENDCLE
--          if(STATUS->IsDModeIn(myDisplayMode))
--            STATUS->RemoveDisplayMode(myDisplayMode);
--          
--          STATUS->AddDisplayMode(aMode);
--          
--          if(STATUS->GraphicStatus()== AIS_DS_Displayed){
--            myMainPM->SetVisibility (anObj, myDisplayMode, Standard_False);
--            myMainPM->Display(anObj, aMode);
--            if(STATUS->IsSubIntensityOn())
--              myMainPM->Color(anObj,mySubIntensity,aMode);
--          }
--          //  myDisplayMode = aMode;
--        }
-+        myMainPM->Color (anObj, mySubIntensity, theMode);
-       }
--    
--  } 
--  myDisplayMode = aMode;
--  if(updateviewer) myMainVwr->Update();
--}
--
-+    }
-+  }
-+
-+  myDisplayMode = theMode;
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
-+}
-+
- //=======================================================================
- //function : SetDisplayMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj, 
--                                           const Standard_Integer aMode,
--                                           const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
-+                                             const Standard_Integer               theMode,
-+                                             const Standard_Boolean               theToUpdateViewer)
- {
--  
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  if(!HasOpenedContext()){
--    
--    if(!myObjects.IsBound(anIObj)) 
--      anIObj->SetDisplayMode(aMode);
--    else if( anIObj->AcceptDisplayMode(aMode) ) 
--    {
--      // CLE
--      // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--      Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--      // ENDCLE
--      // SAN : erase presentations for all display modes different from <aMode>
--      if(STATUS->GraphicStatus()==AIS_DS_Displayed){
--        TColStd_ListOfInteger aModesToRemove;
--        TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
--        for(;ItL.More();ItL.Next()){
--
--          Standard_Integer OldMode = ItL.Value();
--
--          if(OldMode!=aMode){
--            aModesToRemove.Append(OldMode);
--            if(myMainPM->IsHighlighted(anIObj,OldMode))
--              myMainPM->Unhighlight(anIObj,OldMode);
--            myMainPM->SetVisibility (anIObj, OldMode, Standard_False);
--          }
--        }
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext(this);
-+  }
-+
-+  if (HasOpenedContext())
-+  {
-+    return;
-+  }
--        for(ItL.Initialize(aModesToRemove);ItL.More();ItL.Next())
--          STATUS->RemoveDisplayMode(ItL.Value());
-+  if (!myObjects.IsBound (theIObj))
-+  {
-+    theIObj->SetDisplayMode (theMode);
-+    return;
-+  }
-+  else if (!theIObj->AcceptDisplayMode (theMode))
-+  {
-+    return;
-+  }
--        if(!STATUS->IsDModeIn(aMode))
--          STATUS->AddDisplayMode(aMode);
-+  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+  if (aStatus->GraphicStatus() != AIS_DS_Displayed)
-+  {
-+    theIObj->SetDisplayMode (theMode);
-+    return;
-+  }
--        myMainPM->Display(anIObj,aMode);
--        Standard_Integer DM,HM,SM;
--        GetDefModes(anIObj,DM,HM,SM);
--        if(STATUS->IsHilighted()){
--          myMainPM->Highlight(anIObj,HM);
--        }
--        if(STATUS->IsSubIntensityOn()){
--          myMainPM->Color(anIObj,mySubIntensity,aMode);
--        }
--        if(anIObj->IsTransparent() && !myMainVwr->Viewer()->Transparency())
--          myMainVwr->Viewer()->SetTransparency(Standard_True);
--        
--        if(updateviewer) myMainVwr->Update();
-+  // erase presentations for all display modes different from <aMode>
-+  TColStd_ListOfInteger aModesToRemove;
-+  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
-+  {
-+    const Standard_Integer anOldMode = aDispModeIter.Value();
-+    if (anOldMode != theMode)
-+    {
-+      aModesToRemove.Append (anOldMode);
-+      if (myMainPM->IsHighlighted (theIObj, anOldMode))
-+      {
-+        myMainPM->Unhighlight (theIObj, anOldMode);
-       }
--      anIObj->SetDisplayMode(aMode);
-+      myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
-     }
-   }
-+
-+  for (TColStd_ListIteratorOfListOfInteger aRemModeIter (aModesToRemove); aRemModeIter.More(); aRemModeIter.Next())
-+  {
-+    aStatus->RemoveDisplayMode (aRemModeIter.Value());
-+  }
-+
-+  if (!aStatus->IsDModeIn (theMode))
-+  {
-+    aStatus->AddDisplayMode (theMode);
-+  }
-+
-+  myMainPM->Display (theIObj, theMode);
-+  Standard_Integer aDispMode, aHiMode, aSelMode;
-+  GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
-+  if (aStatus->IsHilighted())
-+  {
-+    myMainPM->Highlight (theIObj, aHiMode);
-+  }
-+  if (aStatus->IsSubIntensityOn())
-+  {
-+    myMainPM->Color (theIObj, mySubIntensity, theMode);
-+  }
-+
-+  if (theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-+  }
-+  theIObj->SetDisplayMode (theMode);
- }
- //=======================================================================
- //function : UnsetDisplayMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::
--UnsetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
--                 const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
-+                                               const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
--  if(!anIObj->HasDisplayMode()) return;
--  
--  if(!myObjects.IsBound(anIObj))
--    anIObj->UnsetDisplayMode();
--  else
-+  if (theIObj.IsNull()
-+  || !theIObj->HasDisplayMode())
-+  {
-+    return;
-+  }
-+
-+  if (!myObjects.IsBound (theIObj))
-+  {
-+    theIObj->UnsetDisplayMode();
-+    return;
-+  }
-+
-+  const Standard_Integer anOldMode = theIObj->DisplayMode();
-+  if (myDisplayMode == anOldMode)
-+  {
-+    return;
-+  }
-+
-+  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
-+  aStatus->RemoveDisplayMode (anOldMode);
-+  if (!aStatus->IsDModeIn(myDisplayMode))
-+  {
-+    aStatus->AddDisplayMode (myDisplayMode);
-+  }
-+
-+  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
-+  {
-+    if (myMainPM->IsHighlighted (theIObj, anOldMode))
-     {
--      Standard_Integer OldMode = anIObj->DisplayMode();
--      if(myDisplayMode==OldMode) return;
--      const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--      STATUS->RemoveDisplayMode(OldMode);
--      if(!STATUS->IsDModeIn(myDisplayMode))
--        STATUS->AddDisplayMode(myDisplayMode);
--      if(STATUS->GraphicStatus()==AIS_DS_Displayed){
--        if(myMainPM->IsHighlighted(anIObj,OldMode))
--          myMainPM->Unhighlight(anIObj,OldMode);
--        myMainPM->SetVisibility (anIObj, OldMode, Standard_False);
--        myMainPM->Display(anIObj,myDisplayMode);
--        Standard_Integer DM,HM,SM;
--        GetDefModes(anIObj,DM,HM,SM);
--        if(STATUS->IsHilighted()){
--          myMainPM->Highlight(anIObj,HM);
--        }
--        if(STATUS->IsSubIntensityOn()){
--          myMainPM->Color(anIObj,mySubIntensity,myDisplayMode);
--        }
--        if(updateviewer) myMainVwr->Update();
--      }
--      anIObj->UnsetDisplayMode();
--      
-+      myMainPM->Unhighlight (theIObj, anOldMode);
-     }
-+    myMainPM->SetVisibility (theIObj, anOldMode, Standard_False);
-+    myMainPM->Display (theIObj, myDisplayMode);
-+
-+    Standard_Integer aDispMode, aHiMode, aSelMode;
-+    GetDefModes (theIObj, aDispMode, aHiMode, aSelMode);
-+    if (aStatus->IsHilighted())
-+    {
-+      myMainPM->Highlight (theIObj, aHiMode);
-+    }
-+    if (aStatus->IsSubIntensityOn())
-+    {
-+      myMainPM->Color (theIObj, mySubIntensity, myDisplayMode);
-+    }
-+
-+    if (theToUpdateViewer)
-+    {
-+      myMainVwr->Update();
-+    }
-+  }
-+
-+  theIObj->UnsetDisplayMode();
- }
- //=======================================================================
- //function : SetCurrentFacingModel
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetCurrentFacingModel(
--                        const Handle(AIS_InteractiveObject)& anIObj,
--                        const Aspect_TypeOfFacingModel aModel)
-+void AIS_InteractiveContext::SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                    const Aspect_TypeOfFacingModel       theModel)
- {
--  if (  !anIObj.IsNull ()  )
--    anIObj->SetCurrentFacingModel(aModel);
-+  if (!theIObj.IsNull())
-+  {
-+    theIObj->SetCurrentFacingModel (theModel);
-+  }
- }
- //=======================================================================
--//function : SetColor
--//purpose  : 
-+//function : redisplayPrsRecModes
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Quantity_NameOfColor aColor,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                   const Standard_Boolean               theToUpdateViewer)
- {
--  SetColor(anIObj,Quantity_Color(aColor),updateviewer);
-+  if (theIObj->RecomputeEveryPrs())
-+  {
-+    theIObj->Redisplay();
-+  }
-+  else
-+  {
-+    for (TColStd_ListIteratorOfListOfInteger aModes (theIObj->ListOfRecomputeModes()); aModes.More(); aModes.Next())
-+    {
-+      theIObj->Update (aModes.Value(), Standard_False);
-+    }
-+    theIObj->SetRecomputeOk();
-+  }
-+
-+  if (theToUpdateViewer)
-+  {
-+    UpdateCurrentViewer();
-+  }
- }
--void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Quantity_Color &aColor,
--                                     const Standard_Boolean updateviewer)
-+//=======================================================================
-+//function : redisplayPrsModes
-+//purpose  :
-+//=======================================================================
-+void AIS_InteractiveContext::redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
-- 
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  anIObj->SetColor(aColor);
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
-+  if (theIObj->RecomputeEveryPrs())
-+  {
-+    theIObj->Redisplay();
-+  }
-   else
-+  {
-+    TColStd_ListOfInteger aModes;
-+    theIObj->ToBeUpdated (aModes);
-+    for (TColStd_ListIteratorOfListOfInteger aModeIter (aModes); aModeIter.More(); aModeIter.Next())
-     {
--      Standard_Integer NbDisp=0;
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--      anIObj->SetRecomputeOk();
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
-+      theIObj->Update (aModeIter.Value(), Standard_False);
-     }
-+    theIObj->SetRecomputeOk();
-+  }
--
--#ifdef OCCT_DEBUG
--//   // pour isg
--//   if(anIObj->Type()==AIS_KOI_Datum && anIObj->Signature()==3){
--//     Handle(AIS_Trihedron) Tr = *((Handle(AIS_Trihedron)*)&anIObj);
--//     Standard_Real Lx = myDefaultDrawer->DatumAspect()->FirstAxisLength();
--//     gp_Trsf T; 
--//     gp_Dir D =Tr->Component()->XDirection();
--//     gp_Pnt O = Tr->Component()->Location();
--//     gp_Vec V(D);V*=Lx/5.;
--//     T.SetRotation(gp_Ax1(O,D),M_PI/6.);
--//     T.SetTranslationPart(V);
--//     TopLoc_Location L,IncLoc(T);
--   
--//     for(Standard_Integer I=1;I<90;I++){
--//       if(anIObj->HasLocation())
--//      L = anIObj->Location() * IncLoc;
--//       else
--//      L = IncLoc;
--//       SetLocation(anIObj,L);
--//       UpdateCurrentViewer();
--//     }
--//      for(I=1;I<90;I++){
--//        L = anIObj->Location() /IncLoc;
--//       SetLocation(anIObj,L);
--//       UpdateCurrentViewer();
--//     }
--//    ResetLocation(anIObj);
--//   }
-- #endif
--  if(updateviewer) UpdateCurrentViewer();
-+  if (theToUpdateViewer)
-+  {
-+    UpdateCurrentViewer();
-+  }
- }
- //=======================================================================
--//function : SetDeviationCoefficient
--//purpose  : 
-+//function : SetColor
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theIObj,
-+                                       const Quantity_NameOfColor           theColor,
-+                                       const Standard_Boolean               theToUpdateViewer)
-+{
-+  SetColor (theIObj, Quantity_Color(theColor), theToUpdateViewer);
-+}
--void AIS_InteractiveContext::SetDeviationCoefficient(
--                                     const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Standard_Real   aCoefficient,
--                                     const Standard_Boolean updateviewer)
-+//=======================================================================
-+//function : SetColor
-+//purpose  :
-+//=======================================================================
-+void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theIObj,
-+                                       const Quantity_Color&                theColor,
-+                                       const Standard_Boolean               theToUpdateViewer)
- {
--//  cout<<" Coefficient:"<< aCoefficient <<endl;
--  if(anIObj.IsNull()) return ;
-- 
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--  // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
--  if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
--  if(anIObj->Signature()!=0) return;
--  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationCoefficient(aCoefficient);
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+  theIObj->SetColor (theColor);
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
-+}
-+//=======================================================================
-+//function : SetDeviationCoefficient
-+//purpose  :
-+//=======================================================================
-+void AIS_InteractiveContext::SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                      const Standard_Real                  theCoefficient,
-+                                                      const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp=0;
--      TColStd_ListOfInteger LL;
--      anIObj->ToBeUpdated(LL);
--      TColStd_ListIteratorOfListOfInteger ITI(LL);
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--      anIObj->SetRecomputeOk();
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--    }
--  if(updateviewer) UpdateCurrentViewer();
-+  // to be modified after the related methods of AIS_Shape are passed to InteractiveObject
-+  if (theIObj->Type() != AIS_KOI_Object
-+   && theIObj->Type() != AIS_KOI_Shape)
-+  {
-+    return;
-+  }
-+  else if (theIObj->Signature() != 0)
-+  {
-+    return;
-+  }
-+
-+  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
-+  aShape->SetOwnDeviationCoefficient (theCoefficient);
-+  redisplayPrsModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : SetHLRDeviationCoefficient
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetHLRDeviationCoefficient(
--                                     const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Standard_Real    aCoefficient,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                         const Standard_Real                  theCoefficient,
-+                                                         const Standard_Boolean               theToUpdateViewer)
- {
--//  cout<<" HLRCoefficient:"<< aCoefficient <<endl;
--  if(anIObj.IsNull()) return ;
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-  
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
-   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
--  if(anIObj->Type()!=AIS_KOI_Object && anIObj->Type()!=AIS_KOI_Shape) return;
--  if(anIObj->Signature()!=0) return;
--  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationCoefficient(aCoefficient);
--
--
--
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp=0;
-+  if (theIObj->Type() != AIS_KOI_Object
-+   && theIObj->Type() != AIS_KOI_Shape)
-+  {
-+    return;
-+  }
-+  else if (theIObj->Signature() != 0)
-+  {
-+    return;
-+  }
--      TColStd_ListOfInteger LL;
--      anIObj->ToBeUpdated(LL);
--      TColStd_ListIteratorOfListOfInteger ITI(LL);
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--      anIObj->SetRecomputeOk();
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--    }
--  if(updateviewer) UpdateCurrentViewer();
-+  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
-+  aShape->SetOwnHLRDeviationCoefficient (theCoefficient);
-+  redisplayPrsModes (theIObj, theToUpdateViewer);
- }
--
- //=======================================================================
- //function : SetDeviationAngle
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetDeviationAngle(
--                                     const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Standard_Real   anAngle,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                const Standard_Real                  theAngle,
-+                                                const Standard_Boolean               theToUpdateViewer)
- {
--//  cout<<" Angle:"<< anAngle <<endl;
--  if(anIObj.IsNull()) return ;
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-  
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
-   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
--  if(anIObj->Type()!=AIS_KOI_Shape) return;
--  if(anIObj->Signature()!=0) return;
--  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnDeviationAngle(anAngle);
--
-+  if (theIObj->Type() != AIS_KOI_Shape)
-+  {
-+    return;
-+  }
-+  else if (theIObj->Signature() != 0)
-+  {
-+    return;
-+  }
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp=0;
--      TColStd_ListOfInteger LL;
--      anIObj->ToBeUpdated(LL);
--      TColStd_ListIteratorOfListOfInteger ITI(LL);
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--      anIObj->SetRecomputeOk();
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--    }
--  if(updateviewer) UpdateCurrentViewer();
-+  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
-+  aShape->SetOwnDeviationAngle (theAngle);
-+  redisplayPrsModes (theIObj, theToUpdateViewer);
- }
-+
- //=======================================================================
--//function : SetDeviationAngle
--//purpose  : 
-+//function : SetAngleAndDeviation
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                   const Standard_Real                  theAngle,
-+                                                   const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::SetAngleAndDeviation(
--                                     const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Standard_Real   anAngle,
--                                     const Standard_Boolean updateviewer)
--{
--//  cout<<" Angle:"<< anAngle <<endl;
--  if(anIObj.IsNull()) return ;
--//   Standard_Real anAngleRad = M_PI*anAngle/180; test rob...
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
--  if(anIObj->Type()!=AIS_KOI_Shape) return;
--  if(anIObj->Signature()!=0) return;
--  (*((Handle(AIS_Shape)*)&anIObj))->SetAngleAndDeviation(anAngle);
-+  if (theIObj->Type() != AIS_KOI_Shape)
-+  {
-+    return;
-+  }
-+  if (theIObj->Signature() != 0)
-+  {
-+    return;
-+  }
-+  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
-+  aShape->SetAngleAndDeviation (theAngle);
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
-+  if (theIObj->RecomputeEveryPrs())
-+  {
-+    theIObj->Redisplay();
-+  }
-   else
--    Update(anIObj,updateviewer);
-+  {
-+    Update (theIObj, theToUpdateViewer);
-+  }
- }
- //=======================================================================
--//function : SetDeviationAngle
--//purpose  : 
-+//function : SetHLRAngleAndDeviation
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                      const Standard_Real                  theAngle,
-+                                                      const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::SetHLRAngleAndDeviation(
--                                     const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Standard_Real   anAngle,
--                                     const Standard_Boolean updateviewer)
--{
--//  cout<<" Angle:"<< anAngle <<endl;
--
--  if(anIObj.IsNull()) return ;
--   if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-   // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
--  if(anIObj->Type()!=AIS_KOI_Shape) return;
--  if(anIObj->Signature()!=0) return;
--  (*((Handle(AIS_Shape)*)&anIObj))->SetHLRAngleAndDeviation(anAngle);
--
--
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp=0;
--
--      TColStd_ListOfInteger LL;
--      anIObj->ToBeUpdated(LL);
--      TColStd_ListIteratorOfListOfInteger ITI(LL);
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--      anIObj->SetRecomputeOk();
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--    }
--  if(updateviewer) UpdateCurrentViewer();
-+  if (theIObj->Type() != AIS_KOI_Shape)
-+  {
-+    return;
-+  }
-+  if (theIObj->Signature() != 0)
-+  {
-+    return;
-+  }
-+  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
-+  aShape->SetHLRAngleAndDeviation (theAngle);
-+  redisplayPrsModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : SetHLRDeviationAngle
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetHLRDeviationAngle(
--                                     const Handle(AIS_InteractiveObject)& anIObj, 
--                                     const Standard_Real   anAngle,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                   const Standard_Real                  theAngle,
-+                                                   const Standard_Boolean               theToUpdateViewer)
- {
--//  cout<<" HLRAngle:"<< anAngle <<endl;
--  if(anIObj.IsNull()) return ;
-- 
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
--  if( anIObj->Type()!=AIS_KOI_Shape) return;
--  if(anIObj->Signature()!=0) return;
--  (*((Handle(AIS_Shape)*)&anIObj))->SetOwnHLRDeviationAngle(anAngle);
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp=0;
--      TColStd_ListOfInteger LL;
--      anIObj->ToBeUpdated(LL);
--      TColStd_ListIteratorOfListOfInteger ITI(LL);
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--      anIObj->SetRecomputeOk();
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--    }
--  if(updateviewer) UpdateCurrentViewer();
-+  // To be modified after the related methods of AIS_Shape are passed to InteractiveObject
-+  if (theIObj->Type() != AIS_KOI_Shape)
-+  {
-+    return;
-+  }
-+  if (theIObj->Signature() != 0)
-+  {
-+    return;
-+  }
-+  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (theIObj);
-+  aShape->SetOwnHLRDeviationAngle (theAngle);
-+  redisplayPrsModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : UnsetColor
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::UnsetColor(const Handle(AIS_InteractiveObject)& anIObj,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
-+                                         const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
--   anIObj->UnsetColor();
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp =0;
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--      anIObj->SetRecomputeOk();
--    }
--  if(updateviewer) 
--    UpdateCurrentViewer();
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+
-+  theIObj->UnsetColor();
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : HasColor
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::HasColor(const Handle(AIS_InteractiveObject)& anIObj) const 
-+Standard_Boolean AIS_InteractiveContext::HasColor (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  return anIObj->HasColor();
--
-+  return theIObj->HasColor();
- }
- //=======================================================================
- //function : Color
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Quantity_NameOfColor AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj) const 
-+Quantity_NameOfColor AIS_InteractiveContext::Color (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  return anIObj->Color();
-+  return theIObj->Color();
- }
--void AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj,
--                                   Quantity_Color &aColor) const
-+//=======================================================================
-+//function : Color
-+//purpose  :
-+//=======================================================================
-+void AIS_InteractiveContext::Color (const Handle(AIS_InteractiveObject)& theIObj,
-+                                    Quantity_Color&                      theColor) const
- {
--  anIObj->Color(aColor);
-+  theIObj->Color (theColor);
- }
- //=======================================================================
- //function : Width
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Real AIS_InteractiveContext::Width(const Handle(AIS_InteractiveObject)& anIObj) const 
-+Standard_Real AIS_InteractiveContext::Width (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  return anIObj->Width();
-+  return theIObj->Width();
- }
- //=======================================================================
- //function : SetWidth
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetWidth(const Handle(AIS_InteractiveObject)& anIObj,
--                                     const Standard_Real aValue,
--                                     const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
-+                                       const Standard_Real                  theWidth,
-+                                       const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
-- 
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  anIObj->SetWidth(aValue);
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      Standard_Integer NbDisp=0;
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--          NbDisp++;
--        }
--#ifdef OCCT_DEBUG
--      cout<<"nb of modes to recalculate : "<<NbDisp<<endl;
--#endif
--      anIObj->SetRecomputeOk();
--    }
--   if(updateviewer) 
--    UpdateCurrentViewer();
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+
-+  theIObj->SetWidth (theWidth);
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : UnsetWidth
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::UnsetWidth(const Handle(AIS_InteractiveObject)& anIObj,
--                                       const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
-+                                         const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
--   anIObj->UnsetWidth();
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--        }
--      anIObj->SetRecomputeOk();
--    }
--   if(updateviewer) 
--    UpdateCurrentViewer();
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+
-+  theIObj->UnsetWidth();
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : SetMaterial
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
-+                                          const Graphic3d_NameOfMaterial       theName,
-+                                          const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::SetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
--//POP pour K4L
--                                        const Graphic3d_NameOfMaterial aName,
--//                                      const Graphic3d_NameOfPhysicalMaterial aName,
--                                        const Standard_Boolean updateviewer)
--{
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  anIObj->SetMaterial(aName);
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--        }
--      anIObj->SetRecomputeOk();
--    }
--   if(updateviewer)
--    UpdateCurrentViewer();
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+  theIObj->SetMaterial (theName);
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : UnsetMaterial
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::UnsetMaterial(const Handle(AIS_InteractiveObject)& anIObj,
--                                          const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
-+                                            const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
--  anIObj->UnsetMaterial();
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--        }
--      anIObj->SetRecomputeOk();
--    }
--  if(updateviewer)
--    UpdateCurrentViewer();
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+  theIObj->UnsetMaterial();
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : SetTransparency
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
-+                                              const Standard_Real                  theValue,
-+                                              const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::SetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
--                                            const Standard_Real aValue,
--                                            const Standard_Boolean updateviewer)
--{
--  if(anIObj.IsNull()) return ;
--   if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--
--#ifdef BUC60577 //right optimization
--  if(!anIObj->IsTransparent() && aValue<=0.05) return;
--#else  
--//  if(!anIObj->IsTransparent() && aValue<=0.05) return;
--#endif
--  if(aValue<=0.05){
--    UnsetTransparency(anIObj,updateviewer);
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+
-+  if (!theIObj->IsTransparent()
-+    && theValue <= 0.05)
-+  {
-     return;
-   }
--  
--  if(!myMainVwr->Viewer()->Transparency())
--    myMainVwr->Viewer()->SetTransparency(Standard_True);
--  anIObj->SetTransparency(aValue);
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--        }
--      anIObj->SetRecomputeOk();
--    }
--   if(updateviewer)
--    UpdateCurrentViewer();
-+
-+  if (theValue <= 0.05)
-+  {
-+    UnsetTransparency (theIObj, theToUpdateViewer);
-+    return;
-+  }
-+
-+  theIObj->SetTransparency (theValue);
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : UnsetTransparency
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::UnsetTransparency(const Handle(AIS_InteractiveObject)& anIObj,
--                                              const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
--   anIObj->UnsetTransparency();
--  if(anIObj->RecomputeEveryPrs())
--    anIObj->Redisplay();
--  else
--    {
--      TColStd_ListIteratorOfListOfInteger ITI(anIObj->ListOfRecomputeModes());
--      for (;ITI.More();ITI.Next())
--        {
--          anIObj->Update(ITI.Value(),Standard_False);
--        }
--      anIObj->SetRecomputeOk();
--    }
--
--  // To Unset transparency in the viewer, if no other object is transparent ...(Speed)
--  AIS_DataMapIteratorOfDataMapOfIOStatus It(myObjects);
--  Standard_Boolean FoundTransp(Standard_False);
--  for(;It.More() && !FoundTransp ;It.Next()){
--    if(It.Key()->IsTransparent())
--      FoundTransp = Standard_True;
-+  if (theIObj.IsNull())
-+  {
-+    return;
-   }
--  if(!FoundTransp)
--    myMainVwr->Viewer()->SetTransparency(Standard_False);
--  
--  
--  if(updateviewer)
--    UpdateCurrentViewer();
-+
-+  theIObj->UnsetTransparency();
-+  redisplayPrsRecModes (theIObj, theToUpdateViewer);
- }
--//=======================================================================
--//function : SetSelectedAspect
--//purpose  : 
--//=======================================================================
--void AIS_InteractiveContext::SetSelectedAspect(
--                                const Handle(Prs3d_BasicAspect)& anAspect,
--                                const Standard_Boolean globalChange,
--                                const Standard_Boolean updateViewer)
--{
--  if( !HasOpenedContext() ) {
--    Standard_Boolean found = Standard_False;
--    Handle(AIS_Selection) sel = 
--                AIS_Selection::Selection(myCurrentName.ToCString());
--    Handle(AIS_InteractiveObject) object;
--    for( sel->Init() ; sel->More() ; sel->Next()) {
--      found = Standard_True;
--      object = Handle(AIS_InteractiveObject)::DownCast(sel->Value());
--      object->SetAspect(anAspect,globalChange);
--    }
--    if( found && updateViewer) {
--      myMainVwr->Update();
--    }
-+//=======================================================================
-+//function : SetSelectedAspect
-+//purpose  :
-+//=======================================================================
-+void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
-+                                                const Standard_Boolean           theIsGlobalChange,
-+                                                const Standard_Boolean           theToUpdateViewer)
-+{
-+  if (HasOpenedContext())
-+  {
-+    return;
-+  }
-+
-+  Standard_Boolean isFound = Standard_False;
-+  Handle(AIS_Selection) aSelIter = AIS_Selection::Selection (myCurrentName.ToCString());
-+  for (aSelIter->Init(); aSelIter->More(); aSelIter->Next())
-+  {
-+    isFound = Standard_True;
-+    Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (aSelIter->Value());
-+    anObj->SetAspect (theAspect, theIsGlobalChange);
-+  }
-+
-+  if (isFound
-+   && theToUpdateViewer)
-+  {
-+    myMainVwr->Update();
-   }
- }
- //=======================================================================
- //function : SetLocalAttributes
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                 const Handle(AIS_Drawer)&            theDrawer,
-+                                                 const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::SetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj, 
--                                                const Handle(AIS_Drawer)& aDrawer,
--                                                const Standard_Boolean updateviewer)
--{
--  if(anIObj.IsNull()) return ;
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  anIObj->SetAttributes(aDrawer);
--  Update(anIObj,updateviewer);
--  
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+
-+  theIObj->SetAttributes (theDrawer);
-+  Update (theIObj, theToUpdateViewer);
- }
- //=======================================================================
- //function : UnsetLocalAttributes
--//purpose  : 
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::UnsetLocalAttributes(const Handle(AIS_InteractiveObject)& anIObj,
--                                                  const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                   const Standard_Boolean               theToUpdateViewer)
- {
--  if(anIObj.IsNull()) return ;
--  if(!anIObj->HasInteractiveContext())
--    anIObj->SetContext(this);
--  anIObj->UnsetAttributes();
--  Update(anIObj,updateviewer);
--}
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
-+  if (!theIObj->HasInteractiveContext())
-+  {
-+    theIObj->SetContext (this);
-+  }
-+  theIObj->UnsetAttributes();
-+  Update (theIObj, theToUpdateViewer);
-+}
- //=======================================================================
- //function : Status
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::Status(const Handle(AIS_InteractiveObject)& anIObj, TCollection_ExtendedString& astatus) const 
-+void AIS_InteractiveContext::Status (const Handle(AIS_InteractiveObject)& theIObj,
-+                                     TCollection_ExtendedString&          theStatus) const
- {
--  astatus = "";
-+  theStatus = "";
-+  if (theIObj.IsNull()
-+  || !myObjects.IsBound (theIObj))
-+  {
-+    return;
-+  }
--  if(anIObj.IsNull()) return ;
--  if(myObjects.IsBound(anIObj)){
--    astatus += "\t ____________________________________________";
--    astatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
--    const Handle(AIS_GlobalStatus)& ST = myObjects(anIObj);
--    switch(ST->GraphicStatus()){
-+  theStatus += "\t ____________________________________________";
-+  theStatus += "\t| Known at Neutral Point:\n\tDisplayStatus:";
-+  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
-+  switch (aStatus->GraphicStatus())
-+  {
-     case AIS_DS_Displayed:
--      {
--        astatus +="\t| -->Displayed\n";
--        break;
--      }
--    case AIS_DS_Erased:
--      {
--        astatus +="\t| -->Erased\n";
--        break;
--      }
--    default:
-+    {
-+      theStatus += "\t| -->Displayed\n";
-       break;
-     }
--    astatus += "\t| Active Display Modes in the MainViewer :\n";
--    TColStd_ListIteratorOfListOfInteger ItL (ST->DisplayedModes());
--    for(;ItL.More();ItL.Next()){
--      astatus += "\t|\t Mode ";
--      astatus += TCollection_AsciiString(ItL.Value());
--      astatus+="\n";
--    }   
--    if(IsCurrent(anIObj)) astatus +="\t| Current\n";
--    if(IsSelected(anIObj)) astatus +="\t| Selected\n";
--
--    astatus += "\t| Active Selection Modes in the MainViewer :\n";
--    for(ItL.Initialize(ST->SelectionModes());ItL.More();ItL.Next()){
--      astatus += "\t\t Mode ";
--      astatus += TCollection_AsciiString(ItL.Value());
--      astatus+="\n";
--    }   
--    astatus += "\t ____________________________________________";
--      
-+    case AIS_DS_Erased:
-+    {
-+      theStatus += "\t| -->Erased\n";
-+      break;
-     }
--}
-+    default:
-+      break;
-+  }
-+  theStatus += "\t| Active Display Modes in the MainViewer :\n";
-+  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
-+  {
-+    theStatus += "\t|\t Mode ";
-+    theStatus += TCollection_AsciiString (aDispModeIter.Value());
-+    theStatus += "\n";
-+  }
-+  if (IsCurrent (theIObj))  theStatus +="\t| Current\n";
-+  if (IsSelected(theIObj)) theStatus +="\t| Selected\n";
-+
-+  theStatus += "\t| Active Selection Modes in the MainViewer :\n";
-+  for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
-+  {
-+    theStatus += "\t\t Mode ";
-+    theStatus += TCollection_AsciiString (aSelModeIter.Value());
-+    theStatus += "\n";
-+  }
-+  theStatus += "\t ____________________________________________";
-+}
- //=======================================================================
- //function : GetDefModes
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::GetDefModes (const Handle(AIS_InteractiveObject)& theIObj,
-+                                          Standard_Integer&                    theDispMode,
-+                                          Standard_Integer&                    theHiMode,
-+                                          Standard_Integer&                    theSelMode) const
-+{
-+  if (theIObj.IsNull())
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::GetDefModes(const Handle(AIS_InteractiveObject)& anIObj,
--                                     Standard_Integer& DispMode,
--                                     Standard_Integer& HiMode,
--                                     Standard_Integer& SelMode) const 
--{
--  if(anIObj.IsNull()) return ;
--  DispMode = anIObj->HasDisplayMode() ? anIObj->DisplayMode() : 
--  (anIObj->AcceptDisplayMode(myDisplayMode)? myDisplayMode : 0);
--  
--  HiMode = anIObj->HasHilightMode()? anIObj->HilightMode():DispMode;
--#ifdef BUC61051
--  SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : -1;
--#else
--  SelMode = anIObj->HasSelectionMode()? anIObj->SelectionMode() : 0;
--#endif
-+  theDispMode = theIObj->HasDisplayMode()
-+              ? theIObj->DisplayMode()
-+              : (theIObj->AcceptDisplayMode (myDisplayMode)
-+               ? myDisplayMode
-+               : 0);
-+  theHiMode  = theIObj->HasHilightMode()   ? theIObj->HilightMode()   : theDispMode;
-+  theSelMode = theIObj->HasSelectionMode() ? theIObj->SelectionMode() : -1;
- }
--
- //=======================================================================
- //function : EraseGlobal
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::EraseGlobal(const Handle(AIS_InteractiveObject)& anIObj, 
--                                         const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
-+                                          const Standard_Boolean               theToUpdateviewer)
- {
--  if(anIObj.IsNull()) return ;
--  if(!myObjects.IsBound(anIObj)) return;
-+  if (theIObj.IsNull()
-+  || !myObjects.IsBound (theIObj))
-+  {
-+    return;
-+  }
--  // CLE
--  // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--  Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--  // ENDCLE
--  Standard_Integer Dmode = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0;
--  if(STATUS->GraphicStatus()==AIS_DS_Displayed){
--    
--    TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
--    for(;ItL.More();ItL.Next()){
--      if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
--        myMainPM->Unhighlight(anIObj,ItL.Value());
--      myMainPM->SetVisibility (anIObj, ItL.Value(), Standard_False);
-+  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+
-+  Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
-+  if (aStatus->GraphicStatus() == AIS_DS_Displayed)
-+  {
-+    for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
-+    {
-+      if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
-+      {
-+        myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
-+      }
-+      myMainPM->SetVisibility (theIObj, aDispModeIter.Value(), Standard_False);
-+    }
-+
-+    if (IsCurrent (theIObj)
-+    && !aStatus->IsDModeIn (aDispMode))
-+    {
-+      myMainPM->SetVisibility (theIObj, aDispMode, Standard_False);
-+    }
-+
-+    for (TColStd_ListIteratorOfListOfInteger aSelModeIter (aStatus->SelectionModes()); aSelModeIter.More(); aSelModeIter.Next())
-+    {
-+      mgrSelector->Deactivate (theIObj, aSelModeIter.Value(), myMainSel);
-+    }
-+
-+    if (theToUpdateviewer)
-+    {
-+      myMainVwr->Update();
-     }
--    if(IsCurrent(anIObj) && !STATUS->IsDModeIn(Dmode))
--      myMainPM->SetVisibility (anIObj, Dmode, Standard_False);
--    
--    for(ItL.Initialize(STATUS->SelectionModes());ItL.More();ItL.Next())
--      mgrSelector->Deactivate(anIObj,ItL.Value(),myMainSel);
--    if(updateviewer) myMainVwr->Update();
-   }
--  STATUS->SetGraphicStatus(AIS_DS_Erased);
--  
-+  aStatus->SetGraphicStatus (AIS_DS_Erased);
- }
- //=======================================================================
- //function : ClearGlobal
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::ClearGlobal(const Handle(AIS_InteractiveObject)& anIObj, 
--                                         const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
-+                                          const Standard_Boolean               theToUpdateviewer)
- {
--  if(anIObj.IsNull()) return ;
--  if(!myObjects.IsBound(anIObj)) return;
--  // CLE
--  // const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--  Handle(AIS_GlobalStatus) STATUS = myObjects(anIObj);
--  // ENDCLE
--   TColStd_ListIteratorOfListOfInteger ItL (STATUS->DisplayedModes());
--   for(;ItL.More();ItL.Next()){
--     if(STATUS->IsHilighted()){
--       if(IsCurrent(anIObj))
--#ifdef OCC204
--         AddOrRemoveCurrentObject( anIObj, updateviewer );
--#else
--         AddOrRemoveCurrentObject(anIObj);
--#endif
--       else if(myMainPM->IsHighlighted(anIObj,ItL.Value()))
--         myMainPM->Unhighlight(anIObj,ItL.Value());
--     }
--     myMainPM->Erase(anIObj,ItL.Value());
--     myMainPM->Clear(anIObj,ItL.Value());
--     if(anIObj->HasHilightMode()){
--       Standard_Integer im = anIObj->HilightMode();
--       myMainPM->Unhighlight(anIObj,im);
--       myMainPM->Erase(anIObj,im);
--  
--     }
--   }
-+  if (theIObj.IsNull()
-+  || !myObjects.IsBound (theIObj))
-+  {
-+    return;
-+  }
-+
-+  Handle(AIS_GlobalStatus) aStatus = myObjects (theIObj);
-+  for (TColStd_ListIteratorOfListOfInteger aDispModeIter (aStatus->DisplayedModes()); aDispModeIter.More(); aDispModeIter.Next())
-+  {
-+    if (aStatus->IsHilighted())
-+    {
-+      if (IsCurrent (theIObj))
-+      {
-+        AddOrRemoveCurrentObject (theIObj, theToUpdateviewer);
-+      }
-+      else if (myMainPM->IsHighlighted (theIObj, aDispModeIter.Value()))
-+      {
-+        myMainPM->Unhighlight (theIObj, aDispModeIter.Value());
-+      }
-+    }
-+    myMainPM->Erase (theIObj, aDispModeIter.Value());
-+    myMainPM->Clear (theIObj, aDispModeIter.Value());
-+    if (theIObj->HasHilightMode())
-+    {
-+      Standard_Integer im = theIObj->HilightMode();
-+      myMainPM->Unhighlight (theIObj, im);
-+      myMainPM->Erase       (theIObj, im);
-+    }
-+  }
--  //Object removes from Detected sequence
--  Standard_Integer i = 1;
--  for(i = 1; i < myAISDetectedSeq.Length(); i++)
-+  // Object removes from Detected sequence
-+  for(Standard_Integer aDetIter = 1; aDetIter < myAISDetectedSeq.Length(); ++aDetIter)
-   {
-     Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
--    if( !anObj.IsNull() && anObj != anIObj )
--      myAISDetectedSeq.Remove( i );
-+    if (!anObj.IsNull()
-+      && anObj != theIObj)
-+    {
-+      myAISDetectedSeq.Remove (aDetIter);
-+    }
-   }
--  if(myLastinMain == anIObj)
-+  if (myLastinMain == theIObj)
-+  {
-     myLastinMain.Nullify();
--
--  if(myLastPicked == anIObj)
-+  }
-+  if (myLastPicked == theIObj)
-+  {
-     myLastPicked.Nullify();
-+  }
-+
-+  // remove IO from the selection manager to avoid memory leaks
-+  mgrSelector->Remove (theIObj);
--  // OCC21671: Remove IO from the selection manager in any case
--  // to avoid memory leaks
--  mgrSelector->Remove(anIObj);
-+  myObjects.UnBind (theIObj);
--  if (updateviewer && (STATUS->GraphicStatus() == AIS_DS_Displayed))
-+  if (theToUpdateviewer
-+   && aStatus->GraphicStatus() == AIS_DS_Displayed)
-   {
-     myMainVwr->Update();
-   }
--
--  myObjects.UnBind(anIObj);
--  
- }
- //=======================================================================
- //function : ClearGlobalPrs
--//purpose  : 
-+//purpose  :
- //=======================================================================
-+void AIS_InteractiveContext::ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theIObj,
-+                                             const Standard_Integer               theMode,
-+                                             const Standard_Boolean               theToUpdateViewer)
-+{
-+  if (theIObj.IsNull()
-+  || !myObjects.IsBound (theIObj))
-+  {
-+    return;
-+  }
--void AIS_InteractiveContext::ClearGlobalPrs(const Handle(AIS_InteractiveObject)& anIObj, 
--                                            const Standard_Integer aMode,
--                                            const Standard_Boolean updateviewer)
--{
--  if(anIObj.IsNull()) return ;
--  if(!myObjects.IsBound(anIObj)) return;
--  const Handle(AIS_GlobalStatus)& STATUS = myObjects(anIObj);
--  
--  Standard_Integer DM = anIObj->HasHilightMode() ? anIObj->HilightMode() : 0; 
--  if(STATUS->IsDModeIn(aMode)){
--    if(DM==aMode && myMainPM->IsHighlighted(anIObj,aMode))
--      myMainPM->Unhighlight(anIObj,aMode);
--    
--    myMainPM->Erase(anIObj,aMode);
--    myMainPM->Clear(anIObj,aMode);
-+  const Handle(AIS_GlobalStatus)& aStatus = myObjects (theIObj);
-+  if (aStatus->IsDModeIn (theMode))
-+  {
-+    const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
-+    if (aDispMode == theMode
-+     && myMainPM->IsHighlighted (theIObj, theMode))
-+    {
-+      myMainPM->Unhighlight (theIObj, theMode);
-+    }
-+
-+    myMainPM->Erase (theIObj, theMode);
-+    myMainPM->Clear (theIObj, theMode);
-   }
--  
--  if(STATUS->GraphicStatus()==AIS_DS_Displayed && updateviewer)
-+  if (aStatus->GraphicStatus() == AIS_DS_Displayed
-+   && theToUpdateViewer)
-+  {
-     myMainVwr->Update();
-+  }
- }
- //=======================================================================
- //function : DrawHiddenLine
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::DrawHiddenLine () const {
--
-+Standard_Boolean AIS_InteractiveContext::DrawHiddenLine() const
-+{
-   return myDefaultDrawer->DrawHiddenLine();
- }
- //=======================================================================
- //function : EnableDrawHiddenLine
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::EnableDrawHiddenLine () const {
-+void AIS_InteractiveContext::EnableDrawHiddenLine() const
-+{
-   myDefaultDrawer->EnableDrawHiddenLine();
- }
- //=======================================================================
- //function : DisableDrawHiddenLine 
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::DisableDrawHiddenLine () const {
-+void AIS_InteractiveContext::DisableDrawHiddenLine() const
-+{
-   myDefaultDrawer->DisableDrawHiddenLine();
- }
- //=======================================================================
- //function : HiddenLineAspect
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Handle (Prs3d_LineAspect) AIS_InteractiveContext::HiddenLineAspect () const  {
-+Handle (Prs3d_LineAspect) AIS_InteractiveContext::HiddenLineAspect() const
-+{
-   return myDefaultDrawer->HiddenLineAspect();
- }
- //=======================================================================
- //function : SetHiddenLineAspect
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) const {
--  myDefaultDrawer->SetHiddenLineAspect(anAspect);
-+void AIS_InteractiveContext::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) const
-+{
-+  myDefaultDrawer->SetHiddenLineAspect (theAspect);
- }
- //=======================================================================
- //function : SetIsoNumber
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetIsoNumber(const Standard_Integer Nb,const AIS_TypeOfIso Type)
-+void AIS_InteractiveContext::SetIsoNumber (const Standard_Integer theNb,
-+                                           const AIS_TypeOfIso    theType)
- {
--  switch(Type){
--  case AIS_TOI_IsoU:
--    myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
--    break;
--  case AIS_TOI_IsoV:
--    myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
--    break;
--  case AIS_TOI_Both:
--    myDefaultDrawer->UIsoAspect()->SetNumber(Nb);
--    myDefaultDrawer->VIsoAspect()->SetNumber(Nb);
--    break;
-- 
-+  switch (theType)
-+  {
-+    case AIS_TOI_IsoU:
-+      myDefaultDrawer->UIsoAspect()->SetNumber (theNb);
-+      break;
-+    case AIS_TOI_IsoV:
-+      myDefaultDrawer->VIsoAspect()->SetNumber (theNb);
-+      break;
-+    case AIS_TOI_Both:
-+      myDefaultDrawer->UIsoAspect()->SetNumber (theNb);
-+      myDefaultDrawer->VIsoAspect()->SetNumber (theNb);
-+      break;
-   }
- }
-+
- //=======================================================================
- //function : IsoNumber
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Integer AIS_InteractiveContext::IsoNumber(const AIS_TypeOfIso Type)
-+Standard_Integer AIS_InteractiveContext::IsoNumber (const AIS_TypeOfIso theType)
- {
--  
--  switch(Type){
--  case AIS_TOI_IsoU:
--    return myDefaultDrawer->UIsoAspect()->Number();
--  case AIS_TOI_IsoV:
--    return myDefaultDrawer->VIsoAspect()->Number();
--  case AIS_TOI_Both:
--    return (myDefaultDrawer->UIsoAspect()->Number()==
--            myDefaultDrawer->VIsoAspect()->Number()) ? 
--              myDefaultDrawer->UIsoAspect()->Number(): -1;
-+  switch (theType)
-+  {
-+    case AIS_TOI_IsoU: return myDefaultDrawer->UIsoAspect()->Number();
-+    case AIS_TOI_IsoV: return myDefaultDrawer->VIsoAspect()->Number();
-+    case AIS_TOI_Both: return myDefaultDrawer->UIsoAspect()->Number() == myDefaultDrawer->VIsoAspect()->Number()
-+                            ? myDefaultDrawer->UIsoAspect()->Number()
-+                            : -1;
-   }
-   return 0;
- }
- //=======================================================================
- //function : IsoOnPlane
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::IsoOnPlane(const Standard_Boolean SwitchOn)
-+void AIS_InteractiveContext::IsoOnPlane (const Standard_Boolean theToSwitchOn)
- {
--  myDefaultDrawer->SetIsoOnPlane(SwitchOn);
-+  myDefaultDrawer->SetIsoOnPlane (theToSwitchOn);
- }
- //=======================================================================
- //function : IsoOnPlane
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const 
-+Standard_Boolean AIS_InteractiveContext::IsoOnPlane() const
- {
-   return myDefaultDrawer->IsoOnPlane();
- }
- //=======================================================================
- //function : SetSelectionMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetSelectionMode(const Handle(AIS_InteractiveObject)&, const Standard_Integer )
-+void AIS_InteractiveContext::SetSelectionMode (const Handle(AIS_InteractiveObject)& ,
-+                                               const Standard_Integer )
- {
-+  //
- }
- //=======================================================================
- //function : UnsetSelectionMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::UnsetSelectionMode(const Handle(AIS_InteractiveObject)&)
-+void AIS_InteractiveContext::UnsetSelectionMode (const Handle(AIS_InteractiveObject)& )
- {
-+  //
- }
- //=======================================================================
- //function : SetSensitivityMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetSensitivityMode(const StdSelect_SensitivityMode aMode) {
--
--  if( HasOpenedContext() )
--        myLocalContexts(myCurLocalIndex)->SetSensitivityMode(aMode);
--  else {
--    myMainSel->SetSensitivityMode(aMode);
-+void AIS_InteractiveContext::SetSensitivityMode (const StdSelect_SensitivityMode theMode)
-+{
-+  if (HasOpenedContext())
-+  {
-+    myLocalContexts (myCurLocalIndex)->SetSensitivityMode (theMode);
-+  }
-+  else
-+  {
-+    myMainSel->SetSensitivityMode (theMode);
-   }
- }
- //=======================================================================
- //function : SensitivityMode
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const {
--
--  if( HasOpenedContext() )
--        return myLocalContexts(myCurLocalIndex)->SensitivityMode();
--  return myMainSel->SensitivityMode();
-+StdSelect_SensitivityMode AIS_InteractiveContext::SensitivityMode() const
-+{
-+  return HasOpenedContext()
-+       ? myLocalContexts (myCurLocalIndex)->SensitivityMode()
-+       : myMainSel->SensitivityMode();
- }
- //=======================================================================
- //function : SetSensitivity
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetSensitivity(const Standard_Real aPrecision) {
--
--  if( HasOpenedContext() )
--        myLocalContexts(myCurLocalIndex)->SetSensitivity(aPrecision);
--  else {
--    myMainSel->SetSensitivity(aPrecision);
-+void AIS_InteractiveContext::SetSensitivity (const Standard_Real thePrecision)
-+{
-+  if (HasOpenedContext())
-+  {
-+    myLocalContexts(myCurLocalIndex)->SetSensitivity (thePrecision);
-+  }
-+  else
-+  {
-+    myMainSel->SetSensitivity (thePrecision);
-   }
- }
- //=======================================================================
- //function : Sensitivity
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Real AIS_InteractiveContext::Sensitivity() const {
--
--  if( HasOpenedContext() )
--        return myLocalContexts(myCurLocalIndex)->Sensitivity();
--  return myMainSel->Sensitivity();
-+Standard_Real AIS_InteractiveContext::Sensitivity() const
-+{
-+  return HasOpenedContext()
-+       ? myLocalContexts(myCurLocalIndex)->Sensitivity()
-+       : myMainSel->Sensitivity();
- }
- //=======================================================================
- //function : SetPixelTolerance
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetPixelTolerance(const Standard_Integer aPrecision) {
--
--  if( HasOpenedContext() )
--        myLocalContexts(myCurLocalIndex)->SetPixelTolerance(aPrecision);
--  else {
--    myMainSel->SetPixelTolerance(aPrecision);
-+void AIS_InteractiveContext::SetPixelTolerance (const Standard_Integer thePrecision)
-+{
-+  if (HasOpenedContext())
-+  {
-+    myLocalContexts (myCurLocalIndex)->SetPixelTolerance (thePrecision);
-+  }
-+  else
-+  {
-+    myMainSel->SetPixelTolerance (thePrecision);
-   }
- }
- //=======================================================================
- //function : PixelTolerance
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Integer AIS_InteractiveContext::PixelTolerance() const {
--
--  if( HasOpenedContext() )
--        return myLocalContexts(myCurLocalIndex)->PixelTolerance();
--  return myMainSel->PixelTolerance();
-+Standard_Integer AIS_InteractiveContext::PixelTolerance() const
-+{
-+  return HasOpenedContext()
-+       ? myLocalContexts (myCurLocalIndex)->PixelTolerance()
-+       : myMainSel->PixelTolerance();
- }
- //=======================================================================
- //function : IsInLocal
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::IsInLocal(const Handle(AIS_InteractiveObject)& anIObj,
--                                                   Standard_Integer& TheIndex) const 
-+Standard_Boolean AIS_InteractiveContext::IsInLocal (const Handle(AIS_InteractiveObject)& theIObj,
-+                                                    Standard_Integer&                    theIndex) const
- {
--  if(anIObj.IsNull()) return Standard_False;
-+  if (theIObj.IsNull())
-+  {
-+    return Standard_False;
-+  }
-+
-   // if it exists at neutral point 0 index is returned
--  if(myObjects.IsBound(anIObj)) {
--    TheIndex = 0;
-+  if (myObjects.IsBound (theIObj))
-+  {
-+    theIndex = 0;
-     return Standard_False;
-   }
--  for(Standard_Integer I=1;I<=myLocalContexts.Extent();I++){
--    if(myLocalContexts.IsBound(I)){
--      if(myLocalContexts(I)->IsIn(anIObj)){
--        TheIndex = I;
-+
-+  for (Standard_Integer aCtxIter = 1; aCtxIter <= myLocalContexts.Extent(); ++aCtxIter)
-+  {
-+    if (myLocalContexts.IsBound (aCtxIter))
-+    {
-+      if(myLocalContexts (aCtxIter)->IsIn (theIObj))
-+      {
-+        theIndex = aCtxIter;
-         return Standard_True;
--        
-       }
-     }
-   }
--  TheIndex =-1;
-+  theIndex = -1;
-   return Standard_False;
--}  
--  
-+}
-+
- //=======================================================================
- //function : InitAttributes
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
- void AIS_InteractiveContext::InitAttributes()
- {
--
--  mgrSelector->Add(myMainSel);
-+  mgrSelector->Add (myMainSel);
-   myCurrentName   = AIS_Context_NewCurName();
-   mySelectionName = AIS_Context_NewSelName();
--  AIS_Selection::CreateSelection(mySelectionName.ToCString());
--  AIS_Selection::CreateSelection(myCurrentName.ToCString());
-+  AIS_Selection::CreateSelection (mySelectionName.ToCString());
-+  AIS_Selection::CreateSelection (myCurrentName.ToCString());
--  
--  myDefaultDrawer->SetShadingAspectGlobal(Standard_False);
--  Graphic3d_MaterialAspect aMat(Graphic3d_NOM_BRASS);
--  myDefaultDrawer->ShadingAspect()->SetMaterial(aMat);
-+  myDefaultDrawer->SetShadingAspectGlobal (Standard_False);
-+  Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
-+  myDefaultDrawer->ShadingAspect()->SetMaterial (aMat);
- //  myDefaultDrawer->ShadingAspect()->SetColor(Quantity_NOC_GRAY70);
--  Handle (Prs3d_LineAspect) HLA = myDefaultDrawer->HiddenLineAspect();
--  HLA->SetColor(Quantity_NOC_GRAY20);
--  HLA->SetWidth(1);
--  HLA->SetTypeOfLine(Aspect_TOL_DASH);
-+  Handle(Prs3d_LineAspect) aLineAspect = myDefaultDrawer->HiddenLineAspect();
-+  aLineAspect->SetColor      (Quantity_NOC_GRAY20);
-+  aLineAspect->SetWidth      (1.0);
-+  aLineAspect->SetTypeOfLine (Aspect_TOL_DASH);
-   // tolerance to 4 pixels...
-   SetPixelTolerance();
-   // Customizing the drawer for trihedrons and planes...
--
--  Handle (Prs3d_DatumAspect) DA = myDefaultDrawer->DatumAspect();
--  Standard_Real aLength(100.);
--  DA->SetAxisLength(aLength,aLength,aLength);
--  Quantity_NameOfColor col = Quantity_NOC_LIGHTSTEELBLUE4;
--  DA->FirstAxisAspect()->SetColor(col);
--  DA->SecondAxisAspect()->SetColor(col);
--  DA->ThirdAxisAspect()->SetColor(col);
--
--  Handle(Prs3d_PlaneAspect)PA = myDefaultDrawer->PlaneAspect();
--  aLength =200.;
--  PA->SetPlaneLength(aLength,aLength);
--  PA->EdgesAspect()->SetColor(Quantity_NOC_SKYBLUE);
--  
--
-+  Handle(Prs3d_DatumAspect) aTrihAspect = myDefaultDrawer->DatumAspect();
-+  const Standard_Real aLength = 100.0;
-+  aTrihAspect->SetAxisLength (aLength, aLength, aLength);
-+  const Quantity_NameOfColor aColor = Quantity_NOC_LIGHTSTEELBLUE4;
-+  aTrihAspect->FirstAxisAspect() ->SetColor (aColor);
-+  aTrihAspect->SecondAxisAspect()->SetColor (aColor);
-+  aTrihAspect->ThirdAxisAspect() ->SetColor (aColor);
-+
-+  Handle(Prs3d_PlaneAspect) aPlaneAspect = myDefaultDrawer->PlaneAspect();
-+  const Standard_Real aPlaneLength = 200.0;
-+  aPlaneAspect->SetPlaneLength (aPlaneLength, aPlaneLength);
-+  aPlaneAspect->EdgesAspect()->SetColor (Quantity_NOC_SKYBLUE);
- }
--
- //=======================================================================
- //function : TrihedronSize
--//purpose  : 
-+//purpose  :
- //=======================================================================
- Standard_Real AIS_InteractiveContext::TrihedronSize() const
- {
-   return myDefaultDrawer->DatumAspect()->FirstAxisLength();
- }
-+
- //=======================================================================
- //function : SetTrihedronSize
--//purpose  : 
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::SetTrihedronSize(const Standard_Real aVal,const Standard_Boolean /*updateviewer*/)
-+void AIS_InteractiveContext::SetTrihedronSize (const Standard_Real    theVal,
-+                                               const Standard_Boolean /*updateviewer*/)
- {
--  myDefaultDrawer->DatumAspect()->SetAxisLength(aVal,aVal,aVal);
--  Redisplay(AIS_KOI_Datum,3,Standard_False);
--  Redisplay(AIS_KOI_Datum,4,Standard_True);
-+  myDefaultDrawer->DatumAspect()->SetAxisLength (theVal, theVal, theVal);
-+  Redisplay (AIS_KOI_Datum, 3, Standard_False);
-+  Redisplay (AIS_KOI_Datum, 4, Standard_True);
- }
--
--
- //=======================================================================
- //function : SetPlaneSize
--//purpose  : 
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aValX,
--                                          const Standard_Real aValY,
-+void AIS_InteractiveContext::SetPlaneSize(const Standard_Real    theValX,
-+                                          const Standard_Real    theValY,
-                                           const Standard_Boolean /*updateviewer*/)
- {
--  myDefaultDrawer->PlaneAspect()->SetPlaneLength(aValX,aValY);
--  Redisplay(AIS_KOI_Datum,7);
-+  myDefaultDrawer->PlaneAspect()->SetPlaneLength (theValX, theValY);
-+  Redisplay (AIS_KOI_Datum, 7);
- }
- //=======================================================================
- //function : SetPlaneSize
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--void AIS_InteractiveContext::SetPlaneSize(const Standard_Real aVal,
--                                          const Standard_Boolean updateviewer)
-+void AIS_InteractiveContext::SetPlaneSize (const Standard_Real    theVal,
-+                                           const Standard_Boolean theToUpdateViewer)
- {
--  SetPlaneSize(aVal,aVal,updateviewer);
-+  SetPlaneSize (theVal, theVal, theToUpdateViewer);
- }
- //=======================================================================
- //function : PlaneSize
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
--Standard_Boolean AIS_InteractiveContext::PlaneSize(Standard_Real& LX,Standard_Real& LY) const
-+Standard_Boolean AIS_InteractiveContext::PlaneSize (Standard_Real& theX,
-+                                                    Standard_Real& theY) const
- {
--  LX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
--  LY =  myDefaultDrawer->PlaneAspect()->PlaneYLength();
--  return (Abs(LX-LY)<=Precision::Confusion());
-+  theX = myDefaultDrawer->PlaneAspect()->PlaneXLength();
-+  theY = myDefaultDrawer->PlaneAspect()->PlaneYLength();
-+  return (Abs (theX - theY) <= Precision::Confusion());
- }
--
--
- //=======================================================================
--//function :
--//purpose  : 
-+//function : SetAutoActivateSelection
-+//purpose  :
- //=======================================================================
--void AIS_InteractiveContext::SetAutoActivateSelection( const Standard_Boolean Auto )
-+void AIS_InteractiveContext::SetAutoActivateSelection (const Standard_Boolean theIsAuto)
- {
--  myIsAutoActivateSelMode = Auto;
-+  myIsAutoActivateSelMode = theIsAuto;
- }
- //=======================================================================
--//function :
--//purpose  : 
-+//function : GetAutoActivateSelection
-+//purpose  :
- //=======================================================================
- Standard_Boolean AIS_InteractiveContext::GetAutoActivateSelection() const
- {
-@@ -2837,13 +2721,12 @@
- //=======================================================================
- //function : SetZLayer
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
- void AIS_InteractiveContext::SetZLayer (const Handle(AIS_InteractiveObject)& theIObj,
-                                         const Standard_Integer theLayerId)
- {
--  if (theIObj.IsNull ())
-+  if (theIObj.IsNull())
-     return;
-   if (myObjects.IsBound (theIObj))
-@@ -2853,7 +2736,7 @@
-       theIObj->SetZLayer (myMainPM, theLayerId);
-     }
-   }
--  else if (HasOpenedContext ())
-+  else if (HasOpenedContext())
-   {
-     myLocalContexts (myCurLocalIndex)->SetZLayer (theIObj, theLayerId);
-   }
-@@ -2861,19 +2744,18 @@
- //=======================================================================
- //function : GetZLayer
--//purpose  : 
-+//purpose  :
- //=======================================================================
--
- Standard_Integer AIS_InteractiveContext::GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const
- {
--  if (theIObj.IsNull ())
-+  if (theIObj.IsNull())
-     return -1;
-   if (myObjects.IsBound (theIObj))
-   {
-     return theIObj->GetZLayer (myMainPM);
-   }
--  else if (HasOpenedContext ())
-+  else if (HasOpenedContext())
-   {
-     return myLocalContexts (myCurLocalIndex)->GetZLayer (theIObj);
-   }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext_1.cxx OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext_1.cxx
---- OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext_1.cxx      2014-11-11 17:46:38.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext_1.cxx        2015-01-16 13:01:23.000000000 +0300
-@@ -153,6 +153,7 @@
-   {
-     if (mylastindex != 0 && mylastindex <= myMapOfOwner.Extent())
-     {
-+      myMainPM->ClearImmediateDraw();
-       Unhilight (myMapOfOwner (mylastindex), theView);
-       if (theToRedrawImmediate)
-       {
-@@ -376,6 +377,7 @@
-     if(myAutoHilight)
-     {
-+      myMainPM->ClearImmediateDraw();
-       const Handle(V3d_Viewer)& aViewer = myCTX->CurrentViewer();
-       for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
-       {
-@@ -545,7 +547,6 @@
-     return;
-   }
--  myMainPM->ClearImmediateDraw();
-   const Standard_Integer aHilightMode = GetHiMod (Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable()));
-   if (IsSelected (theOwner))
-   {
-@@ -1044,6 +1045,10 @@
-   myMapOfOwner.Clear();
-   myMapOfOwner.Assign (anOwnersToKeep);
-   mylastindex = myMapOfOwner.FindIndex (aLastPicked);
-+  if (!IsValidIndex (mylastindex))
-+  {
-+    myMainPM->ClearImmediateDraw();
-+  }
-   if (!isAISRemainsDetected)
-   {
-@@ -1197,6 +1202,7 @@
- {
-   if (thePickOwner.IsNull())
-   {
-+    myMainPM->ClearImmediateDraw();
-     if (theToRedrawImmediate)
-     {
-       theView->RedrawImmediate();
-@@ -1248,6 +1254,7 @@
-   if (aNewIndex != mylastindex
-    || thePickOwner->IsForcedHilight())
-   {
-+    myMainPM->ClearImmediateDraw();
-     if (mylastindex != 0
-      && mylastindex <= myMapOfOwner.Extent())
-     {
-@@ -1270,7 +1277,7 @@
-     mylastindex = aNewIndex;
-   }
--  if (mylastindex)
-+  if (mylastindex != 0)
-   {
-     mylastgood = mylastindex;
-   }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext.cxx OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext.cxx
---- OCCT-6.8.0_SRC/src/AIS/AIS_LocalContext.cxx        2014-11-11 17:46:38.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/AIS/AIS_LocalContext.cxx  2015-01-16 12:59:32.000000000 +0300
-@@ -445,65 +445,67 @@
- Standard_Boolean AIS_LocalContext::Remove(const Handle(AIS_InteractiveObject)& aSelectable)
- {
--  if(!myActiveObjects.IsBound(aSelectable)) return Standard_False;
-+  if(!myActiveObjects.IsBound (aSelectable))
-+  {
-+    return Standard_False;
-+  }
-+
-+  if (IsSelected (aSelectable))
-+  {
-+    AddOrRemoveSelected (aSelectable, Standard_False);
-+  }
-+
-+  const Handle(AIS_LocalStatus)& Att = myActiveObjects (aSelectable);
--  if(IsSelected(aSelectable))
--    AddOrRemoveSelected(aSelectable,Standard_False);
--    
--  const Handle(AIS_LocalStatus)& Att = myActiveObjects(aSelectable);
--  
-   TColStd_ListIteratorOfListOfInteger It;
--  // it is checked which were the temporary attributes 
--  // and they are set to 0
--  // desactivate standard modes
--  if(Att->Decomposed()){
--    for(It.Initialize(myListOfStandardMode);It.More();It.Next()){
--      mySM->Deactivate(aSelectable,It.Value(),myMainVS);
-+  // Deactivate standard modes
-+  if (Att->Decomposed())
-+  {
-+    for (It.Initialize (myListOfStandardMode); It.More(); It.Next())
-+    {
-+      mySM->Deactivate (aSelectable, It.Value(), myMainVS);
-     }
-   }
--  
--  // if object or temporary presentations...
--  if(Att->IsTemporary())
-+
-+  // If object or temporary presentations
-+  if (Att->IsTemporary())
-+  {
-+    if (Att->IsSubIntensityOn())
-     {
--      if(Att->IsSubIntensityOn())
--      myMainPM->Unhighlight(aSelectable,Att->HilightMode());
--      
--      // remove if bug on clear correct...
--      myMainPM->Erase(aSelectable,Att->DisplayMode());
--      myMainPM->Clear(aSelectable,Att->DisplayMode());
--      if(myMainPM->IsDisplayed(aSelectable,Att->HilightMode()))
--      myMainPM->Erase(aSelectable,Att->HilightMode());
--      //      myMainPM->Clear(aSelectable,Att->HilightMode());
-+      myMainPM->Unhighlight (aSelectable, Att->HilightMode());
-     }
--  // if below intensity
--  else
-+
-+    myMainPM->Erase (aSelectable, Att->DisplayMode());
-+    myMainPM->Clear (aSelectable, Att->DisplayMode());
-+    if (myMainPM->IsDisplayed (aSelectable, Att->HilightMode()))
-     {
--      if(Att->IsSubIntensityOn())
--      myCTX->SubIntensityOff(aSelectable);
-+      myMainPM->Erase (aSelectable, Att->HilightMode());
-     }
--  // desactivate stored proper modes
--  for(It.Initialize(Att->SelectionModes());It.More();It.Next()){
--    mySM->Deactivate(aSelectable,It.Value(),myMainVS);
--  }
--// pop : si je laisses cela plantes dans les elements de construction  
--//       alors a toi de jouer ROB
--//  RemoveSelected(aSelectable);
--
--  if(IsSelected(aSelectable))
--    AddOrRemoveSelected(aSelectable);
--  myActiveObjects.UnBind(aSelectable);
-+  }
-+  // If subintensity used
-+  else if (Att->IsSubIntensityOn())
-+  {
-+    myCTX->SubIntensityOff (aSelectable);
-+  }
-+
-+  // Deactivate stored selection modes
-+  for (It.Initialize (Att->SelectionModes()); It.More(); It.Next())
-+  {
-+    mySM->Deactivate (aSelectable, It.Value(), myMainVS);
-+  }
-   // Remove the interactive object from selection manager
-   if (mySM->Contains (aSelectable))
-   {
-     mySM->Remove (aSelectable);
-   }
--
-   UpdateSort();
--
-   ClearOutdatedSelection (aSelectable, Standard_True);
-+  // This should be done at the very end because most methods use
-+  // myActiveObjects even during clean-up
-+  myActiveObjects.UnBind (aSelectable);
-   return Standard_True;
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Blend/Blend_Walking_1.gxx OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_1.gxx
---- OCCT-6.8.0_SRC/src/Blend/Blend_Walking_1.gxx       2014-11-11 17:46:43.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_1.gxx 2015-01-16 12:59:38.000000000 +0300
-@@ -56,6 +56,7 @@
- void Blend_Walking::Perform(Blend_Function& Func,
-                           Blend_FuncInv& FuncInv,
-+                            const Handle(ChFiDS_HElSpine)& HGuide,
-                           const Standard_Real Pdep,   
-                           const Standard_Real Pmax,
-                           const Standard_Real MaxStep,
-@@ -154,7 +155,7 @@
-     }
-   }
--  InternalPerform(Func,FuncInv,Pmax);
-+  InternalPerform(Func,FuncInv,HGuide,Pmax);
-   done = Standard_True;
- }
-@@ -461,7 +462,8 @@
-   previousP.ParametersOnS1(sol(1),sol(2));
-   previousP.ParametersOnS2(sol(3),sol(4));
--  InternalPerform(Func,FuncInv,P);
-+  Handle(ChFiDS_HElSpine) anHGuide;
-+  InternalPerform(Func,FuncInv,anHGuide,P);
-   return Standard_True;
- }
-@@ -502,7 +504,8 @@
-   if(OnS1) clasonS1 = Standard_False;
-   else clasonS2 = Standard_False;
--  InternalPerform(Func,FuncInv,P);
-+  Handle(ChFiDS_HElSpine) anHGuide;
-+  InternalPerform(Func,FuncInv,anHGuide,P);
-   clasonS1 = Standard_True;
-   clasonS2 = Standard_True;
-@@ -548,7 +551,8 @@
-   previousP.ParametersOnS1(sol(1),sol(2));
-   previousP.ParametersOnS2(sol(3),sol(4));
--  InternalPerform(Func,FuncInv,Pmin);
-+  Handle(ChFiDS_HElSpine) anHGuide;
-+  InternalPerform(Func,FuncInv,anHGuide,Pmin);
-   iscomplete = Standard_True;
-   return Standard_True;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Blend/Blend_Walking_4.gxx OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_4.gxx
---- OCCT-6.8.0_SRC/src/Blend/Blend_Walking_4.gxx       2014-11-11 17:46:43.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking_4.gxx 2015-01-16 12:59:38.000000000 +0300
-@@ -12,6 +12,8 @@
- // Alternatively, this file may be used under the terms of Open CASCADE
- // commercial license or contractual agreement.
-+#include <gce_MakePln.hxx>
-+
- static void evalpinit(math_Vector& parinit,
-                     const Blend_Point& previousP,
-                     const Standard_Real parprec,
-@@ -65,6 +67,7 @@
- void Blend_Walking::InternalPerform(Blend_Function& Func,
-                                   Blend_FuncInv& FuncInv,
-+                                    const Handle(ChFiDS_HElSpine)& HGuide,
-                                   const Standard_Real Bound)
- {
-@@ -251,12 +254,64 @@
-         // avec les surfaces periodiques.
-         State = Blend_OnRst12;
-         param =  (w1+w2)/2;
-+          gp_Pnt Pnt1, Pnt2;
-         p2d = TheArcTool::Value(recdomain1->Value(),solrst1(1));
-         sol(1) = p2d.X();
-         sol(2) = p2d.Y();
-+          Pnt1 = TheSurfaceTool::Value(surf1,sol(1),sol(2));
-         p2d = TheArcTool::Value(recdomain2->Value(),solrst2(1));
-         sol(3) = p2d.X();
-         sol(4) = p2d.Y();
-+          Pnt2 = TheSurfaceTool::Value(surf2,sol(3),sol(4));
-+          if (!HGuide.IsNull())
-+          {
-+            const Standard_Real TolProd = 1.e-5;
-+            Standard_Real SavedParams [2];
-+            Standard_Boolean SameDirs [2] = {Standard_False, Standard_False};
-+            ChFiDS_ElSpine& theElSpine = HGuide->ChangeCurve();
-+            SavedParams[0] = theElSpine.GetSavedFirstParameter();
-+            SavedParams[1] = theElSpine.GetSavedLastParameter();
-+            for (Standard_Integer ind = 0; ind < 2; ind++)
-+            {
-+              if (!Precision::IsInfinite(SavedParams[ind]))
-+              {
-+                //Check the original first and last parameters of guide curve
-+                //for equality to found parameter <param>:
-+                //check equality of tangent to guide curve and
-+                //normal to plane built on 3 points:
-+                //point on guide curve and points on restrictions of adjacent
-+                //surfaces.
-+                gp_Pnt Pnt0;
-+                gp_Vec Dir0;
-+                HGuide->D1(SavedParams[ind], Pnt0, Dir0);
-+                Standard_Real Length = Dir0.Magnitude();
-+                if (Length <= gp::Resolution())
-+                  continue;
-+                Dir0 /= Length;
-+                gce_MakePln PlaneBuilder(Pnt0, Pnt1, Pnt2);
-+                if (!PlaneBuilder.IsDone())
-+                  continue;
-+                gp_Pln thePlane = PlaneBuilder.Value();
-+                gp_Dir DirPlane = thePlane.Axis().Direction();
-+                gp_Vec theProd = Dir0 ^ DirPlane;
-+                Standard_Real ProdMod = theProd.Magnitude();
-+                if (ProdMod <= TolProd)
-+                  SameDirs[ind] = Standard_True;
-+              }
-+            }
-+            Standard_Real theParam = Precision::Infinite();
-+            //Choose the closest parameter
-+            if (SameDirs[0] && SameDirs[1])
-+              theParam = (Abs(param - SavedParams[0]) < Abs(param - SavedParams[1]))?
-+                SavedParams[0] : SavedParams[1];
-+            else if (SameDirs[0])
-+              theParam = SavedParams[0];
-+            else if (SameDirs[1])
-+              theParam = SavedParams[1];
-+            
-+            if (!Precision::IsInfinite(theParam))
-+              param = theParam;
-+          }
-       }
-       else if (recad1) {
-         // sol sur 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Blend/Blend_Walking.cdl OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking.cdl
---- OCCT-6.8.0_SRC/src/Blend/Blend_Walking.cdl 2014-11-11 17:46:43.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Blend/Blend_Walking.cdl   2015-01-16 12:59:38.000000000 +0300
-@@ -45,6 +45,7 @@
-      Transition       from IntSurf,
-      Function         from Blend,
-      FuncInv          from Blend,
-+     HElSpine         from ChFiDS,
-      State            from TopAbs
-@@ -66,6 +67,7 @@
-     Perform(me: in out; F       : in out Function from Blend;
-                         FInv    : in out FuncInv  from Blend;
-+                      HGuide  : HElSpine from ChFiDS;
-                         Pdep    : Real from Standard;
-                         Pmax    : Real from Standard;
-                       MaxStep : Real from Standard;
-@@ -164,6 +166,7 @@
-     InternalPerform (me: in out;F       : in out Function from Blend;
-                                 FInv    : in out FuncInv  from Blend;
-+                              HGuide  : HElSpine from ChFiDS;
-                                 Bound   : Real from Standard)
-                       
-     is static private;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx
---- OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx        2014-11-11 17:46:39.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx  2015-01-16 12:59:34.000000000 +0300
-@@ -684,8 +684,8 @@
-       }
-       //
-       if (aInOutMap.IsBound (aHole)){
--        const TopoDS_Shape& aHole2=aInOutMap(aHole);
--        if (IsInside(aHole, aHole2, myContext)) {
-+        const TopoDS_Shape& aSolidWas=aInOutMap(aHole);
-+        if (IsInside(aSolid, aSolidWas, myContext)) {
-           aInOutMap.UnBind(aHole);
-           aInOutMap.Bind (aHole, aSolid);
-         }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx
---- OCCT-6.8.0_SRC/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx        2014-11-11 17:46:39.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx  2015-01-16 12:59:34.000000000 +0300
-@@ -267,7 +267,6 @@
-     aPB->Indices(nV[0], nV[1]);
-     //
-     BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
--    ////const BOPDS_IndexedMapOfPaveBlock& aMPBF=aFI.PaveBlocksOn();
-     const BOPCol_MapOfInteger& aMIFOn=aFI.VerticesOn();
-     const BOPCol_MapOfInteger& aMIFIn=aFI.VerticesIn();
-     //~~~
-@@ -305,7 +304,9 @@
-               aEF.SetIndices(nE, nF);
-               aEF.SetCommonPart(aCP);
-               myDS->AddInterf(nE, nF);
--              // 3          
-+              //
-+              aMIEFC.Add(nF);
-+              //           
-               BOPAlgo_Tools::FillMap(aPB, nF, aMPBLI, aAllocator);
-               break;
-             }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools_1.cxx OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools_1.cxx
---- OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools_1.cxx       2014-11-11 17:46:40.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools_1.cxx 2015-01-16 13:01:24.000000000 +0300
-@@ -344,6 +344,8 @@
-                                  Standard_Real& theFVal) {
-     try {
-       const Standard_Real aPar = theX(1);
-+      if (!CheckParameter(aPar))
-+        return Standard_False;
-       gp_Pnt aP1, aP2;
-       gp_Pnt2d aP2d;
-       my3DCurve->D0(aPar, aP1);
-@@ -367,7 +369,8 @@
-                                     math_Vector& theGrad) {
-     try {
-       const Standard_Real aPar = theX(1);
--      
-+      if (!CheckParameter(aPar))
-+        return Standard_False;
-       gp_Pnt aP1, aP2;
-       gp_Vec aDC3D, aDSU, aDSV;
-       gp_Pnt2d aP2d;
-@@ -417,6 +420,19 @@
-   }
-   //
-  private:
-+
-+  Standard_Boolean CheckParameter(const Standard_Real theParam)
-+  {
-+    if (theParam < my3DCurve->FirstParameter() ||
-+        theParam > my3DCurve->LastParameter()  ||
-+        theParam < my2DCurve->FirstParameter() ||
-+        theParam > my2DCurve->LastParameter() )
-+    {
-+      return Standard_False;
-+    }
-+    return Standard_True;
-+  }
-+
-   Handle(Geom_Curve) my3DCurve;
-   Handle(Geom2d_Curve) my2DCurve;
-   Handle(Geom_Surface) mySurf;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools.cxx OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools.cxx
---- OCCT-6.8.0_SRC/src/BOPTools/BOPTools_AlgoTools.cxx 2014-11-11 17:46:40.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/BOPTools/BOPTools_AlgoTools.cxx   2015-01-16 13:01:24.000000000 +0300
-@@ -99,7 +99,8 @@
-                                    gp_Pnt& aPOut,
-                                    Handle(IntTools_Context)& theContext,
-                                    GeomAPI_ProjectPointOnSurf& aProjPL,
--                                   const Standard_Real aDt);
-+                                   const Standard_Real aDt,
-+                                   const Standard_Real aTolE);
- static 
-   Standard_Real MinStep3D(const TopoDS_Edge& theE1,
-                           const TopoDS_Face& theF1,
-@@ -1825,14 +1826,18 @@
-                 GeomAPI_ProjectPointOnSurf& aProjPL,
-                 const Standard_Real aDt)
- {
-+  Standard_Real aTolE;
-+  gp_Pnt aPx;
-+  //
-   BOPTools_AlgoTools3D::GetNormalToFaceOnEdge(aE, aF, aT, aDN);
-   if (aF.Orientation()==TopAbs_REVERSED){
-     aDN.Reverse();
-   }
-+  //
-+  aTolE=BRep_Tool::Tolerance(aE); 
-   aDB = aDN^aDTgt;
-   //
--  gp_Pnt aPx;
--  if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt)) {
-+  if (!FindPointInFace(aF, aP, aDB, aPx, theContext, aProjPL, aDt, aTolE)) {
-     BOPTools_AlgoTools3D::GetApproxNormalToFaceOnEdge(aE, aF, aT, aPx, 
-                                                       aDN, theContext);
-     aProjPL.Perform(aPx);
-@@ -1841,7 +1846,6 @@
-     aDB.SetXYZ(aVec.XYZ());
-   }
- }
--
- //=======================================================================
- //function : FindPointInFace
- //purpose  : Find a point in the face in direction of <aDB>
-@@ -1852,12 +1856,13 @@
-                                  gp_Pnt& aPOut,
-                                  Handle(IntTools_Context)& theContext,
-                                  GeomAPI_ProjectPointOnSurf& aProjPL,
--                                 const Standard_Real aDt)
-+                                 const Standard_Real aDt,
-+                                 const Standard_Real aTolE)
- {
-   Standard_Integer aNbItMax;
-   Standard_Real aDist, aDTol, aPM;
-   Standard_Boolean bRet;
--  gp_Pnt aP1;
-+  gp_Pnt aP1, aPS;
-   //
-   aDTol = Precision::Angular();
-   aPM = aP.XYZ().Modulus();
-@@ -1869,10 +1874,27 @@
-   //
-   GeomAPI_ProjectPointOnSurf& aProj=theContext->ProjPS(aF);
-   //
-+  aPS=aP;
-+  aProj.Perform(aPS);
-+  if (!aProj.IsDone()) {
-+    return bRet;
-+  }
-+  aPS=aProj.NearestPoint();
-+  aProjPL.Perform(aPS);
-+  aPS=aProjPL.NearestPoint();
-+  //
-+  aPS.SetXYZ(aPS.XYZ()+2.*aTolE*aDB.XYZ());
-+   aProj.Perform(aPS);
-+  if (!aProj.IsDone()) {
-+    return bRet;
-+  }
-+  aPS=aProj.NearestPoint();
-+  aProjPL.Perform(aPS);
-+  aPS=aProjPL.NearestPoint();
-+  //
-+  //
-   do {
--    aP1.SetCoord(aP.X()+aDt*aDB.X(),
--                 aP.Y()+aDt*aDB.Y(),
--                 aP.Z()+aDt*aDB.Z());
-+    aP1.SetXYZ(aPS.XYZ()+aDt*aDB.XYZ());
-     //
-     aProj.Perform(aP1);
-     if (!aProj.IsDone()) {
-@@ -1884,7 +1906,7 @@
-     aProjPL.Perform(aPOut);
-     aPOut = aProjPL.NearestPoint();
-     //
--    gp_Vec aV(aP, aPOut);
-+    gp_Vec aV(aPS, aPOut);
-     aDB.SetXYZ(aV.XYZ());
-   } while (aDist > aDTol && --aNbItMax);
-   //
-@@ -2006,8 +2028,8 @@
- //function : IsInvertedSolid
- //purpose  : 
- //=======================================================================
--Standard_Boolean 
--  BOPTools_AlgoTools::IsInvertedSolid(const TopoDS_Solid& aSolid)
-+Standard_Boolean BOPTools_AlgoTools::IsInvertedSolid
-+  (const TopoDS_Solid& aSolid)
- {
-   Standard_Real aTolS;
-   TopAbs_State aState;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/BRepFill/BRepFill_Pipe.cxx OCCT-6.8.0_SRC-patch/src/BRepFill/BRepFill_Pipe.cxx
---- OCCT-6.8.0_SRC/src/BRepFill/BRepFill_Pipe.cxx      2014-11-11 17:46:41.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/BRepFill/BRepFill_Pipe.cxx        2015-01-16 12:59:36.000000000 +0300
-@@ -274,18 +274,9 @@
-   }
-   ShapeUpgrade_RemoveLocations RemLoc;
-+  RemLoc.SetRemoveLevel(TopAbs_COMPOUND);
-   RemLoc.Remove(myFirst);
-   myFirst = RemLoc.GetResult();
--  TopLoc_Location theLoc = myFirst.Location();
--  if (!theLoc.IsIdentity())
--  {
--    TopoDS_Shape NewMyFirst = BRepBuilderAPI_Copy(myFirst);
--    RemLoc.Remove(NewMyFirst);
--    NewMyFirst = RemLoc.GetResult();
--    TopLoc_Location theIdentity;
--    NewMyFirst.Location(theIdentity);
--    myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation(), Standard_True);
--  }
-   
-   myLoc->Law(myLoc->NbLaw())->GetDomain(first, last);
-   myLoc->Law(myLoc->NbLaw())->D0(last,M, V);
-@@ -308,16 +299,6 @@
-   RemLoc.Remove(myLast);
-   myLast = RemLoc.GetResult();
--  theLoc = myLast.Location();
--  if (!theLoc.IsIdentity())
--  {
--    TopoDS_Shape NewMyLast = BRepBuilderAPI_Copy(myLast);
--    RemLoc.Remove(NewMyLast);
--    NewMyLast = RemLoc.GetResult();
--    TopLoc_Location theIdentity;
--    NewMyLast.Location(theIdentity);
--    myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation(), Standard_True);
--  }
-   
- #if DRAW
-   if (Affich) {
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_2.cxx OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_2.cxx
---- OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_2.cxx     2014-11-11 17:46:44.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_2.cxx       2015-01-16 12:59:39.000000000 +0300
-@@ -1862,10 +1862,13 @@
-   Standard_Real wl = Guide.LastParameter();
-   Standard_Real locfleche = (wl - wf) * fleche;
-   Standard_Real wfsav = wf, wlsav = wl;
--  //Now the ElSpine is artificially extended to help rsnld.
--  Standard_Real prab = 0.01;
--  Guide.FirstParameter(wf-prab*(wl-wf));
--  Guide.LastParameter (wl+prab*(wl-wf));
-+  if (!Guide.IsPeriodic())
-+  {
-+    //Now the ElSpine is artificially extended to help rsnld.
-+    Standard_Real prab = 0.01;
-+    Guide.FirstParameter(wf-prab*(wl-wf));
-+    Guide.LastParameter (wl+prab*(wl-wf));
-+  }
-   Handle(ChFiDS_Spine)&  Spine = Stripe->ChangeSpine();
-   Standard_Integer ii, nbed = Spine->NbEdges();
-   Standard_Real lastedlastp = Spine->LastParameter(nbed);
-@@ -1920,7 +1923,9 @@
-     Last = wf;
-     if(Guide.IsPeriodic()) {
-       Last = First - Guide.Period();
-+      Guide.SaveFirstParameter();
-       Guide.FirstParameter(Last);
-+      Guide.SaveLastParameter();
-       Guide.LastParameter (First * 1.1);//Extension to help rsnld.
-     }
-   }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_6.cxx OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_6.cxx
---- OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_6.cxx     2014-11-11 17:46:44.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_6.cxx       2015-01-16 12:59:39.000000000 +0300
-@@ -1573,7 +1573,7 @@
-       if (5*TolGuide > MS) TolGuide = MS/5;
-       if (5*TolEsp > MS) TolEsp = MS/5;
-     }
--    TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
-+    TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
-                   ParSol,TolEsp,Fleche,Appro);
-     if (!TheWalk.IsDone()) {
- #ifdef OCCT_DEBUG
-@@ -2113,7 +2113,7 @@
-       if (5*TolEsp > MS) TolEsp = MS/5;
-     }
-       
--    TheWalk.Perform(Func,FInv,NewFirst,Target,MS,TolGuide,
-+    TheWalk.Perform(Func,FInv,HGuide,NewFirst,Target,MS,TolGuide,
-                   ParSol,TolEsp,Fleche,Appro);
-     
-     if (!TheWalk.IsDone()) {
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_C1.cxx OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_C1.cxx
---- OCCT-6.8.0_SRC/src/ChFi3d/ChFi3d_Builder_C1.cxx    2014-11-11 17:46:44.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ChFi3d/ChFi3d_Builder_C1.cxx      2015-01-16 13:01:24.000000000 +0300
-@@ -371,8 +371,7 @@
-     pared = ponc1.Parameter();
-     parltg = ponc2.Parameter();
-     if ((parltg > f) && (parltg < l)) {
--#ifdef OCC23139
--      ////modified by jgv, 10.05.2012 for the bug 23139////
-+      ////modified by jgv, 10.05.2012 for the bug 23139, 25657////
-       Handle(Geom2d_Curve) PConF = fi.PCurveOnFace();
-       if (!PConF.IsNull())
-       {
-@@ -393,7 +392,6 @@
-         }
-       }
-       /////////////////////////////////////////////////////
--#endif
-       fi.SetParameter(parltg,isfirst);
-       cp.SetArc(cp.Tolerance(),cp.Arc(),pared,cp.TransitionOnArc());
-       return Standard_True;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cdl OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cdl
---- OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cdl       2014-11-11 17:46:44.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cdl 2015-01-16 12:59:39.000000000 +0300
-@@ -50,6 +50,10 @@
-     LastParameter(me) returns Real from Standard
-     is redefined;
-     
-+    GetSavedFirstParameter(me) returns Real from Standard;
-+    
-+    GetSavedLastParameter(me)  returns Real from Standard;
-+    
-     Continuity(me) returns Shape from GeomAbs
-     is redefined static;
-@@ -102,6 +106,10 @@
-     LastParameter(me : in out; P : Real from Standard);
-+    SaveFirstParameter(me : in out);
-+
-+    SaveLastParameter(me : in out);
-+
-     SetOrigin(me : in out; O : Real from Standard);
-     FirstPointAndTgt(me; P : out Pnt from gp; T : out Vec from gp);
-@@ -188,5 +196,7 @@
- period    : Real     from Standard;
- periodic  : Boolean  from Standard; 
-+pfirstsav : Real     from Standard;
-+plastsav  : Real     from Standard;
- end ElSpine;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cxx OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cxx
---- OCCT-6.8.0_SRC/src/ChFiDS/ChFiDS_ElSpine.cxx       2014-11-11 17:46:44.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ChFiDS/ChFiDS_ElSpine.cxx 2015-01-16 12:59:39.000000000 +0300
-@@ -27,6 +27,8 @@
- ChFiDS_ElSpine::ChFiDS_ElSpine():periodic(0)
- {
-+  pfirstsav = Precision::Infinite();
-+  plastsav  = Precision::Infinite();
- }
-@@ -52,6 +54,26 @@
- }
- //=======================================================================
-+//function : GetSavedFirstParameter
-+//purpose  : 
-+//=======================================================================
-+
-+Standard_Real ChFiDS_ElSpine::GetSavedFirstParameter() const
-+{
-+  return pfirstsav;
-+}
-+
-+//=======================================================================
-+//function : GetSavedLastParameter
-+//purpose  : 
-+//=======================================================================
-+
-+Standard_Real ChFiDS_ElSpine::GetSavedLastParameter() const
-+{
-+  return plastsav;
-+}
-+
-+//=======================================================================
- //function : Continuity
- //purpose  : 
- //=======================================================================
-@@ -229,6 +251,26 @@
-   plast = P;
- }
-+//=======================================================================
-+//function : SaveFirstParameter
-+//purpose  : 
-+//=======================================================================
-+
-+void ChFiDS_ElSpine::SaveFirstParameter()
-+{
-+  pfirstsav = pfirst;
-+}
-+
-+//=======================================================================
-+//function : SaveLastParameter
-+//purpose  : 
-+//=======================================================================
-+
-+void ChFiDS_ElSpine::SaveLastParameter()
-+{
-+  plastsav = plast;
-+}
-+
- //=======================================================================
- //function : SetOrigin
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Graphic3d/Graphic3d_GraphicDriver.cdl OCCT-6.8.0_SRC-patch/src/Graphic3d/Graphic3d_GraphicDriver.cdl
---- OCCT-6.8.0_SRC/src/Graphic3d/Graphic3d_GraphicDriver.cdl   2014-11-11 17:46:49.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Graphic3d/Graphic3d_GraphicDriver.cdl     2015-01-16 13:01:24.000000000 +0300
-@@ -261,12 +261,6 @@
-         is deferred;
-     ---Purpose: call_togl_setvisualisation
--    Transparency ( me       : mutable;
--                   ACView   : CView from Graphic3d;
--                   AFlag    : Boolean from Standard )
--        is deferred;
--    ---Purpose: call_togl_transparency
--
-     View ( me   : mutable;
-            ACView   : in out CView from Graphic3d )
-         returns Boolean from Standard
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx
---- OCCT-6.8.0_SRC/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx      2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_ImpImpIntersection_4.gxx        2015-01-16 13:01:24.000000000 +0300
-@@ -1151,6 +1151,7 @@
-                                         const Standard_Real theUlSurf1,
-                                         const Standard_Real thePeriodOfSurf1,
-                                         const Handle(IntSurf_LineOn2S)& theLine,
-+                                        const Standard_Real theTol3D,
-                                         const Standard_Real theTol2D,
-                                         const Standard_Boolean theFlForce)
- {
-@@ -1177,6 +1178,32 @@
-                         thePntOnSurf2.X(), thePntOnSurf2.Y());
-   }
-+  const Standard_Integer aNbPnts = theLine->NbPoints();
-+  if(aNbPnts > 0)
-+  {
-+    Standard_Real aUl = 0.0, aVl = 0.0;
-+    const IntSurf_PntOn2S aPlast = theLine->Value(aNbPnts);
-+    if(isTheReverse)
-+      aPlast.ParametersOnS2(aUl, aVl);
-+    else
-+      aPlast.ParametersOnS1(aUl, aVl);
-+
-+    if(anUpar <= aUl)
-+    {//Parameter value will be always increased.
-+      return Standard_False;
-+    }
-+
-+    //theTol2D is minimal step along parameter changed. 
-+    //Therefore, if we apply this minimal step two 
-+    //neighbour points will be always "same". Consequently,
-+    //we should reduce tolerance for IsSame checking.
-+    const Standard_Real aDTol = 1.0-Epsilon(1.0);
-+    if(aPnt.IsSame(aPlast, theTol3D*aDTol, theTol2D*aDTol))
-+    {
-+      theLine->RemovePoint(aNbPnts);
-+    }
-+  }
-+
-   theLine->Add(aPnt);
-   return Standard_True;
- }
-@@ -1191,6 +1218,7 @@
-                                           const stCoeffsValue& theCoeffs,
-                                           const Bnd_Box2d& theUVSurf1,
-                                           const Bnd_Box2d& theUVSurf2,
-+                                          const Standard_Real theTol3D,
-                                           const Standard_Real theTol2D,
-                                           const Standard_Real thePeriod,
-                                           const Standard_Real theNulValue,
-@@ -1281,7 +1309,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-                           gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
-                           aUSurf1f, aUSurf1l, thePeriod,
--                          theWL->Curve(), theTol2D, theFlForce);
-+                          theWL->Curve(), theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1313,7 +1341,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
-                         aUSurf1f, aUSurf1l, thePeriod,
--                        theWL->Curve(), theTol2D, theFlForce);
-+                        theWL->Curve(),theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1346,7 +1374,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
-                         gp_Pnt2d(anUpar2, aV1), gp_Pnt2d(aU2, aV2),
-                         aUSurf1f, aUSurf1l, thePeriod,
--                        theWL->Curve(), theTol2D, theFlForce);
-+                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1376,7 +1404,7 @@
-         AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-                         gp_Pnt2d(anUpar1, aV1), gp_Pnt2d(aU2, aV2),
-                         aUSurf1f, aUSurf1l, thePeriod,
--                        theWL->Curve(), theTol2D, theFlForce);
-+                        theWL->Curve(), theTol3D, theTol2D, theFlForce);
-       }
-       else
-       {
-@@ -1545,7 +1573,8 @@
-   {
-     Standard_Real &a = theU1crit[i],
-                   &b = theU1crit[i-1];
--    if(Abs(a - b) < theTol2D)
-+    const Standard_Real aRemain = fmod(Abs(a - b), thePeriod); // >= 0, because Abs(a - b) >= 0
-+    if((Abs(a - b) < theTol2D) || (aRemain < theTol2D) || (Abs(aRemain - thePeriod) < theTol2D))
-     {
-       a = (a + b)/2.0;
-       b = Precision::Infinite();
-@@ -1817,6 +1846,7 @@
-     Standard_Boolean isAddedIntoWL1 = Standard_False, isAddedIntoWL2 = Standard_False;
-     Standard_Real anUf = aU1f[aCurInterval], anUl = aU1l[aCurInterval];
-+    const Standard_Boolean isDeltaPeriod  = IsEqual(anUl-anUf, aPeriod);
-     //Inscribe and sort critical points
-     InscribeAndSortArray(anU1crit, aNbCritPointsMax, anUf, anUl, theTol2D, aPeriod);
-@@ -1830,6 +1860,8 @@
-       Handle(IntPatch_WLine) aWLine2 = new IntPatch_WLine(aL2S2, Standard_False);
-       Standard_Integer aWL1FindStatus = 0, aWL2FindStatus = 0;
-+      Standard_Boolean  isAddingWL1Enabled = Standard_True,
-+                        isAddingWL2Enabled = Standard_True;
-       Standard_Real anU1 = anUf;
-@@ -1845,6 +1877,23 @@
-       while(anU1 <= anUl)
-       {
-+        if(isDeltaPeriod)
-+        {
-+          if(IsEqual(anU1, anUl))
-+          {
-+            //if isAddedIntoWL* == TRUE WLine contains only one point
-+            //(which was end point of previous WLine). If we will
-+            //add point found on the current step WLine will contain only
-+            //two points. At that both these points will be equal to the
-+            //points found earlier. Therefore, new WLine will repeat 
-+            //already existing WLine. Consequently, it is necessary 
-+            //to forbid building new line in this case.
-+
-+            isAddingWL1Enabled = !isAddedIntoWL1;
-+            isAddingWL2Enabled = !isAddedIntoWL2;
-+          }
-+        }
-+
-         for(Standard_Integer i = 0; i < aNbCritPointsMax; i++)
-         {
-           if((anU1 - anU1crit[i])*aCriticalDelta[i] < 0.0)
-@@ -1995,123 +2044,129 @@
-           isFirst = Standard_False;
-         }
--        if( ((aUSurf2f-aU21) <= theTol2D) && 
--            ((aU21-aUSurf2l) <= theTol2D) &&
--            ((aVSurf1f - aV11) <= theTol2D) && 
--            ((aV11 - aVSurf1l) <= theTol2D) &&
--            ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
-+        if(isAddingWL1Enabled)
-         {
--          Standard_Boolean isForce = Standard_False;
--          if(!aWL1FindStatus)
-+          if( ((aUSurf2f-aU21) <= theTol2D) && 
-+              ((aU21-aUSurf2l) <= theTol2D) &&
-+              ((aVSurf1f - aV11) <= theTol2D) && 
-+              ((aV11 - aVSurf1l) <= theTol2D) &&
-+              ((aVSurf2f - aV21) <= theTol2D) && ((aV21 - aVSurf2l) <= theTol2D))
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--
--            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+            Standard_Boolean isForce = Standard_False;
-+            if(!aWL1FindStatus)
-             {
--              isForce = Standard_True;
--            }
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU21, aV11, aV11Prev,
--                              aV21, aV21Prev, isTheReverse,
--                              1.0, isForce, isFound1, isFound2);
-+              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+              {
-+                isForce = Standard_True;
-+              }
-+
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU21, aV11, aV11Prev,
-+                                aV21, aV21Prev, isTheReverse,
-+                                1.0, isForce, isFound1, isFound2);
-               
--            if(isFound1 || isFound2)
--            {
--              aWL1FindStatus = 1;
-+              if(isFound1 || isFound2)
-+              {
-+                aWL1FindStatus = 1;
-+              }
-             }
--          }
--          if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
--          {
--            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
--                  gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
--                  aUSurf1f, aUSurf1l, aPeriod,
--                  aWLine1->Curve(), theTol2D, isForce))
-+            if((aWL1FindStatus != 2) || (aWLine1->NbPnts() >= 1))
-             {
--              if(!aWL1FindStatus)
-+              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse, 
-+                    gp_Pnt2d(anU1, aV11), gp_Pnt2d(aU21, aV21),
-+                    aUSurf1f, aUSurf1l, aPeriod,
-+                    aWLine1->Curve(), theTol3D, theTol2D, isForce))
-               {
--                aWL1FindStatus = 1;
-+                if(!aWL1FindStatus)
-+                {
-+                  aWL1FindStatus = 1;
-+                }
-               }
-             }
-           }
--        }
--        else
--        {
--          if(aWL1FindStatus == 1)
-+          else
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
-+            if(aWL1FindStatus == 1)
-+            {
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU21, aV11, aV11Prev,
--                              aV21, aV21Prev, isTheReverse,
--                              1.0, Standard_False, isFound1, isFound2);
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine1, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU21, aV11, aV11Prev,
-+                                aV21, aV21Prev, isTheReverse,
-+                                1.0, Standard_False, isFound1, isFound2);
--            if(isFound1 || isFound2)
--              aWL1FindStatus = 2; //start a new line
-+              if(isFound1 || isFound2)
-+                aWL1FindStatus = 2; //start a new line
-+            }
-           }
-         }
--      
--        if( ((aUSurf2f-aU22) <= theTol2D) &&
--            ((aU22-aUSurf2l) <= theTol2D) && 
--            ((aVSurf1f - aV12) <= theTol2D) &&
--            ((aV12 - aVSurf1l) <= theTol2D) &&
--            ((aVSurf2f - aV22) <= theTol2D) &&
--            ((aV22 - aVSurf2l) <= theTol2D))
-+        
-+        if(isAddingWL2Enabled)
-         {
--          Standard_Boolean isForce = Standard_False;
--
--          if(!aWL2FindStatus)
-+          if( ((aUSurf2f-aU22) <= theTol2D) &&
-+              ((aU22-aUSurf2l) <= theTol2D) && 
-+              ((aVSurf1f - aV12) <= theTol2D) &&
-+              ((aV12 - aVSurf1l) <= theTol2D) &&
-+              ((aVSurf2f - aV22) <= theTol2D) &&
-+              ((aV22 - aVSurf2l) <= theTol2D))
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
-+            Standard_Boolean isForce = Standard_False;
--            if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+            if(!aWL2FindStatus)
-             {
--              isForce = Standard_True;
--            }
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU22, aV12, aV12Prev,
--                              aV22, aV22Prev, isTheReverse,
--                              -1.0, isForce, isFound1, isFound2);
-+              if(((aUSurf2l - aUSurf2f) >= aPeriod) && (Abs(anU1-aUSurf1l) < theTol2D))
-+              {
-+                isForce = Standard_True;
-+              }
-+
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU22, aV12, aV12Prev,
-+                                aV22, aV22Prev, isTheReverse,
-+                                -1.0, isForce, isFound1, isFound2);
-               
--            if(isFound1 || isFound2)
--            {
--              aWL2FindStatus = 1;
-+              if(isFound1 || isFound2)
-+              {
-+                aWL2FindStatus = 1;
-+              }
-             }
--          }
--          if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
--          {
--            if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
--                  gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
--                  aUSurf1f, aUSurf1l, aPeriod,
--                  aWLine2->Curve(), theTol2D, isForce))
-+            if((aWL2FindStatus != 2) || (aWLine2->NbPnts() >= 1))
-             {
--              if(!aWL2FindStatus)
-+              if(AddPointIntoWL(theQuad1, theQuad2, isTheReverse,
-+                    gp_Pnt2d(anU1, aV12), gp_Pnt2d(aU22, aV22),
-+                    aUSurf1f, aUSurf1l, aPeriod,
-+                    aWLine2->Curve(), theTol3D, theTol2D, isForce))
-               {
--                aWL2FindStatus = 1;
-+                if(!aWL2FindStatus)
-+                {
-+                  aWL2FindStatus = 1;
-+                }
-               }
-             }
-           }
--        }
--        else
--        {
--          if(aWL2FindStatus == 1)
-+          else
-           {
--            Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
-+            if(aWL2FindStatus == 1)
-+            {
-+              Standard_Boolean isFound1 = Standard_False, isFound2 = Standard_False;
--            AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
--                              theUVSurf1, theUVSurf2, theTol2D, aPeriod,
--                              aNulValue, anU1, aU22, aV12, aV12Prev,
--                              aV22, aV22Prev, isTheReverse,
--                              -1.0, Standard_False, isFound1, isFound2);
-+              AddBoundaryPoint(theQuad1, theQuad2, aWLine2, anEquationCoeffs,
-+                                theUVSurf1, theUVSurf2, theTol3D, theTol2D, aPeriod,
-+                                aNulValue, anU1, aU22, aV12, aV12Prev,
-+                                aV22, aV22Prev, isTheReverse,
-+                                -1.0, Standard_False, isFound1, isFound2);
--            if(isFound1 || isFound2)
--              aWL2FindStatus = 2; //start a new line
-+              if(isFound1 || isFound2)
-+                aWL2FindStatus = 2; //start a new line
-+            }
-           }
-         }
-@@ -2237,15 +2292,29 @@
-       }
-       else if(aWLine1->NbPnts() > 1)
-       {
--        isTheEmpty = Standard_False;
--        isAddedIntoWL1 = Standard_True;
-+        Standard_Boolean isGood = Standard_True;
-+
-+        if(aWLine1->NbPnts() == 2)
-+        {
-+          const IntSurf_PntOn2S& aPf = aWLine1->Point(1);
-+          const IntSurf_PntOn2S& aPl = aWLine1->Point(2);
--        SeekAdditionalPoints(theQuad1, theQuad2, aWLine1->Curve(), 
--                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
--                              theTol2D, aPeriod, 1.0, isTheReverse);
-+          if(aPf.IsSame(aPl, Precision::Confusion()))
-+            isGood = Standard_False;
-+        }
--        aWLine1->ComputeVertexParameters(theTol3D);
--        theSlin.Append(aWLine1);
-+        if(isGood)
-+        {
-+          isTheEmpty = Standard_False;
-+          isAddedIntoWL1 = Standard_True;
-+
-+          SeekAdditionalPoints( theQuad1, theQuad2, aWLine1->Curve(), 
-+                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
-+                                theTol2D, aPeriod, 1.0, isTheReverse);
-+
-+          aWLine1->ComputeVertexParameters(theTol3D);
-+          theSlin.Append(aWLine1);
-+        }
-       }
-       else
-       {
-@@ -2267,15 +2336,28 @@
-       }
-       else if(aWLine2->NbPnts() > 1)
-       {
--        isTheEmpty = Standard_False;
--        isAddedIntoWL2 = Standard_True;
-+        Standard_Boolean isGood = Standard_True;
-+        if(aWLine2->NbPnts() == 2)
-+        {
-+          const IntSurf_PntOn2S& aPf = aWLine2->Point(1);
-+          const IntSurf_PntOn2S& aPl = aWLine2->Point(2);
-+
-+          if(aPf.IsSame(aPl, Precision::Confusion()))
-+            isGood = Standard_False;
-+        }
--        SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
--                              anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
--                              theTol2D, aPeriod, -1.0, isTheReverse);
-+        if(isGood)
-+        {
-+          isTheEmpty = Standard_False;
-+          isAddedIntoWL2 = Standard_True;
--        aWLine2->ComputeVertexParameters(theTol3D);
--        theSlin.Append(aWLine2);
-+          SeekAdditionalPoints(theQuad1, theQuad2, aWLine2->Curve(),
-+                                anEquationCoeffs, aNbPoints, aUSurf2f, aUSurf2l,
-+                                theTol2D, aPeriod, -1.0, isTheReverse);
-+
-+          aWLine2->ComputeVertexParameters(theTol3D);
-+          theSlin.Append(aWLine2);
-+        }
-       }
-       else
-       {
-@@ -2284,6 +2366,203 @@
-     }
-   }
-+  if(theSlin.Length() > 0)
-+  {
-+    for(Standard_Integer aNumOfLine = 2; aNumOfLine <= theSlin.Length(); aNumOfLine++)
-+    {
-+      const Handle(IntPatch_WLine)& aWLine = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine));
-+
-+      const IntSurf_PntOn2S& aPntFWL = aWLine->Point(1);
-+
-+      Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0;
-+      aPntFWL.Parameters(aU1, aV1, aU2, aV2);
-+
-+      if( IsEqual(aU1, 0.0) || IsEqual(aU1, aPeriod))
-+      {
-+        theSlin.Exchange(1, aNumOfLine);
-+        break;
-+      }
-+    }
-+
-+    for(Standard_Integer aNumOfLine1 = 1; aNumOfLine1 <= theSlin.Length(); aNumOfLine1++)
-+    {
-+      const Handle(IntPatch_WLine)& aWLine1 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine1));
-+
-+      const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
-+      const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
-+      const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
-+
-+      for(Standard_Integer aNPt = 1; aNPt <= theSPnt.Length(); aNPt++)
-+      {
-+        const IntSurf_PntOn2S aPntCur = theSPnt.Value(aNPt).PntOn2S();
-+
-+        if( aPntCur.IsSame(aPntFWL1, Precision::Confusion()) ||
-+            aPntCur.IsSame(aPntLWL1, Precision::Confusion()))
-+        {
-+          theSPnt.Remove(aNPt);
-+          aNPt--;
-+        }
-+      }
-+
-+      Standard_Boolean hasBeenRemoved = Standard_False;
-+      for(Standard_Integer aNumOfLine2 = aNumOfLine1 + 1; aNumOfLine2 <= theSlin.Length(); aNumOfLine2++)
-+      {
-+        const Handle(IntPatch_WLine)& aWLine2 = Handle(IntPatch_WLine)::DownCast(theSlin.Value(aNumOfLine2));
-+
-+        const Standard_Integer aNbPntsWL1 = aWLine1->NbPnts();
-+        const Standard_Integer aNbPntsWL2 = aWLine2->NbPnts();
-+
-+        const IntSurf_PntOn2S& aPntFWL1 = aWLine1->Point(1);
-+        const IntSurf_PntOn2S& aPntLWL1 = aWLine1->Point(aNbPntsWL1);
-+
-+        const IntSurf_PntOn2S& aPntFWL2 = aWLine2->Point(1);
-+        const IntSurf_PntOn2S& aPntLWL2 = aWLine2->Point(aNbPntsWL2);
-+
-+        if(aPntFWL1.IsSame(aPntFWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->InsertBefore(1, aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+
-+        if(aPntFWL1.IsSame(aPntLWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntFWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->InsertBefore(1, aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+
-+        if(aPntLWL1.IsSame(aPntFWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntFWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = 1; aNPt <= aNbPntsWL2; aNPt++)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->Add(aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+
-+        if(aPntLWL1.IsSame(aPntLWL2, Precision::Confusion()))
-+        {
-+          Standard_Real aU11 = 0.0, aU12 = 0.0, aV11 = 0.0, aV12 = 0.0;
-+          Standard_Real aU21 = 0.0, aU22 = 0.0, aV21 = 0.0, aV22 = 0.0;
-+
-+          aPntLWL1.Parameters(aU11, aV11, aU12, aV12);
-+          aPntLWL2.Parameters(aU21, aV21, aU22, aV22);
-+
-+          if( !(IsEqual(fmod(aU11, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU12, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU21, aPeriod), 0.0) ||
-+                IsEqual(fmod(aU22, aPeriod), 0.0) ||
-+                IsEqual(aU11, aUSurf1f) || IsEqual(aU11, aUSurf1l) ||
-+                IsEqual(aU21, aUSurf1f) || IsEqual(aU21, aUSurf1l) ||
-+                IsEqual(aU12, aUSurf2f) || IsEqual(aU12, aUSurf2l) ||
-+                IsEqual(aU22, aUSurf2f) || IsEqual(aU22, aUSurf2l)))
-+          {
-+            aWLine1->ClearVertexes();
-+            for(Standard_Integer aNPt = aNbPntsWL2; aNPt >= 1; aNPt--)
-+            {
-+              const IntSurf_PntOn2S& aPt = aWLine2->Point(aNPt);
-+              aWLine1->Curve()->Add(aPt);
-+            }
-+
-+            aWLine1->ComputeVertexParameters(theTol3D);
-+
-+            theSlin.Remove(aNumOfLine2);
-+            aNumOfLine2--;
-+            hasBeenRemoved = Standard_True;
-+
-+            continue;
-+          }
-+        }
-+      }
-+
-+      if(hasBeenRemoved)
-+        aNumOfLine1--;
-+
-+      //aWLine1->ComputeVertexParameters(theTol3D);
-+    }
-+  }//if(theSlin.Length() > 0)
-+
-+
-   return Standard_True;
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.cdl OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.cdl
---- OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.cdl     2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.cdl       2015-01-16 12:59:50.000000000 +0300
-@@ -309,9 +309,21 @@
-       ---C++: return const&
-         returns HCurve2d from Adaptor2d;
--    Dump(me)
-+    ClearVertexes(me: mutable)
-+      is static;
-     
--      is static;
-+    RemoveVertex(me: mutable;
-+                  theIndex : Integer from Standard)
-+      is static;
-+      
-+    InsertVertexBefore(me: mutable;
-+                        theIndex : Integer from Standard;
-+                        thePnt   : Point from IntPatch)
-+      is static;
-+    
-+        Dump(me)
-+    
-+      is static;
-  
- fields
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.lxx OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.lxx
---- OCCT-6.8.0_SRC/src/IntPatch/IntPatch_WLine.lxx     2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntPatch/IntPatch_WLine.lxx       2015-01-16 12:59:50.000000000 +0300
-@@ -97,3 +97,27 @@
- {
-   return svtx(Index);
- }
-+
-+inline void IntPatch_WLine::ClearVertexes()
-+{
-+  svtx.Clear();
-+}
-+
-+inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
-+{
-+  if((theIndex < 1) || (theIndex > NbVertex()))
-+    Standard_OutOfRange::Raise("Cannot delete not existing vertex");
-+  svtx.Remove(theIndex);
-+}
-+
-+inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
-+                                                const IntPatch_Point& thePnt)
-+{
-+  const Standard_Integer aNbVertexes = NbVertex();
-+  Standard_Integer anIndex = Max(theIndex, 1);
-+
-+  if(anIndex > aNbVertexes)
-+    svtx.Append(thePnt);
-+  else
-+    svtx.InsertBefore(theIndex, thePnt);
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cdl OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cdl
---- OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cdl     2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cdl       2015-01-16 13:01:24.000000000 +0300
-@@ -119,6 +119,15 @@
-       is static;
-+    IsSame(me; theOterPoint : PntOn2S from IntSurf;
-+            theTol3D, theTol2D: Real from Standard = 0.0)
-+            
-+  ---Purpose: Returns TRUE if 2D- and 3D-coordinates of theOterPoint are equal to
-+   --         corresponding coordinates of me (with given tolerance).
-+   --         If theTol2D == 0.0 we will compare 3D-points only.
-+   
-+        returns Boolean from Standard;
-+  
- fields
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cxx OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cxx
---- OCCT-6.8.0_SRC/src/IntSurf/IntSurf_PntOn2S.cxx     2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntSurf/IntSurf_PntOn2S.cxx       2015-01-16 12:59:51.000000000 +0300
-@@ -49,4 +49,31 @@
- }
-+Standard_Boolean IntSurf_PntOn2S::IsSame( const IntSurf_PntOn2S& theOterPoint,
-+                                          const Standard_Real theTol3D,
-+                                          const Standard_Real theTol2D) const
-+{
-+  if(pt.SquareDistance(theOterPoint.Value()) > theTol3D*theTol3D)
-+    return Standard_False;
-+  if(IsEqual(theTol2D, 0.0))
-+  {//We need not compare 2D-coordinates of the points
-+    return Standard_True;
-+  }
-+
-+  Standard_Real aU1 = 0.0, aV1 = 0.0, aU2 = 0.0, aV2 = 0.0;
-+  theOterPoint.Parameters(aU1, aV1, aU2, aV2);
-+
-+  gp_Pnt2d aP1(u1, v1), aP2(aU1, aV1);
-+
-+  if(!aP1.IsEqual(aP2, theTol2D))
-+    return Standard_False;
-+
-+  aP1.SetCoord(u2, v2);
-+  aP2.SetCoord(aU2, aV2);
-+
-+  if(!aP1.IsEqual(aP2, theTol2D))
-+    return Standard_False;
-+
-+  return Standard_True;
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntTools/IntTools_EdgeFace.cxx OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_EdgeFace.cxx
---- OCCT-6.8.0_SRC/src/IntTools/IntTools_EdgeFace.cxx  2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_EdgeFace.cxx    2015-01-16 12:59:51.000000000 +0300
-@@ -1365,20 +1365,27 @@
-   (const IntTools_CommonPrt& aCP,
-    Standard_Real& aTx) 
- {
--  Standard_Real aTF, aTL, Tol, U1f,U1l,V1f,V1l, af, al,aDist2, aMinDist2, aTm, aDist2New;
--  Standard_Real aEpsT;
-+  Standard_Real aTF, aTL, Tol, U1f,U1l,V1f,V1l;
-+  Standard_Real aEpsT, af, al,aDist2, aMinDist2, aTm, aDist2New;
-   Standard_Boolean theflag=Standard_False;
-   Standard_Integer aNbExt, i, iLower ;
--
-+  GeomAbs_CurveType aType;
-+  //
-   aCP.Range1(aTF, aTL);
-+  aType=myC.GetType();
-+  //
-   aEpsT=8.e-5;
-+  if (aType==GeomAbs_Line) {
-+    aEpsT=9.e-5;
-+  }
-+  //
-   aTm=0.5*(aTF+aTL);
-   aDist2=DistanceFunction(aTm);
-   aDist2 *= aDist2;
-   Tol = Precision::PConfusion();
--  const Handle(Geom_Curve)&  Curve   =BRep_Tool::Curve  (myC.Edge(), af, al);
-+  const Handle(Geom_Curve)&  Curve =BRep_Tool::Curve  (myC.Edge(), af, al);
-   const Handle(Geom_Surface)& Surface=BRep_Tool::Surface(myS.Face());
-   Surface->Bounds(U1f,U1l,V1f,V1l);
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/IntTools/IntTools_FaceFace.cxx OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_FaceFace.cxx
---- OCCT-6.8.0_SRC/src/IntTools/IntTools_FaceFace.cxx  2014-11-11 17:46:54.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/IntTools/IntTools_FaceFace.cxx    2015-01-16 12:59:51.000000000 +0300
-@@ -1243,10 +1243,9 @@
-       return;
-     }
-   }
-+  //
-   // Do the Curve
--  
--  
--  typl=L->ArcType();
-+  //
-   switch (typl) {
-   //########################################  
-   // Line, Parabola, Hyperbola
-@@ -1276,10 +1275,14 @@
-     //
-     aNbParts=myLConstruct.NbParts();
-     for (i=1; i<=aNbParts; i++) {
-+      Standard_Boolean bFNIt, bLPIt;
-+      //
-       myLConstruct.Part(i, fprm, lprm);
--      
--      if (!Precision::IsNegativeInfinite(fprm) && 
--          !Precision::IsPositiveInfinite(lprm)) {
-+      //
-+      bFNIt=Precision::IsNegativeInfinite(fprm);
-+      bLPIt=Precision::IsPositiveInfinite(lprm);
-+      //
-+      if (!bFNIt && !bLPIt) {
-         //
-         IntTools_Curve aCurve;
-         //
-@@ -1309,7 +1312,7 @@
-             //
-             aCurve.SetFirstCurve2d(H1);
-           }
--        
-+        //
-         if(myApprox2) { 
-           Handle (Geom2d_Curve) C2d;
-           BuildPCurves(fprm,lprm,Tolpc,myHS2->ChangeSurface().Surface(),newc,C2d);
-@@ -1325,25 +1328,24 @@
-           aCurve.SetSecondCurve2d(H1);
-         }
-         mySeqOfCurve.Append(aCurve);
--      } // end of if (!Precision::IsNegativeInfinite(fprm) &&  !Precision::IsPositiveInfinite(lprm))
-+      } //if (!bFNIt && !bLPIt) {
-       else {
-         //  on regarde si on garde
-         //
--        Standard_Boolean bFNIt, bLPIt;
-         Standard_Real aTestPrm, dT=100.;
--
--        bFNIt=Precision::IsNegativeInfinite(fprm);
--        bLPIt=Precision::IsPositiveInfinite(lprm);
--        
-+        //
-         aTestPrm=0.;
--        
-         if (bFNIt && !bLPIt) {
-           aTestPrm=lprm-dT;
-         }
-         else if (!bFNIt && bLPIt) {
-           aTestPrm=fprm+dT;
-         }
--        
-+        else {
-+          // i.e, if (bFNIt && bLPIt)
-+          aTestPrm=IntTools_Tools::IntermediatePoint(-dT, dT);
-+        }
-+        //
-         gp_Pnt ptref(newc->Value(aTestPrm));
-         //
-         GeomAbs_SurfaceType typS1 = myHS1->GetType();
-@@ -1353,8 +1355,7 @@
-             typS1 == GeomAbs_SurfaceOfRevolution ||
-             typS2 == GeomAbs_SurfaceOfExtrusion ||
-             typS2 == GeomAbs_OffsetSurface ||
--            typS2 == GeomAbs_SurfaceOfRevolution) 
--        {
-+            typS2 == GeomAbs_SurfaceOfRevolution) {
-           Handle(Geom2d_BSplineCurve) H1;
-           mySeqOfCurve.Append(IntTools_Curve(newc, H1, H1));
-           continue;
-@@ -1373,7 +1374,7 @@
-           mySeqOfCurve.Append(IntTools_Curve(newc, H1, H1));
-         }
-       }
--    }// end of for (i=1; i<=myLConstruct.NbParts(); i++)
-+    }// for (i=1; i<=aNbParts; i++) {
-   }// case IntPatch_Lin:  case IntPatch_Parabola:  case IntPatch_Hyperbola:
-     break;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/math/math_Recipes.cxx OCCT-6.8.0_SRC-patch/src/math/math_Recipes.cxx
---- OCCT-6.8.0_SRC/src/math/math_Recipes.cxx   2014-11-11 17:47:18.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/math/math_Recipes.cxx     2015-01-16 13:01:25.000000000 +0300
-@@ -177,7 +177,7 @@
-                      math_Vector& vv,
-                      Standard_Real    TINY) { 
--     Standard_Integer i, imax=0, j, k;
-+     Standard_Integer i, imax=1, j, k;
-      Standard_Real big, dum, sum, temp;
-      Standard_Integer n = a.RowNumber();
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver_7.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver_7.cxx
---- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver_7.cxx       2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver_7.cxx 2015-01-16 13:01:24.000000000 +0300
-@@ -470,13 +470,6 @@
-   }
- }
--void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag)
--{
--  const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView;
--  if (aCView)
--    aCView->WS->UseTransparency(AFlag);
--}
--
- // =======================================================================
- // function : InvalidateBVHData
- // purpose  :
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver.hxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver.hxx
---- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_GraphicDriver.hxx 2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_GraphicDriver.hxx   2015-01-16 13:01:24.000000000 +0300
-@@ -167,7 +167,6 @@
-   Standard_EXPORT void SetClipPlanes (const Graphic3d_CView& theCView);
-   Standard_EXPORT void SetCamera (const Graphic3d_CView& theCView);
-   Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
--  Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
-   Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
-   Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
-   Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_View.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_View.cxx
---- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_View.cxx  2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_View.cxx    2015-01-16 12:59:55.000000000 +0300
-@@ -54,7 +54,7 @@
- OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext,
-                           OpenGl_StateCounter*       theCounter)
--: mySurfaceDetail(Visual3d_TOD_NONE),
-+: mySurfaceDetail(Visual3d_TOD_ALL),
-   myBackfacing(0),
-   myBgTexture(myDefaultBgTexture),
-   myBgGradient(myDefaultBgGradient),
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace_5.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace_5.cxx
---- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace_5.cxx   2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace_5.cxx     2015-01-16 13:01:24.000000000 +0300
-@@ -119,7 +119,7 @@
-       NamedStatus |= OPENGL_NS_2NDPASSNEED;
-     }
--    if (myUseTransparency && aProps->trans != 1.0f)
-+    if (aProps->trans != 1.0f)
-     {
-       // render transparent
-       myMatTmp.Diffuse.a() = aProps->trans;
-@@ -349,7 +349,7 @@
-                              ? TelCullNone
-                              : (TelCullMode )AspectFace_set->CullingMode();
-     if (aCullingMode != TelCullNone
--     && myUseTransparency && !(NamedStatus & OPENGL_NS_2NDPASSDO))
-+     && !(NamedStatus & OPENGL_NS_2NDPASSDO))
-     {
-       // disable culling in case of translucent shading aspect
-       if (AspectFace_set->IntFront().trans != 1.0f)
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.cxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.cxx
---- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.cxx     2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.cxx       2015-01-16 13:01:24.000000000 +0300
-@@ -156,7 +156,6 @@
-   myTransientDrawToFront (Standard_True),
-   myBackBufferRestored   (Standard_False),
-   myIsImmediateDrawn     (Standard_False),
--  myUseTransparency (Standard_False),
-   myUseZBuffer (Standard_False),
-   myUseDepthTest (Standard_True),
-   myUseGLLight (Standard_True),
-@@ -255,15 +254,6 @@
-   return Standard_True;
- }
--// =======================================================================
--// function : UseTransparency
--// purpose  : call_togl_transparency
--// =======================================================================
--void OpenGl_Workspace::UseTransparency (const Standard_Boolean theFlag)
--{
--  myUseTransparency = theFlag;
--}
--
- //=======================================================================
- //function : ResetAppliedAspect
- //purpose  : Sets default values of GL parameters in accordance with default aspects
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.hxx OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.hxx
---- OCCT-6.8.0_SRC/src/OpenGl/OpenGl_Workspace.hxx     2014-11-11 17:46:58.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/OpenGl/OpenGl_Workspace.hxx       2015-01-16 13:01:24.000000000 +0300
-@@ -184,7 +184,6 @@
-                                Image_PixMap&               theImage,
-                                const Graphic3d_BufferType& theBufferType);
--  void UseTransparency (const Standard_Boolean theFlag);
-   Standard_Boolean& UseZBuffer()   { return myUseZBuffer; }
-   Standard_Boolean& UseDepthTest() { return myUseDepthTest; }
-   Standard_Boolean& UseGLLight()   { return myUseGLLight; }
-@@ -671,7 +670,6 @@
-   Standard_Boolean       myTransientDrawToFront; //!< optimization flag for immediate mode (to render directly to the front buffer)
-   Standard_Boolean       myBackBufferRestored;
-   Standard_Boolean       myIsImmediateDrawn;     //!< flag indicates that immediate mode buffer contains some data
--  Standard_Boolean       myUseTransparency;
-   Standard_Boolean       myUseZBuffer;
-   Standard_Boolean       myUseDepthTest;
-   Standard_Boolean       myUseGLLight;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ProjLib/ProjLib_ProjectedCurve.cxx OCCT-6.8.0_SRC-patch/src/ProjLib/ProjLib_ProjectedCurve.cxx
---- OCCT-6.8.0_SRC/src/ProjLib/ProjLib_ProjectedCurve.cxx      2014-11-11 17:47:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ProjLib/ProjLib_ProjectedCurve.cxx        2015-01-16 12:59:57.000000000 +0300
-@@ -53,6 +53,7 @@
- #include <Geom2d_TrimmedCurve.hxx>
- #include <ElCLib.hxx>
- #include <GeomLib.hxx>
-+#include <Extrema_ExtPC.hxx>
- //=======================================================================
- //function : IsoIsDeg
-@@ -482,7 +483,16 @@
-             IsTrimmed[0] = Standard_True;
-             f = f + dt;
-             myCurve = myCurve->Trim(f, l, Precision::Confusion());
--            Vsingular[0] = ElCLib::Parameter(L, P);
-+            // Searching the parameter on the basis curve for surface of revolution
-+            Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
-+            if (anExtr.IsDone())
-+            {
-+              Standard_Integer anIndex = 1;
-+              while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
-+              Vsingular[0] = anExtr.Point(anIndex).Parameter();
-+            }
-+            else
-+              Vsingular[0] = ElCLib::Parameter(L, P);
-             //SingularCase[0] = 3;
-           }
-@@ -492,7 +502,16 @@
-             IsTrimmed[1] = Standard_True;
-             l = l - dt;
-             myCurve = myCurve->Trim(f, l, Precision::Confusion());
--            Vsingular[1] = ElCLib::Parameter(L, P);
-+            // Searching the parameter on the basis curve for surface of revolution
-+            Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance);
-+            if (anExtr.IsDone())
-+            {
-+              Standard_Integer anIndex = 1;
-+              while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++;
-+              Vsingular[1] = anExtr.Point(anIndex).Parameter();
-+            }
-+            else
-+              Vsingular[1] = ElCLib::Parameter(L, P);
-             //SingularCase[1] = 4;
-           }
-         }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/QABugs/QABugs_11.cxx OCCT-6.8.0_SRC-patch/src/QABugs/QABugs_11.cxx
---- OCCT-6.8.0_SRC/src/QABugs/QABugs_11.cxx    2014-11-11 17:47:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/QABugs/QABugs_11.cxx      2015-01-16 13:01:24.000000000 +0300
-@@ -236,10 +236,10 @@
-   anAISCtx->AddOrRemoveCurrentObject(aSh4);
-   //remove all this objects from context
--  anAISCtx->Clear(aSh1, Standard_False);
--  anAISCtx->Clear(aSh2, Standard_False);
--  anAISCtx->Clear(aSh3, Standard_False);
--  anAISCtx->Clear(aSh4, Standard_False);
-+  anAISCtx->Remove (aSh1, Standard_False);
-+  anAISCtx->Remove (aSh2, Standard_False);
-+  anAISCtx->Remove (aSh3, Standard_False);
-+  anAISCtx->Remove (aSh4, Standard_False);
-   return 0;
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/SelectMgr/SelectMgr_EntityOwner.cxx OCCT-6.8.0_SRC-patch/src/SelectMgr/SelectMgr_EntityOwner.cxx
---- OCCT-6.8.0_SRC/src/SelectMgr/SelectMgr_EntityOwner.cxx     2014-11-11 17:47:04.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/SelectMgr/SelectMgr_EntityOwner.cxx       2015-01-16 13:00:02.000000000 +0300
-@@ -129,7 +129,7 @@
- TopLoc_Location SelectMgr_EntityOwner::Location() const
- {
--  return !HasSelectable() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
-+  return !HasLocation() ? TopLoc_Location() : TopLoc_Location(mySelectable->Transformation());
- }
- void SelectMgr_EntityOwner::ResetLocation()
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cdl OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cdl
---- OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cdl     2014-11-11 17:47:05.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cdl       2015-01-16 13:00:03.000000000 +0300
-@@ -135,6 +135,12 @@
-       ---C++: inline
-         ---Purpose: Returns (modifiable) the mode for applying 
-         --          ShapeFix::FixVertexPosition before all fixes, by default False.
-+        
-+        FixVertexTolMode (me: mutable) returns Integer;
-+      ---C++: return &
-+      ---C++: inline
-+        ---Purpose: Returns (modifiable) the mode for fixing tolerances of vertices on whole shape 
-+        --         after performing all fixes
- fields  
-     myResult    : Shape from TopoDS is protected;
-@@ -147,6 +153,7 @@
-     myFixWireMode          : Integer is protected;
-     myFixSameParameterMode : Integer is protected;
-     myFixVertexPositionMode : Integer is protected;
-+    myFixVertexTolMode      : Integer is protected;
-     myStatus    : Integer is protected;
- end Shape;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cxx OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cxx
---- OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.cxx     2014-11-11 17:47:05.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.cxx       2015-01-16 13:00:03.000000000 +0300
-@@ -53,6 +53,7 @@
-   myFixWireMode  = -1;
-   myFixSameParameterMode = -1;
-   myFixVertexPositionMode =0;
-+  myFixVertexTolMode = -1;
-   myFixSolid = new ShapeFix_Solid;
- }
-@@ -71,6 +72,7 @@
-   myFixSameParameterMode = -1;
-   myFixSolid = new ShapeFix_Solid;
-   myFixVertexPositionMode =0;
-+  myFixVertexTolMode = -1;
-   Init(shape);
- }
-@@ -97,7 +99,7 @@
- Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)& theProgress) 
- {
-   Standard_Integer savFixSmallAreaWireMode = 0;
--
-+  Standard_Integer savFixVertexTolMode =  myFixVertexTolMode;
-   Handle(ShapeFix_Face) fft = Handle(ShapeFix_Face)::DownCast( FixFaceTool() );
-   if ( !fft.IsNull() ) {
-     savFixSmallAreaWireMode = fft->FixSmallAreaWireMode();
-@@ -142,7 +144,7 @@
-     TopoDS_Shape shape = myShape;
-     Standard_Boolean savFixSameParameterMode = myFixSameParameterMode;
-     myFixSameParameterMode = Standard_False;
--
-+    myFixVertexTolMode = Standard_False;
-     Standard_Integer aShapesNb = 0;
-     for ( TopoDS_Iterator anIter(S); anIter.More(); anIter.Next() )
-       ++aShapesNb;
-@@ -159,6 +161,7 @@
-       return Standard_False; // aborted execution
-     myFixSameParameterMode = savFixSameParameterMode;
-+    myFixVertexTolMode = savFixVertexTolMode;
-     myShape = shape;
-     break;
-   }
-@@ -242,6 +245,26 @@
-   {
-     SameParameter(myResult, Standard_False, theProgress);
-   }
-+  if( NeedFix( myFixVertexTolMode))
-+  {
-+    Standard_Integer nbF = 0;
-+    TopExp_Explorer anExpF(myResult, TopAbs_FACE);
-+    for( ; anExpF.More() && nbF <= 1; anExpF.Next())
-+      nbF++;
-+    if( nbF > 1)
-+    {
-+      //fix for bug  0025455 
-+      // for case when vertex belong to the different faces it is necessary to check vertices tolerances
-+      //after all fixes.
-+      //This fix it should be performed for example for case when cutting edge was performed.
-+
-+      Handle(ShapeFix_Edge) sfe = FixEdgeTool();
-+      TopExp_Explorer anExpE (myResult, TopAbs_EDGE);
-+      for ( ; anExpE.More(); anExpE.Next()) 
-+        sfe->FixVertexTolerance( TopoDS::Edge (anExpE.Current()));
-+
-+    }
-+  }
-   if ( !fft.IsNull() )
-     fft->FixSmallAreaWireMode() = savFixSmallAreaWireMode;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.lxx OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.lxx
---- OCCT-6.8.0_SRC/src/ShapeFix/ShapeFix_Shape.lxx     2014-11-11 17:47:05.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ShapeFix/ShapeFix_Shape.lxx       2015-01-16 13:00:03.000000000 +0300
-@@ -122,3 +122,13 @@
- {
-   return myFixVertexPositionMode;
- }
-+
-+//=======================================================================
-+//function : FixVertexTolMode
-+//purpose  : 
-+//=======================================================================
-+
-+inline Standard_Integer& ShapeFix_Shape::FixVertexTolMode() 
-+{
-+  return myFixVertexTolMode;
-+}
-\ No newline at end of file
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_Plane.cxx OCCT-6.8.0_SRC-patch/src/V3d/V3d_Plane.cxx
---- OCCT-6.8.0_SRC/src/V3d/V3d_Plane.cxx       2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_Plane.cxx 2015-01-16 13:00:15.000000000 +0300
-@@ -70,7 +70,6 @@
-   Graphic3d_MaterialAspect aPlastic (Graphic3d_NOM_PLASTIC);
-   aPlastic.SetColor (theColor);
-   aPlastic.SetTransparency (0.5);
--  theView->SetTransparency (Standard_True);
-   anAsp->SetFrontMaterial (aPlastic);
-   anAsp->SetInteriorStyle (Aspect_IS_HATCH);
-   anAsp->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_View_2.cxx OCCT-6.8.0_SRC-patch/src/V3d/V3d_View_2.cxx
---- OCCT-6.8.0_SRC/src/V3d/V3d_View_2.cxx      2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_View_2.cxx        2015-01-16 13:01:25.000000000 +0300
-@@ -21,7 +21,6 @@
-      --------------------------------
-       00-09-92 : GG  ; Creation.
-       24-12-97 : FMN ; Suppression de GEOMLITE
--      21-02-00 : GG  ; Add Transparency() method
-       23-11-00 : GG  ; Add IsActiveLight() and IsActivePlane() methods
- ************************************************************************/
-@@ -102,18 +101,6 @@
- }
--void V3d_View::SetTransparency(const Standard_Boolean AnActivity) {
--
--  MyTransparencyFlag = AnActivity;
--  MyView->SetTransparency(AnActivity);
--}
--
--
--Standard_Boolean V3d_View::Transparency() const {
--
--  return MyTransparencyFlag;
--}
--
- void V3d_View::InitActiveLights() {
- myActiveLightsIterator.Initialize(MyActiveLights);
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_View.cdl OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cdl
---- OCCT-6.8.0_SRC/src/V3d/V3d_View.cdl        2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cdl  2015-01-16 13:01:25.000000000 +0300
-@@ -35,8 +35,6 @@
- --              -> Add SetProjModel() method.
- --      VKH - 15/11/99 : G004
- --              -> Add method Dump()
----      GG  - IMP210200
----              -> Add Transparency() method
- --      THA  - 17/08/00 Thomas HARTL <t-hartl@muenchen.matra-dtv.fr>
- --              -> Add Print method (works only under Windows).
- --      GG  - IMP231100
-@@ -415,10 +413,6 @@
-         ---Level: Public
-         ---Purpose: Returns TRUE when the light is active in this view.
--        SetTransparency( me : mutable ; AnActivity : Boolean = Standard_False);
--        ---Level: Public
--        ---Purpose: Activate/Deactivate the transparency in this view.
--
-         SetImmediateUpdate(me: mutable; theImmediateUpdate: Boolean from Standard)
-         returns Boolean from Standard;
-         ---Purpose: sets the immediate update mode and returns the previous one.
-@@ -1141,10 +1135,6 @@
-         ---Level: Public
-         -- purpose: return the current environment texture used
--        Transparency(me) returns Boolean from Standard;
--        ---Level: Public
--        ---Purpose: Returns the transparency activity.
--
-         Visualization ( me ) returns TypeOfVisualization from V3d;
-         ---Level: Public
-         ---Purpose: Returns the current visualisation mode.
-@@ -1638,7 +1628,6 @@
-         MyGridEchoStructure             :       Structure from Graphic3d;
-         MyGridEchoGroup                 :       Group from Graphic3d;
--        MyTransparencyFlag      : Boolean from Standard;
-         myImmediateUpdate: Boolean from Standard is protected;
-         myXscreenAxis           : Vector from Graphic3d;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/V3d/V3d_View.cxx OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cxx
---- OCCT-6.8.0_SRC/src/V3d/V3d_View.cxx        2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/V3d/V3d_View.cxx  2015-01-16 13:00:15.000000000 +0300
-@@ -251,8 +251,6 @@
-   aCamera->SetProjectionType ((Type == V3d_ORTHOGRAPHIC)
-     ? Graphic3d_Camera::Projection_Orthographic
-     : Graphic3d_Camera::Projection_Perspective);
--
--  MyTransparencyFlag = Standard_False;
- }
- //=============================================================================
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/ViewerTest/ViewerTest.cxx OCCT-6.8.0_SRC-patch/src/ViewerTest/ViewerTest.cxx
---- OCCT-6.8.0_SRC/src/ViewerTest/ViewerTest.cxx       2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/ViewerTest/ViewerTest.cxx 2015-01-16 13:01:25.000000000 +0300
-@@ -241,7 +241,7 @@
-        Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theName));
-     if (!anOldObj.IsNull())
--      aContextAIS->Clear (anOldObj, Standard_True);
-+      aContextAIS->Remove (anOldObj, Standard_True);
-     // remove name and old object from map
-     aMap.UnBind2 (theName);
-@@ -2751,7 +2751,7 @@
-   }
-   else
-   {
--    anAISContext->Clear (anIO, Standard_False);
-+    anAISContext->Remove (anIO, Standard_False);
-     aTexturedIO = new AIS_TexturedShape (DBRep::Get (theArgv[1]));
-     GetMapOfAIS().UnBind1 (anIO);
-     GetMapOfAIS().UnBind2 (aShapeName);
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ContextView.cxx OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ContextView.cxx
---- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ContextView.cxx       2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ContextView.cxx 2015-01-16 13:00:15.000000000 +0300
-@@ -57,7 +57,7 @@
- MyVisual (Visual3d_TOV_WIREFRAME),
- MyLights (),
- MyTextureEnv(),
--MySurfaceDetail(Visual3d_TOD_NONE),
-+MySurfaceDetail(Visual3d_TOD_ALL),
- myClipPlanes()
- {
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cdl OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cdl
---- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cdl      2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cdl        2015-01-16 13:00:15.000000000 +0300
-@@ -1045,15 +1045,6 @@
-         -- or insufficient memory.
-       --  Warning: Works only under Windows.
--      SetTransparency ( me : mutable;
--              AFlag : Boolean from Standard )
--              is static;
--      ---Level: Advanced
--      ---Purpose: if <AFlag> is Standard_True then the transparency
--      --          is managed in the view <me>.
--      --          Default Standard_False
--      ---Category: Internal methods
--
-       ZBufferIsActivated ( me )
-               returns Boolean from Standard
-               is static;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cxx OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cxx
---- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_View.cxx      2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_View.cxx        2015-01-16 13:00:15.000000000 +0300
-@@ -805,7 +805,6 @@
-   {
-     myGraphicDriver->ActivateView (MyCView);
-     myGraphicDriver->Background   (MyCView);
--    myGraphicDriver->Transparency (MyCView, myViewManager->Transparency());
-     MyCView.Active = 1;
-@@ -1801,22 +1800,6 @@
- }
- // =======================================================================
--// function : SetTransparency
--// purpose  :
--// =======================================================================
--void Visual3d_View::SetTransparency (const Standard_Boolean theActivity)
--{
--  if (IsDeleted()
--  || !IsDefined()
--  || !IsActive())
--  {
--    return;
--  }
--
--  myGraphicDriver->Transparency (MyCView, theActivity);
--}
--
--// =======================================================================
- // function : SetZBufferActivity
- // purpose  :
- // =======================================================================
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cdl OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cdl
---- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cdl       2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cdl 2015-01-16 13:00:15.000000000 +0300
-@@ -411,24 +411,6 @@
-       --          if <AStructure> is displayed in <AProjector> and TOS_COMPUTED.
-       ---Category: Private methods
--      Transparency ( me )
--              returns Boolean from Standard
--              is static;
--      ---Level: Advanced
--      ---Purpose: Returns Standard_True if the transparency
--      --          is activated in all activated views.
--      --          Default Standard_False
--      ---Category: Internal methods
--
--      SetTransparency ( me : mutable;
--              AFlag : Boolean from Standard )
--              is static;
--      ---Level: Advanced
--      ---Purpose: if <AFlag> is Standard_True then the transparency
--      --          is managed.
--      --          Default Standard_False
--      ---Category: Internal methods
--
-       ZBufferAuto ( me )
-               returns Boolean from Standard
-               is static;
-@@ -473,7 +455,6 @@
-       -- advanced
-       MyZBufferAuto                   :       Boolean from Standard;
--      MyTransparency                  :       Boolean from Standard;
-         -- Z layer indexes
-         myLayerIds                      :       MapOfInteger from TColStd;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cxx OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cxx
---- OCCT-6.8.0_SRC/src/Visual3d/Visual3d_ViewManager.cxx       2014-11-11 17:47:15.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/src/Visual3d/Visual3d_ViewManager.cxx 2015-01-16 13:01:25.000000000 +0300
-@@ -83,8 +83,7 @@
- Graphic3d_StructureManager (theDriver),
- MyDefinedView (),
- MyViewGenId (View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*(Visual3d_ViewManager::CurrentId ()-1),View_IDMIN+((View_IDMIN+View_IDMAX)/(Visual3d_ViewManager::Limit ()))*Visual3d_ViewManager::CurrentId ()-1),
--MyZBufferAuto (Standard_False),
--MyTransparency (Standard_False)
-+MyZBufferAuto (Standard_False)
- {
-   // default layer is always presented in display layer sequence
-   // it can not be removed
-@@ -558,24 +557,6 @@
-   MyViewGenId.Free(aViewId);
- }
--void Visual3d_ViewManager::SetTransparency (const Standard_Boolean AFlag)
--{
--  if (MyTransparency && AFlag) return;
--  if (! MyTransparency && ! AFlag) return;
--
--  for(int i=1; i<=MyDefinedView.Length(); i++)
--  {
--    (MyDefinedView.Value(i))->SetTransparency(AFlag);
--  }
--
--  MyTransparency = AFlag;
--}
--
--Standard_Boolean Visual3d_ViewManager::Transparency () const
--{
--  return (MyTransparency);
--}
--
- void Visual3d_ViewManager::SetZBufferAuto (const Standard_Boolean AFlag)
- {
-   if (MyZBufferAuto && AFlag) return;
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/boolean/bcut_complex/N9 OCCT-6.8.0_SRC-patch/tests/boolean/bcut_complex/N9
---- OCCT-6.8.0_SRC/tests/boolean/bcut_complex/N9       2014-11-11 17:47:21.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/boolean/bcut_complex/N9 2015-01-16 13:00:21.000000000 +0300
-@@ -1,8 +1,8 @@
- # Original bug : pro14942
- # Date : 26Aout98
--#CR23958 puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
--#CR23958 puts "TODO #22911 ALL: Error : The area of the resulting shape is"
-+puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
-+puts "TODO #22911 ALL: Error : The area of the resulting shape is"
- restore [locate_data_file CTO904_pro14942a.rle] a 
- restore [locate_data_file pro14942b.rle] b
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/boolean/bfuse_complex/P1 OCCT-6.8.0_SRC-patch/tests/boolean/bfuse_complex/P1
---- OCCT-6.8.0_SRC/tests/boolean/bfuse_complex/P1      2014-11-11 17:47:22.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/boolean/bfuse_complex/P1        2015-01-16 13:00:23.000000000 +0300
-@@ -1,4 +1,5 @@
- puts "TODO ?OCC24157 ALL: Error : The area of the resulting shape is"
-+puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_"
- # cts17861
- restore [locate_data_file CTO900_cts17861a.rle] a
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/boolean/bopcommon_complex/J1 OCCT-6.8.0_SRC-patch/tests/boolean/bopcommon_complex/J1
---- OCCT-6.8.0_SRC/tests/boolean/bopcommon_complex/J1  2014-11-11 17:47:23.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/boolean/bopcommon_complex/J1    2015-01-16 13:00:24.000000000 +0300
-@@ -1,3 +1,6 @@
-+puts "TODO #22911 ALL: Error : The bopcommon is not valid. The area is"
-+puts "TODO #22911 ALL: Error : The area of the resulting shape is"
-+
- restore [locate_data_file a158] a
- restore [locate_data_file b148] b
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/begin OCCT-6.8.0_SRC-patch/tests/bugs/begin
---- OCCT-6.8.0_SRC/tests/bugs/begin    2014-11-11 17:47:29.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/begin      2015-01-16 13:01:25.000000000 +0300
-@@ -253,7 +253,7 @@
- }
- # Check if list of xdistcs-command is valid
--proc checkList {List Tolerance D_good} {
-+proc checkList {List Tolerance D_good Limit_Tol} {
-    set L1 [llength ${List}]
-    set L2 10
-    set L3 5
-@@ -266,7 +266,14 @@
-       set D [lindex ${List} ${j2}]
-       #puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
-       if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
--         puts "Error: i=${i} T=${T} D=${D}"
-+         puts "Error : T=${T} D=${D}"
-+      }
-+      
-+      if { ${Tolerance} > ${Limit_Tol} } {
-+        if { [expr abs(${D} - ${D_good})] > ${Limit_Tol} 
-+             && [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
-+           puts "Attention (critical value of tolerance) : T=${T} D=${D}"
-+        }
-       }
-    }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/heal/bug25455 OCCT-6.8.0_SRC-patch/tests/bugs/heal/bug25455
---- OCCT-6.8.0_SRC/tests/bugs/heal/bug25455    1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/heal/bug25455      2015-01-16 13:00:32.000000000 +0300
-@@ -0,0 +1,21 @@
-+puts "============"
-+puts "OCC25455"
-+puts "============"
-+puts ""
-+######################################################
-+# fixshape works at the second attempt
-+######################################################
-+
-+restore [locate_data_file bug25455_rx.brep] rx
-+
-+fixshape rx rx
-+
-+set info [checkshape rx]
-+
-+# Resume
-+puts ""
-+if { [regexp {This shape seems to be valid} ${info}] } {
-+   puts "OK: fixshape works properly"
-+} else {
-+   puts "Error: fixshape works bad"
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_1 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_1
---- OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_1      2014-11-11 17:47:31.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_1        2015-01-16 13:01:25.000000000 +0300
-@@ -22,16 +22,16 @@
-   renamevar p_1 result
-   set status 0
--  set length 110.161
--  set nb_v_good 4
--  set nb_e_good 4
-+  set length 110.167
-+  set nb_v_good 1
-+  set nb_e_good 1
-   set nb_w_good 1
-   set nb_f_good 0
-   set nb_sh_good 0
-   set nb_sol_good 0
-   set nb_compsol_good 0
-   set nb_compound_good 0
--  set nb_shape_good 9
-+  set nb_shape_good 3
- }
- if { ${mistake} != 0 } {
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_2 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_2
---- OCCT-6.8.0_SRC/tests/bugs/modalg_1/bug16517_2      2014-11-11 17:47:31.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_1/bug16517_2        2015-01-16 13:01:25.000000000 +0300
-@@ -22,16 +22,16 @@
-   renamevar p_2 result
-   set status 0
--  set length 110.171
--  set nb_v_good 4
--  set nb_e_good 4
-+  set length 110.167
-+  set nb_v_good 1
-+  set nb_e_good 1
-   set nb_w_good 1
-   set nb_f_good 0
-   set nb_sh_good 0
-   set nb_sol_good 0
-   set nb_compsol_good 0
-   set nb_compound_good 0
--  set nb_shape_good 9
-+  set nb_shape_good 3
- }
- # Resume
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22864 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22864
---- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22864        2014-11-11 17:47:32.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22864  2015-01-16 13:00:34.000000000 +0300
-@@ -18,15 +18,15 @@
- #
- set status 0
- #
--set nb_v_good 8
--set nb_e_good 12
--set nb_w_good 4
--set nb_f_good 4
-+set nb_v_good 2
-+set nb_e_good 3
-+set nb_w_good 1
-+set nb_f_good 1
- set nb_sh_good 0
- set nb_sol_good 0
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 29
-+set nb_shape_good 8
- #
- set Numbers 11
- #
-@@ -95,7 +95,7 @@
-     puts "Faulty ${BugNumber}"
- }
--set square 8444.76
-+set square 6606.88
- set 2dviewer 0
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22967 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22967
---- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug22967        2014-11-11 17:47:32.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug22967  2015-01-16 13:00:34.000000000 +0300
-@@ -7,7 +7,7 @@
- ###########################################################################################################
- set BugNumber OCC22967
--set check_value 3.46945e-006
-+set check_value 8.46459e-006
- restore [locate_data_file bug22967_Cylinder_1.brep] b1 
- restore [locate_data_file bug22967_Scale_1.brep] b2 
-@@ -54,6 +54,6 @@
-    puts "OK ${BugNumber}"
- }
--set square 669221
-+set square 668843
- set 2dviewer 0
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug23218 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug23218
---- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug23218        2014-11-11 17:47:32.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug23218  2015-01-16 13:00:35.000000000 +0300
-@@ -19,7 +19,7 @@
- puts $result
- puts "Finish project operation ..."
--set GoodToleranceReached 2.4950140688989345e-006
-+set GoodToleranceReached 6.3315853638232248e-007
- regexp {Tolerance Reached=([-0-9.+eE]+)} $result full ToleranceReached
- proc GetPercent {Value GoodValue} {
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug472_3 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug472_3
---- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug472_3        2014-11-11 17:47:32.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug472_3  2015-01-16 13:00:35.000000000 +0300
-@@ -1,7 +1,7 @@
- #puts "TODO OCC12345 ALL: Faulty shapes in variables faulty_1 to faulty_"
- #puts "TODO OCC12345 ALL: Error : The square of result shape is"
--puts "TODO OCC12345 ALL: Error : The command is not valid"
--puts "TODO OCC12345 ALL: Error : Result shape is WRONG because it must contains"
-+#puts "TODO OCC12345 ALL: Error : The command is not valid"
-+#puts "TODO OCC12345 ALL: Error : Result shape is WRONG because it must contains"
- puts "========================"
- puts " OCC472 "
-@@ -20,8 +20,8 @@
- bfuse result b1 b2
--set nb_v_good 5
--set nb_e_edge 7
--set square 0
-+set nb_v_good 66
-+set nb_e_edge 107
-+set square 31657.5
- set 2dviewer 0
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug497_3 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug497_3
---- OCCT-6.8.0_SRC/tests/bugs/modalg_2/bug497_3        2014-11-11 17:47:32.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_2/bug497_3  2015-01-16 13:00:35.000000000 +0300
-@@ -15,5 +15,5 @@
- bcut result a_1 a_2
--set square 1773.6
-+set square 2471.48
- set 2dviewer 0
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24154 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24154
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24154        2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24154  2015-01-16 13:01:25.000000000 +0300
-@@ -12,18 +12,19 @@
- bop b1 b2
- bopcut result
--set square 2.68434e+06
-+#set square 2.68434e+06
-+set square 5.21269e+06
- set volume 7.35468e+07
- # Analysis of "nbshapes res"
- set nb_v_good 18
--set nb_e_good 27
--set nb_w_good 11
--set nb_f_good 11
-+set nb_e_good 36
-+set nb_w_good 18
-+set nb_f_good 18
- set nb_sh_good 1
- set nb_sol_good 1
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 70
-+set nb_shape_good 93
- set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24798 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24798
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24798        2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24798  2015-01-16 13:00:37.000000000 +0300
-@@ -12,17 +12,17 @@
- bop b1 b2
- bopcut result
--set square 1826.15
-+set square 1826.16
- # Analysis of "nbshapes res"
--set nb_v_good 49
--set nb_e_good 72
-+set nb_v_good 44
-+set nb_e_good 67
- set nb_w_good 29
- set nb_f_good 22
- set nb_sh_good 1
- set nb_sol_good 1
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 175
-+set nb_shape_good 165
- set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_common OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_common
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_common 2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_common   2015-01-16 13:00:37.000000000 +0300
-@@ -43,16 +43,16 @@
- bfillds
- bbop result 0
--set square 10008.5
-+set square 10008.9
--set nb_v_good 260
--set nb_e_good 306
-+set nb_v_good 140
-+set nb_e_good 186
- set nb_w_good 126
- set nb_f_good 126
- set nb_sh_good 40
- set nb_sol_good 40
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 899
-+set nb_shape_good 659
- set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_cut OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_cut
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_cut    2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_cut      2015-01-16 13:00:37.000000000 +0300
-@@ -45,14 +45,14 @@
- set square 103838
--set nb_v_good 280
--set nb_e_good 338
-+set nb_v_good 160
-+set nb_e_good 218
- set nb_w_good 142
- set nb_f_good 80
- set nb_sh_good 3
- set nb_sol_good 3
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 847
-+set nb_shape_good 607
- set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_fuse OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_fuse
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24825_fuse   2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24825_fuse     2015-01-16 13:00:37.000000000 +0300
-@@ -46,14 +46,14 @@
- set square 157211
--set nb_v_good 280
--set nb_e_good 338
-+set nb_v_good 160
-+set nb_e_good 218
- set nb_w_good 142
- set nb_f_good 80
- set nb_sh_good 1
- set nb_sol_good 1
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 843
-+set nb_shape_good 603
- set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24981 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24981
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug24981        2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug24981  2015-01-16 13:00:37.000000000 +0300
-@@ -20,14 +20,14 @@
- bfillds
- bbuild result
--set nb_v_good 268
--set nb_e_good 366
-+set nb_v_good 170
-+set nb_e_good 268
- set nb_w_good 243
- set nb_f_good 195
- set nb_sh_good 75
- set nb_sol_good 75
- set nb_compsol_good 0
- set nb_compound_good  1
--set nb_shape_good 1223
-+set nb_shape_good 1027
- set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_11 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_11
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_11     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_11       2015-01-16 13:00:37.000000000 +0300
-@@ -6,6 +6,12 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # bopcurves command
- restore [locate_data_file bug25292_Input_0.brep] b1
-@@ -21,11 +27,17 @@
- #############################
- regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
-+
-+#This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid. 
- set MaxTol 1.e-7
-+
-+#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 4
-+
- if {${Toler} > ${MaxTol}} {
-   puts "Error: Tolerance is too big!"
- }
--set GoodNbCurv 7
-+
- if {${NbCurv} != ${GoodNbCurv}} {
-   puts "Error: Curve Number is bad!"
- }
-@@ -34,105 +46,54 @@
- # 1
- puts ""
--puts "First curve"
- mksurface s1 f1
- mksurface s2 f2
--dlog reset
--dlog on
--xdistcs c_1 s1 0 1 10
--set Log1 [dlog get]
--
--set List1 [split ${Log1} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List1} ${Tolerance} ${D_good}
--
--# 2
--puts ""
--puts "Second curve"
--
--dlog reset
--dlog on
--xdistcs c_2 s1 0 1 10
--set Log2 [dlog get]
--
--set List2 [split ${Log2} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List2} ${Tolerance} ${D_good}
--
--# 3
--puts ""
--puts "Third curve"
--
--dlog reset
--dlog on
--xdistcs c_3 s1 0 1 10
--set Log3 [dlog get]
--
--set List3 [split ${Log3} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List3} ${Tolerance} ${D_good}
--
--# 4
--puts ""
--puts "Fourth curve"
--
--dlog reset
--dlog on
--xdistcs c_4 s1 0 1 10
--set Log4 [dlog get]
--
--set List4 [split ${Log4} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List4} ${Tolerance} ${D_good}
--
--# 5
--puts ""
--puts "Fifth curve"
--
--dlog reset
--dlog on
--xdistcs c_5 s1 0 1 10
--set Log5 [dlog get]
--
--set List5 [split ${Log5} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List5} ${Tolerance} ${D_good}
--
--# 6
--puts ""
--puts "Sixth curve"
--
--dlog reset
--dlog on
--xdistcs c_6 s1 0 1 10
--set Log6 [dlog get]
--
--set List6 [split ${Log6} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List6} ${Tolerance} ${D_good}
--
--# 7
--puts ""
--puts "Seventh curve"
--
--dlog reset
--dlog on
--xdistcs c_7 s1 0 1 10
--set Log7 [dlog get]
--
--set List7 [split ${Log7} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List7} ${Tolerance} ${D_good}
--
-+for {set i 1} {$i <= ${NbCurv}} {incr i} {
-+  set log [dump c_$i]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+
-+  puts "U1=${U1}"
-+  puts "U2=${U2}"
-+  
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s1 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s2 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+}
- v2d
- 2dfit
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_12 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_12
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_12     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_12       2015-01-16 13:00:37.000000000 +0300
-@@ -1,5 +1,3 @@
--puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
--
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -8,6 +6,12 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # bopcurves command
- restore [locate_data_file bug25292_Input_0.brep] b1
-@@ -23,11 +27,17 @@
- #############################
- regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
-+
-+#This value must be equal to the analogical value in bug25292_11 and bug25292_12 of "bugs modalg_5" testgrid. 
- set MaxTol 1.e-7
-+
-+#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 4
-+
- if {${Toler} > ${MaxTol}} {
-   puts "Error: Tolerance is too big!"
- }
--set GoodNbCurv 7
-+
- if {${NbCurv} != ${GoodNbCurv}} {
-   puts "Error: Curve Number is bad!"
- }
-@@ -36,112 +46,55 @@
- # 1
- puts ""
--puts "First curve"
- mksurface s1 f1
- mksurface s2 f2
--dlog reset
--dlog on
--xdistcs c_1 s1 0 1 10
--set Log1 [dlog get]
--
--set List1 [split ${Log1} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List1} ${Tolerance} ${D_good}
--
--# 2
--puts ""
--puts "Second curve"
--
--dlog reset
--dlog on
--xdistcs c_2 s1 0 1 10
--set Log2 [dlog get]
--
--set List2 [split ${Log2} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List2} ${Tolerance} ${D_good}
--
--# 3
--puts ""
--puts "Third curve"
--
--dlog reset
--dlog on
--xdistcs c_3 s1 0 1 10
--set Log3 [dlog get]
--
--set List3 [split ${Log3} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List3} ${Tolerance} ${D_good}
--
--# 4
--puts ""
--puts "Fourth curve"
--
--dlog reset
--dlog on
--xdistcs c_4 s1 0 1 10
--set Log4 [dlog get]
--
--set List4 [split ${Log4} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List4} ${Tolerance} ${D_good}
--
--# 5
--if { [info exist c_5] } {
--puts ""
--puts "Fifth curve"
--
--dlog reset
--dlog on
--xdistcs c_5 s1 0 1 10
--set Log5 [dlog get]
--
--set List5 [split ${Log5} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List5} ${Tolerance} ${D_good}
--}
--
--# 6
--if { [info exist c_6] } {
--puts ""
--puts "Sixth curve"
--
--dlog reset
--dlog on
--xdistcs c_6 s1 0 1 10
--set Log6 [dlog get]
--
--set List6 [split ${Log6} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List6} ${Tolerance} ${D_good}
-+for {set i 1} {$i <= ${NbCurv}} {incr i} {
-+  set log [dump c_$i]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+
-+  puts "U1=${U1}"
-+  puts "U2=${U2}"
-+  
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s1 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s2 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
- }
--# 7
--if { [info exist c_7] } {
--puts ""
--puts "Seventh curve"
--
--dlog reset
--dlog on
--xdistcs c_7 s1 0 1 10
--set Log7 [dlog get]
--
--set List7 [split ${Log7} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List7} ${Tolerance} ${D_good}
--}
--
--
- v2d
- 2dfit
- set only_screen_axo 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_13 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_13
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_13     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_13       2015-01-16 13:00:37.000000000 +0300
-@@ -23,14 +23,14 @@
- set square 289.348
--set nb_v_good 12
--set nb_e_good 18
-+set nb_v_good 9
-+set nb_e_good 15
- set nb_w_good 10
- set nb_f_good 10
- set nb_sh_good 3
- set nb_sol_good 3
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 57
-+set nb_shape_good 51
- set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_14 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_14
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_14     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_14       2015-01-16 13:00:37.000000000 +0300
-@@ -1,7 +1,3 @@
--puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 12 vertices instead of 9"
--puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 18 edges instead of 15"
--puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 57 shapes instead of 51"
--
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -27,14 +23,14 @@
- set square 289.348
--set nb_v_good 12
--set nb_e_good 18
-+set nb_v_good 9
-+set nb_e_good 15
- set nb_w_good 10
- set nb_f_good 10
- set nb_sh_good 3
- set nb_sol_good 3
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 57
-+set nb_shape_good 51
- set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_15 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_15
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_15     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_15       2015-01-16 13:01:25.000000000 +0300
-@@ -6,8 +6,37 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+
- # intersect command
-+#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 4
-+
- restore [locate_data_file bug25292_Input_0.brep] b1
- restore [locate_data_file bug25292_Input_1.brep] b2
-@@ -20,11 +49,98 @@
- mksurface s2 f2
- #################
--intersect i s1 s2
-+intersect res s1 s2
- #################
--
--if { [info exist i_7] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_16 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_16
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_16     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_16       2015-01-16 13:01:25.000000000 +0300
-@@ -1,5 +1,3 @@
--puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
--
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -8,8 +6,37 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+
- # intersect command
-+#This value must be equal to the analogical value in bug25292_11, bug25292_12, bug25292_15 and bug25292_16 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 4
-+
- restore [locate_data_file bug25292_Input_0.brep] b1
- restore [locate_data_file bug25292_Input_1.brep] b2
-@@ -22,11 +49,99 @@
- mksurface s2 f2
- #################
--intersect i s2 s1
-+intersect res s2 s1
- #################
--if { [info exist i_7] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_21 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_21
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_21     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_21       2015-01-16 13:00:37.000000000 +0300
-@@ -6,6 +6,12 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # bopcurves command
- restore [locate_data_file bug25292_Input_3.brep] b1
-@@ -17,66 +23,74 @@
- copy b2_1 f2
- #########################
--set log [bopcurves f1 f2]
-+set log [bopcurves f1 f2 -2d]
- #########################
- regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
-+
-+#This value must be equal to the analogical value in bug25292_21 and bug25292_22 of "bugs modalg_5" testgrid. 
- set MaxTol 1.e-7
-+
-+#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 2
-+
- if {${Toler} > ${MaxTol}} {
-   puts "Error: Tolerance is too big!"
- }
--set GoodNbCurv 3
-+
- if {${NbCurv} != ${GoodNbCurv}} {
-   puts "Error: Curve Number is bad!"
- }
- #-------------
--# 1
--puts ""
--puts "First curve"
--
- mksurface s1 f1
- mksurface s2 f2
--dlog reset
--dlog on
--xdistcs c_1 s1 0 1 10
--set Log1 [dlog get]
--
--set List1 [split ${Log1} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List1} ${Tolerance} ${D_good}
--
--# 2
--puts ""
--puts "Second curve"
--
--dlog reset
--dlog on
--xdistcs c_2 s1 0 1 10
--set Log2 [dlog get]
--
--set List2 [split ${Log2} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List2} ${Tolerance} ${D_good}
--
--# 3
--puts ""
--puts "Third curve"
--
--dlog reset
--dlog on
--xdistcs c_3 s1 0 1 10
--set Log3 [dlog get]
--
--set List3 [split ${Log3} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List3} ${Tolerance} ${D_good}
--
-+for {set i 1} {$i <= ${NbCurv}} {incr i} {
-+  set log [dump c_$i]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+
-+  puts "U1=${U1}"
-+  puts "U2=${U2}"
-+  
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s1 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s2 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+}
- smallview
- fit
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_22 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_22
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_22     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_22       2015-01-16 13:00:37.000000000 +0300
-@@ -1,5 +1,3 @@
--puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
--
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -8,6 +6,12 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # bopcurves command
- restore [locate_data_file bug25292_Input_3.brep] b1
-@@ -19,69 +23,75 @@
- copy b2_1 f2
- #########################
--set log [bopcurves f2 f1]
-+set log [bopcurves f2 f1 -2d]
- #########################
- regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
-+
-+#This value must be equal to the analogical value in bug25292_21 and bug25292_22 of "bugs modalg_5" testgrid. 
- set MaxTol 1.e-7
-+
-+#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 2
-+
- if {${Toler} > ${MaxTol}} {
-   puts "Error: Tolerance is too big!"
- }
--set GoodNbCurv 3
-+
- if {${NbCurv} != ${GoodNbCurv}} {
-   puts "Error: Curve Number is bad!"
- }
- #-------------
--# 1
--puts ""
--puts "First curve"
--
- mksurface s1 f1
- mksurface s2 f2
--dlog reset
--dlog on
--xdistcs c_1 s1 0 1 10
--set Log1 [dlog get]
--
--set List1 [split ${Log1} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List1} ${Tolerance} ${D_good}
--
--# 2
--puts ""
--puts "Second curve"
--
--dlog reset
--dlog on
--xdistcs c_2 s1 0 1 10
--set Log2 [dlog get]
--
--set List2 [split ${Log2} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List2} ${Tolerance} ${D_good}
--
--# 3
--if { [info exist c_3] } {
--puts ""
--puts "Third curve"
--
--dlog reset
--dlog on
--xdistcs c_3 s1 0 1 10
--set Log3 [dlog get]
--
--set List3 [split ${Log3} {TD= \t\n}]
--set Tolerance 1.0e-7
--set D_good 0.
--checkList ${List3} ${Tolerance} ${D_good}
-+for {set i 1} {$i <= ${NbCurv}} {incr i} {
-+  set log [dump c_$i]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+
-+  puts "U1=${U1}"
-+  puts "U2=${U2}"
-+  
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s1 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s2 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance 1.0e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
- }
--
- smallview
- fit
- set only_screen_axo 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_23 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_23
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_23     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_23       2015-01-16 13:00:37.000000000 +0300
-@@ -21,16 +21,17 @@
- bfillds
- bbuild result
-+#These values must be equal to the analogical values in bug25292_23 and bug25292_24 of "bugs modalg_5" testgrid. 
- set square 31.6797
--set nb_v_good 11
--set nb_e_good 20
-+set nb_v_good 10
-+set nb_e_good 19
- set nb_w_good 13
- set nb_f_good 13
- set nb_sh_good 3
- set nb_sol_good 3
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 64
-+set nb_shape_good 62
- set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_24 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_24
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_24     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_24       2015-01-16 13:00:37.000000000 +0300
-@@ -1,8 +1,3 @@
--puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 11 vertices instead of 10"
--puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 20 edges instead of 19"
--puts "TODO OCC225404 Debian60-64 Windows: Error : Result shape is WRONG because it must contains 64 shapes instead of 62"
--
--
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -26,16 +21,17 @@
- bfillds
- bbuild result
-+#These values must be equal to the analogical values in bug25292_23 and bug25292_24 of "bugs modalg_5" testgrid. 
- set square 31.6797
--set nb_v_good 11
--set nb_e_good 20
-+set nb_v_good 10
-+set nb_e_good 19
- set nb_w_good 13
- set nb_f_good 13
- set nb_sh_good 3
- set nb_sol_good 3
- set nb_compsol_good 0
- set nb_compound_good 1
--set nb_shape_good 64
-+set nb_shape_good 62
- set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_25 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_25
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_25     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_25       2015-01-16 13:01:25.000000000 +0300
-@@ -6,8 +6,37 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+
- # intersect command
-+#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 2
-+
- restore [locate_data_file bug25292_Input_3.brep] b1
- restore [locate_data_file bug25292_Input_11.brep] b2
-@@ -20,11 +49,100 @@
- mksurface s2 f2
- #################
--intersect i s1 s2
-+intersect res s1 s2
- #################
--if { [info exist i_3] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.1e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.1e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.1e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.1e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-+
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_26 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_26
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_26     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_26       2015-01-16 13:01:25.000000000 +0300
-@@ -1,5 +1,3 @@
--puts "TODO OCC225404 Debian60-64 Windows: Error: Curve Number is bad!"
--
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -8,8 +6,37 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+
- # intersect command
-+#This value must be equal to the analogical value in bug25292_21, bug25292_22, bug25292_25 and bug25292_26 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 2
-+
- restore [locate_data_file bug25292_Input_3.brep] b1
- restore [locate_data_file bug25292_Input_11.brep] b2
-@@ -22,12 +49,99 @@
- mksurface s2 f2
- #################
--intersect i s2 s1
-+intersect res s2 s1
- #################
--if { [info exist i_3] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.1e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.1e-7
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.1e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.1e-7
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
--
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_31 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_31
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_31     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_31       2015-01-16 13:01:25.000000000 +0300
-@@ -6,6 +6,12 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # bopcurves command
- restore [locate_data_file bug25292_f1.brep] f1
-@@ -16,48 +22,69 @@
- #############################
- regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
--set MaxTol 1.e-3
-+
-+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
-+set MaxTol 3.e-4
-+
-+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 1
-+
- if {${Toler} > ${MaxTol}} {
-   puts "Error: Tolerance is too big!"
- }
--set GoodNbCurv 2
- if {${NbCurv} != ${GoodNbCurv}} {
-   puts "Error: Curve Number is bad!!"
- }
- #-------------
--# 1
--puts ""
--puts "First curve"
--
- mksurface s1 f1
- mksurface s2 f2
--dlog reset
--dlog on
--xdistcs c_1 s1 0 1 10
--set Log1 [dlog get]
--
--set List1 [split ${Log1} {TD= \t\n}]
--set Tolerance 1.0e-4
--set D_good 0.
--checkList ${List1} ${Tolerance} ${D_good}
--
--# 2
--puts ""
--puts "Second curve"
--
--dlog reset
--dlog on
--xdistcs c_2 s1 0 1 10
--set Log2 [dlog get]
--
--set List2 [split ${Log2} {TD= \t\n}]
--set Tolerance 1.0e-4
--set D_good 0.
--checkList ${List2} ${Tolerance} ${D_good}
--
-+for {set i 1} {$i <= ${NbCurv}} {incr i} {
-+  set log [dump c_$i]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+
-+  puts "U1=${U1}"
-+  puts "U2=${U2}"
-+  
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s1 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance MaxTol
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s2 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance MaxTol
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+}
- smallview
- fit
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_32 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_32
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_32     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_32       2015-01-16 13:01:25.000000000 +0300
-@@ -1,3 +1,5 @@
-+puts "TODO OCC25331 Debian60-64: Error: Tolerance is too big!"
-+
- puts "================"
- puts "OCC25292"
- puts "================"
-@@ -6,6 +8,12 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # bopcurves command
- restore [locate_data_file bug25292_f1.brep] f1
-@@ -16,48 +24,69 @@
- #############################
- regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
--set MaxTol 1.e-3
-+
-+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
-+set MaxTol 3.e-4
-+
-+#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 1
-+
- if {${Toler} > ${MaxTol}} {
-   puts "Error: Tolerance is too big!"
- }
--set GoodNbCurv 2
- if {${NbCurv} != ${GoodNbCurv}} {
-   puts "Error: Curve Number is bad!!"
- }
- #-------------
--# 1
--puts ""
--puts "First curve"
--
- mksurface s1 f1
- mksurface s2 f2
--dlog reset
--dlog on
--xdistcs c_1 s1 0 1 10
--set Log1 [dlog get]
--
--set List1 [split ${Log1} {TD= \t\n}]
--set Tolerance 1.0e-4
--set D_good 0.
--checkList ${List1} ${Tolerance} ${D_good}
--
--# 2
--puts ""
--puts "Second curve"
--
--dlog reset
--dlog on
--xdistcs c_2 s1 0 1 10
--set Log2 [dlog get]
--
--set List2 [split ${Log2} {TD= \t\n}]
--set Tolerance 1.0e-4
--set D_good 0.
--checkList ${List2} ${Tolerance} ${D_good}
--
-+for {set i 1} {$i <= ${NbCurv}} {incr i} {
-+  set log [dump c_$i]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+
-+  puts "U1=${U1}"
-+  puts "U2=${U2}"
-+  
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s1 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance MaxTol
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+
-+  dlog reset
-+  dlog on
-+  xdistcs c_$i s2 ${U1} ${U2} 10
-+  set Log2 [dlog get]
-+  set List2 [split ${Log2} {TD= \t\n}]
-+  set Tolerance MaxTol
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
-+}
- smallview
- fit
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_33 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_33
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_33     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_33       2015-01-16 13:00:37.000000000 +0300
-@@ -6,8 +6,37 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+
- # intersect command
-+#This value must be equal to the analogical value in bug25292_33 and bug25292_34 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 1
-+
- restore [locate_data_file bug25292_f1.brep] f1
- restore [locate_data_file bug25292_f2.brep] f2
-@@ -15,11 +44,99 @@
- mksurface s2 f2
- #################
--intersect i s1 s2
-+intersect res s1 s2
- #################
--if { [info exist i] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.0e-6
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.0e-6
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.0e-6
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.0e-6
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_34 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_34
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_34     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_34       2015-01-16 13:00:37.000000000 +0300
-@@ -6,8 +6,37 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+
- # intersect command
-+#This value must be equal to the analogical value in bug25292_33 and bug25292_34 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 1
-+
- restore [locate_data_file bug25292_f1.brep] f1
- restore [locate_data_file bug25292_f2.brep] f2
-@@ -15,11 +44,99 @@
- mksurface s2 f2
- #################
--intersect i s2 s1
-+intersect res s2 s1
- #################
--if { [info exist i] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.0e-6
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 1.0e-6
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.0e-6
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 1.0e-6
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_35 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_35
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_35     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_35       2015-01-16 13:01:25.000000000 +0300
-@@ -6,8 +6,38 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # intersect command for trimmed surfaces
-+#This value must be equal to the analogical value in bug25292_35 and bug25292_36 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 2
-+
- restore [locate_data_file bug25292_f1.brep] f1
- restore [locate_data_file bug25292_f2.brep] f2
-@@ -21,11 +51,99 @@
- trim s2t s2 0. 1.570796326795 -275 275
- ###################
--intersect k s1t s2t
-+intersect res s1t s2t
- ###################
--if { [info exist k_2] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-4
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-4
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-4
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-4
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_36 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_36
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25292_36     2014-11-11 17:47:34.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25292_36       2015-01-16 13:01:25.000000000 +0300
-@@ -6,8 +6,38 @@
- # Face/Face intersection algorithm gives different results for different order of the arguments
- #######################################################################
-+proc GetRange { curve } {
-+  global U1
-+  global U2
-+  
-+  set log [uplevel dump $curve]
-+  
-+  regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
-+  puts "Degree=${Degree}"
-+  puts "Poles=${Poles}"
-+  puts "KnotsPoles=${KnotsPoles}"
-+  puts ""
-+
-+  set Knot 1
-+  set exp_string "Knots :\n\n +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U1 Mult1
-+
-+  set Knot ${KnotsPoles}
-+  set exp_string " +${Knot} :  +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
-+  regexp ${exp_string} ${log} full U2 Mult2
-+}
-+
-+puts "##############################"
-+puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
-+puts "##############################"
-+puts ""
-+puts ""
-+
- # intersect command for trimmed surfaces
-+#This value must be equal to the analogical value in bug25292_35 and bug25292_36 of "bugs modalg_5" testgrid. 
-+set GoodNbCurv 2
-+
- restore [locate_data_file bug25292_f1.brep] f1
- restore [locate_data_file bug25292_f2.brep] f2
-@@ -21,11 +51,99 @@
- trim s2t s2 0. 1.570796326795 -275 275
- ###################
--intersect k s2t s1t
-+intersect res s2t s1t
- ###################
--if { [info exist k_2] } {
--  puts "OK: Curve Number is good!"
-+set che [whatis res]
-+set ind [string first "3d curve" $che]
-+if {${ind} >= 0} {
-+  #Only variable "res" exists
-+  
-+  if { $GoodNbCurv == 1 } {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
-+  
-+  set U1 0.0
-+  set U2 0.0
-+  
-+  GetRange res
-+
-+  puts "U1 = ${U1}"
-+  puts "U2 = ${U2}"
-+
-+  if {[expr {$U2 - $U1}] < 1.0e-20} {
-+    puts "Error: Wrong curve's range!"
-+  }
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s1 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-4
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+  
-+  dlog reset
-+  dlog on
-+  xdistcs res s2 ${U1} ${U2} 10
-+  set Log1 [dlog get]
-+  set List1 [split ${Log1} {TD= \t\n}]
-+  set Tolerance 3.0e-4
-+  set Limit_Tol 1.0e-7
-+  set D_good 0.
-+  checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
- } else {
--  puts "Error: Curve Number is bad!"
-+  set ic 1
-+  set AllowRepeate 1
-+  while { $AllowRepeate != 0 } {
-+    set che [whatis res_$ic]
-+    set ind [string first "3d curve" $che]
-+    if {${ind} < 0} {
-+      set AllowRepeate 0
-+    } else {
-+      set U1 0.0
-+      set U2 0.0
-+      
-+      GetRange res_$ic
-+      
-+      puts "U1 = ${U1}"
-+      puts "U2 = ${U2}"
-+      
-+      if {[expr {$U2 - $U1}] < 1.0e-20} {
-+        puts "Error: Wrong curve's range!"
-+      }
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s1 ${U1} ${U2} 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-4
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      dlog reset
-+      dlog on
-+      xdistcs res_$ic s2 0 1 10
-+      set Log1 [dlog get]
-+      set List1 [split ${Log1} {TD= \t\n}]
-+      set Tolerance 3.0e-4
-+      set Limit_Tol 1.0e-7
-+      set D_good 0.
-+      checkList ${List1} ${Tolerance} ${D_good} ${Limit_Tol}
-+      
-+      incr ic
-+    }
-+  }
-+  
-+  if {[expr {$ic - 1}] == $GoodNbCurv} {
-+    puts "OK: Curve Number is good!"
-+  } else {
-+    puts "Error: Curve Number is bad!"
-+  }
- }
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25432 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25432
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25432        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25432  2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,33 @@
-+puts "============"
-+puts "OCC25432"
-+puts "============"
-+puts ""
-+#########################################################################
-+# Wrong result obtained by MakerVolume operator.
-+#########################################################################
-+
-+restore [locate_data_file bug25432_qz.brep] q
-+
-+explode q f
-+mkvolume result q_1 q_2 q_3 q_4 q_5 q_6 q_7 q_8 q_9 q_10 q_11 -ni
-+
-+regexp {Mass +: +([-0-9.+eE]+)} [vprops result] full volume
-+
-+set expected_volume 0.26776
-+set tol_abs_volume 1.0e-4
-+set tol_rel_volume 0.0001
-+checkreal "Volume" ${volume} ${expected_volume} ${tol_abs_volume} ${tol_rel_volume}
-+
-+set square 3.59972
-+
-+set nb_v_good 12
-+set nb_e_good 20
-+set nb_w_good 11
-+set nb_f_good 11
-+set nb_sh_good 2
-+set nb_sol_good 2
-+set nb_compsol_good 0
-+set nb_compound_good 1
-+set nb_shape_good 59
-+
-+set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25449 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25449
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25449        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25449  2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,31 @@
-+puts "================"
-+puts "OCC25449"
-+puts "================"
-+puts ""
-+#######################################################################
-+# Excess vertex in result of General Fuse operation.
-+#######################################################################
-+
-+restore [locate_data_file bug25449_fz351.brep] b1
-+restore [locate_data_file bug25449_ez679.brep] b2
-+
-+bclearobjects
-+bcleartools
-+baddobjects b1 b2
-+
-+bfillds -t
-+bbuild result
-+
-+set square 21.1115
-+
-+set nb_v_good 4
-+set nb_e_good 4
-+set nb_w_good 1
-+set nb_f_good 1
-+set nb_sh_good 0
-+set nb_sol_good 0
-+set nb_compsol_good 0
-+set nb_compound_good 1
-+set nb_shape_good 11
-+
-+set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_1 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_1
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_1      1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_1        2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,26 @@
-+puts "================"
-+puts "OCC25450"
-+puts "================"
-+puts ""
-+####################################
-+# Common operation returns wrong shape
-+####################################
-+
-+restore [locate_data_file bug25450_Shape.brep] a
-+
-+explode a
-+bcommon result a_1 a_2
-+
-+set square 142153
-+
-+set nb_v_good 8
-+set nb_e_good 12
-+set nb_w_good 4
-+set nb_f_good 4
-+set nb_sh_good 1
-+set nb_sol_good 0
-+set nb_compsol_good 0
-+set nb_compound_good 1
-+set nb_shape_good 30
-+
-+set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_2 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_2
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25450_2      1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25450_2        2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,27 @@
-+puts "================"
-+puts "OCC25450"
-+puts "================"
-+puts ""
-+####################################
-+# Common operation returns wrong shape
-+####################################
-+
-+restore [locate_data_file bug25450_b1.brep] b1
-+restore [locate_data_file bug25450_b2.brep] b2
-+
-+bop b1 b2
-+bopcommon result
-+
-+set square 35538.3
-+
-+set nb_v_good 4
-+set nb_e_good 4
-+set nb_w_good 1
-+set nb_f_good 1
-+set nb_sh_good 1
-+set nb_sol_good 0
-+set nb_compsol_good 0
-+set nb_compound_good 1
-+set nb_shape_good 12
-+
-+set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25456 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25456
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25456        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25456  2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,17 @@
-+puts "============"
-+puts "OCC25456"
-+puts "============"
-+puts ""
-+###############################
-+## BOPAlgo_CheckerSI reports an error on the given shape
-+###############################
-+
-+restore [locate_data_file bug25456_shape.brep] a
-+
-+set info [bopcheck a]
-+
-+if {[string compare ${info} " This shape seems to be OK.\n"] == 0} {
-+    puts "OK: BOPAlgo_CheckerSI report is good"
-+} else {
-+    puts "Error : BOPAlgo_CheckerSI report is wrong"
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_1 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_1
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_1      1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_1        2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,31 @@
-+puts "========"
-+puts "OCC25465"
-+puts "========"
-+puts ""
-+################################################
-+# Excess vertex in the result of CUT operation
-+################################################
-+
-+restore [locate_data_file OCC25465_Gorivo.brep] b1
-+restore [locate_data_file OCC25465_Translation_1.brep] b2
-+
-+explode b1 f
-+explode b2 f
-+set bug_info [bopcurves b1_3 b2_4]
-+bop b1 b2
-+bopcut result
-+
-+# It is strictly forbidden to change nb_v_good and nb_e_good values (see OCC25465)
-+set nb_v_good 11
-+set nb_e_good 17
-+set nb_w_good 8
-+set nb_f_good 8
-+set nb_sh_good 1
-+set nb_sol_good 1
-+set nb_compsol_good 0
-+set nb_compound_good 1
-+set nb_shape_good 47
-+
-+if {[lindex $bug_info 2] != 3} {
-+  puts "ERROR: OCC25465 is reproduced."
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_2 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_2
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25465_2      1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25465_2        2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,31 @@
-+puts "========"
-+puts "OCC25465"
-+puts "========"
-+puts ""
-+################################################
-+# Excess vertex in the result of CUT operation
-+################################################
-+
-+restore [locate_data_file OCC25465_t_boite1.brep] b1
-+restore [locate_data_file OCC25465_c_cyl.brep] b2
-+
-+explode b1 f
-+explode b2 f
-+set bug_info [bopcurves b1_6 b2_1]
-+bop b1 b2
-+bopcut result
-+
-+# It is strictly forbidden to change nb_v_good and nb_e_good values (see OCC25465)
-+set nb_v_good 13
-+set nb_e_good 20
-+set nb_w_good 11
-+set nb_f_good 8
-+set nb_sh_good 1
-+set nb_sol_good 1
-+set nb_compsol_good 0
-+set nb_compound_good 1
-+set nb_shape_good 55
-+
-+if {[lindex $bug_info 2] != 2} {
-+  puts "ERROR: OCC25465 is reproduced."
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25480 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25480
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25480        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25480  2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,26 @@
-+puts "============"
-+puts "OCC25480"
-+puts "============"
-+puts ""
-+#######################################################################
-+# Incorrect result of BRepOffsetAPI_MakePipe
-+#######################################################################
-+
-+restore [locate_data_file bug25480_part1.brep] a
-+restore [locate_data_file bug25480_part2.brep] b
-+
-+pipe result b a 1
-+
-+set square 48441
-+
-+set nb_v_good 224
-+set nb_e_good 392
-+set nb_w_good 196
-+set nb_f_good 196
-+set nb_sh_good 14
-+set nb_sol_good 14
-+set nb_compsol_good 0
-+set nb_compound_good 8
-+set nb_shape_good 1044
-+
-+set 2dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25488 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25488
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25488        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25488  2015-01-16 13:01:25.000000000 +0300
-@@ -0,0 +1,34 @@
-+puts "========"
-+puts "OCC25488"
-+puts "========"
-+puts ""
-+######################################################
-+# Wrong result of two trimmed cylinders intersection
-+######################################################
-+
-+set Tolerance 3.0e-7
-+set D_good 0.
-+set Limit_Tol 1.0e-7
-+
-+restore [locate_data_file OCC25488_sb1_1t.draw] sb1
-+restore [locate_data_file OCC25488_sb2_1t.draw] sb2
-+
-+set bug_info [intersect res sb1 sb2]
-+
-+set i 0
-+while {$i != [llength $bug_info]} {
-+  set res_i [lindex $bug_info $i]
-+  dlog reset
-+  dlog on
-+  xdistcs ${res_i} sb1 0 1 10
-+  set BugLog [dlog get]
-+  set BugList [split ${BugLog} {TD= \t\n}]
-+  checkList ${BugList} ${Tolerance} ${D_good} ${Limit_Tol}
-+  dlog reset
-+  dlog on
-+  xdistcs ${res_i} sb2 0 1 10
-+  set BugLog [dlog get]
-+  set BugList [split ${BugLog} {TD= \t\n}]
-+  checkList ${BugList} ${Tolerance} ${D_good} ${Limit_Tol}
-+  set i [expr {$i + 1}]
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25505 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25505
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25505        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25505  2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,39 @@
-+puts "============"
-+puts "OCC25505"
-+puts "============"
-+puts ""
-+###############################
-+## General Fuse produces self-intersection shape
-+###############################
-+
-+restore [locate_data_file bug25505_q.brep] q
-+
-+explode q
-+
-+bclearobjects
-+bcleartools
-+baddobjects q_1 q_2 q_3 q_4
-+bfillds
-+bbuild result
-+
-+set info [bopcheck result]
-+
-+if {[string compare ${info} " This shape seems to be OK.\n"] == 0} {
-+    puts "OK: General Fuse produces good shape"
-+} else {
-+    puts "Error : General Fuse produces self-intersection shape"
-+}
-+
-+set square 68796.4
-+
-+set nb_v_good 14
-+set nb_e_good 21
-+set nb_w_good 9
-+set nb_f_good 9
-+set nb_sh_good 7
-+set nb_sol_good 4
-+set nb_compsol_good 0
-+set nb_compound_good  1
-+set nb_shape_good 65
-+
-+set 3dviewer 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25592 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25592
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25592        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25592  2015-01-16 13:00:38.000000000 +0300
-@@ -0,0 +1,50 @@
-+puts "============"
-+puts "OCC25592"
-+puts "============"
-+puts ""
-+######################################################
-+# Bad result of Fillet operation
-+######################################################
-+
-+restore [locate_data_file bug25592_tshape.brep] t
-+explode t e
-+shape c c
-+add t_4 c
-+add t_6 c
-+fillet r t 30 c
-+explode r f
-+
-+set info1 [bopargcheck r_2 #f]
-+if { [regexp "to be valid for BOP" ${info1}] == 1 } {
-+    puts "1. OK : Good result of Fillet operation\n"
-+} else {
-+    puts "1. Error : Bad result of Fillet operation\n"
-+}
-+
-+set info2 [bopargcheck r_1 #f]
-+if { [regexp "to be valid for BOP" ${info2}] == 1 } {
-+    puts "2. OK : Good result of Fillet operation\n"
-+} else {
-+    puts "2. Error : Bad result of Fillet operation\n"
-+}
-+
-+set info3 [bopargcheck r_6 #f]
-+if { [regexp "to be valid for BOP" ${info3}] == 1 } {
-+    puts "3. OK : Good result of Fillet operation\n"
-+} else {
-+    puts "3. Error : Bad result of Fillet operation\n"
-+}
-+
-+set info4 [bopargcheck r_7 #f]
-+if { [regexp "to be valid for BOP" ${info4}] == 1 } {
-+    puts "4. OK : Good result of Fillet operation\n"
-+} else {
-+    puts "4. Error : Bad result of Fillet operation\n"
-+}
-+
-+set info5 [bopargcheck r_9 #f]
-+if { [regexp "to be valid for BOP" ${info5}] == 1 } {
-+    puts "5. OK : Good result of Fillet operation\n"
-+} else {
-+    puts "5. Error : Bad result of Fillet operation\n"
-+}
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25657 OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25657
---- OCCT-6.8.0_SRC/tests/bugs/modalg_5/bug25657        1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/modalg_5/bug25657  2015-01-16 13:01:25.000000000 +0300
-@@ -0,0 +1,25 @@
-+puts "========"
-+puts "OCC25657"
-+puts "========"
-+puts ""
-+###########################################################################################
-+#  Bad result of Fillet operation
-+###########################################################################################
-+
-+restore [locate_data_file bug25657_r4.brep] r4
-+explode r4 e
-+shape c c
-+add r4_15 c
-+fillet res r4 20 c
-+
-+explode res f
-+
-+pcurve res_2
-+# exception
-+
-+pcurve res_5
-+# exception
-+
-+smallview
-+fit
-+set only_screen_axo 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_1 OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_1
---- OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_1        2014-11-11 17:47:35.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_1  2015-01-16 13:00:39.000000000 +0300
-@@ -1,3 +1,5 @@
-+puts "TODO CR25432 ALL: Error : The square of result shape is"
-+
- puts "================"
- puts "OCC26"
- puts "================"
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_2 OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_2
---- OCCT-6.8.0_SRC/tests/bugs/moddata_2/bug26_2        2014-11-11 17:47:35.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/moddata_2/bug26_2  2015-01-16 13:00:39.000000000 +0300
-@@ -1,3 +1,5 @@
-+puts "TODO CR25432 ALL: Error : The square of result shape is"
-+
- puts "================"
- puts "OCC26"
- puts "================"
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/moddata_3/bug25494 OCCT-6.8.0_SRC-patch/tests/bugs/moddata_3/bug25494
---- OCCT-6.8.0_SRC/tests/bugs/moddata_3/bug25494       1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/moddata_3/bug25494 2015-01-16 13:00:40.000000000 +0300
-@@ -0,0 +1,14 @@
-+puts "================"
-+puts "OCC25494"
-+puts "================"
-+puts ""
-+#######################################################################
-+# Wrong result obtained by projection algorithm
-+#######################################################################
-+
-+restore [locate_data_file bug25494_s.draw] s
-+restore [locate_data_file bug25494_c.draw] c
-+
-+project c2d c s
-+
-+dump c2d
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/vis/bug25492 OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25492
---- OCCT-6.8.0_SRC/tests/bugs/vis/bug25492     1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25492       2015-01-16 13:00:41.000000000 +0300
-@@ -0,0 +1,32 @@
-+puts "============"
-+puts "CR25492"
-+puts "============"
-+puts ""
-+#######################################################################
-+# The selected subshape does not have topological relationship
-+# with orginal shape in OCC680
-+#######################################################################
-+pload ALL
-+
-+set isEqual 0
-+vinit
-+box aShape 5 5 5 3 3 3
-+vdisplay aShape
-+vfit
-+vselmode 4 1
-+vselect 100 200
-+vpickselected aSub
-+explode aShape F
-+
-+
-+for {set i 1} {$i <= 6 } {incr i} {
-+  set aRes [compare aShape_$i aSub];
-+  if { [lsearch $aRes equal] != -1} {
-+    set isEqual 1
-+  }
-+}
-+
-+if {$isEqual == 0} {
-+puts "Error: No selected sub-shape was found in exploded sub-shapes"
-+}
-+set only_screen 1
-diff -Naur --exclude=CVS --exclude=.git OCCT-6.8.0_SRC/tests/bugs/vis/bug25528 OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25528
---- OCCT-6.8.0_SRC/tests/bugs/vis/bug25528     1970-01-01 03:00:00.000000000 +0300
-+++ OCCT-6.8.0_SRC-patch/tests/bugs/vis/bug25528       2015-01-16 13:00:41.000000000 +0300
-@@ -0,0 +1,25 @@
-+puts "============"
-+puts "OCC25528"
-+puts "============"
-+puts ""
-+####################################################################################
-+# Visualization - Exception on removing an interactive object from 
-+# a local context
-+# vremove -local <obj_name> crashes if there is an opened local context
-+####################################################################################
-+
-+pload ALL
-+box b 1 2 3
-+vinit
-+vdisplay b
-+vfit
-+
-+# opening a local context for local selection
-+vselmode b 4 1
-+# Select a face just to simulate the scenario used in a real application
-+vselect 200 200
-+# This line should not lead to exception
-+vremove -local b
-+
-+# Screenshot should be empty (box removed successfully)
-+vdump ${imagedir}/${casename}.png