0024971: Incomplete interface of NCollection classes
[occt.git] / src / Prs3d / Prs3d_WFShape.cxx
old mode 100644 (file)
new mode 100755 (executable)
index b1b2136..3c2131c
@@ -1,19 +1,15 @@
-// Copyright (c) 2013 OPEN CASCADE SAS
+// Copyright (c) 2013-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 #include <Prs3d_WFShape.hxx>
 
@@ -180,7 +176,6 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
   Prs3d_NListOfSequenceOfPnt aWireCurves;
   Prs3d_NListOfSequenceOfPnt aFreeCurves;
   Prs3d_NListOfSequenceOfPnt anUnFreeCurves;
-  TColgp_SequenceOfPnt       aShapePoints;
 
   const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number();
   const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number();
@@ -303,17 +298,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
     Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
     for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
     {
-      aNbVertices += anIt.Value().Length();
+      aNbVertices += anIt.Value()->Length();
     }
     Handle(Graphic3d_ArrayOfPolylines) anUIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
     for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
     {
-      TColgp_SequenceOfPnt aPoints;
-      aPoints.Assign (anIt.Value());
-      anUIsoArray->AddBound (aPoints.Length());
-      for (Standard_Integer anI = 1; anI <= aPoints.Length(); ++anI)
+      const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+      anUIsoArray->AddBound (aPoints->Length());
+      for (Standard_Integer anI = 1; anI <= aPoints->Length(); ++anI)
       {
-        anUIsoArray->AddVertex (aPoints.Value (anI));
+        anUIsoArray->AddVertex (aPoints->Value (anI));
       }
     }
     Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@@ -321,23 +315,23 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
     aGroup->AddPrimitiveArray (anUIsoArray);
   }
 
+  // NOTE: THIS BLOCK WILL NEVER EXECUTE AS aVIsoCurves IS NOT FILLED!!
   if (aVIsoCurves.Size() > 0)
   {
     aNbBounds = aVIsoCurves.Size();
     Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
     for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
     {
-      aNbVertices += anIt.Value().Length();
+      aNbVertices += anIt.Value()->Length();
     }
     Handle(Graphic3d_ArrayOfPolylines) VIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
     for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
     {
-      TColgp_SequenceOfPnt aPoints;
-      aPoints.Assign (anIt.Value());
-      VIsoArray->AddBound (aPoints.Length());
-      for (int anI = 1; anI <= aPoints.Length(); anI++)
+      const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+      VIsoArray->AddBound (aPoints->Length());
+      for (int anI = 1; anI <= aPoints->Length(); anI++)
       {
-        VIsoArray->AddVertex (aPoints.Value (anI));
+        VIsoArray->AddVertex (aPoints->Value (anI));
       }
     }
     Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@@ -449,14 +443,14 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
       try
       {
         OCC_CATCH_SIGNALS
-        TColgp_SequenceOfPnt aPoints;
-        if (!AddPolygon (anEdge, aDeflection, aPoints))
+        const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
+        if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
         {
           if (BRep_Tool::IsGeometric (anEdge))
           {
             BRepAdaptor_Curve aCurve (anEdge);
             myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
-                             aPoints, Standard_False);
+                             aPoints->ChangeSequence(), Standard_False);
             aWireCurves.Append (aPoints);
           }
         }
@@ -485,14 +479,14 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
         try
         {
           OCC_CATCH_SIGNALS
-          TColgp_SequenceOfPnt aPoints;
-          if (!AddPolygon (anEdge, aDeflection, aPoints))
+          const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
+          if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
           {
             if (BRep_Tool::IsGeometric (anEdge))
             {
               BRepAdaptor_Curve aCurve (anEdge);
               myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
-                               aPoints, Standard_False);
+                               aPoints->ChangeSequence(), Standard_False);
               aFreeCurves.Append (aPoints);
             }
           }
@@ -520,13 +514,13 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
       try
       {
         OCC_CATCH_SIGNALS
-        TColgp_SequenceOfPnt aPoints;
-        if (!AddPolygon (anEdge, aDeflection, aPoints))
+        const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
+        if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
         {
           if (BRep_Tool::IsGeometric (anEdge))
           {
             BRepAdaptor_Curve aCurve (anEdge);
-            myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints, Standard_False);
+            myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints->ChangeSequence(), Standard_False);
             anUnFreeCurves.Append (aPoints);
           }
         }
@@ -550,17 +544,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
     Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
     for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
     {
-      aNbVertices += anIt.Value().Length();
+      aNbVertices += anIt.Value()->Length();
     }
     Handle(Graphic3d_ArrayOfPolylines) WireArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
     for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
     {
-      TColgp_SequenceOfPnt aPoints;
-      aPoints.Assign (anIt.Value());
-      WireArray->AddBound (aPoints.Length());
-      for (anI = 1; anI <= aPoints.Length(); ++anI)
+      const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+      WireArray->AddBound (aPoints->Length());
+      for (anI = 1; anI <= aPoints->Length(); ++anI)
       {
-        WireArray->AddVertex (aPoints.Value (anI));
+        WireArray->AddVertex (aPoints->Value (anI));
       }
     }
     Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@@ -574,17 +567,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
     Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
     for (anIt.Init (aFreeCurves); anIt.More(); anIt.Next())
     {
-      aNbVertices += anIt.Value().Length();
+      aNbVertices += anIt.Value()->Length();
     }
     Handle(Graphic3d_ArrayOfPolylines) aFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
     for (anIt.Init(aFreeCurves); anIt.More(); anIt.Next())
     {
-      TColgp_SequenceOfPnt aPoints;
-      aPoints.Assign (anIt.Value());
-      aFreeArray->AddBound (aPoints.Length());
-      for (anI = 1; anI <= aPoints.Length(); ++anI)
+      const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+      aFreeArray->AddBound (aPoints->Length());
+      for (anI = 1; anI <= aPoints->Length(); ++anI)
       {
-        aFreeArray->AddVertex (aPoints.Value (anI));
+        aFreeArray->AddVertex (aPoints->Value (anI));
       }
     }  
     Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@@ -598,17 +590,16 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
     Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
     for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
     {
-      aNbVertices += anIt.Value().Length();
+      aNbVertices += anIt.Value()->Length();
     }
     Handle(Graphic3d_ArrayOfPolylines) anUnFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
     for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
     {
-      TColgp_SequenceOfPnt aPoints;
-      aPoints.Assign (anIt.Value());
-      anUnFreeArray->AddBound (aPoints.Length());
-      for (anI = 1; anI <= aPoints.Length(); ++anI)
+      const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+      anUnFreeArray->AddBound (aPoints->Length());
+      for (anI = 1; anI <= aPoints->Length(); ++anI)
       {
-        anUnFreeArray->AddVertex (aPoints.Value (anI));
+        anUnFreeArray->AddVertex (aPoints->Value (anI));
       }
     }
     Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
@@ -617,6 +608,7 @@ void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
   }
 
   // Points
+  TColgp_SequenceOfPnt aShapePoints;
   for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex())
   {
     aShapePoints.Append (BRep_Tool::Pnt (aTool.GetVertex()));