IMP  2.1.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 //! The base class for geometry.
22 /** This class doesn't have much to say other than the color.
23 
24  \headerfile geometry.h "IMP/display/geometry.h"
25  */
26 class IMPDISPLAYEXPORT Geometry : public IMP::base::Object {
27  bool has_color_;
28  Color color_;
29 
30  public:
31  // Geometry();
32  Geometry(std::string name);
33  Geometry(Color c, std::string name);
34  // Geometry(Color c);
35  virtual Color get_color() const {
36  IMP_USAGE_CHECK(has_color_, "Color not set");
37  return color_;
38  }
39 
40  virtual bool get_has_color() const { return has_color_; }
41  void set_has_color(bool tf) { has_color_ = tf; }
42  void set_color(Color c) {
43  has_color_ = true;
44  color_ = c;
45  }
46 
47  //! Return a set of geometry composing this one
48  virtual Geometries get_components() const { return Geometries(); }
49 
51 };
52 
53 IMPDISPLAY_END_NAMESPACE
54 
55 #endif /* IMPDISPLAY_DECLARE_GEOMETRY_H */
Represent an RGB color.
Definition: Color.h:24
The base class for geometry.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
IMP::base::Vector< IMP::base::Pointer< Geometry > > Geometries
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Various general useful macros for IMP.
Represent a color.
Common base class for heavy weight IMP objects.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
virtual Geometries get_components() const
Return a set of geometry composing this one.
Various general useful macros for IMP.
A shared base class to help in debugging and things.