Salome HOME
8ed5405e58c79f47d19ed4aa56afc709612519d9
[modules/shaper.git] / src / PartSet / PartSet_FieldStepPrs.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef PartSet_FieldStepPrs_H
21 #define PartSet_FieldStepPrs_H
22
23 #include "PartSet.h"
24 #include <ModuleBase_IStepPrs.h>
25
26 #include <ModelAPI_ResultField.h>
27 #include <ModelAPI_Feature.h>
28
29 #include <ViewerData_AISShape.hxx>
30 #include <TopoDS_Shape.hxx>
31 #include <gp_Pnt.hxx>
32
33 #include <QList>
34
35 DEFINE_STANDARD_HANDLE(PartSet_FieldStepPrs, ViewerData_AISShape)
36
37 /**
38 * \ingroup GUI
39 * A redefinition of standard AIS Interactive Object in order to provide specific behaviour
40 * for wire presentations based in a one plane
41 */
42 class PartSet_FieldStepPrs : public ViewerData_AISShape, public ModuleBase_IStepPrs
43 {
44 public:
45   /// Constructor
46   /// \param theResult a result object
47   Standard_EXPORT PartSet_FieldStepPrs(FieldStepPtr theStep);
48
49   ModelAPI_AttributeTables::ValueType dataType() const;
50
51   bool dataRange(double& theMin, double& theMax) const;
52
53   DEFINE_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape)
54
55 protected:
56   //! Compute presentation considering sub-shape color map.
57   virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
58     const Handle(Prs3d_Presentation)& thePrs,  const Standard_Integer theMode);
59
60 private:
61   QList<double> range(double& theMin, double& theMax) const;
62   QList<double> booleanValues() const;
63   QStringList strings() const;
64   bool computeMassCenter(const TopoDS_Shape& theShape, gp_Pnt& theCenter);
65
66
67   FieldStepPtr myStep;
68   FeaturePtr myFeature;
69 };
70
71 #endif