]> OCCT Git - occt-copy.git/commitdiff
0029958: Visualization - add method Graphic3d_ArrayOfPrimitives::AddEdges() taking...
authorkgv <kgv@opencascade.com>
Sat, 14 Jul 2018 10:59:22 +0000 (13:59 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 27 Jul 2018 13:19:09 +0000 (16:19 +0300)
src/AIS/AIS_ColorScale.cxx
src/Graphic3d/Graphic3d_ArrayOfPrimitives.hxx
src/StdPrs/StdPrs_ShadedShape.cxx

index ebcad408893338dc0a4f76a3f611986f8a5d6982..4317fa08c29c52da6e95a6eae3c72448a996c0da 100644 (file)
@@ -55,12 +55,8 @@ namespace
     theTris->AddVertex (gp_Pnt (theXLeft + theSizeX, theYBottom,            0.0), theColorBottom);
     theTris->AddVertex (gp_Pnt (theXLeft,            theYBottom + theSizeY, 0.0), theColorTop);
     theTris->AddVertex (gp_Pnt (theXLeft + theSizeX, theYBottom + theSizeY, 0.0), theColorTop);
-    theTris->AddEdge (aVertIndex);
-    theTris->AddEdge (aVertIndex + 1);
-    theTris->AddEdge (aVertIndex + 2);
-    theTris->AddEdge (aVertIndex + 1);
-    theTris->AddEdge (aVertIndex + 2);
-    theTris->AddEdge (aVertIndex + 3);
+    theTris->AddEdges (aVertIndex,     aVertIndex + 1, aVertIndex + 2);
+    theTris->AddEdges (aVertIndex + 1, aVertIndex + 2, aVertIndex + 3);
   }
 
   //! Compute hue angle from specified value.
index 6e63e59322751135c3a796719dad52208e837c0f..490574872a0f147253ed3d7c4d2cda35ae049681 100644 (file)
@@ -631,6 +631,39 @@ public: //! @name optional array of Indices/Edges for using shared Vertex data
   //! @return the actual edges number
   Standard_EXPORT Standard_Integer AddEdge (const Standard_Integer theVertexIndex);
 
+  //! Convenience method, adds two vertex indices (a segment) in the range [1,VertexNumber()] in the array.
+  //! @return the actual edges number
+  Standard_Integer AddEdges (Standard_Integer theVertexIndex1,
+                             Standard_Integer theVertexIndex2)
+  {
+    AddEdge (theVertexIndex1);
+    return AddEdge (theVertexIndex2);
+  }
+
+  //! Convenience method, adds three vertex indices (a triangle) in the range [1,VertexNumber()] in the array.
+  //! @return the actual edges number
+  Standard_Integer AddEdges (Standard_Integer theVertexIndex1,
+                             Standard_Integer theVertexIndex2,
+                             Standard_Integer theVertexIndex3)
+  {
+    AddEdge (theVertexIndex1);
+    AddEdge (theVertexIndex2);
+    return AddEdge (theVertexIndex3);
+  }
+
+  //! Convenience method, adds four vertex indices (a quad) in the range [1,VertexNumber()] in the array.
+  //! @return the actual edges number
+  Standard_Integer AddEdges (Standard_Integer theVertexIndex1,
+                             Standard_Integer theVertexIndex2,
+                             Standard_Integer theVertexIndex3,
+                             Standard_Integer theVertexIndex4)
+  {
+    AddEdge (theVertexIndex1);
+    AddEdge (theVertexIndex2);
+    AddEdge (theVertexIndex3);
+    return AddEdge (theVertexIndex4);
+  }
+
 public: //! @name optional array of Bounds/Subgroups within primitive array (e.g. restarting primitives / assigning colors)
 
   //! Returns optional bounds buffer.
index 7fda37ccb1a3887072d2d1f29f1acc5e19759899..8f2de978c8e21fb2742b6d6728002b783633c707 100644 (file)
@@ -268,9 +268,9 @@ namespace
         aV1.Cross (aV2);
         if (aV1.SquareMagnitude() > aPreci)
         {
-          anArray->AddEdge (anIndex[0] + aDecal);
-          anArray->AddEdge (anIndex[1] + aDecal);
-          anArray->AddEdge (anIndex[2] + aDecal);
+          anArray->AddEdges (anIndex[0] + aDecal,
+                             anIndex[1] + aDecal,
+                             anIndex[2] + aDecal);
         }
       }
     }