0031137: Modeling Data, BinTools_ShapeSet - avoid allocation of temporary arrays IR-2019-11-08
authorkgv <kgv@opencascade.com>
Wed, 6 Nov 2019 16:26:24 +0000 (19:26 +0300)
committerbugmaster <bugmaster@opencascade.com>
Sat, 9 Nov 2019 16:12:47 +0000 (19:12 +0300)
BinTools_ShapeSet now defines maps with proper types instead of Standard_Transient.
BinTools_ShapeSet now avoids allocation of temporary arrays while reading
triangulation and polygonal data.

Classes Poly_Triangle, Poly_PolygonOnTriangulation, Poly_Polygon3D and Poly_Polygon2D
have been cleared from .lxx files and extended by new methods for preallocating and filling array,
as alternative to passing arrays by copy.

wavefront command - export "f" instead of obsolete "fo" keys into file.
BinTools - added missing tools for reading/writing short reals.

18 files changed:
src/BinTools/BinTools.cxx
src/BinTools/BinTools.hxx
src/BinTools/BinTools_ShapeSet.cxx
src/BinTools/BinTools_ShapeSet.hxx
src/MeshTest/MeshTest.cxx
src/Poly/FILES
src/Poly/Poly_Polygon2D.cxx
src/Poly/Poly_Polygon2D.hxx
src/Poly/Poly_Polygon2D.lxx [deleted file]
src/Poly/Poly_Polygon3D.cxx
src/Poly/Poly_Polygon3D.hxx
src/Poly/Poly_Polygon3D.lxx [deleted file]
src/Poly/Poly_PolygonOnTriangulation.cxx
src/Poly/Poly_PolygonOnTriangulation.hxx
src/Poly/Poly_PolygonOnTriangulation.lxx [deleted file]
src/Poly/Poly_Triangle.cxx [deleted file]
src/Poly/Poly_Triangle.hxx
src/Poly/Poly_Triangle.lxx [deleted file]

index 19f62f2..a02f717 100644 (file)
@@ -49,17 +49,34 @@ Standard_OStream& BinTools::PutInteger(Standard_OStream& OS, const Standard_Inte
 
 //=======================================================================
 //function : PutReal
 
 //=======================================================================
 //function : PutReal
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
+Standard_OStream& BinTools::PutReal (Standard_OStream& theOS,
+                                     const Standard_Real& theValue)
+{
+#if DO_INVERSE
+  const Standard_Real aRValue = InverseReal (theValue);
+  theOS.write((char*)&aRValue, sizeof(Standard_Real));
+#else
+  theOS.write((char*)&theValue, sizeof(Standard_Real));
+#endif
+  return theOS;
+}
 
 
-Standard_OStream& BinTools::PutReal(Standard_OStream& OS, const Standard_Real aValue)
+//=======================================================================
+//function : PutShortReal
+//purpose  :
+//=======================================================================
+Standard_OStream& BinTools::PutShortReal (Standard_OStream& theOS,
+                                          const Standard_ShortReal& theValue)
 {
 {
-  Standard_Real aRValue = aValue;
 #if DO_INVERSE
 #if DO_INVERSE
-      aRValue = InverseReal (aValue);
+  const Standard_ShortReal aValue = InverseShortReal (theValue);
+  theOS.write ((char*)&aValue, sizeof(Standard_ShortReal));
+#else
+  theOS.write ((char*)&theValue, sizeof(Standard_ShortReal));
 #endif
 #endif
-  OS.write((char*)&aRValue, sizeof(Standard_Real));  
-  return OS;
+  return theOS;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
@@ -76,19 +93,39 @@ Standard_OStream& BinTools::PutExtChar(Standard_OStream& OS, const Standard_ExtC
   OS.write((char*)&aSValue, sizeof(Standard_ExtCharacter));  
   return OS;
 }
   OS.write((char*)&aSValue, sizeof(Standard_ExtCharacter));  
   return OS;
 }
+
 //=======================================================================
 //function : GetReal
 //=======================================================================
 //function : GetReal
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
+Standard_IStream& BinTools::GetReal (Standard_IStream& theIS,
+                                     Standard_Real& theValue)
+{
+  if (!theIS.read ((char*)&theValue, sizeof(Standard_Real)))
+  {
+    throw Storage_StreamTypeMismatchError();
+  }
+#if DO_INVERSE
+  theValue = InverseReal (theValue);
+#endif
+  return theIS;
+}
 
 
-Standard_IStream& BinTools::GetReal(Standard_IStream& IS, Standard_Real& aValue)
+//=======================================================================
+//function : GetShortReal
+//purpose  :
+//=======================================================================
+Standard_IStream& BinTools::GetShortReal (Standard_IStream& theIS,
+                                          Standard_ShortReal& theValue)
 {
 {
-  if(!IS.read ((char*)&aValue, sizeof(Standard_Real)))
+  if (!theIS.read ((char*)&theValue, sizeof(Standard_ShortReal)))
+  {
     throw Storage_StreamTypeMismatchError();
     throw Storage_StreamTypeMismatchError();
+  }
 #if DO_INVERSE
 #if DO_INVERSE
-  aValue = InverseReal (aValue);
+  theValue = InverseShortReal (theValue);
 #endif
 #endif
-  return IS;
+  return theIS;
 }
 
 //=======================================================================
 }
 
 //=======================================================================
index 633d587..78b5c0c 100644 (file)
@@ -42,9 +42,10 @@ public:
 
   DEFINE_STANDARD_ALLOC
 
 
   DEFINE_STANDARD_ALLOC
 
-  
-  Standard_EXPORT static Standard_OStream& PutReal (Standard_OStream& OS, const Standard_Real theValue);
-  
+  Standard_EXPORT static Standard_OStream& PutReal (Standard_OStream& OS, const Standard_Real& theValue);
+
+  Standard_EXPORT static Standard_OStream& PutShortReal (Standard_OStream& OS, const Standard_ShortReal& theValue);
+
   Standard_EXPORT static Standard_OStream& PutInteger (Standard_OStream& OS, const Standard_Integer theValue);
   
   Standard_EXPORT static Standard_OStream& PutBool (Standard_OStream& OS, const Standard_Boolean theValue);
   Standard_EXPORT static Standard_OStream& PutInteger (Standard_OStream& OS, const Standard_Integer theValue);
   
   Standard_EXPORT static Standard_OStream& PutBool (Standard_OStream& OS, const Standard_Boolean theValue);
@@ -52,7 +53,9 @@ public:
   Standard_EXPORT static Standard_OStream& PutExtChar (Standard_OStream& OS, const Standard_ExtCharacter theValue);
   
   Standard_EXPORT static Standard_IStream& GetReal (Standard_IStream& IS, Standard_Real& theValue);
   Standard_EXPORT static Standard_OStream& PutExtChar (Standard_OStream& OS, const Standard_ExtCharacter theValue);
   
   Standard_EXPORT static Standard_IStream& GetReal (Standard_IStream& IS, Standard_Real& theValue);
-  
+
+  Standard_EXPORT static Standard_IStream& GetShortReal (Standard_IStream& IS, Standard_ShortReal& theValue);
+
   Standard_EXPORT static Standard_IStream& GetInteger (Standard_IStream& IS, Standard_Integer& theValue);
   
   Standard_EXPORT static Standard_IStream& GetBool (Standard_IStream& IS, Standard_Boolean& theValue);
   Standard_EXPORT static Standard_IStream& GetInteger (Standard_IStream& IS, Standard_Integer& theValue);
   
   Standard_EXPORT static Standard_IStream& GetBool (Standard_IStream& IS, Standard_Boolean& theValue);
index 4299960..35bc4ea 100644 (file)
@@ -725,7 +725,7 @@ void  BinTools_ShapeSet::WriteGeometry(const TopoDS_Shape& S,
       const TopoDS_Face& F = TopoDS::Face(S);
 
       // Write the surface geometry
       const TopoDS_Face& F = TopoDS::Face(S);
 
       // Write the surface geometry
-      Standard_Boolean aNatRes = (BRep_Tool::NaturalRestriction(F)) ? Standard_True : Standard_False;
+      Standard_Boolean aNatRes = BRep_Tool::NaturalRestriction(F);
       BinTools::PutBool (OS, aNatRes);
       BinTools::PutReal (OS, TF->Tolerance());
       BinTools::PutInteger (OS, !TF->Surface().IsNull()
       BinTools::PutBool (OS, aNatRes);
       BinTools::PutReal (OS, TF->Tolerance());
       BinTools::PutInteger (OS, !TF->Surface().IsNull()
@@ -797,7 +797,7 @@ void  BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
 
        BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
        TopLoc_Location L;
 
        BRep_ListOfPointRepresentation& lpr = TV->ChangePoints();
        TopLoc_Location L;
-       Standard_Boolean aNewF = (myFormatNb > 2) ? Standard_True : Standard_False;
+       Standard_Boolean aNewF = (myFormatNb > 2);
        do {
          if(aNewF) {
            val = (Standard_Integer)IS.get();//case {0|1|2|3}
        do {
          if(aNewF) {
            val = (Standard_Integer)IS.get();//case {0|1|2|3}
@@ -1034,8 +1034,8 @@ void  BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
           case 5 : // -5- Polygon3D                     
            BinTools::GetInteger(IS, c);
            BinTools::GetInteger(IS, l);
           case 5 : // -5- Polygon3D                     
            BinTools::GetInteger(IS, c);
            BinTools::GetInteger(IS, l);
-//??? Bug?  myBuilder.UpdateEdge(E,Handle(Poly_Polygon3D)::DownCast(myPolygons3D(c)));
-           myBuilder.UpdateEdge(E,Handle(Poly_Polygon3D)::DownCast(myPolygons3D(c)), Locations().Location(l));
+//??? Bug?  myBuilder.UpdateEdge(E,myPolygons3D(c));
+           myBuilder.UpdateEdge(E, myPolygons3D(c), Locations().Location(l));
             break;
 
           case 6 : // -6- Polygon on triangulation
             break;
 
           case 6 : // -6- Polygon on triangulation
@@ -1047,18 +1047,13 @@ void  BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
 
            BinTools::GetInteger(IS, t);
            BinTools::GetInteger(IS, l);
 
            BinTools::GetInteger(IS, t);
            BinTools::GetInteger(IS, l);
-            if (closed) {
-              myBuilder.UpdateEdge
-                (E, Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt)),
-                 Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt2)),
-                 Handle(Poly_Triangulation)::DownCast(myTriangulations(t)),
-                 Locations().Location(l));
+            if (closed)
+            {
+              myBuilder.UpdateEdge (E, myNodes(pt), myNodes(pt2), myTriangulations(t), Locations().Location(l));
             }
             }
-            else {
-              myBuilder.UpdateEdge
-                (E,Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(pt)),
-                 Handle(Poly_Triangulation)::DownCast(myTriangulations(t)),
-                 Locations().Location(l));
+            else
+            {
+              myBuilder.UpdateEdge (E, myNodes(pt), myTriangulations(t), Locations().Location(l));
             }
             // range            
             break;
             }
             // range            
             break;
@@ -1107,8 +1102,7 @@ void  BinTools_ShapeSet::ReadGeometry(const TopAbs_ShapeEnum T,
       // cas triangulation
        if(aByte == 2) {
          BinTools::GetInteger(IS, s);
       // cas triangulation
        if(aByte == 2) {
          BinTools::GetInteger(IS, s);
-         myBuilder.UpdateFace(TopoDS::Face(S),
-                              Handle(Poly_Triangulation)::DownCast(myTriangulations(s)));
+         myBuilder.UpdateFace(TopoDS::Face(S), myTriangulations(s));
        }
       }
       break;
        }
       }
       break;
@@ -1182,197 +1176,213 @@ void  BinTools_ShapeSet::AddShapes(TopoDS_Shape&       S1,
 
 //=======================================================================
 //function : WritePolygonOnTriangulation
 
 //=======================================================================
 //function : WritePolygonOnTriangulation
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
-
 void BinTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS) const
 {
 void BinTools_ShapeSet::WritePolygonOnTriangulation(Standard_OStream& OS) const
 {
-  Standard_Integer i, j, nbpOntri = myNodes.Extent();
-
-  OS << "PolygonOnTriangulations " << nbpOntri << "\n";
-  Handle(Poly_PolygonOnTriangulation) Poly;
-  Handle(TColStd_HArray1OfReal) Param;
-  try {
+  const Standard_Integer aNbPol = myNodes.Extent();
+  OS << "PolygonOnTriangulations " << aNbPol << "\n";
+  try
+  {
     OCC_CATCH_SIGNALS
     OCC_CATCH_SIGNALS
-    for (i=1; i<=nbpOntri; i++) {
-      Poly = Handle(Poly_PolygonOnTriangulation)::DownCast(myNodes(i));
-      const TColStd_Array1OfInteger& Nodes = Poly->Nodes();
-      BinTools::PutInteger(OS, Nodes.Length());
-      for (j=1; j <= Nodes.Length(); j++) 
-       BinTools::PutInteger(OS,  Nodes.Value(j));
-
-    // writing parameters:
-      Param = Poly->Parameters();
-
-    // write the deflection
-      BinTools::PutReal(OS, Poly->Deflection());
-      if (!Param.IsNull()) {
-       BinTools::PutBool(OS, Standard_True);
-       for (j=1; j <= Param->Length(); j++) 
-         BinTools::PutReal(OS, Param->Value(j)); 
+    for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+    {
+      const Handle(Poly_PolygonOnTriangulation)& aPoly = myNodes.FindKey (aPolIter);
+      const TColStd_Array1OfInteger& aNodes = aPoly->Nodes();
+      BinTools::PutInteger(OS, aNodes.Length());
+      for (Standard_Integer aNodeIter = 1; aNodeIter <= aNodes.Length(); ++aNodeIter)
+      {
+        BinTools::PutInteger(OS, aNodes.Value (aNodeIter));
+      }
+
+      // write the deflection
+      BinTools::PutReal(OS, aPoly->Deflection());
+
+      // writing parameters
+      if (const Handle(TColStd_HArray1OfReal)& aParam = aPoly->Parameters())
+      {
+        BinTools::PutBool(OS, Standard_True);
+        for (Standard_Integer aNodeIter = 1; aNodeIter <= aParam->Length(); ++aNodeIter)
+        {
+          BinTools::PutReal(OS, aParam->Value (aNodeIter));
+        }
+      }
+      else
+      {
+        BinTools::PutBool(OS, Standard_False);
       }
       }
-      else 
-       BinTools::PutBool(OS, Standard_False);
     }
   }
     }
   }
-  catch(Standard_Failure const& anException) {
+  catch (Standard_Failure const& anException)
+  {
     Standard_SStream aMsg;
     Standard_SStream aMsg;
-    aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygonOnTriangulation(..)" << std::endl;
-    aMsg << anException << std::endl;
+    aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygonOnTriangulation(..)\n" << anException << "\n";
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 
 //=======================================================================
 //function : ReadPolygonOnTriangulation
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 
 //=======================================================================
 //function : ReadPolygonOnTriangulation
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
-
 void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
 {
 void BinTools_ShapeSet::ReadPolygonOnTriangulation(Standard_IStream& IS)
 {
-  char buffer[255];
-  IS >> buffer;
-  if (IS.fail() || (strstr(buffer,"PolygonOnTriangulations") == NULL)) {
+  char aHeader[255];
+  IS >> aHeader;
+  if (IS.fail() || (strstr(aHeader,"PolygonOnTriangulations") == NULL))
+  {
     throw Standard_Failure("BinTools_ShapeSet::ReadPolygonOnTriangulation: Not a PolygonOnTriangulation section");
   }
     throw Standard_Failure("BinTools_ShapeSet::ReadPolygonOnTriangulation: Not a PolygonOnTriangulation section");
   }
-  Standard_Integer i, j, val, nbpol = 0, nbnodes =0;
-  Standard_Boolean hasparameters;
-  Standard_Real par;
-  Handle(TColStd_HArray1OfReal) Param;
-  Handle(Poly_PolygonOnTriangulation) Poly;
-  IS >> nbpol;
-  IS.get();//remove LF 
-  try {
-    OCC_CATCH_SIGNALS
-    for (i=1; i<=nbpol; i++) {
-      BinTools::GetInteger(IS, nbnodes);
 
 
-      TColStd_Array1OfInteger Nodes(1, nbnodes);
-      for (j = 1; j <= nbnodes; j++) {
-       BinTools::GetInteger(IS, val);
-       Nodes(j) = val;
+  Standard_Integer aNbPol = 0;
+  IS >> aNbPol;
+  IS.get();//remove LF
+  try
+  {
+    OCC_CATCH_SIGNALS
+    for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+    {
+      Standard_Integer aNbNodes = 0;
+      BinTools::GetInteger(IS, aNbNodes);
+      Handle(Poly_PolygonOnTriangulation) aPoly = new Poly_PolygonOnTriangulation (aNbNodes, Standard_False);
+      TColStd_Array1OfInteger& aNodes = aPoly->ChangeNodes();
+      for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+      {
+        BinTools::GetInteger(IS, aNodes.ChangeValue (aNodeIter));
       }
       }
-      Standard_Real def;
-      BinTools::GetReal(IS, def);
-      BinTools::GetBool(IS, hasparameters);
-      if (hasparameters) {
-       TColStd_Array1OfReal Param1(1, nbnodes);
-       for (j = 1; j <= nbnodes; j++) {
-         BinTools::GetReal(IS, par);
-         Param1(j) = par;
-       }
-       Poly = new Poly_PolygonOnTriangulation(Nodes, Param1);
+
+      Standard_Real aDefl = 0.0;
+      BinTools::GetReal(IS, aDefl);
+      aPoly->Deflection (aDefl);
+
+      Standard_Boolean hasParameters = Standard_False;
+      BinTools::GetBool(IS, hasParameters);
+      if (hasParameters)
+      {
+        Handle(TColStd_HArray1OfReal) aParams = new TColStd_HArray1OfReal (1, aNbNodes);
+        for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+        {
+          BinTools::GetReal(IS, aParams->ChangeValue (aNodeIter));
+        }
+        aPoly->SetParameters (aParams);
       }
       }
-      else Poly = new Poly_PolygonOnTriangulation(Nodes);
-      Poly->Deflection(def);
-      myNodes.Add(Poly);
+      myNodes.Add (aPoly);
     }
   }
     }
   }
-  catch(Standard_Failure const& anException) {
+  catch (Standard_Failure const& anException)
+  {
     Standard_SStream aMsg;
     Standard_SStream aMsg;
-    aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygonOnTriangulation(..)" << std::endl;
-    aMsg << anException << std::endl;
+    aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygonOnTriangulation(..)\n" << anException << "\n";
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 
-
-
 //=======================================================================
 //function : WritePolygon3D
 //=======================================================================
 //function : WritePolygon3D
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
-
 void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS)const
 {
 void BinTools_ShapeSet::WritePolygon3D(Standard_OStream& OS)const
 {
-  Standard_Integer i, j, nbpol = myPolygons3D.Extent();
-  OS << "Polygon3D " << nbpol << "\n";
-  Handle(Poly_Polygon3D) P;
-  try {
+  const Standard_Integer aNbPol = myPolygons3D.Extent();
+  OS << "Polygon3D " << aNbPol << "\n";
+  try
+  {
     OCC_CATCH_SIGNALS
     OCC_CATCH_SIGNALS
-    for (i = 1; i <= nbpol; i++) {
-      P = Handle(Poly_Polygon3D)::DownCast(myPolygons3D(i));
-      BinTools::PutInteger(OS, P->NbNodes());
-      BinTools::PutBool(OS, P->HasParameters()? 1:0);
-
-    // write the deflection
-      BinTools::PutReal(OS, P->Deflection());
-
-    // write the nodes
-      Standard_Integer i1, nbNodes = P->NbNodes();
-      const TColgp_Array1OfPnt& Nodes = P->Nodes();
-      for (j = 1; j <= nbNodes; j++) {
-       BinTools::PutReal(OS, Nodes(j).X());
-       BinTools::PutReal(OS, Nodes(j).Y());
-       BinTools::PutReal(OS, Nodes(j).Z());
+    for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+    {
+      const Handle(Poly_Polygon3D)& aPoly = myPolygons3D.FindKey (aPolIter);
+      BinTools::PutInteger(OS, aPoly->NbNodes());
+      BinTools::PutBool(OS, aPoly->HasParameters());
+
+      // write the deflection
+      BinTools::PutReal(OS, aPoly->Deflection());
+
+      // write the nodes
+      const Standard_Integer  aNbNodes = aPoly->NbNodes();
+      const TColgp_Array1OfPnt& aNodes = aPoly->Nodes();
+      for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+      {
+        const gp_Pnt& aPnt = aNodes.Value (aNodeIter);
+        BinTools::PutReal(OS, aPnt.X());
+        BinTools::PutReal(OS, aPnt.Y());
+        BinTools::PutReal(OS, aPnt.Z());
       }
       }
-      if (P->HasParameters()) {
-       const TColStd_Array1OfReal& Param = P->Parameters();
-       for ( i1 = 1; i1 <= nbNodes; i1++ ) {
-         BinTools::PutReal(OS, Param(i1));
-       }
+      if (aPoly->HasParameters())
+      {
+        const TColStd_Array1OfReal& aParam = aPoly->Parameters();
+        for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+        {
+          BinTools::PutReal(OS, aParam.Value (aNodeIter));
+        }
       }
     }
   }
       }
     }
   }
-  catch(Standard_Failure const& anException) {
+  catch (Standard_Failure const& anException)
+  {
     Standard_SStream aMsg;
     Standard_SStream aMsg;
-    aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygon3D(..)" << std::endl;
-    aMsg << anException << std::endl;
+    aMsg << "EXCEPTION in BinTools_ShapeSet::WritePolygon3D(..)\n" << anException << "\n";
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 //=======================================================================
 //function : ReadPolygon3D
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 //=======================================================================
 //function : ReadPolygon3D
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
-
 void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
 {
 void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
 {
-  char buffer[255];
-  Standard_Integer i, j, p, nbpol=0, nbnodes =0;
-  Standard_Boolean hasparameters = Standard_False;
-  Standard_Real d, x, y, z;
-  IS >> buffer;
+  char aHeader[255];
+  IS >> aHeader;
 
 
-  if (IS.fail() || strstr(buffer,"Polygon3D") == NULL) {
+  if (IS.fail() || strstr(aHeader,"Polygon3D") == NULL)
+  {
 #ifdef OCCT_DEBUG
 #ifdef OCCT_DEBUG
-    std::cout <<"Buffer: " << buffer << std::endl;
+    std::cout <<"Buffer: " << aHeader << std::endl;
 #endif
     throw Standard_Failure("BinTools_ShapeSet::ReadPolygon3D: Not a Polygon3D section");
   }
 #endif
     throw Standard_Failure("BinTools_ShapeSet::ReadPolygon3D: Not a Polygon3D section");
   }
-  Handle(Poly_Polygon3D) P;
-  IS >> nbpol;
-  IS.get();//remove LF 
 
 
-  try {
+  Standard_Integer aNbPol = 0;
+  IS >> aNbPol;
+  IS.get();//remove LF
+  try
+  {
     OCC_CATCH_SIGNALS
     OCC_CATCH_SIGNALS
-    for (i=1; i<=nbpol; i++) {
-      BinTools::GetInteger(IS, nbnodes);
-      BinTools::GetBool(IS, hasparameters);
-      TColgp_Array1OfPnt Nodes(1, nbnodes);
-      BinTools::GetReal(IS, d);
-      for (j = 1; j <= nbnodes; j++) {
-       BinTools::GetReal(IS, x);
-       BinTools::GetReal(IS, y);
-       BinTools::GetReal(IS, z);
-       Nodes(j).SetCoord(x,y,z);
+    for (Standard_Integer aPolIter = 1; aPolIter <= aNbPol; ++aPolIter)
+    {
+      Standard_Integer aNbNodes = 0;
+      Standard_Boolean hasParameters = Standard_False;
+      Standard_Real aDefl = 0.0;
+      BinTools::GetInteger(IS, aNbNodes);
+      BinTools::GetBool(IS, hasParameters);
+      BinTools::GetReal(IS, aDefl);
+
+      Handle(Poly_Polygon3D) aPoly = new Poly_Polygon3D (aNbNodes, hasParameters);
+      aPoly->Deflection (aDefl);
+
+      TColgp_Array1OfPnt& aNodes = aPoly->ChangeNodes();
+      for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+      {
+        gp_XYZ& aPnt = aNodes.ChangeValue (aNodeIter).ChangeCoord();
+        BinTools::GetReal(IS, aPnt.ChangeCoord (1));
+        BinTools::GetReal(IS, aPnt.ChangeCoord (2));
+        BinTools::GetReal(IS, aPnt.ChangeCoord (3));
       }
       }
-      if (hasparameters) {
-       TColStd_Array1OfReal Param(1,nbnodes);
-       for (p = 1; p <= nbnodes; p++) 
-         BinTools::GetReal(IS, Param(p));
-
-       P = new Poly_Polygon3D(Nodes, Param);
+      if (hasParameters)
+      {
+        TColStd_Array1OfReal& aParam = aPoly->ChangeParameters();
+        for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+        {
+          BinTools::GetReal(IS, aParam.ChangeValue (aNodeIter));
+        }
       }
       }
-      else P = new Poly_Polygon3D(Nodes);
-      P->Deflection(d);
-      myPolygons3D.Add(P);
+
+      myPolygons3D.Add (aPoly);
     }
   }
     }
   }
-  catch(Standard_Failure const& anException) {
+  catch (Standard_Failure const& anException)
+  {
     Standard_SStream aMsg;
     Standard_SStream aMsg;
-    aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygon3D(..)" << std::endl;
-    aMsg << anException << std::endl;
+    aMsg << "EXCEPTION in BinTools_ShapeSet::ReadPolygon3D(..)\n" << anException << "\n";
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
@@ -1380,125 +1390,134 @@ void BinTools_ShapeSet::ReadPolygon3D(Standard_IStream& IS)
 
 //=======================================================================
 //function : WriteTriangulation
 
 //=======================================================================
 //function : WriteTriangulation
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
-
 void BinTools_ShapeSet::WriteTriangulation(Standard_OStream& OS) const
 {
 void BinTools_ShapeSet::WriteTriangulation(Standard_OStream& OS) const
 {
-  Standard_Integer i, j, nbNodes, nbtri = myTriangulations.Extent();
-  Standard_Integer nbTriangles = 0, n1, n2, n3;
-    OS << "Triangulations " << nbtri << "\n";
-  Handle(Poly_Triangulation) T;
-  try {
+  const Standard_Integer aNbTriangulations = myTriangulations.Extent();
+  OS << "Triangulations " << aNbTriangulations << "\n";
+
+  try
+  {
     OCC_CATCH_SIGNALS
     OCC_CATCH_SIGNALS
-    for (i = 1; i <= nbtri; i++) {
-      T = Handle(Poly_Triangulation)::DownCast(myTriangulations(i));
-      BinTools::PutInteger(OS, T->NbNodes());
-      BinTools::PutInteger(OS, T->NbTriangles());
-      BinTools::PutBool(OS, T->HasUVNodes()? 1:0);
-    // write the deflection
-      BinTools::PutReal(OS, T->Deflection());
-
-    // write the 3d nodes
-      nbNodes = T->NbNodes();
-      const TColgp_Array1OfPnt& Nodes = T->Nodes();
-      for (j = 1; j <= nbNodes; j++) {
-       BinTools::PutReal(OS, Nodes(j).X());
-       BinTools::PutReal(OS, Nodes(j).Y());
-       BinTools::PutReal(OS, Nodes(j).Z());
+    for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations; ++aTriangulationIter)
+    {
+      const Handle(Poly_Triangulation)& aTriangulation = myTriangulations.FindKey (aTriangulationIter);
+      const Standard_Integer aNbNodes     = aTriangulation->NbNodes();
+      const Standard_Integer aNbTriangles = aTriangulation->NbTriangles();
+      BinTools::PutInteger(OS, aNbNodes);
+      BinTools::PutInteger(OS, aNbTriangles);
+      BinTools::PutBool(OS, aTriangulation->HasUVNodes() ? 1 : 0);
+      BinTools::PutReal(OS, aTriangulation->Deflection());
+
+      // write the 3d nodes
+      const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
+      for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+      {
+        const gp_Pnt& aPnt = aNodes.Value (aNodeIter);
+        BinTools::PutReal(OS, aPnt.X());
+        BinTools::PutReal(OS, aPnt.Y());
+        BinTools::PutReal(OS, aPnt.Z());
       }
       }
-    
-      if (T->HasUVNodes()) {
-       const TColgp_Array1OfPnt2d& UVNodes = T->UVNodes();
-       for (j = 1; j <= nbNodes; j++) {
-         BinTools::PutReal(OS, UVNodes(j).X());
-         BinTools::PutReal(OS, UVNodes(j).Y());
-       }
+
+      if (aTriangulation->HasUVNodes())
+      {
+        const TColgp_Array1OfPnt2d& aUVNodes = aTriangulation->UVNodes();
+        for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+        {
+          const gp_Pnt2d aUV = aUVNodes.Value (aNodeIter);
+          BinTools::PutReal(OS, aUV.X());
+          BinTools::PutReal(OS, aUV.Y());
+        }
       }
       }
-      nbTriangles = T->NbTriangles();
-      const Poly_Array1OfTriangle& Triangles = T->Triangles();
-      for (j = 1; j <= nbTriangles; j++) {
-       Triangles(j).Get(n1, n2, n3);
-       BinTools::PutInteger(OS, n1);
-       BinTools::PutInteger(OS, n2);
-       BinTools::PutInteger(OS, n3);
+
+      const Poly_Array1OfTriangle& aTriangles = aTriangulation->Triangles();
+      for (Standard_Integer aTriIter = 1; aTriIter <= aNbTriangles; ++aTriIter)
+      {
+        const Poly_Triangle& aTri = aTriangles.Value (aTriIter);
+        BinTools::PutInteger(OS, aTri.Value (1));
+        BinTools::PutInteger(OS, aTri.Value (2));
+        BinTools::PutInteger(OS, aTri.Value (3));
       }
     }
   }
       }
     }
   }
-  catch(Standard_Failure const& anException) {
+  catch (Standard_Failure const& anException)
+  {
     Standard_SStream aMsg;
     Standard_SStream aMsg;
-    aMsg << "EXCEPTION in BinTools_ShapeSet::WriteTriangulation(..)" << std::endl;
-    aMsg << anException << std::endl;
+    aMsg << "EXCEPTION in BinTools_ShapeSet::WriteTriangulation(..)\n" << anException << "\n";
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 
 //=======================================================================
 //function : ReadTriangulation
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
 
 //=======================================================================
 //function : ReadTriangulation
-//purpose  : 
+//purpose  :
 //=======================================================================
 //=======================================================================
-
-void BinTools_ShapeSet::ReadTriangulation(Standard_IStream& IS)
+void BinTools_ShapeSet::ReadTriangulation (Standard_IStream& IS)
 {
 {
-  char buffer[255];
-  Standard_Integer i, j, nbtri =0;
-  Standard_Real d, x, y, z;
-  Standard_Integer nbNodes =0, nbTriangles=0;
-  Standard_Boolean hasUV = Standard_False;
-
-  Handle(Poly_Triangulation) T;
-  IS >> buffer;
-
-  if (IS.fail() || (strstr(buffer,"Triangulations") == NULL)) {
+  char aHeader[255];
+  IS >> aHeader;
+  if (IS.fail() || (strstr(aHeader, "Triangulations") == NULL))
+  {
     throw Standard_Failure("BinTools_ShapeSet::Triangulation: Not a Triangulation section");
   }
     throw Standard_Failure("BinTools_ShapeSet::Triangulation: Not a Triangulation section");
   }
-  IS >> nbtri;
+
+  Standard_Integer aNbTriangulations = 0;
+  IS >> aNbTriangulations;
   IS.get();// remove LF 
 
   IS.get();// remove LF 
 
-  try {
+  try
+  {
     OCC_CATCH_SIGNALS
     OCC_CATCH_SIGNALS
-    for (i=1; i<=nbtri; i++) {
-      BinTools::GetInteger(IS, nbNodes);
-      BinTools::GetInteger(IS, nbTriangles);
-      TColgp_Array1OfPnt Nodes(1, nbNodes);
+    for (Standard_Integer aTriangulationIter = 1; aTriangulationIter <= aNbTriangulations; ++aTriangulationIter)
+    {
+      Standard_Integer aNbNodes = 0, aNbTriangles = 0;
+      Standard_Boolean hasUV = Standard_False;
+      Standard_Real aDefl = 0.0;
+      BinTools::GetInteger(IS, aNbNodes);
+      BinTools::GetInteger(IS, aNbTriangles);
       BinTools::GetBool(IS, hasUV);
       BinTools::GetBool(IS, hasUV);
-      TColgp_Array1OfPnt2d UVNodes(1, nbNodes);
-      BinTools::GetReal(IS, d); //deflection
-      for (j = 1; j <= nbNodes; j++) {
-       BinTools::GetReal(IS, x);
-       BinTools::GetReal(IS, y);
-       BinTools::GetReal(IS, z);
-       Nodes(j).SetCoord(x,y,z);
+      BinTools::GetReal(IS, aDefl); //deflection
+      Handle(Poly_Triangulation) aTriangulation = new Poly_Triangulation (aNbNodes, aNbTriangles, hasUV);
+      aTriangulation->Deflection (aDefl);
+
+      TColgp_Array1OfPnt& aNodes = aTriangulation->ChangeNodes();
+      for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+      {
+        Standard_Real* anXYZ = aNodes.ChangeValue (aNodeIter).ChangeCoord().ChangeData();
+        BinTools::GetReal(IS, anXYZ[0]);
+        BinTools::GetReal(IS, anXYZ[1]);
+        BinTools::GetReal(IS, anXYZ[2]);
       }
       }
-      
-      if (hasUV) {
-       for (j = 1; j <= nbNodes; j++) {
-         BinTools::GetReal(IS, x);
-         BinTools::GetReal(IS, y);
-         UVNodes(j).SetCoord(x,y);
-       }
+
+      if (hasUV)
+      {
+        TColgp_Array1OfPnt2d& aUVNodes = aTriangulation->ChangeUVNodes();
+        for (Standard_Integer aNodeIter = 1; aNodeIter <= aNbNodes; ++aNodeIter)
+        {
+          gp_XY& anUV = aUVNodes.ChangeValue (aNodeIter).ChangeCoord();
+          BinTools::GetReal(IS, anUV.ChangeCoord (1));
+          BinTools::GetReal(IS, anUV.ChangeCoord (2));
+        }
       }
       }
-      
+
       // read the triangles
       // read the triangles
-      Standard_Integer n1,n2,n3;
-      Poly_Array1OfTriangle Triangles(1, nbTriangles);
-      for (j = 1; j <= nbTriangles; j++) {
-       BinTools::GetInteger(IS, n1);
-       BinTools::GetInteger(IS, n2);
-       BinTools::GetInteger(IS, n3);
-       Triangles(j).Set(n1,n2,n3);
+      Poly_Array1OfTriangle& aTriangles = aTriangulation->ChangeTriangles();
+      for (Standard_Integer aTriIter = 1; aTriIter <= aNbTriangles; ++aTriIter)
+      {
+        Poly_Triangle& aTri = aTriangles.ChangeValue (aTriIter);
+        BinTools::GetInteger(IS, aTri.ChangeValue (1));
+        BinTools::GetInteger(IS, aTri.ChangeValue (2));
+        BinTools::GetInteger(IS, aTri.ChangeValue (3));
       }
       }
-      
-      if (hasUV) T =  new Poly_Triangulation(Nodes,UVNodes,Triangles);
-      else T = new Poly_Triangulation(Nodes,Triangles);      
-      T->Deflection(d);      
-      myTriangulations.Add(T);
+
+      myTriangulations.Add (aTriangulation);
     }
   }
     }
   }
-  catch(Standard_Failure const& anException) {
+  catch (Standard_Failure const& anException)
+  {
     Standard_SStream aMsg;
     Standard_SStream aMsg;
-    aMsg << "EXCEPTION in BinTools_ShapeSet::ReadTriangulation(..)" << std::endl;
-    aMsg << anException << std::endl;
+    aMsg << "EXCEPTION in BinTools_ShapeSet::ReadTriangulation(..)\n" << anException << "\n";
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
     throw Standard_Failure(aMsg.str().c_str());
   }
 }
index 8cfa5d5..6ad63f1 100644 (file)
@@ -171,19 +171,8 @@ public:
   //! be read back by Read.
   Standard_EXPORT void WritePolygonOnTriangulation (Standard_OStream& OS) const;
 
   //! be read back by Read.
   Standard_EXPORT void WritePolygonOnTriangulation (Standard_OStream& OS) const;
 
-
-
-
-protected:
-
-
-
-
-
 private:
 
 private:
 
-
-
   TopTools_IndexedMapOfShape myShapes;
   BinTools_LocationSet myLocations;
   Standard_Integer myFormatNb;
   TopTools_IndexedMapOfShape myShapes;
   BinTools_LocationSet myLocations;
   Standard_Integer myFormatNb;
@@ -191,19 +180,12 @@ private:
   BinTools_SurfaceSet mySurfaces;
   BinTools_CurveSet myCurves;
   BinTools_Curve2dSet myCurves2d;
   BinTools_SurfaceSet mySurfaces;
   BinTools_CurveSet myCurves;
   BinTools_Curve2dSet myCurves2d;
-  TColStd_IndexedMapOfTransient myPolygons2D;
-  TColStd_IndexedMapOfTransient myPolygons3D;
-  TColStd_IndexedMapOfTransient myTriangulations;
-  TColStd_IndexedMapOfTransient myNodes;
+  NCollection_IndexedMap<Handle(Poly_Polygon2D), TColStd_MapTransientHasher> myPolygons2D;
+  NCollection_IndexedMap<Handle(Poly_Polygon3D), TColStd_MapTransientHasher> myPolygons3D;
+  NCollection_IndexedMap<Handle(Poly_Triangulation), TColStd_MapTransientHasher> myTriangulations;
+  NCollection_IndexedMap<Handle(Poly_PolygonOnTriangulation), TColStd_MapTransientHasher> myNodes;
   Standard_Boolean myWithTriangles;
 
   Standard_Boolean myWithTriangles;
 
-
 };
 
 };
 
-
-
-
-
-
-
 #endif // _BinTools_ShapeSet_HeaderFile
 #endif // _BinTools_ShapeSet_HeaderFile
index 8dcf5c3..95afd0e 100644 (file)
@@ -805,7 +805,7 @@ static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, con
         k1 = n1+totalnodes;
         k2 = n2+totalnodes;
         k3 = n3+totalnodes;
         k1 = n1+totalnodes;
         k2 = n2+totalnodes;
         k3 = n3+totalnodes;
-        fprintf(outfile, "%s %d%s%d %d%s%d %d%s%d\n", "fo", k1,"//", k1, k2,"//", k2, k3,"//", k3);
+        fprintf(outfile, "f %d%s%d %d%s%d %d%s%d\n", k1,"//", k1, k2,"//", k2, k3,"//", k3);
       }
       nbpolygons += nbTriangles;
       totalnodes += nbNodes;
       }
       nbpolygons += nbTriangles;
       totalnodes += nbNodes;
index 3d22dcd..53661cd 100755 (executable)
@@ -19,15 +19,10 @@ Poly_MakeLoops.cxx
 Poly_MakeLoops.hxx
 Poly_Polygon2D.cxx
 Poly_Polygon2D.hxx
 Poly_MakeLoops.hxx
 Poly_Polygon2D.cxx
 Poly_Polygon2D.hxx
-Poly_Polygon2D.lxx
 Poly_Polygon3D.cxx
 Poly_Polygon3D.hxx
 Poly_Polygon3D.cxx
 Poly_Polygon3D.hxx
-Poly_Polygon3D.lxx
 Poly_PolygonOnTriangulation.cxx
 Poly_PolygonOnTriangulation.hxx
 Poly_PolygonOnTriangulation.cxx
 Poly_PolygonOnTriangulation.hxx
-Poly_PolygonOnTriangulation.lxx
-Poly_Triangle.cxx
 Poly_Triangle.hxx
 Poly_Triangle.hxx
-Poly_Triangle.lxx
 Poly_Triangulation.cxx
 Poly_Triangulation.hxx
 Poly_Triangulation.cxx
 Poly_Triangulation.hxx
index 4e6fc62..a83fab4 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
-#include <gp_Pnt2d.hxx>
 #include <Poly_Polygon2D.hxx>
 #include <Poly_Polygon2D.hxx>
-#include <Standard_NullObject.hxx>
-#include <Standard_Type.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
 
 //=======================================================================
 //function : Poly_Polygon2D
 
 IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
 
 //=======================================================================
 //function : Poly_Polygon2D
-//purpose  : 
+//purpose  :
+//=======================================================================
+Poly_Polygon2D::Poly_Polygon2D (const Standard_Integer theNbNodes)
+: myDeflection (0.0),
+  myNodes (1, theNbNodes)
+{
+  //
+}
+
+//=======================================================================
+//function : Poly_Polygon2D
+//purpose  :
 //=======================================================================
 Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes): 
     myDeflection(0.),
 //=======================================================================
 Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes): 
     myDeflection(0.),
@@ -34,35 +41,3 @@ Poly_Polygon2D::Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes):
   for (i = Nodes.Lower(); i <= Nodes.Upper(); i++)
     myNodes(j++) = Nodes(i);
 }
   for (i = Nodes.Lower(); i <= Nodes.Upper(); i++)
     myNodes(j++) = Nodes(i);
 }
-
-//=======================================================================
-//function : Deflection
-//purpose  : 
-//=======================================================================
-
-Standard_Real Poly_Polygon2D::Deflection() const 
-{
-  return myDeflection;
-}
-
-//=======================================================================
-//function : Deflection
-//purpose  : 
-//=======================================================================
-
-void Poly_Polygon2D::Deflection(const Standard_Real D)
-{
-  myDeflection = D;
-}
-
-//=======================================================================
-//function : Nodes
-//purpose  : 
-//=======================================================================
-
-const TColgp_Array1OfPnt2d& Poly_Polygon2D::Nodes() const 
-{
-  return myNodes;
-}
-
-
index 6e7d3dc..9a91fde 100644 (file)
 #ifndef _Poly_Polygon2D_HeaderFile
 #define _Poly_Polygon2D_HeaderFile
 
 #ifndef _Poly_Polygon2D_HeaderFile
 #define _Poly_Polygon2D_HeaderFile
 
-#include <Standard.hxx>
 #include <Standard_Type.hxx>
 #include <Standard_Type.hxx>
-
-#include <Standard_Real.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <Standard_Transient.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <Standard_Transient.hxx>
-#include <Standard_Integer.hxx>
-class Standard_NullObject;
-
 
 
-class Poly_Polygon2D;
 DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
 
 //! Provides a polygon in 2D space (for example, in the
 DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
 
 //! Provides a polygon in 2D space (for example, in the
@@ -38,13 +31,14 @@ DEFINE_STANDARD_HANDLE(Poly_Polygon2D, Standard_Transient)
 //! repeated at the end of the table of nodes.
 class Poly_Polygon2D : public Standard_Transient
 {
 //! repeated at the end of the table of nodes.
 class Poly_Polygon2D : public Standard_Transient
 {
-
 public:
 
 public:
 
-  
+  //! Constructs a 2D polygon with specified number of nodes.
+  Standard_EXPORT explicit Poly_Polygon2D (const Standard_Integer theNbNodes);
+
   //! Constructs a 2D polygon defined by the table of points, <Nodes>.
   Standard_EXPORT Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes);
   //! Constructs a 2D polygon defined by the table of points, <Nodes>.
   Standard_EXPORT Poly_Polygon2D(const TColgp_Array1OfPnt2d& Nodes);
-  
+
   //! Returns the deflection of this polygon.
   //! Deflection is used in cases where the polygon is an
   //! approximate representation of a curve. Deflection
   //! Returns the deflection of this polygon.
   //! Deflection is used in cases where the polygon is an
   //! approximate representation of a curve. Deflection
@@ -64,44 +58,30 @@ public:
   //! deflection to each polygon. In this case, the Deflection
   //! function is used to set a value on each polygon, and
   //! later to fetch the value.
   //! deflection to each polygon. In this case, the Deflection
   //! function is used to set a value on each polygon, and
   //! later to fetch the value.
-  Standard_EXPORT Standard_Real Deflection() const;
-  
-  //! Sets the deflection of this polygon to D
-  Standard_EXPORT void Deflection (const Standard_Real D);
-  
+  Standard_Real Deflection() const { return myDeflection; }
+
+  //! Sets the deflection of this polygon.
+  void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
+
   //! Returns the number of nodes in this polygon.
   //! Note: If the polygon is closed, the point of closure is
   //! repeated at the end of its table of nodes. Thus, on a closed
   //! triangle, the function NbNodes returns 4.
   //! Returns the number of nodes in this polygon.
   //! Note: If the polygon is closed, the point of closure is
   //! repeated at the end of its table of nodes. Thus, on a closed
   //! triangle, the function NbNodes returns 4.
-    Standard_Integer NbNodes() const;
-  
-  //! Returns the table of nodes for this polygon.
-  Standard_EXPORT const TColgp_Array1OfPnt2d& Nodes() const;
-
+  Standard_Integer NbNodes() const { return myNodes.Length(); }
 
 
+  //! Returns the table of nodes for this polygon.
+  const TColgp_Array1OfPnt2d& Nodes() const { return myNodes; }
 
 
+  //! Returns the table of nodes for this polygon.
+  TColgp_Array1OfPnt2d& ChangeNodes() { return myNodes; }
 
   DEFINE_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
 
 
   DEFINE_STANDARD_RTTIEXT(Poly_Polygon2D,Standard_Transient)
 
-protected:
-
-
-
-
 private:
 
 private:
 
-
   Standard_Real myDeflection;
   TColgp_Array1OfPnt2d myNodes;
 
   Standard_Real myDeflection;
   TColgp_Array1OfPnt2d myNodes;
 
-
 };
 
 };
 
-
-#include <Poly_Polygon2D.lxx>
-
-
-
-
-
 #endif // _Poly_Polygon2D_HeaderFile
 #endif // _Poly_Polygon2D_HeaderFile
diff --git a/src/Poly/Poly_Polygon2D.lxx b/src/Poly/Poly_Polygon2D.lxx
deleted file mode 100644 (file)
index 10de878..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Created on: 1995-03-09
-// Created by: Laurent PAINNOT
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : NbNodes
-//purpose  : 
-//=======================================================================
-
-inline Standard_Integer Poly_Polygon2D::NbNodes() const 
-{
-  return myNodes.Length();
-}
-
index a4f2881..b7deae9 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
-#include <gp_Pnt.hxx>
 #include <Poly_Polygon3D.hxx>
 #include <Poly_Polygon3D.hxx>
-#include <Standard_NullObject.hxx>
-#include <Standard_Type.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
 
 
 IMPLEMENT_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
 
+//=======================================================================
+//function : Poly_Polygon3D
+//purpose  :
+//=======================================================================
+Poly_Polygon3D::Poly_Polygon3D (const Standard_Integer theNbNodes,
+                                const Standard_Boolean theHasParams)
+: myDeflection (0.0),
+  myNodes (1, theNbNodes)
+{
+  if (theHasParams)
+  {
+    myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
+  }
+}
+
 //=======================================================================
 //function : Poly_Polygon3D
 //purpose  : 
 //=======================================================================
 //function : Poly_Polygon3D
 //purpose  : 
@@ -70,67 +81,3 @@ Handle(Poly_Polygon3D) Poly_Polygon3D::Copy() const
   aCopy->Deflection(myDeflection);
   return aCopy;
 }
   aCopy->Deflection(myDeflection);
   return aCopy;
 }
-
-
-//=======================================================================
-//function : Deflection
-//purpose  : 
-//=======================================================================
-
-Standard_Real Poly_Polygon3D::Deflection() const 
-{
-  return myDeflection;
-}
-
-//=======================================================================
-//function : Deflection
-//purpose  : 
-//=======================================================================
-
-void Poly_Polygon3D::Deflection(const Standard_Real D)
-{
-  myDeflection = D;
-}
-
-//=======================================================================
-//function : Nodes
-//purpose  : 
-//=======================================================================
-
-const TColgp_Array1OfPnt& Poly_Polygon3D::Nodes() const 
-{
-  return myNodes;
-}
-
-//=======================================================================
-//function : HasParameters
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Poly_Polygon3D::HasParameters() const 
-{
-  return !myParameters.IsNull();
-}
-
-
-//=======================================================================
-//function : Parameters
-//purpose  : 
-//=======================================================================
-
-const TColStd_Array1OfReal& Poly_Polygon3D::Parameters() const 
-{
-  return myParameters->Array1();
-}
-
-//=======================================================================
-//function : ChangeParameters
-//purpose  : 
-//=======================================================================
-
-TColStd_Array1OfReal& Poly_Polygon3D::ChangeParameters() const 
-{
-  return myParameters->ChangeArray1();
-}
-
-
index da57e39..e91f930 100644 (file)
 #ifndef _Poly_Polygon3D_HeaderFile
 #define _Poly_Polygon3D_HeaderFile
 
 #ifndef _Poly_Polygon3D_HeaderFile
 #define _Poly_Polygon3D_HeaderFile
 
-#include <Standard.hxx>
 #include <Standard_Type.hxx>
 #include <Standard_Type.hxx>
-
-#include <Standard_Real.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColStd_HArray1OfReal.hxx>
 #include <Standard_Transient.hxx>
 #include <Standard_Transient.hxx>
+#include <TColgp_Array1OfPnt.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_Array1OfReal.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_NullObject;
-
+#include <TColStd_HArray1OfReal.hxx>
 
 
-class Poly_Polygon3D;
 DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
 
 //! This class Provides a polygon in 3D space. It is generally an approximate representation of a curve.
 DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
 
 //! This class Provides a polygon in 3D space. It is generally an approximate representation of a curve.
@@ -42,11 +34,13 @@ DEFINE_STANDARD_HANDLE(Poly_Polygon3D, Standard_Transient)
 //! parameter of the corresponding point on the curve.
 class Poly_Polygon3D : public Standard_Transient
 {
 //! parameter of the corresponding point on the curve.
 class Poly_Polygon3D : public Standard_Transient
 {
-
 public:
 
 public:
 
-  
-  //! onstructs a 3D polygon defined by the table of points, Nodes.
+  //! Constructs a 3D polygon with specific number of nodes.
+  Standard_EXPORT Poly_Polygon3D (const Standard_Integer theNbNodes,
+                                  const Standard_Boolean theHasParams);
+
+  //! Constructs a 3D polygon defined by the table of points, Nodes.
   Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
   
   //! Constructs a 3D polygon defined by
   Standard_EXPORT Poly_Polygon3D(const TColgp_Array1OfPnt& Nodes);
   
   //! Constructs a 3D polygon defined by
@@ -63,59 +57,45 @@ public:
   Standard_EXPORT virtual Handle(Poly_Polygon3D) Copy() const;
   
   //! Returns the deflection of this polygon
   Standard_EXPORT virtual Handle(Poly_Polygon3D) Copy() const;
   
   //! Returns the deflection of this polygon
-  Standard_EXPORT Standard_Real Deflection() const;
-  
-  //! Sets the deflection of this polygon to D. See more on deflection in Poly_Polygon2D
-  Standard_EXPORT void Deflection (const Standard_Real D);
+  Standard_Real Deflection() const { return myDeflection; }
+
+  //! Sets the deflection of this polygon. See more on deflection in Poly_Polygon2D
+  void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
   
   //! Returns the number of nodes in this polygon.
   //! Note: If the polygon is closed, the point of closure is
   //! repeated at the end of its table of nodes. Thus, on a closed
   //! triangle the function NbNodes returns 4.
   
   //! Returns the number of nodes in this polygon.
   //! Note: If the polygon is closed, the point of closure is
   //! repeated at the end of its table of nodes. Thus, on a closed
   //! triangle the function NbNodes returns 4.
-    Standard_Integer NbNodes() const;
-  
+  Standard_Integer NbNodes() const { return myNodes.Length(); }
+
   //! Returns the table of nodes for this polygon.
   //! Returns the table of nodes for this polygon.
-  Standard_EXPORT const TColgp_Array1OfPnt& Nodes() const;
-  
+  const TColgp_Array1OfPnt& Nodes() const { return myNodes; }
+
+  //! Returns the table of nodes for this polygon.
+  TColgp_Array1OfPnt& ChangeNodes() { return myNodes; }
+
   //! Returns the table of the parameters associated with each node in this polygon.
   //! HasParameters function checks if   parameters are associated with the nodes of this polygon.
   //! Returns the table of the parameters associated with each node in this polygon.
   //! HasParameters function checks if   parameters are associated with the nodes of this polygon.
-  Standard_EXPORT Standard_Boolean HasParameters() const;
+  Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
   
   //! Returns true if parameters are associated with the nodes
   //! in this polygon.
   
   //! Returns true if parameters are associated with the nodes
   //! in this polygon.
-  Standard_EXPORT const TColStd_Array1OfReal& Parameters() const;
-  
+  const TColStd_Array1OfReal& Parameters() const { return myParameters->Array1(); }
+
   //! Returns the table of the parameters associated with each node in this polygon.
   //! ChangeParameters function returnes the  array as shared. Therefore if the table is selected by
   //! reference you can, by simply modifying it, directly modify
   //! the data structure of this polygon.
   //! Returns the table of the parameters associated with each node in this polygon.
   //! ChangeParameters function returnes the  array as shared. Therefore if the table is selected by
   //! reference you can, by simply modifying it, directly modify
   //! the data structure of this polygon.
-  Standard_EXPORT TColStd_Array1OfReal& ChangeParameters() const;
-
-
-
+  TColStd_Array1OfReal& ChangeParameters() const { return myParameters->ChangeArray1(); }
 
   DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
 
 
   DEFINE_STANDARD_RTTIEXT(Poly_Polygon3D,Standard_Transient)
 
-protected:
-
-
-
-
 private:
 
 private:
 
-
   Standard_Real myDeflection;
   TColgp_Array1OfPnt myNodes;
   Handle(TColStd_HArray1OfReal) myParameters;
 
   Standard_Real myDeflection;
   TColgp_Array1OfPnt myNodes;
   Handle(TColStd_HArray1OfReal) myParameters;
 
-
 };
 
 };
 
-
-#include <Poly_Polygon3D.lxx>
-
-
-
-
-
 #endif // _Poly_Polygon3D_HeaderFile
 #endif // _Poly_Polygon3D_HeaderFile
diff --git a/src/Poly/Poly_Polygon3D.lxx b/src/Poly/Poly_Polygon3D.lxx
deleted file mode 100644 (file)
index d87a5a6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Created on: 1995-03-09
-// Created by: Laurent PAINNOT
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : NbNodes
-//purpose  : 
-//=======================================================================
-
-inline Standard_Integer Poly_Polygon3D::NbNodes() const 
-{
-  return myNodes.Length();
-}
-
index 989c3c1..5dfaee9 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <Poly_PolygonOnTriangulation.hxx>
 #include <Poly_PolygonOnTriangulation.hxx>
-#include <Standard_NullObject.hxx>
-#include <Standard_Type.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
 
 
 IMPLEMENT_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
 
+//=======================================================================
+//function : Poly_PolygonOnTriangulation
+//purpose  :
+//=======================================================================
+Poly_PolygonOnTriangulation::Poly_PolygonOnTriangulation (const Standard_Integer theNbNodes,
+                                                          const Standard_Boolean theHasParams)
+: myDeflection (0.0),
+  myNodes (1, theNbNodes)
+{
+  if (theHasParams)
+  {
+    myParameters = new TColStd_HArray1OfReal (1, theNbNodes);
+  }
+}
+
 //=======================================================================
 //function : Poly_PolygonOnTriangulation
 //purpose  : 
 //=======================================================================
 //function : Poly_PolygonOnTriangulation
 //purpose  : 
@@ -66,53 +78,16 @@ Handle(Poly_PolygonOnTriangulation) Poly_PolygonOnTriangulation::Copy() const
 }
 
 //=======================================================================
 }
 
 //=======================================================================
-//function : Deflection
-//purpose  : 
-//=======================================================================
-
-Standard_Real Poly_PolygonOnTriangulation::Deflection() const 
-{
-  return myDeflection;
-}
-
-//=======================================================================
-//function : Deflection
-//purpose  : 
+//function : SetParameters
+//purpose  :
 //=======================================================================
 //=======================================================================
-
-void Poly_PolygonOnTriangulation::Deflection(const Standard_Real D)
+void Poly_PolygonOnTriangulation::SetParameters (const Handle(TColStd_HArray1OfReal)& theParameters)
 {
 {
-  myDeflection  = D;
+  if (!theParameters.IsNull()
+   && (theParameters->Lower() != myNodes.Lower()
+    || theParameters->Upper() != myNodes.Upper()))
+  {
+    throw Standard_OutOfRange ("Poly_PolygonOnTriangulation::SetParameters() - invalid array size");
+  }
+  myParameters = theParameters;
 }
 }
-
-//=======================================================================
-//function : Nodes
-//purpose  : 
-//=======================================================================
-
-const TColStd_Array1OfInteger& Poly_PolygonOnTriangulation::Nodes() const 
-{
-  return myNodes;
-}
-
-
-//=======================================================================
-//function : HasParameters
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean Poly_PolygonOnTriangulation::HasParameters() const 
-{
-  return (!myParameters.IsNull());
-}
-
-//=======================================================================
-//function : Parameters
-//purpose  : 
-//=======================================================================
-
-Handle(TColStd_HArray1OfReal) Poly_PolygonOnTriangulation::Parameters() const 
-{
-  return myParameters;
-}
-
index d12424a..a95e6d2 100644 (file)
 #ifndef _Poly_PolygonOnTriangulation_HeaderFile
 #define _Poly_PolygonOnTriangulation_HeaderFile
 
 #ifndef _Poly_PolygonOnTriangulation_HeaderFile
 #define _Poly_PolygonOnTriangulation_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
 
 
-#include <Standard_Real.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_HArray1OfReal.hxx>
+#include <Standard_Type.hxx>
 #include <Standard_Transient.hxx>
 #include <Standard_Transient.hxx>
+#include <TColStd_Array1OfInteger.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_Array1OfReal.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_NullObject;
-
+#include <TColStd_HArray1OfReal.hxx>
 
 
-class Poly_PolygonOnTriangulation;
 DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
 
 //! This class provides a polygon in 3D space, based on the triangulation
 DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
 
 //! This class provides a polygon in 3D space, based on the triangulation
@@ -47,14 +40,15 @@ DEFINE_STANDARD_HANDLE(Poly_PolygonOnTriangulation, Standard_Transient)
 //! curve.represents a 3d Polygon
 class Poly_PolygonOnTriangulation : public Standard_Transient
 {
 //! curve.represents a 3d Polygon
 class Poly_PolygonOnTriangulation : public Standard_Transient
 {
-
 public:
 
 public:
 
-  
+  //! Constructs a 3D polygon on the triangulation of a shape with specified size of nodes.
+  Standard_EXPORT Poly_PolygonOnTriangulation (const Standard_Integer theNbNodes,
+                                               const Standard_Boolean theHasParams);
+
   //! Constructs a 3D polygon on the triangulation of a shape,
   //! defined by the table of nodes, <Nodes>.
   Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes);
   //! Constructs a 3D polygon on the triangulation of a shape,
   //! defined by the table of nodes, <Nodes>.
   Standard_EXPORT Poly_PolygonOnTriangulation(const TColStd_Array1OfInteger& Nodes);
-  
 
   //! Constructs a 3D polygon on the triangulation of a shape, defined by:
   //! -   the table of nodes, Nodes, and the table of parameters, <Parameters>.
 
   //! Constructs a 3D polygon on the triangulation of a shape, defined by:
   //! -   the table of nodes, Nodes, and the table of parameters, <Parameters>.
@@ -73,59 +67,51 @@ public:
   Standard_EXPORT virtual Handle(Poly_PolygonOnTriangulation) Copy() const;
 
   //! Returns the deflection of this polygon
   Standard_EXPORT virtual Handle(Poly_PolygonOnTriangulation) Copy() const;
 
   //! Returns the deflection of this polygon
-  Standard_EXPORT Standard_Real Deflection() const;
-  
-  //! Sets the deflection of this polygon to D.
+  Standard_Real Deflection() const { return myDeflection; }
+
+  //! Sets the deflection of this polygon.
   //! See more on deflection in Poly_Polygones2D.
   //! See more on deflection in Poly_Polygones2D.
-  Standard_EXPORT void Deflection (const Standard_Real D);
-  
+  void Deflection (const Standard_Real theDefl) { myDeflection = theDefl; }
 
   //! Returns the number of nodes for this polygon.
   //! Note: If the polygon is closed, the point of closure is
   //! repeated at the end of its table of nodes. Thus, on a closed
   //! triangle, the function NbNodes returns 4.
 
   //! Returns the number of nodes for this polygon.
   //! Note: If the polygon is closed, the point of closure is
   //! repeated at the end of its table of nodes. Thus, on a closed
   //! triangle, the function NbNodes returns 4.
-    Standard_Integer NbNodes() const;
-  
+  Standard_Integer NbNodes() const { return myNodes.Length(); }
+
   //! Returns the table of nodes for this polygon. A node value
   //! is an index in the table of nodes specific to an existing
   //! triangulation of a shape.
   //! Returns the table of nodes for this polygon. A node value
   //! is an index in the table of nodes specific to an existing
   //! triangulation of a shape.
-  Standard_EXPORT const TColStd_Array1OfInteger& Nodes() const;
-  
+  const TColStd_Array1OfInteger& Nodes() const { return myNodes; }
+
+  //! Returns the table of nodes for this polygon for modification.
+  TColStd_Array1OfInteger& ChangeNodes() { return myNodes; }
 
   //! Returns true if parameters are associated with the nodes in this polygon.
 
   //! Returns true if parameters are associated with the nodes in this polygon.
-  Standard_EXPORT Standard_Boolean HasParameters() const;
-  
+  Standard_Boolean HasParameters() const { return !myParameters.IsNull(); }
+
   //! Returns the table of the parameters associated with each node in this polygon.
   //! Warning
   //! Use the function HasParameters to check if parameters
   //! are associated with the nodes in this polygon.
   //! Returns the table of the parameters associated with each node in this polygon.
   //! Warning
   //! Use the function HasParameters to check if parameters
   //! are associated with the nodes in this polygon.
-  Standard_EXPORT Handle(TColStd_HArray1OfReal) Parameters() const;
-
+  const Handle(TColStd_HArray1OfReal)& Parameters() const { return myParameters; }
 
 
+  //! Returns the table of the parameters associated with each node in this polygon.
+  //! Warning! HasParameters() should be called beforehand to check if parameters array is allocated.
+  TColStd_Array1OfReal& ChangeParameters() { return myParameters->ChangeArray1(); }
 
 
+  //! Sets the table of the parameters associated with each node in this polygon.
+  //! Raises exception if array size doesn't much number of polygon nodes.
+  Standard_EXPORT void SetParameters (const Handle(TColStd_HArray1OfReal)& theParameters);
 
   DEFINE_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
 
 
   DEFINE_STANDARD_RTTIEXT(Poly_PolygonOnTriangulation,Standard_Transient)
 
-protected:
-
-
-
-
 private:
 
 private:
 
-
   Standard_Real myDeflection;
   TColStd_Array1OfInteger myNodes;
   Handle(TColStd_HArray1OfReal) myParameters;
 
   Standard_Real myDeflection;
   TColStd_Array1OfInteger myNodes;
   Handle(TColStd_HArray1OfReal) myParameters;
 
-
 };
 
 };
 
-
-#include <Poly_PolygonOnTriangulation.lxx>
-
-
-
-
-
 #endif // _Poly_PolygonOnTriangulation_HeaderFile
 #endif // _Poly_PolygonOnTriangulation_HeaderFile
diff --git a/src/Poly/Poly_PolygonOnTriangulation.lxx b/src/Poly/Poly_PolygonOnTriangulation.lxx
deleted file mode 100644 (file)
index ee9237a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 1996-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : NbNodes
-//purpose  : 
-//=======================================================================
-
-inline Standard_Integer Poly_PolygonOnTriangulation::NbNodes() const 
-{
-  return myNodes.Length();
-}
-
diff --git a/src/Poly/Poly_Triangle.cxx b/src/Poly/Poly_Triangle.cxx
deleted file mode 100644 (file)
index 21f9993..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// Created on: 1995-03-06
-// Created by: Laurent PAINNOT
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Poly_Triangle.hxx>
-#include <Standard_OutOfRange.hxx>
-
-//=======================================================================
-//function : Poly_Triangle
-//purpose  : 
-//=======================================================================
-Poly_Triangle::Poly_Triangle()
-{
-  myNodes[0] =  myNodes[1] = myNodes[2] = 0;
-}
-
-//=======================================================================
-//function : Poly_Triangle
-//purpose  : 
-//=======================================================================
-
-Poly_Triangle::Poly_Triangle(const Standard_Integer N1,
-                            const Standard_Integer N2, 
-                            const Standard_Integer N3)
-{
-  myNodes[0] = N1;
-  myNodes[1] = N2;
-  myNodes[2] = N3;
-}
-
-//=======================================================================
-//function : Set
-//purpose  : 
-//=======================================================================
-
-void Poly_Triangle::Set(const Standard_Integer N1, 
-                       const Standard_Integer N2, 
-                       const Standard_Integer N3)
-{
-  myNodes[0] = N1;
-  myNodes[1] = N2;
-  myNodes[2] = N3;
-}
-
-//=======================================================================
-//function : Get
-//purpose  : 
-//=======================================================================
-
-void Poly_Triangle::Get(Standard_Integer& N1, 
-                       Standard_Integer& N2, 
-                       Standard_Integer& N3) const 
-{
-  N1 = myNodes[0];
-  N2 = myNodes[1];
-  N3 = myNodes[2];
-}
-
index 9722440..b00ff5f 100644 (file)
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
-
 #include <Standard_Integer.hxx>
 #include <Standard_Integer.hxx>
-class Standard_OutOfRange;
-
+#include <Standard_OutOfRange.hxx>
 
 
-//! Describes a component triangle of a triangulation
-//! (Poly_Triangulation object).
-//! A Triangle is defined by a triplet of nodes. Each node is an
-//! index in the table of nodes specific to an existing
+//! Describes a component triangle of a triangulation (Poly_Triangulation object).
+//! A Triangle is defined by a triplet of nodes.
+//! Each node is an index in the table of nodes specific to an existing
 //! triangulation of a shape, and represents a point on the surface.
 //! triangulation of a shape, and represents a point on the surface.
-class Poly_Triangle 
+class Poly_Triangle
 {
 public:
 
   DEFINE_STANDARD_ALLOC
 
 {
 public:
 
   DEFINE_STANDARD_ALLOC
 
-  
   //! Constructs a triangle and sets all indices to zero.
   //! Constructs a triangle and sets all indices to zero.
-  Standard_EXPORT Poly_Triangle();
-  
-  //! Constructs a triangle and sets its three indices
-  //! to N1, N2 and N3 respectively, where these node values
-  //! are indices in the table of nodes specific to an existing
-  //! triangulation of a shape.
-  Standard_EXPORT Poly_Triangle(const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
-  
-  //! Sets the value of  the three nodes of this triangle to N1, N2 and N3   respectively.
-  Standard_EXPORT void Set (const Standard_Integer N1, const Standard_Integer N2, const Standard_Integer N3);
-  
-  //! Sets the value of  the Indexth node of this triangle to Node.
-  //! Raises OutOfRange if Index is not in 1,2,3
-    void Set (const Standard_Integer Index, const Standard_Integer Node);
-  
-  //! Returns the node indices of this triangle in N1, N2 and N3.
-  Standard_EXPORT void Get (Standard_Integer& N1, Standard_Integer& N2, Standard_Integer& N3) const;
+  Poly_Triangle() { myNodes[0] =  myNodes[1] = myNodes[2] = 0; }
+
+  //! Constructs a triangle and sets its three indices,
+  //! where these node values are indices in the table of nodes specific to an existing triangulation of a shape.
+  Poly_Triangle (const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3)
+  {
+    myNodes[0] = theN1;
+    myNodes[1] = theN2;
+    myNodes[2] = theN3;
+  }
+
+  //! Sets the value of the three nodes of this triangle.
+  void Set (const Standard_Integer theN1, const Standard_Integer theN2, const Standard_Integer theN3)
+  {
+    myNodes[0] = theN1;
+    myNodes[1] = theN2;
+    myNodes[2] = theN3;
+  }
   
   
+  //! Sets the value of node with specified index of this triangle.
+  //! Raises Standard_OutOfRange if index is not in 1,2,3
+  void Set (const Standard_Integer theIndex, const Standard_Integer theNode)
+  {
+    Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::Set(), invalid index");
+    myNodes[theIndex - 1] = theNode;
+  }
+
+  //! Returns the node indices of this triangle.
+  void Get (Standard_Integer& theN1, Standard_Integer& theN2, Standard_Integer& theN3) const
+  {
+    theN1 = myNodes[0];
+    theN2 = myNodes[1];
+    theN3 = myNodes[2];
+  }
+
   //! Get the node of given Index.
   //! Raises OutOfRange from Standard if Index is not in 1,2,3
   //! Get the node of given Index.
   //! Raises OutOfRange from Standard if Index is not in 1,2,3
-    Standard_Integer Value (const Standard_Integer Index) const;
-  Standard_Integer operator() (const Standard_Integer Index) const
-{
-  return Value(Index);
-}
-  
-  //! Get the node of given Index.
-  //! Raises OutOfRange if Index is not in 1,2,3
-    Standard_Integer& ChangeValue (const Standard_Integer Index);
-  Standard_Integer& operator() (const Standard_Integer Index)
-{
-  return ChangeValue(Index);
-}
-
-
-
-
-protected:
-
+  Standard_Integer Value (const Standard_Integer theIndex) const
+  {
+    Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::Value(), invalid index");
+    return myNodes[theIndex - 1];
+  }
 
 
+  Standard_Integer operator() (const Standard_Integer Index) const { return Value(Index); }
 
 
+  //! Get the node of given Index.
+  //! Raises OutOfRange if Index is not in 1,2,3
+  Standard_Integer& ChangeValue (const Standard_Integer theIndex)
+  {
+    Standard_OutOfRange_Raise_if(theIndex < 1 || theIndex > 3, "Poly_Triangle::ChangeValue(), invalid index");
+    return myNodes[theIndex - 1];
+  }
 
 
+  Standard_Integer& operator() (const Standard_Integer Index) { return ChangeValue(Index); }
 
 private:
 
 
 private:
 
-
-
   Standard_Integer myNodes[3];
 
   Standard_Integer myNodes[3];
 
-
 };
 
 };
 
-
-#include <Poly_Triangle.lxx>
-
-
-
-
-
 #endif // _Poly_Triangle_HeaderFile
 #endif // _Poly_Triangle_HeaderFile
diff --git a/src/Poly/Poly_Triangle.lxx b/src/Poly/Poly_Triangle.lxx
deleted file mode 100644 (file)
index fb4c423..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// Created on: 1995-03-06
-// Created by: Laurent PAINNOT
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public 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.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_OutOfRange.hxx>
-
-//=======================================================================
-//function : Set
-//purpose  : 
-//=======================================================================
-
-inline void Poly_Triangle::Set(const Standard_Integer Index, const Standard_Integer Node)
-{
-  Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
-  myNodes[Index-1] = Node;
-}
-
-//=======================================================================
-//function : Value
-//purpose  : 
-//=======================================================================
-
-inline Standard_Integer Poly_Triangle::Value(const Standard_Integer Index) const 
-{
-  Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
-  return myNodes[Index-1];
-}
-
-//=======================================================================
-//function : ChangeValue
-//purpose  : 
-//=======================================================================
-
-inline Standard_Integer& Poly_Triangle::ChangeValue
-(const Standard_Integer Index)
-{
-  Standard_OutOfRange_Raise_if(Index < 1 || Index > 3,NULL);
-  return myNodes[Index-1];
-}
-