Salome HOME
d2b9b1658a102905b412b6960d4391a7b7c8f603
[modules/geom.git] / src / GEOM / GEOM_Object.hxx
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef _GEOM_Object_HeaderFile
24 #define _GEOM_Object_HeaderFile
25
26 #include "GEOM_BaseObject.hxx"
27
28 #include <Aspect_TypeOfMarker.hxx>
29 #include <Standard_GUID.hxx>
30 #include <TColStd_HSequenceOfTransient.hxx>
31 #include <TDF_Label.hxx>
32 #include <TopoDS_Shape.hxx>
33
34 #include <list>
35
36 class GEOM_Object;
37 class TFunction_Driver;
38 class GEOM_Engine;
39
40 DEFINE_STANDARD_HANDLE( GEOM_Object, GEOM_BaseObject )
41
42 class GEOM_Object : public GEOM_BaseObject
43 {
44  friend class GEOM_Engine;
45  
46  public:
47   struct Color {
48     //! Red component of the color
49     double R;
50     //! Green component of the color
51     double G;
52     //! Blue component  of the color
53     double B;
54   };
55
56  private:
57   GEOM_Object(TDF_Label& theLabel);
58
59  public:
60   Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType);
61   Standard_EXPORT ~GEOM_Object();
62
63   //Finds a GEOM_Object on the label theLabel
64   Standard_EXPORT static Handle(GEOM_Object) GetObject(const TDF_Label& theLabel);
65
66   //Finds a GEOM_Object by a reference, stored on the label theLabel
67   Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(const TDF_Label& theLabel);
68
69   //###########################################################
70   //Access to properties
71   //###########################################################
72
73   //Returns a value (as TopoDS_Shape) of this GEOM_Object
74   Standard_EXPORT TopoDS_Shape GetValue();
75
76   //Sets a color of this GEOM_Object
77   Standard_EXPORT void SetColor(const Color& theColor);
78
79   //Returns a color of this GEOM_Object
80   Standard_EXPORT Color GetColor();
81
82   //Toggles an auto color mode on this GEOM_Object
83   Standard_EXPORT void SetAutoColor(bool theAutoColor);
84
85   //Returns a flag of auto color mode of this GEOM_Object
86   Standard_EXPORT bool GetAutoColor();
87
88   //Sets predefined point marker texture
89   Standard_EXPORT void SetMarkerStd(const Aspect_TypeOfMarker theType, double theSize);
90   
91   //Sets custom point marker texture
92   Standard_EXPORT void SetMarkerTexture(int theTextureId);
93
94   //Gets point marker type
95   Standard_EXPORT Aspect_TypeOfMarker GetMarkerType();
96
97   //Gets point marker scale factor / size
98   Standard_EXPORT double GetMarkerSize();
99
100   //Gets custom marker texture ID
101   Standard_EXPORT int GetMarkerTexture();
102
103   //Unsets point marker
104   Standard_EXPORT void UnsetMarker();
105
106   //###########################################################
107   // Sub-shape methods
108   //###########################################################
109
110   //Returns false if the object is a sub-shape of another object
111   Standard_EXPORT bool IsMainShape();
112
113   //Comfort method
114   Standard_EXPORT static Handle(TColStd_HSequenceOfTransient)
115     GetLastFunctions( const std::list< Handle(GEOM_Object) >& theObjects );
116
117 public:
118   DEFINE_STANDARD_RTTIEXT(GEOM_Object,GEOM_BaseObject)
119 };
120
121 #endif