1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef Model_ResultConstruction_H_
22 #define Model_ResultConstruction_H_
25 #include <ModelAPI_ResultConstruction.h>
28 class ModelAPI_Document;
31 /**\class Model_ResultConstruction
33 * \brief The construction element result of a feature.
35 * Provides a shape that may be displayed in the viewer.
36 * Intermediate, light result that in many cases produces a result on the fly.
38 class Model_ResultConstruction : public ModelAPI_ResultConstruction
40 std::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
41 std::shared_ptr<GeomAPI_Shape> myShape; ///< shape of this result created "on the fly"
43 /// Retuns the parameters of color definition in the resources config manager
44 MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
45 std::string& theDefault);
47 /// By default object is displayed in the object browser.
48 MODEL_EXPORT virtual bool isInHistory();
50 MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
51 /// Returns the shape-result produced by this feature
52 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
54 /// Sets the flag that it must be displayed in history (default is true)
55 MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
57 /// if the construction result may be used as faces, this method returns not zero number of faces
58 /// \param theUpdateNaming is false of keeping the naming structure untouched (on load)
59 MODEL_EXPORT virtual int facesNum(const bool theUpdateNaming = true);
60 /// if the construction result may be used as faces, this method returns face by zero based index
61 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Face> face(const int theIndex);
63 /// By default object is not infinite.
64 MODEL_EXPORT virtual bool isInfinite();
65 /// Sets the flag that it is infinite
66 MODEL_EXPORT virtual void setInfinite(const bool theInfinite);
67 /// The construction element is never concealed
68 MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
70 /// Updates the shape taking the current value from the data structure, returns true
71 /// if update has been correctly done
72 MODEL_EXPORT virtual bool updateShape();
75 /// Makes a body on the given feature
76 Model_ResultConstruction();
78 /// Stores shape in the data structure to allow identification it by the naming
79 void storeShape(std::shared_ptr<GeomAPI_Shape> theShape);
81 friend class Model_Objects;