IMP  2.0.1
The Integrative Modeling Platform
declare_Geometry.h
Go to the documentation of this file.
1 /**
2  * \file IMP/display/declare_Geometry.h
3  * \brief Implement geometry for the basic shapes from IMP.algebra.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPDISPLAY_DECLARE_GEOMETRY_H
9 #define IMPDISPLAY_DECLARE_GEOMETRY_H
10 
11 #include <IMP/display/display_config.h>
12 #include "Color.h"
13 #include <IMP/base/Object.h>
14 #include <IMP/base/object_macros.h>
16 
17 IMPDISPLAY_BEGIN_NAMESPACE
18 class Geometry;
20 
21 
22 //! The base class for geometry.
23 /** This class doesn't have much to say other than the color.
24 
25  \headerfile geometry.h "IMP/display/geometry.h"
26  */
27 class IMPDISPLAYEXPORT Geometry: public IMP::base::Object
28 {
29  bool has_color_;
30  Color color_;
31 public:
32  //Geometry();
33  Geometry(std::string name);
34  Geometry(Color c, std::string name);
35  //Geometry(Color c);
36  virtual Color get_color() const {
37  IMP_USAGE_CHECK(has_color_, "Color not set");
38  return color_;
39  }
40 
41  virtual bool get_has_color() const {
42  return has_color_;
43  }
44  void set_has_color(bool tf) {
45  has_color_=tf;
46  }
47  void set_color(Color c) {
48  has_color_=true;
49  color_=c;
50  }
51 
52  //! Return a set of geometry composing this one
53  virtual Geometries get_components() const {return Geometries();}
54 
56 };
57 
58 
59 IMPDISPLAY_END_NAMESPACE
60 
61 #endif /* IMPDISPLAY_DECLARE_GEOMETRY_H */