Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_FieldStepPrs.cpp
index c09da9f9113f0184d23519f3373c5aa1c857b106..3fb0a1fc672bba0da7d1acbdc6b012e6dc2e419a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -37,9 +37,8 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopExp_Explorer.hxx>
-#include <Prs3d_Root.hxx>
 #include <Graphic3d_Text.hxx>
-
+#include <Graphic3d_AspectText3d.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape);
 
@@ -217,7 +216,7 @@ void PartSet_FieldStepPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
     QStringList aValues = strings();
     AttributeSelectionListPtr aSelList =
       aData->selectionList(CollectionPlugin_Field::SELECTED_ID());
-    Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+    Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
     for (int i = 0; i < aSelList->size(); i++) {
       AttributeSelectionPtr aSelection = aSelList->value(i);
       GeomShapePtr aShapePtr = aSelection->value();
@@ -319,14 +318,12 @@ bool PartSet_FieldStepPrs::computeMassCenter(const TopoDS_Shape& theShape, gp_Pn
     if (!triangulation.IsNull() && triangulation->HasUVNodes()) {
       gp_XY C(0, 0);
       double A = 0;
-      const TColgp_Array1OfPnt2d& uvArray = triangulation->UVNodes();
-      const Poly_Array1OfTriangle&  trias = triangulation->Triangles();
       int n1, n2, n3;
-      for (int iT = trias.Lower(); iT <= trias.Upper(); ++iT) {
-        trias(iT).Get(n1, n2, n3);
-        const gp_Pnt2d& uv1 = uvArray(n1);
-        const gp_Pnt2d& uv2 = uvArray(n2);
-        const gp_Pnt2d& uv3 = uvArray(n3);
+      for (int iT = 1; iT <= triangulation->NbTriangles(); ++iT) {
+        triangulation->Triangle(iT).Get(n1, n2, n3);
+        const gp_Pnt2d& uv1 = triangulation->UVNode(n1);
+        const gp_Pnt2d& uv2 = triangulation->UVNode(n2);
+        const gp_Pnt2d& uv3 = triangulation->UVNode(n3);
         double a = 0.5 * sqrt((uv1.X() - uv3.X()) * (uv2.Y() - uv1.Y()) -
           (uv1.X() - uv2.X()) * (uv3.Y() - uv1.Y()));
         C += (uv1.XY() + uv2.XY() + uv3.XY()) / 3. * a;