Salome HOME
Update copyrights 2014.
[modules/geom.git] / src / GEOM / GEOM_Object.hxx
1 // Copyright (C) 2007-2014  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 <TDF_Label.hxx>
31 #include <TopoDS_Shape.hxx>
32
33 class GEOM_Object;
34 class Handle(TFunction_Driver);
35 class GEOM_Engine;
36
37 DEFINE_STANDARD_HANDLE( GEOM_Object, GEOM_BaseObject );
38
39 class GEOM_Object : public GEOM_BaseObject
40 {
41  friend class GEOM_Engine;
42  
43  public:
44   struct Color {
45     //! Red component of the color
46     double R;
47     //! Green component of the color
48     double G;
49     //! Blue component  of the color
50     double B;
51   };
52
53  private:
54   GEOM_Object(TDF_Label& theLabel);
55
56  public:
57   Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType);
58   Standard_EXPORT ~GEOM_Object();
59
60   //Finds a GEOM_Object on the label theLabel
61   Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel);
62
63   //Finds a GEOM_Object by a reference, stored on the label theLabel
64   Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel);
65
66   //###########################################################
67   //Access to properties
68   //###########################################################
69
70   //Returns a value (as TopoDS_Shape) of this GEOM_Object
71   Standard_EXPORT TopoDS_Shape GetValue();
72
73   //Sets a color of this GEOM_Object
74   Standard_EXPORT void SetColor(const Color& theColor);
75
76   //Returns a color of this GEOM_Object
77   Standard_EXPORT Color GetColor();
78
79   //Toggles an auto color mode on this GEOM_Object
80   Standard_EXPORT void SetAutoColor(bool theAutoColor);
81
82   //Returns a flag of auto color mode of this GEOM_Object
83   Standard_EXPORT bool GetAutoColor();
84
85   //Sets predefined point marker texture
86   Standard_EXPORT void SetMarkerStd(const Aspect_TypeOfMarker theType, double theSize);
87   
88   //Sets custom point marker texture
89   Standard_EXPORT void SetMarkerTexture(int theTextureId);
90
91   //Gets point marker type
92   Standard_EXPORT Aspect_TypeOfMarker GetMarkerType();
93
94   //Gets point marker scale factor / size
95   Standard_EXPORT double GetMarkerSize();
96
97   //Gets custom marker texture ID
98   Standard_EXPORT int GetMarkerTexture();
99
100   //Unsets point marker
101   Standard_EXPORT void UnsetMarker();
102
103   //###########################################################
104   // Sub-shape methods
105   //###########################################################
106
107   //Returns false if the object is a sub-shape of another object
108   Standard_EXPORT bool IsMainShape();
109
110 public:
111   DEFINE_STANDARD_RTTI( GEOM_Object );
112 };
113
114 #endif