]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_FieldStepPrs.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_FieldStepPrs.cpp
index 4d3ed48eec3c18b4388068c6b7571c0883fdaa4a..3fb0a1fc672bba0da7d1acbdc6b012e6dc2e419a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  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
 #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);
 
 #define POINT_SIZE 8
 
 
-void emptyDeleter(ModelAPI_ResultField* theF)
+void emptyDeleter(ModelAPI_ResultField* /*theF*/)
 {
   // Do nothing
 }
@@ -119,6 +118,8 @@ QList<double> PartSet_FieldStepPrs::range(double& theMin, double& theMax) const
       case ModelAPI_AttributeTables::INTEGER:
         aFieldStepData << aVal.myInt;
         break;
+      default: // [to avoid compilation warning]
+        break;
       }
     }
   }
@@ -215,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();
@@ -256,7 +257,6 @@ QList<double> PartSet_FieldStepPrs::booleanValues() const
     }
   }
   QList<double> aShapeData;
-  double aRangeMin = aFieldStepData.first(), aRangeMax = aFieldStepData.last();
   for (int aRow = 0; aRow < aRows - 1; aRow++) {
     double aNorm = 0;
     int aBaseIndex = aRow * aCols;
@@ -318,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;