1 // Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
20 #ifndef Model_ResultConstruction_H_
21 #define Model_ResultConstruction_H_
24 #include <ModelAPI_ResultConstruction.h>
27 class ModelAPI_Document;
30 /**\class Model_ResultConstruction
32 * \brief The construction element result of a feature.
34 * Provides a shape that may be displayed in the viewer.
35 * Intermediate, light result that in many cases produces a result on the fly.
37 class Model_ResultConstruction : public ModelAPI_ResultConstruction
39 std::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
40 std::shared_ptr<GeomAPI_Shape> myShape; ///< shape of this result created "on the fly"
42 /// Retuns the parameters of color definition in the resources config manager
43 MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
44 std::string& theDefault);
46 /// By default object is displayed in the object browser.
47 MODEL_EXPORT virtual bool isInHistory();
49 MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
50 /// Returns the shape-result produced by this feature
51 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
53 /// Sets the flag that it must be displayed in history (default is true)
54 MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
56 /// if the construction result may be used as faces, this method returns not zero number of faces
57 /// \param theUpdateNaming is false of keeping the naming structure untouched (on load)
58 MODEL_EXPORT virtual int facesNum(const bool theUpdateNaming = true);
59 /// if the construction result may be used as faces, this method returns face by zero based index
60 MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Face> face(const int theIndex);
61 /// Change the order of faces
63 virtual void setFacesOrder(const std::list<std::shared_ptr<GeomAPI_Face> >& theFaces);
65 /// By default object is not infinite.
66 MODEL_EXPORT virtual bool isInfinite();
67 /// Sets the flag that it is infinite
68 MODEL_EXPORT virtual void setInfinite(const bool theInfinite);
69 /// The construction element may be concealed only by "delete" feature
70 MODEL_EXPORT virtual void setIsConcealed(const bool theValue, const bool theForced = false);
72 /// Updates the shape taking the current value from the data structure, returns true
73 /// if update has been correctly done
74 MODEL_EXPORT virtual bool updateShape();
77 /// Makes a body on the given feature
78 Model_ResultConstruction();
80 /// Stores shape in the data structure to allow identification it by the naming
81 void storeShape(std::shared_ptr<GeomAPI_Shape> theShape);
83 friend class Model_Objects;